BASIC-11 Interpreter for the Z80

I recently recovered a bunch of old BASIC programs from a RT-11 floppy disk, dating from the times I worked on a PDP-11 machine. I wanted to run them on my P112, but I'm a lazy person: instead of porting so many BASIC source files to another BASIC dialect (e.g MS-BASIC), I simply ported the interpreter .

Programs written for BASIC-11 can be often recognized by the use of the backslash character "\" as statement separator in place of the more common colon ":". Some of the string manipulation functions are different than e.g. in MS-BASIC (SEG$ instead of MID$, POS instead of INSTR, etc.) but that's an area where the different BASIC dialects tend to differ from each other. BASIC-11 is also noted for supporting virtual arrays, which allow the user to manipulate large amounts of data that otherwise would not fit in RAM. Other than that, it is a pretty basic BASIC.

Note that this is a port of the simple BASIC-11 interpreter, and not the much more complex (bloated?) Basic-PLUS. The port is pretty much complete except for CALL statement support, which was normally used to call machine-language routines. But where in e.g. MS-BASIC one could just specify the machine-language routine address in the CALL statement, in BASIC-11 you had to link your routines with a special reference table to the interpreter so the routines could be called by name. Thus, it was more like some primitive form of language extension and therefore not very popular.

The port is very accurate: same token values are used, and even the floating point number format is maintained (as a side note, DEC's floating point format differs from Microsoft's only in the position of the mantissa sign bit). Programs that were saved in "compiled" (tokenized) format in RT-11 load and execute properly. Programs "compiled" in RSX-11M probably won't, since the standard IAS/RSX version of BASIC-11 had a known bug that caused corruption of the tokenized files during the disk write operation. In any case, it was common practice for BASIC-11 users to save their programs in plain ASCII format.

There is only one minor difference, and is that the port accepts a question mark "?" as a synonym for the PRINT statement, whereas the original BASIC-11 did not.

Last modified 23-Aug-2018