I have a mirror of the contents of one of my backgrounds in WRAM so I can change it and not have to worry about only writing to it in vblank. However, I'm running into strange timing errors where I'm not able to DMA my OAM mirror and my tilemap mirror in the vblank period (I'm assuming it's a timing error anyway, the amount of data that actually gets transferred seems to change depending on the number of nops I add to the vblank routine). If that's the case, and there's not enough time to transfer the whole mirror, how am I supposed to DMA it over in vblank? You don't have random access to VRAM so you can't just DMA using multiple channels with offsets, and interleaving the tilemap mirror seems like a huge pain. Any help would be appreciated.
In case I'm doing something wrong, here's my WRAM-VRAM macro:
In case I'm doing something wrong, here's my WRAM-VRAM macro:
Code:
.macro WRAMToVRAM source, destination, size
lda #$80
sta $2115 ;word-access,increment by one
ldx #destination
stx $2116
ldx #source
stx $4312 ;dma source address
lda #$7e
sta $4314 ;bank
ldx #size
stx $4315
lda #$18 ;dest = $2118, vram write register
sta $4311
lda #$1 ;word increment on dest, src increment
sta $4310
.endmacro
lda #$80
sta $2115 ;word-access,increment by one
ldx #destination
stx $2116
ldx #source
stx $4312 ;dma source address
lda #$7e
sta $4314 ;bank
ldx #size
stx $4315
lda #$18 ;dest = $2118, vram write register
sta $4311
lda #$1 ;word increment on dest, src increment
sta $4310
.endmacro