Now You’re Coding With Power
NESFab is a modern, C-like language for NES game development that hides the dirty details without slowing down code execution.
The 8-bit video games of yesteryear have a charm to them that has kept them popular with gamers to this day. The resolution may be low — and the palettes limited — by today’s standards, but the often cute graphics and addictive gameplay keeps us coming back for more time and again. The more technically inclined among these retro gamers will inevitably look at the relative simplicity of their favorite classic games and say, “I can do that.”
Surely programming these decades-old games is far easier than something more modern, right? If that is your belief, then you have a lot to learn. Have you ever heard of “racing the beam” on the Atari 2600? The console had almost no memory, so a video buffer was out of the question. The programmer had to count CPU cycles to deliver data to the graphics chip at the exact moment it was needed (remember that CRT TVs continually retraced the display). Oh, and they would have to somehow manage to squeeze game logic in-between those constant screen updates.
The simple graphics and sound only make it seem like developing games would be easy until you take the severe hardware limitations into consideration. Then one realizes that it is a slog through archaic assembly language and hardware diagrams while trying to develop wizard-level optimizations to shave off a few clock cycles from a routine.
The NES is one of the most popular game consoles among enthusiasts, and while it may not be quite as challenging to code for as the Atari 2600, it is still extremely limited by its early-1980s hardware. So to make the most of those limited resources, developers have typically programmed the machine using 6502 assembly code, with none of the conveniences of a modern, high-level programming language. This closeness to the hardware is great for writing fast-running code, but it causes many would-be developers to find something else to do with their free time.
In the case of the NES, there are now some modern, high-level languages available that compile code to 6502 assembly, saving developers a lot of hassle. Unfortunately, the compilers are far from perfect, and the code they produce tends to be slow. That may be just fine for a "Hello, World" program, but for those working on their magnum opus that will forever redefine the NES, these tools fall flat. Assembly language or bust.
Now a new C-like language called NESFab may change all of that. It handles the difficult details associated with directly accessing the hardware, and it is much faster than similar compilers for the NES, to boot. There are also a lot of existing libraries ready to go that make developing games much easier. Chores like bank switching are also simplified so that developers can focus on building the game instead.
The NESFab project is currently in beta, so you might come across a few bugs. But a number of impressive games have already been developed, and some decent documentation exists, so this project is one that looks like it is worth giving a shot. And if it works out for you, you can also check out MapFab, a graphical level editor that is designed for use with the NESFab language.