Skip to content

NESFab 1.1

Compare
Choose a tag to compare
@pubby pubby released this 18 Sep 03:55
· 84 commits to master since this release

Overview

This version contains several prominent bug fixes, and a few small features:

Metasprite library reorganization and animation.fab

I've moved lib/metasprite.fab into its own folder: lib/metasprite/metasprite.fab.
This folder also contains a new library file, animation.fab, which contains code for animating metasprites.

To see this file used in an example, check out examples/animation.

Paired hardware writes (and reads)

Using the following syntax, you can now execute two hardware writes consecutively:

{foo_addr, bar_addr}(foo_value, bar_data)

This syntax ensures that the hardware writes will occur as close together as possible, without any execution happening in-between.

Why is this necessary?

First, it's helpful when writing scrolling code to minimize PPU glitches. With this syntax, there's less concern of timing windows.

More importantly though, it's important when interfacing mappers like MMC3, which require two writes to interface.

Consider the code below which doesn't use this feature:

{$8000}(0)
{$8001}(calc_bank())

NESFab may decide to call the function calc_bank between the the two hardware writes. If this occurs, the first write will be clobbered as calling a function writes to $8000 too.

With a paired write, the problem is avoided, as calc_bank must occur before both of the two writes:

{$8000, $8001}(0, calc_bank())

--ctags Option

The --ctags option can be used to generate a ctags file. When loaded into a text editor, the ctags file can be used to quickly navigate to definitions.

To use ctags in VSCode, install the following extension: https://marketplace.visualstudio.com/items?itemName=jtanx.ctagsx

--ram-init, --sram-init, --vram-init Options

These new compiler flags cause memory to be zero'd out on boot. Although not recommended (it's better to zero-init using code), I've gotten a few requests for these so I've decided to add them.