
Jeff Minter never ported his game Gridrunner to the Nintendo Entertainment system. So I did. Maybe I don't know what I'm doing.
You can play it online here.
On Ubuntu you can install FCEUX, the NES emulator, as follows:
sudo apt install fceux
Once you have that installed, you can download the game and play it:
fceux gridrunner.nes
On FCEUX, you can use F to fire and the Arrow keys to move.
On Ubuntu you can install the build dependencies as follows:
sudo apt install cc65 fceux python3
Then you can compile and run:
$ make
Made out of curiosity as part of the Gridrunner project. This example project was a big help in getting started.
This is mostly confined to nes.asm. It's where I've put all the helper functions as well the boiler plate robbed from Brad Smith's example project.
The C64 is a very friendly system to develop on - you write a value to a location in memory and it magically
appears on screen. You write a value to a different location, it changes color. The NES on the other hand requires
a lot more convolutions from you. While it allows up to 64 8x8 sprites, it does not really envisage you writing
lots of characters to screen every frame - which is what we're doing here, just like the original Gridrunner. Of
course, there is a world in which I could have just used sprites instead (and maybe there will be) but for a first
pass what I have done is write as many as characters as possible to screen as I can in the small interval allowed by
the NES between each frame. This all happens in the MainNMIInterruptHandler
, which is the routine that runs every
time the NES takes a little rest between drawing a frame on the screen. This little rest is known as the VBLANK, or
Vertical Blank. Every time Gridrunner wants to write a character to the screen, such as when moving the ship to a new
position, I instead write it to a buffer array called NMT_UPDATE
. This is done using a few different utility
functions, depending on the use case, but mainly WriteCurrentCharacterToCurrentXYPosBatch
which will append updates
to the list in NMT_UPDATE
until there are enough of them to warrant writing to the screen itself in MainNMIInterruptHandler
.
Crappy, almost non-existent. I stopped short of figuring out how to make sound work in NES properly.
The NES version seems faster than the original Gridrunner. This is not because I'm a coding genius, it's because it's the way it worked when I got the thing working.
I wrote up the basic workings of C64 gridrunner in this Little Black Book. Everything there applies to the NES version.