ROM Library and Bootstrap Code

The memory board had an EPROM that mapped to the first 16k of memory. In it we stored the code used to initialize the system and some routines that would be useful to programs, such as writing to the display, getting a line of input from the keyboard, converting decimal to hex, and copying strings around.

Before we got the serial port working, our programs had to be burned on the EPROM as well, since we had no other way to get data into the system. The main routine was simply appended to the library code.

Here are a few of the files we used regularly:

HTML Raw Description
rom.asm rom.asm The main routine that we assembled. This #includes the other library files, contains some test scaffolding, has some interrupt-handling routines, and converts keyboard codes into ASCII. The include of image.asm was for displaying precompiled images on the monitor that was eventually added using the video board.
library.asm library.asm Contains the bootstrapping code and some library functions, including a routine to print to the display.
stdio.asm stdio.asm Contains a gets() function to get a line of input from the keyboard. Was eventually going to have more routines from C's stdio.h header.
string.asm string.asm Contains a strcpy() function to copy a string. Was eventually going to have more routines from C's string.h header.
printf.asm printf.asm A C-like printf() routine that handles %d, %x, and %s.

PIC Code in I/O Board

The I/O board had a PIC chip to do most of the I/O work. The PIC chip had an EPROM built-in, which we programmed to communicate with the Z-80 CPU.

Here's the HTML and raw versions of the source code. Basically it's responsible for the following things:

We developed a simple protocol so that we didn't have to use several interrupt channels. Only a single IRQ channel was used on the 8259 and the CPU asked the PIC what kind of data was available.

C Compiler

Lawrence wrote a very simple C compiler, which compiled to assembly language. (If you look at rom.asm above, you can see an include of zcc_out.asm.) It wasn't used for anything but small tests. It didn't support structures or floating point, but it did support pointers. You can download the source code.

Operating System

We wrote a very simple multi-tasking operating system, but it was never even tested on the machine. It worked under Linux when interrupts were simulated with alarm signals. The C compiler never got far enough along to compile it. You can download the source code. It was called BLan9 as a pun on Plan 9, the operating system from Bell Labs, and the BL stands for “Brad and Lawrence”.

Logic Analyzer

The problems we had with the CPU board drove us to build a simple logic analyzer that worked through the parallel port of our laptop. This logic analyzer software recorded the values of four pins at up to 70 kHz. The result could displayed, scrolled, and zoomed in an X Window window. After fighting with the CPU board for months, we found the problem in hours with this program—it was obvious by comparing various signals that the 8259 wasn't latching the interrupt pins like we thought it did. There's nothing like good debugging tools. You can download the source code.

« Back