ARTICLE: Changing or Disabling Cheat Codes

Completed patches for Keen1.
Post Reply
User avatar
adurdin
Site Founder
Posts: 549
Joined: Fri Aug 29, 2003 11:27 pm
Location: Edinburgh, Scotland
Contact:

ARTICLE: Changing or Disabling Cheat Codes

Post by adurdin »

This post describes how to change or disable the cheats in Keen 1, 2, and 3 (v1.31)

The first thing you must do is decide what three keys should be the cheat code, and find the corresponding scan codes from the table below. For example, suppose we wanted to use J,X,Tab for a cheat code. The three scan codes are $24, $2D, $0F.

Scan Codes:

Code: Select all

ESC       $01   U           $16   | or \      $2B   F6          $40
! or 1    $02   I           $17   Z           $2C   F7          $41
@ or 2    $03   O           $18   X           $2D   F8          $42
# or 3    $04   P           $19   C           $2E   F9          $43
$ or 4    $05   { or [      $1A   V           $2F   F10         $44
% or 5    $06   } or ]      $1B   B           $30   NUMLOCK     $45
^ or 6    $07   ENTER       $1C   N           $31   SCROLL LOCK $46
& or 7    $08   CTRL        $1D   M           $32   HOME or 7   $47
* or 8    $09   A           $1E   < or ,      $33   UP or 8     $48
( or 9    $0A   S           $1F   > or .      $34   PGUP or 9   $49
) or 0    $0B   D           $20   ? or /      $35   NUMPAD -    $4A
_ or -    $0C   F           $21   RIGHT SHIFT $36   LEFT or 4   $4B
+ or =    $0D   G           $22   PRTSC or *  $37   NUMPAD 5    $4C
LEFT      $0E   H           $23   ALT         $38   RIGHT or 6  $4D
TAB       $0F   J           $24   SPACEBAR    $39   NUMPAD +    $4E
Q         $10   K           $25   CAPSLOCK    $3A   END or 1    $4F
W         $11   L           $26   F1          $3B   DOWN or 2   $50
E         $12   : or ;      $27   F2          $3C   PGDN or 3   $51
R         $13   " or '      $28   F3          $3D   INS or 0    $52
T         $14     or `      $29   F4          $3E   DEL or .    $53
Y         $15   LEFT SHIFT  $2A   F5          $3F
Before we can use these scan codes in a patch, we need to add a number to them, appropriate to the episode. Continuing the example, if we were wanting to change the cheats for episode 1, we would add $502C to each scan code, giving us $5050, $5059, $503B.

Numbers to Add to Scan Codes:

Code: Select all

Episode  Number to Add
   1         $502C
   2         $5008
   3         $5258
Now we need to patch the appropriate addresses. There are two cheats, and three addresses for each cheat: one address for each key. The addresses are different for each episode, and are listed in the following table:

Addresses to Patch

Code: Select all

Episode  Cheat       Addresses
   1     Items  $11F5, $11FC, $1203
          God   $120D, $1214, $121B

   2     Items  $11AF, $11B6, $11BD
          God   $11C7, $11CE, $11D5

   3     Items  $1150, $1157, $115E
          God   $1168, $116F, $1176
Because the values we're patching are larger than one byte, we need to write the patches with the bytes reversed. If, in our example, we wanted to change the god-mode cheat, our patch file would be:

Code: Select all

%ext ck1
%version 1.31

# Change the god-mode cheat to J,X,Tab
%patch $120D  $50 $50
%patch $1214  $59 $50
%patch $121B  $3B $50

%end
Disabling the cheats
An easy way to disable a cheat is to use a scan code of zero for each key. For example, a patch file to disable the god-mode cheat in Keen 1 would be:

Code: Select all

%ext ck1
%version 1.31

# Disable the god-mode cheat
%patch $120D  $2C $50
%patch $1214  $2C $50
%patch $121B  $2C $50

%end
Post Reply