http://nintendoage.com/forum/messagevie ... adid=33274When we are using nested loops to copy entire backgrounds we want 256 x 4 = 1KB
It then shows 4 passes of 256 reads/writes.
Isn't a full screen 960 bytes? 32 x 30 tiles?
I ended up writing something that loops 256 3 times, then finishes off the stragglers for the remaining 192 bytes.
Code: Select all
LDA $2002 ; read PPU status to reset the high/low latch
LDA #$20
STA $2006 ; write the high byte of $2000 address
LDA #$00
STA $2006 ; write the low byte of $2000 address
LDA #LOW(StartNametable)
STA pointerLow
LDA #HIGH(StartNametable)
STA pointerHigh
LDX #$00
LDY #$00
LoadStartNametableLoop:
LDA [pointerLow], y
STA $2007
INY
; nametable data will hold one full screen, or 32*30 bytes
; we need to check our x counter to determine when to stop reading "chunks" of 256 bytes
; if x is 3 we have already read 3 * 256 bytes, and only need the straggler 192 bytes
; otherwise we keep reading until y flips again (another 256 bytes read)
CPX #$03
BNE StartNametableChunk
CPY #$C0
BNE LoadStartNametableLoop
JMP LoadStartNametableDone
StartNametableChunk:
CPY #$00
BNE LoadStartNametableLoop
INC pointerHigh
INX
JMP LoadStartNametableLoop
LoadStartNametableDone: