Skip to content

NESFab 1.3

Compare
Choose a tag to compare
@pubby pubby released this 09 Dec 03:47
· 33 commits to master since this release

This update contains a few features and a few bug fixes.

Legal-only Instructions

Building the compiler with make ISA=legal results in a NESFab executable that only generates legal instructions. As illegal instructions have better performance, the default implementation will remain as-is.

Because this is the first release to support this feature, I've included a nesfab_legal.exe in the Windows release. I haven't decided if future releases will do the same.

Conditional byte blocks

You can now use if and else inside byte blocks, so long as the condition can be checked at compile time. This enables data to be included / excluded based on compile-time knowledge.

asm fn foo() U
: employs
    default
        if SOME_CONSTANT == 1
            lda #10
        else
            lda #32
        sta &return
        rts

The current implementation cannot handle labels inside of conditionals, so watch out for that caveat.

PUF Audio Update

More speeds

A common complaint was that PUF music had to be speed 4 or slower. This update removes that restriction, allowing any speed from 1 to 30, albeit with reduced performance for speeds 1 to 3.

Changeable speeds

You can now use puf.set_speed to change the speed of a song while it is playing. This can be used to hasten the music when gameplay gets tense.

Controller Update

Controller reading has received a small update to support more than 2 players.

--controllers compiler flag

You can now set the --controllers option, used to mark the maximum number of controllers used. This exports a __controllers option in the language, which library code (or your code) can reference.

The default controller reading in lib/nes.fab checks the __controllers option to determine its implementation. For 1 player, it only reads the first controller. For 2 players, it reads both. For 3 and 4 players, it checks for the presence of the NES Four Score adapter. No higher player count is supported yet.

See examples/4_player to see the Four Score used.

Famicom Controller Support

As mentioned, the default controller code can handle the Four Score adapter. Unfortunately, the Japanese Famicom supports many more styles of adapters, which complicates things.

The new file lib/famicom.fab contains a controller reading implementation which handles all of these adapters, including the Four Score. It was based on code written by Miau, shared on the forums. Currently, this implementation does not handle the DPCM error, so the DMC channel should not be used.

SNES Mouse Support

The library file lib/mouse.fab implements SNES mouse support.

Currently, this implementation does not handle the DPCM error, so the DMC channel should not be used.

See examples/mouse to see the SNES Mouse used.

CNROM change

Previously, CNROM was changing banks by writing to an address directly, e.g. {$8000}(my_bank). As this method cannot handle bus conflicts, CNROM was changed to use the state keyword, e.g. state(my_bank).