Architecture Overview

The KWAK-8 cpu runs programs stored in ROM images, The Emulator can load ROM images from Cartridge png files or from Intel .hex files ROM Images may be up to 128k. Once running the CPU has access to 64k RAM, however CPU instructions cannot be executed from RAM, all code must exist in the ROM.

The Display

The display buffer is a 512x392 pixel area. The screen may show portion of this area measuring either 240x180 (lowres mode) or 480x360 (hires mode). The CPU cannot read from the display buffer. The display buffer stores pixel colours directly and has no concept of palettes. Any paletted operations are converted into colour values before they are written to the display buffer.

Writing to the display can be achieved either by writing bytes individually to an IO port or by utilizing the Blitter. Writing bytes individually can provide easy access to the full 256 colour palette but is CPU intensive. The Blitter can transfer Images from RAM to the display in a variety of formats but is limited to 16 colours per Blit operation.


The full 256 colour KWAK-8 palette

Audio

There are 8 audio voices, each with 8 bytes worth of parameters. These 8 bytes encode

Utilizing the sound Envelope, simple sounds can be played as fire-and-forget effects, more complex sounds can be achieved by dynamically adjusting the parameters as the sound plays.

Inputs

There are 16 bits of button state providing direct polling of arrow keys, WASD, Enter, Escape, Space, Ctrl, Shift, Backspace, Z and X. Z, X and Backspace are logically ORed with the state of the mouse buttons.

The Mouse position may be polled as a pair of Unsigned bytes. This position is measured in lowres mode pixels.

Two pollable 8-bit timers are available, One increments every video frame, the other increments once every second.

A key-buffer interface exists as a single 8-bit port. Reading from the port removes a value from the buffer, When the buffer is empty the port returns a value of zero.

Blitter Formats

The blitter can convert RAM data into display images as

The 8,4,3, and 2 pixels-per-byte formats support transparency and additive rendering.