Image
Download | Games | Documentation | Tutorials | Source | Discord | Patreon

NESFab is a new programming language for creating NES games. Designed with 8-bit limitations in mind, the language is more ergonomic to use than C, while also producing faster assembly code. It's easy to get started with, and has a useful set of libraries for making your first — or hundredth — NES game.

// This small program plays a sound effect.

// Variables:
vars /sound
    UU pitch = 1000

// Sends 'pitch' variable to the APU, emitting sound:
fn play_sound()
    {$4015}(%100)
    {$4008}($FF)
    {$400A}(pitch.a)
    {$400B}(pitch.b & %111)

mode main()
    {PPUCTRL}(%10000000)
    while true
        pitch *= 1.01
        play_sound()
        nmi

Innovations & Features

Performance

NESFab generates better 6502 machine code than any high-level compiler tested, including GCC and LLVM. It's possible that NESFab is the best performing 6502 compiler in existence.

Image (Click the image to open in a new tab.)

Traditionally, NES games were written by hand in assembly language, as anything else at the time was too sluggish to run on the 1980s era CPU. NESFab isn't sluggish though!

Automatic Bank Switching

The NES uses a 16-bit address space, but most games need more data than 16-bits can represent. To overcome this limitation, programs can be broken up into segments called "banks", and hardware on the cartridge can switch between these banks at runtime.

Handling banks is normally a tedious affair for programmers, but NESFab handles it for you. The compiler smartly allocates code and data into banks, with the gritty details abstracted away.

Image

Easy Asset Loading

Writing a half-dozen conversion scripts isn't fun. Luckily, NESFab automates asset loading and conversion for you. Just plop your assets into your project directory, import a library, and you're rolling!

Image

Map Editor

Need a level editor? Use MapFab! It's designed to be easily integrated into your NESFab projects, letting you create more, faster.

Image

Download

The best way to get NESFab is by compiling it from the source, which will always be up-to-date. For those who don't like compiling, binary releases will be provided from time to time.

Please understand that NESFab is currently in beta, and likely has bugs and missing features.

Projects Using NESFab

Image
Hang Glider - by Pubby
Image
Little Sisyphus - by Pubby
Image
Desert Escape! - by Wowee! Games
Image
Snail Hop - by Libra Bits
Image
enoNES - by fractal161
Image
Roll Tool - by fractal161
Image
Mosh Lift- by Morphcat
Image
Snow Brawl - by svntax
Image
Rodent Eating Serpent - by Nikku4211
Image
Balloony - by gast2405
Image
Comuni Non Comuni - by Pasquiindustry
Image
Super Hard Bouncer - by Libra Bits
Image
Planetar by Duobix
Image
Song of Morus - by SunnyChow
Image
Slow Mole Jr. - by SlowMoleStudio
Image
Relic Dungeon - by Libra Bits
Image
PROTO_1987_01_IT - by Pasquiindustry
Image
Tranoid - by Matthew Laux
Image
Jump Boy - by kennit
Image
Hurdles - by AUVIMA Software
Image
Air Hockey - by bthacker

Tutorials

Official NESFab tutorials:

Tutorials by kennit:

If you have produced a tutorial, reach out to have it listed here.

[Back to my homepage] | [Hire me]