← All news Releases

BASIC-256 v2.2.0 released

Where 2.1 modernised the original, 2.2.0 starts adding to the language: WINDOW coordinates, matrix and vector maths, FRAMERATE, noise, turtle graphics and a further speed-up. Discussion: comments closed

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. 2.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. Builds are available for Windows, macOS (Apple Silicon and Intel), Linux and the Raspberry Pi, and BASIC-256 also runs in a browser tab with nothing to install.

What 2.2.0 brings

  • Coordinates of your own choosing, with the 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. The order of the arguments picks which way each axis runs, so WINDOW -1,1,1,-1 puts y=1 at the top, the way graph paper does. 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.
  • Drawing accepts fractional coordinates. PLOT, LINE, RECT, CIRCLE, ELLIPSE, ARC, CHORD, PIE, STAMP, TEXT and IMGLOAD now place what they draw where they are told instead of rounding down to the nearest whole pixel, so a circle at 100.5, 100.5 sits half a pixel right of and below one at 100, 100. Whole-number coordinates draw exactly as they always did.
  • Matrix and vector arithmetic on ordinary arrays. MAT ADD, MAT SUB and MAT MUL work on whole arrays at once — MAT ADD Position = Position + Velocity moves every particle in one statement — 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 row, a column, or whatever MAT TRN hands back — so these work on the shape a program already holds its vectors in.
  • 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, so however long the drawing took comes out of the wait instead of being added to it. BASIC-256 runs on everything from a Raspberry Pi to a modern desktop, and this is what lets a program written on a fast machine keep its speed on a slow one. 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. Unlike RAND, which hands back an unrelated value every call, the same coordinate always gives the same value and nearby coordinates give nearby ones — which is what makes it suit terrain, clouds, textures and wandering paths. 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, as turtle graphics has always had them, and the bare filename works wherever the program is saved because the IDE searches the Modules folder it ships with.
  • Programs run a fifth to a quarter faster than 2.1.1, and none run slower. The gain is in the way values are held while a program runs rather than in any one statement, so 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 — DIM, REDIM, copying one array into another, and the MAT statements — 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 honoured, 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 limit counted everything a program INCLUDEd as well, so a short program that pulled in a few large modules could reach it as easily as one long file, 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.
  • SPRITEPOLY now places the polygon where it was drawn and leaves room for the pen width, instead of shifting and clipping any shape that was not already in the corner of its own bounding box.
  • New example programs ship with the release and are in the browser version’s File → Open Example list too: a tour of the four vector operations, a turtle demo that draws a square, a hexagon, a star, a spiral and a recursive tree, and a 200-particle simulation with no FOR loop in the physics at all.
  • One thing to watch when upgrading: MOD may now be written in capitals, so a MOD b, a Mod b and a mod b are all the remainder operator, as % has always been. That makes mod a reserved word in every capitalisation — a program that used it as the name of a variable has to rename it.

The ChangeLog has the full list, and the release notes summarise every version so far.

Pick your platform and download it, or try it in your browser first.