Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; Set up
- SEI ; Disable interrupts
- LDA #$20 ; Set for text mode, no bitmap
- STA $D011
- LDA #$00 ; Black background
- STA $D020
- STA $D021
- ; Main loop
- main JSR random ; Get a random screen position
- STA $00 ; Store low byte of address
- LDA #$04 ; High byte of screen RAM address
- STA $01
- LDX #$00 ; Counter for "ARF"
- printChar LDA message,X ; Load character from "ARF"
- STA ($00),Y ; Store at random position
- INX ; Move to next character
- CPX #$03 ; Check if we printed all three chars
- BNE printChar ; If not, loop back
- JMP main ; Repeat indefinitely
- ; Simple random number generator
- ; Returns a random byte in A, low byte of address in Y
- random LDA $D012 ; Load current raster line
- STA $D4 ; Store it temporarily
- LDA $D4
- EOR $D4+1 ; XOR with next byte in zero-page
- ASL ; Multiply by 2
- TAY ; Transfer to Y to use as index
- RTS
- message .byte "ARF" ; Message to print
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement