Decoding Microbee BASIC - an early '80s big BASIC with tiny BASIC roots

Microbee was a range of Z80 based computers developed in Australia during the late seventies as S100 hardware, and then having mainstream success in 1982 when a better packaged and simple (cheap!) version was taken up by one of our schools authorities as a standard machine.

Microbee BASIC is a reasonably good version of BASIC with roots to the tiny BASICs of the late seventies. The authors (there were many, including Dave Griffiths, Ron Harris, Matthew Starr, and others who don’t get any credits) took BASIC ETC and built on it, with floating point routines, I/O routines, Graphics routines etc.

My main joy is recreating the hardware (see the FreeBee Microbee compatible), but along the way I’ve wanted to modify the Microbee BASIC to support extensions to the original hardware - principally supporting Flash ROM for code storage. Rather a lot of that work involved delving into the depths of Microbee BASIC 5.29e in order to figure out how it worked, so I could then move stuff around and modify it.

I hit a threshhold a month or so ago where I realised I had enough documented that I might as well just get on with it and do the whole lot. So I got systematic, doing the core basic routines, I/O routines, integer maths, floating point maths, and finally (the hardest bit) the graphics routines.

So here it is, Microbee BASIC version 5.29e (the version that adds support for extended hires graphics) with most every line commented and links made readable, in a form where simply typing:

z80asm -i basic_529e.asm -o output.bin -llisting.txt

On a linux/MacOS machine running z80asm will give you a perfect byte-for-byte copy of BASIC 5.29e.

Along the way I have learned an amazing amount about how BASICs are built, how to do floating point routines (Taylor approximations are used for everything), and how all three versions of graphics routines (LORES, which is straightforward, HIRES, making use of a hash table of PCG characters to speed identification of unique PCG, and HIRES2, which goes for broke with very confusing self-modifying routines copied into RAM at 0200h).

I found a typo, in the third ATAN Taylor series constant, where the last Mantissa byte is 0C0h rather than 080h. It doesn’t affect things, as 0C0 is interpreted as 080 in packed BCD form.

There’s some shocking code where the machine jumps into the middle of instructions - sometimes I think deliberately in order to save a byte or two, lots of random padding because later authors were frightened to move anything, and right at the end of the Premium ROM a pile of meaningless garbage that’s just there because the author never calculated their end of code, and just went to a 100h boundary.

Go have a look - the listing.txt file:

is the full listing of all the different .asm files in a readable form.

5 Likes

Wow - a major undertaking - well done, and thanks for sharing!