Software

The Challenge

Although the original plan was always to run my Focus operating system, which may some day still happen, I soon realised that the size of the compiled C code was quickly getting out of hand. Due to the limited address space of the Z80, I'd set myself a limit of 16K for the ROM on which the operating system would reside, leaving 48K for RAM. With only the bare minimum of functionality, and still plenty to do, I was already over half my quota.

Writing the operating system in assembly would result in a more compact (and faster executing) image, at the price of portability and programming difficulty. Having dabbled in assembly language years ago, I got hold of some old ZX Spectrum programming manuals for an intensive refresher course. Thankfully, I quickly got back into the swing of assembly and, although it might not be the most elegant or efficient code at times, it definitely seems to work.

Debugging

As any programmer will recognise, debugging programs on a regular, working computer can be hard enough. Debugging software on a system where you're not even sure the hardware is working as expected is a whole nother story. Seeing as both the hardware and the software are all new, there's often no way of knowing exactly where to look, should a problem appear (and yes, they will appear!). Add a somewhat unfamiliar, low-level programming language to the equation and you've got a proper challenge on your hands.

This in turn means a lot of trial and error, with ample doses of confusion and frustration (see my accounts of troubleshooting the serial and ata interfaces). However, when you do finally find the cause some such myserious problem, it truely is a rewarding and often enlightening experience! If you want to get to know how computers really work, I can't think of a better way to learn than to build your own - from scratch.

The Results

The Z80 system's ROM is an ongoing project; you can check the progress here. The assembly language source code can be browsed here in the source code repository.