Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;-------------------------------; Random Number Generator
- GetRand: ; By: 1024
- PHY ; Comments By: Fakescaper
- LDY #$01 ;
- JSR .Maths ;
- DEY ;
- JSR .Maths ;
- PLY ;
- RTL ;
- .Maths LDA $148B ;
- ASL #2 ;
- SEC ;
- ADC $148B ;
- STA $148B ;
- ASL $148C ;
- LDA #$20 ;
- BIT $148C ;
- BCC .Label1 ; If any of the ADC or ASL cleared carry,
- BEQ .Label2 ; reverse the results of the BIT test
- BNE .Label3 ;
- .Label1 BNE .Label2 ;
- .Label3 ;
- INC $148C ; when determining whether or not we INC
- .Label2 ;
- LDA $148C ;
- EOR $148B ;
- STA $148D,Y ; Output gets stored in this RAM Address, 16 bit result.
- RTS ; You might want to add an ADC $13 or SBC $94 before this STA for extra "random"
- ;-------------------------------; (or you can just do it after calling this routine)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement