Advertisement
Guest User

sm rng routine commented

a guest
Jan 11th, 2016
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. $80/8111 E2 20 SEP #$20 ; set 8-bit mode accumulator
  2. $80/8113 AD E5 05 LDA $05E5 ; load low byte of last random number
  3. $80/8116 8D 02 42 STA $4202
  4. $80/8119 A9 05 LDA #$05 ; multiply it by 5
  5. $80/811B 8D 03 42 STA $4203
  6. $80/811E EA NOP
  7. $80/811F C2 20 REP #$20 ; set 16-bit mode accumulator
  8. $80/8121 AD 16 42 LDA $4216 ; load the resultant product
  9. $80/8124 48 PHA ; push it onto the stack
  10. $80/8125 E2 20 SEP #$20 ; 8-bit
  11. $80/8127 AD E6 05 LDA $05E6 ; load high byte of last random number
  12. $80/812A 8D 02 42 STA $4202
  13. $80/812D A9 05 LDA #$05 ; multiply by 5
  14. $80/812F 8D 03 42 STA $4203
  15. $80/8132 EB XBA ; exchange high and low bytes of accumulator
  16. $80/8133 EA NOP
  17. $80/8134 AD 16 42 LDA $4216 ; load low byte of product
  18. $80/8137 38 SEC
  19. $80/8138 63 02 ADC $02,s ; add to it the high byte of the original product
  20. $80/813A 83 02 STA $02,s ; save it to the high byte of the original product
  21. $80/813C C2 20 REP #$20 ; 16-bit
  22. $80/813E 68 PLA ; pull it from the stack
  23. $80/813F 69 11 00 ADC #$0011 ; add 11
  24. $80/8142 8D E5 05 STA $05E5 ; save as new random number
  25. $80/8145 6B RTL
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement