FastBasic 4.3 Brings Display List Interrupts to BASIC

On 29 February 2020, dmsc (Daniel Serpell) released FastBasic 4.3, describing it as ready for the 2020 BASIC ten-liners. The main new feature is something BASIC programmers on the Atari had always had to write in machine language: display list interrupts (DLIs), through a short, declarative syntax.

How the DLI support works

A DLI is defined with DLI SET, which lists values to be written into hardware registers when the interrupt fires. Each value can come from a DATA ... BYTE array, so each DLI in the display list writes the next element of the array. DLI name switches it on and a plain DLI switches it off. To trigger it you set bit 7 of the chosen display list instructions yourself, for example by POKEing 130 (a mode-2 line with the DLI bit set) into the display list.

The release came with a demo that multiplexes two players into four moving two-colour sprites. Arrays hold the horizontal positions and the two colours for each band, and the DLI copies them into $D000/$D001 (HPOSP0/HPOSP1) and $D012/$D013 (COLPM0/COLPM1). The main loop then just changes the array values once per frame with PAUSE 0. Full documentation is in the FastBasic manual's "Display List Interrupts" section.

Discussion and limits

Experienced coders in the thread pointed out the trade-offs. One DLI routine is reused for every interrupt and takes its values from arrays, so you cannot chain different routines. Instead you write different array values for each band. The interrupt counter also relies on an OS location that attract mode can change, so a long-running program could index outside its arrays. These are reasonable compromises for a feature aimed at short, fast BASIC programs.

Follow-up: version 4.4

The next stable release, FastBasic 4.4, added a WSYNC option inside DLIs so one interrupt can change registers on several lines. It also brought a CLR statement, the & operator as shorthand for ADR(), more keyword abbreviations, and IDE improvements: BREAK returns to the editor, Ctrl-C/Ctrl-V copy and paste lines, and Ctrl-G jumps to a line. The cross-compiler gained cartridge output, a DATA FILE statement for including binary files, and a bundled copy of the CC65 tools, so you no longer need a separate CC65 install.

Where to get it

Releases are on GitHub at github.com/dmsc/fastbasic/releases (tag v4.3 for this version). The thread includes dlitest.xex, the compiled sprite-multiplexing demo.

Credits