Focus Homepage

Focus running on a ZX Spectrum emulator

Introduction

Focus (a Free OS for Computers with Unimpressive Specifications) is (or will be) an open source project to develop an operating system for low-spec and homebrew computers.

The plan is to make a portable and highly configurable OS, so the majority is written in C, with a little assembly for really low-level stuff. Although the idea was always to run Focus on my homebrew Z80 system, the first release is being developed for the Sinclair ZX Spectrum. Not only can I then re-use most of the code for my own Z80-based system, but the OS can be compiled and run under a readily available emulator, as shown in the screenshot to the right. I've also made a short demo video (about 150KB) using the RealSpectrum External link emulator.

Latest News - Verison 0.1.0 Available

I've made this very early pre-alpha release available, which does very little other than demonstrate the basic kernel framework. At the moment, the following things are working (to a degree!)...

Interrupt handling

Tasks can be registered to be called periodically from a main interrupt handler using the Z80's interrupt mode 1, as does the Spectrum.

Memory management

The kernel automatically arranges available memory into "buddy blocks" and can allocate/free blocks of various sizes.

Virtual File System

I'm still not too sure how this is going to pan out... The basics are in place, allowing you to register devices and volumes and logically link in actual hardware drivers.

Specturm Device Drivers

The video and keyboard drivers are working, as is a rather rudimentary clicking sound which is used as an error beep. These are combined into a console driver, which can be accessed via the VFS. Currently implemented mostly in C, the driver code is quite large and video in particular is a bit slow. I'm planning to fix this by rewriting most of the architecture-specific stuff in assembly.

Shell Interface

A basic shell with a few built-in commands and environment variable support is (almost) working. This makes use of the console driver and a basic line reader.

If you'd like to be kept informed with updates, please send mail to steve@cosam.org and I'll add your address to the mailing list.

Downloads

You can find the latest sources in the source code repository. The following are also provided for your convenience:

Features

Although a minimal operating system, Focus will provide a stripped down POSIX-ish API featuring most of the system calls familiar to C programmers of Unix or Windows systems.

The most likely scenario is that the first release will be a single user, single processing system. The aim is to get at least something resembling decent multi-processing in there as soon as possible.

Focus adopts the Unix "everything's a file" principal to a certain degree, meaning you can open, close, read to and write to devices as if they were regular files. The current design does however use a more AmigaDOS-like approach to device and volume naming, and there's no mounting necessary. The OS uses a virtual file system; modular device drivers can be plugged into this to offer great flexibility.

Memory management in the initial release is handled with the so-called "buddy system", which avoids fragmentation and yet doesn't need thousands of lines of code. Seeing as the Spectrum doesn't have hardware support for paging or memory protection, this has been left for a later release. Focus will however preform regular checks on various boundries, so you'll be warned if, for example, the stack starts threatening your data.

Tools

The tools I'm using for development at the moment are:

  • SDCC External link
    This open source C compiler targets the Z80 and Intel 8051 CPUs, and others are planned to follow in the future. It can be run on Linux or other Unix systems, or even under Windows using Cygwin External link.
  • RealSpectrum External link
    A great Spectrum emulator, which also features a handy debugger tool and even video capture! The standard ROMs are easily replaced with your own images.
  • Hex2Bin utility External link
    Required to convert SDCC's output into a binary image for use in the emulator, or indeed a real computer!. (If you have trouble with it, delete the executable and run 'make' to recompile it.)