FastBasic 4.5: Procedure Parameters and Variable Pointers

In March 2021 dmsc (Daniel Serpell) announced the final FastBasic 4.5 release. It followed a public beta and became the base for the next year's ten-liner entries. A quick fix update (4.5.2) followed within days.

Language changes

The biggest change is procedures with parameters. PROC and EXEC can now pass values, and EXEC can be abbreviated to @, so a call looks more like a statement:

PROC Test A : ? A : ENDPROC
@Test 123

Other additions:

  • ADR() and the & operator can now take the address of a variable. A = 1 : DPOKE &A, 123 : ? A prints 123. That means you can pass a pointer into a procedure and change the caller's variable, much like a C pointer argument. The author said floating-point variables would follow later. That support (and a %() function) eventually arrived in 4.7.
  • String constants can contain any character written as a hex value, e.g. PRINT "Hello"$9B"World".
  • PAUSE with no argument waits for the next vertical blank (same as PAUSE 0).
  • PROC gets a shorter abbreviation, PR..
  • The parser handles syntax errors more robustly. The author had found bad inputs that could slow it down badly.

Editor and cross-compiler

The native IDE got much faster copy/paste, restores the left margin when you exit to DOS, and removes P/M graphics when a program returns to the editor. The PC cross-compiler gives better error messages, checks that PROC and EXEC parameter counts match, and has a new -l option that turns an abbreviated listing into an expanded, indented one. That is handy for reading other people's ten-liners.

After a lot of optimisation, the integer IDE still fits in 8,192 bytes (8,166 in 4.5.2) and the floating-point IDE is 9,457 bytes.

Teething problems

Early testers noticed that the first upload still called itself a release candidate, and that the Windows cross-compiler needed a missing libwinpthread-1.dll. Both problems were caused by a late-night build. The author fixed them by rebuilding with static linking and replacing the release files.

Where to get it

The ATR disk image, manual and cross-compilers for Windows, Linux and macOS are on github.com/dmsc/fastbasic/releases.

Credits