# Pacman character definitions

In ROM, a character is defined by a matrix of 8x8 pixels, with 2 bits per pixel. This makes it possible to store 4 pixels in a byte, and a whole in 16 bytes. Within a byte the bits are arranged in the following order:

Bit | Description
0 | Bit 0 of pixel #1
1 | Bit 0 of pixel #2
2 | Bit 0 of pixel #3
3 | Bit 0 of pixel #4
4 | Bit 1 of pixel #1
5 | Bit 1 of pixel #2
6 | Bit 1 of pixel #3
7 | Bit 1 of pixel #4

If the character pixel at X, Y is aXY then a character has the following layout:

>     a00 a10 ... a70
>     a01 ...     a71
>     ...         ...
>     a07 a17 ... a77

and the first eight bytes in the character map define the lower four rows:

>     a77:bit1 a76:bit1 a75:bit1 a74:bit1 a77:bit0 a76:bit0 a75:bit0 a74:bit0
>     a67:bit1 a66:bit1 a65:bit1 a64:bit1 a67:bit0 a66:bit0 a65:bit0 a64:bit0
>     a57:bit1 a56:bit1 a55:bit1 a54:bit1 a57:bit0 a56:bit0 a55:bit0 a54:bit0
>     a47:bit1 a46:bit1 a45:bit1 a44:bit1 a47:bit0 a46:bit0 a45:bit0 a44:bit0
>     a37:bit1 a36:bit1 a35:bit1 a34:bit1 a37:bit0 a36:bit0 a35:bit0 a34:bit0
>     a27:bit1 a26:bit1 a25:bit1 a24:bit1 a27:bit0 a26:bit0 a25:bit0 a24:bit0
>     a17:bit1 a16:bit1 a15:bit1 a14:bit1 a17:bit0 a16:bit0 a15:bit0 a14:bit0
>     a07:bit1 a06:bit1 a05:bit1 a04:bit1 a67:bit0 a06:bit0 a05:bit0 a04:bit0

The following eight bytes define the upper rows with an identical layout.

It might seem strange that the pixels in a byte are arranged in columns rather than in rows, but this an artifact due to the screen being rotated by ninety degrees in the cabinet. I have decided to talk directly in terms of the actual screen but if we consider the natural screen layout then pixels do take the more usual arrangement where pixels in a byte refer to pixels that are in the same row.

Copyright (c) 1997-2004 Alessandro Scotti . All rights reserved.