<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>
Date   : Tue, 20 Sep 1988 16:44:15 GMT
From   : oliveb!intelca!mipos3!cadavr!dbraun@ames.arc.nasa.gov (Doug Braun ~)
Subject: Z-80 Unix?

In article <278@pte.UUCP> car@pte.UUCP (Chris Rende) writes:
>In his book "The Unix Operating System" Kaare Christian mentions that Unix
>exists for the Z-80. This was a big suprise to me. I didn't know that Unix ran
>on any 8 bit CPU's.

I wrote one a couple of years ago.  It is a totally from-scratch implementation
of the Unix kernel for a 64K CP/M machine.  It runs just fine on my machine,
being able to support the 7th edition shell with no problems. I would be
glad to mail the source code or post it to the net.

It works like this:  The kernel is in the top 32K, and a process exists
in the bottom 32K.  Process switching happens by total swapping.  This 
arrangement is like the "Mini-Unix" that Bell Labs put out for the smallest
PDP-11's a while back.

Virtually all of the 7th Edition system calls, and most of its functionality
are implemented.  Here are the restrictions that I remember offhand:

The debugger system call does not exist (but profiling does exist).
The TTY driver is bare-bones and supports only one TTY.
Inode numbers are 16 bits, so there can be only 32 Meg partitions.
The seek system call uses the old 6th Edition arguments (no 32 bit arguments)
The time and stime system calls use the MS-DOS format for times.
Because of the total swapping, disk I/O is synchronous.  There is no point
running another process while one waits for disk I/O, since you would
have to swap it in.  The locks and semaphores needed to implement this are
also not present.

On the bright side, everything else seems to work fine.  Execve, fork, wait,
etc., all work correctly.  The number of processes is limited only by table
sizes (and your patience).  Links, pipes, random file access, owner, and 
group permissions work correctly.  The 4.2BSD stdio library was ported
to the system.

This was written to run on my custom-built hardware.  There is no hardware
memory management, just custom disk, tape (9-track!!), and serial I/O
hardware.  Of course, the system supports major and minor devices and
character and block device tables, so adding in new drivers is not too
hard.

The kernel was completely written by me, but unfortunately I cannot legally
distribute the shell, ed, cpp, tar, and 15 or so other utilities I ported
to this system.  It was compiled by the Q/C compiler (under CP/M) along
with a ported version of cpp.  Also, I was never able to get the C
compiler to fit in 32K, but cpp, a patched version of the M80 assembler,
and a linker written by me all run under the system.  I also wrote
some utilities such as fsck and ps that are very kernel-dependent.
Most of the Minix programs would probably port to this system, though.

If anybody would like to look at this stuff, let me know, and I will
dig out the disks and figure out how to upload them.

Doug Braun                             Intel Corp CAD
                                       408 765-4279

 / decwrl \
 | hplabs |
-| oliveb |- !intelca!mipos3!cadev4!dbraun
 | amd    |
 \ qantel /

<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>