Patch:Keen walking (Galaxy)
This page contains patches that relate to the player walking and under what conditions the player starts and stops doing so. It covers the three Keen Galaxy episodes. This page also covers patches relating to Keen standing still as these are closely related. It does not cover patches relating to Keen being bored, mooning or other actions where he doesn't move.
Other patches relating to Keen can be found under Keen (Keen 4), Keen (Keen 5), Keen (Keen 6) and Keen (Keen Dreams). Patches for Keen's walking in Vorticons and Dreams have their own pages.
Sprite Actions
Keen can go to standing under a variety of circumstances and likewise can do a number of things while standing. These are not covered here but instead covered on the pages of the action involved. (For example becoming bored.) Keen is spawned standing when he first starts a level. While standing he continues to stand as long as nothing else happens.
If Keen is 'keyblocked' that is, two opposite keys like left and right are pressed at the same time, he will remain standing. If he attempts to walk into a wall he will also be set to standing.
Keen will start walking when the arrow keys are pressed and he is on the ground. This somehow leads to four walking starts related in an unknown manner. Keen's walk cycle is four actions long, when the arrow keys are no longer pressed he will revert to standing.
Actions: -Keen 4 $098CW #Keen standing $1094W #Keen walking 1 $10B2W #Keen walking 2 $10D0W #Keen walking 3 $10EEW #Keen walking 4
Keen 4
#Spawn Keen -standing
%patch $B844 [$098CW]
#Keen standing keeps standing
%patch $2F818 [$098CW]
#Keen goes to standing when walking against walls
%patch $D415 [$098CW]
#Keen starts walking
%patch $BF7E [$1094W]
%patch $BFA0 [$10D0W]
%patch $BFC3 [$10B2W]
%patch $BFCA [$10EEW]
#Keen's walk loop
%patch $2FF20 [$10B2W]
%patch $2FF3E [$10D0W]
%patch $2FF5C [$10EEW]
%patch $2FF7A [$1094W]
#Keen stop walking
%patch $BE40 [$098CW]
#Unknown, adjust walking?
%patch $E876 [$1094W]
#Unknown, check walking?
%patch $ED7E [$1094W]
%patch $EDA0 [$10D0W]
%patch $EDC3 [$10B2W]
%patch $EDCA [$10EEW]
#Keyblock -stand
%patch $BBC3 [$098CW]
Sprite Behavior
Walking Keen only uses one behavior when walking, with an additional behavior when standing. The standing behavior is also used by many other actions where Keen does not move, such as his bored sequence.
Behaviors: $0B800395RL #Keen still -Keen 4 $0B80062CRL #Keen walking -Keen 4 $0AAF046DRL #Keen still -Keen 5 $0AAF0701RL #Keen walking -Keen 5 $0AA20610RL #Keen walking -Keen 6
Keen 4
#Keen standing behavior
%patch $2F80C $0B800395RL
#Keen walk behaviors
%patch $2FF14 $0B80062CRL
%patch $2FF32 $0B80062CRL
%patch $2FF50 $0B80062CRL
%patch $2FF6E $0B80062CRL
Keen 5
#Keen standing behavior
%patch $30BD8 $0AAF046DRL
#Keen walk behaviors
%patch $312C2 $0AAF0701RL
%patch $312E0 $0AAF0701RL
%patch $312FD $0AAF0701RL
%patch $3131C $0AAF0701RL
Keen 6
#Keen walk behaviors
%patch $31C4C $0AA20610RL
%patch $31C6A $0AA20610RL
%patch $31C88 $0AA20610RL
%patch $31CA6 $0AA20610RL
Standing behavior code
This is the complete code for Keen's standing behavior, used by many actions where the player stands still. It is divided up into several sections. The very first section checks for all possible player inputs, arrow keys, jump and shoot. If any of these keys are being pressed the game runs code to make Keen do stuff. (This is handled elsewhere and involves things like starting to walk or shoot.)
The remaining sections deal with Keen being bored. The second section refers to one of the following sections depending on the value of Keen's bored sprite variable. The third section starts Keen's first bored behavior if enough time has passed. The fourth and fifth start Keen's mooning or bored behavior if enough time has passed (and if he's standing on a moon tile.)The last section sets Keen's final bored behavior, again if enough time has passed.
Keen 4
#Keen standing behavior
%patch $BB95 $55 $8B $EC $56 $8B $76 $06 $83 $3E {$A7D2W} [$08] {$75} $15 $83 $3E
{$C5C9W} [$00] {$75} $0E $83 $3E {$C5C5W} [$00] {$75} $07 $83 $3E {$C5C1W}
[$00] {$74} $18 $33 $C0 $89 $44 $40 $89 $44 $3E $C7 $44 $1C {$098CW}
$56 $0E $E8 $FE9BW $83 $C4 $02 $5E $5D $CB
$8B $44 $36 $25 $F8
$FF $3D [$0018W] {$74} $0A $8B $44 $3E $03 $06 {$A54CW} $89 $44 $3E
$8B $44 $40 $0B $C0 {$74} $0D $3D [$0001W] $74 $22 $3D [$0002W] {$74}
$4C $5E $5D $CB
$81 $7C $3E [$00C8W] {$7E} $59 $FF $44 $40 $C7 $44
$1C {$09AAW} $C7 $44 $3E [$0000W] $5E $5D $CB $5E $5D $CB
$81 $7C
$3E [$012CW] {$7E} $3F $FF $44 $40 $C7 $44 $3E [$0000W] $83 $3E {$CAB5W}
[$01] {$75} $0E $C7 $06 {$CAB5W} [$0002W] $C7 $44 $1C {$0A7CW} $5E
$5D $CB
$C7 $44 $1C {$09C8W} $5E $5D $CB $5E $5D $CB
$81 $7C $3E
[$02BCW] {$7E} $10 $FF $44 $40 $C7 $44 $1C {$0AD6W} $C7 $44 $3E [$0000W]
$5E $5D $CB $5E $5D $CB
Walking behavior code
This is the complete code for Keen's walking behavior. It is divided up into several sections, some of unknown function. The very first section checks whether Keen is still walking, if not then his action is changed to standing.
The second and third sections are unknown, possibly involving Keen looking up and down. The fourth and fifth sections check to see if Keen is shooting, and if so his action is changed to shooting up or left\right respectively.
The sixth section deals with Keen jumping and pogoing while walking, it checks various keys and changes Keen's actions as expected. The remaining sections adjust Keen's walking and walking speed by checking his walking actions and setting his Misc C variable.
Keen 4
#Keen walking behavior
%patch $BE2C $55 $8B $EC $83 $EC $02 $56 $8B $76 $06 $83 $3E {$A7CEW} [$00] {$75}
$12 $C7 $44 $1C {$098CW} $56 $0E $E8 $FC1EW $83 $C4 $02 $5E $8B
$E5 $5D $CB
$A1 {$A7CEW} $89 $44 $0E $A1 {$A7D0W} $3D [$FFFFW] {$74}
$07 $3D [$0001W] {$74} $31 $EB $45 $56 $0E $E8 $F9E9W $83 $C4 $02
$0B $C0 {$74} $03 $E9 $0160W $83 $3E {$C5BDW} [$00] {$74} $03 $E9 $0156W
$56 $0E $E8 $FAB5W $83 $C4 $02 $0B $C0 {$74} $03 $E9 $0147W
$EB $1B $5E $8B $E5 $5D $CB
$56 $0E $E8 $F9BAW $83 $C4 $02 $0B
$C0 {$74} $03 $E9 $0131W $EB $05 $5E $8B $E5 $5D $CB
$83 $3E {$C5C1W}
[$00] {$74} $2D $83 $3E {$C5BFW} [$00] {$75} $26 $C7 $06 {$C5BFW} [$0001W]
$83 $3E {$A7D0W} [$FF] {$75} $0A $C7 $44 $1C {$0DA6W} $5E $8B $E5
$5D $CB
$C7 $44 $1C {$0D6AW} $5E $8B $E5 $5D $CB $5E $8B $E5 $5D
$CB
$83 $3E {$C5C9W} [$00] {$74} $3B $83 $3E {$C5C7W} [$00] {$75} $34 $C7
$06 {$C5C7W} [$0001W] $B8 [$0002W] $50 $9A $187409F1RL $83 $C4
$02 $8B $44 $0E $B1 $04 $D3 $E0 $89 $44 $16 $C7 $44 $18 [$FFD8W]
$33 $C0 $A3 {$C921W} $A3 {$C923W} $C7 $06 {$CABBW} [$0012W] $C7 $44
$1C {$1166W} $83 $3E {$C5C5W} [$00] {$74} $3E $83 $3E {$C5C3W} [$00] {$75}
$37 $C7 $06 {$C5C3W} [$0001W] $C7 $44 $1C {$110CW} $B8 [$0002W] $50
$9A $187409F1RL $83 $C4 $02 $8B $44 $0E $B1 $04 $D3 $E0 $89
$44 $16 $C7 $44 $18 [$FFD0W] $C7 $06 {$C923W} [$0000W] $C7 $06 {$CABBW}
[$0018W] $5E $8B $E5 $5D $CB
$8B $5C $36 $83 $E3 $07 $D1 $E3
$8B $87 [$13BEW] $F7 $2E $4C $A5 $89 $46 $FE $01 $06 {$C923W} $81
$7C $1C {$1094W} {$75} $1B $83 $7C $42 [$00] {$75} $15 $33 $C0 $50 $9A
$187409F1RL $83 $C4 $02 $C7 $44 $42 [$0001W] $5E $8B $E5 $5D
$CB
$81 $7C $1C {$10D0W} {$75} $1C $83 $7C $42 [$00] {$75} $16 $B8 [$0001W]
$50 $9A $187409F1RL $83 $C4 $02 $C7 $44 $42 [$0001W] $5E
$8B $E5 $5D $CB
$81 $7C $1C {$10B2W} {$74} $07 $81 $7C $1C {$10EEW}
{$75} $05 $C7 $44 $42 [$0000W] $5E $8B $E5 $5D $CB
Ground reactions
When Keen is 'on the ground' (Standing, walking, most of his bored sequence, etc.) his behaviors point to a shared segment of code that handles keypresses. This avoids requiring a large segment of code for every separate behavior. It handles everything Keen can do while on the ground; shooting, jumping, pogoing and looking up\down.
This is the complete code for Keen's input handling when he is on the ground (Standing or walking). The first section checks to see if a left or right arrow is being pressed. If it is Keen is sent into his first walking action, with a delay of 4 ticks.
The second section deals with space being pressed. First the key is checked, then the 'is Keen shooting already?' variable. If he is then the game skips to the next section. If he isn't then the game sets this to 1. Then Keen's vertical direction is checked; if Keen is looking up (Vertical direction is -1) he goes to the 'shoot up' action. Otherwise he goes to the 'shoot horizontally' action.
The third section does a similar thing with jumping, the key is checked then 'is Keen jumping already?' If Keen can jump then sound $02 is played, Keen's horizontal speed is set to 0 and his vertical speed to $FFD8W (upwards). Keen is given a 'jump duration' of $12 and his action is changed to his first jumping action.
Section 4 is near identical but involving pogoing. (In fact it even plays the same sound, even though this will be overwritten by the actual pogo sound.) This time the 'pogo duration' is $18.
Section 5 deals with Keen looking up or down. First his looking direction is checked, whether it is +-1. If it is neither the code stops. Looking up is run first; Keen's sprite is sent to some checking code, if this returns anything but zero the remaining code is skipped. Otherwise a variable is checked, if it too is zero Keen's sprite is sent to a second bit of code. If this returns anything but zero the code skips to the end, otherwise it sets Keen's action to 'look up'.
After this is looking down; it sends Keen's sprite to a check and, if this returns anything but zero, changes his action to 'look down'.
Keen 4
#Keen Ground Input code
%patch $BA65 $55 $8B $EC $56 $8B $76 $06 $83 $3E $A7CEW $00 $74 $27 $C7 $44 #Walk
$1C [$1094W] $56 $90 $0E $E8 $03AEW $83 $C4 $02 $8B $44 $0E $8B
$5C $1C $F7 $6F $0C $F7 $2E $A54CW $BB $0004W $99 $F7 $FB $A3
$C923W $5E $5D $CB
$83 $3E {$C5C1W} $00 $74 $27 $83 $3E $C5BFW #Shoot
$00 $75 $20 $C7 $06 $C5BFW $0001W $83 $3E $A7D0W $FF $75 $08
$C7 $44 $1C [$0DA6W] $5E $5D $CB $C7 $44 $1C [$0D6AW] $5E $5D $CB
$5E $5D $CB
$83 $3E {$C5C9W} $00 $74 $37 $83 $3E $C5C7W $00 $75 #Jump
$30 $C7 $06 $C5C7W $0001W $B8 [$0002W] $50 $9A $187409F1RL
$83 $C4 $02 $C7 $44 $16 [$0000W] $C7 $44 $18 [$FFD8W] $C7 $06 $C921W
$0000W $C7 $06 $CABBW [$0012W] $C7 $44 $1C [$1166W] $5E $5D
$CB
$83 $3E {$C5C5W} $00 $74 $37 $83 $3E $C5C3W $00 $75 $30 $C7 #Pogo
$06 $C5C3W $0001W $B8 [$0002W] $50 $9A $187409F1RL $83 $C4
$02 $C7 $44 $1C [$110CW] $C7 $44 $16 [$0000W] $C7 $44 $18 [$FFD0W]
$C7 $06 $C921W $0000W $C7 $06 $CABBW [$0018W] $5E $5D $CB
$A1 #Look up\down
$A7D0W $3D [$FFFFW] $74 $08 $3D [$0001W] $74 $2D $5E $5D $CB $56
$0E $E8 $FCF9W $83 $C4 $02 $0B $C0 $75 $32 $83 $3E $C5BDW $00
$75 $0C $56 $0E $E8 $FDCBW $83 $C4 $02 $0B $C0 $75 $1F $C7 $44
$1C [$0C02W] $5E $5D $CB $5E $5D $CB $56 $0E $E8 $FCCFW $83 $C4
$02 $0B $C0 $75 $08 $C7 $44 $1C [$0C3EW] $0C $5E $5D $CB $5E $5D $CB
Speed
Keen has a constant animation speed when running that depends both on the values listed here and how fast he animates. Keen has no horizontal speed when standing still, but does attempt to move down, for unknown reasons.
Keen also slows down or speeds up going up and down slopes respectively; the speed changes are stored in a list accessed by the walking behavior. The values in the list are for Keen moving right, when Keen moves left the value is reversed. (So for example when walking right over a Top->bottom tile Keen's speed is increased by 8 as this is downhill. When walking left, or uphill, his speed is slowed by 8.)
Keen 4
#Keen standing speed
%patch $2F808 [$0000W $0020W]
#Keen running speeds
%patch $2FF10 [$0018W $0000W]
%patch $2FF2E [$0018W $0000W]
%patch $2FF4C [$0018W $0000W]
%patch $2FF6A [$0018W $0000W]
#Modifier list location
%patch $BF6E [$13BEW]
#Walking speed modifiers
%patch $3022E [$0000W] #No ground (Don't affect speed)
[$0000W] #Walking on flat (Don't affect speed)
[$0004W] #Top -> middle (Increase by 4)
[$0004W] #Middle -> bottom (Increase by 4)
[$0008W] #Top -> bottom (Increase by 8)
[$FFFCW] #Bottom -> middle (Decrease by 4)
[$FFFCW] #Middle -> top (Decrease by 4)
[$FFF8W] #Bottom -> top (Decrease by 8)
[$FFF8W] #??? (Decrease by 8)
[$0000W] #??? (Don't affect speed)
[$0008W] #??? (Increase by 8)
Keen 5
#Keen standing speed
%patch $30BD4 [$0000W $0020W] #Standing
%patch $30BF2 [$0000W $0020W] #Standing on Platforms
#Keen running speeds
%patch $312BE [$0018W $0000W]
%patch $312DC [$0018W $0000W]
%patch $312FA [$0018W $0000W]
%patch $31318 [$0018W $0000W]
#Walking speed modifiers
%patch $315DC [$0000W] #No ground (Don't affect speed)
[$0000W] #Walking on flat (Don't affect speed)
[$0004W] #Top -> middle (Increase by 4)
[$0004W] #Middle -> bottom (Increase by 4)
[$0008W] #Top -> bottom (Increase by 8)
[$FFFCW] #Bottom -> middle (Decrease by 4)
[$FFFCW] #Middle -> top (Decrease by 4)
[$FFF8W] #Bottom -> top (Decrease by 8)
[$FFF8W] #??? (Decrease by 8)
[$0000W] #??? (Don't affect speed)
[$0008W] #??? (Increase by 8)
Keen 6
#Keen standing speed
%patch $315D6 [$0000W $0020W]
#Keen running speeds
%patch $31C48 [$0018W $0000W]
%patch $31C66 [$0018W $0000W]
%patch $31C84 [$0018W $0000W]
%patch $31CA2 [$0018W $0000W]
#Walking speed modifiers
%patch $31F66 [$0000W] #No ground (Don't affect speed)
[$0000W] #Walking on flat (Don't affect speed)
[$0004W] #Top -> middle (Increase by 4)
[$0004W] #Middle -> bottom (Increase by 4)
[$0008W] #Top -> bottom (Increase by 8)
[$FFFCW] #Bottom -> middle (Decrease by 4)
[$FFFCW] #Middle -> top (Decrease by 4)
[$FFF8W] #Bottom -> top (Decrease by 8)
[$FFF8W] #??? (Decrease by 8)
[$0000W] #??? (Don't affect speed)
[$0008W] #??? (Increase by 8)
Sprite Collision
Keen really has only one sprite collision and this is used in most of his actions. Naturally this includes both standing and walking. The actual collision is explained and dissected on Keen's main pages, Keen (Keen 4), Keen (Keen 5) and Keen (Keen 6)
Keen 4
#Standing
%patch $2F810 $0B8014A9RL
#Walking
%patch $2FF18 $0B8014A9RL
%patch $2FF36 $0B8014A9RL
%patch $2FF54 $0B8014A9RL
%patch $2FF72 $0B8014A9RL
Keen 5
#Standing
%patch $30BDC $0AAF1597RL
#Standing on platforms
%patch $30BFA $0AAF1597RL
#Walking
%patch $312C6 $0AAF1597RL
%patch $312E4 $0AAF1597RL
%patch $31302 $0AAF1597RL
%patch $31320 $0AAF1597RL
Keen 6
#Standing
%patch $315DE $0AA2144ARL
#Walking
%patch $31C50 $0AA2144ARL
%patch $31C6E $0AA2144ARL
%patch $31C8C $0AA2144ARL
%patch $31CAA $0AA2144ARL
Animations
Keen's walking sequence consists of four actions. These behave pretty simply using eight total animations animating every 6 ticks. Keen's standing sequence is a single action whose 'animation' speed controls how quickly Keen responds to outside influences. (By default it's 4, faster tan most visible game changes.)
Keen 4
#Keen standing animations
%patch $2F7FC $008AW $0082W
%patch $2F806 $0004W
#Keen walking animations
%patch $2FF04 $008BW $0083W
%patch $2FF0E $0006W
%patch $2FF22 $008CW $0084W
%patch $2FF2C $0006W
%patch $2FF40 $008DW $0085W
%patch $2FF4A $0006W
%patch $2FF5E $008EW $0086W
%patch $2FF68 $0006W
Keen 5
#Keen standing animations
%patch $30BC8 $0074W $006CW #Keen standing
%patch $30BD2 $0004W
%patch $30BE6 $008BW $008BW #Keen on platforms
%patch $30BF0 $0004W
#Keen walking animations
%patch $312B2 $0075W $006DW
%patch $312BC $0006W
%patch $312D0 $0076W $006EW
%patch $312DA $0006W
%patch $312EE $0077W $006FW
%patch $312F8 $0006W
%patch $3130C $0078W $0070W
%patch $31316 $0006W
Keen 6
#Keen standing animations
%patch $2F7FC $008AW $0082W
%patch $2F806 $0004W
#Keen walking animations
%patch $31C3C $003DW $0035W
%patch $31C46 $0006W
%patch $31C5A $003EW $0036W
%patch $31C64 $0006W
%patch $31C78 $003FW $0037W
%patch $31C82 $0006W
%patch $31C96 $0040W $0038W
%patch $31CA0 $0006W
Sounds
There are four sounds used by Keen's walking behavior. The first is when he starts jumping, the second when he starts pogoing and the third\fourth while walking itself.
The first walking sound is sound 0, giving it a different patch structure from all other sounds and making it exceedingly difficult to alter, though it can be silenced easily enough.
Keen 4
%patch $BEF2 $02 #Keen jumps while walking sound
%patch $BEF1 $EB $0A #Don't play Keen jumps while walking sound
%patch $BF39 $02 #Keen starts pogoing while walking sound
%patch $BF38 $EB $0A #Don't play Keen starts pogoing while walking sound
%patch $BF88 $C033W #Keen walking sound 1 (Sound 0!)
%patch $BF88 $EB $09 #Don't play Keen walking sound 1
%patch $BFAB $01 #Keen walking sound 2 sound
%patch $BFAA $EB $0A #Don't play Keen walking sound 2
Keen 5
%patch $B2B7 $02 #Keen jumps while walking sound
%patch $B2B6 $EB $0A #Don't play Keen jumps while walking sound
%patch $B2FE $02 #Keen starts pogoing while walking sound
%patch $B2FD $EB $0A #Don't play Keen starts pogoing while walking sound
%patch $B34D $C033W #Keen walking sound sound 1 (Sound 0!)
%patch $B34D $EB $09 #Don't play Keen walking sound 1
%patch $AE0A $01 #Keen enter door sound 2
%patch $AE09 $EB $0A #Don't play Keen enter door sound 2
Keen 6
%patch $B0F3 $02 #Keen jumps while walking sound
%patch $B0F2 $EB $0A #Don't play Keen jumps while walking sound
%patch $B13A $02 #Keen starts pogoing while walking sound
%patch $B139 $EB $0A #Don't play Keen starts pogoing while walking sound
%patch $B189 $C033W #Keen walking sound sound 1
%patch $B189 $EB $09 #Don't play Keen walking sound 1
%patch $B1AC $01 #Keen walking sound 2
%patch $B1AB $EB $0A #Don't play Keen walking sound 2
Sprite-tile interaction
Keen has two interactions, one while standing and one while walking. Keen's standing interaction deals with him landing on flat ground and being moved by conveyor belts.
Keen 4
#Standing
%patch $2F814 $0B801AA2RL
#Walking
%patch $2FF1C $0B801B5FRL
%patch $2FF3A $0B801B5FRL
%patch $2FF58 $0B801B5FRL
%patch $2FF76 $0B801B5FRL
Keen 5
#Standing
%patch $30BE0 $0AAF1AC6RL
#Standing on platforms
%patch $30BFE $0AAF1AC6RL
#Walking
%patch $312CA $0AAF1B83RL
%patch $312E8 $0AAF1B83RL
%patch $31306 $0AAF1B83RL
%patch $31324 $0AAF1B83RL
Keen 6
#Standing
%patch $315E2 $0AA2197CRL
#Walking
%patch $31C54 $0AA21A39RL
%patch $31C72 $0AA21A39RL
%patch $31C90 $0AA21A39RL
%patch $31CAE $0AA21A39RL
Standing interaction code
This is the complete code for Keen's standing tile interaction. In Keen Galaxy the first line checks whether Keen is standing on solid ground. If not the falling sequence is activated. Sound $14 plays, Keen's vertical speed is set to 0 and he changes to the falling action ($11A2 in Keen 4, $1080W in Keen 5 and $101AW in Keen 6). After this Keen's jump variable is set to 0, preventing him from jumping while falling.
On line 5 the 'deadly and can't land on in God Mode' type is checked for in an unusual manner. If Keen contacts this type then the 'kill Keen' code is run.
Lines 6-9 deal with conveyor belts, these make Keen move left or right when he stands on them. The first check is for rightwards conveyors, top-flag $29. These increase Keen's horizontal speed and set his vertical speed to 0 as well as setting his 'bored time' ($3E) to 0 so he will not become bored on conveyors. Line 8 checks for leftwards conveyors doing the same thing, except changing Keen's horizontal speed by -8.
The last three lines draw Keen's sprite on the screen.
Keen's standing tile interaction
#Keen 4 standing tile interaction =$0B801AA2RL
%patch $D2A2 $55 $8B $EC $56 $8B $76 $06 $83 $7C {$36} [$00] {$75} $32 $B8 [$0014W] #Fall check
$50 $9A $187409F1RL $83 $C4 $02 $8B $44 $0E $D1 $E0 $D1 $E0
$D1 $E0 $89 $44 $16 $C7 $44 $18 [$0000W] $B8 [$11A2W] $50 $56 $9A
$09DC120ARL $83 $C4 $04 $C7 $06 {$CABBW} [$0000W] $EB $5E $8B
$44 {$36} [$25] [$FFF8W] $3D [$0008W] {$75} $06 $0E $E8 $F8F9W $EB $4D
$83 $7C {$36} [$29] {$75} $22 $A1 {$A54CW} $D1 $E0 $D1 $E0 $D1 $E0 $A3 #Conveyor r
{$C923W} $C7 $06 {$C921W} [$0000W] $C7 $44 $3E [$0000W] $56 $9A
$09DC06A5RL $83 $C4 $02 $EB $25 $83 $7C {$36} [$31] {$75} $1F $A1 {$A54CW} #Conveyor l
$BA [$FFF8W] $F7 $EA $A3 {$C923W} $C7 $06 {$C921W} [$0000W] $C7
$44 $3E [$0000W] $56 $9A $09DC06A5RL $83 $C4 $02 $FF $74 $20
$33 $C0 $50 $FF $74 $1E $FF $74 $0C $FF $74 $0A $8B $C6 $05 $46
$00 $50 $9A $16541641RL $83 $C4 $0C $5E $5D $CB
#Keen 5 standing tile interaction =$0AAF1AC6RL
%patch $C5B6 $55 $8B $EC $56 $8B $76 $06 $83 $7C {$36} [$00] {$75} $32 $B8 [$0014W] #Fall check
$50 $9A $196E09EFRL $83 $C4 $02 $8B $44 $0E $D1 $E0 $D1 $E0
$D1 $E0 $89 $44 $16 $C7 $44 $18 [$0000W] $B8 [$1080W] $50 $56 $9A
$090B1242RL $83 $C4 $04 $C7 $06 {$C181W} [$0000W] $EB $5E $8B
$44 {$36} [$25] [$FFF8W] $3D [$0008W] {$75} $06 $0E $E8 $FA03W $EB $4D
$83 $7C {$36} [$29] {$75} $22 $A1 {$9BB4W} $D1 $E0 $D1 $E0 $D1 $E0 $A3 #Conveyor r
{$BF85W} $C7 $06 {$BF83W} [$0000W] $C7 $44 $3E [$0000W] $56 $9A
$090B0710RL $83 $C4 $02 $EB $25 $83 $7C {$36} [$31] {$75} $1F $A1 {$9BB4W} #Conveyor l
$BA [$FFF8W] $F7 $EA $A3 {$BF85W} $C7 $06 {$BF83W} [$0000W] $C7
$44 $3E [$0000W] $56 $9A $090B0710RL $83 $C4 $02 $FF $74 $20
$33 $C0 $50 $FF $74 $1E $FF $74 $0C $FF $74 $0A $8B $C6 $05 $46
$00 $50 $9A $174E163ERL $83 $C4 $0C $5E $5D $CB
#Keen 6 standing tile interaction
%patch $C39C $55 $8B $EC $56 $8B $76 $06 $83 $7C {$36} [$00] {$75} $32 $B8 [$0014W] #Fall check
$50 $9A $183B09F1RL $83 $C4 $02 $8B $44 $0E $D1 $E0 $D1 $E0
$D1 $E0 $89 $44 $16 $C7 $44 $18 [$0000W] $B8 [$101AW] $50 $56 $9A
$08F41297RL $83 $C4 $04 $C7 $06 {$CC21W} [$0000W] $EB $5E $8B
$44 {$36} [$25] [$FFF8W] $3D [$0008W] {$75} $06 $0E $E8 $FA00W $EB $4D
$83 $7C {$36} [$29] {$75} $22 $A1 {$A6DAW} $D1 $E0 $D1 $E0 $D1 $E0 $A3 #Conveyor r
{$CA89W} $C7 $06 {$CA87W} [$0000W] $C7 $44 $3E [$0000W] $56 $9A
$08F406A5RL $83 $C4 $02 $EB $25 $83 $7C {$36} [$31] {$75} $1F $A1 {$A6DAW} #Conveyor l
$BA [$FFF8W] $F7 $EA $A3 {$CA89W} $C7 $06 {$CA87W} [$0000W] $C7
$44 $3E [$0000W] $56 $9A $08F406A5RL $83 $C4 $02 $FF $74 $20
$33 $C0 $50 $FF $74 $1E $FF $74 $0C $FF $74 $0A $8B $C6 $05 $46
$00 $50 $9A $16081770RL $83 $C4 $0C $5E $5D $CB
Walking interaction code
This is the complete code for Keen's standing tile interaction. In Keen Galaxy the first line checks whether Keen is standing on solid ground. If not the falling sequence is activated. Sound $14 plays, Keen's vertical speed is set to 0 and he changes to the falling action ($11A2 in Keen 4, $1080W in Keen 5 and $101AW in Keen 6). After this Keen's jump variable is set to 0, preventing him from jumping while falling.
On line 5 the 'deadly and can't land on in God Mode' type is checked for in an unusual manner. If Keen contacts this type then the 'kill Keen' code is run.
Lines 6-9 deal with conveyor belts, these make Keen move left or right when he stands on them. The first check is for rightwards conveyors, top-flag $29. These increase Keen's horizontal speed and set his vertical speed to 0. Line 8 checks for leftwards conveyors doing the same thing, except changing Keen's horizontal speed by -8.
On line 10 checks are made for Keen walking into walls. First the code checks to see if Keen is touching a left wall. If so, it then checks to see if he is moving left. If so then the next two checks are skipped to go to wall-blocking. Otherwise the game then checks to see if Keen is touching a right wall, and if so whether he's moving right. Together these checks see if Keen is trying to walk into walls. If so then his action timer is set to 0 (Stopping him animating.) and his action to 'standing' Keen's direction is then checked again and his left or right standing animation taken from game data and applied immediately to his current animation. (So he immediately goes to standing when hitting a wall.)
The last three lines draw Keen's sprite on the screen.
Keen's standing tile interaction
#Keen 4 walking tile interaction
%patch $D35F $55 $8B $EC $56 $8B $76 $06 $83 $7C {$36} [$00] {$75} $33 $B8 [$0014W] #Fall check
$50 $9A $187409F1RL $83 $C4 $02 $8B $44 $0E $D1 $E0 $D1 $E0
$D1 $E0 $89 $44 $16 $C7 $44 $18 [$0000W] $B8 [$11A2W] $50 $56 $9A
$09DC120ARL $83 $C4 $04 $C7 $06 {$CABBW} [$0000W] $E9 $0089W
$8B $44 $36 $25 [$FFF8W] $3D [$0008W] {$75} $06 $0E $E8 $F83BW $EB
$78 $83 $7C $36 [$29] {$75} $1D $A1 {$A54CW} $D1 $E0 $D1 $E0 $D1 $E0 #Conveyor right
$A3 {$C923W} $C7 $06 {$C921W} [$0000W] $56 $9A $09DC06A5RL $83
$C4 $02 $EB $55 $83 $7C $36 [$31] {$75} $1C $A1 {$A54CW} $BA [$FFF8W] #Conveyor left
$F7 $EA $A3 {$C923W} $C7 $06 {$C921W} [$0000W] $56 $9A $09DC06A5RL
$83 $C4 $02 $EB $33 $83 $7C {$38} [$00] {$74} $06 $83 $7C $0E [$FF] #Walls
{$74} $0C $83 $7C {$3C} [$00] {$74} $21 $83 $7C $0E [$01] {$75} $1B $C7 $44
$1A [$0000W] $C7 $44 $1C [$098CW] $83 $7C $0E [$01] {$75} $05 $A1 [$098EW]
$EB $03 $A1 [$098CW] $89 $44 $1E $FF $74 $20 $33 $C0 $50 $FF
$74 $1E $FF $74 $0C $FF $74 $0A $8B $C6 $05 $46 $00 $50 $9A
$16541641RL $83 $C4 $0C $5E $5D $CB
Keen's standing tile interaction
#Keen 5 walking tile interaction
%patch $C673 $55 $8B $EC $56 $8B $76 $06 $83 $7C {$36} [$00] {$75} $33 $B8 [$0014W] #Fall check
$50 $9A $196E09EFRL $83 $C4 $02 $8B $44 $0E $D1 $E0 $D1 $E0
$D1 $E0 $89 $44 $16 $C7 $44 $18 [$0000W] $B8 [$1080W] $50 $56 $9A
$090B1242RL $83 $C4 $04 $C7 $06 {$C181W} [$0000W] $E9 $0089W
$8B $44 $36 $25 [$FFF8W] $3D [$0008W] {$75} $06 $0E $E8 $F945W $EB
$78 $83 $7C $36 [$29] {$75} $1D $A1 {$9BB4W} $D1 $E0 $D1 $E0 $D1 $E0 #Conveyor right
$A3 {$BF85W} $C7 $06 {$BF83W} [$0000W] $56 $9A $090B0710RL $83
$C4 $02 $EB $55 $83 $7C $36 [$31] {$75} $1C $A1 {$9BB4W} $BA [$FFF8W] #Conveyor left
$F7 $EA $A3 {$BF85W} $C7 $06 {$BF83W} [$0000W] $56 $9A $090B0710RL
$83 $C4 $02 $EB $33 $83 $7C {$38} [$00] {$74} $06 $83 $7C $0E [$FF] #Walls
{$74} $0C $83 $7C {$3C} [$00] {$74} $21 $83 $7C $0E [$01] {$75} $1B $C7 $44
$1A [$0000W] $C7 $44 $1C [$0888W] $83 $7C $0E [$01] {$75} $05 $A1 [$088AW]
$EB $03 $A1 [$0888W] $89 $44 $1E $FF $74 $20 $33 $C0 $50 $FF
$74 $1E $FF $74 $0C $FF $74 $0A $8B $C6 $05 $46 $00 $50 $9A
$174E163ERL $83 $C4 $0C $5E $5D $CB
Keen's standing tile interaction
#Keen 6 walking tile interaction
%patch $C459 $55 $8B $EC $56 $8B $76 $06 $83 $7C {$36} [$00] {$75} $33 $B8 [$0014W] #Fall check
$50 $9A $183B09F1RL $83 $C4 $02 $8B $44 $0E $D1 $E0 $D1 $E0
$D1 $E0 $89 $44 $16 $C7 $44 $18 [$0000W] $B8 [$101AW] $50 $56 $9A
$08F41297RL $83 $C4 $04 $C7 $06 {$CC21W} [$0000W] $E9 $0089W
$8B $44 $36 $25 [$FFF8W] $3D [$0008W] {$75} $06 $0E $E8 $F942W $EB
$78 $83 $7C $36 [$29] {$75} $1D $A1 {$A6DAW} $D1 $E0 $D1 $E0 $D1 $E0 #Conveyor right
$A3 {$CA89W} $C7 $06 {$CA87W} [$0000W] $56 $9A $08F406A5RL $83
$C4 $02 $EB $55 $83 $7C $36 [$31] {$75} $1C $A1 {$A6DAW} $BA [$FFF8W] #Conveyor left
$F7 $EA $A3 {$CA89W} $C7 $06 {$CA87W} [$0000W] $56 $9A $08F406A5RL
$83 $C4 $02 $EB $33 $83 $7C {$38} [$00] {$74} $06 $83 $7C $0E [$FF] #Walls
{$74} $0C $83 $7C {$3C} [$00] {$74} $21 $83 $7C $0E [$01] {$75} $1B $C7 $44
$1A [$0000W] $C7 $44 $1C [$089AW] $83 $7C $0E [$01] {$75} $05 $A1 [$089CW]
$EB $03 $A1 [$089AW] $89 $44 $1E $FF $74 $20 $33 $C0 $50 $FF
$74 $1E $FF $74 $0C $FF $74 $0A $8B $C6 $05 $46 $00 $50 $9A
$16081770RL $83 $C4 $0C $5E $5D $CB