home *** CD-ROM | disk | FTP | other *** search
/ Transactor / Transactor_18_1987_Transactor_Publishing.d64 / multiply.pal (.txt) < prev    next >
Commodore BASIC  |  2023-02-26  |  483b  |  24 lines

  1. 100 ; multiply routine
  2. 110 mloop = *
  3. 120 lsr m1            ;sr m1
  4. 130 ror m1+1          ;the carry from m1 -> m1+1
  5. 140 bcc shift         ;add on carry set
  6. 150 clc               ;r=r+m2
  7. 160 lda m2+1
  8. 170 adc r+1
  9. 180 sta r+1
  10. 190 lda m2
  11. 200 adc r
  12. 210 sta r
  13. 220 shift = *
  14. 230 asl m2+1          ;sl m2
  15. 240 rol m2
  16. 250 lda m1+1
  17. 260 bne mloop
  18. 270 lda m1            ;if m1 and m1+1=0
  19. 280 bne mloop         ;when we are done
  20. 290 rts
  21. 300 m1     .word $0023
  22. 310 m2     .word $000f
  23. 320 r     .word $0000
  24.