home *** CD-ROM | disk | FTP | other *** search
-
- UNL
- COPY MACROS.FUNC
- COPY MACROS.PROG
- COPY MACROS.STOP
- COPY MACROS.LDAX
- COPY MACROS.SACX
- COPY MACROS.SUBX
- COPY MACROS.VAR
- LIST
-
- FUNC DDV$,(DIVID,2),DIVSOR,QUOTNT,REMAIN Begin FUNC
- VAR QSN,SAVE1 Declare temporaries
- SAR AR1,SAVE1 Save the AR used in our loop
- LAC DIVID,0 Test Dividend
- BLZ S2 Skip if negative
- LAC ONE,0 Pick up sign of remainder
- SACL QSN,0 Save the sign
- LAC DIVSOR,0 Test Divisor
- BGEZ S3 Skip if positive
- S1 LT MINUS Pick up sign of quotient
- B S4 Go divide
- S2 LAC MINUS,0 Pick up sign of remainder
- SACL QSN,0 Save the sign
- ZAC Load 0
- SUBX DIVID Compute -DIVID
- SACX DIVID Save -DIVID
- LAC DIVSOR,0 Test Divisor
- BGEZ S1 Skip if negative
- S3 LT ONE Pick up sign of quotient
- S4 ZAC Load 0
- SUB DIVSOR,0 Make -DIVSOR
- BLZ S5 Skip if made it minus
- SACL DIVSOR,0 Save -DIVSOR (which is positive)
- S5 LDAX DIVID Load absolute value of dividend
- LARK AR1,15 Load shift count-1
- LARP AR1 Select AR1
- LOOP SUBC DIVSOR One Shift left and subtract
- BANZ LOOP loop for 16 times
- SACL QUOTNT,0 Save Unsigned quotient
- SACH REMAIN,0 Save Unsigned remainder
- MPY QUOTNT Compute Signed Quotient
- PAC To AC
- SACL QUOTNT,0 To QUOTNT
- LT QSN Load the sign
- MPY REMAIN Compute signed remainder
- PAC To AC
- SACL REMAIN,0 To REMAIN
- LAR AR1,SAVE1 Restore AR1
- STOP Return
-
- END