When a program makes a CMP it subtracts the operands and the Zero flag
will indicate if the two operands were equal or not. JZ means jump if zero,
which means it jumps if the Zero flag was set, if it wasn't it won't jump.
So to crack this we simply change the JZ into a JNZ or a JMP. JNZ means
jump if not zero and JMP means jump anyway.
MOV AH,[BX] ; Move a letter into AH
INC BX ; BX points to the next letter
LODSB ; Store encrypted letter in AL
CMP BX,51E7 ; Check if BX is a space (20 in hex)
JAE 3DF4 ; If so then jump
ROR AL,1 ; This is the first instruction to decrypt AL
XOR AL,A2 ; And now we have a letter stored in AL
CMP AL,00 ; Check to see if it was the last letter in the correct
; password
JZ 3DEF ; If so then jump here
CMP AH,AL ; Compare user letter with correct password letter
JMP 3DB8 ; Jump anyway and go on with next char
Now it doesn't matter if AH and AL are the same, the program will
always work. Another way of defeating this protection would be to compare
the true password with the true password like this:
MOV AH,[BX] ; Move a letter into AH
INC BX ; BX points to the next letter
LODSB ; Store encrypted letter in AL
CMP BX,51E7 ; Check if BX is a space (20 in hex)
JAE 3DF4 ; If so then jump
ROR AL,1 ; This is the first instruction to decrypt AL
XOR AL,A2 ; And now we have a letter stored in AL
CMP AL,00 ; Check to see if it was the last letter in the correct
; password
JZ 3DEF ; If so then jump here
CMP AL,AL ; Compare correct password letter with itself
JZ 3DB8 ; If the same then jump and go on with next char
This way the Zero flag will always be set. You could experiment with
this a lot.
SNAPPING
Let us find the address that stores the player ball and then find the
increaser or decreaser. Start the game and play some pinball. Switch back
to Softice and snap save the DS register.
SNAP S DS:0 DS:FFFF
Loose the ball, switch back and snap compare. Look for changes from 1
to 2 since PF tells us that we start with ball 1 and after loosing it we
have ball 2. There are not many changes in memory with these values.
2DB4:000D
2DB2:000B
2DB2:000E
2DFF:000F
2E02:000E
Dump these areas to see if they change after you loose a ball. If they
change without loosing a ball then they are not the correct addresses. We
are looking for a change in memory that ONLY happens when we loose a
ball. You quickly realize that 2E02:000E is the correct storage address of
the number of balls we have left. It's an increaser. We start with the
value 1, then it increases until the value is 3 and is about to change to
4. I don't think I have to remind you that the segment addresses will be
different for you. Alright let's put a value on that address.
E 2E02:000E (and change it to 9)
Ah, it didn't work. I knew it wouldn't, did you? As I said this address
hold the player balls and it will be compared with a predefined value. If
you want more balls you gotta find the predefined value. That's very easy,
just breakpoint on memory access to 2E02:000E
BPM 2E02:000E RW
The next time Softice pops up will be when you loose a ball and you
will see this code:
MOV AL,[33DF] ; Get predefined value
CMP [33DE],AL ; Compare it with user value
JA 0B4D ; If the same jump to end session
Let's change the predefined value:
E DS:33DF (and change it to whatever you fancy)
And it works just fine. Use a hex editor as usual to patch it. Now this
way of making cheats is very nice and funny. But a more elegant way would
be to make a trainer. So everytime we press "+" we increase our ball limit
in 1 ball. Trainers involves pretty complex assembler programming. There
are some trainer tutorials on the Web, but they assume that you are at
least on an intermediate level of assembler programming. Don't worry I will
explain for you in a later lesson (if there's a demand) in detail how to
write trainers. I'll explain the whole set, how to write TSR programs which
is basically the same as writing a trainer. For those of you who can't wait
for that lessons here are some clues.
The program has to be memory resident. It has to read the keyboard on
every cycle of the processor to see if a key has been pressed and if so,
which key was pressed. To make a program resident you'll have to hook an
interrupt and redirect it to your program.
CHEAT CODES, WHERE???
As I said in the beginning, almost all of the games released since 1992
contains built in options which can be triggered. In PF there are some
cheat codes that the programmers put in. I will now show you the basics of
finding these codez.
There are two ways of finding them, both can be useful in different
cases. The first one is simply dumping the file in a hex editor and read
all the strings you find. The other way is to debug the game (what else)
and put a breakpoint on keyboard reading, usually interrupt 09, and see
what the program is looking for. Let's try the first method.
Load TABLE1.PRG in a hex editor. Search for "cheat", "is" and
everything else you can think of if you come up empty. When I searched PF
for the string "cheat" it was found in three places. Here is what I found.
JOHAN$ CHEAT$
TECH$ EARTHQUAKE$
TSP$ EXTRA*BALL$
DANIEL$ SNAILS$
GABRIEL$ FAIR*PLAY$
ROBBAN$ STEIN$
GREETS$
And just below them are the messages you'll get when you have typed
them in.
_________________
I would rather be a sparrow than a snail
----------------------------------------
You will now get 7 balls dude
----------------------------------------
All cheats have now been reset
----------------------------------------
The tilt feature is now disabled
----------------------------------------
There are alot of nasty cheats in this game....
----------------------------------------
The dot machine system.....coded by JOHAN
----------------------------------------
Music......................coded by DANIEL
Obviously there are cheat codes here, you can get 7 balls and disable
the tilt function. And you can reset the cheats. I call this an built-in
trainer (almost). I'll leave it up to you to try these codes. For method 2
I'll leave it up to you as a homework to study debugging techniques to find
the cheat codes by tracing through the keyboard routines.
That's all for now friends, more in the next
lesson. Please e-mail me
with your work (the cheats you have made, write an essay on it, on how you
approached the program, etc., etc.). Your questions and remarks on my work
are also welcomed.
indian_trail@hotmail.com
(10-Oct-97)

Go to the parent page: Software hacking.