This page is a mirror of Tepples' nesdev forum mirror (URL TBD).
Last updated on Oct-18-2019 Download

Trying to cut down on room load times... Problem

Trying to cut down on room load times... Problem
by on (#41137)
I'll go through the steps of how I load my rooms in my game here:
-Turns off the PPU, hides sprites, gets pointers, loads the palettes, loads the song, sets a flag to tell the game to read in data for the attribute table.
-After vblank, it performs all the math and writes the specific 64 bytes into memory. It then sets the aforementioned flag to false (don't need to do math twice)
-For my next frame, during vblank, I want to have it so it loads in that data that was written to memory into the attribute table. The only problem is, it doesn't work. I right now have this empty step in vblank that does nothing but increments the jump table index so that the next one will do the attribute writes. This method works.

If I perform the writes in that specific part, nothing loads right. Random BG tiles are written too, which makes no sense.

Any thoughts?

by on (#41138)
This sounds like somehow you're writing PPU data when it's not supposed to be written. Look for things like this:

ldx #$64
ldy #0
-
lda Buffer,y
sta $2007
iny
dex
bne -

Catch the error? #$64 isn't the same as #64 obviously. I've done this sort of thing before. Otherwise, you may have some tiny hidden bug where you're really updating when the PPU is on for some reason. Or you may have PPU increment 32 enabled when you think it's PPU increment 1 or the other way around.