Hacker News new | ask | show | jobs
by HarHarVeryFunny 923 days ago
That list is missing Acorn's ISO Pascal from c.1981 of which I was co-author, maybe the epitome of "Pascal for Small Machines".

Our Pascal ran on the 6502-based BBC Micro which had 16K or 32K of RAM (model A/B), and by default no external storage other than a built in cassette tape interface. Floppy disks were a fairly expensive add-on that schools may have bought but most home owners did not.

Given the typical lack of floppies, and wanting the "instant on" experience of BBC BASIC, we delivered ISO Pascal in two 16K ROMs (i.e. chips) that the user plugged into "sideways ROM" slots in the motherboard. Typing *pascal would enter our Pascal language environment where a command line would let you compile and run programs and enter/edit them using a full screen editor (which went on to have a life of it's own as an editor used both internally at Acorn, and as a user product).

The BBC Micro's memory space had 16K for the "operating system" (MOS) which contained assembler entry points for all the built in functionality, 16K for a "language" (by default BBC BASIC), and 32K for RAM (16K installed in model A), thereby using up the entire 64KB 6502 address space.

Getting Pascal to run in the available space was the key challenge, both for the language itself and for user programs. The 6502 is great to write assembler programs in, but has very poor support for high level languages meaning that compiling to 6502 machine code was out of the question since it would severely limit the size of the programs the user could fit in the available RAM. To achieve better code density we instead compiled to a stack-based virtual machine code, similar in concept to UCSD p-code that we called BL-code (I'm the "B").

Our compiler was self-hosting, written in Pascal, and compiled to just over(!) 16K of BL-code. In order to get it down to 16K we had to post-process it to replace common sequences of BL-code instructions with macro instructions we added for this purpose.

The other 16K ROM contained the BL-code interpreter (VM), the screen editor (4KB) and the Pascal run-time libraries (floating point copied from BBC BASIC, integer math, Pascal I/O, heap, etc). This also was a squeeze utilizing many 6502 tricks to save one byte at a time until it also fit into 16K.

If you've really paid attention to the above description, you might notice a slight problem .. the Beeb address space only had room for ONE sideways ROM to be addressable at a time, but our compiler, and the BL-code VM/interpreter needed to run it, were in two separate ROMs! To address this, the VM/interpreter was self-relocating and would relocate itself into RAM to run the compiler. To run user programs the VM ran from ROM.

The UCSD P-system had preceded ours, but targeted larger Z-80 systems with floppies and 64KB of RAM. It was also not standard Pascal. Ours was the first full standards complete & compliant Pascal to run on a diskless machine. The British Standards Institute (BSI) had adopted the ISO Pascal standard, and during development we made a number of trips from Acorn in Cambridge to the BSI in London to run their test suite and obtain feedback. Eventually, after it was released, PM Margaret Thatcher had been visiting the BSI who proudly showed off our ROM-based ISO Pascal as an example of British innovation!

1 comments

> The UCSD P-system had preceded ours, but targeted larger Z-80 systems with floppies and 64KB of RAM.

The P-system originally targeted the PDP-11; and after that it targeted lots of things. I used it on PDP-11, 6502, and some HP machine; I never actually saw it on Z-80, though I'm sure it was available.