1/* 2Copyright (c) 1990 The Regents of the University of California. 3All rights reserved. 4 5Redistribution and use in source and binary forms are permitted 6provided that the above copyright notice and this paragraph are 7duplicated in all such forms and that any documentation, 8and/or other materials related to such 9distribution and use acknowledge that the software was developed 10by the University of California, Berkeley. The name of the 11University may not be used to endorse or promote products derived 12from this software without specific prior written permission. 13THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 14IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 15WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 16 */ 17#include <picolibc.h> 18 19 .global ___udivhi3 20 21___udivhi3: 22 stz <r0 23 ldy #1 24 ldx <r4 25 lda <r5 26 27div1: 28 asl a 29 bcs div2 30 iny 31 cpy #17 32 bne div1 33 34div2: ror a 35 36div4: pha 37 txa 38 sec 39 sbc 1,s 40 bcc div3 41 tax 42 43div3: rol <r0 44 pla 45 lsr a 46 dey 47 bne div4 48 rtl 49