MitchellSternke / SuperMarioBros-C

An attempt to translate the original Super Mario Bros. for the NES to readable C/C++
625 stars 70 forks source link

Wrong Warp Inaccuracy #3

Open ghost opened 6 years ago

ghost commented 6 years ago

When entering the warp zone pipe in 1-2 before they are loaded, the game does not load the same destination as the original cartridge release of the game. Video

MitchellSternke commented 5 years ago

Hi, thanks for filing this issue. The root cause of this is that the memory ordering and contents are not the same as in the original game (if you look at the C++ code, all static data is placed starting at address 0x8000, whereas this is where instruction code is placed in the ROM).

To fix this it would require loading the correct data into the addresses that are accessed by the glitch. Or more generally, loading all data to the same locations in memory as the original game. This would require keeping track of addressing as we parse the disassembly (knowing how much space instructions and data take up, and taking this into account when we assign addresses to global variables). This would also require assembling the instructions into machine code so that we can store the correct instruction data in memory as well. Not an impossible task, but it would require some research to get it correct.

Again, thank you for filing this 😄 . Not sure if I can get to fixing it soon, but I am open to taking a pull request in the meantime.