Skip to content

BASIC256 2.2.0

Latest

Choose a tag to compare

@uglymike17 uglymike17 released this 13 Sep 13:42
· 1 commit to main since this release

BASIC-256 v2.2.0 is out — and it is a different kind of release from the ones before it. The 2.1 line brought the original BASIC-256 up to date: Qt 6, a modern build, new platforms and a browser version, but much the same language underneath.
Basic-256 v2.2.0 starts adding to the language itself. Existing programs keep working — almost everything below is new ground rather than changed ground, with one exception noted at the end.

What 2.2.0 brings

  • A new WINDOW statement. WINDOW -1,-1,1,1 puts 0,0 in the middle of the graphics area, and every drawing statement then works in those units. PIXEL, MOUSEX, MOUSEY, CLICKX and CLICKY read back in the same units, so what you draw is what you can find again. WINDOW on its own goes back to plain pixels.
  • Matrix and vector arithmetic on ordinary arrays. MAT ADD, MAT SUB and MAT MUL work on whole arrays at once and MAT TRN and MAT INV transpose and invert. Alongside them, a DOT b gives the dot product, a CROSS b the cross product, NORM(v) the length of a vector and UNIT(v) the same vector scaled to length one. Any array will do as a vector.
  • A steady frame rate, with the new FRAMERATE statement. FRAMERATE 60 inside a drawing loop waits until the next frame is due rather than for a fixed length of time. FRAMERATE 0 takes the cap off again.
  • A new NOISE function, giving a smooth, repeatable value between -1 and 1 from an OpenSimplex noise field. SEED now fixes the noise field as well as the random number sequence, so a seeded program draws the same landscape every run.
  • Turtle graphics, as a bundled module. INCLUDE "turtle.kbs" pulls in a turtle that draws by going forward and turning rather than by working out coordinates — t_forward, t_right, t_penup, t_home and the rest, with short forms for the six commands a drawing repeats most. Angles are in degrees measured clockwise from north.
  • Programs run a fifth to a quarter faster than 2.1.1, and none run slower. Drawing, arithmetic and array work all benefit. Arrays use about half the memory they used to, and the statements that act on a whole array at once are three to five times faster. Setting up a million-element array takes a quarter of the time it did.
  • Array and map literals may be written over several lines. A table can be laid out a row to a line instead of being crammed onto one very long one, blank lines between the rows are ignored, and a remark may be put inside the mustaches so the rows can be annotated as they are laid out.

Also in this release

  • PAUSE now waits for the time it is given, to about a millisecond, on every platform and whatever else the machine is doing. Any delay up to a day is honored, and pressing Stop ends a program sitting in a PAUSE at once rather than when the pause runs out on its own.
  • A program is no longer limited to about 5000 lines. The previous limit counted everything a program INCLUDE as well and crossing it stopped the program with a syntax error pointing at a line that had nothing wrong with it.
  • On Windows, a running program's graphics no longer stop for seconds at a time until the mouse is moved. Animations that end each frame with REFRESH, and programs that draw without FASTGRAPHICS, now run at a steady rate whether or not the mouse is touched.
  • New example programs ship with the release

See the changelog for the full list.