Pac/Pengo Multitasking Operating System



Alpaca is a small multitasking operating system for Z-80 computers, specifically for Pac-Man/Pengo arcade hardware. It is an expansion upon my PTUI project, which was originally just an experiment to see how much of a real GUI can be put into the tight constraints of Pac-Man arcade machine hardware. The limitations are a total of 1kb of RAM (for storage and stack), 16k of ROM, sprite/tile based video hardware (1k color, 1k character ram), joystick, and two buttons.

The features of the OS are:

  • up to 4 processes concurrently running
  • simple inter-process communication via messages
  • simple semaphores
  • simple memory management (eventually)
  • adjustable priorities (eventually)

The features of the GUI (PTUI) are:

  • Joystick and start buttons navigate
  • Window frames can be moved about the screen, raised, hidden
  • Build-configurable color schemes, frame ornaments
  • Many widgets including: push/radio/check/spin buttons, sliders, text display


[This page] [ Overview | Screenshots | News | Downloads ]

[Other pages] [ Turaco CL | Pac Hardware Hacking ]

[Related projects (not mine)] [ Contiki | IntyOS ]

Development Phases

--== Phase 1 ==--

This is the current phase of development. This phase will include:
  • 4 concurrently running tasks
  • simple semaphores
  • simple messages
  • exec subsystem (exec, kill, sleep)
  • simple memory helpers (memset, memcpy)
  • simple screen interactions (clear, fill screen, draw text)
  • simple example tasks (each do different things to show it works)

--== Phase 2 ==--

This phase will involve the addition of some or all of the following:
  • Complete GUI
  • adjustable priorities
  • dynamic ram allocation
  • Ports to other related platforms (Bally-Midway MCR2 for example)


Screenshot of the splash screen. The lower right Umlaut Llama is a floating sprite, which does a lissajous on the screen.

Cleaned up the look of the interface, got the z-order raise-lower almost working.
NOTE: This is of the PTUI system, which is not implemented in Alpaca yet!


<< Fri Aug 22 2003 - 15:35:02 EDT >>

It is now a 136 page document that builds down into 1458 bytes. Many little things have been added, and the task switching code has been formulated, although it might not work.... I haven't written exec or kill yet. ;)

<< Tue Aug 5 2003 - 16:28:07 EDT >>

As of last night, The following functions are also completed:
  • putstr - Draw text to anywhere on the screen
  • textcenter - Center the text
  • textright - Right justify the text
The demo build is now up to 1406 bytes, but that includes quite a bit of test code and stubs.
    Up next to write:
  • Task switcher
  • Task Exec core
  • Task Kill core
  • puthex - draw a hex (base-16) value on the screen
  • putbcd - draw a decimal integer (bcd) value on the screen
  • putint - draw a decimal integer (base-10) value on the screen
Oh, and apparantly, Alpaca was mentioned on July 28 on the weblog at /dev/null. Cool!

<< Fri Aug 1 2003 - 11:41:42 EDT >>

The demo build is now 1162 bytes. This includes the following utility functions:
  • memset - set a chunk of ram to a certain value
  • clear screen - clears the screen
  • sine - sine of a value (using a lookup table)
  • cosine - cosine of a value (using sine)
  • rand - very pserdorandom number generator
  • xy2offs - convert XY to video/color ram offset (using a lookup table)
  • sleep - timer-based wait mechanism (seperate from the task switcher)
But it does not include yet:
  • working semaphores
  • task switching
  • messaging
  • a proper 'sleep'
I also was vaguely looking in to porting to Bally-Midway MCR/1,2,3 hardware. This would enable the OS to run on Tron, Satan's Hollow, Spy Hunter, Tapper, Two Tigers, Journey, Discs Of Tron, etc. hardware.

I also have a goal set for myself. The core kernel (with utility functions listed above, and perhaps more) must not exceed 1k of ROM space. It currently uses 138 bytes too many, but that also includes test code for tasks. Just the core stuff right now is 669 bytes. So I have 335 bytes to implement:

  • task switching
  • correct "sleep"
  • puts - draws a text string to the screen
  • puti - draws an integer value to the screen
  • puth - draws a hex value to the screen

pacman ROMs

pengo2u ROMs

PDF source .tar.gz
  • everything from 0.7 below
  • XY to screen offset conversion routines
  • text string output routines for the three screen regions
  • text justification routines (center, right)
  • guicls routine to clear the screen to a wallpaper
  • better rand() algorithm using the R register
  • splash screen implemented
  • Task switching coded and partially documented
  • Document has better organization
  • 136 page PDF, 1458 byte executable
  • v0.7
    pacman ROMs

    pengo2u ROMs

    PDF source .tar.gz
  • sets up the processor, design hammered out
  • implements: timer and watchdog in ISR, cls, memset, sleep
  • half-implements: exec, kill, sleep(0)
  • not implemented yet: task switching (!)
  • 99 page PDF, 626 byte executable