Commodore64et6510

Multiplication with shifted additions

Jun 14th, 2025 (edited)
22
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. *=$C000
  2.  
  3. multplicand = $FB
  4. multiplier = $FC
  5. Result_LB = $FD
  6. Result_HB = $FE
  7.  
  8. ; A will hold the temporary LB of the 16 bits result
  9. ; X=LB of result
  10. ; A=HB of result
  11.  
  12. LDA #100
  13. LDX #120
  14. STA multplicand ;
  15. STX multiplier
  16.  
  17. LDA #00
  18.  
  19. LSR multiplier
  20. BCC STEP0
  21. CLC ; carry always set
  22. ADC multplicand
  23. STEP0
  24. ROR
  25. ROR multiplier
  26. BCC SEQ1
  27. CLC
  28. ADC multplicand
  29. SEQ1
  30. ROR
  31. ROR multiplier
  32. BCC SEQ2
  33. CLC
  34. ADC multplicand
  35. SEQ2
  36. ROR
  37. ROR multiplier
  38. BCC SEQ3
  39. CLC
  40. ADC multplicand
  41. SEQ3
  42. ROR
  43. ROR multiplier
  44. BCC SEQ4
  45. CLC
  46. ADC multplicand
  47. SEQ4
  48. ROR
  49. ROR multiplier
  50. BCC SEQ5
  51. CLC
  52. ADC multplicand
  53. SEQ5
  54. ROR
  55. ROR multiplier
  56. BCC SEQ6
  57. CLC
  58. ADC multplicand
  59. SEQ6
  60. ROR
  61. ROR multiplier
  62. BCC SEQ7
  63. CLC
  64. ADC multplicand
  65. SEQ7
  66. ROR
  67. ROR multiplier
  68. BCC END
  69. CLC
  70. ADC multplicand
  71. END
  72. LDX multiplier
  73.  
Advertisement
Add Comment
Please, Sign In to add comment