Home Documentation Examples Downloads

About TinyBASIC Two

TinyBASIC Two is a simple BASIC interpreter which has been created to get beginners programming on the Raspberry Pi as quickly as possible.

One of its unique features is the provision of flavours which allows the beginner to taste programming with vanilla which has the simple---but unsatisfactory---GOTO statement, then make the switch to sweeter raspberry and learn the joys of structured programming where GOTO is banned!

TinyBASIC Two extends this idea by adding humbug which provides a faithful emulation of the 1978 Transam Triton, one of the first British home computers.

TinyBASIC Two includes:

  1. an editor to create, save, load and run programs
  2. the BASIC interpreter
  3. support for drawing simple graphic shapes in vanilla or raspberry flavours
  4. support for the Triton VDU including its unique special font

The project gets its inspiration from Li-Cheng Wang's Palo Alto Tiny Basic which originally occupied an amazing 1.77kB of memory!

Head over to the downloads section for a DEB package for Raspberry-Pi (Wheezy) or the source code tarball.

The current version is 2.1, released 23/12/2012.

I was very surprised to see Liz (who maintains the Raspberry-Pi web-site) post a link to TinyBASIC on the 29th October. Thanks! A numnber of posts were submitted to the article suggesting the TinyBASIC be included in Raspian. I think there might be licence concerns here, as the core of TinyBASIC was obtained from programmersheaven.com. (See Licence, below.)

Another suggestion was to include some sort of support for the GPIO. I have started looking at wiringPi which looks as though this would make it fairly easy to do, except I wouldn't want TinyBASIC to have run as root.

The Editor

TinyBASIC Two includes a very simple editor which allows programs to be entered, edited and run. No need to learn vi or Emacs! Lines of program code entered with a line-number are stored in ascending line-number order in TinyBASIC's memory. If you leave off the line number the statement is executed immediately.

Use special editor commands to save programs to SD card, load from SD card, list files on the SD card, change working directory, set execution tracing on or off or switch between vanilla and raspberry flavours. There's also a full built-in help system which comprehensively documents all BASIC statements and special editor commands.

The BASIC Language

TinyBASIC implements the following language features:

And in raspberry flavour the following language features are available: And in humbug flavour the following language features are available:

Support for Graphics

In vanilla and raspberry flavours TinyBASIC Two has limited support for selected graphics routines. These are invoked through the DRAW command.

The SDL and the gfx extension libraries provide a drawing "surface" on both X11 or the Linux console. When used on X11 (under, say LXDE) TinyBASIC will open a separate window in which the graphics will appear. However, when run on the Linux console, the console will be "locked" until the program executes a DRAW END statement.

To keep the interface simple TinyBASIC Two supports colours via nine pre-defined colour names. It also supports the alpha channel via a transparency option with all the DRAW commands.

The DRAW command allows the programmer to:

In humbug flavour the VDU command allows the programmer to "map" characters from the special Triton font onto the display at any of the 1024 screen positions. This is analagous to a poke command which many BASIC languages provided. The Triton font has 128 characters (called glyphs), 64 are the printable (UPPERCASE) letters, numbers and various symbols, and 64 are special graphic shapes

Software Licence

This work is based on original C-code downloaded from www.programmersheaven.com in June 2012. No information is available from the site as to the original author or its licence.

All modifications to the original version are copyright (C)2012 by Andrew Lack. The modifications are licensed under the terms of the GNU Public Licence, version 2.

Andrew Lack, December 2012.
E-mail: email.log.go@googlemail.com