Skip to content

Release 4.8

Choose a tag to compare

@dmsc dmsc released this 23 Oct 05:40
· 9 commits to master since this release

FastBasic has functions!

This is a long overdue release. The main language addition is user-defined integer functions, complemented by floating-point DATA arrays and a large compiler/optimizer cleanup.

Language changes:

  • Adds user-defined integer functions. A PROC can return a value with RETURN expression, and the function is called from any integer expression with @name(...):

    PROC Square X
      RETURN X*X
    ENDPROC
    
    ? @Square(5)
    

    Calls support nested and recursive functions.

  • RETURN can also be used without a value, as an early exit from a PROC. Active FOR loops are unwound before returning.

  • Adds floating-point DATA arrays. Use a name ending in %:

    DATA values%() = 1.0, 2.5, 3.75
    

    The elements can be read and written like other arrays.

  • %() can now be used on the left side of an assignment, allowing floating-point values to be stored through an address:

    %(1536) = 0.1234
    
  • INPUT now works correctly with BYTE and floating-point DATA arrays.

  • ENDPROC can now be abbreviated as EN.. If an IF is open, EN. closes the IF first, as before.

IDE and Atari compiler changes:

  • The native parser now reports an error for source lines longer than 255 characters instead of looping.
  • More parser and code-size optimizations; the integer IDE remains below 8 KB.
  • EN. abbreviation support is available in the native compiler too.

Fixes:

  • Fixes the cross compiler's floating-point SIN/COS link failure.
  • Fixes COLOR() tracking when PRINT statements are shortened by the optimizer.
  • Fixes INPUT into BYTE and floating-point DATA arrays.
  • Fixes -ls listings to use exactly the requested line width and to keep EOL bytes inside strings.
  • Fixes ordering of DATA and PROC blocks declared on the same line in the cross compiler.
  • Fixes the Windows test-runner build with newer MinGW and updates CI to the current Windows runner.

Cross Compiler:

  • New pattern-based peephole optimizer with many additional rules. The test suite now checks that every peephole rule is reached.
  • Constant-address POKE expressions, including symbolic byte addresses, are folded into compact NUM_POKE / BYTE_POKE forms.
  • INPUT directly into a variable no longer builds and stores a temporary address.
  • Unnecessary SADDR save/restore pairs around function calls are removed.
  • VAR = VAR + 1 is compiled to INC VAR; other common expression sequences are also simplified.
  • Function calls now produce a compile error when the target PROC has no value-returning RETURN.
  • Listing fixes and stable DATA/PROC ordering.

Documentation and tests:

  • Manual updated for functions, RETURN, EN., floating-point DATA and %() assignment.
  • Cross-compiler manual clarifications.
  • New editor test harness with 51 editor tests using the full mini65 E: emulation; the complete suite now has 161 tests.