Close
0%
0%

Pac 1024

A full program for Z80 Pac-Man arcade hardware in 1k of space, containing Program, ROMs and PROMs.

Similar projects worth following
The program space in Pac-Man is usually the first 16 kbytes of space in the Z80's memory 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 require use of existing graphics and color/palette PROMs on board, so I include all of them within the $0400 ROM space. Similarly, graphics ROMs are also extracted from the 1K of space.

The program is very limited, as you can only move a cursor around and change the sprite. :D

IT IS NOT A CLONE OF PAC-MAN IN 1K OF ROM. ;)

Everything, including toolchains are further documented via the github link.

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.

Okay...

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. ;)

pacman.zip

A "pacman" romset for your MAME emulator (or burn to EPROMs for "real" hardware.

Zip Archive - 4.97 kB - 01/06/2017 at 04:32

Download

  • 1 × (MAME Emulator?) (No components were necessary other than pac-man emulation

  • Project Post-mortem...

    Scott Lawrence01/06/2017 at 04:36 0 comments

    There are no further updates for this project. I did this more of a proof-of-concept, or a test of my own abilities to see if it was possible to combine program, character glyps, sprites, color and palette ROMs all into 1024 bytes of space. I was curious as to how the constraints would play out, and really just what it would be like to work within those constraints.

    It's a pretty interesting idea, and I'm not really sure there's anywhere to go with it from here. 512ish bytes of program space is a bit too limiting for me. I could probably crunch my code down another 100 bytes by dropping some of the input routine checks and niceties, but I've proven to myself that I can do it, and it's time to move on... ;)

View project log

  • 1
    Step 1

    Download the pacman.zip file

  • 2
    Step 2

    Unzip the file. It will have created a "pacman" directory with various ROM files:

    • the pacman.1k file is the one that all of the other files are derived from
    • pacman.5e is the character ROM
    • pacman.5f is the sprite ROM
    • pacman.6e, 6f, 6h, 6j are the program ROMs. Only the lowest 1kbyte of space is used
    • pacman.7f, 4a are the color and palette ROMs
    • pacman.1m, 3m are the sound ROMs
  • 3
    Step 3

    Drop this "pacman" directory into your ROMs folder for MAME, or wherever all of your ROMs are stored.

    NOTE: you can also just drop the ZIP file into your ROMS folder.

    NOTE 2: Be sure to save aside your REAL pacman ROMs if you have any FIRST.

View all 4 instructions

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates