home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Transactor
/
Transactor_18_1987_Transactor_Publishing.d64
/
divide.pal
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2023-02-26
|
527b
|
29 lines
90 ; divide routine
100 dloop = *
110 asl m2+1
120 rol m2
130 rol r2+1
140 rol r2
150 sec
160 lda r2+1
170 sbc m1+1
180 tax ;save low byte
190 lda r2
200 sbc m1
210 tay ;save high byte
220 bcc skipsave
230 stx r2+1 ;store saved bytes
240 sty r2 ;in r2
250 skipsave = *
260 rol r1+1 ;shift carry from
270 rol r1 ;subtract into r1
280 lda m2+1
290 bne dloop
300 lda m2
310 bne dloop
320 rts
330 m1 .word $0005
340 m2 .word $002b
350 r1 .word $0000
360 r2 .word $0000