home *** CD-ROM | disk | FTP | other *** search
- .text | cjpurcell 30Jul89
- .even |
- .globl __divsi3 |
- .globl ___divsi3 |
- __divsi3: |
- ___divsi3: |
- link a6,#-2 | 2 bytes of local
- clrw a6@(-2) | zap the local; it's our neg flg
- |
- movel a6@(12),d0 | get b
- bge divs1 | pos, ok
- negl d0 | negate it
- addqw #1,a6@(-2) | and inc the flag
- divs1: |
- movel d0,sp@- | push adjusted b
- movel a6@(8),d0 | get a
- bge divs2 | pos, ok
- negl d0 | negate it
- subqw #1,a6@(-2) | and dec the flag
- divs2: |
- movel d0,sp@- | push adjusted a
- jbsr ___udivsi3 | do an unsigned div
- addql #8,sp | flush args
- tstw a6@(-2) | flag set?
- beq divs3 | nope, go ahead and return
- negl d0 | negate the result
- divs3: |
- |
- unlk a6 | unlink the frame
- rts | done!
-