Skip to content

Instantly share code, notes, and snippets.

@lhz
Last active October 1, 2015 13:52
Show Gist options
  • Save lhz/48454acf864031e9296f to your computer and use it in GitHub Desktop.
Save lhz/48454acf864031e9296f to your computer and use it in GitHub Desktop.
Fill screen at $0400 with chequer pattern.
;; Self-modifying code ($18 bytes in ZP, $1A bytes elsewhere)
a: lda #$20
ldy #$18
a_row: ldx #$28
a_col: sta $03E8,y
eor #$80
dex
bmi a_row
iny
bne a_col
inc a_col + 2
asl a_done
bcc a_col
a_done: .byte %00010110 ; Will be $60 = RTS after 4 asl
;; As above, but trashing $08xx ($17 bytes in ZP, $19 bytes elsewhere)
b: lda #$20
tay
b_row: ldx #$28
b_col: sta $03E0,y
eor #$80
dex
bmi b_row
iny
bne b_col
inc b_col + 2
asl b_done
bcc b_col
b_done: .byte %00001011 ; Will be $60 = RTS after 5 asl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment