Patch:Debug mode

From KeenWiki
Jump to navigation Jump to search

Debug mode is a state the Keen Galaxy games enter where the F10 cheat codes can be accessed. It is activated under two conditions; firstly when the nowait executable switch is used, which sets it automatically and secondly when the A 2 enter key combination is pressed in the game itself which displays a notification window.

Not to be confused with DEBUG.TXT.


Debug notification window

This window appears when the three 'debug keys' are pressed. It will always appear, even if debug mode is already active.

Keen 4

#A 2 Enter cheat window
%patch $82EE [$0002W]  #Window height
%patch $82F2 [$0014W]  #Window width
%patch $8303 [$066DW]  #Text called from

#Text
%patch $2F4DD "Debug keys active" $00

Keen 5

#A 2 Enter cheat window
%patch $826A [$0002W]  #Window height
%patch $826E [$0014W]  #Window width
%patch $827F  [$5DFW] #Text called from

#Text
%patch $3091F "Debug keys active" $00

Keen 6

#A 2 Enter cheat window
%patch $8095 [$0002W]  #Height
%patch $8099 [$0014W]  #Width
%patch $80AA [$05D7W]  #Text called from

#Text
%patch $31307 "Debug keys active" $00


Complete window code

This is the complete code for the debug window including its size, the variable set and the keys needed to activate it. As it contains all these patches it is incompatible with the other window-related patches on this page.

The first line of each patch contains the two keys that must be pressed (in addition to enter) to activate the window as well as the window's height ($0002W.) The second line contains the window's width. The third line contains the pointer to the window's text and the fourth line sets the debug variable.

Complete debug window code

#Complete debug window code - Keen 4
%patch $82DF $83 $3E {$C683W}  [$00] {$74} $38 $83 $3E {$C64DW}  [$00] {$74} $31 $B8 [$0002W]
                 $50 $B8 [$0014W]  $50 $9A $19311070RL     $83 $C4 $04 $83 $06
             $35 $A5 $02 $B8 [$066DW]  $50 $9A $19310CF9RL     $83 $C4 $02 $9A
             $1D060A9BRL     $9A $14600EDFRL     $C7 $06 {$7A16W}  [$0001W]

#Complete debug window code - Keen 5
%patch $825B $83 $3E {$BCEBW}  [$00] {$74} $38 $83 $3E {$BCB5W}  [$00] {$74} $31 $B8 [$0002W]
                 $50 $B8 [$0014W]  $50 $9A $1A2B106ERL     $83 $C4 $04 $83 $06
             $9D $9B $02 $B8 [$05DFW]  $50 $9A $1A2B0CF7RL     $83 $C4 $02 $9A
             $1E000A97RL     $9A $155A0EDCRL     $C7 $06 {$6F14W}  [$0001W]

#Complete debug window code - Keen 6
%patch $8086 $83 $3E {$C811W}  [$00] {$74} $38 $83 $3E {$C7DBW}  [$00] {$74} $31 $B8 [$0002W]
                 $50 $B8 [$0014W]  $50 $9A $18F81070RL     $83 $C4 $04 $83 $06
             $C3 $A6 $02 $B8 [$05D7W]  $50 $9A $18F80CF9RL     $83 $C4 $02 $9A
             $1CF70AA5RL     $9A $14130EE0RL     $C7 $06 {$754EW}  [$0001W]


Keys needed to activate Debug mode

Three keys are needed to activate debug. (See Patch:Scancodes.) By default these are 'a' and '2'; 'enter' is a 'gateway key' meaning that it is shared between several things such as the status window. As such 'enter' must be one of the three keys and only the other two can be altered. Setting either key to $C647, $BCAF or $C7D5 (in Keen 4, Keen 5 and Keen 6 respectively) will disable debug mode and thus the F10 cheats. (Unless the debug requirement is removed from cheating.)

Keen 4

#Debug keys
%patch $82E1 {$C683W} #A
%patch $82E8 {$C64DW} #2

Keen 5

#Debug keys
%patch $825D {$BCEBW} #A
%patch $8264 {$BCB5W} #2

Keen 6

#Debug keys
%patch $8088 {$C811W} #A
%patch $808F {$C7DBW} #2


Disable Debug window

These patches will disable the debug mode window, meaning the F10 keys cannot be used unless that specific requirement is changed.

Keen 4

#Disable A 2 Enter keys
%patch $78B7 $EB

Keen 5

#Disable A 2 Enter keys
%patch $8260  $EB

Keen 6

#Disable A 2 Enter keys
%patch $8092 $EB


Disable window but keys still activate debug mode

This patch is identical to the above one except that the key combination will still activate debug mode. This will make it a 'silent activation'

Keen 4

#Disable window but A 2 enter keys still activate debug mode
%patch $82ED $EB $29

Keen 5

#Disable window but A 2 enter keys still activate debug mode
%patch $8269 $EB $29

Keen 6

#Disable window but A 2 enter keys still activate debug mode
%patch $8094 $EB $29


Disable debug mode

This patch allows the player to see the debug window, but doesn't activate the cheats. Once again this can be circumvented with the -nowait switch. This in fact skips setting the debug variable to 1 (See below.) Debug mode must be disabled in two separate locations, the A 2 Enter keys and the -nowait switch. Both patches are independent and can be used individually.

Keen 4

#A 2 Enter doesn't activate debug mode
%patch $8318 $EB $04

#Nowait switch doesn't affect debug mode
%patch $3EB6 $EB $12

Keen 5

#A 2 Enter doesn't activate debug mode
%patch $8294 $EB $04

#Nowait switch doesn't affect debug mode
%patch $3EB0 $EB $12

Keen 6

#A 2 Enter doesn't activate debug mode
%patch $80BF $EB $04

#Nowait switch doesn't affect debug mode
%patch $3CDF $EB $12


Debug variable

This patch allows a modder to alter the debug variable used to detect whether debug is 'on' It is turned on in two situations, firstly when the -nowait switch is used and secondly when the A 2 enter keys are pressed. It is checked before any F10 cheats are used.

All three variables can be different and\or set to different values. (It is possible for example to make the A 2 Enter cheat disable debug mode.)

Keen 4

#Set variable with -nowait switch
%patch $3EC6 {$7A16W} [$0001W]

#Set variable with A 2 Enter keys
%patch $831A {$7A16W} [$0001W]

#Need variable to be this for cheats
%patch $7AB4 {$7A16W} [$00] {$74}

Keen 5

#Set variable with -nowait switch
%patch $3EC0 {$6F14W} [$0001W]

#Set variable with A 2 Enter keys
%patch $8296 {$6F14W} [$0001W]

#Need variable to be this for cheats
%patch $7A6F {$6F14W} [$00] {$74}

Keen 6

#Set variable with -nowait switch
%patch $3CEF {$754EW} [$0001W]

#Set variable with A 2 Enter keys
%patch $80C1 {$754EW} [$0001W]

#Need variable to be this for cheats
%patch $784B {$754EW} [$00] {$74}


Don't need debug mode to use F10 cheats

This patch removes the need to use debug mode in order to use the F10 cheats.

Keen 4

#Don't need debug mode to use F10 cheats
%patch $7AB7 $90 $90

Keen 5

#Don't need debug mode to use F10 cheats
%patch $7A72 $90 $90

Keen 6

#Don't need debug mode to use F10 cheats
%patch $784B $90 $90