Patch:Sprite spawning
This page is a tutorial page on patching sprite spawning. It contains information on what sprite spawn code is and how to patch it. A sprite's spawn code sets all of the sprite's variables before it is placed in the level. Many of these variables are important and only set once.
This page deals with patches relating to sprite spawning, covering a number of patches applied to sprites before they're even created and even allowing more sprites than normal to be placed in a game. The page is prefaced with a section explaining the different areas of sprite spawning, followed by a section for each game.
A related tutorial page dealing with expanding the number of sprites in Keen 1-3 is Patch:Patching Vorticon Sprites and its equivalent for Keen Galaxy and Dreams is Patch:Patching Galaxy Sprites.
Areas of sprite spawning
There are three areas involved in spawning a sprite, the pointer list, the initiation code and the spawning code proper.
The pointer list is exactly what it sounds like, sprites in level maps are simply values in the sprite plane, from $0000-$FFFF. Certain 'standard' values (Lower ones) are used for sprites, other 'special' values are treated on a case by case basis, usually switches.
There are three parts to this, the list's location, its length (minus one) and the list itself. The list consists of a number of two-byte values each related to the location of a sprite's initiation code. Every sprite of a certain number will be directed via the list to a certain segment of initiation code.
Initiation code prepares the game for the sprite, setting aside memory, caching graphics and suchlike. It is not a solid block of code, but part of the same code as the pointer list. The initiation code directs the game to the sprite's individual spawning code.
The spawning code is a solid block of code executed once per sprite that results in the sprite being placed in the level and set in motion; it prepares the sprite for the game.
Keen 1
Keen 1 is unusual in that only the first five sprites are 'standard', while the Ice cannons, falling block and Keen himself are special cases with specific sprite numbers. It is possible to standardize the sprite initiations and thus allow many more sprite types and customization. This is covered in the following section.
Initiations
All pointers are the same, two-byte values giving the exact location of the data they reference. Thus the pointer to the list of value $1709W directs the game to the list at $1709. The standard sprite list is 4 + 1 = 5 entries long. Other sprite types are more difficult to work with. Sprites less than Ice Type 3 ($09) but greater then the standard types (Including type 6, an Ice Cannon!) are Ice Cannons. (By default $07, $08 and $09.) Type 0 Ice Cannons have their own special type ($06), dealt with before all other sprites, even standard ones. The Chain's type is $0A and finally Keen too has a special type, $FF (255).
Keen 1 Initiation list
#List location
%patch $1632 {$1709W}
#List length
%patch $1627 $04
#List
%patch $1709 [$1656W] #Yorp
[$1661W] #Garg
[$166CW] #Vorticon
[$1676W] #Butler robot
[$1680W] #Tank robot
#Special sprite numbers
%patch $161F [$06] #Ice Type 0
%patch $1636 [$09] #Ice Type 3
%patch $163D [$07] #Ice Type 1
%patch $1642 [$08] #Ice Type 2
%patch $164A [$0A] #Falling block
%patch $164F [$00FFW] #Keen
The initiation codes for Keen 1 are mostly quite simple, setting aside some memory space then jumping straight to the spawn code. Getting to the spawn code is reasonably easy to decipher, involving the address of the code plus the $E8 call plus the number of bytes before it.
The player's initiation is different and far more complex. It does not seem to call a spawn code, but the blue value is how high Keen spawns. (This appears to be stored in memory so Keen can be spawned later.)
Keen 1 initiation codes
#Initiation codes
%patch $1656 $57 $56 $E8 $0225W $83 $C4 $04 $E9 $008EW #Goes to Yorp (Code at $1656 + $225 + $5 = $1880)
%patch $1661 $57 $56 $E8 $01DDW $83 $C4 $04 $E9 $0083W #Goes to Garg (Code at $1661 + $1DD + $5 = $1843)
%patch $166C $57 $56 $E8 $0164W $83 $C4 $04 $EB $79 #Goes to Vorticon (Code at $166C + $164 + $5 = $17D5)
%patch $1676 $57 $56 $E8 $00FCW $83 $C4 $04 $EB $6F #Goes to Butler Bot (Code at $1676 + $FC + $5 = $1777)
%patch $1680 $57 $56 $E8 $008EW $83 $C4 $04 $EB $65 #Goes to Tank Bot (Code at $1680 + $8E + $5 = $1713)
%patch $168A $33 $C0 $50 $57 $56 $E8 $028EW $83 $C4 $06 $EB $58 #Goes to Type 0 Ice Cannon (Code at $168A + $28E + $8 = $1920)
%patch $1697 $B8 $0001W $50 $57 $56 $E8 $0280W $83 $C4 $06 $EB $4A #Goes to Type 1 Ice Cannon (Code at $1697 + $280 + $9 = $1920)
%patch $16A5 $B8 $0002W $50 $57 $56 $E8 $0272W $83 $C4 $06 $EB $3C #Goes to Type 2 Ice Cannon (Code at $16A5 + $272 + $9 = $1920)
%patch $16B3 $B8 $0003W $50 $57 $56 $E8 $0264W $83 $C4 $06 $EB $2E #Goes to Type 3 Ice Cannon (Code at $16B3 + $264 + $9 = $1920)
%patch $16C1 $57 $56 $E8 $021DW $83 $C4 $04 $EB $24 #Goes to Falling block (Code at $16C1 + $21D + $5 = $18E3)
#Keen's initiation
%patch $16CB $8B $C6 $99 $B1 $0C $E8 $CA7EW $A3 $6EDEW $89 $16 $6EE0W
$8B $C7 $99 $B1 $0C $E8 $CA6FW $05 [$0800W] $83 $D2 $00 $A3 $6EE2W
$89 $16 $6EE4W
Spawn codes
The spawn codes for Keen 1 are quite complex as they set most of the sprite's properties and behaviors, including strength, actions and death code. It is informative to browse Patch:Jump conditions, Patch:Sprite collision, Patch:Sprite behavior, Patch:Sprite animations and Patch:Sprite type. All of these are set in the following codes.
Keen 1 spawn codes
#Yorp
%patch $1880 $55 $8B $EC $56 $E8 $10AEW $8B $F0 $C7 $04 [$0002W] $8B $46 $04 #Sprite type = 2
$99 $B1 $0C $E8 $C8BBW $89 $44 $04 $89 $54 $06 $8B $46 $06 $99
$B1 $0C $E8 $C8ACW $05 $00 $08 $83 $D2 $00 $89 $44 $08 $89 $54
$0A $C7 $44 $32 {$194FW} $8B $44 $06 $8B $54 $04 $3B $06 $E0 $6E #Start behavior is at $194F
$7F $0F $7C $06 $3B $16 $DE $6E $73 $07 $C7 $44 $20 [$003CW] $EB #If left of Keen speed = $3C else is $FFC4 (+\-60)
$05 $C7 $44 $20 [$FFC4W] $C7 $44 $34 {$1A68W} $C7 $44 $28 [$0030W] #Death at $1A68, start animation = $30 = 48
$5E $5D $C3
#Garg
%patch $1843 $55 $8B $EC $56 $E8 $10EBW $8B $F0 $C7 $04 [$0003W] $8B $46 $04 #Sprite type = 3
$99 $B1 $0C $E8 $C8F8W $89 $44 $04 $89 $54 $06 $8B $46 $06 $99
$B1 $0C $E8 $C8E9W $89 $44 $08 $89 $54 $0A $C7 $44 $32 {$1B51W} #Start behavior at $1B51
$C7 $44 $34 {$1BCEW} $C7 $44 $28 [$003CW] $5E $5D $C3 #Death at $1BCE; start animation = $3C = 60
#Vorticon
%patch $17D5 $55 $8B $EC $56 $E8 $1159W $8B $F0 $C7 $04 [$0004W] $8B $46 $04 #Sprite type = 4
$99 $B1 $0C $E8 $C966W $89 $44 $04 $89 $54 $06 $8B $46 $06 $99
$B1 $0C $E8 $C957W $89 $44 $08 $89 $54 $0A $C7 $44 $32 {$1C0EW} #Behavior at 1C0E
$C7 $44 $34 {$1D6EW} $C7 $44 $24 [$0003W] $83 $3E $04 $83 {$10 $75} #Death 1D6E, strength = 3 unless level = 16
$05 $C7 $44 $24 [$0068W] $8B $44 $06 $8B $54 $04 $3B $06 $E0 $6E #Then strength = 100
$7C $0F $7F $06 $3B $16 $DE $6E $76 $07 $C7 $44 $20 [$FFA6W] $EB #If right of Keen speed = FFA6
$05 $C7 $44 $20 [$005AW] $C7 $44 $28 [$004EW] $5E $5D $C3 #Else speed = $5A, start animation = $4E
#Butler bot
%patch $1777 $55 $8B $EC $56 $E8 $11B7W $8B $F0 $C7 $04 [$0005W] $8B $46 $04 #Sprite type = 5
$99 $B1 $0C $E8 $C9C4W $89 $44 $04 $89 $54 $06 $8B $46 $06 $99
$B1 $0C $E8 $C9B5W $89 $44 $08 $89 $54 $0A $C7 $44 $20 [$005AW] #Start speed = $5A
$8B $44 $06 $8B $54 $04 $3B $06 $E0 $6E $7F $10 $7C $06 $3B $16
$DE $6E $73 $08 $8B $44 $20 $F7 $D8 $89 $44 $20 $C7 $44 $32
{$1DC7W} $C7 $44 $34 {$1E94W} $C7 $44 $28 [$0060W] $5E $5D $C3 #Behavior 1DC7, death 1E94, start animation $60
#Tank bot
%patch $1713 $55 $8B $EC $56 $E8 $121BW $8B $F0 $C7 $04 [$0006W] $8B $46 $04 #Sprite type = 6
$99 $B1 $0C $E8 $CA28W $89 $44 $04 $89 $54 $06 $8B $46 $06 $99
$B1 $0C $E8 $CA19W $05 $00 $08 $83 $D2 $00 $89 $44 $08 $89 $54
$0A $C7 $44 $20 [$005AW] $8B $44 $06 $8B $54 $04 $3B $06 $E0 $6E #Start speed = $5A
$7F $10 $7C $06 $3B $16 $DE $6E $73 $08 $8B $44 $20 $F7 $D8 $89
$44 $20 $C7 $44 $32 {$1F75W} $C7 $44 $34 {$2045W} $C7 $44 $28 #Start behavior at $1F75W death at $2045
[$006AW] $5E $5D $C3 #Start animation $6A
#Falling block
%patch $18E3 $55 $8B $EC $56 $E8 $104BW $8B $F0 $C7 $04 [$0008W] $8B $46 $04 #Sprite type = 8
$99 $B1 $0C $E8 $C858W $89 $44 $04 $89 $54 $06 $8B $46 $06 $99
$B1 $0C $E8 $C849W $89 $44 $08 $89 $54 $0A $C7 $44 $32 {$3360W} #Start behavior at $3360 (Nothing)
$C7 $44 $34 {$22BBW} $C7 $44 $28 [$0072W] $5E $5D $C3 #Death $22BB, start (and only) animation $72
#Ice cubes
%patch $1920 $55 $8B $EC $56 $E8 $1057W $8B $F0 $C7 $44 $08 $0003W $C7 $44 #No sprite type or other properties
$22 {$204AW} $8B $46 $08 $89 $44 $0A $8B $46 $04 $99 $89 $04 $89 #Call Canon behavior at $204A
$54 $02 $8B $46 $06 $99 $89 $44 $04 $89 $54 $06 $5E $5D $C3
Standardize Keen 1 initiations, allow more types of sprite
As explained under Patch:Patching Vorticon Sprites this patch rearranges the 'core switch statement' allowing all default sprites to be treated as standard. The new list length is the blue $09 and its location is $168A. This actually greatly simplifies the Keen 1 code, and as such is used in preference to the above default code as it flows more logically.
Keen 1 pointers
#Re-write the core switch statement.
%patch $161D $4B $83 $FB [$09] $76 $0A $81 $FB $FE $00 $0F $84 $A0 $00 $E9 $C1
$00 $D1 $E4 $2E $D1 $E3 $2E $FF $A7 {$168AW}
#Combine the ice-launchers
%patch $16B1 $D1 $EB $83 $EB $05 $53
#Locations of jumps to sprite spawn code
%patch $168A {$1656W} #Yorp
{$1661W} #Garg
{$166CW} #Vorticon
{$1676W} #Butler
{$1680W} #Tank
{$16B1W} #Ice Launcher 1
{$16B1W} #Ice Launcher 2
{$16B1W} #Ice Launcher 3
{$16B1W} #Ice Launcher 4
{$16C1W} #Falling Block
Keen 2
Keen 2 is much more regular than Keen 1 in that all its sprites follow he same basic pattern.
Initiations
All pointers are the same, two-byte values giving the exact location of the data they reference. Thus the pointer to the list of value $3BE2W directs the game to the list at $3BE2. The standard sprite list is 3 + 1 = 4 entries long. Other sprite types are more difficult to work with. Types 5, 6, 7 and 255 have their own separate codes that are jumped to directly, for reasons unknown.
Keen 1 Initiation list
#List location
%patch $3B4A {$3BE2W}
#List length
%patch $3B3F [$03]
#List
%patch $3BE2 [$3B5EW] #Vorticon (At $3B5E)
[$3B68W] #Youth (At $3B68)
[$3B72W] #Vorticon Elite (At $3B72)
[$3B7CW] #Scrub (At $3B7C)
#Special sprite numbers
%patch $3B37 [$05] $74 $4C #Robot (At $3B86)
%patch $3B4E [$06] $74 $3F #Platform (At $3B90)
%patch $3B53 [$07] $74 $44 #Tantalus spark (At $3B9A)
%patch $3B58 [$00FFW] $74 $48 #Keen (At $3BA4)
The initiation codes for Keen 2 are mostly quite simple, setting aside some memory space then jumping straight to the spawn code. Getting to the spawn code is reasonably easy to decipher, involving the address of the code plus the $E8 call plus the number of bytes before it.
The player's initiation is different and far more complex. It does not seem to call a spawn code, but the blue value is how high Keen spawns. (This appears to be stored in memory so Keen can be spawned later.)
Keen 2 initiation codes
#Initiation codes
%patch $3B5E $57 $56 $E8 $0087W $83 $C4 $04 $EB $60 #Goes to Vorticon (Code at $3B5E + $87 + $5 = $3BEA)
%patch $3B68 $57 $56 $E8 $00DFW $83 $C4 $04 $EB $56 #Goes to Youth (Code at $3B68 + $DF + $5 = $3C4C)
%patch $3B72 $57 $56 $E8 $0137W $83 $C4 $04 $EB $4C #Goes to Elite (Code at $3B72 + 137 + $5 = $3CAE)
%patch $3B7C $57 $56 $E8 $018FW $83 $C4 $04 $EB $42 #Goes to Scrub (Code at $3B7C + 18F + $5 = $3D10)
%patch $3B86 $57 $56 $E8 $01C2W $83 $C4 $04 $EB $38 #Goes to Robot (Code at $3B86 + 1C2 + $5 = $3D4D)
%patch $3B90 $57 $56 $E8 $01FFW $83 $C4 $04 $EB $2E #Goes to Platform (Code at $3B90 + 1FF + $5 = $3D94)
%patch $3B9A $57 $56 $E8 $023DW $83 $C4 $04 $EB $24 #Goes to Tantalus (Code at $3B9S + 23D + $5 = $3DDC)
#Keen's initiation
%patch $3BA4 $8B $C6 $99 $B1 $0C $E8 $9CD5W $A3 $6EBAW $89 $16 $6EBCW
$8B $C7 $99 $B1 $0C $E8 $9CC6W $05 [$0800W] $83 $D2 $00 $A3 $6EBEW
$89 $16 $6EC0W
Spawn codes
The spawn codes for Keen 2 are quite complex as they set most of the sprite's properties and behaviors, including strength, actions and death code. It is informative to browse Patch:Jump conditions, Patch:Sprite collision, Patch:Sprite behavior, Patch:Sprite animations and Patch:Sprite type. All of these are set in the following codes.
A notable difference fro Keen 1 is that nearly all sprites are given a strength value, even if that value is just 1.
Keen 2 spawn codes
#Vorticon spawning code
%patch $3BEA $55 $8B $EC $56 $E8 $1B86W $8B $F0 $C7 $04 [$0002W] $8B $46 $04 #Sprite type = 2
$99 $B1 $0C $E8 $9C81W $89 $44 $04 $89 $54 $06 $8B $46 $06 $99
$B1 $0C $E8 $9C72W $89 $44 $08 $89 $54 $0A $C7 $44 $32 {$3E19W} #Behavior = $3E19
$C7 $44 $34 {$3F8CW} $C7 $44 $24 [$0001W] $8B $44 $06 $8B $54 $04 #Collision = $3F8C, health = 1
$3B $06 $BC $6E $7C $0F $7F $06 $3B $16 $BA $6E $76 $07 $C7 $44
$20 [$FFA6W] $EB $05 $C7 $44 $20 [$005AW] $C7 $44 $28 [$0052W] $5E #Speed +-90, sprite = $52
$5D $C3
#Vorticon Youth spawning code
%patch $3C4C $55 $8B $EC $56 $E8 $1B24W $8B $F0 $C7 $04 [$0003W] $8B $46 $04 #Sprite type = 3
$99 $B1 $0C $E8 $9C1FW $89 $44 $04 $89 $54 $06 $8B $46 $06 $99
$B1 $0C $E8 $9C10W $89 $44 $08 $89 $54 $0A $C7 $44 $32 {$3FCCW} #Behavior = $3FCC
$C7 $44 $34 {$4093W} $C7 $44 $24 [$0001W] $8B $44 $06 $8B $54 $04 #Collision = $4094, health = 1
$3B $06 $BC $6E $7C $0F $7F $06 $3B $16 $BA $6E $76 $07 $C7 $44
$20 [$FF06W] $EB $05 $C7 $44 $20 [$00FAW] $C7 $44 $28 [$0030W] $5E #Speed +-250, sprite = $30
$5D $C3
#Vorticon Elite spawning code
%patch $3CAE $55 $8B $EC $56 $E8 $1AC2W $8B $F0 $C7 $04 [$0004W] $8B $46 $04 #Sprite type = 4
$99 $B1 $0C $E8 $9BBDW $89 $44 $04 $89 $54 $06 $8B $46 $06 $99
$B1 $0C $E8 $9BAEW $89 $44 $08 $89 $54 $0A $C7 $44 $32 {$40CEW} #Behavior = $40CE
$C7 $44 $34 {$4283W} $C7 $44 $24 [$0002W] $8B $44 $06 $8B $54 $04 #Collision = $4283, health = 2
$3B $06 $BC $6E $7C $0F $7F $06 $3B $16 $BA $6E $76 $07 $C7 $44
$20 [$FF9CW] $EB $05 $C7 $44 $20 [$0064W] $C7 $44 $28 [$0058W] $5E #Speed +-100, sprite = $58
$5D $C3
#Scrub spawning code
%patch $3D10 $55 $8B $EC $56 $E8 $1A60W $8B $F0 $C7 $04 [$0005W] $8B $46 $04 #Sprite type = 5
$99 $B1 $0C $E8 $9B5BW $89 $44 $04 $89 $54 $06 $8B $46 $06 $99
$B1 $0C $E8 $9B4CW $89 $44 $08 $89 $54 $0A $C7 $44 $32 {$42C1W} #Behavior = $42C1
$C7 $44 $34 {$4507W} $C7 $44 $28 [$0066W] $5E $5D $C3 #Collision = $4507, sprite = $66
#Guard Robot spawning code
%patch $3D4D $55 $8B $EC $56 $E8 $1A23W $8B $F0 $C7 $04 [$0006W] $8B $46 $04 #Sprite type = 6
$99 $B1 $0C $E8 $9B1EW $89 $44 $04 $89 $54 $06 $8B $46 $06 $99
$B1 $0C $E8 $9B0FW $89 $44 $08 $89 $54 $0A $C7 $44 $20 [$0064W] #Speed = 100
$C7 $44 $32 {$4539W} $C7 $44 $34 {$4677W} $C7 $44 $24 $63 $00 $C7 #Behavior = $4539, collision = $4677, sprite = $78
$44 $28 [$0078W] $5E $5D $C3
#Platform spawning code
%patch $3D94 $55 $8B $EC $56 $E8 $19DCW $8B $F0 $C7 $04 [$0007W] $8B $46 $04 #Sprite type = 7
$99 $B1 $0C $E8 $9AD7W $89 $44 $04 $89 $54 $06 $8B $46 $06 $99
$B1 $0C $E8 $9AC8W $05 [$FC00W] $83 $D2 $FF $89 $44 $08 $89 $54 #Spawn $FC00 down
$0A $C7 $44 $32 {$467CW} $C7 $44 $34 {$61A2W} $C7 $44 $28 [$007EW] #Behavior = $467C, collision = $61A2, speed = $7E, sprite = $4B
$C7 $44 $20 [$004BW] $5E $5D $C3
#Tantalus spawning code
%patch $3DDC $55 $8B $EC $56 $E8 $1994W $8B $F0 $C7 $04 [$0008W] $8B $46 $04 #Sprite type = 8
$99 $B1 $0C $E8 $9A8FW $89 $44 $04 $89 $54 $06 $8B $46 $06 $99
$B1 $0C $E8 $9A80W $89 $44 $08 $89 $54 $0A $C7 $44 $32 {$46DFW} #Behavior = $46DF, collision = $4716, sprite = $80
$C7 $44 $34 {$4716W} $C7 $44 $28 [$0080W] $5E $5D $C3
Standardize Keen 2 initiations, allow more types of sprite
As explained under Patch:Patching Vorticon Sprites this patch rearranges the 'core switch statement' allowing all default sprites to be treated as standard. The new list length is the blue $07 and its location is $3B83. This allows several more sprites to be added to the game (here just one new one is added.)
Keen 2 pointers
#Regularized Keen 2 spawning code
%patch $3B35 $81 $FB $00FFW $74 $69 $4B $83 $FB [$07] $76 $03 $E9 $0084W $D1
$E3 $2E $FF $A7 $3B83W
%patch $3B4B $57 $56 $E8 $009AW $EB $4D $57 $56 $E8 $00F5W $EB $46
$57 $56 $E8 $0150W $EB $3F $57 $56 $E8 $01ABW $EB $38
$57 $56 $E8 $01E1W $EB $31 $57 $56 $E8 $0221W $EB $2A
$57 $56 $E8 $0262W $EB $23 $57 $56 $E8 $CF71W $EB $1C
%patch $3B83 $3B4BW $3B52W $3B59W $3B60W $3B67W $3B6EW $3B75W $3B7CW
#New sprite spawn, immortal, platform type, Tantalus behavior
%patch $0AF2 $55 $8B $EC $56 $E8 $4C7EW $8B $F0 $C7 $04 [$0007W] $8B $46 $04
$99 $B1 $0C $E8 $CD79W $89 $44 $04 $89 $54 $06 $8B $46 $06 $99
$B1 $0C $E8 $CD6AW $89 $44 $08 $89 $54 $0A $C7 $44 $32 {$46DFW}
$C7 $44 $34 {$4677W} $C7 $44 $28 $0010W $C7 $44 $20 [$0049W] $5E
$5D $C3
Keen 3
Keen 3 is much more regular than Keen 1 or 2 in that all its sprites follow he same basic pattern.
Initiations
All pointers are the same, two-byte values giving the exact location of the data they reference. However Keen 3 has one important different. The primary list is a 'number list' that gives values in the sprite plane that are converted to various sprites. (For example value 1 in the sprite plane becomes sprite 1, the Vorticon. Value 255 becomes sprite 19, or Keen.) Both this list and the pointer list are the same length, controlled by a single variable, the list length. This is in entries, or words; two bytes long. (So the list length in bytes is this value * 2) The location of the pointer list is a number of bytes after the number list (So changing the number list's location also changes the pointer list location.) By default this value is the length of the number list in bytes so that both lists form a solid block of data. Also notable is the 'Vorticon 2' which has its own sprite number, yet has the same pointer as the Vorticon meaning this sprite is just an unnecessary additional Vorticon.
Keen 3 Initiation lists
#List location
%patch $3ACA {$3BD4W} #Number
%patch $3ADE [$26] #Pointer list is this many bytes after number list (3BD4 + 26 = 3BFA)
#List lengths (in words, = byte length/2)
%patch $3AC7 $0013W
#Number list
%patch $3BD4 [$0001W] #Vorticon
%patch $3BD6 [$0002W] #Vortikid
%patch $3BD8 [$0003W] #Vortimom
%patch $3BDA [$0004W] #Meep
%patch $3BDC [$0005W] #Vortininja
%patch $3BDE [$0006W] #Foob
%patch $3BE0 [$0007W] #Ball
%patch $3BE2 [$0008W] #Jack
%patch $3BE4 [$0009W] #H Platform
%patch $3BE6 [$000AW] #V Platform
%patch $3BE8 [$000BW] #Vorticon 2
%patch $3BEA [$000CW] #Purple Spark
%patch $3BEC [$000DW] #Heart
%patch $3BEE [$000EW] #Gun across
%patch $3BF0 [$000FW] #Gun down
%patch $3BF2 [$0010W] #MM Hand
%patch $3BF4 [$0011W] #MM Left foot
%patch $3BF6 [$0012W] #MM Right foot
%patch $3BF8 [$00FFW] #Keen
#Pointer list
%patch $3BFA [$3ADFW] #Vorticon
%patch $3BFC [$3AE9W] #Vortikid
%patch $3BFE [$3AF3W] #Vortimom
%patch $3C00 [$3AFDW] #Meep
%patch $3C02 [$3B07W] #Vortininja
%patch $3C04 [$3B11W] #Foob
%patch $3C06 [$3B1BW] #Ball
%patch $3C08 [$3B25W] #Jack
%patch $3C0A [$3B2FW] #H Platform
%patch $3C0C [$3B39W] #V Platform
%patch $3C0E [$3B42W] #Vorticon 2
%patch $3C10 [$3B4BW] #Purple Spark
%patch $3C12 [$3B54W] #Heart
%patch $3C14 [$3B5DW] #Gun across
%patch $3C16 [$3B66W] #Gun down
%patch $3C18 [$3B6FW] #Hand
%patch $3C1A [$3B78W] #Left Foot
%patch $3C1C [$3B86W] #Right foot
%patch $3C1E [$3B94W] #Keen
The initiation codes for the various sprites are quite simple. each simply tells the game a new sprite is going to be produced, then jumps to that sprite's spawn code. The finishing code is run by all sprite initiation codes.
Keen 3 initiation codes
#Initiation codes
%patch $3ADF $56 $57 $E8 $013CW $59 $59 $E9 $00D1W #Goes to Vorticon (Code at $3ADF + $13C + 5 = $3C20)
%patch $3AE9 $56 $57 $E8 $0194W $59 $59 $E9 $00C7W #Goes to Vortikid (Code at $3AE9 + $194 + 5 = $3C82)
%patch $3AF3 $56 $57 $E8 $01ECW $59 $59 $E9 $00BDW #Goes to Vortimom (Code at $3AF3 + $1EC + 5 = $3CE4)
%patch $3AFD $56 $57 $E8 $0244W $59 $59 $E9 $00B3W #Goes to Meep (Code at $3AFD + $244 + 5 = $3D46)
%patch $3B07 $56 $57 $E8 $02A2W $59 $59 $E9 $00A9W #Goes to Vortininja (Code at $3B07 + $2A2 + 5 = $3DAE)
%patch $3B11 $56 $57 $E8 $02FAW $59 $59 $E9 $009FW #Goes to Foob (Code at $3B11 + $2FA + 5 = $3E10)
%patch $3B1B $56 $57 $E8 $0352W $59 $59 $E9 $0095W #Goes to Ball (Code at $3B1B + $352 + 5 = $3E72)
%patch $3B25 $56 $57 $E8 $03CAW $59 $59 $E9 $008BW #Goes to Jack (Code at $3B25 + $3CA + 5 = $3EF4)
%patch $3B2F $56 $57 $E8 $0442W $59 $59 $E9 $0081W #Goes to H Platform (Code at $3B2F + $442 + 5 = $3F76)
%patch $3B39 $56 $57 $E8 $0480W $59 $59 $EB $78 #Goes to V Platform (Code at $3B39 + $480 + 5 = $3FBE)
%patch $3B42 $56 $57 $E8 $00D9W $59 $59 $EB $6F #Goes to Vorticon (Code at $3B42 + $D9 + 5 = $3C20)
%patch $3B4B $56 $57 $E8 $0516W $59 $59 $EB $66 #Goes to Purple Spark (Code at $3B4B + $516 + 5 = $4066)
%patch $3B54 $56 $57 $E8 $054AW $59 $59 $EB $5D #Goes to Heart (Code at $3B54 + $54A + 5 = $40A3)
%patch $3B5D $56 $57 $E8 $049EW $59 $59 $EB $54 #Goes to Gun across (Code at $3B5D + $49E + 5 = $4000)
%patch $3B66 $56 $57 $E8 $04C8W $59 $59 $EB $4B #Goes to Gun down (Code at $3B66 + $4C8 + 5 = $4033)
%patch $3B6F $56 $57 $E8 $056CW $59 $59 $EB $42 #Goes to Hand (Code at $3B6F + $56C + 5 = $40E0)
%patch $3B78 $B8 $FFFFW $50 $56 $57 $E8 $0597W $83 $C4 $06 $EB $34 #Goes to Left foot (Code at $3B78 + $597 + 9 = $4118)
%patch $3B86 $B8 $0001W $50 $56 $57 $E8 $0589W $83 $C4 $06 $EB $26 #Goes to Right foot (Code at $3B86 + $589 + 9 = $4118)
%patch $3B94 $8B $C7 $99 $B1 $0C $E8 $25 $A3B0W $0A $71 $89 $16 $0C $71 $8B #Goes to Keen (Code at $3B94 + $B016 + 5 = $EBAA)
$C6 $99 $B1 $0C $E8 $B016W $05 $00 $08 $83 $D2 $00 $A3 $0E $71
$89 $16 $10 $71 $EB $00
%patch $3BBA $47 $3B $3E $34 $6E $7D $03 $E9 $E6 $FE $46 $3B $36 $84 $6E $7D #Finisher
$03 $E9 $D7 $FE $5F $5E $8B $E5 $5D $C3
Spawn codes
The spawn codes for Keen 3 are quite complex as they set most of the sprite's properties and behaviors, including strength, actions and death code. It is informative to browse Patch:Jump conditions, Patch:Sprite collision, Patch:Sprite behavior, Patch:Sprite animations and Patch:Sprite type. All of these are set in the following codes. Notice that the left and right foot of the Mangling Machine use the same spawn code, and that both the MM hands and feet are metasprites not sprites.
A notable difference fro Keen 1 is that nearly all sprites are given a strength value, even if that value is just 1.
Keen 3 spawn codes
#Vorticon
%patch $3C20 $55 $8B $EC $56 $E8 $2396W $8B $F0 $C7 $04 [$0002W] $8B $46 $04 #Sprite type = 2
$99 $B1 $0C $E8 $AF8BW $89 $44 $04 $89 $54 $06 $8B $46 $06 $99
$B1 $0C $E8 $AF7CW $89 $44 $08 $89 $54 $0A $C7 $44 $32 {$414AW} #Behavior = $414A
$C7 $44 $34 {$42D0W} $C7 $44 $24 [$0001W] $8B $44 $06 $8B $54 $04 #Collision = $42D0, health = 1
$3B $06 $0C $71 $7C $0F $7F $06 $3B $16 $0A $71 $76 $07 $C7 $44 #Check for Keen
$20 [$FFA6W] $EB $05 $C7 $44 $20 [$005AW] $C7 $44 $28 [$0047W] $5E #Speed +-5A sprite = 47
$5D $C3
#Vortikid
%patch $3C82 $55 $8B $EC $56 $E8 $2334W $8B $F0 $C7 $04 [$0003W] $8B $46 $04 #Sprite type = 3
$99 $B1 $0C $E8 $AF29W $89 $44 $04 $89 $54 $06 $8B $46 $06 $99
$B1 $0C $E8 $AF1AW $89 $44 $08 $89 $54 $0A $C7 $44 $32 {$4311W} #Behavior = $4311
$C7 $44 $34 {$43D9W} $C7 $44 $24 [$0001W] $8B $44 $06 $8B $54 $04 #Collision = $43D9, health = 1
$3B $06 $0C $71 $7C $0F $7F $06 $3B $16 $0A $71 $76 $07 $C7 $44
$20 [$FF06W] $EB $05 $C7 $44 $20 [$00FAW] $C7 $44 $28 [$002FW] $5E #Speed +-250, sprite = 2F
$5D $C3
#Vortimom
%patch $3CE4 $55 $8B $EC $56 $E8 $22D2W $8B $F0 $C7 $04 [$0004W] $8B $46 $04 #Sprite type = 4
$99 $B1 $0C $E8 $AEC7W $89 $44 $04 $89 $54 $06 $8B $46 $06 $99
$B1 $0C $E8 $AEB8W $89 $44 $08 $89 $54 $0A $C7 $44 $32 {$440CW} #Behavior = $440C
$C7 $44 $34 {$470CW} $C7 $44 $24 [$0005W] $8B $44 $06 $8B $54 $04 #Collision = $470C, health = 5
$3B $06 $0C $71 $7C $0F $7F $06 $3B $16 $0A $71 $76 $07 $C7 $44
$20 [$FFCEW] $EB $05 $C7 $44 $20 [$0032W] $C7 $44 $28 [$0055W] $5E #Speed +-50, sprite = 55
$5D $C3
#Meep
%patch $3D46 $55 $8B $EC $56 $E8 $2270W $8B $F0 $C7 $04 [$0005W] $8B $46 $04 #Sprite type = 5
$99 $B1 $0C $E8 $AE65W $89 $44 $04 $89 $54 $06 $8B $46 $06 $99
$B1 $0C $E8 $AE56W $05 $00 $08 $83 $D2 $00 $89 $44 $08 $89 $54
$0A $C7 $44 $32 {$4746W} $C7 $44 $34 {$4898W} $C7 $44 $24 [$0001W] #Behavior = $4746 Collision = $4898, health = 1
$8B $44 $06 $8B $54 $04 $3B $06 $0C $71 $7C $0F $7F $06 $3B $16
$0A $71 $76 $07 $C7 $44 $20 [$FFBFW] $EB $05 $C7 $44 $20 [$0041W] #Speed +-65, sprite = 78
$C7 $44 $28 [$0078W] $5E $5D $C3
#Vortininja
%patch $3DAE $55 $8B $EC $56 $E8 $2208W $8B $F0 $C7 $04 [$0006W] $8B $46 $04 #Sprite type = 6
$99 $B1 $0C $E8 $ADFDW $89 $44 $04 $89 $54 $06 $8B $46 $06 $99
$B1 $0C $E8 $ADEEW $89 $44 $08 $89 $54 $0A $C7 $44 $32{ $48F7W} #Behavior = $48F7
$C7 $44 $34 {$49CDW} $C7 $44 $24 [$0003W] $8B $44 $06 $8B $54 $04 #Collision $49CD, health = 3
$3B $06 $0C $71 $7C $0F $7F $06 $3B $16 $0A $71 $76 $07 $C7 $44
$20 [$FFFFW] $EB $05 $C7 $44 $20 [$0001W] $C7 $44 $28 [$004DW] $5E #Face Keen, sprite = 4D
$5D $C3
#Foob
%patch $3E10 $55 $8B $EC $56 $E8 $21A6W $8B $F0 $C7 $04 [$0007W] $8B $46 $04 #Sprite type = 7
$99 $B1 $0C $E8 $AD9BW $89 $44 $04 $89 $54 $06 $8B $46 $06 $99
$B1 $0C $E8 $AD8CW $89 $44 $08 $89 $54 $0A $C7 $44 $32 {$4A0CW} #Behavior = $4A0C
$C7 $44 $34 {$4B7EW} $C7 $44 $24 [$0001W] $8B $44 $06 $8B $54 $04 #Collision $4B 7E, health = 1
$3B $06 $0C $71 $7C $0F $7F $06 $3B $16 $0A $71 $76 $07 $C7 $44
$20 [$FFCEW] $EB $05 $C7 $44 $20 [$0032W] $C7 $44 $28 [$005DW] $5E #Speed +-50, sprite = 5D
$5D $C3
#Ball
%patch $3E72 $55 $8B $EC $56 $E8 $2144W $8B $F0 $C7 $04 [$0008W] $8B $46 $04 #Sprite type = 8
$99 $B1 $0C $E8 $AD39W $89 $44 $04 $89 $54 $06 $8B $46 $06 $99
$B1 $0C $E8 $AD2AW $89 $44 $08 $89 $54 $0A $C7 $44 $32 {$4C0BW} #Behavior = $4A0C
$C7 $44 $34 {$6A00W} $C7 $44 $24 [$0001W] $8B $44 $06 $8B $54 $04 #Collision $6A00, health = 1
$3B $06 $0C $71 $7C $0F $7F $06 $3B $16 $0A $71 $76 $07 $C7 $44
$20 [$FE70W] $EB $05 $C7 $44 $20 [$0190W] $8B $44 $0A $8B $54 $08 #H Speed +-400
$3B $06 $10 $71 $7C $0F $7F $06 $3B $16 $0E $71 $76 $07 $C7 $44
$22 [$FE70W] $EB $05 $C7 $44 $22 [$0190W] $C7 $44 $28 [$006DW] $5E #V Speed +-400, sprite = 6D
$5D $C3
#Jack
%patch $3EF4 $55 $8B $EC $56 $E8 $20C2W $8B $F0 $C7 $04 [$0009W] $8B $46 $04 #Sprite type = 9
$99 $B1 $0C $E8 $ACB7W $89 $44 $04 $89 $54 $06 $8B $46 $06 $99
$B1 $0C $E8 $ACA8W $89 $44 $08 $89 $54 $0A $C7 $44 $32 {$4BBDW} #Behavior = $4BBD
$C7 $44 $34 {$6A00W} $C7 $44 $24 [$0001W] $8B $44 $06 $8B $54 $04 #Collision $6A00, health = 1
$3B $06 $0C $71 $7C $0F $7F $06 $3B $16 $0A $71 $76 $07 $C7 $44
$20 [$FE70W] $EB $05 $C7 $44 $20 [$0190W] $8B $44 $0A $8B $54 $08 #H Speed +-400
$3B $06 $10 $71 $7C $0F $7F $06 $3B $16 $0E $71 $76 $07 $C7 $44
$22 [$FE70W] $EB $05 $C7 $44 $22 [$0190W] $C7 $44 $28 [$006EW] $5E #V Speed +-400, sprite = 6D
$5D $C3
#H Platform
%patch $3F76 $55 $8B $EC $56 $E8 $2040W $8B $F0 $C7 $04 [$000AW] $8B $46 $04 #Sprite type = 10
$99 $B1 $0C $E8 $AC35W $89 $44 $04 $89 $54 $06 $8B $46 $06 $99
$B1 $0C $E8 $AC26W $05 $00 $FC $83 $D2 $FF $89 $44 $08 $89 $54
$0A $C7 $44 $32 {$4C47W} $C7 $44 $34 {$6A00W} $C7 $44 $28 [$006BW] #Behavior = $4C47, Collision $6A00 Sprite = 6B
$C7 $44 $20 [$004BW] $5E $5D $C3 #Speed = +76
#V Platform
%patch $3FBE $55 $8B $EC $56 $E8 $1FF8W $8B $F0 $C7 $04 [$000AW] $8B $46 $04 #Sprite type = 10
$99 $B1 $0C $E8 $ABEDW $89 $44 $04 $89 $54 $06 $8B $46 $06 $99
$B1 $0C $E8 $ABDEW $89 $44 $08 $89 $54 $0A $C7 $44 $32 {$4C47W} #Behavior = $4C47
$C7 $44 $34 {$6A00W} $C7 $44 $28 [$006BW] $C7 $44 $22 [$004BW] $5E #Collision $6A00, Sprite = 6B, Speed = +76
$5D $C3
#H gun
%patch $4000 $55 $8B $EC $56 $E8 $2001W $8B $F0 $C7 $44 $08 [$0005W] $8B $46 $04 #Sprite type = 5
$99 $B1 $0C $E8 $ABAAW $89 $04 $89 $54 $02 $8B $46 $06 $99 $B1 $0C
$E8 $AB9CW $89 $44 $04 $89 $54 $06 $C7 $44 $22 {$4D34W} $5E $5D $C3 #Behavior = $4D34
#V gun
%patch $4033 $55 $8B $EC $56 $E8 $1FCEW $8B $F0 $C7 $44 $08 [$0005W] $8B $46 $04 #Sprite type = 5
$99 $B1 $0C $E8 $AB77W $89 $04 $89 $54 $02 $8B $46 $06 $99 $B1 $0C
$E8 $AB69W $89 $44 $04 $89 $54 $06 $C7 $44 $22 {$4D9BW} $5E $5D $C3 #Behavior = $4D9B
#Purple Spark
%patch $4066 $55 $8B $EC $56 $E8 $1F50W $8B $F0 $C7 $04 [$000DW] $8B $46 $04 #Sprite type = 13
$99 $B1 $0C $E8 $AB45W $89 $44 $04 $89 $54 $06 $8B $46 $06 $99
$B1 $0C $E8 $AB36W $89 $44 $08 $89 $54 $0A $C7 $44 $32 {$4E02W} #Behavior = $4E02
$C7 $44 $34 {$4E19W} $C7 $44 $28 [$0072W] $5E $5D $C3 #Collision $4E19, sprite = 72
#Heart
%patch $40A3 $55 $8B $EC $56 $E8 $1F13W $8B $F0 $C7 $04 [$000CW] $8B $46 $04 #Sprite type = 12
$B1 $0C $E8 $AB08W $89 $44 $04 $89 $54 $06 $8B $46 $06 $99 $B1
$0C $E8 $AAF9W $89 $44 $08 $89 $54 $0A $C7 $44 $32 {$4EA6W} $C7 #Behavior = $4EA6
$44 $34 {$4EBEW} $C7 $44 $28 [$0072W] $5E $5D $C3 #Collision $4EBE, sprite = 72
#MM Hand (Spawns metasprite, not sprite)
%patch $40E0 $55 $8B $EC $56 $E8 $1F21W $8B $F0 $C7 $44 $08 [$0006W] $8B $46 #Sprite type = 6
$04 $99 $89 $04 $89 $54 $02 $8B $46 $06 $99 $89 $44 $04 $89 $54
$06 $C7 $44 $22 {$50F4W} $C7 $44 $0C [$0000W] $C7 $44 $0A [$0001W] #Direction = right, up
$C7 $44 $0E $000FW $5E $5D $C3
#MM Feet (Spawns metasprite, not sprite)
%patch $4118 $55 $8B $EC $56 $E8 $1EE9W $8B $F0 $C7 $44 $08 [$0007W] $8B $46 #Sprite type = 7
$04 $99 $89 $04 $89 $54 $02 $8B $46 $06 $99 $89 $44 $04 $89 $54
$06 $8B $46 $08 $89 $44 $0A $89 $44 $0E $C7 $44 $22 {$52F1W} $5E #Behavior = $52F1
$5D $C3
Keen Dreams
Keen Dreams is similar to Keen Galaxy in that there are two kinds of pointers, 'short' (two-byte) pointers used in the pointer list and 'long' (four byte) pointers.
Initiations
Pointers in Dreams are different from those in Vorticons in that they require a value to be added to them to get the actual location they refer to. In Dreams this is $44D0. So a pointer with the value $04FCW actually refers to code at $04FC + $44D0 = $49CC. Interestingly infoplane values are used for both sprites and level entrances on the map. This means that if extra levels are desired some sprites will have to be overwritten
Keen Dreams pointer list
#Location of list ($44D0 + $050DW = $49DD)
%patch $4774 [$050DW]
#Length of list (60 items)
%patch $4769 [$3C]
#Sprite code pointer list (Origin is 44D0)
%patch $49DD [$02A6W] #Keen right (At $4776)
%patch $49DF [$02BDW] #Keen left (At $478D)
%patch $49E1 [$04FCW] #BLANK (At $49CC)
%patch $49E3 [$04FCW] #BLANK (At $49CC)
%patch $49E5 [$04FCW] #BLANK (At $49CC)
%patch $49E7 [$04FCW] #BLANK (At $49CC)
%patch $49E9 [$04FCW] #BLANK (At $49CC)
%patch $49EB [$04FCW] #BLANK (At $49CC)
%patch $49ED [$04FCW] #BLANK (At $49CC)
%patch $49EF [$04FCW] #BLANK (At $49CC)
%patch $49F1 [$04FCW] #BLANK (At $49CC)
%patch $49F3 [$04FCW] #BLANK (At $49CC)
%patch $49F5 [$04FCW] #BLANK (At $49CC)
%patch $49F7 [$04FCW] #BLANK (At $49CC)
%patch $49F9 [$04FCW] #BLANK (At $49CC)
%patch $49FB [$04FCW] #BLANK (At $49CC)
%patch $49FD [$04FCW] #BLANK (At $49CC)
%patch $49FF [$04FCW] #BLANK (At $49CC)
%patch $4A01 [$02D4W] #Map Keen (At $47A4)
%patch $4A03 [$04FCW] #BLANK (At $49CC)
%patch $4A05 [$02F3W] #100 Pts (At $47C3)
%patch $4A07 [$02F3W] #200 Pts (At $47C3)
%patch $4A09 [$02F3W] #500 Pts (At $47C3)
%patch $4A0B [$02F3W] #1000 Pts (At $47C3)
%patch $4A0D [$02F3W] #2000 Pts (At $47C3)
%patch $4A0F [$02F3W] #5000 Pts (At $47C3)
%patch $4A11 [$02F3W] #1UP (At $47C3)
%patch $4A13 [$02F3W] #Eye (At $47C3)
%patch $4A15 [$02F3W] #Flower Power (At $47C3)
%patch $4A17 [$02F3W] #Flower Pot (At $47C3)
%patch $4A19 [$02EDW] #Boobus Bomb (At $47BD)
%patch $4A1B [$02F3W] #Key (At $47C3)
%patch $4A1D [$0316W] #Door (At $47E6)
%patch $4A1F [$04FCW] #BLANK (At $49CC)
%patch $4A21 [$04FCW] #BLANK (At $49CC)
%patch $4A23 [$04FCW] #BLANK (At $49CC)
%patch $4A25 [$04FCW] #BLANK (At $49CC)
%patch $4A27 [$04FCW] #BLANK (At $49CC)
%patch $4A29 [$04FCW] #BLANK (At $49CC)
%patch $4A2B [$04FCW] #BLANK (At $49CC)
%patch $4A2D [$0332W] #Broccolash (At $4802)
%patch $4A2F [$0354W] #Tomatooth (At $4824)
%patch $4A31 [$0376W] #Carrot Courier (At $4846)
%patch $4A33 [$04FCW] #BLANK (At $49CC)
%patch $4A35 [$0398W] #Asparagusto (At $4868)
%patch $4A37 [$03BAW] #Sour Grape (At $488A)
%patch $4A39 [$03DCW] #Tater Trooper (At $48AC)
%patch $4A3B [$03FEW] #Minecart (At $48CE)
%patch $4A3D [$0417W] #Frenchy (At $48E7)
%patch $4A3F [$0439W] #Melon Lips left (At $4909)
%patch $4A41 [$0439W] #Melon Lips right (At $4909)
%patch $4A43 [$0439W] #Melon Lips down (At $4909)
%patch $4A45 [$04FCW] #BLANK (At $49CC)
%patch $4A47 [$04FCW] #BLANK (At $49CC)
%patch $4A49 [$04FCW] #BLANK (At $49CC)
%patch $4A4B [$04FCW] #BLANK (At $49CC)
%patch $4A4D [$0462W] #Squasher (At $4932)
%patch $4A4F [$0483W] #Apel (At $4953)
%patch $4A51 [$04A4W] #Pea Pod (At $4974)
%patch $4A53 [$04C5W] #Pea Brain (At $4995)
%patch $4A55 [$04E6W] #Boobus Tuber (At $49B6)
There are several things to note about the initiation codes. They are quite similar to those in Keen Vorticons.
The first and most important thing is sprite cache. When a sprite is spawned it often (But not always!) sets a value in memory to 1. This section of memory is then scanned and sprites cached off the sprite cache list. This is a five byte string $C7 $06 $70xxW $0001W, where xx is different for each sprite cache. As an example the Brocolash's cache is $BC, the Tomatooth's is $BE (They are next to each other in the cache list, and thus differ by 2 in memory.) A fuller explanation of this is given at Patch:Sprite cache.
Notice the Pea Brain uses the same cache as the Pea Pod; this may be because the Pea Brain is never used in Keen Dreams by default and so is 'slaved' to the Pea Pod.
The call ($9A $xxxxxxxxRL) is the call to the actual spawning code. So for example Normal Keen calls $05E80CFFRL. All jumps ($E9 $xxxxW or $EB $xx.) go to the 'Blank' code. These will need to be adjusted if the code is copied somewhere else, for example to make a new sprite.
Keen Dreams initiation codes
#Right Keen initiation code
%patch $4776 $B8 $0001W $50 $FF $36 $7052W $FF $36 $7050W $9A $05E80CFFRL
$83 $C4 $06 $E9 $023FW
#Left Keen initiation code
%patch $478D $B8 $FFFFW $50 $FF $36 $7052W $FF $36 $7050W $9A $05E80CFFRL
$83 $C4 $06 $E9 $0228W
#Map Keen initiation code
%patch $47A4 $FF $36 $7052W $FF $36 $7050W $9A $05E80B20RL $83 $C4 $04
$C7 $06 $70BAW $0001W $E9 $020FW
#Boobus Bomb (Uses following item initiation code)
%patch $47BD $C7 $06 $704CW $0001W
#Items initiation code
%patch $47C3 $A1 $70ACW $2D [$0015W] $50 $FF $36 $7052W $FF $36 $7050W $9A
$07C504A3RL $83 $C4 $06 $8B $1E $3E $70 $C7 $47 $02 $0000W
$E9 $01E6W
#Door initiation code
%patch $47E6 $FF $36 $7052W $FF $36 $7050W $9A $07C50323RL $83 $C4 $04
$8B $1E $3E $70 $C7 $47 $02 $0000W $E9 $01CAW
#Broccolash initiation code
%patch $4802 $FF $36 $7052W $FF $36 $7050W $9A $07C50546RL $83 $C4 $04
$8B $1E $3E $70 $C7 $47 $02 $0000W $C7 $06 $70BCW $0001W $E9
$01A8W
#Tomatooth initiation code
%patch $4824 $FF $36 $7052W $FF $36 $7050W $9A $07C5060ARL $83 $C4 $04
$8B $1E $3E $70 $C7 $47 $02 $0000W $C7 $06 $70BEW $0001W $E9
$0186W
#Carrot Courier initiation code
%patch $4846 $FF $36 $7052W $FF $36 $7050W $9A $07C5078DRL $83 $C4 $04
$8B $1E $3E $70 $C7 $47 $02 $0000W $C7 $06 $70C0W $0001W $E9
$0164W
#Asparagusto initiation code
%patch $4868 $FF $36 $7052W $FF $36 $7050W $9A $07C50896RL $83 $C4 $04
$8B $1E $3E $70 $C7 $47 $02 $0000W $C7 $06 $70C2W $0001W $E9
$0142W
#Sour Grape initiation code
%patch $488A $FF $36 $7052W $FF $36 $7050W $9A $07C508D4RL $83 $C4 $04
$8B $1E $3E $70 $C7 $47 $02 $0000W $C7 $06 $70C4W $0001W $E9
$0120W
#Tater Trooper initiation code
%patch $48AC $FF $36 $7052W $FF $36 $7050W $9A $08680006RL $83 $C4 $04
$8B $1E $3E $70 $C7 $47 $02 $0000W $C7 $06 $70C6W $0001W $E9
$00FEW
#Minecart initiation code
%patch $48CE $FF $36 $7052W $FF $36 $7050W $9A $08680100RL $83 $C4 $04
$C7 $06 $70C8W $0001W $E9 $00E5W
#Frenchy initiation code
%patch $48E7 $FF $36 $7052W $FF $36 $7050W $9A $086801E1RL $83 $C4 $04
$8B $1E $3E $70 $C7 $47 $02 $0000W $C7 $06 $70CAW $0001W $E9
$00C3W
#Melon initiation code
%patch $4909 $A1 $70ACW $2D $0032W $50 $FF $36 $7052W $FF $36 $7050W $9A
$0868035ERL $83 $C4 $06 $8B $1E $3E $70 $C7 $47 $02 $0000W
$C7 $06 $70CCW $0001W $E9 $009AW
#Squasher initiation code
%patch $4932 $FF $36 $7052W $FF $36 $7050W $9A $086807BFRL $83 $C4 $04
$8B $1E $3E $70 $C7 $47 $02 $0000W $C7 $06 $70CEW $0001W $EB
$79
#Apel initiation code
%patch $4953 $FF $36 $7052W $FF $36 $7050W $9A $086808C8RL $83 $C4 $04
$8B $1E $3E $70 $C7 $47 $02 $0000W $C7 $06 $70D0W $0001W $EB
$58
#Pea Pod initiation code
%patch $4974 $FF $36 $7052W $FF $36 $7050W $9A $08680B67RL $83 $C4 $04
$8B $1E $3E $70 $C7 $47 $02 $0000W $C7 $06 $70D2W $0001W $EB
$37
#Pea Brain initiation code
%patch $4995 $FF $36 $7052W $FF $36 $7050W $9A $08680AE9RL $83 $C4 $04
$8B $1E $3E $70 $C7 $47 $02 $0000W $C7 $06 $70D2W $0001W $EB
$16
#Boobus Tuber initiation code
%patch $49B6 $FF $36 $7052W $FF $36 $7050W $9A $08680C8ARL $83 $C4 $04
$C7 $06 $70D4W $0001W
#BLANK (All initiation codes jump to this)
%patch $49CC $8B $1E $3E $70 $83 $7F $02 $02 $74 $05 $C7 $47 $02 $0000W $C3
Spawn codes
The last blue highlighted value is the sprite action the sprite uses as it proceeds to act in-level. $C7 $07 $xxxxW sets the sprite type and $C7 $47 $0E $xxxxW is the horizontal direction the sprite starts moving in, either $0001W (Facing right), $FFFFW (Facing left) or $0000W (Neither, never used.) $C7 $47 $10 $xxxxW is the vertical direction and works similarly.
Finally $D3 $E0 $05 $xxxxW is how far down (Or more usually up) the sprite is spawned from where it is placed. This is necessary for sprites that walk on the ground as they can only be placed in the level at multiples of 16 pixels high while their actual height can be anything. However it is often used even when this is not the case.
Keen Dreams spawn codes
#Map Keen spawn code
%patch $69A0 $55 $8B $EC $8B $1E $34 $70 $C7 $07 [$0001W] $83 $3E {$70EEW} [$00]
{$75} $11 $8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B $46 $08 $D3
$E0 $EB $0D $8B $1E $34 $70 $A1 $70EEW $89 $47 $0A $A1 $70F0W
$89 $47 $0C $8B $1E $34 $70 $C7 $47 $02 [$0001W] $C7 $47 $06 [$0001W]
$C7 $47 $0E [$0000W] $C7 $47 $10 [$0000W] $C7 $47 $3E [$0006W]
$C7 $47 $40 [$0003W] $C7 $47 $20 [$00D7W] $B8 [$0D3AW] $50 $FF $36
$34 $70 $9A $044D1212RL $83 $C4 $04 $5D $CB
#Keen spawn code
%patch $6B7F $55 $8B $EC $8B $1E $34 $70 $C7 $07 [$0001W] $C7 $47 $02 [$0001W]
$C7 $47 $06 [$0001W] $8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B
$46 $08 $D3 $E0 $05 [$FF00W] $89 $47 $0C $8B $46 $0A $89 $47 $0E
$C7 $47 $10 [$0001W] $B8 [$0ED8W] $50 $FF $36 $34 $70 $9A $044D1212RL
$83 $C4 $04 $5D $CB
#Door spawn code
%patch $7F73 $55 $8B $EC $33 $C0 $50 $9A $044D01C9RL $44 $44 $8B $1E $3E
$70 $C7 $07 [$0003W] $8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B
$46 $08 $D3 $E0 $05 [$FF00W] $89 $47 $0C $C7 $47 $0E [$0001W] $C7
$47 $10 [$FFFFW] $C7 $47 $06 [$0000W] $B8 [$1732W] $50 $FF $36 $3E
$70 $9A $044D1212RL $83 $C4 $04 $5D $CB
#Items spawn code
%patch $80F3 $55 $8B $EC $56 $8B $76 $0A $33 $C0 $50 $9A $044D01C9RL $44
$44 $8B $1E $3E $70 $C7 $47 $06 [$0000W] $C7 $07 [$0004W] $8B $46
$06 $B1 $08 $D3 $E0 $89 $47 $0A $8B $46 $08 $D3 $E0 $89 $47 $0C
$83 $FE [$09] {$75} $05 $81 {$0C6FW} [$0080W] $8B $1E $3E $70 $C7 $47
$10 [$FFFFW] $89 $77 $3E $8B $DE $D1 $E3 $8B $87 [$19A8W] $8B $1E
$3E $70 $89 $47 $20 $89 $47 $40 $83 $FE [$07] {$74} $07 $8B $47 $40
$40 $40 $EB $0A $8B $1E $3E $70 $8B $47 $40 $05 [$0004W] $8B $1E
$3E $70 $89 $47 $42 $B8 [$196CW] $50 $FF $36 $3E $70 $9A $044D1212RL
$83 $C4 $04 $5E $5D $CB
#Broccolash spawn code
%patch $8196 $55 $8B $EC $33 $C0 $50 $9A $044D01C9RL $44 $44 $8B $1E $3E
$70 $C7 $07 [$0005W] $8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B
$46 $08 $D3 $E0 $05 [$FF00W] $89 $47 $0C $C7 $47 $0E [$0001W] $B8
[$19C0W] $50 $FF $36 $3E $70 $9A $044D1212RL $83 $C4 $04 $5D
$CB
#Tomatooth spawn code
%patch $825A $55 $8B $EC $33 $C0 $50 $9A $044D01C9RL $44 $44 $8B $1E $3E
$70 $C7 $07 [$0006W] $8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B
$46 $08 $D3 $E0 $05 [$FF80W] $89 $47 $0C $C7 $47 $0E [$0001W] $B8
[$1B46W] $50 $FF $36 $3E $70 $9A $044D1212RL $83 $C4 $04 $5D
$CB
#Carrot Courier spawn code
%patch $83DD $55 $8B $EC $33 $C0 $50 $9A $044D01C9RL $44 $44 $8B $1E $3E
$70 $C7 $07 [$0007W] $8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B
$46 $08 $D3 $E0 $05 [$FF00W] $89 $47 $0C $C7 $47 $0E [$0001W] $C7
$47 $10 [$0001W] $B8 [$1B82W] $50 $FF $36 $3E $70 $9A $044D1212RL
$83 $C4 $04 $8B $1E $3E $70 $C7 $47 $36 [$0001W] $5D $CB
#Asparagusto spawn code
%patch $84E6 $55 $8B $EC $33 $C0 $50 $9A $044D01C9RL $44 $44 $8B $1E $3E
$70 $C7 $07 [$0009W] $8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B
$46 $08 $D3 $E0 $89 $47 $0C $C7 $47 $0E [$0001W] $B8 [$1C18W] $50
$FF $36 $3E $70 $9A $044D1212RL $83 $C4 $04 $5D $CB
#Sour Grape spawn code
%patch $8524 $55 $8B $EC $33 $C0 $50 $9A $044D01C9RL $44 $44 $8B $1E $3E
$70 $C7 $07 [$000AW] $8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B
$46 $08 $D3 $E0 $89 $47 $0C $C7 $47 $0E [$0001W] $C7 $47 $10 [$0001W]
$B8 [$1C90W] $50 $FF $36 $3E $70 $9A $044D1212RL $83 $C4
$04 $5D $CB
#Tater Trooper spawn code
%patch $8686 $55 $8B $EC $33 $C0 $50 $9A $044D01C9RL $44 $44 $8B $1E $3E
$70 $C7 $07 [$000BW] $8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B
$46 $08 $D3 $E0 $05 [$FF0FW] $89 $47 $0C $C7 $47 $0E [$0001W] $C7
$47 $10 [$0001W] $B8 [$1D08W] $50 $FF $36 $3E $70 $9A $044D1212RL
$83 $C4 $04 $8B $1E $3E $70 $C7 $47 $36 [$0001W] $5D $CB
#Minecart spawn code
%patch $8780 $55 $8B $EC $33 $C0 $50 $9A $044D01C9RL $44 $44 $8B $1E $3E
$70 $C7 $07 [$000CW] $8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B
$46 $08 $D3 $E0 $05 [$FFD0W] $89 $47 $0C $C7 $47 $0E [$0001W] $C7
$47 $10 [$0001W] $C7 $47 $02 [$0002W] $B8 [$1DDAW] $50 $FF $36 $3E
$70 $9A $044D1212RL $83 $C4 $04 $5D $CB
#Frenchy spawn code
%patch $8861 $55 $8B $EC $33 $C0 $50 $9A $044D01C9RL $44 $44 $8B $1E $3E
$70 $C7 $07 [$000DW] $8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B
$46 $08 $D3 $E0 $05 [$FF00W] $89 $47 $0C $C7 $47 $0E [$0001W] $C7
$47 $10 [$0001W] $B8 [$1E16W] $50 $FF $36 $3E $70 $9A $044D1212RL
$83 $C4 $04 $5D $CB
#Melon spawn code
%patch $89DE $55 $8B $EC $56 $8B $76 $0A $33 $C0 $50 $9A $044D01C9RL $44
$44 $8B $1E $3E $70 $C7 $07 [$000EW] $8B $46 $06 $B1 $08 $D3 $E0
$89 $47 $0A $8B $46 $08 $D3 $E0 $89 $47 $0C $0B $F6 $74 $07 $C7
$47 $0E [$0001W] $EB $09 $8B $1E $3E $70 $C7 $47 $0E [$FFFFW] $83
$FE [$02] {$7D} $05 $B8 [$1F9CW] $EB $03 $B8 [$1FF6W] $50 $FF $36 $3E
$70 $9A $044D1212RL $83 $C4 $04 $9A $16C40026RL $D1 $F8
$8B $1E $3E $70 $89 $47 $1A $89 $77 $3E $5E $5D $CB
#Squasher spawn code
%patch $8E3F $55 $8B $EC $33 $C0 $50 $9A $044D01C9RL $44 $44 $8B $1E $3E
$70 $C7 $07 [$0013W] $8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B
$46 $08 $D3 $E0 $05 [$FF00W] $89 $47 $0C $C7 $47 $0E [$0001W] $C7
$47 $10 [$0001W] $B8 [$20C8W] $50 $FF $36 $3E $70 $9A $044D1212RL
$83 $C4 $04 $5D $CB
#Apel spawning code
%patch $8F48 $55 $8B $EC $33 $C0 $50 $9A $044D01C9RL $44 $44 $8B $1E $3E
$70 $C7 $07 [$0014W] $8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B
$46 $08 $D3 $E0 $05 [$FF00W] $89 $47 $0C $C7 $47 $0E [$0001W] $C7
$47 $10 [$0001W] $B8 [$215EW] $50 $FF $36 $3E $70 $9A $044D1212RL
$83 $C4 $04 $5D $CB
#Pea Brain spawn code
%patch $9169 $55 $8B $EC $33 $C0 $50 $9A $044D01C9RL $44 $44 $8B $1E $3E
$70 $C7 $07 [$0016W] $8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B
$46 $08 $D3 $E0 $89 $47 $0C $B8 [$22A8W] $50 $FF $36 $3E $70 $9A
$044D1212RL $83 $C4 $04 $5D $CB
#Pea Pod spawn code
%patch $91E7 $55 $8B $EC $33 $C0 $50 $9A $044D01C9RL $44 $44 $8B $1E $3E
$70 $C7 $07 [$0015W] $8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B
$46 $08 $D3 $E0 $05 [$FF00W] $89 $47 $0C $C7 $47 $0E [$0001W] $C7
$47 $10 [$0001W] $B8 [$2320W] $50 $FF $36 $3E $70 $9A $044D1212RL
$83 $C4 $04 $5D $CB
#Boobus Tuber spawn code
%patch $930A $55 $8B $EC $33 $C0 $50 $9A $044D01C9RL $44 $44 $8B $1E $3E
$70 $C7 $07 [$0017W] $8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B
$46 $08 $D3 $E0 $05 [$FA80W] $89 $47 $0C $C7 $47 $0E [$FFFFW] $B8
[$23D4W] $50 $FF $36 $3E $70 $9A $044D1212RL $83 $C4 $04 $8B
$1E $3E $70 $C7 $47 $44 [$000CW] $5D $CB
Keen 4
Initiations
The initiation pointer list pointers are short and require another value to be added to them to give the location to which they refer. (Thus in Keen 4 a value of $0064 actually points to code at $E8F0 + $0064 = $E954.)
Keen 4 pointer list
#Location of list ($E8F0 + $0595 = $EE85)
%patch $E952 $0595W
#Length of list (88 items)
%patch $E947 $57
#Sprite code pointer list (Origin is E8F0)
%patch $EE85 [$0064W] #Right Facing Keen (At $E954)
%patch $EE87 [$0090W] #Left Facing Keen (At $E980)
%patch $EE89 [$00BCW] #Map Keen (At $E9AC)
%patch $EE8B [$00E4W] #Council Member (At $E9D4)
%patch $EE8D [$010DW] #Easy Berkeloid (At $E9FD)
%patch $EE8F [$0122W] #Lindsey (At $EA12)
%patch $EE91 [$014BW] #Easy Wormouth (At $EA3B)
%patch $EE93 [$0174W] #Easy Skypest (At $EA64)
%patch $EE95 [$0189W] #Cloud (At $EA79)
%patch $EE97 [$019EW] #Foot (At $EA8E)
%patch $EE99 [$01CDW] #Inchworm (At $EABD)
%patch $EE9B [$01FCW] #Bounder (At $EAEC)
%patch $EE9D [$0211W] #Egg (At $EB01)
%patch $EE9F [$0240W] #Easy Lick (At $EB30)
%patch $EEA1 [$0269W] #Easy Dopefish (At $EB59)
%patch $EEA3 [$027EW] #Schoolfish (At $EB6E)
%patch $EEA5 [$02A7W] #Easy Sprite (At $EB97)
%patch $EEA7 [$02BCW] #Smirky (At $EBAC)
%patch $EEA9 [$02D1W] #Mimrock (At $EBC1)
%patch $EEAB [$02FAW] #Easy Arachnut (At $EBEA)
%patch $EEAD [$030FW] #Mushroom (At $EBFF)
%patch $EEAF [$0338W] #Easy Slug (At $EC28)
%patch $EEB1 [$029DW] #Medium Sprite (At $EB8D)
%patch $EEB3 [$0293W] #Hard Sprite (At $EB83)
%patch $EEB5 [$034DW] #Horizontal Scrollbar (At $EC3D)
%patch $EEB7 [$0360W] #Vertical Scrollbar (At $EC50)
%patch $EEB9 [$0372W] #Up Platform (At $EC62)
%patch $EEBB [$0372W] #Right Platform (At $EC62)
%patch $EEBD [$0372W] #Down Platform (At $EC62)
%patch $EEBF [$0372W] #Left Platform (At $EC62)
%patch $EEC1 [$050DW] #B Block (At $EDFD)
%patch $EEC3 [$038EW] #Dropping Platform (At $EC7E)
%patch $EEC5 [$03A3W] #Miragia (At $EC93)
%patch $EEC7 [$03B2W] #IF Ammo (At $ECA2)
%patch $EEC9 [$03DEW] #Wetsuit (At $ECCE)
%patch $EECB [$050DW] #'I Keen' (At $EDFD)
%patch $EECD [$050DW] #'Mom' (At $EDFD)
%patch $EECF [$050DW] #'Dad' (At $EDFD)
%patch $EED1 [$050DW] #BLANK (At $EDFD)
%patch $EED3 [$050DW] #BLANK (At $EDFD)
%patch $EED5 [$050DW] #BLANK (At $EDFD)
%patch $EED7 [$03FBW] #Swimming Keen (At $ECEB)
%patch $EED9 [$032EW] #Medium Slug (At $EC1E)
%patch $EEDB [$0324W] #Hard Slug (At $EC14)
%patch $EEDD [$016AW] #Medium Skypest (At $EA5A)
%patch $EEDF [$0160W] #Hard Skypest (At $EA50)
%patch $EEE1 [$0236W] #Medium Lick (At $EB26)
%patch $EEE3 [$022CW] #Hard Lick (At $EB1C)
%patch $EEE5 [$0103W] #Medium Berkeloid (At $E9F3)
%patch $EEE7 [$00F9W] #Hard Berkeloid (At $E9E9)
%patch $EEE9 [$0141W] #Medium Wormouth (At $EA31)
%patch $EEEB [$0137W] #Hard Wormouth (At $EA27)
%patch $EEED [$0489W] #Easy Up Dart (At $ED79)
%patch $EEEF [$0489W] #Easy Right Dart (At $ED79)
%patch $EEF1 [$0489W] #Easy Down Dart (At $ED79)
%patch $EEF3 [$0489W] #Easy Left Dart (At $ED79)
%patch $EEF5 [$04A4W] #Red Gem (At $ED94)
%patch $EEF7 [$04A4W] #Yellow Gem (At $ED94)
%patch $EEF9 [$04A4W] #Blue Gem (At $ED94)
%patch $EEFB [$04A4W] #Green Gem (At $ED94)
%patch $EEFD [$04A4W] #100 Pts (At $ED94)
%patch $EEFF [$04A4W] #200 pts (At $ED94)
%patch $EF01 [$04A4W] #500 Pts (At $ED94)
%patch $EF03 [$04A4W] #1000 Pts (At $ED94)
%patch $EF05 [$04A4W] #2000 Pts (At $ED94)
%patch $EF07 [$04A4W] #5000 Pts (At $ED94)
%patch $EF09 [$04A4W] #1UP (At $ED94)
%patch $EF0B [$04A4W] #Raygun (At $ED94)
%patch $EF0D [$04CAW] #Up Mine (At $EDBA)
%patch $EF0F [$04CAW] #Right Mine (At $EDBA)
%patch $EF11 [$04CAW] #Down Mine (At $EDBA)
%patch $EF13 [$04CAW] #Left Mine (At $EDBA)
%patch $EF15 [$02F0W] #Medium Arachnut (At $EBE0)
%patch $EF17 [$02E6W] #Hard Arachnut (At $EBD6)
%patch $EF19 [$04E5W] #Mooning Keen (At $EDD5)
%patch $EF1B [$04FBW] #Easy Bird(At $EDEB)
%patch $EF1D [$04F4W] #Medium Bird (At $EDE4)
%patch $EF1F [$04EDW] #Hard Bird (At $EDDD)
%patch $EF21 [$0463W] #Medium Up Dart (At $ED53)
%patch $EF23 [$0463W] #Medium Right Dart (At $ED53)
%patch $EF25 [$0463W] #Medium Down Dart (At $ED53)
%patch $EF27 [$0463W] #Medium Left Dart (At $ED53)
%patch $EF29 [$043DW] #Hard Up Dart (At $ED2D)
%patch $EF2B [$043DW] #Hard Right Dart (At $ED2D)
%patch $EF2D [$043DW] #Hard Down Dart (At $ED2D)
%patch $EF2F [$043DW] #Hard Left dart (At $ED2D)
%patch $EF31 [$025FW] #Medium Dopefish (At $EB4F)
%patch $EF33 [$0255W] #Hard Dopefish (At $EB45)
There are several things to note about the initiation codes. They are far more thorough than in Keen Vorticons. The first things to note are the difficulty checks. Those sprites that have easy, normal and hard spawns have three different values. The easy pointer value is largest, with normal and hard being ten less each, since the way the code is set up has the difficulty checks first. The difficulty check is usually a ten byte string $83 $3E $7A6CW $02\$03 $7D $03 $E9 $xxxxW This means roughly 'If the difficulty is equal or harder than this, jump over the 'do nothing' jump.' Normal difficulty is $02, Hard is $03. The check can be understood by looking at Patch:Jump conditions and Patch:Game stats.
The second things are sprite caches. When a sprite is spawned it often (But not always!) sets a value in memory to 1. This section of memory is then scanned and sprites cached off the sprite cache list. This is a five byte string $C7 $06 $CBxxW $0001W, where xx is different for each sprite cache. As an example the Council Member's cache is $5D, the Bird's is $5F (They are next to each other in the cache list, and thus differ by 2 in memory.) A fuller explanation of this is given at Patch:Sprite cache.
Notice the Egg sets two cache values, one for itself and one for the Bird. Several sprites set no cache, including the Wetsuit, which uses a hardcoded value for the (Single frame) it caches. Other sprites cache individual animations as well as their cache, or even several animations in addition to their cache.
The last call ($9A $xxxxxxxxRL) is the call to the actual spawning code. So for example Normal Keen calls $0B80000ERL and $0D8F0003RL, with that second one being the code that spawns him. (The other one sets him as the player.) Again, some sprites are not spawned at all, but just sit there.
All jumps ($E9 $xxxxW or $EB $xx.) go to the 'B Block' code. (The B Block code is used for sprites that do nothing, however only the B Block sprite will stop platforms.) These will need to be adjusted if the code is copied somewhere else, for example to make a new sprite.
Keen 4 initiation codes
#Right facing Keen
%patch $E954 $B8 [$0001W] $50 $FF $76 $FC $57 $9A {$0B80000ERL} #Keen's direction is +1
$83 $C4 $06 $9A {$0D8F0003RL} $C7 $06 $CB3DW $0001W $B8 $2A3ARW
$8A $16 $EC $7A $8E $C0 $26 $08 $16 [$00FDW] $E9 $047DW #Cache scoreboard too
#Left facing Keen
%patch $E980 $B8 [$FFFFW] $50 $FF $76 $FC $57 $9A {$0B80000ERL} #Keen's direction is -1
$83 $C4 $06 $9A {$0D8F0003RL} $C7 $06 $CB3DW $0001W $B8 $2A3ARW
$8A $16 $EC $7A $8E $C0 $26 $08 $16 [$00FDW] $E9 $0451W #Cache scoreboard too
#Map Keen
%patch $E9AC $FF $76 $FC $57 $9A {$0D8F050ARL} $83 $C4 $04 $9A {$0D8F0003RL}
$C7 $06 $CB4FW $0001W $B8 $2A3ARW $8A $16 $EC $7A $8E $C0
$26 $08 $16 [$00FDW] $E9 $0429W #Cache scoreboard too
#Council Member
%patch $E9D4 $FF $76 $FC $57 $9A {$0FA80269RL} $83 $C4 $04 $C7 $06 $CB5DW
$0001W $E9 $0414W
#Berkeloid
%patch $E9E9 $83 $3E [$7A6CW] {$03 $7D} $03 $E9 $040AW $83 $3E [$7A6CW] {$02 $7D}
$03 $E9 $0400W $FF $76 $FC $57 $9A {$1080039BRL} $83 $C4 $04
$C7 $06 $CB75W $0001W $E9 $03EBW
#Lindsey
%patch $EA12 $FF $76 $FC $57 $9A {$11A20DB5RL} $83 $C4 $04 $C7 $06 $CB57W
$0001W $E9 $03D6W
#Wormouth
%patch $EA27 $83 $3E [$7A6CW] {$03 $7D} $03 $E9 $03CCW $83 $3E [$7A6CW] {$02}
{$7D} $03 $E9 $03C2W $FF $76 $FC $57 $9A {$10800006RL} $83 $C4
$04 $C7 $06 $CB6BW $0001W $E9 $03ADW
#Skypest
%patch $EA50 $83 $3E [$7A6CW] {$03 $7D} $03 $E9 $03A3W $83 $3E [$7A6CW] {$02 $7D}
$03 $E9 $0399W $FF $76 $FC $57 $9A {$0FA80B67RL} $83 $C4 $04
$C7 $06 $CB69W $0001W $E9 $0384W
#Cloud
%patch $EA79 $FF $76 $FC $57 $9A {$108001C2RL} $83 $C4 $04 $C7 $06 $CB73W
$0001W $E9 $036FW
#Foot
%patch $EA8E $FF $76 $FC $57 $9A {$1080072CRL} $83 $C4 $04 $C7 $06 $CB59W
$0001W $BE [$015EW] $EB $0F $B8 $3A $2A $8A $16 $EC $7A $8E $C0 #Also cache Smirky clouds, start
$26 $08 $94 $00 $00 $46 $81 $FE [$0161W] $76 $EB $E9 $0340W #End
#Inchworm
%patch $EABD $FF $76 $FC $57 $9A {$108006B2RL} $83 $C4 $04 $C7 $06 $CB59W
$0001W $BE [$015EW] $EB $0F $B8 $3A $2A $8A $16 $EC $7A $8E $C0 #Also cache Smirky clouds, start
$26 $08 $94 $00 $00 $46 $81 $FE [$0161W] $76 $EB $E9 $0311W #End
#Bounder
%patch $EAEC $FF $76 $FC $57 $9A {$108008EARL} $83 $C4 $04 $C7 $06 $CB71W
$0001W $E9 $02FCW
#Egg
%patch $EB01 $FF $76 $FC $57 $9A {$0FA8055DRL} $83 $C4 $04 $C7 $06 $CB5FW
$0001W $C7 $06 $CB83W $0001W $E9 $02E1W
#Lick
%patch $EB1C $83 $3E [$7A6CW] {$03 $7D} $03 $E9 $02D7W $83 $3E [$7A6CW] {$02 $7D}
$03 $E9 $02CDW $FF $76 $FC $57 $9A {$10800AC8RL} $83 $C4 $04
$C7 $06 $CB6DW $0001W $E9 $02B8W
#Dopefish
%patch $EB45 $83 $3E [$7A6CW] {$03 $7D} $03 $E9 $02AEW $83
$3E [$7A6CW] {$02 $7D} $03 $E9 $02A4W $FF $76 $FC $57 $9A {$11A20690RL}
$83 $C4 $04 $C7 $06 $CB63W $0001W $E9 $028FW
#Schoolfish
%patch $EB6E $FF $76 $FC $57 $9A {$11A20AA7RL} $83 $C4 $04 $C7 $06 $CB65W
$0001W $E9 $027AW
#Sprite
%patch $EB83 $83 $3E [$7A6CW] {$03 $7D} $03 $E9 $0270W $83 $3E [$7A6CW] {$02 $7D}
$03 $E9 $0266W $FF $76 $FC $57 $9A {$11A20B5FRL} $83 $C4 $04
$C7 $06 $CB7DW $0001W $E9 $0251W
#Smirky
%patch $EBAC $FF $76 $FC $57 $9A {$11A2000ERL} $83 $C4 $04 $C7 $06 $CB5BW
$0001W $E9 $023CW
#Mimrock
%patch $EBC1 $FF $76 $FC $57 $9A {$11A20447RL} $83 $C4 $04 $C7 $06 $CB61W
$0001W $E9 $0227W
#Arachnut
%patch $EBD6 $83 $3E [$7A6CW] {$03 $7D} $03 $E9 $021DW $83 $3E [$7A6CW] {$02 $7D}
$03 $E9 $0213W $FF $76 $FC $57 $9A {$0FA80A8ERL} $83 $C4 $04
$C7 $06 $CB67W $0001W $E9 $01FEW
#Mad Mushroom
%patch $EBFF $FF $76 $FC $57 $9A {$0FA80445RL} $83 $C4 $04 $C7 $06 $CB53W
$0001W $E9 $01E9W
#Poison Slugs
%patch $EC14 $83 $3E [$7A6CW] {$03 $7D} $03 $E9 $01DFW $83 $3E [$7A6CW] {$02 $7D}
$03 $E9 $01D5W $FF $76 $FC $57 $9A {$0FA802FERL} $83 $C4 $04
$C7 $06 $CB51W $0001W $E9 $01C0W
#Horizontal\Vertical scroll bars
%patch $EC3D $B8 $0001W $50 $FF $76 $FC $57 $9A {$16540B08RL} $83 $C4 $06 #Horizontal bars = 1
$E9 $01ADW $33 $C0 $50 $FF $76 $FC $57 $9A {$16540B08RL} $83 #Vertical bars = 0
$C4 $06 $E9 $019BW
#Horizontal-Vertical Platforms
%patch $EC62 $8B $46 $F8 $05 $FFE5W $50 $FF $76 $FC $57 $9A {$10800CABRL}
$83 $C4 $06 $C7 $06 $CB6FW $0001W $E9 $017FW
#Dropping Platform
%patch $EC7E $FF $76 $FC $57 $9A {$108010FCRL} $83 $C4 $04 $C7 $06 $CB6FW
$0001W $E9 $016AW
#Miragia
%patch $EC93 $FF $76 $FC $57 $9A {$0FA80000RL} $83 $C4 $04 $E9 $015BW
#IF Ammo
%patch $ECA2 $83 $3E [$7A58W] [$05] {$7C} $03 $E9 $0151W $B8 [$000BW] $50 $FF $76 #Here check Keen's ammo < 5, ammo is 12th item kind
$FC $57 $9A {$0FA801A3RL} $83 $C4 $06 $8B $1E [$19D2W] $D1 $E3
$C7 $87 $CB3BW $0001W $E9 $0132W $E9 $012FW
#Wetsuit - Note single frame is cached
%patch $ECCE $FF $76 $FC $57 $9A {$11A20FD1RL} $83 $C4 $04 $B8 $2A3ARW $8A
$16 $EC $7A $8E $C0 $26 $08 $16 [$01AEW] $E9 $0112W
#Swimming Keen
%patch $ECEB $FF $76 $FC $57 $9A $0E8F0CFERL $83 $C4 $04 $9A {$0D8F0003RL}
$C7 $06 $CB7BW $0001W $BE [$00DBW] $EB $0F $B8 $2A3ARW $8A #Cache items got - start
$16 $EC $7A $8E $C0 $26 $08 $94 $00 $00 $46 $81 $FE [$00E2W] $76 #Cache items got - end
$EB $B8 $2A3ARW $8A $16 $EC $7A $8E $C0 $26 $08 $16 [$00FDW] $E9 #Cache scoreboard
$00D0W
#Dart shooter - hard
%patch $ED2D $83 $3E [$7A6CW] {$02 $7D} $03 $E9 $00C6W $8B $46 $F8 $05 $FFADW
$50 $FF $76 $FC $57 $9A {$11A20E3BRL} $83 $C4 $06 $C7
$06 $CB79W $0001W $E9 $00AAW
#Dart shooter - medium
%patch $ED53 $83 $3E [$7A6CW] {$02 $7D} $03 $E9 $00A0W $8B $46 $F8 $05 $FFB1W
$50 $FF $76 $FC $57 $9A {$11A20E3BRL} $83 $C4 $06 $C7 $06 $CB79W
$0001W $E9 $0084W
#Dart shooter - easy
%patch $ED79 $8B $46 $F8 $05 $FFCBW $50 $FF $76 $FC $57 $9A {$11A20E3BRL}
$83 $C4 $06 $C7 $06 $CB79W $0001W $EB $69
#Items
%patch $ED94 $8B $46 $F8 $05 [$FFC7W] $50 $FF $76 $FC $57 $9A {$0FA801A3RL}
$83 $C4 $06 $8B $5E $F8 $D1 $E3 $8B $9F [$194AW] $D1 $E3 $C7 $87
$CB3BW $0001W $EB $43
#Mine
%patch $EDBA $8B $46 $F8 $05 [$FFBBW] $50 $FF $76 $FC $57 $9A {$11A20CECRL}
$83 $C4 $06 $C7 $06 $CB7FW $0001W $EB $28
#Mooning Keen
%patch $EDD5 $C7 $06 $CB81W $0001W $EB $20
#Blue bird
%patch $EDDD $83 $3E [$7A6CW] {$03 $7C} $19 $83 $3E [$7A6CW] {$02 $7C} $12 $FF $76
$FC $57 $9A {$0FA805B9RL} $83 $C4 $04 $C7 $06 $CB5FW $0001W
#B Block-type sprites
%patch $EDFD $47 $3B $3E $E4 $A7 $73 $03 $E9 $FB24W $FF $46 $FC $8B $46 $FC
$3B $06 $E2 $A7 $73 $03 $E9 $FB10W $A1 $D6 $A7 $89 $46 $FE $EB
$17
Spawn codes
These are spawn codes found in games. Unlike the initiation codes, they are standalone and can be swapped about and edited as desired. Notice that the very last variable set in Galaxy is the sprite action; in Vorticons it is the location of the sprite code and collision.
Depending on the spawn code, different things may happen. Miragia's spawn code is the shortest, but will not allow a sprite to do anything except replace tiles as Miragia does. There are a number of values set.
The last blue highlighted value is the sprite action the sprite uses as it proceeds to act in-level. $C7 $02 $xxxxW sets the sprite activity, $C7 $47 $06 $xxxxW sets the clipping, $C7 $07 $xxxxW sets the sprite type, $C7 $20 $xxxxW sets the foreground value., Finally $D3 $E0 $05 $xxxx is how far down (Or more usually up) the sprite is spawned from where it is placed. This is necessary for sprites that walk on the ground as they can only be placed in the level at multiples of 16 pixels high while their actual height can be anything.
$C7 $47 $0E $xxxxW is the horizontal direction the sprite starts moving in, either $0001W (Facing right), $FFFFW (Facing left) or $0000W (Neither, never used.) $C7 $47 $10 $xxxxW is the vertical direction and works similarly. Some sprites have a probability check to determine which way they face this is always 50:50 (Though it needn't be.) and the code responsible for this is $9A $1D02002ARL $3D $0080W
Keen 4 spawn codes
#Normal Keen spawning code
%patch $B80E $55 $8B $EC $8B $1E $A7D6W $C7 $07 [$0002W] $C7 $47 $02 [$0002W]
$C7 $47 $20 [$0001W] $8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B
$46 $08 $D3 $E0 $05 [$FF0FW] $89 $47 $0C $8B $46 $0A $89 $47 $0E
$C7 $47 $10 [$0001W] $B8 [$098CW] $50 $53 $9A $09DC118CRL $83
$C4 $04 $5D $CB
#Map Keen spawning code
%patch $DDFA $55 $8B $EC $83 $3E {$7A70W} [$07] {$74} $03 $E9 $00A9W $8B $1E $D6
$A7 $C7 $47 $06 [$0000W] $C7 $07 [$0002W] $A1 {$7A1AW} $89 $47 {$0A}
$A1 {$7A1CW} $89 $47 {$0C} $C7 $47 $02 [$0002W] $C7 $47 $20 [$0003W]
$C7 $47 $0E [$0000W] $C7 $47 $10 [$0000W] $81 $3E {$7A1AW} [$1400W]
{$73} $31 $C7 $47 $3E [$0118W] $B8 [$1E00W] $2B $47 $0A $BB [$0118W]
$33 $D2 $F7 $F3 $40 $8B $1E $A7D6W $89 $47 $16 $B8 [$3700W] $2B
$47 $0C $BB [$0118W] $33 $D2 $F7 $F3 $40 $8B $1E $A7D6W $89 $47
$18 $EB $31 $8B $1E $A7D6W $C7 $47 $3E [$008CW] $B8 [$1000W] $2B
$47 $0A $BB [$008CW] $99 $F7 $FB $40 $8B $1E $A7D6W $89 $47 $16
$B8 [$2F00W] $2B $47 $0C $BB [$008CW] $99 $F7 $FB $40 $8B $1E $D6
$A7 $89 $47 $18 $B8 [$1492W] $50 $FF $36 $D6 $A7 $9A $09DC118CRL
$83 $C4 $04 $5D $CB
$8B $1E $A7D6W $C7 $07 [$0002W] $83 $3E
{$7A1AW} [$00] {$75} $14 $8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B
$46 $08 $D3 $E0 $89 $47 $0C $EB $10 $8B $1E {$A7D6W} $A1 {$7A1AW}
$89 $47 {$0A} $A1 {$7A1CW} $89 $47 {$0C} $8B $1E $A7D6W $C7 $47 $02
[$0002W] $C7 $47 $20 [$0001W] $C7 $47 $0E [$0000W] $C7 $47 $10 [$0000W]
$C7 $47 $3E [$0006W] $C7 $47 $40 [$0003W] $C7 $47 $42 [$0000W]
$C7 $47 $1E [$0100W] $B8 [$14ECW] $50 $53 $9A $09DC118CRL $83
$C4 $04 $5D $CB
#Sitting flag spawn code
%patch $E2ED $55 $8B $EC $33 $C0 $50 $9A $06BD1E11RL $83 $C4 $02 $8B $1E
$D8 $A7 $C7 $47 $06 [$0000W] $C7 $47 $20 [$0003W] $C7 $07 [$0022W]
$C7 $47 $02 [$0001W] $8B $46 $06 $B1 $08 $D3 $E0 $05 [$0060W] $89
$47 $0A $8B $46 $08 $D3 $E0 $05 [$FE20W] $89 $47 $0C $9A $1D02002ARL
$BB [$0010W] $99 $F7 $FB $8B $1E $D8 $A7 $89 $47 $1A $B8
[$15EEW] $50 $53 $9A $09DC118CRL $83 $C4 $04 $5D $CB
#Swimming Keen spawning code
%patch $F5EE $55 $8B $EC $8B $1E $A7D6W $C7 $07 [$0002W] $C7 $47 $02 [$0002W]
$C7 $47 $20 [$0001W] $8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B
$46 $08 $D3 $E0 $89 $47 $0C $C7 $47 $0E [$0001W] $C7 $47 $10 [$0001W]
$C7 $47 $06 [$0002W] $B8 [$19ECW] $50 $53 $9A $10B1118CRL
$83 $C4 $04 $5D $CB
#Miragia spawning code
%patch $FA80 $55 $8B $EC $33 $C0 $50 $9A $06BD1E11RL $83 $C4 $02 $8B $1E
$D8 $A7 $C7 $07 [$0001W] $C7 $47 $02 [$0002W] $8B $46 $06 $89 $47
$0A $8B $46 $08 $89 $47 $0C $C7 $47 $1C [$1DFCW] $5D $CB
#Items spawn code
%patch $FC23 $55 $8B $EC $56 $8B $76 $0A $33 $C0 $50 $9A $06BD1E11RL $83
$C4 $02 $8B $1E $D8 $A7 $C7 $47 $06 [$0000W] $C7 $47 $20 [$0002W]
$C7 $07 [$0004W] $8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B $46
$08 $D3 $E0 $89 $47 $0C $C7 $47 $10 [$FFFFW] $89 $77 $3E $8B $DE
$D1 $E3 $8B $87 [$1FA0W] $8B $1E $D8 $A7 $89 $47 $1E $89 $47 $40
$8B $47 $40 $05 [$0002W] $89 $47 $42 $B8 [$1EECW] $50 $53 $9A
$09DC118CRL $83 $C4 $04 $5E $5D $CB
#Council Member spawn
%patch $FCE9 $55 $8B $EC $33 $C0 $50 $9A $06BD1E11RL $83 $C4 $02 $8B $1E
$D8 $A7 $C7 $07 [$0006W] $C7 $47 $02 [$0001W] $C7 $47 $20 [$0000W]
$8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B $46 $08 $D3 $E0 $05
[$FE8FW] $89 $47 $0C $9A $1D02002ARL $3D {$0080W} $7D $0B $8B
$1E $D8 $A7 $C7 $47 $0E [$0001W] $EB $09 $8B $1E $D8 $A7 $C7 $47
$0E [$FFFFW] $8B $1E $D8 $A7 $C7 $47 $10 [$0001W] $B8 [$1FB8W] $50
$53 $9A $09DC118CRL $83 $C4 $04 $5D $CB
#Slug spawning code
%patch $FD7E $55 $8B $EC $33 $C0 $50 $9A $06BD1E11RL $83 $C4 $02 $8B $1E
$D8 $A7 $C7 $07 [$0005W] $C7 $47 $02 [$0001W] $C7 $47 $20 [$0002W]
$8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B $46 $08 $D3 $E0 $05
[$FF8FW] $89 $47 $0C $9A $1D02002ARL $3D {$0080W} $7D $0B $8B
$1E $D8 $A7 $C7 $47 $0E [$0001W] $EB $09 $8B $1E $D8 $A7 $C7 $47
$0E [$FFFFW] $8B $1E $D8 $A7 $C7 $47 $10 [$0001W] $B8 [$2012W] $50
$53 $9A $09DC118CRL $83 $C4 $04 $5D $CB
#Mad Mushroom spawning code
%patch $FEC5 $55 $8B $EC $33 $C0 $50 $9A $06BD1E11RL $83 $C4 $02 $8B $1E
$D8 $A7 $C7 $07 [$0009W] $C7 $47 $02 [$0001W] $C7 $47 $20 [$0000W]
$8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B $46 $08 $D3 $E0 $05
[$FF0FW] $89 $47 $0C $C7 $47 $0E [$0001W] $C7 $47 $10 [$0001W] $B8
[$20E4W] $50 $53 $9A $09DC118CRL $83 $C4 $04 $5D $CB
#Egg spawn code
%patch $FFDD $55 $8B $EC $33 $C0 $50 $9A $06BD1E11RL $83 $C4 $02 $8B $1E
$D8 $A7 $C7 $07 [$0008W] $C7 $47 $02 [$0001W] $C7 $47 $20 [$0002W]
$8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B $46 $08 $D3 $E0 $05
[$FF8FW] $89 $47 $0C $C7 $47 $0E [$0001W] $C7 $47 $10 [$0001W] $B8
[$2120W] $50 $53 $9A $09DC118CRL $83 $C4 $04 $5D $CB
#Blue Bird spawning code
%patch $10039 $55 $8B $EC $B8 $01 $00 $50 $9A $06BD1E11RL $83 $C4 $02 $8B
$1E $D8 $A7 $C7 $07 [$001BW] $C7 $47 $02 [$0001W] $C7 $47 $20 [$0002W]
$8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B $46 $08 $D3 $E0
$05 [$FF0FW] $89 $47 $0C $8B $47 $0A $8B $1E $A7D6W $3B $47 $0A
$73 $0B $8B $1E $D8 $A7 $C7 $47 $0E [$0001W ] $EB $09 $8B $1E $D8
$A7 $C7 $47 $0E [$FFFFW] $8B $1E $D8 $A7 $C7 $47 $10 [$0001W] $B8
[$21B6W] $50 $53 $9A $09DC118CRL $83 $C4 $04 $5D $CB
#Skypest spawning code
%patch $105E7 $55 $8B $EC $33 $C0 $50 $9A $06BD1E11RL $83 $C4 $02 $8B $1E
$D8 $A7 $C7 $07 [$000BW] $C7 $47 $02 [$0001W] $C7 $47 $20 [$0000W]
$8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B $46 $08 $D3 $E0 $89
$47 $0C $9A $1D02002ARL $3D [$0080W] {$7D} $0B $8B $1E $D8 $A7
$C7 $47 $0E [$0001W] $EB $09 $8B $1E $D8 $A7 $C7 $47 $0E [$FFFFW]
$9A $1D02002ARL $3D [$0080W] {$7D} $0B $8B $1E $D8 $A7 $C7 $47
$10 [$0001W] $EB $09 $8B $1E $D8 $A7 $C7 $47 $10 [$FFFFW] $B8 [$2486W]
$50 $FF $36 $D8 $A7 $9A $09DC118CRL $83 $C4 $04 $5D $CB
#Cloud spawning code
%patch $109C2 $55 $8B $EC $33 $C0 $50 $9A $06BD1E11RL $83 $C4 $02 $8B $1E
$D8 $A7 $C7 $07 [$000DW] $C7 $47 $02 [$0002W] $C7 $47 $20 [$0002W]
$8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B $46 $08 $D3 $E0 $89
$47 $0C $B8 [$0001W] $89 $47 $0E $89 $47 $10 $B8 [$28A0W] $50 $53
$9A $09DC118CRL $83 $C4 $04 $5D $CB
#Berkeloid spawning code
%patch $10B9B $55 $8B $EC $33 $C0 $50 $9A $06BD1E11RL $83 $C4 $02 $8B $1E
$D8 $A7 $C7 $07 [$000EW] $C7 $47 $02 [$0001W] $C7 $47 $20 [$0002W]
$8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B $46 $08 $D3 $E0 $05
[$FE00W] $89 $47 $0C $9A $1D02002ARL $3D [$0080W] $7D $0B $8B
$1E $D8 $A7 $C7 $47 $0E [$0001W] $EB $09 $8B $1E $D8 $A7 $C7 $47
$0E [$FFFFW] $8B $1E $D8 $A7 $C7 $47 $10 [$0001W] $C7 $47 $40 [$0008W]
$B8 [$2AF8W] $50 $53 $9A $09DC118CRL $83 $C4 $04 $5D $CB
#Inchworm spawning code
%patch $10EB2 $55 $8B $EC $33 $C0 $50 $9A $06BD1E11RL $83 $C4 $02 $8B $1E
$D8 $A7 $C7 $07 [$0010W] $C7 $47 $02 [$0001W] $C7 $47 $20 [$0002W]
$8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B $46 $08 $D3 $E0 $89
$47 $0C $9A $1D02002ARL $3D [$0080W] {$7D} $0B $8B $1E $D8 $A7
$C7 $47 $0E [$0001W] $EB $09 $8B $1E $D8 $A7 $C7 $47 $0E [$FFFFW]
$8B $1E $D8 $A7 $C7 $47 $10 [$0001W] $B8 [$2E9AW] $50 $9A $09DC118CRL
$83 $C4 $04 $9A $1D02002ARL $BB [$0020W] $99 $F7
$FB $8B $1E $D8 $A7 $89 $47 $1A $5D $CB
#Foot spawning code
%patch $10F2C $55 $8B $EC $33 $C0 $50 $9A $06BD1E11RL $83 $C4 $02 $8B $1E
$D8 $A7 $C7 $07 [$0011W] $C7 $47 $02 [$0001W] $C7 $47 $20 [$0000W]
$8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B $46 $08 $05 [$FFFDW]
$D3 $E0 $89 $47 $0C $B8 [$2EF4W] $50 $53 $9A $09DC118CRL $83
$C4 $04 $5D $CB
#Bounder Spawning code
%patch $110EA $55 $8B $EC $33 $C0 $50 $9A $06BD1E11RL $83 $C4 $02 $8B $1E
$D8 $A7 $C7 $07 [$000FW] $C7 $47 $02 [$0001W] $C7 $47 $20 [$0000W]
$8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B $46 $08 $D3 $E0 $05
[$FF80W] $89 $47 $0C $C7 $47 $10 [$0001W] $C7 $47 $0E [$0000W] $B8
[$2F12W] $50 $53 $9A $09DC118CRL $83 $C4 $04 $5D $CB
#Lick spawn code
%patch $112C8 $55 $8B $EC $33 $C0 $50 $9A $06BD1E11RL $83 $C4 $02 $8B $1E
$D8 $A7 $C7 $07 [$0012W] $C7 $47 $02 [$0001W] $C7 $47 $20 [$0002W]
$8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B $46 $08 $D3 $E0 $89
$47 $0C $9A $1D02002ARL $3D [$0080W] {$7D} $0B $8B $1E $D8 $A7
$C7 $47 $0E [$0001W] $EB $09 $8B $1E $D8 $A7 $C7 $47 $0E [$FFFFW]
$8B $1E $D8 $A7 $C7 $47 $10 [$0001W] $9A $1D02002ARL $BB $0040W
$99 $F7 $FB $8B $1E $D8 $A7 $89 $47 $08 $B8 [$3002W] $50 $53
$9A $09DC118CRL $83 $C4 $04 $5D $CB
#Horizontal-Vertical Platforms Spawning code
%patch $114AB $55 $8B $EC $33 $C0 $50 $9A $06BD1E11RL $83 $C4 $02 $8B $1E
$D8 $A7 $C7 $07 [$0014W] $C7 $47 $02 [$0002W] $C7 $47 $20 [$0000W]
$8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B $46 $08 $D3 $E0 $89
$47 $0C $8B $5E $0A $83 $FB [$03] $77 $45 $D1 $E3 $2E $FF $A7 [$0D3CW] #4 kinds of platform, direction list at $1153C
$8B $1E $D8 $A7 $C7 $47 $0E [$0000W] $C7 $47 $10 [$FFFFW] $EB #Up platform
$2E $8B $1E $D8 $A7 $C7 $47 $0E [$0001W] $C7 $47 $10 [$0000W] $EB #Right platform
$1E $8B $1E $D8 $A7 $C7 $47 $0E [$0000W] $C7 $47 $10 [$0001W] $EB #Down platform
$0E $8B $1E $D8 $A7 $C7 $47 $0E [$FFFFW] $C7 $47 $10 [$0000W] $B8 #Left platform
[$316AW] $50 $FF $36 $D8 $A7 $9A $09DC118CRL $83 $C4 $04 $5D
$CB
#Dropping Platform Spawning code
%patch $118FC $55 $8B $EC $33 $C0 $50 $9A $06BD1E11RL $83 $C4 $02 $8B $1E
$D8 $A7 $C7 $07 [$0014W] $C7 $47 $02 [$0002W] $C7 $47 $20 [$0000W]
$8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B $46 $08 $D3 $E0 $89
$47 $3E $89 $47 $0C $C7 $47 $0E [$0000W] $C7 $47 $10 [$0001W] $C7
$47 $06 [$0000W] $B8 [$3188W] $50 $53 $9A $09DC118CRL $83 $C4
$04 $5D $CB
#Smirky Spawning code
%patch $11A2E $55 $8B $EC $33 $C0 $50 $9A $06BD1E11RL $83 $C4 $02 $8B $1E
$D8 $A7 $C7 $07 [$001AW] $C7 $47 $02 [$0001W] $C7 $47 $20 [$0003W]
$8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B $46 $08 $D3 $E0 $05
[$FE80W] $89 $47 $0C $9A $1D02002ARL $3D {$0080W} $7D $0B $8B
$1E $D8 $A7 $C7 $47 $0E [$0001W] $EB $09 $8B $1E $D8 $A7 $C7 $47
$0E [$FFFFW] $8B $1E $D8 $A7 $C7 $47 $10 [$0001W] $B8 [$31E2W] $50
$53 $9A $09DC118CRL $83 $C4 $04 $5D $CB
#Mimrock Spawning code
%patch $11E67 $55 $8B $EC $33 $C0 $50 $9A $06BD1E11RL $83 $C4 $02 $8B $1E
$D8 $A7 $C7 $07 [$0013W] $C7 $47 $02 [$0001W] $C7 $47 $20 [$0003W]
$8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B $46 $08 $D3 $E0 $05
[$FF30W] $89 $47 $0C $B8 [$0001W] $89 $47 $0E $89 $47 $10 $B8 [$343AW]
$50 $53 $9A $09DC118CRL $83 $C4 $04 $5D $CB
#Dopefish spawn code
%patch $120B0 $55 $8B $EC $33 $C0 $50 $9A $06BD1E11RL $83 $C4 $02 $8B $1E
$D8 $A7 $C7 $07 [$0015W] $C7 $47 $02 [$0001W] $C7 $47 $20 [$0002W]
$C7 $47 $06 [$0002W] $8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B
$46 $08 $D3 $E0 $05 [$FD00W] $89 $47 $0C $9A $1D02002ARL $3D
[$0080W] $7D $0B $8B $1E $D8 $A7 $C7 $47 $0E [$0001W] $EB $09 $8B
$1E $D8 $A7 $C7 $47 $0E [$FFFFW] $8B $1E $D8 $A7 $C7 $47 $10 [$0001W]
$B8 [$35C0W] $50 $53 $9A $09DC118CRL $83 $C4 $04 $5D $CB
#Schoolfish spawn code
%patch $124C7 $55 $8B $EC $33 $C0 $50 $9A $06BD1E11RL $83 $C4 $02 $8B $1E
$D8 $A7 $C7 $07 [$0016W] $C7 $47 $02 [$0001W] $C7 $47 $06 [$0002W]
$C7 $47 $20 [$0000W] $8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B
$46 $08 $D3 $E0 $89 $47 $0C $B8 [$0001W] $89 $47 $0E $89 $47 $10
$B8 [$3764W] $50 $53 $9A $09DC118CRL $83 $C4 $04 $5D $CB
#Sprite spawn code
%patch $1257F $55 $8B $EC $33 $C0 $50 $9A $06BD1E11RL $83 $C4 $02 $8B $1E
$D8 $A7 $C7 $07 [$0017W] $C7 $47 $02 [$0001W] $C7 $47 $20 [$0000W]
$C7 $47 $06 [$0000W] $8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B
$46 $08 $D3 $E0 $89 $47 $3E $89 $47 $0C $B8 [$0001W] $89 $47 {$0E}
$89 $47 {$10} $B8 [$37A0W] $50 $53 $9A $09DC118CRL $83 $C4 $04
$5D $CB
#Underwater Mine spawning code
%patch $1270C $55 $8B $EC $33 $C0 $50 $9A $06BD1E11RL $83 $C4 $02 $8B $1E
$D8 $A7 $C7 $07 [$0020W] $C7 $47 $02 [$0002W] $C7 $47 $20 [$0000W]
$8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B $46 $08 $D3 $E0 $89
$47 $0C $8B $5E $0A $83 $FB [$03] $77 $45 $D1 $E3 $2E $FF $A7 [$0D7EW]
$8B $1E $D8 $A7 $C7 $47 $0E [$0000W] $C7 $47 $10 [$FFFFW] $EB
$2E $8B $1E $D8 $A7 $C7 $47 $0E [$0001W] $C7 $47 $10 [$0000W] $EB
$1E $8B $1E $D8 $A7 $C7 $47 $0E [$0000W] $C7 $47 $10 [$0001W] $EB
$0E $8B $1E $D8 $A7 $C7 $47 $0E [$FFFFW] $C7 $47 $10 [$0000W] $B8
[$3890W] $50 $FF $36 $D8 $A7 $9A $09DC118CRL $83 $C4 $04 $5D
$CB
#Mine direction list
%patch $1279E [$0D2DW]] #Up
[$0D3DW] #Right
[$0D4DW] #Down
[$0D5DW] #Left
#Lindsey spawn code
%patch $127D5 $55 $8B $EC $33 $C0 $50 $9A $06BD1E11RL $83 $C4 $02 $8B $1E
$D8 $A7 $C7 $07 [$0018W] $C7 $47 $02 [$0001W] $C7 $47 $20 [$0000W]
$8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B $46 $08 $D3 $E0 $05
[$FF00W] $89 $47 $3E $89 $47 $0C $C7 $47 $10 [$0001W] $B8 [$38EAW]
$50 $53 $9A $09DC118CRL $83 $C4 $04 $5D $CB
#Dart shooter spawning code
%patch $1285B $55 $8B $EC $56 $8B $76 $0A $33 $C0 $50 $9A $06BD1E11RL $83
$C4 $02 $8B $1E $D8 $A7 $C7 $07 [$0001W] $C7 $47 $02 [$0001W] $8B
$46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $C7 $47 $06 [$0000W] $8B $46
$08 $D3 $E0 $89 $47 $0C $89 $77 $3E $8B $DE $83 $FB [$03] $77 $50
$D1 $E3 $2E $FF $A7 {$0EDEW} $8B $1E $D8 $A7 $83 {$6F $0C} [$30] $81
{$47 $0A} [$0090W] $C7 {$47 $1E} [$017CW] $EB $35 $8B $1E $D8 $A7 $81
{$47 $0A} [$0080W] $83 {$47 $0C} [$50] $C7 {$47 $1E} [$0180W] $EB $21 $8B
$1E $D8 $A7 $81 {$47 $0A} [$0090W] $C7 {$47 $1E} [$017EW] $EB $11 $8B
$1E $D8 $A7 $83 {$47 $0C} [$70] $83 {$6F $0A} [$30] $C7 {$47 $1E} [$0182W]
$B8 [$3962W] $50 $FF $36 $D8 $A7 $9A $09DC118CRL $83 $C4 $04
$5E $5D $CB
#Dart shooter position list
%patch $128FE $0E82W #Up (At $128A2)
%patch $12900 $0E96W #Right (At $128B6)
%patch $12902 $0EAAW #Down (At $128CA)
%patch $12904 $0EBAW #Left (At $128DA)
#Wetsuit spawn code
%patch $129F1 $55 $8B $EC $33 $C0 $50 $9A $06BD1E11RL $83 $C4 $02 $8B $1E
$D8 $A7 $C7 $07 [$001EW] $C7 $47 $02 [$0001W] $8B $46 $06 $B1 $08
$D3 $E0 $89 $47 $0A $8B $46 $08 $D3 $E0 $05 [$FF00W] $89 $47 $0C
$B8 [$3A34W] $50 $53 $9A $09DC118CRL $83 $C4 $04 $5D $CB
#Scrollbar 'spawning' code
%patch $17048 $55 $8B $EC $83 $7E $0A $00 $74 $29 $8B $1E $AC $CC $D1 $E3 $8B
$46 $08 $89 $87 $9E $CC $A1 $AC $CC $FF $06 $AC $CC $3D $06 [$00]
{$75} $35 $B8 [$4244W] $50 $9A $037D022FRL $83 $C4 $02 $5D $CB
$5D $CB
$8B $1E $AA $CC $D1 $E3 $8B $46 $06 $89 $87 $92 $CC $A1
$AA $CC $FF $06 $AA $CC $3D $06 [$00] {$75} $0C $B8 [$4279W] $50 $9A
$037D022FRL $83 $C4 $02 $5D $CB
Allow more sprite kinds
This patch expands the maximum number of different sprite initiations possible in Keen 4; the default patch above allows a maximum of $7F or 127 initiations, whereas this patch allows a maximum of $7FFFW, or thousands, making the number practically unlimited.
This patch will only work as long as right-facing Keen's initiation code (Above)is not tampered with. The patch here uses the default number of sprites, 87.
Allow more than 127 sprite types in Keen 4
#Allow more than 127 sprite types in Keen 4
%patch $E945 $81 $FB [$0057W] $76 $02 $EB $30
Create space for new initiation code
These patches rearrange the existing initiation codes so that they are ore compact. This allows a modder to insert new code in the freed space. All the patches in this section can be combined to free up the maximum amount of space.
Compact Keen initiation method
This patch compacts the Left, right and map Keen initiation codes so they use the minimum amount of space. (This is possible because they all require similar code.) It frees space at $E999 for a 3-difficulty sprite or several non-difficulty sprites. Note that the scorebox's cached graphic is marked as the last blue value. (The first two are in-level Keen's left\right facing directions.) Checking the original initiation code will give a more detailed breakdown of what is presented here.
Create space for new initiation code in Keen 4
#Change pointers
%patch $EE87 $0069W #Left Facing Keen (At $E959)
%patch $EE89 $0081W #Map Keen (At $E971)
#Compact Keen spawns
%patch $E954 $B8 [$0001W] $EB $03 $B8 [$FFFFW] $50 $FF $76 $FC $57 $9A {$0B80000ERL}
$83 $C4 $06 $C7 $06 $CB3DW $0001W $EB $12
%patch $E971 $FF $76 $FC $57 $9A {$0D8F050ARL} $83 $C4 $04 $C7 $06 $CB4FW
$0001W $9A $0D8F0003RL $B8 $2A3ARW $8A $16 $EC $7A $8E $C0
$26 $08 $16 [$00FDW] $E9 $0464W
Inchowrm-Foot method
This patch collapses the Inchworm and Foot initiation codes and stops both caching the Treasure Eater Smoke frames. What this means is that both will take up less memory but the Inchworms cannot transform into the Foot and emit smoke. As a bonus space is created for an additional initiation code for a totally new sprite.
The space freed is 61 bytes ($EAAE-$EAEB). This is enough for a 3 difficulty sprite or several single difficulty sprites.
Create space for new initiation code in Keen 4
#Change Inchworm pointer to new code
%patch $EE99 $01B3W #Inchworm (At $EAA3)
#Foot doesn't cache smoke, Inchworm doesn't either
%patch $EAA0 $E9 $035AW $FF $76 $FC $57 {$9A $108006B2RL} $EB $E9
Keen 5
Keen 5 is similar to Keen 4, and the same points apply.
Initiations
Keen 5 pointer list
#Location of list ($ED50 + $0776 = $F4C6)
%patch $EE94 $0776W
#Length of list (124 items)
%patch $EE89 $7C
#Sprite code pointer list (Origin is $ED50)
%patch $F4C6 [$0146W] #Keen right (At $EE96)
%patch $F4C8 [$0170W] #Keen left (At $EEC0)
%patch $F4CA [$019AW] #Map Keen (At $EEEA)
%patch $F4CC [$01F5W] #Easy Sparky (At $EF45)
%patch $F4CE [$01EBW] #Normal Sparky (At $EF3B)
%patch $F4D0 [$01E1W] #Hard Sparky (At $EF31)
%patch $F4D2 [$021CW] #Easy Mine (At $EF6C)
%patch $F4D4 [$0212W] #Normal Mine (At $EF62)
%patch $F4D6 [$0208W] #Hard Mine (At $EF58)
%patch $F4D8 [$0243W] #Easy up Slicestar (At $EF93)
%patch $F4DA [$0239W] #Normal up Slicestar (At $EF89)
%patch $F4DC [$022FW] #Hard up Slicestar (At $EF7F)
%patch $F4DE [$026DW] #Easy RoboRed (At $EFBD)
%patch $F4E0 [$0263W] #Normal RoboRed (At $EFB3)
%patch $F4E2 [$0259W] #Hard RoboRed (At $EFA9)
%patch $F4E4 [$0294W] #Easy Spirogrip (At $EFE4)
%patch $F4E6 [$028AW] #Normal Spirogrip (At $EFDA)
%patch $F4E8 [$0280W] #Hard Spirogrip (At $EFD0)
%patch $F4EA [$02BBW] #Easy bouncy Slicestar (At $F00B)
%patch $F4EC [$02B1W] #Normal bouncy Slicestar (At $F001)
%patch $F4EE [$02A7W] #Hard bouncy Slicestar (At $EFF7)
%patch $F4F0 [$02E2W] #Easy right Slicestar (At $F032)
%patch $F4F2 [$02D8W] #Normal right Slicestar (At $F028)
%patch $F4F4 [$02CEW] #Hard right Slicestar (At $F01E)
%patch $F4F6 [$02F9W] #Horizontal scrollbar (At $F049)
%patch $F4F8 [$01CAW] #'T' map Keen (At $EF1A)
%patch $F4FA [$030AW] #Up Horizontal-Vertical Red Platform (At $F05A)
%patch $F4FC [$030AW] #Right Horizontal-Vertical Red Platform (At $F05A)
%patch $F4FE [$030AW] #Down Horizontal-Vertical Red Platform (At $F05A)
%patch $F500 [$030AW] #Left Horizontal-Vertical Red Platform (At $F05A)
%patch $F502 [$0657W] #[B] sprite (At $F3A7)
%patch $F504 [$0327W] #Dropping Platform (At $F077)
%patch $F506 [$036AW] #Easy still Platform (At $F0BA)
%patch $F508 [$034DW] #Normal Still Platform (At $F09D)
%patch $F50A [$033AW] #Hard still Platform (At $F08A)
%patch $F50C [$0387W] #Up Red Goplat (At $F0D7)
%patch $F50E [$0387W] #Right Red Goplat (At $F0D7)
%patch $F510 [$0387W] #Down Red Goplat (At $F0D7)
%patch $F512 [$0387W] #Left Red Goplat (At $F0D7)
%patch $F514 [$03A4W] #Sneaky Platform (At $F0F4)
%patch $F516 [$03B7W] #QED\Fuse counter (At $F107)
%patch $F518 [$03F1W] #Easy Little Ampton (At $F141)
%patch $F51A [$03E7W] #Normal Little Ampton (At $F137)
%patch $F51C [$03DDW] #Hard Little Ampton (At $F12D)
%patch $F51E [$0418W] #Easy laser up (At $F168)
%patch $F520 [$0442W] #Easy laser right (At $F192)
%patch $F522 [$046DW] #Easy laser left (At $F1BD)
%patch $F524 [$0498W] #Easy laser down (At $F1E8)
%patch $F526 [$040EW] #Normal laser up (At $F15E)
%patch $F528 [$0438W] #Normal laser right (At $F188)
%patch $F52A [$0463W] #Normal laser down (At $F1B3)
%patch $F52C [$048EW] #Normal laser left (At $F1DE)
%patch $F52E [$0404W] #Hard laser up (At $F154)
%patch $F530 [$042EW] #Hard laser right (At $F17E)
%patch $F532 [$0459W] #Hard laser down (At $F1A9)
%patch $F534 [$0484W] #Hard laser left (At $F1D4)
%patch $F536 [$04BEW] #Red gem (At $F20E)
%patch $F538 [$04BEW] #Yellow gem (At $F20E)
%patch $F53A [$04BEW] #Green gem (At $F20E)
%patch $F53C [$04BEW] #Blue gem (At $F20E)
%patch $F53E [$04BEW] #100 points (At $F20E)
%patch $F540 [$04BEW] #200 points (At $F20E)
%patch $F542 [$04BEW] #500 points (At $F20E)
%patch $F544 [$04BEW] #1000 points (At $F20E)
%patch $F546 [$04BEW] #2000 points (At $F20E)
%patch $F548 [$04BEW] #5000 points (At $F20E)
%patch $F54A [$04BEW] #1UP (At $F20E)
%patch $F54C [$04BEW] #Raygun (At $F20E)
%patch $F54E [$04AFW] #Low ammo raygun (At $F1FF)
%patch $F550 [$04E3W] #V card (At $F233)
%patch $F552 [$051CW] #Easy Volte-face (At $F26C)
%patch $F554 [$0512W] #Normal Volte-face (At $F262)
%patch $F556 [$0508W] #Hard Volte-face (At $F258)
%patch $F558 [$0543W] #Easy Shelley (At $F293)
%patch $F55A [$0539W] #Normal Shelley (At $F289)
%patch $F55C [$052FW] #Hard Shelley (At $F27F)
%patch $F55E [$056AW] #Easy Spindred (At $F2BA)
%patch $F560 [$0560W] #Normal Spindred (At $F2B0)
%patch $F562 [$0556W] #Hard Spindred (At $F2A6)
%patch $F564 [$057DW] #Up Purple Goplat (At $F2CD)
%patch $F566 [$057DW] #Right Purple Goplat (At $F2CD)
%patch $F568 [$057DW] #Down Purple Goplat (At $F2CD)
%patch $F56A [$057DW] #Left Purple Goplat (At $F2CD)
%patch $F56C [$059BW] #Up Horizontal-Vertical Purple Platform (At $F2EB)
%patch $F56E [$059BW] #Right Horizontal-Vertical Purple Platform (At $F2EB)
%patch $F570 [$059BW] #Down Horizontal-Vertical Purple Platform (At $F2EB)
%patch $F572 [$059BW] #Left Horizontal-Vertical Purple Platform (At $F2EB)
%patch $F574 [$05CDW] #Easy Shikadi Master (At $F31D)
%patch $F576 [$05C3W] #Normal Shikadi Master (At $F313)
%patch $F578 [$05B9W] #Hard Shikadi Master (At $F309)
%patch $F57A [$0657W] #Up Platform guide (At $F3A7)
%patch $F57C [$0657W] #Right Platform guide (At $F3A7)
%patch $F57E [$0657W] #Down Platform guide (At $F3A7)
%patch $F580 [$0657W] #Left Platform guide (At $F3A7)
%patch $F582 [$0657W] #Up-right Platform guide (At $F3A7)
%patch $F584 [$0657W] #Down-right Platform guide (At $F3A7)
%patch $F586 [$0657W] #Down-left Platform guide (At $F3A7)
%patch $F588 [$0657W] #Up-left Platform guide (At $F3A7)
%patch $F58A [$05EDW] #Easy Shikadi (At $F33D)
%patch $F58C [$05E6W] #Normal Shikadi (At $F336)
%patch $F58E [$05DFW] #Hard Shikadi (At $F32F)
%patch $F590 [$060DW] #Easy Shockshund (At $F35D)
%patch $F592 [$0606W] #Normal Shockshund (At $F356)
%patch $F594 [$05FFW] #Hard Shockshund (At $F34F)
%patch $F596 [$062DW] #Easy Sphereful (At $F37D)
%patch $F598 [$0626W] #Normal Sphereful (At $F376)
%patch $F59A [$061FW] #Hard Sphereful (At $F36F)
%patch $F59C [$0657W] #BLANK (At $F3A7)
%patch $F59E [$0657W] #BLANK (At $F3A7)
%patch $F5A0 [$0657W] #BLANK (At $F3A7)
%patch $F5A2 [$0657W] #BLANK (At $F3A7)
%patch $F5A4 [$0657W] #BLANK (At $F3A7)
%patch $F5A6 [$0657W] #BLANK (At $F3A7)
%patch $F5A8 [$0657W] #BLANK (At $F3A7)
%patch $F5AA [$0657W] #BLANK (At $F3A7)
%patch $F5AC [$0657W] #BLANK (At $F3A7)
%patch $F5AE [$0657W] #BLANK (At $F3A7)
%patch $F5B0 [$0657W] #BLANK (At $F3A7)
%patch $F5B2 [$0657W] #BLANK (At $F3A7)
%patch $F5B4 [$0657W] #BLANK (At $F3A7)
%patch $F5B6 [$0657W] #BLANK (At $F3A7)
%patch $F5B8 [$0657W] #BLANK (At $F3A7)
%patch $F5BA [$0657W] #BLANK (At $F3A7)
%patch $F5BC [$063FW] #Korath (At $F38F)
%patch $F5BE [$0651W] #Teleporter (At $F3A1)
There are several things to note about the initiation codes. They are quite similar to, but better structured than Keen 4. The first things to notice the difficulty checks. Those sprites that have easy, normal and hard spawns have three different values. The easy pointer value is largest, with normal and hard being ten less each, since the way the code is set up has the difficulty checks first. The difficulty check is usually a ten byte string $83 $3E $6F6CW $02\$03 $7D $03 $E9 $xxxxW This means roughly 'If the difficulty is equal or harder than this, jump over the 'do nothing' jump.' Normal difficulty is $02, Hard is $03. The check can be understood by looking at Patch:Jump conditions and Patch:Game stats.
The second things are sprite caches. When a sprite is spawned it often (But not always!) sets a value in memory to 1. This section of memory is then scanned and sprites cached off the sprite cache list. This is a five byte string $C7 $06 $C2xxW $0001W, where xx is different for each sprite cache.
The last call ($9A $xxxxxxxxRL) is the call to the actual spawning code. So for example Normal Keen calls $0AAF0000RL and $0CCB0007RL, with that second one being the code that spawns him. (The other one sets him as the player.) Again, some sprites are not spawned at all, but just sit there.
All jumps ($E9 $xxxxW or $EB $xx.) go to the 'B Block' code. (The B Block code is used for sprites that do nothing, however only the B Block sprite will stop platforms.) These will need to be adjusted if the code is copied somewhere else, for example to make a new sprite.
Keen 5 initiation codes
#Keen right
%patch $EE96 $B8 [$0001W] $50 $57 $56 $9A {$0AAF0000RL} $83 $C4 $06 $9A
{$0CCB0007RL} $C7 $06 $C269W $0001W $B8 $2B7BRW $8A $16 $EC $6F
$8E $C0 $26 $08 $16 [$00EBW] $E9 $04E7W
#Keen left
%patch $EEC0 $B8 [$FFFFW] $50 $57 $56 $9A {$0AAF0000RL} $83 $C4 $06 $9A
{$0CCB0007RL} $C7 $06 $C269W $0001W $B8 $2B7BRW $8A $16 $EC $6F
$8E $C0 $26 $08 $16 [$00EBW] $E9 $04BDW
#Map Keen
%patch $EEEA $9A {$0CCB0007RL} $C7 $06 $C27FW $0001W $B8 $2B7BRW $8A $16
$EC $6F $8E $C0 $26 $08 $16 [$00EBW] $83 $3E [$6F70W] {$0D $75} $03
$E9 $049AW $57 $56 $9A {$0CCB050ERL} $83 $C4 $04 $E9 $048DW
#T map Keen
%patch $EF1A $83 $3E [$6F70W] {$0D $74} $03 $E9 $0483W $57 $56 $9A {$0CCB057FRL}
$83 $C4 $04 $E9 $0476W
#Sparky
%patch $EF31 $83 $3E [$6F6CW] {$03 $7D} $03 $E9 $046CW $83 $3E [$6F6CW] {$02 $7D}
$03 $E9 $0462W $57 $56 $9A {$11020004RL} $83 $C4 $04 $C7 $06
$C289W $0001W $E9 $044FW
#Shikadi mine
%patch $EF58 $83 $3E [$6F6CW] {$03 $7D} $03 $E9 $0445W $83 $3E [$6F6CW] {$02 $7D}
$03 $E9 $043BW $57 $56 $9A {$11C40001RL} $83 $C4 $04 $C7 $06
$C28BW $0001W $E9 $0428W
#Up Slicestar
%patch $EF7F $83 $3E [$6F6CW] {$03 $7D} $03 $E9 $041EW $83 $3E [$6F6CW] {$02 $7D}
$03 $E9 $0414W $33 $C0 $50 $57 $56 $9A {$1102070DRL} $83 $C4
$06 $C7 $06 $C28DW $0001W $E9 $03FEW
#RoboRed
%patch $EFA9 $83 $3E [$6F6CW] {$03 $7D} $03 $E9 $03F4W $83 $3E [$6F6CW] {$02 $7D}
$03 $E9 $03EAW $57 $56 $9A {$11C4095CRL} $83 $C4 $04 $C7 $06
$C28FW $0001W $E9 $03D7W
#Spirogrip
%patch $EFD0 $83 $3E [$6F6CW] {$03 $7D} $03 $E9 $03CDW $83 $3E [$6F6CW] {$02 $7D}
$03 $E9 $03C3W $57 $56 $9A {$11C40B61RL} $83 $C4 $04 $C7 $06
$C291W $0001W $E9 $03B0W
#Bouncy Slicestar
%patch $EFF7 $83 $3E [$6F6CW] {$03 $7D} $03 $E9 $03A6W $83 $3E [$6F6CW] {$02 $7D}
$03 $E9 $039CW $57 $56 $9A {$110207ACRL} $83 $C4 $04 $C7 $06
$C28DW $0001W $E9 $0389W
#Right Slicestar
%patch $F01E $83 $3E [$6F6CW] {$03 $7D} $03 $E9 $037FW $83 $3E [$6F6CW] {$02 $7D}
$03 $E9 $0375W $B8 [$0001W] $50 $57 $56 $9A {$1102070DRL} $83
$C4 $06 $C7 $06 $C28DW $0001W $E9 $035EW
#Horizontal scrollbar
%patch $F049 $B8 [$0001W] $50 $57 $56 $9A {$174E0B05RL} $83 $C4 $06 $E9 $034DW
#Red Horizontal-Vertical Platforms
%patch $F05A $33 $C0 $50 $8B $46 $FA $05 [$FFE5W] $50 $57 $56 $9A {$0F9206BCRL}
$83 $C4 $08 $C7 $06 $C29DW $0001W $E9 $0330W
#Dropping Platform
%patch $F077 $57 $56 $9A {$0F920BC8RL} $83 $C4 $04 $C7 $06 $C29DW $0001W $E9 $031DW
#Still Platform -hard
%patch $F08A $57 $56 $9A {$0F920CECRL} $83 $C4 $04 $C7 $06 $C29DW $0001W $E9 $030AW
#Still Platform - normal
%patch $F09D $83 $3E [$6F6CW] {$02 $7E} $03 $E9 $0300W $57 $56 $9A {$0F920CECRL}
$83 $C4 $04 $C7 $06 $C29DW $0001W $E9 $02EDW
#Still Platform - easy
%patch $F0BA $83 $3E [$6F6CW] {$01 $7E} $03 $E9 $02E3W $57 $56 $9A {$0F920CECRL}
$83 $C4 $04 $C7 $06 $C29DW $0001W $E9 $02D0W
#Red Goplat
%patch $F0D7 $33 $C0 $50 $8B $46 $FA $05 [$FFDCW] $50 $57 $56 $9A {$0F920D3FRL}
$83 $C4 $08 $C7 $06 $C29DW $0001W $E9 $02B3W
#Sneaky Platform
%patch $F0F4 $57 $56 $9A {$0F9214D1RL} $83 $C4 $04 $C7 $06 $C29DW $0001W
$E9 $02A0W
#QED\Fuse
%patch $F107 $83 $3E [$6F68W] {$0C $75} $12 $C7 $06 $6F5EW $0004W $57 $56 $9A
{$11C41D56RL} $83 $C4 $04 $EB $04 $FF $06 $5E $6F $C7 $06 $C2A5W
$0001W $E9 $027AW
#Little Ampton
%patch $F12D $83 $3E [$6F6CW] {$03 $7D} $03 $E9 $0270W $83 $3E [$6F6CW] {$02 $7D}
$03 $E9 $0266W $57 $56 $9A {$11020240RL} $83 $C4 $04 $C7 $06 $C293W
$0001W $E9 $0253W
#Laser up
%patch $F154 $83 $3E [$6F6CW] {$03 $7D} $03 $E9 $0249W $83 $3E [$6F6CW] {$02 $7D}
$03 $E9 $023FW $33 $C0 $50 $57 $56 $9A {$0F921597RL} $83 $C4
$06 $C7 $06 $C27DW $0001W $E9 $0229W
#Laser right
%patch $F17E $83 $3E [$6F6CW] {$03 $7D} $03 $E9 $021FW $83 $3E [$6F6CW] {$02 $7D}
$03 $E9 $0215W $B8 [$0001W] $50 $57 $56 $9A {$0F921597RL} $83 $C4
$06 $C7 $06 $C27DW $0001W $E9 $01FEW
#Laser down
%patch $F1A9 $83 $3E [$6F6CW] {$03 $7D} $03 $E9 $01F4W $83 $3E [$6F6CW] {$02 $7D}
$03 $E9 $01EAW $B8 [$0002W] $50 $57 $56 $9A {$0F921597RL} $83 $C4
$06 $C7 $06 $C27DW $0001W $E9 $01D3W
#Laser left
%patch $F1D4 $83 $3E [$6F6CW] {$03 $7D} $03 $E9 $01C9W $83 $3E [$6F6CW] {$02 $7D}
$03 $E9 $01BFW $B8 [$0003W] $50 $57 $56 $9A {$0F921597RL} $83 $C4
$06 $C7 $06 $C27DW $0001W $E9 $01A8W
#Low ammo raygun (Uses following item initiation)
%patch $F1FF $83 $3E [$6F56W] {$05 $7C} $03 $E9 $019EW $C7 $46 $FA [$0044W]
#Items
%patch $F20E $8B $46 $FA $05 [$FFC7W] $50 $57 $56 $9A {$0F92047FRL} $83 $C4
$06 $8B $5E $FA $D1 $E3 $8B $9F [$17CAW] $D1 $E3 $C7 $87 $C25FW
$0001W $E9 $0174W
#V card
%patch $F233 $8B $46 $FA $05 [$FFC6W] $50 $57 $56 $9A {$0F92047FRL} $83 $C4
$06 $8B $5E $FA $D1 $E3 $8B $9F [$17C8W] $D1 $E3 $C7 $87 $C25FW
$0001W $E9 $014FW
#Volte Face
%patch $F258 $83 $3E [$6F6CW] {$03 $7D} $03 $E9 $0145W $83 $3E [$6F6CW] {$02 $7D}
$03 $E9 $013BW $57 $56 $9A {$0F9211B4RL} $83 $C4 $04 $C7 $06 $C295W
$0001W $E9 $0128W
#Shelley
%patch $F27F $83 $3E [$6F6CW] {$03 $7D} $03 $E9 $011EW $83 $3E [$6F6CW] {$02 $7D}
$03 $E9 $0114W $57 $56 $9A $1E $09 $02 $11 $83 $C4 $04 $C7 $06 $C29BW
$0001W $E9 $0101W
#Spindred
%patch $F2A6 $83 $3E [$6F6CW] {$03 $7D} $03 $E9 $00F7W $83 $3E [$6F6CW] {$02 $7D}
$03 $E9 $00EDW $57 $56 $9A {$11C40C5DRL} $83 $C4 $04 $C7 $06
$C299W $0001W $E9 $00DAW
#Purple Goplat
%patch $F2CD $B8 [$0001W] $50 $8B $46 $FA $05 [$FFB0W] $50 $57 $56 $9A {$0F920D3FRL}
$83 $C4 $08 $C7 $06 $C297W $0001W $E9 $00BCW
#Purple Horizontal-Vertical Platform
%patch $F2EB $B8 [$0001W] $50 $8B $46 $FA $05 [$FFACW] $50 $57 $56 $9A {$0F9206BCRL}
$83 $C4 $08 $C7 $06 $C297W $0001W $E9 $009EW
#Shikadi Master
%patch $F309 $83 $3E [$6F6CW] {$03 $7D} $03 $E9 $0094W $83 $3E [$6F6CW] {$02 $7D}
$03 $E9 $008AW $57 $56 $9A {$11C40E47RL} $83 $C4 $04 $C7 $06
$C281W $0001W $EB $78
#Shikadi
%patch $F32F $83 $3E [$6F6CW] {$03 $7C} $71 $83 $3E [$6F6CW] {$02 $7C} $6A $57 $56
$9A {$11C41287RL} $83 $C4 $04 $C7 $06 $C283W $0001W $EB $58
#Shocksund
%patch $F34F $83 $3E [$6F6CW] {$03 $7C} $51 $83 $3E [$6F6CW] {$02 $7C} $4A $57 $56
$9A {$11C41617RL} $83 $C4 $04 $C7 $06 $C285W $0001W $EB $38
#Sphereful
%patch $F36F $83 $3E [$6F6CW] {$03 $7C} $31 $83 $3E [$6F6CW] {$02 $7C} $2A $57 $56
$9A {$11C419D8RL} $83 $C4 $04 $C7 $06 $C287W $0001W $EB $18
#Korath
%patch $F38F $57 $56 $9A {$11C41C81RL} $83 $C4 $04 $C7 $06 $C2A3W $0001W $EB $06
#Teleporter
%patch $F3A1 $C7 $06 $C2A9W $0001W
Spawn codes
These are spawn codes found in games. Unlike the initiation codes, they are standalone and can be swapped about and edited as desired. Notice that usually the very last variable set in Galaxy is the sprite action; in Vorticons it is the location of the sprite code and collision.
Depending on the spawn code, different things may happen. Many spawn codes are of the same basic size and structure, simply tweaking a few basic sprite properties such as foreground and sprite type.
The last blue highlighted value is the sprite action the sprite uses as it proceeds to act in-level. $C7 $47 $02 $xxxxW sets the sprite activity, $C7 $47 $06 $xxxxW sets the clipping, $C7 $07 $xxxxW sets the sprite type, $C7 $20 $xxxxW sets the foreground value. Some sprites also have $C7 $47 $40 $xxxxW set its strength. Finally $D3 $E0 $05 $xxxxW is how far down (Or more usually up) the sprite is spawned from where it is placed. This is necessary for sprites that walk on the ground as they can only be placed in the level at multiples of 16 pixels high while their actual height can be anything.
$C7 $47 $0E $xxxxW is the horizontal direction the sprite starts moving in, either $0001W (Facing right), $FFFFW (Facing left) or $0000W (Neither, never used.) $C7 $47 $10 $xxxxW is the vertical direction and works similarly. Some sprites have a probability check to determine which way they face this is always 50:50 (Though it needn't be.) and the code responsible for this is $9A $1D02002ARL $3D $0080W
Keen 5 spawn codes
#Normal Keen spawning code
%patch $AAF0 $55 $8B $EC $8B $1E $9E3EW $C7 $07 [$0002W] $C7 $47 $02 [$0002W]
$C7 $47 $20 [$0001W] $8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B
$46 $08 $D3 $E0 $05 [$FF0FW] $89 $47 $0C $8B $46 $0A $89 $47 $0E
$C7 $47 $10 [$0001W] $B8 [$0888W] $50 $53 $9A $13B511C4RL $83
$C4 $04 $5D $CB
#Demo Sign spawn code
%patch $CCB7 $55 $8B $EC $8B $1E $3C $9E $C7 $07 [$0001W] $C7 $47 $20 [$0003W]
$C7 $47 $02 [$0002W] $C7 $47 $06 [$0000W] $C7 $47 $40 [$FFFFW] $C7
$47 $3E [$FFFFW] $C7 $47 $42 [$FFFFW] $C7 $47 $44 [$FFFFW] $83 $3E
{$9B97W} [$00] {$74} $07 $C7 $47 $1C [$0788W] $5D $CB
$83 $3E {$332CW}
[$00] {$75} $12 $B8 [$133EW] $50 $FF $36 $3C $9E $9A $090B11C4RL
$83 $C4 $04 $5D $CB
$B8 [$135CW] $50 $FF $36 $3C $9E $9A $090B11C4RL
$83 $C4 $04 $B8 $2B7BW $8A $16 $EC $6F $8E $C0 $26 $08
$16 [$006BW] $5D $CB
#Item spawning code (Includes V card and low ammo)
%patch $FD9F $55 $8B $EC $56 $8B $76 $0A $33 $C0 $50 $9A $06B91DCDRL $83
$C4 $02 $8B $1E $40 $9E $C7 $47 $06 [$0000W] $C7 $47 $20 [$0002W]
$C7 $07 [$0005W] $8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B $46
$08 $D3 $E0 $89 $47 $0C $C7 $47 $10 [$FFFFW] $89 $77 $3E $8B $DE
$D1 $E3 $8B $87 [$1A54W] $8B $1E $40 $9E $89 $47 $1E $89 $47 $40
$8B $47 $40 $05 [$0002W] $89 $47 $42 $B8 [$1946W] $50 $53 $9A $090B11C4RL
$83 $C4 $04 $5E $5D $CB
#Horizontal-Vertical Red\Purple Platform spawning code
%patch $FFDC $55 $8B $EC $33 $C0 $50 $9A $06B91DCDRL $83 $C4 $02 $8B $1E
$40 $9E $C7 $07 [$0006W] $C7 $47 $02 [$0002W] $C7 $47 $20 [$0000W]
$8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B $46 $08 $D3 $E0 $89
$47 $0C $8B $5E $0A $83 $FB [$03] $77 $45 $D1 $E3 $2E $FF $A7 [$076EW]
$8B $1E $40 $9E $C7 $47 $0E [$0000W] $C7 $47 $10 [$FFFFW] $EB
$2E $8B $1E $40 $9E $C7 $47 $0E [$0001W] $C7 $47 $10 [$0000W] $EB
$1E $8B $1E $40 $9E $C7 $47 $0E [$0000W] $C7 $47 $10 [$0001W] $EB
$0E $8B $1E $40 $9E $C7 $47 $0E [$FFFFW] $C7 $47 $10 [$0000W] $83
$7E $0C $00 $74 $1B $8B $1E $40 $9E $83 $47 $0A $40 $83 $47 $0C
$40 $B8 [$1B7CW] $50 $53 $9A $090B11C4RL $83 $C4 $04 $5D $CB
$B8 [$1B5EW] $50 $FF $36 $40 $9E $9A $090B11C4RL $83 $C4 $04
$5D $CB
#Platform direction list
%patch $1008E $6FDW #Up (At $1001D)
%patch $10090 $70DW #Right (At $1002D)
%patch $10092 $71DW #Down (At $1003D)
%patch $10094 $72DW #Left (At $1004D)
#Dropping Platform spawn code
%patch $104E8 $55 $8B $EC $33 $C0 $50 $9A $06B91DCDRL $83 $C4 $02 $8B $1E
$40 $9E $C7 $07 [$0006W] $C7 $47 $02 [$0002W] $C7 $47 $20 [$0000W]
$8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B $46 $08 $D3 $E0 $89
$47 $3E $89 $47 $0C $C7 $47 $0E [$0000W] $C7 $47 $10 [$0001W] $C7
$47 $06 [$0000W] $B8 {$1BB8W} $50 $53 $9A $090B11C4RL $83 $C4
$04 $5D $CB
#Sitting platform spawn code
%patch $1060C $55 $8B $EC $33 $C0 $50 $9A $06B91DCDRL $83 $C4 $02 $8B $1E
$40 $9E $C7 $07 [$0006W] $C7 $47 $02 [$0001W] $C7 $47 $20 [$0000W]
$8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B $46 $08 $D3 $E0 $89
$47 $3E $89 $47 $0C $C7 $47 $0E [$0000W] $C7 $47 $10 [$0001W] $C7
$47 $06 [$0000W] $B8 [$1C12W] $50 $53 $9A $090B11C4RL $83 $C4
$04 $5D $CB
#Goplat spawning code
%patch $1065F $55 $8B $EC $56 $57 $8B $76 $06 $8B $7E $08 $33 $C0 $50 $9A
$06B91DCDRL $83 $C4 $02 $8B $1E $40 $9E $C7 $07 [$0006W] $C7 $47
$02 [$0002W] $C7 $47 $20 [$0000W] $8B $C6 $B1 $08 $D3 $E0 $89 $47
$0A $8B $C7 $D3 $E0 $89 $47 $0C $C7 $47 $0E [$0000W] $C7 $47 $10
[$0001W] $C7 $47 $06 [$0000W] $83 $7E $0C $00 $74 $17 $83 $47 $0A
$40 $83 $47 $0C $40 $B8 [$1C4EW] $50 $53 $9A $090B11C4RL $83
$C4 $04 $EB $10 $B8 [$1C30W] $50 $FF $36 $40 $9E $9A $090B11C4RL
$83 $C4 $04 $8B $46 $0A $05 [$005BW] $8B $DF $D1 $E3 $8B $9F
$87 $BF $D1 $EB $D1 $E3 $8E $06 $53 $9E $8B $D6 $D1 $E2 $03 $DA
$26 $89 $07 $8B $1E $40 $9E $8B $46 $0A $89 $47 $3E $C7 $47 $40
[$0100W] $5F $5E $5D $CB
#Volte-face spawn code
%patch $10AD4 $55 $8B $EC $83 $EC $04 $56 $57 $8B $7E $06 $33 $C0 $50 $9A $06B91DCDRL
$83 $C4 $02 $8B $1E $40 $9E $C7 $07 [$0010W] $C7 $47
$02 [$0002W] $C7 $47 $20 [$0002W] $8B $C7 $B1 $08 $D3 $E0 $89 $47
$0A $8B $46 $08 $D3 $E0 $89 $47 $0C $C7 $47 $06 [$0000W] $B8 [$1CCCW]
$50 $53 $9A $090B11C4RL $83 $C4 $04 $8B $5E $08 $D1 $E3
$8B $87 $87 $BF $D1 $E8 $E0D1W $8B $16 $53 $9E $8B $DF $D1 $E3
$03 $C3 $89 $56 $FE $89 $46 $FC $C4 $5E $FC $26 $83 $7F $FE $5C
$75 $05 $BE [$0001W] $EB $36 $C4 $5E $FC $26 $83 $7F $02 $5E $75
$05 $BE [$0003W] $EB $27 $A1 $4C $9E $D1 $E0 $C4 $5E $FC $2B $D8
$26 $83 $3F $5D $75 $05 $BE [$0002W] $EB $12 $A1 $4C $9E $D1 $E0
$C4 $5E $FC $03 $D8 $26 $83 $3F $5B $75 $02 $33 $F6 $8B $C6 $05
[$005BW] $C4 $5E $FC $26 $89 $07 $8B $1E $40 $9E $89 $77 $3E $C7
$47 $40 [$0100W] $5F $5E $8B $E5 $5D $CB
#Sneaky Platform spawn code
%patch $10DF1 $55 $8B $EC $33 $C0 $50 $9A $06B91DCDRL $83 $C4 $02 $8B $1E
$40 $9E $C7 $07 [$0006W] $C7 $47 $02 [$0002W] $C7 $47 $20 [$0000W]
$8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $3E $89 $47 $0A $8B $46 $08
$D3 $E0 $89 $47 $0C $C7 $47 $0E [$0000W] $C7 $47 $10 [$0001W] $C7
$47 $06 [$0000W] $B8 [$1DA4W] $50 $53 $9A $090B11C4RL $83 $C4
$04 $5D $CB
#Enemy shooter spawn code
%patch $10EB7 $55 $8B $EC $56 $57 $8B $76 $06 $8B $7E $08 $33 $C0 $50 $9A $06B91DCDRL
$83 $C4 $02 $8B $1E $40 $9E $C7 $07 [$000FW] $C7 $47
$02 [$0001W] $8B $C6 $89 $47 $2C $89 $47 $30 $8B $C7 $89 $47 $32
$89 $47 $2E $8B $C6 $B1 $08 $D3 $E0 $89 $47 $26 $89 $47 $22 $89
$47 $0A $8B $C7 $D3 $E0 $89 $47 $28 $89 $47 $24 $89 $47 $0C $8B
$46 $0A $89 $47 $3E $B8 [$1DFEW] $50 $53 $9A $090B11C4RL $83
$C4 $04 $5F $5E $5D $CB
#Sparky spawn code
%patch $11024 $55 $8B $EC $33 $C0 $50 $9A $06B91DCDRL $83 $C4 $02 $8B $1E
$40 $9E $C7 $07 [$0009W] $C7 $47 $02 [$0001W] $C7 $47 $20 [$0000W]
$8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B $46 $08 $D3 $E0 $05
[$FF00W] $89 $47 $0C $9A $1DFB0036RL $3D $0080W $7D $0B $8B
$1E $40 $9E $C7 $47 $0E [$0001W] $EB $09 $8B $1E $40 $9E $C7 $47
$0E [$FFFFW] $8B $1E $40 $9E $C7 $47 $10 [$0001W] $B8 [$1F0CW] $50
$53 $9A $090B11C4RL $83 $C4 $04 $5D $CB
#Little Ampton spawning code
%patch $11260 $55 $8B $EC $33 $C0 $50 $9A $06B91DCDRL $83 $C4 $02 $8B $1E
$40 $9E $C7 $07 [$000EW] $C7 $47 $02 [$0001W] $C7 $47 $20 [$0000W]
$8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B $46 $08 $D3 $E0 $05
[$FF80W] $89 $47 $0C $9A $1DFB0036RL $3D [$0080W] $7D $0B $8B
$1E $40 $9E $C7 $47 $0E [$0001W] $EB $09 $8B $1E $40 $9E $C7 $47
$0E [$FFFFW] $8B $1E $40 $9E $C7 $47 $10 [$0001W] $B8 [$21DCW] $50
$53 $9A $090B11C4RL $83 $C4 $04 $5D $CB
#Horizontal\Vertical Slicestar spawning code
%patch $1172D $55 $8B $EC $33 $C0 $50 $9A $06B91DCDRL $83 $C4 $02 $8B $1E
$40 $9E $C7 $07 [$000BW] $C7 $47 $02 [$0001W] $C7 $47 $20 [$0002W]
$8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B $46 $08 $D3 $E0 $89
$47 $0C $C7 $47 $44 [$0014W] $8B $5E $0A $83 $FB [$03] $77 $45 $D1
$E3 $2E $FF $A7 [$07A4W] $8B $1E $40 $9E $C7 $47 $0E [$0000W] $C7
$47 $10 [$FFFFW] $EB $2E $8B $1E $40 $9E $C7 $47 $0E [$0001W] $C7
$47 $10 [$0000W] $EB $1E $8B $1E $40 $9E $C7 $47 $0E [$0000W] $C7
$47 $10 [$0001W] $EB $0E $8B $1E $40 $9E $C7 $47 $0E [$FFFFW] $C7
$47 $10 [$0000W] $B8 [$23BCW] $50 $FF $36 $40 $9E $9A $090B11C4RL
$83 $C4 $04 $5D $CB
#Slicestar direction list
%patch $117C4 [$0753W] #Down (At $11773)
%patch $117C6 [$0763W] #Right (At $11783)
%patch $117C8 [$0773W] #Left (At $11793)
%patch $117CA [$0783W] #Up (At $117A3)
#Shelley spawn code
%patch $1193E $55 $8B $EC $33 $C0 $50 $9A $06B91DCDRL $83 $C4 $02 $8B $1E
$40 $9E $C7 $07 [$0009W] $C7 $47 $02 [$0001W] $C7 $47 $20 [$0000W]
$8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B $46 $08 $D3 $E0 $89
$47 $0C $9A $1DFB0036RL $3D [$0080W] {$7D} $0B $8B $1E $40 $9E
$C7 $47 $0E [$0001W] $EB $09 $8B $1E $40 $9E $C7 $47 $0E [$FFFFW]
$8B $1E $40 $9E $C7 $47 $10 [$0001W] $B8 [$2416W] $50 $53 $9A
$090B11C4RL $83 $C4 $04 $5D $CB
#Mine spawning code
%patch $11C41 $55 $8B $EC $56 $33 $C0 $50 $9A $06B91DCDRL $83 $C4 $02 $8B
$1E $40 $9E $C7 $07 [$000AW] $C7 $47 $02 [$0001W] $C7 $47 $06 [$0000W]
$8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B $46 $08 $D3 $E0
$05 [$FF0FW] $89 $47 $0C $C7 $47 $40 [$0100W] $C7 $47 $42 [$00D0W]
$B8 [$2644W] $50 $53 $9A $090B11C4RL $83 $C4 $04 $8B $1E $40
$9E $C7 $47 $16 [$0100W] $33 $F6 $EB $12 $56 $FF $36 $40 $9E $90
$0E $E8 $0095W $83 $C4 $04 $0B $C0 $75 $06 $46 $83 $FE $03 $7E
$E9 $5E $5D $CB
#Robo Red spawning code
%patch $1259C $55 $8B $EC $33 $C0 $50 $9A $06B91DCDRL $83 $C4 $02 $8B $1E
$40 $9E $C7 $07 [$000CW] $C7 $47 $02 [$0001W] $8B $46 $06 $B1 $08
$D3 $E0 $89 $47 $0A $8B $46 $08 $D3 $E0 $05 [$FC00W] $89 $47 $0C
$9A $1DFB0036RL $3D [$0080W] $7D $0B $8B $1E $40 $9E $C7 $47
$0E [$0001W] $EB $09 $8B $1E $40 $9E $C7 $47 $0E [$FFFFW] $B8 [$2734W]
$50 $FF $36 $40 $9E $9A $090B11C4RL $83 $C4 $04 $5D $CB
#Spirogrip spawn code
%patch $127A1 $55 $8B $EC $33 $C0 $50 $9A $06B91DCDRL $83 $C4 $02 $8B $1E
$40 $9E $C7 $07 [$000DW] $C7 $47 $02 [$0001W] $8B $46 $06 $B1 $08
$D3 $E0 $89 $47 $0A $8B $46 $08 $D3 $E0 $05 [$FF00W] $89 $47 $0C
$C7 $47 $0E [$0001W] $C7 $47 $10 [$0001W] $B8 [$2824W] $50 $53 $9A
$090B11C4RL $83 $C4 $04 $5D $CB
#Shikadi Master Spawn code
%patch $12A87 $55 $8B $EC $33 $C0 $50 $9A $06B91DCDRL $83 $C4 $02 $8B $1E
$40 $9E $C7 $07 [$0013W] $C7 $47 $02 [$0001W] $8B $46 $06 $B1 $08
$D3 $E0 $89 $47 $0A $8B $46 $08 $D3 $E0 $05 $80 $FE $89 $47 $0C
$B8 [$2AF4W] $50 $53 $9A $090B11C4RL $83 $C4 $04 $5D $CB
#Shikadi spawn code
%patch $12EC7 $55 $8B $EC $33 $C0 $50 $9A $06B91DCDRL $83 $C4 $02 $8B $1E
$40 $9E $C7 $07 [$0014W] $C7 $47 $02 [$0001W] $8B $46 $06 $B1 $08
$D3 $E0 $89 $47 $0A $8B $46 $08 $D3 $E0 $05 [$FF00W] $89 $47 $0C
$C7 $47 $40 [$0004W] $9A $1DFB0036RL $3D [$0080W] $7D $0B $8B
$1E $40 $9E $C7 $47 $0E [$0001W] $EB $09 $8B $1E $40 $9E $C7 $47
$0E [$FFFFW] $B8 [$2D10W] $50 $FF $36 $40 $9E $9A $090B11C4RL
$83 $C4 $04 $5D $CB
#Shockshund spawn code
%patch $13257 $55 $8B $EC $33 $C0 $50 $9A $06B91DCDRL $83 $C4 $02 $8B $1E
$40 $9E $C7 $07 [$0015W] $C7 $47 $02 [$0001W] $8B $46 $06 $B1 $08
$D3 $E0 $89 $47 $0A $8B $46 $08 $D3 $E0 $05 [$FF80W] $89 $47 $0C
$C7 $47 $40 [$0002W] $B8 [$0001W] $89 $47 $10 $89 $47 $0E $B8 [$2F0EW]
$50 $53 $9A $090B11C4RL $83 $C4 $04 $5D $CB
#Q.E.D. spawn code
%patch $13996 $55 $8B $EC $56 $57 $8B $76 $06 $8B $7E $08 $33 $C0 $50 $9A $06B91DCDRL
$83 $C4 $02 $8B $1E $40 $9E $C7 $07 [$0019W] $C7 $47
$02 [$0001W] $89 $77 $2C $89 $7F $2E $8B $47 $2C $40 $89 $47 $30
$8B $47 $2E $40 $89 $47 $32 $8B $C6 $B1 $08 $D3 $E0 $05 [$FFF0W]
$89 $47 $22 $89 $47 $0A $8B $C7 $D3 $E0 $05 [$FFF0W] $89 $47 $24
$89 $47 $0C $8B $47 $22 $05 $20 $02 $89 $47 $26 $8B $47 $24 $05
$20 $02 $89 $47 $28 $B8 [$3186W] $50 $53 $9A $090B11C4RL $83
$C4 $04 $5F $5E $5D $CB
Unused Platform cache
There is one unused sprite cache in Keen 5. It is a single animation in size and contains a small red platform. This is useful since it is not hard to expand it or use it for a totally unique sprite. It's call is $C29F.
Keen 5 Cache
#Cache
%patch $31A4C $01BFW #Small red platform cache start
%patch $31AA0 $01BFW #Cache end
Create space for new initiation code
These patches rearrange the existing initiation codes so that they are ore compact. This allows a modder to insert new code in the freed space. All the patches in this section can be combined to free up the maximum amount of space.
Compact Keen initiation method
This patch compacts the Left and right Keen initiation codes so they use the minimum amount of space. (This is possible because they both require similar code.) It frees space at $EEC5 for a 3-difficulty sprite or several non-difficulty sprites.
The patch is quite basic; in effect the Keen left code only sets Keen's direction before jumping to the Keen right code, leaving all its space free.
Create space for new initiation code in Keen 5
#Keen left code compacted
%patch $EEC0 $B8 [$FFFFW] $EB $D4
Compact Platform initiations method
This patch works by compacting the very similar Platform initiation codes (They all cache the same graphics.) This requires extensive reorganization but frees up a considerable amount of initiation space. (Specifically the space from $F05A-$0FA8 is freed.)
Create space for new initiation code in Keen 5
#Move initiation pointers (Free $4E at $F05A)
%patch $F4FA $0359W #Up Horizontal-Vertical Red Platform (At $F0A9)
%patch $F4FC $0359W #Right Horizontal-Vertical Red Platform (At $F0A9)
%patch $F4FE $0359W #Down Horizontal-Vertical Red Platform (At $F0A9)
%patch $F500 $0359W #Left Horizontal-Vertical Red Platform (At $F0A9)
%patch $F504 $036CW #Dropping Platform (At $F0BC)
%patch $F506 $037EW #Easy still Platform (At $F0CE)
%patch $F508 $0375W #Normal Still Platform (At $F0C5)
%patch $F50A $0385W #Hard still Platform (At $F0D5)
%patch $F50C $037EW #Up Red Goplat (At $F0DE)
%patch $F50E $038EW #Right Red Goplat (At $F0DE)
%patch $F510 $038EW #Down Red Goplat (At $F0DE)
%patch $F512 $038EW #Left Red Goplat (At $F0DE)
#Compress initiation codes
%patch $F0A9 $33 $C0 $50 $8B $46 $FA $05 [$FFE5W] $50 $57 $56 $9A {$0F9206BCRL} $EB $33
%patch $F0BC $57 $56 $9A {$0F920BC8RL} $EB $36
%patch $F0C5 $83 $3E {$6F6CW} [$02] {$7F} $38 $EB $07
%patch $F0CE $83 $3E {$6F6CW} [$01] {$7F} $2F $57 $56 $9A {$0F920CECRL}
$EB $1D
%patch $F0DE $33 $C0 $50 $8B $46 $FA $05 [$FFDCW] $50 $57 $56 $9A {$0F920D3FRL}
$83 $C4 $08 $EB $0A
Compact Enemy Shooter initiations method
This patch works by compacting the very similar Enemy Shooter initiation codes (They all cache the same graphics and use similar code.) This requires extensive reorganization but frees up a considerable amount of initiation space. (Specifically the space from $F154-$F1A1 is freed.)
Create space for new initiation code in Keen 5
#Move pointers (Frees $F154-$F1A1)
%patch $F51E $0460W #Easy laser up (At $F1B0)
%patch $F520 $0472W #Easy laser right (At $F1C2)
%patch $F522 $0485W #Easy laser left (At $F1D5)
%patch $F524 $0498W #Easy laser down (At $F1E8)
%patch $F526 $0459W #Normal laser up (At $F1A9)
%patch $F528 $046BW #Normal laser right (At $F1BB)
%patch $F52A $047EW #Normal laser down (At $F1CE)
%patch $F52C $0491W #Normal laser left (At $F1E1)
%patch $F52E $0452W #Hard laser up (At $F1A2)
%patch $F530 $0464W #Hard laser right (At $F1B4)
%patch $F532 $0477W #Hard laser down (At $F1C7)
%patch $F534 $048AW #Hard laser left (At $F1DA)
#Compress initiation codes
%patch $F1A2 $83 $3E [$6F6CW] {$03 $7C} $53 $83 $3E [$6F6CW] {$02 $7C} $4C
[$33 $C0] $EB $37
%patch $F1B4 $83 $3E [$6F6CW] {$03 $7C} $41 $83 $3E [$6F6CW] {$02 $7C} $3A $B8
[$0001W] $EB $24
%patch $F1C7 $83 $3E [$6F6CW] {$03 $7C} $2E $83 $3E [$6F6CW] {$02 $7C} $27 $B8
[$0002W] $EB $11
%patch $F1DA $83 $3E [$6F6CW] {$03 $7C} $1B $83 $3E [$6F6CW] {$02 $7C} $14 $B8 [$0003W]
$50 $57 $56 $9A $0F921597RL $83 $C4 $06 $C7 $06 $C27DW
$0001W $E9 $01A8W
Keen 6
This section is partly incomplete.
Keen 6 is similar to Keen 4, and the same points apply.
Initiations
Keen 6 pointer list
#Location of list ($E420 + $0532 = $E952)
%patch $E486 $0532W
#Length of list (105 items)
%patch $E47B $69
#Sprite code pointer list (Origin is $E420)
%patch $E952 [$0068W] #Keen right (At $E488)
%patch $E954 [$0092W] #Keen left (At $E4B2)
%patch $E956 [$00BCW] #Map Keen (At $E4DC)
%patch $E958 [$00F6W] #Easy Bloog (At $E516)
%patch $E95A [$00ECW] #Medium Bloog (At $E50C)
%patch $E95C [$00E2W] #Hard Bloog (At $E502)
%patch $E95E [$0109W] #Red Blooglet (At $E529)
%patch $E960 [$0109W] #Yellow Blooglet (At $E529)
%patch $E962 [$0109W] #Blue Blooglet (At $E529)
%patch $E964 [$0109W] #Green Blooglet (At $E529)
%patch $E966 [$0109W] #Red keygem Blooglet (At $E529)
%patch $E968 [$0109W] #Yellow keygem Blooglet (At $E529)
%patch $E96A [$0109W] #Green keygem Blooglet (At $E529)
%patch $E96C [$0109W] #Blue keygem Blooglet (At $E529)
%patch $E96E [$0145W] #Bottom of cliff (At $E565)
%patch $E970 [$0145W] #Top of cliff (At $E565)
%patch $E972 [$04A7W] #BLANK (At $E8C7)
%patch $E974 [$016DW] #Easy Fleex (At $E58D)
%patch $E976 [$0163W] #Medium Fleex (At $E583)
%patch $E978 [$0159W] #Hard Fleex (At $E579)
%patch $E97A [$0180W] #Easy UNUSED (At $E5A0)
%patch $E97C [$0180W] #Medium UNUSED (At $E5A0)
%patch $E97E [$0180W] #Hard UNUSED (At $E5A0)
%patch $E980 [$0180W] #Molly (At $E5A0)
%patch $E982 [$0193W] #Horizontal scrollbar (At $E5B3)
%patch $E984 [$01A4W] #Vertical scrollbar (At $E5C4)
%patch $E986 [$01B4W] #Platform up (At $E5D4)
%patch $E988 [$01B4W] #Platform right (At $E5D4)
%patch $E98A [$01B4W] #Platform down (At $E5D4)
%patch $E98C [$01B4W] #Platform left (At $E5D4)
%patch $E98E [$04A7W] #B sprite (At $E8C7)
%patch $E990 [$01CEW] #Falling Platform (At $E5EE)
%patch $E992 [$0211W] #Only-Easy sitting Platform (At $E631)
%patch $E994 [$01F4W] #Easy\Medium sitting Platform (At $E614)
%patch $E996 [$01E1W] #Easy\Medium\Hard sitting Platform (At $E601)
%patch $E998 [$022EW] #Path Platform up (At $E64E)
%patch $E99A [$022EW] #Path Platform right (At $E64E)
%patch $E99C [$022EW] #Path Platform down (At $E64E)
%patch $E99E [$022EW] #Path Platform left (At $E64E)
%patch $E9A0 [$024EW] #Sneaky Platform (At $E66E)
%patch $E9A2 [$0275W] #Easy Bobba (At $E695)
%patch $E9A4 [$026BW] #Medium Bobba (At $E68B)
%patch $E9A6 [$0261W] #Hard Bobba (At $E681)
%patch $E9A8 [$0288W] #Satellite dropoff up (At $E6A8)
%patch $E9AA [$0288W] #Satellite dropoff right (At $E6A8)
%patch $E9AC [$04A7W] #BLANK (At $E8C7)
%patch $E9AE [$02B0W] #Easy Nospike (At $E6D0)
%patch $E9B0 [$02A6W] #Medium Nospike (At $E6C6)
%patch $E9B2 [$029CW] #Hard Nospike (At $E6BC)
%patch $E9B4 [$02D7W] #Easy Gik (At $E6F7)
%patch $E9B6 [$02CDW] #Medium Gik (At $E6ED)
%patch $E9B8 [$02C3W] #Hard Gik (At $E6E3)
%patch $E9BA [$02EAW] #Laser up (At $E70A)
%patch $E9BC [$02EAW] #Laser right (At $E70A)
%patch $E9BE [$02EAW] #Laser down (At $E70A)
%patch $E9C0 [$02EAW] #Laser left (At $E70A)
%patch $E9C2 [$0313W] #Red gem (At $E733)
%patch $E9C4 [$0313W] #Yellow gem (At $E733)
%patch $E9C6 [$0313W] #Green gem (At $E733)
%patch $E9C8 [$0313W] #Blue gem (At $E733)
%patch $E9CA [$0313W] #100 points (At $E733)
%patch $E9CC [$0313W] #200 points (At $E733)
%patch $E9CE [$0313W] #500 points (At $E733)
%patch $E9D0 [$0313W] #1000 points (At $E733)
%patch $E9D2 [$0313W] #2000 points (At $E733)
%patch $E9D4 [$0313W] #5000 points (At $E733)
%patch $E9D6 [$0313W] #1UP (At $E733)
%patch $E9D8 [$0313W] #Ammo (At $E733)
%patch $E9DA [$0304W] #IF ammo (At $E724)
%patch $E9DC [$034CW] #Easy Orbatrix (At $E76C)
%patch $E9DE [$0342W] #Medium Orbatrix (At $E762)
%patch $E9E0 [$0338W] #Hard Orbatrix (At $E758)
%patch $E9E2 [$0373W] #Easy Bipship (At $E793)
%patch $E9E4 [$0369W] #Medium Bipship (At $E789)
%patch $E9E6 [$035FW] #Hard Bipship (At $E77F)
%patch $E9E8 [$03A0W] #Easy Flect (At $E7C0)
%patch $E9EA [$0396W] #Medium Flect (At $E7B6)
%patch $E9EC [$038CW] #Hard Flect (At $E7AC)
%patch $E9EE [$03C7W] #Easy Blorb (At $E7E7)
%patch $E9F0 [$03BDW] #Medium Blorb (At $E7DD)
%patch $E9F2 [$03B3W] #Hard Blorb (At $E7D3)
%patch $E9F4 [$03EEW] #Easy Ceilick (At $E80E)
%patch $E9F6 [$03E4W] #Medium Ceilick (At $E804)
%patch $E9F8 [$03DAW] #Hard Ceilick (At $E7FA)
%patch $E9FA [$0415W] #Easy Blooguard (At $E835)
%patch $E9FC [$040BW] #Medium Blooguard (At $E82B)
%patch $E9FE [$0401W] #Hard Blooguard (At $E821)
%patch $EA00 [$0428W] #Grabbiter (At $E848)
%patch $EA02 [$0434W] #Satellite (At $E854)
%patch $EA04 [$04A7W] #BLANK (At $E8C7)
%patch $EA06 [$04A7W] #Platform path up (At $E8C7)
%patch $EA08 [$04A7W] #Platform path right (At $E8C7)
%patch $EA0A [$04A7W] #Platform path down (At $E8C7)
%patch $EA0C [$04A7W] #Platform path left (At $E8C7)
%patch $EA0E [$04A7W] #Platform path up-right (At $E8C7)
%patch $EA10 [$04A7W] #Platform path down-right (At $E8C7)
%patch $EA12 [$04A7W] #Platform path down-left (At $E8C7)
%patch $EA14 [$04A7W] #Platform path down-right (At $E8C7)
%patch $EA16 [$0440W] #Rope and grappling hook (At $E860)
%patch $EA18 [$0452W] #Sandwich (At $E872)
%patch $EA1A [$0464W] #Rocket pass (At $E884)
%patch $EA1C [$0484W] #Easy Babobba (At $E8A4)
%patch $EA1E [$047DW] #Medium Babobba (At $E89D)
%patch $EA20 [$0476W] #Hard Babobba (At $E896)
%patch $EA22 [$0496W] #Rocket on Xax (At $E8B6)
%patch $EA24 [$0496W] #Rocket on station (At $E8B6)
There are several things to note about the initiation codes. They are far more thorough than in Keen Vorticons. The first things to note are the difficulty checks. Those sprites that have easy, normal and hard spawns have three different values. The easy pointer value is largest, with normal and hard being ten less each, since the way the code is set up has the difficulty checks first. The difficulty check is usually a ten byte string $83 $3E $75A8W $02\$03 $7D $03 $E9 $xxxxW This means roughly 'If the difficulty is equal or harder than this, jump over the 'do nothing' jump.' Normal difficulty is $02, Hard is $03. The check can be understood by looking at Patch:Jump conditions and Patch:Game stats.
The second things are sprite caches. When a sprite is spawned it often (But not always!) sets a value in memory to 1. This section of memory is then scanned and sprites cached off the sprite cache list. This is a five byte string $C7 $06 $CDxxW $0001W, where xx is different for each sprite cache. As an example the Nospike's cache is $37, the Gik's is $39 (They are next to each other in the cache list, and thus differ by 2 in memory.) A fuller explanation of this is given at Patch:Sprite cache.
The last call ($9A $xxxxxxxxRL) is the call to the actual spawning code. So for example Nospike calls $10CC0005RL.
All jumps ($E9 $xxxxW or $EB $xx.) go to the 'B Block' code. (The B Block code is used for sprites that do nothing, however only the B Block sprite will stop platforms.) These will need to be adjusted if the code is copied somewhere else, for example to make a new sprite.
Keen 6 initiation codes
#Keen right initiation code
%patch $E488 $B8 [$0001W] $50 $57 $56 $9A {$0AA20004RL} $83 $C4 $06 $9A
$0CA6000ARL $C7 $06 $CD01W $0001W $B8 $2BF3RW $8A $16 $28 $76
$8E $C0 $26 $08 $16 [$00AFW] $E9 $0415W
#Keen left initiation code
%patch $E4B2 $B8 [$FFFFW] $50 $57 $56 $9A {$0AA20004RL} $83 $C4 $06 $9A
$0CA6000ARL $C7 $06 $CD01W $0001W $B8 $2BF3RW $8A $16 $28 $76
$8E $C0 $26 $08 $16 [$00AFW] $E9 $03EBW
#Map Keen initiation code
%patch $E4DC $57 $56 $9A {$0CA60511RL} $83 $C4 $04 $9A $0CA6000ARL $C7
$06 $CD15W $0001W $B8 $2BF3RW $8A $16 $28 $76 $8E $C0 $26 $08
$16 [$00AFW] $E9 $03C5W
#Bloog initiation code
%patch $E502 $83 $3E {$75A8W} [$03] {$7D} $03 $E9 $03BBW $83 $3E {$75A8W} [$02] {$7D}
$03 $E9 $03B1W $57 $56 $9A {$0EFC186ARL} $83 $C4 $04 $C7 $06
$CD19W $0001W $E9 $039EW
#Blooglet initiation code
%patch $E529 $8B $46 $FA $05 [$FFF9W] $50 $57 $56 $9A {$0EFC1B60RL} $83 $C4
$06 $8B $46 $FA $05 [$FFF9W] $BB [$0004W] $99 $F7 $FB $D1 $E2 $8B
$DA $C7 $87 $CD1BW $0001W $83 $7E $FA $0A $7F $03 $E9 $036EW
$C7 $06 $CD11W $0001W $E9 $0365W $E9 $0362W
#Cliffs initiation code
%patch $E565 $8B $46 $FA $05 [$FFF1W] $50 $57 $56 $9A {$0EFC0A50RL} $83 $C4
$06 $E9 $034EW
#Fleex initiation code
%patch $E579 $83 $3E {$75A8W} [$03] {$7D} $03 $E9 $0344W $83 $3E {$75A8W} [$03] {$7D}
$03 $E9 $033AW $57 $56 $9A {$11CF000FRL} $83 $C4 $04 $C7 $06
$CD3DW $0001W $E9 $0327W
#Horizontal scrollbar initiation code
%patch $E5B3 $B8 $0001W $50 $57 $56 $9A {$16080C38RL} $83 $C4 $06 $E9 $0303W
#Vertical scrollbar initiation code
%patch $E5C4 $33 $C0 $50 $57 $56 $9A {$16080C38RL} $83 $C4 $06 $E9 $02F3W
#Horizontal-Vertical Platform initiation code
%patch $E5D4 $8B $46 $FA $05 [$FFE5W] $50 $57 $56 $9A {$0EFC1116RL} $83 $C4
$06 $C7 $06 $CD23W $0001W $E9 $02D9W
#Dropping Platform initiation code
%patch $E5EE $57 $56 $9A {$0EFC13C2RL} $83 $C4 $04 $C7 $06 $CD23W $0001W
$E9 $02C6W
#Easy\Medium\Hard Platform initiation code
%patch $E601 $57 $56 $9A {$0EFC14E6RL} $83 $C4 $04 $C7 $06 CD23W $0001W
$E9 $02B3W
#Easy\Medium Platform initiation code
%patch $E614 $83 $3E {$75A8W} [$02] {$7E} $03 $E9 $02A9W $57 $56 $9A {$0EFC14E6RL}
$83 $C4 $04 $C7 $06 $CD23W $0001W $E9 $0296W
#Only-Easy Platform initiation code
%patch $E631 $83 $3E {$75A8W} [$01] {$7E} $03 $E9 $028CW $57 $56 $9A {$0EFC14E6RL}
$83 $C4 $04 $C7 $06 $CD23W $0001W $E9 $0279W
#Path Following Platform initiation code
%patch $E64E $8B $46 $FA $05 [$FFDCW] $50 $57 $56 $9A {$0EFC1539RL} $83 $C4
$06 $C7 $06 $CD23W $0001W $C7 $06 $CD33W $0001W $E9 $0259W
#Sneaky Platform initiation code
%patch $E66E $57 $56 $9A {$0EFC17A4RL} $83 $C4 $04 $C7 $06 $CD23W $0001W
$E9 $0246W
#Bobba initiation code
%patch $E681 $83 $3E {$75A8W} [$03] {$7D} $03 $E9 $023CW $83 $3E {$75A8W} [$02] {$7D}
$03 $E9 $0232W $57 $56 $9A {$11CF015CRL} $83 $C4 $04 $C7 $06
$CD29W $0001W $E9 $021FW
#Satellite dropoff point initiation code
%patch $E6A8 $8B $46 $FA $05 [$FFD4W] $50 $57 $56 $9A {$0EFC0CF3RL} $83 $C4
$06 $E9 $020BW
#Nospike initiation code
%patch $E6BC $83 $3E {$75A8W} [$03] {$7D} $03 $E9 $0201W $83 $3E {$75A8W} [$02] {$7D}
$03 $E9 $01F7W $57 $56 $9A {$10CC0005RL} $83 $C4 $04 $C7 $06
$CD37W $0001W $E9 $01E4W
#Gik initiation code
%patch $E6E3 $83 $3E $A8 $75 $03 $7D $03 $E9 $01DAW $83 $3E $A8 $75 $02 $7D
$03 $E9 $01D0W $57 $56 $9A {$10CC045ARL} $83 $C4 $04 $C7 $06
$CD25W $0001W $E9 $01BDW
#Enemy gun initiation code
%patch $E70A $8B $46 $FA $05 [$FFCBW] $50 $57 $56 $9A $10CC06B1RL $83 $C4
$06 $C7 $06 $CD43W $0001W $E9 $01A3W
#'IF' Ammo initiation code (Uses following item initiation)
%patch $E724 $83 $3E {$7590W} [$05] {$7C} $03 $E9 $0199W $C7 $46 $FA [$0044W]
#Item initiation code
%patch $E733 $8B $46 $FA $05 [$FFC7W] $50 $57 $56 $9A {$0EFC0420RL} $83 $C4
$06 $8B $5E $FA $D1 $E3 $8B $9F [$17D8W] $D1 $E3 $C7 $87 $CCFFW
$0001W $E9 $016FW
#Orbatrix initiation code
%patch $E758 $83 $3E {$75A8W} [$03] {$7D} $03 $E9 $0165W $83 $3E {$75A8W} [$02] {$7D}
$03 $E9 $015BW $57 $56 $9A {$10CC081ERL} $83 $C4 $04 $C7 $06
$CD39W $0001W $E9 $0148W
#Bipship initiation code
%patch $E77F $83 $3E {$75A8W} [$03] {$7D} $03 $E9 $013EW $83 $3E {$75A8W} [$02] {$7D}
$03 $E9 $0134W $57 $56 $9A {$10CC0B03RL} $83 $C4 $04 $B8 $0001W
$A3 $CD33W $A3 $CD35W $A3 $CD31W $E9 $011BW
#Flect initiation code
%patch $E7AC $83 $3E {$75A8W} [$03] {$7D} $03 $E9 $0111W $83 $3E {$75A8W} [$02] {$7D}
$03 $E9 $0107W $57 $56 $9A {$10CC0E24RL} $83 $C4 $04 $C7 $06
$CD2FW $0001W $E9 $00F4W
#Blorb initiation code
%patch $E7D3 $83 $3E {$75A8W} [$03] {$7D} $03 $E9 $00EAW $83 $3E {$75A8W} [$02] {$7D}
$03 $E9 $00E0W $57 $56 $9A {$11CF06ACRL} $83 $C4 $04 $C7 $06
$CD27W $0001W $E9 $00CDW
#Ceilick initiation code
%patch $E7FA $83 $3E {$75A8W} [$03] {$7D} $03 $E9 $00C3W $83 $3E {$75A8W} [$02] {$7D}
$03 $E9 $00B9W $57 $56 $9A {$11CF07BCRL} $83 $C4 $04 $C7 $06
$CD3BW $0001W $E9 $00A6W
#Blooguard initiation code
%patch $E821 $83 $3E $75A8W [$03] {$7D} $03 $E9 $009CW $83 $3E $75A8W [$02] {$7D}
$03 $E9 $0092W $57 $56 $9A {$0EFC192ERL} $83 $C4 $04 $C7 $06
$CD2DW $0001W $E9 $007FW
#Grabbiter initiation code
%patch $E848 $57 $56 $9A {$0EFC0515RL} $83 $C4 $04 $EB $73
#Satellite initiation code
%patch $E854 $57 $56 $9A {$0EFC0D73RL} $83 $C4 $04 $EB $67
#Rope initiation code
%patch $E860 $57 $56 $9A {$0EFC0FD1RL} $83 $C4 $04 $C7 $06 $CD3FW $0001W
$EB $55
#Sandwich initiation code
%patch $E872 $57 $56 $9A {$0EFC0F90RL} $83 $C4 $04 $C7 $06 $CD41W $0001W
$EB $43
#Rocket pass initiation code
%patch $E884 $57 $56 $9A {$0EFC1012RL} $83 $C4 $04 $C7 $06 $CD45W $0001W
$EB $31
#Babobba initiation code
%patch $E896 $83 $3E $75A8W [$03] {$7C} $2A $83 $3E $75A8W [$02] {$7C} $23 $57 $56
$9A {$11CF0404RL} $83 $C4 $04 $C7 $06 $CD2BW $0001W $EB $11
#Rocket initiation code
%patch $E8B6 $8B $46 $FA $05 [$FF98W] $50 $57 $56 $9A {$0EFC06C3RL} $83 $C4
$06
Spawn codes
These are spawn codes found in Keen 6. Unlike the initiation codes, they are standalone and can be swapped about and edited as desired. Notice that usually the very last variable set in Galaxy is the sprite action; in Vorticons it is the location of the sprite code and collision.
Depending on the spawn code, different things may happen. Many spawn codes are of the same basic size and structure, simply tweaking a few basic sprite properties such as foreground and sprite type.
The last blue highlighted value is the sprite action the sprite uses as it proceeds to act in-level. $C7 $47 $02 $xxxxW sets the sprite activity, $C7 $47 $06 $xxxxW sets the clipping, $C7 $07 $xxxxW sets the sprite type, $C7 $20 $xxxxW sets the foreground value. Some sprites also have $C7 $47 $40 $xxxxW set its strength. Finally $D3 $E0 $05 $xxxx is how far down (Or more usually up) the sprite is spawned from where it is placed. This is necessary for sprites that walk on the ground as they can only be placed in the level at multiples of 16 pixels high while their actual height can be anything.
$C7 $47 $0E $xxxxW is the horizontal direction the sprite starts moving in, either $0001W (Facing right), $FFFFW (Facing left) or $0000W (Neither, never used.) $C7 $47 $10 $xxxxW is the vertical direction and works similarly. Some sprites have a probability check to determine which way they face; this is always 50:50 (Though it needn't be.) and the code responsible for this is $9A $1CF30034RL $3D $0080W
Keen 6 spawn codes
#Item spawn code
%patch $F3E0 $55 $8B $EC $56 $8B $76 $0A $33 $C0 $50 $9A $069A1E25RL $83
$C4 $02 $8B $1E $66 $A9 $C7 $47 $06 [$0000W] $C7 $47 $20 [$0002W]
$C7 $07 [$0005W] $8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B $46
$08 $D3 $E0 $89 $47 $0C $C7 $47 $10 [$FFFFW] $89 $77 $3E $8B $DE
$D1 $E3 $8B $87 [$1A78W] $8B $1E $66 $A9 $89 $47 $1E $89 $47 $40
$8B $47 $40 $05 [$0002W] $89 $47 $42 $B8 [$196AW] $50 $53 $9A
$08F41219RL $83 $C4 $04 $5E $5D $CB
#Grabbiter spawn code
%patch $F4D5 $55 $8B $EC $33 $C0 $50 $9A $069A1E25RL $83 $C4 $02 $8B $1E
$66 $A9 $C7 $47 $02 [$0001W] $C7 $47 $06 [$0000W] $C7 $47 $20 [$0002W]
$C7 $07 [$001EW] $8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B
$46 $08 $D3 $E0 $89 $47 $0C $83 $3E {$7594W} [$02] {$75} $0F $B8 [$1ACCW]
$50 $53 $9A $08F41219RL $83 $C4 $04 $5D $CB
$B8 [$1A90W]
$50 $FF $36 $66 $A9 $9A $08F41219RL $83 $C4 $04 $5D $CB
#Satellite dropoff point spawn code
%patch $FCB3 $55 $8B $EC $56 $57 $8B $76 $06 $8B $7E $08 $33 $C0 $50 $9A
$069A1E25RL $83 $C4 $02 $8B $1E $66 $A9 $C7 $47 $02 [$0002W] $C7
$47 $06 [$0000W] $C7 $47 $20 [$0002W] $C7 $07 [$0022W] $8B $C6 $89
$47 $30 $89 $47 $2C $8B $C7 $89 $47 $32 $89 $47 $2E $8B $46 $0A
$35 [$0001W] $40 $89 $47 $3E $8B $C6 $B1 $08 $D3 $E0 $89 $47 $22
$89 $47 $0A $8B $47 $22 $05 [$0100W] $89 $47 $26 $8B $C7 $D3 $E0
$89 $47 $24 $89 $47 $0C $8B $47 $24 $05 [$0100W] $89 $47 $28 $B8
[$1C52W] $50 $53 $9A $08F41219RL $83 $C4 $04 $5F $5E $5D $CB
#Satellite spawning code
%patch $FD33 $55 $8B $EC $83 $EC $02 $56 $57 $8B $76 $06 $8B $7E $08 $33 $C0
$50 $9A $069A1E25RL $83 $C4 $02 $8B $1E $66 $A9 $C7 $47 $06
[$0000W] $C7 $47 $20 [$0002W] $C7 $47 $02 [$0002W] $C7 $07 [$0021W]
$8B $C6 $B1 $08 $D3 $E0 $89 $47 $0A $8B $C7 $D3 $E0 $89 $47 $0C
$C7 $47 $0E [$0000W] $C7 $47 $10 [$0001W] $B8 [$1C8EW] $50 $53 $9A
$08F41219RL $83 $C4 $04 $C7 $46 $FE [$0003W] $8B $46 $FE $05
[$005BW] $8B $DF $D1 $E3 $8B $9F $8B $CA $D1 $EB $D1 $E3 $8E $06
$79 $A9 $8B $D6 $D1 $E2 $03 $DA $26 $89 $07 $8B $1E $66 $A9 $8B
$46 $FE $89 $47 $3E $C7 $47 $40 [$0100W] $C7 $47 $44 [$0002W] $5F
$5E $8B $E5 $5D $CB
#Sandwich spawning code
%patch $FF50 $55 $8B $EC $33 $C0 $50 $9A $069A1E25RL $83 $C4 $02 $8B $1E
$66 $A9 $C7 $47 $06 [$0000W] $C7 $47 $20 [$0002W] $C7 $07 [$001BW]
$8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B $46 $08 $D3 $E0 $89
$47 $0C $B8 [$1D06W] $50 $53 $9A $08F41219RL $83 $C4 $04 $5D
$CB
#Rope spawning code
%patch $FF91 $55 $8B $EC $33 $C0 $50 $9A $069A1E25RL $83 $C4 $02 $8B $1E
$66 $A9 $C7 $47 $06 [$0000W] $C7 $47 $20 [$0002W] $C7 $07 [$001CW]
$8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B $46 $08 $D3 $E0 $89
$47 $0C $B8 [$1D24W] $50 $53 $9A $08F41219RL $83 $C4 $04 $5D
$CB
#Passcard spawning code
%patch $FFD2 $55 $8B $EC $33 $C0 $50 $9A $069A1E25RL $83 $C4 $02 $8B $1E
$66 $A9 $C7 $47 $06 [$0000W] $C7 $47 $20 [$0002W] $C7 $07 [$001DW]
$8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B $46 $08 $D3 $E0 $89
$47 $0C $B8 [$1D42W] $50 $53 $9A $08F41219RL $83 $C4 $04 $5D
$CB
#Molly spawning code
%patch $1006B $55 $8B $EC $33 $C0 $50 $9A $069A1E25RL $83 $C4 $02 $8B $1E
$66 $A9 $C7 $07 [$000CW] $C7 $47 $02 [$0001W] $C7 $47 $20 [$0000W]
$8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B $46 $08 $D3 $E0 $05
[$FF80W] $89 $47 $0C $9A $1CF30034RL $3D [$0080W] $7D $0B $8B
$1E $66 $A9 $C7 $47 $0E [$0001W] $EB $09 $8B $1E $66 $A9 $C7 $47
$0E [$FFFFW] $8B $1E $66 $A9 $C7 $47 $10 [$0001W] $B8 [$1D60W] $50
$53 $9A $08F41219RL $83 $C4 $04 $5D $CB
#Horizontal-Vertical Platform spawn code
%patch $100D6 $55 $8B $EC $33 $C0 $50 $9A $069A1E25RL $83 $C4 $02 $8B $1E
$66 $A9 $C7 $07 [$0006W] $C7 $47 $02 [$0002W] $C7 $47 $20 [$0000W]
$8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B $46 $08 $D3 $E0 $89
$47 $0C $8B $5E $0A $83 $FB [$03] {$77} $45 $D1 $E3 $2E $FF $A7 #3 + 1 Platform types
{$11A8W} $8B $1E $66 $A9 $C7 $47 $0E [$0000W] $C7 $47 $10 [$FFFFW] $EB #List location, up code
$2E $8B $1E $66 $A9 $C7 $47 $0E [$0001W] $C7 $47 $10 [$0000W] $EB #Right code
$1E $8B $1E $66 $A9 $C7 $47 $0E [$0000W] $C7 $47 $10 [$0001W] $EB #Down code
$0E $8B $1E $66 $A9 $C7 $47 $0E [$FFFFW] $C7 $47 $10 [$0000W] $B8 #Left code
[$1DD8W] $50 $FF $36 $66 $A9 $9A $08F41219RL $83 $C4 $04 $5D
$CB
#Direction list
%patch $10168 [$1157W] #Up (At $10117)
%patch $1016A [$1167W] #Right (At $10127)
%patch $1016C [$1177W] #Down (At $10137)
%patch $1016E [$1187W] #Left (At $10147)
#Dropping Platform spawn code
%patch $10382 $55 $8B $EC $33 $C0 $50 $9A $069A1E25RL $83 $C4 $02 $8B $1E
$66 $A9 $C7 $07 [$0006W] $C7 $47 $02 [$0002W] $C7 $47 $20 [$0000W]
$8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B $46 $08 $D3 $E0 $89
$47 $3E $89 $47 $0C $C7 $47 $0E [$0000W] $C7 $47 $10 [$0001W] $C7
$47 $06 [$0000W] $B8 [$1DF6W] $50 $53 $9A $08F41219RL $83 $C4
$04 $5D $CB
#Sitting Platforms spawn code
%patch $104A6 $55 $8B $EC $33 $C0 $50 $9A $069A1E25RL $83 $C4 $02 $8B $1E
$66 $A9 $C7 $07 [$0006W] $C7 $47 $02 [$0001W] $C7 $47 $20 [$0000W]
$8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B $46 $08 $D3 $E0 $89
$47 $3E $89 $47 $0C $C7 $47 $0E [$0000W] $C7 $47 $10 [$0001W] $C7
$47 $06 [$0000W] $B8 [$1E50W] $50 $53 $9A $08F41219RL $83 $C4
$04 $5D $CB
#Path Following Platform spawn code
%patch $104F9 $55 $8B $EC $56 $57 $8B $76 $06 $8B $7E $08 $33 $C0 $50 $9A
$069A1E25RL $83 $C4 $02 $8B $1E $66 $A9 $C7 $07 [$0006W] $C7 $47
$02 [$0002W] $C7 $47 $20 [$0000W] $8B $C6 $B1 $08 $D3 $E0 $89 $47
$0A $8B $C7 $D3 $E0 $89 $47 $0C $C7 $47 $0E [$0000W] $C7 $47 $10
[$0001W] $C7 $47 $06 [$0000W] $B8 [$1E6EW] $50 $53 $9A $08F41219RL
$83 $C4 $04 $8B $46 $0A $05 [$005BW] $8B $DF $D1 $E3 $8B $9F
$8B $CA $D1 $EB $D1 $E3 $8E $06 $79 $A9 $8B $D6 $D1 $E2 $03 $DA
$26 $89 $07 $8B $1E $66 $A9 $8B $46 $0A $89 $47 $3E $C7 $47 $40
[$0100W] $5F $5E $5D $CB
#Sneaky Platform spawn code
%patch $10764 $55 $8B $EC $33 $C0 $50 $9A $069A1E25RL $83 $C4 $02 $8B $1E
$66 $A9 $C7 $07 [$0006W] $C7 $47 $02 [$0002W] $C7 $47 $20 [$0000W]
$8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $3E $89 $47 $0A $8B $46 $08
$D3 $E0 $89 $47 $0C $C7 $47 $0E [$0000W] $C7 $47 $10 [$0001W] $C7
$47 $06 [$0000W] $B8 [$1E8CW] $50 $53 $9A $08F41219RL $83 $C4
$04 $5D $CB
#Bloog spawn code
%patch $1082A $55 $8B $EC $33 $C0 $50 $9A $069A1E25RL $83 $C4 $02 $8B $1E
$66 $A9 $C7 $07 [$0007W] $C7 $47 $02 [$0001W] $C7 $47 $20 [$0000W]
$8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B $46 $08 $D3 $E0 $05
[$FE00W] $89 $47 $0C $9A $1CF30034RL $3D [$0080W] $7D $0B $8B
$1E $66 $A9 $C7 $47 $0E [$0001W] $EB $09 $8B $1E $66 $A9 $C7 $47
$0E [$FFFFW] $8B $1E $66 $A9 $C7 $47 $10 [$0001W] $B8 [$1EE6W] $50
$53 $9A $08F41219RL $83 $C4 $04 $5D $CB
#Blooguard spawning code
%patch $108EE $55 $8B $EC $33 $C0 $50 $9A $069A1E25RL $83 $C4 $02 $8B $1E
$66 $A9 $C7 $07 [$0018W] $C7 $47 $02 [$0001W] $C7 $47 $20 [$0000W]
$8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B $46 $08 $D3 $E0 $05
[$FD80W] $89 $47 $0C $9A $1CF30034RL $3D [$0080W] $7D $0B $8B
$1E $66 $A9 $C7 $47 $0E [$0001W] $EB $09 $8B $1E $66 $A9 $C7 $47
$0E [$FFFFW] $8B $1E $66 $A9 $C7 $47 $10 [$0001W] $C7 $47 $40 [$0003W]
$B8 [$1F7CW] $50 $53 $9A $08F41219RL $83 $C4 $04 $5D $CB
#Blooglet spawn code
%patch $10B20 $55 $8B $EC $56 $8B $76 $0A $33 $C0 $50 $9A $069A1E25RL $83
$C4 $02 $8B $1E $66 $A9 $C7 $07 [$0008W] $C7 $47 $02 [$0001W] $C7
$47 $20 [$0000W] $8B $46 $06 $B1 $08 $D3 $E0