Page 2 of 2
Re: SMB Crash at End of Second NameTable
Posted: Tue Jan 29, 2019 10:49 am
by davecom
Right, name tables get written by $2007. I can see incorrect tiles being written there right before the crash.
Re: SMB Crash at End of Second NameTable
Posted: Wed Jan 30, 2019 11:08 pm
by davecom
Okay I finished building my nametables debugger. You can find a "just before the crash" screenshot of both the game (small window) and the 4 nametables (big window) here:
- Before the crash screenshot.
Then you will find an "after the crash" screenshot here:
- After the crash screenshot.
As you can see from the screenshots, the text and coin on the top actually appears to be okay in the nametables! The mystery deepens.
EDIT: Originally was failing a timing test ROM. I have since fixed that—I wasn't counting the +1 ticks for successful branches. Fixed. SMB still crashing.
Re: SMB Crash at End of Second NameTable
Posted: Thu Jan 31, 2019 12:25 am
by davecom
Okay I solved it!
As I suspected it did have to do with pulling from the wrong nametable address and it also was a one liner!
For nametable byte address fetch I was using:
Code: Select all
address = (0x2000 + NAME_TABLE_ADDRESS) | (V & 0x0FFF);
Where NAME_TABLE_ADDRESS was
Code: Select all
((((word)PPU_CONTROL1) & 0b00000011) * 0x400)
But I noticed in Fogleman's emulator that actually I just needed the simpler:
I guess V already encodes the specific nametable... okay SMB is working now. Thanks everyone.