FastBasic

Year
2017
Publisher
Open source (GitHub: dmsc/fastbasic)
Type
Language
Category
Modern compiled BASIC: native IDE under 8K plus PC cross-compiler
Developer
dmsc
Language
6502 assembly (interpreter/IDE); cc65 tools for the cross-compiler
Requirements
Any Atari 8-bit with a DOS and disk/disk image for the native IDE; Windows, Linux or macOS for the cross-compiler
FastBasic 4.7 editor on an Atari screen showing the Editor Help page: Ctrl-A, Ctrl-E, Ctrl-Z undo, Ctrl-S save, Ctrl-R parse and run, Ctrl-W compile to binary file

Overview

FastBasic is a modern BASIC for the Atari 8-bit, written and maintained by the AtariAge member dmsc. Full source and binaries for the Atari, Linux, Windows and macOS are published on GitHub. It looks familiar to anyone who knows Atari BASIC or Turbo-BASIC XL, but it works very differently inside. Programs are compiled to a compact bytecode, and the core numeric type is the integer. The result is much faster than the classic interpreters. In a 2019 AtariAge comparison of a simple nested FOR/NEXT loop across Atari BASIC, Altirra BASIC, compiled Turbo-BASIC XL and FastBasic, FastBasic "wrecks the other three". With its tiny footprint and abbreviations, it has become a favourite for the annual BASIC 10-liner contests.

Two ways to use it

  • Native IDE on the Atari. A full-screen editor and compiler that run on the machine itself. The integer-only IDE has been kept under 8K through every release: 8,188 bytes in version 4.0, and still under 8K in 4.7. A floating-point IDE of about 9.4K adds real numbers. You write, compile and run without leaving the editor. Since version 4.4, BREAK returns from your program to the IDE, and the editor has mark-and-copy of lines (CTRL-M, CTRL-C). Command-line compilers FBC.COM (and the integer-only FBCI from 4.7) handle programs too large for the editor: FBC PROG.BAS PROG.COM.
  • Cross-compiler on a PC. It produces standalone Atari executables and includes only the parts of the runtime a program actually uses. In Release 3 a one-line ? "Hello" compiled to 453 bytes, interpreter included. It has an optimiser (tail calls, multiply/divide/modulo and bitwise operations), label files for debugging, and since 4.4 the option to build cartridge images. The cc65 tools it relies on are bundled.

Language highlights

FastBasic keeps the Atari BASIC graphics, sound and I/O statements and adds structured programming and hardware access, release by release:

  • Structured loops and conditionals such as REPEAT … UNTIL, plus PAUSE, KEY() and MOVE/-MOVE.
  • Typed DATA arrays that live directly in memory, for example DATA p1() BYTE = $E7,$81,$81,$E7.
  • Player/missile graphics from 4.0: PMGRAPHICS, PMHMOVE and PMADR().
  • Display-list interrupts from 4.3. One DLI SET line describes which array values go into which hardware registers on each interrupt. dmsc's demo uses it to multiplex two players into four moving two-colour sprites.
  • CLR (4.4), and in 4.7 an SIO statement, FujiNet network statements (NOPEN, NCLOSE, NSTATUS, NGET), a 24-bit %TIME, ADR for floating-point variables and looser syntax, for example PRINT "A=" A.
  • USR() calls machine code. It pushes the return address and the arguments, then jumps to the routine.

A small taste. This loop cycles the background colour until a key is pressed:

' Cycle the background colour until a key is pressed
DATA cols() BYTE = $28,$88,$C8,$08
I = 0
REPEAT
  PAUSE 10
  POKE 710, cols(I)
  I = (I + 1) MOD 4
UNTIL KEY()

History

dmsc announced FastBasic's Release 3 on AtariAge in early 2018. It added string comparisons and a faster interpreter, and the SIEVE benchmark took 17 seconds. Version 4.0 (the "Tenliners'19" release, early 2019) changed the virtual machine from stack-based to register-plus-stack, gaining 10–20% (13% on SIEVE on the Atari), and added FBC.COM and P/M graphics. 4.3 brought DLIs in time for the 2020 ten-liners, 4.4 followed in spring 2020, and the 4.7 "new year 2025" release added the FujiNet and SIO support. Community member MrFish designed manual covers for the native and cross-compiler editions. The manual itself lives in the project's repository.

Using it today

Download the latest release from github.com/dmsc/fastbasic/releases. The first release appeared there in October 2017, and version 4.8 followed in October 2026. The 4.7 release disk boots straight to a menu naming its programs: FB (the standard IDE), FBI (integer-only IDE), FBC (command-line compiler) and EFAST (a screen accelerator). Boot the ATR in Altirra or on real hardware and run the IDE, or use the cross-compiler with your usual PC editor and test the resulting .XEX in an emulator. Typical gotchas: the default integer IDE has no floating point, so pick the floating-point build if you need real numbers. And the DLI model takes its values from arrays on each interrupt, so time-critical raster tricks still need care.

Credits