home *** CD-ROM | disk | FTP | other *** search
- *
- * c68 support routines .Xlmul, .Xulmul, .Xaslmul, .Xasulmul
- *
- * multiplication of signed and unsigned long quantities
- * (based on a routine used by SozobonX's xdlibs library)
- *
- .text
-
- .globl .Xlmul
- .globl .Xulmul
- .globl .Xaslmul
- .globl .Xasulmul
-
- .Xaslmul:
- .Xasulmul:
- movem.l 4(sp),d1/a1
- exg d1,a1
- move.l (a1),d0
- bsr Rlmul
- move.l d0,(a1) ; assign result
- bra fin
-
- .Xlmul:
- .Xulmul:
- movem.l 4(sp),d0/d1 ; get operands
- bsr Rlmul
- fin: move.l (sp)+,a0 ; get return address
- addq.l #8,sp ; remove two long parameters
- jmp (a0) ; return to calling code
-
- Rlmul: move.l d0,d2 ; do the actual multiplication
- mulu d1,d2 ; (this code is identical for both
- movea.l d2,a0 ; unsigned and signed longs)
- move.l d0,d2
- swap d0
- mulu d1,d0
- swap d1
- mulu d2,d1
- add.l d1,d0
- swap d0
- clr.w d0
- add.l a0,d0
- rts
-