\chapter{Overview}

%%%%%%%%%%%%%%%
\section{This Document}

This document describes and implements \OS.  \OS is a multitasking
operating system designed for Pac-Man\footnote{Pac-Man is copyright
and trademark NAMCO.} and Pengo\footnote{Pengo is copyright and
trademark SEGA.} arcade hardware.

This document contains the all-original source code (Z-80 ASM) to build the
core operating system, as well as a few example tasks.  The asm file
generated by this document ([[alpaca.asm]]) is commented as well so
this document is not needed to understand what is going on in that
file.\footnote{I know that this goes against the reason for using noweb,
but this is meant to be used as a learning device for others,
and I feel that having fully documented asm is important for this
purpose.}  This document can be used alone or as the reference for the
generated .asm file.

Pengo is included as well for  the explanations since the basic hardware is
identical to Pac-Man, albeit with its control registers and layout of the
hardware differing slightly.  In fact, Pengo hardware is a superset
of Pac-Man hardware.   Anything that runs on Pac hardware should run on
Pengo.  Pengo adds some other hardware, like the ability to switch
graphics banks, as well as some extra ram, but those details are
outside of the scope of this document.  

About the only main differences is that the sound and color PROMS are
layed out differently.  This will result in colors being "off", or the
sound not sounding right.

It should also be noted that all of the graphics used in the graphics
roms are completely original to avoid copyright issues with NAMCO,
SEGA, or whomever currently holds the copyrights for the original
program and graphics code.


%%%%%%%%%%%%%%%
\section{Hardware Limitations}

The hardware has some distinct and extreme limitations.  The most 
important of these limitations are:

\begin{itemize}
    \item 1 Kb (1024 bytes) of RAM
    \item 16 Kb (16384 bytes) of ROM (Pac-Man hardware)
    \item background of 8x8 tiled characters, four colors each (1 Kb)
    \item 6 floating sprites (16x16 pixels, four colors) (1 Kb)
\end{itemize}

Ms. Pac-Man adds another 8Kb (8192 bytes) of non-contiguous ROM. 

Pengo hardware doubles the RAM to 2 Kb, and has 36 Kb of contiguous
ROM, making for a much more flexible system.  Due to the fact that
we're writing this for Pac hardware primarilly, we will not exploit
these advantages within the kernel of this OS.  If we write this
for the smaller of the two, then it will work on both.


%%%%%%%%%%%%%%%
\section{Project Goals}

The goals of \OS are to provide task management, messaging, basic
semaphores, simple ram management and a graphical user interface
for a few tasks concurrently running on the arcade machine computer.
The number of runnable tasks will be fixed.  This all comes together
to form a fully pre-emptive multitasking operating system can be
built on such a tight hardware platform.

I fully realize that there are other multitasking OS's for the Z80
architecture.  I know that this is not the first, but I highly doubt
any other package is as fully documented as this one.

The design of the architecture is detailed in \S\ref{chp:kernelarch}.

The footprint of the OS Kernel is designed to be very small to
allow for user code and data to be as large as possible.  

Being that the OS is currently in development, I'm shooting for no
more than 1Kb (1024 bytes) of space to be used by the kernel,
library functions and data, allowing for 15Kb (15360 bytes) of
program space for applications and games to be implemented.  I'm
also trying to keep the number of sprites and tiles used down to
a minimum as well for similar reasons.  The OS uses upper and
lowercase character sprites, but this can always be reduced down
to just one or the other to gain back 26 character positions.
