My Photo
Name:
Location: Downham Market, Norfolk, United Kingdom

Sunday, March 26, 2006

One of the things which distinguishes BBC BASIC from other dialects is its compactness: it squeezes a lot of functionality in a small space. The original 6502 versions of BBC BASIC (on the BBC Micro, BBC Master and Acorn Electron) all fitted into a 16 Kbyte ROM, but despite that managed to provide one of the richest feature sets of any BASIC interpreter of the time - as well as incorporating a 6502 assembler.

The ARM version of BBC BASIC, resident in the Acorn Archimedes, Risc PC and Iyonix PC, fits into a 64 Kbyte (?) ROM and provides an extended feature set including multi-line IF...ENDIF, WHILE...ENDWHILE & CASE...ENDCASE structures, array arithmetic, many new keywords and, of course, a full ARM assembler.

BBC BASIC for Windows (run-time version) is not much more than 80 Kbytes, including the necessary overhead for interfacing with Windows. The actual interpreter is only about 64 Kbytes, yet manages to provide not only all the functionality of the earlier versions but Structures, PRIVATE variables, 65535-character strings, new variable types (byte, 64-bit float), event trapping and - you guessed it - a complete 32-bit x86 assembler including floating-point and MMX support!

The compact size of the BBC BASIC for Windows interpreter allows the compile utility (which isn't a real compiler, but attaches a compressed version of the user's BASIC program to a copy of the interpreter) to create standalone executables which are typically smaller than 100 Kbytes. Compare that with its main competitor!

To keep BBC BASIC for Windows as 'lean and mean' as possible, support for things like Windows GUI components (dialogue boxes, buttons and the like) is not built-in but is provided by installable libraries - sections of pre-written BASIC code which are supplied with BB4W and which effectively extend the language by means of callable functions (FN) and procedures (PROC). In general I don't believe in building into the core language features which can perfectly adequately be achieved using libraries: where would one stop? Increasing the size of the interpreter to add a new feature means everybody's executables get larger, whether they use that feature in their program or not.

There is just one problem with this. Because dialogue boxes, buttons and window controls in general are not built into the language, BBC BASIC isn't as good as some dialects at 'cleaning up' after itself. If a user's program opens a dialogue box, but fails to close it before his program exits, the dialogue box may be left active. As the 'dialogue box routine' is typically resident in the heap (by default immediately above the BASIC program) it's very likely to crash when the program is edited, or next run, or almost anything.

Unfortunately this can give the impression that BBC BASIC is 'fragile', i.e. prone to crash for no apparent reason. It isn't really, but users do need to be careful to close dialogue boxes and otherwise 'tidy up' before their program quits, and to include ON ERROR and ON CLOSE statements to ensure this 'tidying up' is done however the program is terminated.

Nevertheless in general I feel this is a small price to pay for the other advantages of such a compact language.

1 Comments:

Blogger Gulsun Eby said...

Thank you for creating BBC BASIC for Windows.

11:02 PM  

Post a Comment

<< Home