FastBasic 4.4: BREAK Key, Copy and Paste, and Cartridge Output

On 20 September 2020, dmsc (Daniel Serpell) released FastBasic 4.4, which he called the "Spring 2020 Release". It brings all the improvements from the preceding beta into a stable version, plus a few more fixes. FastBasic is a fast, integer-oriented BASIC for the Atari 8-bit with a structured, line-number-free syntax derived from Turbo-Basic XL. It runs both as an on-Atari IDE and as a PC cross-compiler.

A friendlier editor

The changes most users will notice are in the on-Atari IDE:

  • BREAK now returns to the IDE from a running program. The author admitted this was "long overdue".
  • Copy and paste of lines. Ctrl-C marks a line and Ctrl-V inserts a copy after the cursor. Pressing Ctrl-V repeatedly makes several copies. Page-down therefore moved from Ctrl-V to Ctrl-I.
  • Ctrl-G jumps to any line number, which helps with longer programs.
  • On a 1200XL, Shift-F1 and Shift-F2 work as page-up and page-down.

Language additions

  • A CLR statement un-dimensions all arrays and sets every variable to 0.
  • WSYNC can be used inside a DLI definition, so one display list interrupt can change registers on several scan lines.
  • & is shorthand for ADR().
  • More abbreviations, and most functions no longer need parentheses, which makes code shorter. That is useful for the BASIC ten-liner contests.

One small incompatibility: the abbreviations for ELSE, ENDIF, PMGRAPHICS and PMHPOS changed, to make them shorter and more consistent.

Cross-compiler: ROM-ready code

The PC cross-compiler can now produce code that runs from a cartridge. It removes all self-modifying code and adds a stub that copies the zero-page interpreter from ROM to RAM at startup. A new DATA FILE statement includes binary data from external files, DATA arrays can be accessed from external assembly modules, and the CC65 tools are now bundled, so a separate CC65 installation is no longer needed.

How small is it?

A question posted in the thread a few months later asked whether FastBasic's interpreter could be reused as a scripting engine in other 6502 projects. Dmsc said yes: the bytecode interpreter is portable and is entered with a pointer to the bytecode and a JSR. Because the cross-compiler links through ld65, only the routines a program actually uses end up in the binary. He gave these sizes, measured on the development version of early 2021:

Program content Interpreter size
Minimal program 255 bytes
With multiplication and variables about 500 bytes
With arrays and loops about 850 bytes
Full games (Joyas, Wazers) 1,459 and 1,613 bytes
Every token except floating point 2,314 bytes
Every token including floating point 3,202 bytes

It also needs 20–32 bytes of zero page.

Where to get it

The Atari disk image, manuals and Windows, macOS and Linux cross-compilers are at github.com/dmsc/fastbasic/releases/tag/v4.4.

Credits