The program space in Pac-Man is usually the first 16 kbytes of space in the Z80's mrmory space. This is from $0000 through $3FFF. Since we're limited to 1024 bytes, we're only using $0000 through $03FF.
Pac-Man hardware uses dedicated PROMs and ROMs for sound waveforms, character glyphs, sprites, and color palettes. I feel like it would be cheating for the contest to requre use of existing graphics and color/palette PROMs on board, so I include all of them within the $0400 ROM space.
The graphics are not accessible from the CPU normally, and in this case, they're still not, but since all data is derived from this single ROM image, we are able to see it from the CPU. We do not take advantage of this though, although I could see being able to use them to make large rendered text on the screen or somesuch.
Each character is 8x8 pixels, at 2 bits of depth. Each pixel can be one of three colors in the selected palette. Sprites are the same way, but they're 16x16 pixels.
Normally, the character rom contains 255 characters, in a 4kbyte rom (PACMAN.5E), with each glyph being (4096/256) 16 bytes long. For this exercise, we're only using the character glyphs for ASCII '0' through '9', plus 'A'-'F', all starting at 0x300. This uses up a decent chunk of our memory space.
Sprites use 4 times the amount of storage, as they're 16x16 pixels, so they use 64 bytes each. The two of these that I have in this project are 128 bytes of storage, or 1/8 the full space available for the project! The two sprites are at 0x280 and ox2C0.
You can see the graphics and sprites via MAME by hitting "F4". Use the joystick left and right to scroll through the color lookup tables and the characters/sprites. Up/Down will select the color palette used to view the sprites. Try color 1, with GFXSet 0 for example. You will see some garbage which is the program code, then the sprites all jumbled up, then the digits 0-9,A,B and some solid blocks of color. With GFXSet 1, you'll see something similar, but the sprites will now be assembled (circle and ghost) while the digits are all jumbled together.
I should also note that the color PROM and palette PROMs are extracted from the 1k ROM as well. The 16 byte Color PROM is extracted starting at 592 bytes and the 256 byte palette PROM is extracted starting at 608 bytes. If you use the F4 browser of Mame, you'll also see here that the Color PROM is is mostly garbage. I needed more space for the program, so the Color PROM is inaccurate with the original game.
Sound ROMs are extracted starting at the beginning of the ROM since we don't care about those right now anyway.
All of this is taken care of in the Makefile, through the use of 'dd' on the assembled 1kbyte ROM file.
All of this adds up. We end up with right around HALF of the available 1 kilobyte alotted!
I did this mainly because I wanted to see if I could, since I'm pretty sure it's never been done before (and with good reason).
Sadly, with everything going on in the past month, I have not been able to make a full game out if this, but instead made this little toy that moves a couple sprites around the screen while you move the joystick.
If you want to try this in a real Pac-Man arcade machine, you do not need to replace any of the PROMs, as the colors and palette are subsets of the "real" PROMs, and the sound PROMs are ignored. The character ROM (5E) should be fine, and the sprite ROM (5F) can be left in place. In fact, all you need to program is the 6E ROM and drop that one on the board, and you should see something. ;)