1985-02-07 22:06:32 +00:00
|
|
|
.define .dvu
|
1986-07-22 13:37:16 +00:00
|
|
|
.sect .text
|
|
|
|
.sect .rom
|
|
|
|
.sect .data
|
|
|
|
.sect .bss
|
1985-02-07 22:06:32 +00:00
|
|
|
|
|
|
|
! unsigned long divide
|
|
|
|
! register usage:
|
1987-03-27 08:49:14 +00:00
|
|
|
! : d2 divisor
|
1985-02-07 22:06:32 +00:00
|
|
|
! d1 dividend
|
|
|
|
! exit : d1 quotient
|
1987-03-27 08:49:14 +00:00
|
|
|
! d0 remainder
|
1986-07-22 13:37:16 +00:00
|
|
|
.sect .text
|
1985-02-07 22:06:32 +00:00
|
|
|
.dvu:
|
1987-03-27 08:49:14 +00:00
|
|
|
move.l 4(sp),d2
|
1986-07-22 13:37:16 +00:00
|
|
|
move.l 8(sp),d1
|
|
|
|
move.l d3,-(sp)
|
1987-03-27 08:49:14 +00:00
|
|
|
tst.l d2
|
1985-02-07 22:06:32 +00:00
|
|
|
bne 0f
|
1987-11-16 15:52:57 +00:00
|
|
|
move.l #EIDIVZ,-(sp)
|
1985-02-07 22:06:32 +00:00
|
|
|
jsr .trp
|
|
|
|
0:
|
1987-03-27 08:49:14 +00:00
|
|
|
clr.l d0
|
1985-02-07 22:06:32 +00:00
|
|
|
move.l #31,d3
|
|
|
|
3:
|
|
|
|
lsl.l #1,d1
|
1987-03-27 08:49:14 +00:00
|
|
|
roxl.l #1,d0
|
|
|
|
cmp.l d2,d0
|
1985-02-07 22:06:32 +00:00
|
|
|
blt 4f
|
1987-03-27 08:49:14 +00:00
|
|
|
sub.l d2,d0
|
1985-02-07 22:06:32 +00:00
|
|
|
add #1,d1
|
|
|
|
4:
|
|
|
|
dbf d3,3b
|
1986-07-22 13:37:16 +00:00
|
|
|
move.l (sp)+,d3
|
|
|
|
move.l (sp)+,a0
|
|
|
|
add.l #8,sp
|
|
|
|
move.l a0,-(sp)
|
1985-02-07 22:06:32 +00:00
|
|
|
rts
|
1986-07-22 13:37:16 +00:00
|
|
|
|
1985-02-07 22:06:32 +00:00
|
|
|
.align 2
|