ack/mach/m68k4/libem/dvu.s

41 lines
507 B
ArmAsm
Raw Normal View History

1985-02-07 22:06:32 +00:00
.define .dvu
.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
.sect .text
1985-02-07 22:06:32 +00:00
.dvu:
1987-03-27 08:49:14 +00:00
move.l 4(sp),d2
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
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
1985-02-07 22:06:32 +00:00
.align 2