I don't have enough RAM to hold all of CHR RAM, so I need to read the data during VBLANK.
This is what I have right now:
It takes
Code: Select all
lda #>TILEADDRESS
sta $2006
lda #<TILEADDRESS
sta $2006
bit $2007 ; clear read buffer
lda $2007 ; read 8 bytes, store on zero page
sta tmp0
lda $2007
sta tmp1
lda $2007
sta tmp2
lda $2007
sta tmp3
lda $2007
sta tmp4
lda $2007
sta tmp5
ldy $2007
ldx $2007
lda #<TILEADDRESS
sta $2005 ; keep high byte
sta $2006 ; go back to tile address
; write 8 bytes, ora'd with bytes read.
lda tmp0
ora #val0
sta $2007
lda tmp1
ora #val1
sta $2007
lda tmp2
ora #val2
sta $2007
lda tmp3
ora #val3
sta $2007
lda tmp4
ora #val4
sta $2007
lda tmp5
ora #val5
sta $2007
tya
ora #val6
sta $2007
txa
ora #val7
sta $2007
EDIT: Saved some time using tokumaru's trick