Skip to content

PicoMite V6.03.02b1

Choose a tag to compare

@UKTailwind UKTailwind released this 29 Aug 13:33
· 14 commits to main since this release

Beta for testing. This is 6.03.02b1, continuing the 6.03.02 beta cycle. It adds
whole-array assignment, functions that return arrays, and MM.ERRLINE, on top of the
single-element array dimensions introduced in b0. As with b0, please report anything
odd — especially in existing programs that have nothing to do with the new features.

New: whole-array assignment

A complete array can be copied into another array in a single assignment by using the
array names with empty brackets:

Dim a%(5), b%(5)
b%() = a%()

Both arrays must be the same type (for strings, also the same maximum length as set by
LENGTH; for structure arrays, the same structure type) and must hold the same total
number of elements. The dimensions may differ so long as the totals match — a 2 x 3
array can be copied into a six element array. The copy is a single memory move, so it
is fast regardless of size.

New: functions can return arrays

A function can declare an array return type by adding the dimensions to AS INTEGER
or AS FLOAT (these two types only), and its result is consumed with a whole-array
assignment:

Function Multiples(n%) As Integer(5)
  Local i%
  For i% = 0 To 5 : Multiples(i%) = n% * i% : Next i%
End Function

Dim m%(5)
m%() = Multiples(3)

The result is set by assigning to elements of the function's name. Two rules to know:

  • The function can only be used as the source of a whole-array assignment. Anywhere
    else in an expression (PRINT Multiples(3), arithmetic, CALL()) is an error,
    reported before the function body runs.
  • Reading an element of the function's name inside the function (eg,
    x = Multiples(i%)) calls the function recursively — the same resolution rule that
    makes recursion work. If intermediate values must be read back, build the result in
    a LOCAL array and finish with a whole-array assignment to the function's name
    (eg, Multiples() = tmp%()).

New: MM.ERRLINE

Alongside MM.ERRNO and MM.ERRMSG$, the read-only variable MM.ERRLINE returns the
line number of the statement that caused the last error — the same number as the [n]
prefix on a reported error. It is zero if the error was not in the program (at the
command prompt, or in the library), and it is cleared by RUN and
ON ERROR CLEAR/IGNORE/SKIP along with the other two.

New: brown-out reset reporting

On RP2350, MM.INFO$(BOOT) now reports a brown-out reset distinctly instead of
folding it into the generic power-on cause.

Fixes

  • The console no longer emits the autowrap escape sequence (ESC [?7h) before every
    line of input. It is now sent once at reset and once when the full screen editor
    exits (which pairs with the ESC [?7l the editor emits on entry) — nothing else
    touches it. Anything logging or parsing the console stream sees clean lines again.

Test programs

Self-checking tests for the new features are in Testfiles/: ArrayCopyTest.bas
(all builds), ArrayCopyStructTest.bas (builds with structures),
ArrayFuncTest.bas and ErrLineTest.bas.

Notes

  • The manual covers the new features (LET, FUNCTION, DIM and LOCAL, the Arrays
    tutorial appendix, and the predefined read-only variables table); the attached PDF
    has the per-command bookmarks.
  • Memory sizes are unchanged from b0 on every variant.