Patch:Palette

From KeenWiki
Jump to navigation Jump to search

This page covers patches relating to the color palette(s) used in Keen games. The term "palette" covers two different topics.

The first is the actual colors used in the game. By default, Keen games use the standard EGA palette for DOS, as do most id Software games. These colors are preset and cannot be changed. It is however possible to make the Keen Vorticons games use a VGA palette, in which up to 256 colors can be independently defined in terms of RGB (Red, Blue, Green) values from 0–63. Patches involving changin game colors are covered in the first section of this page.

The second relates to how the existing colors are used in the games. While the game has only 16 colors available to it it can use them to color things in any number of different ways. This is used to do things such as fade the screen to black. As the screen fades different 'color maps' are used so that a pixel of the same value adopts different colors. Patches involving color maps are covered in the second section of this page.


Game palettes

Patches in this section deal with changing the limited range of colors available to the game.


Change game colors

The patches in this section allow modification of the default 16-color EGA palette. The patch is the same across all Keen games.

First is a list of 16 3-byte entries; the 16 EGA colors use by the game. Each color consists of three components; red, green and blue. These have values from 0–63, as with other VGA palette formats. This makes each palette 48 bytes long. The order of colors in the palette is the order of the colors in the game. (The first color, 0, is usually black for example.) The colors listed here are their default values and in their default order, so you can see how they work.

After this is the palette loading code. The values $0004W and $001CW in blue are the location of the palette's dark and light colors respectively in the game's 'data segment'; changing this allows the palette to be moved. (This is simple enough; the second value will always be $18 larger than the first, this is 3 bytes x 8 colors in size.)

Note that the Keen 1 patch needs the change background tiles patch in order to work properly. The Keen 2/3 patches disable the joystick configuration window for the required space. In Keen Galaxy the patch disables the EGAGRAPH check and so is incompatible with other patches that also use this.

The Keen Dreams patch uses unused 'fade to white' code space and disables the 'can't load title screen error' to clear the screen before the game starts.

Change the default colors -Keen 1

#This is the color palette: 16 entries of r, g, b (each 0–63)
%patch $13054 
       00 00 00  #Black
       00 00 42  #Blue
       00 42 00  #Green
       00 42 42  #Cyan
       42 00 00  #Red
       42 00 42  #Magenta
       42 21 00  #Brown
       42 42 42  #Bright grey
       21 21 21  #Grey
       21 21 63  #Bright blue
       21 63 21  #Bright green
       21 63 63  #Bright cyan
       63 21 21  #Bright red
       63 21 63  #Bright magenta/pink
       63 63 21  #Yellow
       63 63 63  #White

#Set the palette
%patch $6E46  $E8 $D5D3W  $90 $90
%patch $441C  $B8 $000DW  $10CDW  $B8 $1012W  $B9 $0008W  $BB $0000W  $8C $DA
              $8E $C2 $BA [$0004W]  $10CDW  $BB $0018W  $BA [$001CW]  $10CDW  $C3

#Include this part if the "Change background tiles" patch is not used
%patch $4409  $B8 $14 $01 $26 $81 $3F $31 $01 $73 $03 $B8 $8F $00 $26 $89 $07
              $E9 $015CW

Change the default colors -Keen 2

#This is the color palette: 16 entries of r, g, b (each 0–63)
%patch $17784 
       00 00 00  #Black
       00 00 42  #Blue
       00 42 00  #Green
       00 42 42  #Cyan
       42 00 00  #Red
       42 00 42  #Magenta
       42 21 00  #Brown
       42 42 42  #Bright grey
       21 21 21  #Grey
       21 21 63  #Bright blue
       21 63 21  #Bright green
       21 63 63  #Bright cyan
       63 21 21  #Bright red
       63 21 63  #Bright magenta/pink
       63 63 21  #Yellow
       63 63 63  #White

#Set the palette
%patch $3045 $E8 $E535W  $90 $90
%patch $157C $C3 $B8 $000DW  $10CDW  $B8 $1012W  $B9 $0008W  $BB $0000W  $8C
             $DA $8E $C2 $BA [$0004W]  $10CDW  $BB $0018W  $BA [$001CW]  $10CDW
             $C3

Change the default colors -Keen 3

#This is the color palette: 16 entries of r, g, b (each 0–63)
%patch $19824
       00 00 00  #Black
       00 00 42  #Blue
       00 42 00  #Green
       00 42 42  #Cyan
       42 00 00  #Red
       42 00 42  #Magenta
       42 21 00  #Brown
       42 42 42  #Bright grey
       21 21 21  #Grey
       21 21 63  #Bright blue
       21 63 21  #Bright green
       21 63 63  #Bright cyan
       63 21 21  #Bright red
       63 21 63  #Bright magenta/pink
       63 63 21  #Yellow
       63 63 63  #White

#Set the palette
%patch $2FE0  $E8 $58 $E5 $90 $90
%patch $153A  $C3 $B8 $000DW  $10CDW  $B8 $1012W  $B9 $0008W  $BB $0000W  $8C
              $DA $8E $C2 $BA [$0004W]  $10CDW  $BB $0018W  $BA [$001CW]  $10CDW
              $C3

Change the default colors -Keen Dreams

#This is the color palette: 16 entries of r, g, b (each 0–63)
%patch $23A74 
       00 00 00  #Black
       00 00 42  #Blue
       00 42 00  #Green
       00 42 42  #Cyan
       42 00 00  #Red
       42 00 42  #Magenta
       42 21 00  #Brown
       42 42 42  #Bright grey
       21 21 21  #Grey
       21 21 63  #Bright blue
       21 63 21  #Bright green
       21 63 63  #Bright cyan
       63 21 21  #Bright red
       63 21 63  #Bright magenta/pink
       63 63 21  #Yellow
       63 63 63  #White

#Set the palette
%patch $CB09 $9A $0CA5019BRL
%patch $CBEB $B8 $000DW  $10CDW  $B8 $1012W  $B9 $0008W  $BB $0000W  $8C $DA
             $8E $C2 $BA [$0004W]  $10CDW  $BB $0018W  $BA [$001CW]  $10CDW  $CB

#Clear screen before title loads
%patch $4395 $9A $0CA500FFRL     $9A $0CA5014DRL     $E9 $0107W

Change the default colors -Keen 4

#This is the color palette: 16 entries of r, g, b (each 0–63)
%patch $2EE74 
       00 00 00  #Black
       00 00 42  #Blue
       00 42 00  #Green
       00 42 42  #Cyan
       42 00 00  #Red
       42 00 42  #Magenta
       42 21 00  #Brown
       42 42 42  #Bright grey
       21 21 21  #Grey
       21 21 63  #Bright blue
       21 63 21  #Bright green
       21 63 63  #Bright cyan
       63 21 21  #Bright red
       63 21 63  #Bright magenta/pink
       63 63 21  #Yellow
       63 63 63  #White

#Set the palette
%patch $3CE5  $90 $90
%patch $1D130 $9A $037D0526RL
%patch $3CF6  $B8 $000DW  $10CDW  $B8 $1012W  $B9 $0008W  $BB $0000W  $8C $DA
              $8E $C2 $BA [$0004W]  $10CDW  $BB $0018W  $BA [$001CW]  $10CDW  $CB

Change the default colors -Keen 5

#This is the color palette: 16 entries of r, g, b (each 0–63)
%patch $30344 
       00 00 00  #Black
       00 00 42  #Blue
       00 42 00  #Green
       00 42 42  #Cyan
       42 00 00  #Red
       42 00 42  #Magenta
       42 21 00  #Brown
       42 42 42  #Bright grey
       21 21 21  #Grey
       21 21 63  #Bright blue
       21 63 21  #Bright green
       21 63 63  #Bright cyan
       63 21 21  #Bright red
       63 21 63  #Bright magenta/pink
       63 63 21  #Yellow
       63 63 63  #White

#Set the palette
%patch $3CDF  $90 $90
%patch $1E0CC $9A $037D0520RL
%patch $3CF0  $B8 $000DW  $10CDW  $B8 $1012W  $B9 $0008W  $BB $0000W  $8C $DA
              $8E $C2 $BA [$0004W]  $10CDW  $BB $0018W  $BA [$001CW]  $10CDW  $CB


VGA palette patch

This VGA palette patch allows a modifiable palette that also fades smoothly to and from black through direct modification of colors. This is unlike the default palette, which fades in stages involving the simple swapping around of color maps. (See section 2.) This makes it far more versatile. There are two palettes, one for normal gameplay, and the other, for when the lights are turned off.

These patches invalidate the screen-fading patches in the next section since they use an alternate means of changing the colors. Note that when the palette is fading in or out, sprites are frozen (when starting a level they do not appear) until the fade is completed.

Aside from the two palettes, there are four editable values, marked in red; the last two values are the delays before the palette swap when the lights are turned on or off. As above, the game freezes for this long when the switch is flipped.

The first two are the fade-in/fade-out intensities, and can be made smaller or larger to change the fade times. If made smaller, the fade will not go completely to black (if made half as large, it will fade half to black; that is, if made small enough, the screen will not fade, but merely dim before switching). If made larger, the screen will fade to black and stay black for a certain amount of time.

There are two patches to choose from, a "normal speed" and a "double speed" patch (for those who want a fade-in/out time closer to the original without having to settle for a partially dimmed screen). The code common to both patches is listed first, you will need it in addition to one of the following sections, labeled appropriately. Of course, highlighted values have the same function in both patches.

Keen 1, common code:

#New palette patch
#First palette; modified
%patch $21850 
       00 00 00 #black
       00 00 42 #blue
       00 42 00 #green
       00 42 42 #cyan
       42 00 00 #red
       42 00 42 #magenta
       42 21 00 #brown
       42 42 42 #bright gray
       21 21 21 #gray
       21 21 63 #bright blue
       21 63 21 #bright green
       21 63 63 #bright cyan
       63 21 21 #bright red
       63 21 63 #pink
       63 63 21 #yellow
       63 63 63 #white

#Lights out palette
       00 00 00 #black
       00 00 42 #blue
       00 21 00 #green
       00 21 42 #cyan
       21 00 00 #red
       21 00 42 #magenta
       21 10 00 #brown
       21 21 42 #bright gray
       10 10 21 #gray
       10 10 63 #bright blue
       10 42 21 #bright green
       10 42 63 #bright cyan
       42 10 21 #bright red
       42 10 63 #pink
       42 42 21 #yellow
       63 63 63 #white

#----------------------------------------------------------------------------
#Set EGA color register values for VGA pass-through
%patch $1558B   $00 $01 $02 $03 $04 $05 $06 $07
                $08 $09 $0A $0B $0C $0D $0E $0F $03

Slow fade code

#Set the palette when we go into graphics mode
%patch $6E46 $E8 $FE60W  $90 $90
 
#Code to set graphics mode and set the palette
%patch $6CA9 $B8 $0D $00 $CD $10 $B8 $13 $10 $BB $00 $01 $CD $10 $B8 $02 $10
             $1E $07 $BA $3B $25 $CD $10 $B8 $12 $10 $B9 $20 $00 $31 $DB $BA
             $00 $E8 $CD $10 $C3
 
#Support functions
%patch $5B3D $BA $DA $03 $EC $A8 $08 $75 $FB $EC $A8 $08 $74 $FB $C3 $55 $89
             $E5 $E8 $EC $FF $BA $DA $03 $EC $BA $C0 $03 $EC $50 $B0 $14 $EE
             $8B $46 $04 $EE $58 $EE $89 $EC $5D $C3 $55 $89 $E5 $83 $EC $08
             $31 $C0 $31 $DB $89 $46 $F8 $8A $87 $00 $E8 $2A $46 $04 $73 $02
             $31 $C0 $89 $46 $FA $43 $8A $87 $00 $E8 $2A $46 $04 $73 $02 $31
             $C0 $89 $46 $FC $43 $8A $87 $00 $E8 $2A $46 $04 $73 $02 $31 $C0
             $89 $46 $FE $43 $E8 $B7 $10 $FF $46 $F8 $83 $FB $60 $75 $C8 $89
             $EC $5D $C3
%patch $6C5B $55 $89 $E5 $BA $C8 $03 $8B $46 $04 $EE $BA $C9 $03 $8B $46 $06
             $EE $8B $46 $08 $EE $8B $46 $0A $EE $89 $EC $5D $C3
 
#VGA palette fading
#fade in
%patch $6C49 $B9 {$40 $00} $E8 $EE $EE $89 $C8 $48 $50 $E8 $11 $EF $44 $44 $E2
              $F2 $C3
#fade out
%patch $6C8D $B9 {$40 $00} $E8 $AA $EE $B8 $40 $00 $29 $C8 $50 $E8 $CB $EE
             $44 $44 $E2 $F0 $31 $C0 $50 $E8 $A5 $EE $44 $44 $C3
 
#VGA lights on and off
%patch $3592 $C7 $06 $1E $82 $01 $00 $B8 {$01 $00} $50 $E8 $43 $8B $44 $44 $31
             $C0 $50 $E8 $A4 $25 $44 $44 $C3
%patch $35B2 $C7 $06 $1E $82 $00 $00 $B8 {$01 $00} $50 $E8 $23 $8B $44 $44 $B8
             $01 $00 $50 $E8 $83 $25 $44 $44 $C3

Fast fade code

#Set the palette when we go into graphics mode
%patch $6E46 $E8 $64 $FE $90 $90
 
#Code to set graphics mode and set the palette
%patch $6CAD $B8 $0D $00 $CD $10 $B8 $13 $10 $BB $00 $01 $CD $10 $B8 $02 $10
             $1E $07 $BA $3B $25 $CD $10 $B8 $12 $10 $B9 $20 $00 $31 $DB $BA
             $00 $E8 $CD $10 $C3
 
#Support functions
%patch $5B3D $BA $DA $03 $EC $A8 $08 $75 $FB $EC $A8 $08 $74 $FB $C3 $55 $89
             $E5 $E8 $EC $FF $BA $DA $03 $EC $BA $C0 $03 $EC $50 $B0 $14 $EE
             $8B $46 $04 $EE $58 $EE $89 $EC $5D $C3 $55 $89 $E5 $83 $EC $08
             $31 $C0 $31 $DB $89 $46 $F8 $8A $87 $00 $E8 $2A $46 $04 $73 $02
             $31 $C0 $89 $46 $FA $43 $8A $87 $00 $E8 $2A $46 $04 $73 $02 $31
             $C0 $89 $46 $FC $43 $8A $87 $00 $E8 $2A $46 $04 $73 $02 $31 $C0
             $89 $46 $FE $43 $E8 $B9 $10 $FF $46 $F8 $83 $FB $60 $75 $C8 $89
             $EC $5D $C3
%patch $6C5D $55 $89 $E5 $BA $C8 $03 $8B $46 $04 $EE $BA $C9 $03 $8B $46 $06
             $EE $8B $46 $08 $EE $8B $46 $0A $EE $89 $EC $5D $C3
 
#VGA palette fading
#fade in
%patch $6C49 $B9 {$20 $00} $E8 $EE $EE $89 $C8 $D1 $E0 $48 $50 $E8 $0F $EF $44
             $44 $E2 $F0 $C3 
#fade out
%patch $6C8D $B9 {$20 $00} $E8 $AA $EE $B8 $40 $00 $D1 $E1 $29 $C8 $50 $E8 $C9
             $EE $44 $44 $D1 $E9 $E2 $EC $31 $C0 $50 $E8 $A1 $EE $44 $44 $C3 
 
#VGA lights
%patch $3592 $C7 $06 $1E $82 $01 $00 $B8 {$01 $00} $50 $E8 $43 $8B $44 $44 $31
             $C0 $50 $E8 $A4 $25 $44 $44 $C3
%patch $35B2 $C7 $06 $1E $82 $00 $00 $B8 {$01 $00} $50 $E8 $23 $8B $44 $44 $B8
             $01 $00 $50 $E8 $83 $25 $44 $44 $C3


V 2 palette addon

This is an advanced palette patch intended for use with the V 2 tileset patch. The features it allows include:

  • Each level can have its own palette
  • Color cycling
  • Smoother fades and custom colors when lights are turned out

The original patch (A link to which can be found in the 'external links' section of this page.) relies on a number of external files and is thus quite compact. As such the patch is not given here as it is too unwieldy and complicated. It should also be noted that it overwrites, and is thus incompatible with, the original V 2 patch.


Color maps

This section deals with patches that change not the colors themselves, but how the 16 palette colors are mapped onto pixels on the screen. This is done through the aid of 17-byte strings known as 'color maps'. (16 possible screen values and a border color.)

While a game can only use the same 16 base colors, some or all of those colors can be mapped in any number of ways. While a given pixel on the screen will always use the same entry in a color map (Entry 1, entry 2...) that entry can point to a different color in different maps.


The color table

The game reads graphics as EGA data of four planes, red, green, blue, and bright (Intensity) each plane has a value of 4, 2, 1 and 24), respectively. When this is done (and the default colors are used) the following values represent each color (in hex):

$1F, white       $1E, yellow       $1D, light purple  $1C, light red
$1B, light teal  $1A, light green  $19, light blue    $18, dark grey (light black)
$17, white       $16, yellow       $15, light purple  $14, light red
$13, light teal  $12, light green  $11, light blue    $10, dark grey (light black)
$0F, light grey  $0E, brown        $0D, dark purple   $0C, dark red
$0B, dark teal   $0A, dark green   $09, dark blue     $08, black
$07, light grey  $06, brown        $05, dark purple   $04, dark red
$03, dark teal   $02, dark green   $01, dark blue     $00, black

Notice that the colors between 08-17 are not used much in normal palettes, and have a different order than the remaining colors, for reasons not entirely clear. It is possible that these colors are only useful in certain conditions or display modes. (It is notable that they are used in Keen Galaxy for the 'terminator text' color maps.)

What is often considered to be the "normal" gameplay palette simply assigns the preset EGA colors logically to the values given by the color planes. Thus, color 0 is given value 0 (black) and color 6 is given value 6 (purple). But it is possible to assign the colors in many possible ways. As an example, the "lights out" palette in Keen Vorticons gives all the light color slots dark color values, and all the dark color slots the value 0 (black), making it look as if the game has become significantly darker.

Palettes here then consist of 17 values, 16 EGA values and one border color value (not often seen in modern systems due to different screen resolutions and the like). To see what color you are changing in a palette, just look at what number it is in the 'normal' palette.

In Keen Galaxy palettes have a location like any other data. Quite often the palette and a border color are set together, the border color being an entry from the palette itself.


Game color maps

These are the game color maps. Blue values are the 16 game colors while brown values are the border colors for the color map. There are four 'primary' color maps; 'Normal' (used for most gameplay) 'Fade 1 and fade 2' (used during screen fades) and 'Black' (Used at the end of a fade, where the screen is entirely black.) There are often other color maps used in more specific situations.

In Keen Vorticons 'Fade 1' is also used when lights are turned off and the border color can be changed without the palette. This usually happens when some enemy is being killed.

Keen Galaxy has several other default maps,'White fade' and 'White' as well as an unused blank (All black) palette.

Keen 1

#Default color maps
%patch $15558 [$00 $00 $00 $00 $00 $00 $00 $00  $00 $00 $00 $00 $00 $00 $00 $00] {$03} #Black
%patch $15569 [$00 $00 $00 $00 $00 $00 $00 $00  $00 $01 $02 $03 $04 $05 $06 $07] {$03} #Fade 2
%patch $1557A [$00 $00 $00 $00 $00 $00 $00 $00  $18 $19 $1A $1B $1C $1D $1E $1F] {$03} #Fade 1
%patch $1558B [$00 $01 $02 $03 $04 $05 $06 $07  $18 $19 $1A $1B $1C $1D $1E $1F] {$03} #Normal

#Border color changes
%patch $4A62 {$03} #After killing a Vorticon
%patch $6F9D {$03} #After killing Vorticon commander
%patch $4A7D {$0E} #While Vorticon is dying 1
%patch $4A85 {$03} #While Vorticon is dying 2

Keen 2

#Default color maps
%patch $19BE8 [$00 $00 $00 $00 $00 $00 $00 $00  $00 $00 $00 $00 $00 $00 $00 $00] {$03} #Black
%patch $19BF9 [$00 $00 $00 $00 $00 $00 $00 $00  $00 $01 $02 $03 $04 $05 $06 $07] {$03} #Fade 2
%patch $19C0A [$00 $00 $00 $00 $00 $00 $00 $00  $18 $19 $1A $1B $1C $1D $1E $1F] {$03} #Fade 1
%patch $19C1B [$00 $01 $02 $03 $04 $05 $06 $07  $18 $19 $1A $1B $1C $1D $1E $1F] {$03} #Normal

#Border color changes
%patch $319C {$03} #After killing a Vorticon
%patch $77C6 {$03} #After killing a Tantalus ray
%patch $77E1 {$0E} #While Tantalus dies 1
%patch $77E9 {$03} #While Tantalus dies 2

Keen 3

#Default color maps
%patch $1BD84 [$00 $00 $00 $00 $00 $00 $00 $00  $00 $00 $00 $00 $00 $00 $00 $00] {$03} #Black
%patch $1BD95 [$00 $00 $00 $00 $00 $00 $00 $00  $00 $01 $02 $03 $04 $05 $06 $07] {$03} #Fade 2
%patch $1BDA6 [$00 $00 $00 $00 $00 $00 $00 $00  $18 $19 $1A $1B $1C $1D $1E $1F] {$03} #Fade 1
%patch $1BDB7 [$00 $01 $02 $03 $04 $05 $06 $07  $18 $19 $1A $1B $1C $1D $1E $1F] {$03} #Normal

#Ending sequence press flash
%patch $1C072 [$18 $19 $1A $1B $1C $1D $1E $1F  $18 $19 $1A $1B $1C $1D $1E $1F] {$03}

#Border colors:
%patch $8080 {$0E} #While a purple spark dies 1
%patch $808A {$03} #While a purple spark dies 2
%patch $3131 {$03} #After killing a Vorticon

Keen Dreams

#Default color maps
%patch $26384 [$00 $00 $00 $00 $00 $00 $00 $00  $00 $00 $00 $00 $00 $00 $00 $00] {$00} #Black
%patch $26395 [$00 $00 $00 $00 $00 $00 $00 $00  $00 $01 $02 $03 $04 $05 $06 $07] {$00} #Fade 2
%patch $263A6 [$00 $00 $00 $00 $00 $00 $00 $00  $18 $19 $1A $1B $1C $1D $1E $1F] {$00} #Fade 1
%patch $263B7 [$00 $01 $02 $03 $04 $05 $06 $07  $18 $19 $1A $1B $1C $1D $1E $1F] {$00} #Normal
%patch $263C8 [$00 $01 $02 $03 $04 $05 $06 $07  $1F $1F $1F $1F $1F $1F $1F $1F] {$00} #White fade
%patch $263D9 [$1F $1F $1F $1F $1F $1F $1F $1F  $1F $1F $1F $1F $1F $1F $1F $1F] {$1F} #White
%patch $263EA [$00 $00 $00 $00 $00 $00 $00 $00  $00 $00 $00 $00 $00 $00 $00 $00] {$00} #Blank

Keen 4

#Default color maps
%patch $33D24 [$00 $00 $00 $00 $00 $00 $00 $00  $00 $00 $00 $00 $00 $00 $00 $00] {$00} #Black
%patch $33D35 [$00 $00 $00 $00 $00 $00 $00 $00  $00 $01 $02 $03 $04 $05 $06 $07] {$00} #Fade 2
%patch $33D46 [$00 $00 $00 $00 $00 $00 $00 $00  $18 $19 $1A $1B $1C $1D $1E $1F] {$00} #Fade 1
%patch $33D57 [$00 $01 $02 $03 $04 $05 $06 $07  $18 $19 $1A $1B $1C $1D $1E $1F] {$00} #Normal
%patch $33D68 [$00 $01 $02 $03 $04 $05 $06 $07  $1F $1F $1F $1F $1F $1F $1F $1F] {$1F} #White fade
%patch $33D79 [$1F $1F $1F $1F $1F $1F $1F $1F  $1F $1F $1F $1F $1F $1F $1F $1F] {$00} #White
%patch $33D8A [$00 $00 $00 $00 $00 $00 $00 $00  $00 $00 $00 $00 $00 $00 $00 $00] {$00} #Blank

#Story background color map
%patch $2F05E [$00 $01 $02 $03 $04 $10 $06 $07  $1F $1F $1F $1F $1F $1F $1F $1F] {$00}

#Terminator text color map
%patch $2F078 [$00 $18 $18 $07 $01 $01 $01 $01  $11 $11 $11 $11 $13 $13 $13 $13] {$00}

#Terminator text color map 2 (Screen moves out)
%patch $2F088 [$00 $00 $18 $18 $07 $01 $01 $01  $01 $11 $11 $11 $11 $13 $13 $13] {$00}

Keen 5

#Default color maps
%patch $366F4 [$00 $00 $00 $00 $00 $00 $00 $00  $00 $00 $00 $00 $00 $00 $00 $00] {$00} #Black
%patch $34705 [$00 $00 $00 $00 $00 $00 $00 $00  $00 $01 $02 $03 $04 $05 $06 $07] {$00} #Fade 2
%patch $34716 [$00 $00 $00 $00 $00 $00 $00 $00  $18 $19 $1A $1B $1C $1D $1E $1F] {$00} #Fade 1
%patch $34727 [$00 $01 $02 $03 $04 $05 $06 $07  $18 $19 $1A $1B $1C $1D $1E $1F] {$00} #Normal
%patch $34738 [$00 $01 $02 $03 $04 $05 $06 $07  $1F $1F $1F $1F $1F $1F $1F $1F] {$1F} #White fade
%patch $34749 [$1F $1F $1F $1F $1F $1F $1F $1F  $1F $1F $1F $1F $1F $1F $1F $1F] {$00} #White
%patch $3475A [$00 $00 $00 $00 $00 $00 $00 $00  $00 $00 $00 $00 $00 $00 $00 $00] {$00} #Blank

#Game over color map
%patch $31BE2 [$00 $01 $02 $03 $04 $05 $06 $07  $18 $19 $1A $1B $1C $1D $1E $1F] {$03}

#Story background color map
%patch $304DE [$00 $01 $18 $1E $1F $1C $06 $07  $13 $13 $13 $13 $13 $13 $13 $13] {$00}

#Terminator text color map
%patch $304F8 [$00 $04 $04 $1C $01 $01 $01 $01  $11 $11 $11 $11 $13 $13 $13 $13] {$00}

#Terminator text color map 2 (screen moves out)
%patch $30509 [$00 $04 $04 $1C $01 $01 $01 $01  $11 $11 $11 $11 $13 $13 $13 $04] {$00}

Keen 6

#Default color maps
%patch $3571C [$00 $00 $00 $00 $00 $00 $00 $00  $00 $00 $00 $00 $00 $00 $00 $00] {$00} #Black
%patch $3572D [$00 $00 $00 $00 $00 $00 $00 $00  $00 $01 $02 $03 $04 $05 $06 $07] {$00} #Fade 2
%patch $3573E [$00 $00 $00 $00 $00 $00 $00 $00  $18 $19 $1A $1B $1C $1D $1E $1F] {$00} #Fade 1
%patch $3574F [$00 $01 $02 $03 $04 $05 $06 $07  $18 $19 $1A $1B $1C $1D $1E $1F] {$00} #Normal
%patch $35760 [$00 $01 $02 $03 $04 $05 $06 $07  $1F $1F $1F $1F $1F $1F $1F $1F] {$1F} #White fade
%patch $35771 [$1F $1F $1F $1F $1F $1F $1F $1F  $1F $1F $1F $1F $1F $1F $1F $1F] {$00} #White
%patch $35782 [$00 $00 $00 $00 $00 $00 $00 $00  $00 $00 $00 $00 $00 $00 $00 $00] {$00} #Blank

#Story background color map
%patch $30E62 [$00 $01 $18 $19 $04 $1C $06 $07  $1F $1F $1F $1F $1F $1F $1F $1F] {$00}

#Terminator text color map
%patch $30E7C [$00 $05 $05 $15 $01 $01 $01 $01  $11 $11 $11 $11 $13 $13 $13 $13] {$00}

#Terminator text color map 2 (screen moves out)
%patch $30E8D [$00 $05 $05 $15 $01 $01 $01 $01  $11 $11 $11 $11 $13 $13 $13 $05] {$00}


Screen fades

The most common use of color maps is during 'screen fades', where the screen fades to black then fades back in. This is used to disguise abrupt screen changes such as entering levels. In Keen Vorticons there are two fades, 'Fade to black' and 'Fade from black'. Keen Galaxy and Dreams have two additional but unused fades, 'Fade to white' and 'Fade from white'.

The two important components of a fade are the color maps used and the time taken per 'step' of fade.


Vorticons

In Keen Vorticons both the time between fade steps and the color map used for that step must be specified. There are also additional delays not easily observed in default gameplay.

For simplicity the four game palettes used will be referred to in order of 'brightness' as (1), normal, (2), First fade, (3), second fade, and (4) black. While 'fade to black' uses all four maps, 'fade from black' uses only three, giving it a more 'immediate' look.

Keen 1

#Fade speeds -Fade {from} black
%patch $6C4D [$0001W] #Pause before fade starts
%patch $6C62 [$0008W] #4->3
%patch $6C77 [$0008W] #3->1

#Fade speeds -Fade {to} black
%patch $6C91 [$0001W] #Pause before fade starts
%patch $6CA6 [$0008W] #1->2
%patch $6CBB [$0008W] #2->3
%patch $6CD0 [$0008W] #3->4

#Fade {from} black color maps
%patch $6C5A [$2508W] #4 (Black)
%patch $6C6F [$2519W] #3 (Second fade)
%patch $6C84 [$253BW] #1 (Normal)

#Fade {to} black color maps
%patch $6C9E [$253BW] #1 (Normal)
%patch $6CB3 [$252AW] #2 (First fade)
%patch $6CC8 [$2519W] #3 (Second fade)
%patch $6CDD [$2508W] #4 (Black)

Keen 2

#Fade speeds -Fade {from} black
%patch $2E5B [$0001W] #Pause before fade starts
%patch $2E70 [$0008W] #4->3
%patch $2E85 [$0008W] #3->1

#Fade speeds -Fade {to} black
%patch $2E9F [$0001W] #Pause before fade starts
%patch $2EB4 [$0008W] #1->2
%patch $2EC9 [$0008W] #2->3
%patch $2EDE [$0008W] #3->4

#Fade {from} black color maps
%patch $2E68 [$2468W] #4 (Black)
%patch $2E7D [$2479W] #3 (Second fade)
%patch $2E92 [$249BW] #1 (Normal)

#Fade {to} black color maps
%patch $2EAC [$249BW] #1 (Normal)
%patch $2EC1 [$248AW] #2 (First fade)
%patch $2ED6 [$2479W] #3 (Second fade)
%patch $2EEB [$2468W] #4 (Black)

Keen 3

#Fade speeds -Fade {from} black
%patch $2DF5 [$0001W] #Pause before fade starts
%patch $2E09 [$0008W] #4->3
%patch $2E1D [$0008W] #3->1

#Fade speeds -Fade {to} black
%patch $2E36 [$0001W] #Pause before fade starts
%patch $2E4A [$0008W] #1->2
%patch $2E5E [$0008W] #2->3
%patch $2E72 [$0008W] #3->4

#Fade {from} black color maps
%patch $2E01 [$2564W] #4 (Black)
%patch $2E15 [$2575W] #3 (Second fade)
%patch $2E29 [$2597W] #1 (Normal)

#Fade {to} black color maps
%patch $2E42 [$2597W] #1 (Normal)
%patch $2E56 [$2586W] #2 (First fade)
%patch $2E6A [$2575W] #3 (Second fade)
%patch $2E7E [$2564W] #4 (Black)


Galaxy and Dreams

In Keen Galaxy and Dreams things are more compact than in Vorticons. The game has four fades, to a black screen, from a black screen, to a white screen and from a white screen. (The white fades are unused.) A single value controls the speed of all steps in a given fade.

Each fade has a 'base' color map it starts from, this is the same for all fades, the 'black screen'. This is references three times per fade; once for colors and twice more for 'screen border' colors.

A fade will take this and then move forward or back a given number of maps. 'Fade to black' starts 3 steps away and moves back to the black map, while 'Fade from black' starts at the black map and moves back three steps. The number of steps for these fades is thus easily adjustable. The (unused) white fades start a number of steps away and so have two values affecting how many steps they take. (Fade from white' for example has 5 - 2 = 3 steps.)

Keen Dreams

#Fade speed
%patch $CB86 [$0006W] #To black
%patch $CBD3 [$0006W] #From black
%patch $CC22 [$0006W] #To white
%patch $CC71 [$0006W] #From white

#Number of steps in fade
%patch $CB51 [$03] #Fade to black
%patch $CBE0 [$04] #Fade from black
%patch $CBED [$03] #Fade to white 1
%patch $CC2F [$06] #Fade to white 2
%patch $CC3C [$05] #Fade from white 1
%patch $CC71 [$02] #Fade from white 2

#Palettes
%patch $CB64 [$2924W] #Fade to black 1
%patch $CB6E [$2914W] #Fade to black 2
%patch $CB7C [$2914W] #Fade to black 3
%patch $CBB1 [$2924W] #Fade from black 1
%patch $CBBB [$2914W] #Fade from black 2
%patch $CBC9 [$2914W] #Fade from black 3
%patch $CC00 [$2924W] #Fade to white 1
%patch $CC0A [$2914W] #Fade to white 2
%patch $CC18 [$2914W] #Fade to white 3
%patch $CC4F [$2924W] #Fade from white 1
%patch $CC59 [$2914W] #Fade from white 2
%patch $CC67 [$2914W] #Fade from white 3

Keen 4

#Fade speed
%patch $1D209 [$0006W] #To black
%patch $1D25B [$0006W] #From black
%patch $1D2AF [$0006W] #To white
%patch $1D303 [$0006W] #From white

#Number of steps in fade
%patch $1D1D4 [$03] #Fade to black
%patch $1D269 [$04] #Fade from black
%patch $1D27A [$03] #Fade to white 1
%patch $1D2BD [$06] #Fade to white 2
%patch $1D2CE [$05] #Fade from white 1
%patch $1D311 [$02] #Fade from white 2

#Starting color map used
%patch $1D1E7 [$4EC4W] #Fade to black 1
%patch $1D1F1 [$4EB4W] #Fade to black 2
%patch $1D1FF [$4EB4W] #Fade to black 3
%patch $1D239 [$4EC4W] #Fade from black 1
%patch $1D243 [$4EB4W] #Fade from black 2
%patch $1D251 [$4EB4W] #Fade from black 3
%patch $1D28D [$4EC4W] #Fade to white 1
%patch $1D297 [$4EB4W] #Fade to white 2
%patch $1D2A5 [$4EB4W] #Fade to white 3
%patch $1D2E1 [$4EC4W] #Fade from white 1
%patch $1D2EB [$4EB4W] #Fade from white 2
%patch $1D2F9 [$4EB4W] #Fade from white 3

Keen 5

#Fade speed
%patch $1E1A5 [$0006W] #To black
%patch $1E1F7 [$0006W] #From black
%patch $1E24B [$0006W] #To white
%patch $1E29F [$0006W] #From white

#Number of steps in fade
%patch $1E170 [$03] #Fade to black
%patch $1E205 [$04] #Fade from black
%patch $1E216 [$03] #Fade to white 1
%patch $1E259 [$06] #Fade to white 2
%patch $1E26A [$05] #Fade from white 1
%patch $1E2AD [$02] #Fade from white 2

#Starting color map used
%patch $1E183 [$43C4W] #Fade to black 1
%patch $1E18D [$43B4W] #Fade to black 2
%patch $1E19B [$43B4W] #Fade to black 3
%patch $1E1D5 [$43C4W] #Fade from black 1
%patch $1E1DF [$43B4W] #Fade from black 2
%patch $1E1ED [$43B4W] #Fade from black 3
%patch $1E229 [$43C4W] #Fade to white 1
%patch $1E233 [$43B4W] #Fade to white 2
%patch $1E241 [$43B4W] #Fade to white 3
%patch $1E27D [$43C4W] #Fade from white 1
%patch $1E287 [$43B4W] #Fade from white 2
%patch $1E295 [$43B4W] #Fade from white 3

Keen 6

#Fade speed
%patch $1D123 [$0006W] #To black
%patch $1D175 [$0006W] #From black
%patch $1D1C9 [$0006W] #To white
%patch $1D21D [$0006W] #From white

#Number of steps in fade
%patch $1D0EE [$03] #Fade to black
%patch $1D183 [$04] #Fade from black
%patch $1D194 [$03] #Fade to white 1
%patch $1D1D7 [$06] #Fade to white 2
%patch $1D1E8 [$05] #Fade from white 1
%patch $1D22B [$02] #Fade from white 2

#Starting color map used
%patch $1D101 [$49FCW] #Fade to black 1
%patch $1D10B [$49ECW] #Fade to black 2
%patch $1D119 [$49ECW] #Fade to black 3
%patch $1D153 [$49FCW] #Fade from black 1
%patch $1D15D [$49ECW] #Fade from black 2
%patch $1D16B [$49ECW] #Fade from black 3
%patch $1D1A7 [$49FCW] #Fade to white 1
%patch $1D1B1 [$49ECW] #Fade to white 2
%patch $1D1BF [$49ECW] #Fade to white 3
%patch $1D1FB [$49FCW] #Fade from white 1
%patch $1D205 [$49ECW] #Fade from white 2
%patch $1D213 [$49ECW] #Fade from white 3


Screen border

As well as the main part of the screen, on some setups a surrounding 'border' of a certain color is visible. In Keen Vorticons games this is a part of gameplay, the border often flashing when an enemy is destroyed. In Keen Galaxy the border is passive, but must still match its color with the rest of the game's palette. As such Galaxy games have a collection of 'border palette' references used for this purpose.

Keen 4

#Border palette references
%patch $1D16E {$4EB4W} #Black
%patch $1D180 {$4EC5W} #Dark 2
%patch $1D18F {$4ED6W} #Dark 1
%patch $1D193 {$4EE7W} #Normal
%patch $1D1A2 {$4EF8W} #Light
%patch $1D1A6 {$4F09W} #White

Keen 5

#Border palette references
%patch $1E10A {$43B4W} #Black
%patch $1E11C {$43C5W} #Dark 2
%patch $1E12B {$43D6W} #Dark 1
%patch $1E12F {$43E7W} #Normal
%patch $1E13E {$43F8W} #Light
%patch $1E142 {$4409W} #White

Keen 6

#Border palette references
%patch $1D088 {$49ECW} #Black
%patch $1D09A {$49FDW} #Dark 2
%patch $1D0A9 {$4A0EW} #Dark 1
%patch $1D0AD {$4A1FW} #Normal
%patch $1D0BC {$4A30W} #Light
%patch $1D0C0 {$4A41W} #White


Main colors

The 'main' or default color map is the colors used for most of gameplay, the colors the game's art is based on. This is 'reset' in many situations during gameplay and is thus important to update if some other patch alters the palettes.

Keen Dreams

#Default colors
%patch $CB3A {$2957W} #Border
%patch $CB41 {$2947W} #Colors

Keen 4

#Default colors
%patch $1D1B9 {$4EF7W} #Border
%patch $1D1C0 {$4EE7W} #Colors

Keen 5

#Default colors
%patch $1E155 {$43F7W} #Border
%patch $1E15C {$43E7W} #Colors

Keen 6

#Default colors
%patch $1D0D3 {$4A2FW} #Border
%patch $1D0DA {$4A1FW} #Colors


Light switches

In Keen Vorticons it is possible for players to 'turn the lights on\off' by using a certain tile. Doing so changes the game's palette to that of the first fading palette (Used in screen fades.) Like many palette transitions there is a pause time (By default set to be as short as possible.) and a color map call.

Keen 1

#Speed of lightswitcing:
%patch $359C [$0001W] #Off
%patch $35BC [$0001W] #On

#Light palettes:
%patch $35A9 [$253BW] #Lights on
%patch $35C9 [$2519W] #Lights off

Keen 2

#Speed of lightswitcing:
%patch $63DE [$0001W] #Off
%patch $63FE [$0001W] #On

#Light palettes:
%patch $640B [$2479W] #Lights on
%patch $63EB [$249BW] #Lights off

Keen 3

#Speed of lightswitcing:
%patch $6C60 [$0001W] #Off
%patch $6C41 [$0001W] #On

#Light palettes:
%patch $6C4D [$2597W] #Lights on
%patch $6C6C [$2519W] #Lights off


Custom lights off colors

By default, the lights off colors in Keen 1–3 use the second (darkest) fade-out palette. It is possible however to make a new palette for when the are lights off and use that instead. The palette is set up identically to the palettes above. The second line changes the 'lights out' code to use the new color map.

These patches are incompatible with the palette changing patches in the first section as they put the new color map in the same location as the color palette. This can be fixed by changing the palette location and the pointer to it.

Keen 1

#Make a new palette for lights off:
%patch $19824 $1F $1F $1F $1F $1F $1F $1F $1F  $00 $00 $00 $00 $00 $00 $00 $00 $00
%patch $35C9  [$0034W]

Keen 2

#Make a new palette for lights off:
%patch $19824 $1F $1F $1F $1F $1F $1F $1F $1F  $00 $00 $00 $00 $00 $00 $00 $00 $00
%patch $640B  [$0044W]

Keen 3

#Make a new palette for lights off:
%patch $19824 $1F $1F $1F $1F $1F $1F $1F $1F  $00 $00 $00 $00 $00 $00 $00 $00 $00
%patch $6C6C  [$0004W]


Terminator sequence

Patches relating to the two custom color maps used for the Terminator sequence in Keen Galaxy can be found on their own page.


Star Wars story screen

Patches relating to the custom color map used for the Story screen in Keen Galaxy can be found on their own page.


Black screens

Sometimes the Galaxy games switch directly to a black screen rather than using a screen fade. In these cases it calls the 'black screen' color map directly.

Keen 4

#Black screen at game startup
%patch $4EB6 {$4EC4W} #Border
%patch $4EBD {$4EB4W} #Screen palette (Black)

#Black screen after Star Wars story
%patch $578F {$4EC4W} #Border
%patch $5796 {$4EB4W} #Screen palette (Black)

#Black screen after Star Wars story
%patch $1D1E7 {$4EC4W} #Border
%patch $5796 {$4EB4W} #Screen palette (Black)

Keen 5

#Black screen at game startup
%patch $4EB0 {$43C4W} #Border
%patch $4EB7 {$43B4W} #Screen palette (Black)

#Black screen after Star Wars story
%patch $5789 {$43C4W} #Border
%patch $5790 {$43B4W} #Screen palette (Black)

Keen 6

#Black screen at game startup
%patch $4CD1 {$49FCW} #Border
%patch $4CD8 {$49ECW} #Screen palette (Black)

#Black screen after Star Wars story
%patch $5998 {$49FCW} #Border
%patch $599F {$49ECW} #Screen palette (Black)


Misc color map patches

These are odds-and-ends of patches not yet sorted into their own sections.

Keen 3

#Other things palettes are used for:
%patch $5A15 $2852W #Flash as Vorterazi take pictures
%patch $5A44 $2597W #Return to normal palette after


External Links