Patch:Shelley

From KeenWiki
Jump to navigation Jump to search

Shelleys are small and difficult to kill enemies in Keen 5. They are prone to suicide attacks, jumping on the player from above and exploding. (Which they will also do if shot or jumped on, notably other enemies can destroy them.)


Sprite Type

Shelley use sprite type 9 which is used only by Shelley and doesn't affect anything else. Shelley are however susceptible to being destroyed by any sprites of type 4, 'enemy projectile' which is used by many enemy shots.

Keen 5

#Shelley sprite type
%patch $11952 $09


Sprite Actions

The Shelley has a number of actions that interact in complex and interesting ways. Shelley are spawned walking back and forth. The walk cycle is four actions long. While walking they will stop at the edge of platforms, seeing if they can pounce on Keen.

When looking to jump the Shelley can jump left or right, but will resume walking if Keen is not below it. If Keen is below it it will go to jumping and then to flipping and finally to falling. The falling Shelley will remain so until shot or hitting flat ground.

The falling Shelley is complex; it can be destroyed midair (A) or when it hits solid tiles (B) In both cases Shelley smoke and two fragments, left and right will be produced.

The smoke will animate and vanish, as will the two fragments.

Actions:
$2416W #Shelly walk 1
$2434W #Shelly walk 2
$2452W #Shelly walk 3
$2470W #Shelly walk 4
$248EW #Shelly prepare to jump
$24ACW #Shelly jump
$24CAW #Shelly flip
$24E8W #Shelly fall
$2506W #Shelly smash A (Air)
$2524W #Shelly smash B (Ground)
$2542W #Shelly smash smoke 1
$2560W #Shelly smash smoke 2
$257EW #Shelly smash smoke 3
$259CW #Shelly smash smoke 4
$25BAW #Shelly fragment left
$25D8W #Shelly fragment right

Keen 5

#When spawned
%patch $11998 [$2416W]

#Walking loop
%patch $32772 [$2434W]
%patch $32790 [$2452W]
%patch $327AE [$2470W]
%patch $327CC [$2416W]

#When at platform edges
%patch $11B95 [$248EW]

#While looking to jump
%patch $119E4 [$24CAW] #Looking to jump right and sees Keen)
%patch $11A0E [$24CAW] #Looking to jump left and sees Keen)

#Looking to jump
%patch $327EA [$24ACW]

#Jumping
%patch $32808 [$2416W]

#Flip
%patch $32826 [$24E8W]

#Falling
%patch $32844 [$0000W]

#While falling
%patch $11B07 [$2524W] #Shelly smash B (If hit on the ground)
%patch $11B16 [$2506W] #Shelly fall A (If hit in air)

#Shelley Smash A
%patch $32862 [$0000W]

#Shelley Smash B
%patch $32880 [$0000W]

#Produce these when smashed
%patch $11B3F [$2542W] #Shelly smash smoke
%patch $11A5A [$25BAW] #Spawn Shelley right fragment
%patch $11A8D [$25D8W] #Spawn Shelley left fragment

#Smashed smoke sequence
%patch $3289E [$2560W]
%patch $328BC [$257EW]
%patch $328DA [$259CW]
%patch $328F8 [$0000W]

#Smashed Shelley fragments
%patch $32916 [$0000W] #Shelly fragments (Wait to vanish)
%patch $32934 [$0000W] #Shelly fragments (Wait to vanish)


Sprite Behavior

The Shelley has three behaviors it uses; looking to see if it can jump (used when pausing at the edge of platforms), jumping (used when... jumping, followed by two frames that use a generic falling sprite behavior.) and smashing. (Used by both smashing Shelleys)

Behaviors:
$11020986RL #Shelly prepare to jump
$110209FARL #Shelly jump
$11020A0CRL #Shelley smash

Keen 5

#Walking
%patch $32766 $00000000L  #Nothing
%patch $32784 $00000000L  #Nothing
%patch $327A2 $00000000L  #Nothing
%patch $327C0 $00000000L  #Nothing

#Shelly prepare to jump
%patch $327DE $11020986RL #Shelly prepare to jump

#Jump
%patch $327FC $110209FARL #Shelly jump
%patch $3281A $090B1710RL #Fall
%patch $32838 $090B1710RL #Fall

#Smash A
%patch $32856 $11020A0CRL #Shelley smash

#Smash B
%patch $32874 $11020A0CRL #Shelley smash

#Smoke
%patch $32892 $00000000L  #Nothing
%patch $328B0 $00000000L  #Nothing
%patch $328CE $00000000L  #Nothing
%patch $328EC $00000000L  #Nothing

#Fragments
%patch $3290A $090B1710RL #Fall
%patch $32928 $090B1710RL #Fall


Shelley attack code

This is the behavior code for the 'waiting Shelley'; when it is at the edges of platforms (Or floating in the air) and looking for Keen. It can do three things, nothing, jump left or jump right. It will help to read up on jump conditions before looking at this patch.)

The second line is where checks start; the first thing checked is if Keen is below the Shelley ($72), if not, nothing is done. Otherwise...

In the third line the Shelley's direction is checked, ($0E $01 $75, see also Galaxy Sprite Parameters.) If the Shelley is moving left a jump is made to the 'check for Keen left' code. Otherwise the 'check for Keen right code' is run.

Still on line 3 the Shelley checks if Keen is one to three tiles right of it, if so, it pounces, changing its horizontal speed to $10, its vertical speed to $FFE8 and its action to jumping.

Lines six onwards are the 'check for Keen left' code. On the seventh line the Shelley checks if Keen is between -1 and -3 tiles right of him (Hence the negative numbers.) and if so, it pounces, changing its horizontal speed to $FFF0, its vertical speed to $FFE8 and its action to jumping.

See also the sprite positioning section for a short patch giving these checks without the rest of the code. Note that this patch contains, and is thus incompatible with, several others on this page. Hopefully it is obvious where these smaller patches fit into this one.

Keen 5

#Shelley attack code
%patch $119A6 $55 $8B $EC $56 $8B $76 $06 $8B $1E $3E $9E $8B $47 $24 $3B $44
              $28 {$72} $5E $8B $1E $3E $9E $8B $47 $2A $2B $44 $2A $8B $D0 $83 #Attack if Keen below and...
              $7C {$0E $01 $75} $29 $81 $FA [$0100W]  {$7E} $46 $81 $FA [$0300W]  $7D #Between 1-3 tiles right
              $40 $C7 $44 $16 [$0010W]  $C7 $44 $18 [$FFE8W]  $C7 $44 $1C [$24CAW]  #Jump stuff
              $33 $C0 $A3 $83 $BF $A3 $85 $BF $5E $5D $CB $5E $5D $CB 
                                                                      $81 $FA
              [$FF00W]  {$7D} $1D $81 $FA [$FD00W]  {$7E} $17 $C7 $44 $16 [$FFF0W]  $C7 #Else if 1-3 tiles left
              $44 $18 [$FFE8W]  $C7 $44 $1C [$24CAW]  $33 $C0 $A3 $83 $BF $A3 $85 #Jump stuff
              $BF $5E $5D $CB


Don't jump off platform edges onto Keen

This patch stops the Shelley dive-bombing Keen if he is below it on a platform edge. This eliminates their ability to self destruct, and makes them harder to destroy also.

Keen 5

#Shelley don't jump off platform edges
%patch $119A6 $CB


Attack Keen on flat ground

This patch disables the height check in the code above. This means that if Keen is level or above the Shelley, they will still attack. Practically this means they will walk towards him on flat ground, then jump up to attack him. As a side effect if Keen is far above them, they will still attack, jumping at nothing, so sprite placement is key.

Keen 5

#Shelley don't jump off platform edges
%patch $119B7 $90 $90


Shelley waits at ledges forever

This patch causes the Shelley to freeze at the edge of platforms forever instead of turning around. There are two lines to the patch, one for each direction of platform edge.

Keen 5

#Shelley waits at ledges forever
%patch $11B60 $90 $90 #Left
%patch $11B79 $90 $90 #Right


Speed and Jump Height

Most of the Shelley's motion is due to its animation, namely its walking speeds of $0080W. However it also has a number of jump heights and widths, both for itself and for the fragments produced when it smashes. These have a horizontal and vertical component and must have different values for left and right.

Shelley animation motion

#Shelley walk
%patch $32762 [$0080W $0000W]
%patch $32780 [$0080W $0000W]
%patch $3279E [$0080W $0000W]
%patch $327BC [$0080W $0000W]

#Jump
%patch $327DA [$0000W $0000W] #Prepare
%patch $327F8 [$0000W $0000W] #Jump
%patch $32816 [$0000W $0000W] #Flip
%patch $32834 [$0000W $0000W] #Fall

#Smash A
%patch $32852 [$0000W $0000W]

#Smash B
%patch $32870 [$0000W $0000W]

#Smash smoke
%patch $3288E [$0000W $0000W]
%patch $328AC [$0000W $0000W]
%patch $328CA [$0000W $0000W]
%patch $328E8 [$0000W $0000W]

#Fragments
%patch $32906 [$0000W $0000W]
%patch $32924 [$0000W $0000W]

Shelley jump speeds

#Shelley jump right
%patch $119DA [$0010W] #Width
%patch $119DF [$FFE8W] #Height

#Shelley jump left
%patch $11A03 [$FFF0W] #Width
%patch $11A08 [$FFE8W] #Height

Shelley fragment speeds

#Shelley fragment left
%patch $11A03 [$FFF0W] #Width
%patch $119DA [$0010W] #Height

#Shelley fragment right
%patch $11A52 [$0020W] #Width
%patch $11A57 [$FFE8W] #Height


Sprite Collision

The Shelley is harmless, but will push Keen back and forth. It can also be shot.

Collision values

The Shelley has its own collision, but the fragments it produces when it explodes use the standard 'deadly to Keen' collision. Making these 'nothing' makes the Shelley harmless.

Keen 5 collision values

#Walk
%patch $3276A $11020A7CRL #Shelley walk
%patch $32788 $11020A7CRL #Shelley walk
%patch $327A6 $11020A7CRL #Shelley walk
%patch $327C4 $11020A7CRL #Shelley walk

#Jump
%patch $327E2 $11020A7CRL #Shelley walk (Prepare)
%patch $32800 $11020A7CRL #Shelley walk (Jump)
%patch $3281E $11020A7CRL #Shelley walk (Flip)
%patch $3283C $11020A7CRL #Shelley walk (Fall)

#Smash A
%patch $3285A $00000000L  #Nothing

#Smash B
%patch $32878 $00000000L  #Nothing

#Smash smoke
%patch $32896 $090B1799RL #Deadly
%patch $328B4 $090B1799RL #Deadly
%patch $328D2 $090B1799RL #Deadly
%patch $328F0 $090B1799RL #Deadly

#Fragments
%patch $3290E $090B1799RL #Deadly
%patch $3292C $090B1799RL #Deadly


Collision code

This is the complete collision code for the Shelley. It is one of the more complex collisions and will thus be dissected in detail.

The first thing looked for is Keen. If he is found the 'push Keen' code is called, which will push Keen if he is in front of the Shelley. Then the Shelley checks if Keen is in front of it (not before pushing him!) and, if he is, ends. if he isn't, the Shelley will go to the explode code. (You cannot sneak up on a Shelley.) To disable pushing replace $9A $090B0CD2RL with $90 $90 $90 $90 $90. This will result in the Shelley nearly always exploding when walking into Keen. (Though it is possible for him to jump out of the way just after touching it, or walk past it very quickly. To fix this you will want to replace replace $73 $03 with $EB $03 Replacing it with $EB $0E will make the Shelley not explode when touching Keen at all.) To make the Shelley push Keen but not explode replace $8B $1E $3E $9E with $5F $5E $5D $CB.

Following this section is a check for Keen's shot and the enemy shot (e.g. Robo Red's shot. If Keen's shot is detected the Shelley runs the 'destroy Keen's shot' code. Replacing $9A $0CCB10B3RL with $90 $90 $90 $90 $90 will not destroy Keen's shot (It will pass right through.) If the enemy shot type is detected, it is removed using different code. (Again replacing $9A $06B91E47RL with $90 $90 $90 $90 $90 will stop this.) Both will then go on to the 'Shelley explode' section. if none of these three types (Keen, Keen's shot, enemy shot) are detected, the code will end. Replacing $75 $66 with $75 $0F will make all other sprites explode the Shelley too (Quite amusing.) Replacing $EB $14 with $EB $10 or $EB $04 with $90 $90 will stop the Shelley exploding when hit by Keen's or enemy shots respectively.

After this is the explosion code; first the explosion sound is played, replace $9A $196E09EFRL with $90 $90 $90 $90 $90 to remove this. Next the Shelley checks if it is in the air or not (Actually a check if the tile below it has a top blocking property.) This results in it becoming one of two possible exploded Shelleys. Replace $74 $0F with $EB $0F to always make the air kind or $90 $90 to always make the ground kind. (This can have interesting effects.)

The smoke is then set to foreground (In front of the Shelley) and produced. Note that the two fragments produced when Shelley is smashed are produced elsewhere, not in the collision.

Keen 5

#Shelley collision
%patch $11A9C $55 $8B $EC $56 $57 $8B $76 $06 $8B $7E $08 $83 $3D [$02] {$75 $24} #Check for Keen
              $56 $57 $9A $090B0CD2RL     $83 $C4 $04 $8B $1E $3E $9E $8B $47 #Push Keen
              $2A $3B $44 $22 {$73 $03} $E9 $0086W  $3B $44 $26 $76 $2A $5F $5E #If on wrong side go to (2), else end
              $5D $CB $EB $24 
%patch $11AD0                 $83 $3D [$03] {$75 $0B} $57 $9A $0CCB10B3RL     $83 #Check for Keen's shot from ABOVE, destroy, goto (2)
              $C4 $02 $EB $14 $83 $3D [$04] {$75 $66} $57 $9A $06B91E47RL     $83 #And enemy shot from ABOVE, destroy, end
              $C4 $02 $EB $04 $5F $5E $5D $CB 
                                              $B8 [$0024W]  $50 $9A $196E09EFRL #(2) Play sound
                  $83 $C4 $02 $83 $7C $36 [$00] {$74 $0F} $B8 [$2524W]  $50 $56 $9A #Check if in air, if yes, become bust Shelley A
              $090B1242RL     $83 $C4 $04 $EB $0D $B8 [$2506W]  $50 $56 $9A     #If no, become bust Shelley B
          $090B1242RL     $83 $C4 $04 $B8 [$0001W]  $50 $9A $06B91DCDRL     $83 #Smoke is foreground
              $C4 $02 $8B $44 $0A $8B $1E $40 $9E $89 $47 $0A $8B $44 $0C $89
              $47 $0C $B8 [$2542W]  $50 $53 $9A $090B11C4RL $83 $C4 $04 $5F     #Make smoke
              $5E $5D $CB


Don't push Keen - short patch

This is a short patch that does not need the long above patch to work. It stops the Shelley pushing Keen. This results in it exploding quite quickly when it tries to walk past him. The second patch adds another line that makes sure Keen cannot quickly jump out of the way or sneak past the Shelley, making a 100% foolproof patch. It should be obvious in the above section how this patch fits into the long patch.

Keen 5

#Shelley don't push Keen (Results in exploding on contact.)
%patch $11AAE $90 $90 $90 $90 $90

Keen 5

#Shelley explode on contact with Keen
%patch $11AAE $90 $90 $90 $90 $90
%patch $11AC0 $EB


Don't explode when touching Keen - short patch

This is a short patch that does not need the long above patch to work. It stops the Shelley exploding or pushing when they are touching Keen, they just walk right by him. It should be obvious in the above section how this patch fits into the long patch.

Keen 5

#Shelley don't interact with Keen at all
%patch $11AAE $90 $90 $90 $90 $90
%patch $11AC0 $EB $0E


Don't explode when touching Keen, but push him - short patch

This is a short patch that does not need the long above patch to work. It stops the Shelley exploding when they touch Keen, but lets them push him around. It should be obvious in the above section how this patch fits into the long patch.

Keen 5

#Shelley push Keen, don't explode
%patch $11AB6 $5F $5E $5D $CB


Don't explode when shot by Keen - short patch

This is a short patch that does not need the long above patch to work. It stops the Shelley exploding when shot by Keen's shot, while still blocking it. It should be obvious in the above section how this patch fits into the long patch.

Keen 5

#Shelley don't explode when shot by Keen
%patch $11ADF $10


Don't explode when shot by enemies - short patch

This is a short patch that does not need the long above patch to work. It stops the Shelley exploding when shot by enemies ' shots, while still blocking them. It should be obvious in the above section how this patch fits into the long patch.

Keen 5

#Shelley don't explode when shot by Keen
%patch $11AEE $90 $90


Animations

The Shelley has a complex set of animations. First is a four frame walking cycle. At platform edges it has a six frame jumping cycle that uses only three different animations total. (And, if the Shelley doesn't jump, only the first frame is used.) Notice the two different smashed Shelleys have two different animations, one right way up, the other upside down. The smashed Shelley's animation speeds are irrelevant.

The smashed smoke cycle is four frames long and there are also two one-frame Shelley fragment cycles, one for each fragment the Shelley produces.

Keen 5

#Cache
%patch $31A48 [$01ACW] #Shelley cache start
%patch $31A9C [$01BDW] #Cache end

#Shelly walk
%patch $32756 $01B0W $01ACW
%patch $32760 $0008W        #Animation speed
%patch $32774 $01B1W $01ADW
%patch $3277E $0008W        #Animation speed
%patch $32792 $01B2W $01AEW
%patch $3279C $0008W        #Animation speed
%patch $327B0 $01B3W $01AFW
%patch $327BA $0008W        #Animation speed

#Shelly jump
%patch $327CE $01B1W $01ADW #Shelly prepare to jump
%patch $327D8 $0064W        #Pause while 'aiming'
%patch $327EC $01B1W $01ADW #Shelly jump
%patch $327F6 $0001W        #Animation speed
%patch $3280A $01B6W $01B4W #Shelly flip
%patch $32814 $0008W        #Animation speed
%patch $32828 $01B7W $01B5W #Shelly fall
%patch $32832 $0008W        #Animation speed

#Shelly smash A
%patch $32846 $01B7W $01B5W
%patch $32850 $0008W        #Animation speed

#Shelly smash B
%patch $32864 $01B1W $01ADW
%patch $3286E $0008W        #Animation speed

#Shelly smash smoke
%patch $32882 $01B8W $01B8W
%patch $3288C $0014W        #Animation speed
%patch $328A0 $01B9W $01B9W
%patch $328AA $0014W        #Animation speed
%patch $328BE $01BAW $01BAW
%patch $328C8 $0014W        #Animation speed
%patch $328DC $01BBW $01BBW
%patch $328E6 $0014W        #Animation speed

#Shelly fragments
%patch $328FA $01BCW $01BCW #Left
%patch $32904 $0008W        #Animation speed
%patch $32918 $01BDW $01BDW #Right
%patch $32922 $0008W        #Animation speed


Sprite positioning and jump attack range

This is the attack range for the Shelley, contained in the sprite behavior patch section above. This much shorter patch will allow the attack range of the Shelley to be changed. Each line can be included or omitted at will.

Keen 5

#Jump Keen detection and range:
%patch $119B7 {$72}    #IF Keen is below it... ($77 = above)

#Shelley jump right if Keen is:
%patch $119CF {$7E}    #At or further than...
%patch $119CD [$0100W] #1 tile right of it AND
%patch $119D5 {$7D}    #At or closer than...
%patch $119D3 [$0300W] #3 tiles right of it

#Shelley jump left if Keen is:
%patch $119F8 {$7D}    #At or further than...
%patch $119F6 [$FF00W] #1 tile left of it AND
%patch $119FE {$7E}    #At or closer than...
%patch $119FC [$FD00W] #3 tiles left of it


Sounds

The Shelley makes a noise when it explodes. There are two times this sound is played (and both sounds can be different if desired.) the first is when the Shelley is shot by Keen or an enemy, or Keen pogos onto it. The second is when a falling Shelley hits flat ground.

Keen 5

#Shelley explode when shot sound
%patch $11AF5 $24

#Shelley explode when hitting the ground sound
%patch $11BE0 $24

Keen 5

#Don't play Shelley explode when shot sound
%patch $11AF4 $EB $0A

#Don't play Shelley explode when hitting the ground sound
%patch $11BDF $EB $0A


Clipping and foreground

Shelley has a foreground variable of 0, meaning it appears behind all sprites and foreground tiles. This avoids foreground errors when the Shelley smashes into floors.

Shelley foreground variable

#Shelley foreground variable
%patch $1195C [$0000W]


Sprite-tile interaction

The Shelley's tile interaction is very important. The first one is used when the Shelley is walking, this is what makes the Shelley pause at platform edges and possibly jump. The Shelley preparing to jump and jumping uses a generic 'avoid solid tiles' interaction. Falling and smashed Shelley use the falling Shelley interaction, which makes the Shelley explode when it hits solid ground. Finally the fragments have their own interaction that lets them bounce off of flat ground.

Keen 5

#Walk
%patch $3276E $11020B2FRL #Shelley walk
%patch $3278C $11020B2FRL #Shelley walk
%patch $327AA $11020B2FRL #Shelley walk
%patch $327C8 $11020B2FRL #Shelley walk

#Jump
%patch $327E6 $090B17B5RL #Solid (Prepare)
%patch $32804 $090B17B5RL #Solid (Jump)
%patch $32822 $11020BA1RL #Shelley fall (Flip)
%patch $32840 $11020BA1RL #Shelley fall (Fall)

#Smash A
%patch $3285E $11020BA1RL #Shelley fall

#Smash B
%patch $3287C $11020BA1RL #Shelley fall

#Smash smoke
%patch $3289A $090B17B5RL #Solid
%patch $328B8 $090B17B5RL #Solid
%patch $328D6 $090B17B5RL #Solid
%patch $328F4 $090B17B5RL #Solid

#Fragments
%patch $32912 $0F920119RL #Explosion fragments
%patch $32930 $0F920119RL #Explosion fragments


Shelley walking tile interaction code

Action type

Most of the Shelley's actions use action type 0, making their movement somewhat jerky. This surprisingly includes the jumping Shelley, which is unexpected. The Shelley fragments as well as the last frame of the falling Shelley use type 2, as both these sprites fall proper. Finally the first and third frames of the jumping Shelley use type 3 as they may need to move smoothly through the air.

Keen 5

#Walk
%patch $3275A [$0000W]
%patch $32778 [$0000W]
%patch $32796 [$0000W]
%patch $327B4 [$0000W]

#Jump
%patch $327D2 [$0003W] #Prepare to jump
%patch $327F0 [$0000W] #Jump
%patch $3280E [$0003W] #Flip
%patch $3282C [$0002W] #Fall

#Smash A
%patch $3284A [$0000W]

#Smash B
%patch $32868 [$0000W]

#Smash smoke
%patch $32886 [$0000W]
%patch $328A4 [$0000W]
%patch $328C2 [$0000W]
%patch $328E0 [$0000W]

#Fragments
%patch $328FE [$0002W] #Left
%patch $3291C [$0002W] #Right


Deprotect and stick to ground

The Shelley has a 'stick to ground' value of 1 for its walking and preparing to jump actions, as it needs to walk up and down hills. It uses the deprotect animation value (as well as stick to ground value) when it is jumping, for unknown reasons.

Keen 5

#Walk
%patch $3275C [$0000W $0001W]
%patch $3277A [$0000W $0001W]
%patch $32798 [$0000W $0001W]
%patch $327B6 [$0000W $0001W]

#Jump
%patch $327D4 [$0000W $0001W] #Prepare to jump
%patch $327F2 [$0001W $0001W] #Jump
%patch $32810 [$0000W $0000W] #Flip
%patch $3282E [$0000W $0000W] #Fall

#Shelley smash A
%patch $3284C [$0000W $0000W]

#Shelley smash B
%patch $3286A [$0000W $0000W]

#Smash smoke
%patch $32888 [$0000W $0000W]
%patch $328A6 [$0000W $0000W]
%patch $328C4 [$0000W $0000W]
%patch $328E2 [$0000W $0000W]

#Fragments
%patch $32900 [$0000W $0000W] #Left
%patch $3291E [$0000W $0000W] #Right


Sprite spawn code

This is the complete spawn code for the Shelley. Notice there are three types, one for each difficulty level. The cache is set in $C7 $06 $C29BW $0001W.

The last blue highlighted value in the spawn code is the sprite action the sprite uses as it proceeds to act in-level. $C7 $47 $02 $xxxxW sets the sprite activity, $C7 $07 $xxxxW sets the sprite type, $C7 $20 $xxxxW sets the foreground value.

$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. The Shelley has 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

#Location of initiation code
%patch $F558 [$543W]  #Easy Shelley (At $F293)
%patch $F55A [$539W]  #Normal Shelley (At $F289)
%patch $F55C [$52FW]  #Hard Shelley (At $F27F)

#Shelley Initiation code
%patch $F27F $83 $3E [$6F6CW]  {$03 $7D} $03 $E9 $011EW  $83 $3E [$6F6CW]  {$02 $7D}
             $03 $E9 $0114W  $57 $56 $9A $1102091ERL     $83 $C4 $04 $C7 $06 $C29BW
             $0001W  $E9 $0101W

#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