An attempt to translate the original Super Mario Bros. for the NES to readable C/C++
An attempt to translate the original Super Mario Bros. for the NES to readable C/C++
An attempt to translate the original Super Mario Bros. for the NES to readable C/C++.
I've taken the smbdis.asm disassembly of Super Mario Bros. and successfully converted it to C++ using an automated codegen program I wrote (which you can be found in the codegen/ subdirectory of the repo). Right now, it looks very similar to the original disassembly and is fairly dense code, but it works! Check out source/SMB/SMB.cpp if you're curious.
Many thanks to doppelganger ([email protected]), who wrote the original comprehensive Super Mario Bros. disassembly. This can be found in the docs/ folder of the repo.
looks and plays just like the original
Dependencies
From the root of the repo, execute:
mkdir build
cd build
cmake ..
makeThis should create the executable smbc in the build directory.
This requires an unmodified copy of the Super Mario Bros. (JU) (PRG0) [!].nes ROM to run. Without this, the game won't have any graphics, since the CHR data is used for rendering. By default, the program will look for this file in the current working directory, but this can also be configured in smbc.conf.
Optionally, the program can be configured with a file named smbc.conf in the working directory. This file has an INI format. For example, the following would configure the option audio.frequency to be 22050:
[audio]
frequency = 22050The following is a list of all configurable options:
The game consists of a few parts:
Essentially, the game is a statically recompiled version of Super Mario Bros. for modern platforms. The only part of the NES that doesn't have to be emulated is the CPU, since most instructions are now native C++ code.
The plan is to eventually ditch all of the emulation layer and convert code that relies upon it. Once that's done, this will be a true cross-platform version of Super Mario Bros. which behaves identically to the original. It could then be easily modified and extended with new features!
TODO
No open issues yet, or sync has not completed.