Re-hacking the 80’s-part 2
Das computer
So here’s some background about the project:

First of all: The Commodore 64: it was the computer I grew up with. I loved it. It was quite popular and there were thousands of games. There is an EMORMOUS amount of information about this computer so I won’t go into that here.
The scene
You also had hackers, people (often very young), that managed to circumvent the copy protection (‘cracking’) and distributed the cracked games.
The hacker scene was very competitive and they were always trying to be the first to

crack a game or impress by putting a nice intro or trainer-function in the game (they even hacked a game of mine!). In the beginning the intros were simple but the competetiveness brought out the best in the young crackers and after a while you could have intros that had better graphics, sound and programming than the game itself.


Cracking was (and is) illegal and so there was always a air of mystery surrounding hackers. For me hackers were cool!
I wanted to be one, but didn’t know where to start, didn’t know anyone in the scene , I didn’t even know anyone who had a C64 (my brother had the contacts).
Baby steps in the kiddy pool
Logically I didn’t know much about the tools of the ‘trade’, but we had an expansion you could fit into a slot for the C64: the Power cartridge.

It had all kinds of cool things, like build-in speedloaders, BASIC expansion, a machine code monitor and a way of saving the complete state of the computer to disk.
Those last two options were what made it possible for me to crack a game:
At one point my brother borrowed an original game for copying purposes. It had some copy protection, but with the cartridge you could load the game and then save the state of the computer. Loading that state meant you could always resume from that point. Such a state could not be distributed as a crack, because you needed that same cartridge to load such a state.
But if you opened the machine code monitor you could save parts of memory like regular files and try to find a start address. Then you could load those files, call the starting address (‘SYS’ to start a piece of machine code from BASIC) and maybe if you had all relevant pieces of memory loaded the game would run.

(Of course years ahead of the actual movie)
The game in question was not very well protected: you could see the BASIC SYS command in memory and calling that after a reset would run the game. So the challenge was to find the relevant pieces of memory.
To combine those pieces to one part and adding an intro and a music was a big ask for me. With the help of my brother we made some kind of multi-piece loader. It used a weird feature of Commodore BASIC where if you loaded a piece of memory from a running BASIC program, the BASIC program would start from the beginning after loading but with all values of the variables intact .
Even to the standards of hacks then it was a bad hack. But a good starting point for this project!
The game
The game I talk about is The Willow Pattern Adventure A week ago I bought an original of this game. Seemed only reasonable to know what I talk about, and try to repeat the hack I did 30 years ago. You can see a screenshot of the packaging here.

Although I hacked the game, I must admit that I didn’t play it that much at the time. It looked nice and had some OK music, but we had hundreds of games and this game was quite tough! You had no map and the game was also very unforgiving: you could easily make a mistake which made it impossible to finish the game. And it wasn’t some kind of casual game, you had to invest a lot of time even if you played flawless.


But worst of all were the Giants. You had to jump from stone to stone while giants would try to grab you. And being hit or falling not only meant losing a life, it could also mean losing a sword, which could make the game unfinishable:
Jump jump jump jump, phew!, kill a samurai (5), oh no another samurai! now I must go back to get another sword, jump jump jump jump, try to get a sword, die, try again, pick up the sword, jump jump jump DIE LOSE SWORD END OF GAME!.
It didn’t take much of this for me to give up and try something else.
Little cheat
It’s almost the end of the second part. Still not much code, but the next parts will be better (or worse for non-coders).
I will leave with a nice little cheat I discovered during this project. It helps to avoid the grabbing hands of the Giants. Just follow these steps (4):
- Load game, start game
- Reset the computer (without turning it off!).
- from BASIC type : POKE 3123,24
- then type SYS 2096, voilá!
What is does is change this piece of code
L0C30 LDA LD01E ; Sprite to Sprite Collision Detect MOS 6566 VIDEO INTERFACE CONTROLLER (VIC)
LSR ;
BCS L0C37 ;
to
L0C30 LDA LD01E ; Sprite to Sprite Collision Detect MOS 6566 VIDEO INTERFACE CONTROLLER (VIC)
CLC ;
BCS L0C37 ;
What the code does is read some memory, $D01E where the video chip registers if a sprite hits another sprite. If that sprite is hit, the corresponding bit (in this case the first) is set to one.
LSR, shifts that first bit into the Carry bit of the CPU’s status register. The next instruction BCS is a conditional jump if the carry-bit is set (in this case if a collision has occured).
By changing LSR to CLC, you don’t shift the first bit, but instead always clear the carry bit (which is what CLC does), so the jump is never taken: a hit is now never registered.
(1) quote from the book ‘Only you can save mankind’ by Terry Pratchett. And pretty accurate: those screenshots always were from a version for a more advanced computer.
(2) pimped commodore taken from http://www.remix64.com/board/viewtopic.php?t=4619
(3) picture by Grass
(4) If you’re playing on an emulator you can change memory without resetting. In VICE open monitor with ALT-M, then type ‘> 0C33 18’ then leave the monitor with ‘x’.
(5) Yes, it was a game set in China that had Samurai.
Hacking the 80’s-part 3 | Goerp
[…] Re-hacking the 80’s-part 2<< […]