Mallard BASIC notes
I've seen the following versions of Mallard BASIC 'in the wild':
|1.11 (run-only)||Supplied with CP/M for the BBC Micro|
|1.29||Supplied with PCW 8000 series|
|1.39||Supplied with PCW 9512|
|1.44||Supplied with Spectrum +3 CP/M|
|1.47||Supplied with PcW 9256/9512+|
|1.48||Supplied with PcW 10|
|1.50 (16-bit)||Sold for the PC|
It does make me wonder how the numbering system worked; if it was just a straightforward increasing sequence, there should be versions 1.30 to 1.38 out there somewhere, for example. Or possibly they were for other platforms; the manual mentions versions for the 8080 processor, and for CP/M-86, for example.
Files saved by Mallard BASIC begin with a 3-byte header:
defb 0FCh ;Magic defb ver ;Version defb prot ;Protection scheme, 0 meaning none
In practice, ver is always either 3 (in files saved by v1.11) or 4 (all other versions). And prot is always 0 for none, or 1 for the only protection scheme. So the magic number sequences are:
FC 03 00 - Unprotected, saved by v1.11 FC 03 01 - Protected, saved by v1.11 FC 04 00 - Unprotected, saved by v1.29+ FC 04 01 - Protected, saved by v1.29+
The main difference between the versions is that a version 3 file may not contain the tokens for VERSION, CVIK, CVUK, MKIK$, MKUK$, CONSOLIDATE, or RANKSPEC.
The Jetsam keyed-access file system creates pairs of files -- a data file containing the actual records, and an index file containing a B*-Tree index. Each file has a 128-byte header; the index file begins with the signature 'Jetsam0', the data file with 'MIOPEN'.
Near the start of the Mallard BASIC executable is a 6-byte area containing installation data:
DEFB runonly ;0 for full BASIC, 1 for run-only BASIC DEFB compress_spaces ;Nonzero to remove unnecessary spaces from ;lines as they are entered. DEFB ver ;Version of install program required to ;install this program DEFW screen_details ;Address of the screen descriptor DEFW keyb_details ;Address of the keyboard descriptor ;(not present in run-only versions)
In 8-bit versions, the table is at offset 001Fh from the start of the .COM file. In the MSDOS version, it is at 0023h, and in the CP/M-86 version it is at offset 01A3h (because the code segment is preceded by an 80h-byte header and a 100h-byte Zero Page).
The screen descriptor has this format:
DEFB screen width ;First argument to WIDTH command DEFB screen auto-cr ;Second argument to WIDTH command DEFB editor ;0 for the 'command' (dumb terminal) editor ;0FFh for normal cursor-keys editor DEFS 6 ;ESCape sequence to move cursor left DEFS 6 ;ESCape sequence to move cursor right DEFS 6 ;ESCape sequence to move cursor up DEFS 6 ;ESCape sequence to move cursor down DEFS 6 ;Carriage return, line feed
(In run-only versions of BASIC, this descriptor is only two bytes long, containing the two width values.)
Escape sequences are held in Pascal format, as a length byte followed by the bytes to print. If the first byte of the sequence is 0FFh, the next two bytes are treated as the address of a machine-code subroutine to call.
The keyboard descriptor lists the codes returned by cursor keys. Again, these are held in Pascal format, with a length byte followed by 1-3 ASCII values:
DEFS 4 ;Cursor left DEFS 4 ;Cursor right DEFS 4 ;Cursor up DEFS 4 ;Cursor down DEFS 4 ;Find character DEFS 4 ;Delete right DEFS 4 ;Delete left DEFS 4 ;Delete to character DEFS 4 ;Toggle insert/overwrite DEFS 4 ;Abandon editing line DEFS 4 ;Finish editing line
(Run-only versions do not have a keyboard descriptor).
The protection algorithm used by SAVE "filename",P uses three values as keys; if two copies of BASIC.COM have different keys, they cannot share protected programs.
The three keys are:
- "Serial number" at 0107h
- " & customer" at 0114h
- "Acorn Computers" (not at a fixed location)