Back to home

Compiling Super Mario Bros from Source

When I was browsing on gopher.black I came across a super good SMB dissasembly and I started thinking about what would be needed to compile this back into a working rom. The comments in the code said that I needed a iNES file header and a character rom to make this work.

Of course, the first thing I did was to look if some other people have done this but I couldn't find a lot of information. But after some searching I found this forum thread. Someone in that thread explained everything to do some basic modding of the game and even supplied everything you need to compile it yourself. YEAH!!! The link he gave was unfortunately dead but it was luckely archived.

Great, now I have everything I need! The zip file includes:

If you're on windows I think you should just be able to run MAKESMB.BAT to make a SMB rom but I didn't test it because I'm doing this on a mac. Also because of that reason this didn't work out of the box. I can't run the bat file and the the included assembler and linker only work on windows. But that's not a big problem, the assembler and linker can be installed with brew by running

	brew install cc65
	

in the terminal and the bat file is really simple so I wrote a shell script that does the same thing.

	#!/bin/sh
	clear
	ca65 smbdis.asm
	ld65 -C ldconfig.txt smbdis.o
	rm smb.nes
	cat smb.hdr smb.prg smb.chr > smb.nes
	

Now I can finally compile Super Mario Bros from source. And a fun fact: my emulator even recognises it as a SMB rom so it must really be close to the original.

I recommend trying out the rom hacks that are explained in that forum post. They are fun and you can make Mario jump about 2km into the air.

Thanks for reading this and I hope that you try this out yourself.