Lode Runner Palette Description SPECIFIC LOCATIONS - PALETTES ---------------------------------------------------------------------- ADR OFFSET TYPE NOTES ---------------------------------------------------------------------- $C37E - $C39D 038E - 03AD PAL Initial Palette loaded $C39E - $C3A5 03AE - 03B5 PAL Animated palettes for ladders and gold piles. $DD6B - $DD6E 1D7B - 1D7E PAL Title screen palette $E650 - $E653 2660 - 2663 PAL Player status screen. ---------------------------------------------------------------------- A 32 byte palette is loaded and is used throughout the entire game. When different colors are needed for a screen or animated objects are displayed, a trick is used to save space. As some of you may know, the space in this game is very limited unless you expand the ROM to 32 KB PRG. Looking at the map that I have provided for easy reference, one can see that the initial palette is located at the PRG address range $C37E - $C39D. Let's set a read break point in FCEUD, to the specific address range stated. $C2DC:A9 3F LDA #$3F ; set high address of PPU to palette 0 $C2DE:A2 00 LDX #$00 ; set low address of PPU to palette 0 $C2E0:20 78 C1 JSR $C178 ; call to set PPU and pan/scroll registers $C2E3:A0 20 LDY #$20 $C2E5:BD 7E C3 LDA $C37E,X @ $C37E = #$0F ; load palette from ROM $C2E8:20 06 C0 JSR $C006 ; call to display to screen $C2EB:E8 INX $C2EC:88 DEY $C2ED:D0 F6 BNE $C2E5 ; repeat until palette is done loading. $C2EF:60 RTS ; return to save $C178:8D 06 20 STA $2006 = #$00 $C17B:8E 06 20 STX $2006 = #$00 $C17E:A5 04 LDA $0004 = #$00 $C180:8D 05 20 STA $2005 = #$00 $C183:A5 05 LDA $0005 = #$00 $C185:8D 05 20 STA $2005 = #$00 $C188:A5 02 LDA $0002 = #$10 $C18A:8D 00 20 STA $2000 = #$10 $C18D:60 RTS $C006:8D 07 20 STA $2007 = #$00 $C009:60 RTS What we have here is pretty much a standard palette display routine, about as simple as it's going to get. Now your basic and initial palette is loaded for the entire game. Before I go on to explain more about Lode Runner's palette system. Let's look at the following list. Initial palette # | Offset | Address 0F - 038E - $C37E (title screen slot) 16 - 038F - $C37F 30 - 0390 - $C380 38 - 0391 - $C381 0F - 0392 - $C382 17 - 0393 - $C383 26 - 0394 - $C384 07 - 0395 - $C385 0F - 0396 - $C386 36 - 0397 - $C387 (animated color slot) Ladders 00 - 0398 - $C388 30 - 0399 - $C389 0F - 039A - $C38A 38 - 039B - $C38B 28 - 039C - $C38C 30 - 029D - $C38D (animated color slot) Gold Piles 0F - 039E - $C38E 16 - 039F - $C38F 27 - 03A0 - $C390 12 - 03A1 - $C391 0F - 03A2 - $C392 30 - 03A3 - $C393 2B - 03A4 - $C394 16 - 03A5 - $C395 0F - 03A6 - $C396 29 - 03A7 - $C397 16 - 03A8 - $C398 30 - 03A9 - $C399 0F - 03AA - $C39A 30 - 03AB - $C39B 30 - 03AC - $C39C 30 - 03AD - $C39D Ladder Animation Colors 26 - 03AE - $C39E 16 - 03AF - $C39F 06 - 03B0 - $C3A0 16 - 03B1 - $C3A1 Gold Pile Animation Colors 20 - 03B2 - $C3A2 10 - 03B3 - $C3A3 00 - 03B4 - $C3A4 10 - 03B5 - $C3A5 Title Screen Colors 38 - 1D7B - $DD6B 30 - 1D7C - $DD6C 16 - 1D7D - $DD6D 12 - 1D7E - $DD6E (background) Here comes the interesting part. Instead of loading a new 32 byte palette, the original palette remains loaded and only the new colors are loaded that are needed at a particular time. I will attempt to explain the title screen first. As you can see according to my chart, the colors are 12, 16, 30, 38. The palette is loaded backwards as they appear in the ROM. The order turns out right as a decrement routine is used. $DD2E:A2 04 LDX #$04 ; start with the 4th color $DD30:BD 6A DD LDA $DD6A,X @ $DD6E = #$12 ; load 4 color palette $DD33:20 06 C0 JSR $C006 ; call to display $DD36:CA DEX ; -1 X $DD37:D0 F7 BNE $DD30 ; load palette until finished Palette: 12 16 30 38 replaces 0F 16 30 38 Now it gets a little more complicated as we move on to the animated colors for the ladders and the gold piles. We shall examine the code for the gold piles first. $C08E:AA TAX ; Transfer A to X $C08F:A9 0F LDA #$0F ; Load color 1 $C091:20 06 C0 JSR $C006 ; call to display $C094:A9 38 LDA #$38 ; load color 2 $C096:20 06 C0 JSR $C006 ; call to display $C099:A9 28 LDA #$28 ; load color 3 $C09B:20 06 C0 JSR $C006 ; call to display $C09E:BD A2 C3 LDA $C3A2,X @ $C3A2 = #$20 ; load color 4 $C0A1:20 06 C0 JSR $C006 ; call to display This routine is called many times to give the gold piles an animated look as the colors change. As this routine is called again, the colors are cycled through as follows: 20, 10, 00, 10 in the very same color slot which is the fourth color. Palette 0F - 039A - $C38A 38 - 039B - $C38B 28 - 039C - $C38C 30 - 029D - $C38D (animated color slot) Gold Piles - 20, 10, 00, 10. There are other palettes in this game with the same type of effects described up above. Perhaps other games use this format. I was asked to find the palette colors in this game by Disch while he was programming the new Lode Funner editor, of course for the game Lode Runner. So I decided to make as organized notes as possible, perhaps the notes could be useful in your Lode Runner hack. Gil-Galad 02/06/2008 http://gilgalad.arc-nova.org/