1985-02-07 22:06:32 +00:00
|
|
|
.define .dvi
|
1986-07-22 13:37:16 +00:00
|
|
|
.sect .text
|
|
|
|
.sect .rom
|
|
|
|
.sect .data
|
|
|
|
.sect .bss
|
1985-02-07 22:06:32 +00:00
|
|
|
|
|
|
|
! signed long divide
|
1986-07-22 13:37:16 +00:00
|
|
|
.sect .text
|
1985-02-07 22:06:32 +00:00
|
|
|
.dvi:
|
1987-03-27 08:57:38 +00:00
|
|
|
move.l 4(sp),d2
|
1986-07-22 13:37:16 +00:00
|
|
|
move.l 8(sp),d1
|
|
|
|
move.l d4,-(sp)
|
1985-02-07 22:06:32 +00:00
|
|
|
clr.l d4
|
1987-03-27 08:57:38 +00:00
|
|
|
tst.l d2 ! divisor
|
1985-02-07 22:06:32 +00:00
|
|
|
bpl 1f
|
1987-03-27 08:57:38 +00:00
|
|
|
neg.l d2
|
1985-02-07 22:06:32 +00:00
|
|
|
not d4
|
|
|
|
1:
|
|
|
|
tst.l d1 ! dividend
|
|
|
|
bpl 2f
|
|
|
|
neg.l d1
|
|
|
|
not d4
|
|
|
|
swap d4
|
|
|
|
not d4
|
|
|
|
swap d4
|
|
|
|
2:
|
|
|
|
move.l d1,-(sp)
|
1987-03-27 08:57:38 +00:00
|
|
|
move.l d2,-(sp)
|
1985-02-07 22:06:32 +00:00
|
|
|
jsr .dvu
|
|
|
|
tst d4
|
|
|
|
beq 5f
|
|
|
|
neg.l d1 ! quotient
|
|
|
|
5:
|
|
|
|
tst.l d4
|
|
|
|
bpl 6f
|
1987-03-27 08:57:38 +00:00
|
|
|
neg.l d0 ! remainder
|
1985-02-07 22:06:32 +00:00
|
|
|
6:
|
1986-07-22 13:37:16 +00:00
|
|
|
move.l (sp)+,d4
|
|
|
|
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
|