Skip to content

Instantly share code, notes, and snippets.

@selenologist
Created January 24, 2016 15:16
Show Gist options
  • Save selenologist/fb382a9b9e5b3f1b69b8 to your computer and use it in GitHub Desktop.
Save selenologist/fb382a9b9e5b3f1b69b8 to your computer and use it in GitHub Desktop.
; Fills the screen at the end of the snake game demonstrated at https://skilldrick.github.io/easy6502/
; I could have patched the MSB of the STA instruction's address but this works and there's no delay between blocks
gameOver:
ldx #0
fillLoop1:
lda sysRandom
sta $0200, x
inx
bne fillLoop1 ; if Z=0 (inx did not wrap around), then keep filling
fillLoop2:
lda sysRandom
sta $0300, x
inx
bne fillLoop2
fillLoop3:
lda sysRandom
sta $0400, x
inx
bne fillLoop3
fillLoop4:
lda sysRandom
sta $0500, x
inx
bne fillLoop4
end:
jmp gameOver ; keep filling
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment