Persistent NES-ROM hacking for profit and fun (Stage 1)

Amrit Sharma Poudel
2 min readMay 30, 2023

--

Kids born in the 90s know it. Contra, Jackal, Mario, etc. — that was life. Long nights of playing Contra on weekends was sort of our daily routine. The hard-a*s “Waterfall” level, and the other harder levels to complete in just three or four lives? Well, good luck with that!

Pure nostalgia

Fortunately, there was a Konami-code that could give you 30 lives to start with. Having a Spray gun (I don’t really know what it stands for: some call it Spray, Shower, or Spread gun) which you could have when you get “S” on those flying thingy could make your life lot easier.

Spray? Shower?

The main focus of this post is to modify the NES ROM file so that you will always have 30 lives to start with, or better — you never “lose” your life and you will always have “S(hower, pread, pray)” gun even if you “die” (that for some time later!).

Stage 1: Pre-f(l)ight Checklist / Assumptions

First things first. Some boring information. NES is based on an 8-bit 6502 microprocessor. I found this site which has a list of all the opcodes for this microprocessor which you can have in your arsenal, it comes in handy — believe me. I assume you are comfortable with basic Assembly or at least are familiar with this Family of Microprocessors (The flags, registers, etc.).

There are many resources where you can download NES ROM files. Well GIYF. What you need is Contra.nes. I fear copyright and respect it, so do it on your own.

A debugger and an emulator — why not both at the same time? Hats off to the people at FCEUX. It is a great tool for debugging and RAM Search and PPU viewing etc.

You will also need a Hex Editor to permanently modify the ROM. I prefer HxD-Editor. It is freeware and does its job just fine.

--

--