| 1 | .globl _dodiv |
| 2 | # |
| 3 | # routine to destructively divide array representation of a bignum by |
| 4 | # 1000000000 |
| 5 | # |
| 6 | # invocation: |
| 7 | # remainder = dodiv(top,bottom) |
| 8 | # int *top, *bottom; |
| 9 | # where *bottom is the address of the biggning of the array, *top is |
| 10 | # the top of the array. |
| 11 | # |
| 12 | # register assignments: |
| 13 | # r0 = carry |
| 14 | # r1 & r2 = 64bit temporary |
| 15 | # r3 = pointer |
| 16 | # |
| 17 | _dodiv: .word 0 |
| 18 | clrl r0 #no carry to begin. |
| 19 | movl 8(ap),r3 #get pointer to array. |
| 20 | loop: emul $0x40000000,r0,(r3),r1 |
| 21 | ediv $1000000000,r1,(r3),r0 |
| 22 | acbl 4(ap),$4,r3,loop |
| 23 | ret |