Close

Micro-Soft BASIC and π

A project log for Gigatron TTL microcomputer

Just because! A home computer without microprocessor

marcel-van-kervinckMarcel van Kervinck 10/16/2019 at 19:320 Comments

It took a while, but now Micro-Soft BASIC is running on the 32K Gigatron! We already had Tiny BASIC of course, but that doesn't have 9 digits floating point (40 bits), let alone transcendental functions. Remember when Hackaday wrote that the Gigatron would probably never have floating point?

This is the BASIC that Paul Allen and Bill Gates wrote with Monte Davidoff and Ric Weiland, and for which they started Microsoft, or spelled Micro-Soft back then. They licensed it to many microcomputer builders, amongst others to Commodore. The version we have running is an early one for the Commodore PET. 

Although the system can interpret 6502 code, there still was work to do: code, buffers, zero page variables and stack needed relocation, but that wasn't the biggest hurdle as Michael Steil's excellent set of reconstructed assembly sources made that relatively painless. The main problem was to create a sufficiently large continuous memory space. Although the Gigatron has 32K of RAM, 19KB of that is used for screen memory and the remainder is heavily fragmented. For example, by default the largest continuous block we have is just 512 bytes. BASIC itself needs 8KB, plus we need some K's for user program and variables. Ouch... 

The first win is to disable the sound channels 2 through 4. That creates a continuous block from $200 to $800. For this trick you need ROM v4.

The next step is to compress the video memory. Our video resolution is already next to nothing, but we can always lower it even more! Of the 120 visible pixel lines, every 8th is always empty. At least, as long as we only use capitals, and for a mid-1970s BASIC that's perfectly acceptable. The empty pixel lines can then be shared for all rows of text. That saves 14*256 = 3585 bytes already.

The last trick is to increase the spacing between text lines from 1 to 4. This reduces the text lines from 15 to 11, but yields 4 * 7 * 256 =7,168 bytes.

Of course we then went overboard and added a flashing cursor, we made sure that the WAIT 6502 Easter Egg works, and that there is a π-symbol. The Gigatron doesn't have that in its font, but it does have T and U.... And... the font is stored without horizontal spacing, so there's our glyph:

  R         S         T   pi    U
  |         |         |   |     |
  v         v         v   v     v
  x x x x . . x x x . x x # # # # . . . x
  x . . . x x . . . . . . # . . # . . . x
  x . . . x x . . . . . . # . . # . . . x
  x x x x . . x x x . . . # . . # . . . x
  x . x . . . . . . x . . # . . # . . . x
  x . . x . . . . . x . . # . . # . . . x
  x . . . x x x x x . . . # . . . # x x .
  . . . . . . . . . . . . . . . . . . . .
  0 1 2 3 4 5 6 7 8 9 a b c d e f 1 1 1 1
  ^                               0 1 2 3
  |
  font82up

Good enough for me:

Discussions