Welcome to the Pac-Man palette hacking document. I'll try to explain this to the best of my ability, but please understand I'm no expert and I learn most of what I know by figuratively whacking things with a monkey wrench.
Table of Contents
The 7F Color PROM (The Lookup Table)
The 4A Color PROM (The Palette PROM)
List of All Palettes
Changing Maze Palettes in Ms. Pac-Man
Changing Maze Palettes in Pac-Man
Changing Fruit Palettes in Pac-Man
There are two color PROMs on Pac-Man boards- the 4A and the 7F. Before we can get into any of that, however, we need to take a look at all the possible colors Pac-Man hardware can generate.
The above "color map" was created using the attract mode for an earlier Namco game titled "Bomb Bee". The Bomb Bee attract mode includes a few separate "strips" of color for red, green, and blue, as well as some isolated greys, which I've also included above for easy reference. Bomb Bee is the preceding hardware to Galaxian, and Pac-Man is the succeeding hardware. Don't worry too hard about what that means. If you ever want to hack Galaxian (or games for similar hardware such as Scramble) the color map displayed above should also apply to those games (as well as Dig Dug, Galaga, and many others).
Anyways, back on track- these colors are all assigned hexadecimal values and these values (taken from the color map itself) are used by the 7F, which you'll see below as the white values in the following table:
The values depicted in blue above every color value are the individual "numbered slots" that each color is loaded into. There are 16 slots total, but the first slot is occupied by the black color that the game uses for transparency. Here's a quick visualization of the above data:
Basically, the 7F is a sort of "digital paint palette" containing all the colors the game can use, hand-picked from the gigantic 256 color map above. Visualizing it as an actual artist's palette might help you understand if you find yourself struggling.
If you want to add additional colors while retaining compatibility with the original palettes, there are three unused duplicates of black in slots 04, 08, and 0A. You can replace these with whatever colors you like to add three extra available colors to your hacks. Simply open the "82s123.7f" file from an unzipped pacman.zip MAME ROM in a hex editor of your choice, locate a color in the color map at the top of this page that you'd like to use, and then type in the value of that color over one of the unused duplicate 00 values in the 7F file. Once you've added the additional colors you'd like (or modified the pre-existing colors), save your changes and you're good to go.
The above visualization, as well as everything we've discussed so far, has relied on values assigned by the color map. But from this point forward, after we've picked the colors we like and made whatever additions or changes necessary, we're no longer going to be using these values. Why? Well, because the 4A PROM doesn't use them.
The 4A assigns its color data using the values used by the slots, not the color map, meaning that if you want to use the color red somewhere in the 4A, instead of typing in 07 (its color map value), you have to type in 01 (the slot it occupies in the 7F PROM). Below is the 7F data again, but with the color slot values instead of the color map values:
(Remember that if you haven't already, you can insert three additional colors into the three unused slots listed above.)
You'll see these same 7F slot number values used throughout the 4A PROM, which contains the following data:
I've split up the 4A data into four colored "blocks" to help explain my next point- the 4A contains 32 different palettes, organized in groups of 4 colors each, with the very first color in each palette being transparent black (meaning we technically have three "useable" colors per palette).
Above is a visualization of the 4A data, now with every individual palette grouped up, blocked off, and assigned its own palette number. Yes, there is a third set of values here but this time each value represents a palette composed of four colors. This third and final set of numbers is what the game code itself most commonly uses to assign palette data to the graphics on-screen. Below is a list of every palette and what they're used for:
Any modifications you make to the above palettes will modify the associated graphics. Thankfully though there are a lot of unused palettes you can use to squeeze in more colors- ten of them, in fact. Palettes 02, 04, 06, 08, 0A, 0B, 0C, 0D, 13, and 1C are all unused and may be repurposed as additional palettes for your hacks.
When used to color mazes, each palette's colors are assigned the following way:
For example, the first maze in Ms. Pac-Man is colored the following way:
This gives us the traditional "reddish pink" starting maze in Ms. Pac-Man.
Let's say we wanted to change this to a different pre-existing palette (for the sake of this example, at least- realistically you're free to create whatever palette you like in the unused slots and use those instead). I'm going to change this to palette 15.
To do this we open the "boot6" file from an unzipped "Ms. Pac-Man (bootleg, set 1)" MAME ROM (mspacmab.zip) in our hex editor and then go to address 5AE. You should be greeted with the following data (copypasted from Scott Lawrence's Ms. Pac-Man Disassembly):
95AE 1d 1d ; color code for levels 1 and 2 95B0 16 16 16 ; color code for levels 3, 4, 5 95B3 14 14 14 14 ; color code for levels 6 - 9 95B7 07 07 07 07 ; color code for levels 10 - 13 95BB 18 18 18 18 ; color code for levels 14 - 17 95BF 1d 1d 1d 1d ; color code for levels 18 - 21
Locate the first 1D at address 5AE and overwrite it with the palette value of your choice (15, in my case). Then save your edit, rezip the ROM (make sure the folder name is still "mspacmab.zip") and paste it into your MAME ROM folder. Boot it up (because the file is altered MAME will give you an "incorrect checksum" error- just ignore that and continue) and start a game, and provided you don't run into the infamous "red and blue maze bug" detailed here, the first maze should now reflect the change you made.
Because every individual level from 1 to 21 (before the game loops) has its own dedicated color code, you can give unique palettes to all your maze designs. This means that even though levels 1 and 2 in a stock game of Ms. Pac-Man are the same color, we can change that so that level 2 is a unique palette separate from level 1, as pictured below:
To accomplish this all we have to do is modify the second 1D value located at address 5AF in the boot6 file. In this case I've modified it to use palette 12.
Compared to Ms. Pac the color palette used by the maze in Pac is overall less flexible. There's technically three color palettes used by just the single maze that exists in Pac-Man- palettes 10, 1A, and 1B. 1A and 1B are duplicates of palette 10 used to control the ghost behavior in certain scenarios (1A prevents ghosts from changing direction when in the outer perimeter of the ghost house, and 1B is used to slow ghosts down in tunnels). What this means is that changing the palette used by the maze purely by altering the ROM code is ineffective- you would have to dedicate three separate palette slots to replace all three of the original palettes (assuming you intend each palette to be identical like in the original game, but this can work in your favor if you'd like alternate palettes for the tunnels in your hack).
A much simpler and easier way to accomplish a technically superior result is to modify the 4A file instead, changing the values for the three maze palettes directly in the 4A without making any alterations to the actual game code itself. Let's head into the 82s126.4a file from an unzipped pacman.zip MAME rom and change all instances of 0B (Blue) in palettes 10, 1A, and 1B to 0D (Teal) instead. Save the changes, rezip the folder, run the game in MAME and the result is...
...a teal maze, a la Pac-Man Plus. This is one of the handful of changes Midway made to the original Pac-Man color PROMs in Plus which makes it incompatible with the original PROMs.
Let's say you wanted to do away with the "neon outline" look and fill in the mazes with an additional color like in Ms. Pac-Man. All you have to do is change the "middle color" between your outline color and the pellet color. Below is an example result:
Because Pac-Man lacks the "filled-in" tiles used by Ms. Pac-Man to fully fill the "insides" of the mazes we get unsightly black holes in any of the "box" shaped bits of our maze, but we can fix this by adding in those additional tiles from Ms. Pac and then editing the maze in a program like AGE.
First things first- there are two sets of fruit palettes in both Pac-Man and Ms. Pac-Man. One set is for the fruit items themselves as they appear in the maze, and the other set is for the fruit "icons" that appear on the bottom of the screen to denote what level you're on.
The color values for the Fruit Items in Pac-Man are found in the pacman.6e file at address EFD and begins with the Cherry. The following data is taken from Scott Lawrence's Ms. Pac-Man Disassembly:
; table for fruit sprites, colors, point value. pac-man only, not used in ms. pac ; (the 3 bytes are stored in the above order) ; [the corresponding ms pac fruit table is at #879D] 0EFD 00 14 06 ; cherry 0F00 01 0F 07 ; strawberry 0F03 02 15 08 ; 1st peach 0F06 02 15 08 ; 2nd peach 0F09 04 14 09 ; 1st apple 0F0C 04 14 09 ; 2nd apple 0F0F 05 17 0A ; 1st grape 0F12 05 17 0A ; 2nd grape 0F15 06 09 0B ; 1st galaxian 0F18 06 09 0B ; 2nd galaxian 0F1B 03 16 0C ; 1st bell 0F1E 03 16 0C ; 2nd bell 0F21 07 16 0D ; 1st key 0F24 07 16 0D ; 2nd key 0F27 07 16 0D ; 3rd key 0F2A 07 16 0D ; 4th key 0F2D 07 16 0D ; 5th key 0F30 07 16 0D ; 6th key 0F33 07 16 0D ; 7th key 0F36 07 16 0D ; 8th key 0F39 07 16 0D ; 9th key
The second value in this table is the color palette for each individual fruit and you can refer to the above list of palettes further up on this page for reference if you'd like to alter any of them. Take note how the "duplicate fruits" are actually two separate entries- you can use this to your advantage in your hacks by changing these fruits into new ones or creating alternate color variations, or you can repurpose all 9 duplicate keys as entirely separate fruits if you can manage to squeeze in enough new graphics.
The data for the Fruit Icons can be found below:
; pac-man data follows, fruit table ;3B08: 90 14 ; cherry ;3B0A: 94 0F ; strawberry ;3B0C: 98 15 ; 1st orange ;3B0E: 98 15 ; 2nd orange ;3B10: A0 14 ; 1st apple ;3B12: A0 14 ; 2nd apple ;3B14: A4 17 ; 1st pineapple ;3B16: A4 17 ; 2nd pineapple ;3B18: A8 09 ; 1st galaxian / pretzel ;3B1A: A8 09 ; 2nd galaxian / pretzel ;3B1C: 9C 16 ; 1st bell / banana ;3B1E: 9C 16 ; 2nd bell / banana ;3B20: AC 16 ; 1st key ;3B22: AC 16 ; 2nd key ;3B24: AC 16 ; 3rd key ;3B26: AC 16 ; 4th key ;3B28: AC 16 ; 5th key ;3B2A: AC 16 ; 6th key ;3B2C: AC 16 ; 7th key ;3B2E: AC 16 ; 8th key
Like before, the second values here are the color codes. The first value is the sprite ID. There are two sets of graphics for the fruits in the game data, despite being identical- one set for the fruit items and another set for the icons. If you alter one of the "types" of fruit, don't forget to change the other!
For a quick example, I modified the cherry values and graphics and changed it into a carrot, taken from this sheet of custom Pac-Man graphics by SuperJustinBros.
Here you can see the modified icon:
And here is the modified item: