Alley Cat Image Format
| Format type | Image |
|---|---|
| Hardware | CGA |
| Colour depth | 2-bit (CGA) |
| Minimum size (pixels) | Unknown |
| Maximum size (pixels) | Unknown |
| Palette | Shared |
| Plane count | 1 |
| Transparent pixels? | Palette-based |
| Hitmap pixels? | No |
| Games |
Graphics in Alley Cat are uncompressed, headerless arrays of packed two-bit pixels inside the executable. The same encoding holds sprites, room tiles, score digits and title lettering. There is no separate bitmap or palette file.
File format
Image dimensions and locations are supplied by code, frame tables or shape lists. Bytes are stored left to right, then top to bottom. For a width divisible by four, the row length is width / 4 bytes and the image length is width * height / 4 bytes.
| Bits in each byte | Pixel |
|---|---|
| 7–6 | Leftmost |
| 5–4 | Second |
| 3–2 | Third |
| 1–0 | Rightmost |
byteOffset = imageStart + y * (width / 4) + floor(x / 4) pixel = (data[byteOffset] >> (6 - 2 * (x % 4))) & 3
The stored rows are consecutive. CGA's alternating 0x0000/0x2000 scan-line banks apply to the screen destination, not to these source images. For screen coordinates within 320×200:
screenOffset = (y % 2) * 0x2000 + floor(y / 2) * 80 + floor(x / 4)
Drawing modes
| Routine | Operation per pixel | Meaning |
|---|---|---|
| copyRect (CS:2D9D) | destination = source | Opaque copy, including colour 0 |
| blitOver (CS:2CCC) | Keep background when source = 0; otherwise use source | Colour 0 is transparent |
| blitAnd (CS:2D35) | destination = background AND source | Colour 3 preserves the background; colours 1 and 2 mask its bits; colour 0 clears it |
There is no separate transparency plane. The AND operation is not equivalent to replacing every non-transparent pixel with its stored colour: the result depends on the background. The viewer's optional transparent preview hides colour 3 for AND sprites and colour 0 for other modes; it is a preview convention, not a full simulation of every blitter.
Palette
Pixel values are indices 0–3. Palette selection is controlled by the program and hardware. The viewer offers CGA cyan/magenta, green/red and bright variants. Its measured Tandy title palette is black, light green, light blue and white. Tandy rooms reprogram the palette, so that title palette is not a universal palette for every scene.
Examples
These are IBM DS offsets; add 0x300 to obtain file offsets:
| DS offset | Dimensions | Length | Contents |
|---|---|---|---|
| 0x2720 + 16 * digit | 8×8 | 16 bytes per digit | Score digits 0–9 |
| 0x2904 + 16 * tile | 8×8 | 16 bytes per tile | Four wall tiles |
| 0x2020 + 8 * tile | 8×4 | 8 bytes per tile | Four room tiles |
| 0x32B8 + 10 * mark | 8×5 | 10 bytes per mark | Ten floor marks |
| 0x6152 | 88×29 | 638 bytes | IBM presents artwork |
| 0x63D0 | 112×22 | 616 bytes | Alley Cat logotype |
| 0x6680 | 112×8 | 224 bytes | Title credits artwork |
Notes
- The BIOS font used for menu text is not embedded in the game. The port supplies its own substitute ROM-style font. The score digits and title lettering above are game graphics.
- No intrinsic minimum or maximum dimensions are stored in an image header. The viewer's width/height input limits are tool limits, not format limits.
- Change pixels in place while preserving the extent of the image. Moving or resizing it requires updating its consumers; a raw exported .bin does not include its dimensions or drawing mode.
Source code
From re-alleycat, the open-source HTML5 port (revision b003aa63ffbb):
- viewer.html – pixels(), palettes, fixed graphics and catalogue
- src/game/prims.js – copyRect(), blitOver(), blitAnd() and CGA addressing
- src/game/score.js – score-digit graphics
- src/machine/bios.js – BIOS font distinction
- docs/RE_NOTES.md – observed Tandy palette
Credits
This file format was reverse engineered by VorticonCmdr. Please credit the original research when using this information in your own project, and include a link back to this wiki.