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
WINDOWstatement.WINDOW -1,-1,1,1puts 0,0 in the middle of the graphics area, and every drawing statement then works in those units.PIXEL,MOUSEX,MOUSEY,CLICKXandCLICKYread back in the same units, so what you draw is what you can find again.WINDOWon its own goes back to plain pixels. - Matrix and vector arithmetic on ordinary arrays.
MAT ADD,MAT SUBandMAT MULwork on whole arrays at once andMAT TRNandMAT INVtranspose and invert. Alongside them,a DOT bgives the dot product,a CROSS bthe cross product,NORM(v)the length of a vector andUNIT(v)the same vector scaled to length one. Any array will do as a vector. - A steady frame rate, with the new
FRAMERATEstatement.FRAMERATE 60inside a drawing loop waits until the next frame is due rather than for a fixed length of time.FRAMERATE 0takes the cap off again. - A new
NOISEfunction, giving a smooth, repeatable value between -1 and 1 from an OpenSimplex noise field.SEEDnow 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_homeand 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
PAUSEnow 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 aPAUSEat 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
INCLUDEas 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 withoutFASTGRAPHICS, 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.