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	.global	___udivhi3
18
19___udivhi3:
20	stz	<r0
21	ldy	#1
22	ldx	<r4
23	lda	<r5
24
25div1:
26	asl	a
27	bcs	div2
28	iny
29	cpy	#17
30	bne	div1
31
32div2:	ror	a
33
34div4:	pha
35	txa
36	sec
37	sbc	1,s
38	bcc	div3
39	tax
40
41div3:	rol	<r0
42	pla
43	lsr	a
44	dey
45	bne	div4
46	rtl
47