Re-hacking the 80’s-part 2

[part 1]

Das computer

So here’s some background about the project:

(2)

This one is pimped, they weren’t that colourful! (2)

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

one of the first intro's I remember. This one is from GCS, the German Cracking Service.

one of the first intro’s I remember. This one is from GCS, the German Cracking Service.

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.

Here the hacker changed the text on the billboard. Digital graffiti!

Here the hacker changed the text on the billboard. Digital graffiti!

 

 

 

A recent hack where the hackers made a pretty picture for an old and pretty crappy looking game,

A recent hack where the hackers made a pretty picture (3) for an old and pretty crappy looking game (Hideous Bill),

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.

Our cartridge was wrapped in tape to make it fit in the carttridge slot.

the cartridge we had was wrapped in tape to make it fit in the carttridge slot.

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.

Very Matrix-like! (Of course years ahead of the actual movie)

A machine code mointor. Very Matrix-like!
(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.

'Actual games shots from a game you haven't bought.' (1)

‘Actual games shots from a game you haven’t bought.’ (1)

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.

gameplay1

That sword is nice to have but how to get it? And when do I use it?

gameplay2

Giants from hell!

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):

  1. Load game, start game
  2. Reset the computer (without turning it off!).
  3. from BASIC type : POKE 3123,24
  4. then type SYS 2096, voilá!

What is does is change this piece of code

1
2
3
 L0C30 LDA LD01E ; Sprite to Sprite Collision Detect MOS 6566 VIDEO INTERFACE CONTROLLER (VIC)
LSR ;
BCS L0C37 ;

to

1
2
3
 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.

 

 

 

Posted in: Games, Programs

One comment

  1. Pingback: Hacking the 80’s-part 3 | Goerp

Leave a Reply

Your email address will not be published. Required fields are marked *