The wiki states:
I'm:
-Not uploading OAM through DMA
-Not writing to nametable space
-Not writing attributes or palettes
-Not doing scanline trickery to cheat on vblank time
and yet I can only upload 6 tiles max. before the PPU gets confused and messes up writing (spilling beyond vblank). Any advice on how I can improve my code (below)? Or do I need to convert character data to sequential LDA/STA instructions?
Quote:
Assuming moderately unrolled VRAM loading code, the NTSC vblank is long enough to copy about 160 bytes per frame plus the OAM display list without turning rendering on late. This is enough for 10 tiles alone, or 8 tiles plus a nametable row, nametable column, or entire palette.
I'm:
-Not uploading OAM through DMA
-Not writing to nametable space
-Not writing attributes or palettes
-Not doing scanline trickery to cheat on vblank time
and yet I can only upload 6 tiles max. before the PPU gets confused and messes up writing (spilling beyond vblank). Any advice on how I can improve my code (below)? Or do I need to convert character data to sequential LDA/STA instructions?
Code:
;Copies 1 to 256 bytes of data sequentially to a specified address in PPU memory
PPUMemory_Copy: ;Bankswitch manually before use.
LDA $2002
LDA PPU_TGTPTR + 1
STA $2006
LDA PPU_TGTPTR
STA $2006 ;Set up $2007 writes to PPU Target Address
LDA #$FF
SEC
SBC PPU_ORGPTR
TAX ;Calculate number of increments for overflow
LDY #0
.loop
LDA [PPU_ORGPTR], y
STA $2007
INY
DEX
BNE .cont
INC PPU_ORGPTR + 1
.cont
CPY Copy_Quantity; NESDev note: I'm loading the corresponding address for the label with the value 16*6. If I set it up to copy one more whole tile it glitches.
BNE .loop
RTS
PPUMemory_Copy: ;Bankswitch manually before use.
LDA $2002
LDA PPU_TGTPTR + 1
STA $2006
LDA PPU_TGTPTR
STA $2006 ;Set up $2007 writes to PPU Target Address
LDA #$FF
SEC
SBC PPU_ORGPTR
TAX ;Calculate number of increments for overflow
LDY #0
.loop
LDA [PPU_ORGPTR], y
STA $2007
INY
DEX
BNE .cont
INC PPU_ORGPTR + 1
.cont
CPY Copy_Quantity; NESDev note: I'm loading the corresponding address for the label with the value 16*6. If I set it up to copy one more whole tile it glitches.
BNE .loop
RTS