Some games switch nametables during the game (like going from a menu to the gameplay). How do you know which nametable to use? I have been checking bits 1-0 of 0x2000, but that doesn't seem to work properly.
For instance, when Galaga starts, it is using $2800 and is mirrored at $2C00, but when the game begins, it changes to $2000 and is mirrored at $2400. How do you know which one is being used?
This is what I've been doing, which is obviously wrong:
nameTable = 0x2000 + ((memory.memCPU[0x2000] & 0x03) * 0x0400);
When loading the rom, I get '0' from bit 0 of $2000. And when the game starts, I get '2'. So I would expect to use $2000 for the main menu background and $2800 for the in-game background. Instead, it uses $2800 for the main menu background and $2000 for the in-game background. This is a bit puzzling to me.
If Bits 1-0 of 0x2000 do not give you this information, what does?
For instance, when Galaga starts, it is using $2800 and is mirrored at $2C00, but when the game begins, it changes to $2000 and is mirrored at $2400. How do you know which one is being used?
This is what I've been doing, which is obviously wrong:
nameTable = 0x2000 + ((memory.memCPU[0x2000] & 0x03) * 0x0400);
When loading the rom, I get '0' from bit 0 of $2000. And when the game starts, I get '2'. So I would expect to use $2000 for the main menu background and $2800 for the in-game background. Instead, it uses $2800 for the main menu background and $2000 for the in-game background. This is a bit puzzling to me.
If Bits 1-0 of 0x2000 do not give you this information, what does?