Re-hacking the 80’s-part 1

What?

Thirty years ago I cracked a game. This is a first post of a series about trying to improve on that piece of (in this case relatively harmless) criminal activity.
Not sure if it will interest anyone or if anyone except bots is reading this blog, but I’ll just pretend there is an interested audience and start (‘oh yes, please do!)’.


Why?

About two years ago I posted some pictures I made on the Commodore 64 in the 80’s. In the caption of one picture I mentioned  that I made that picture for a game I hacked.

WILLOW PATTERN CRACK PIC

At that time there were people reading my blog, because I got a reaction from an admin of the Commodore64 Scene Database, a site dedicated to preserving everything the so-called commodore-scene made.

He wanted to put my pictures and the crack I mentioned on their site. I agreed for the pictures, but it seemed that time had corrupted the disk of the crack and I refrained from posting the crack.

After a while I took another look at the crack and noticed that the corrupted data was just a small patch of about 32 bytes that were supposed to be the value of 255 in stead of 0. I corrected the file and now the crack was like it used to be.

basic

man, I didn’t even get the name of the game right!

But I still didn’t post it on CSDB, because I was a bit apprehensive about it. The level of programming in the scene was pretty high in the 80’s and the standards has only got higher since then.
The crack by me was crudely done and together with my brother we made some multi-part mess, part basic, part assembly, with a naive (unintentionally) racist picture and music stolen from a demo (which just spells ‘LOSER’ in big capital letters, hack something that has already been hacked).
But in the back of my mind I had the idea, that if I could make a different version I could upload it with the original crack as a sort of then-and-now-package.
But the newer version would have meet the following criteria:

  • all parts contained in one file
  • have some original intro
  • have some trainer options
  • have original music

A few weeks ago I decided I that a piece of programming I worked on would work as an original-enough intro to the game. So finally I have accepted my own challenge:

I shall recreate this hack to the level I find acceptable to post on CSDB!

(insert lightning flash and rolling thunder)

To be honest: I had already met most criteria when I decided to blog about it, but it is not entirely finished and already I’ve come up with some stretch goals.

Where next?

In the next part I shall write some more about the background. But the series will be code centered and I don’t want to end this post without code.
Here is the code of the music routine I ripped from the game (it’s auto-labelled and auto-commented by a disassembler I  made and I omitted some data ):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
      JSR L0F66 ; 
      DEC L0ED5 ; 
      BEQ L0E0B ; 
      JMP $EA31 ; 
L0E0B LDA #0C ; 
      STA L0ED5 ; 
      LDA $FA ; 
      STA L0ED6 ; 
      LDA $FB ; 
      STA L0ED7 ; 
L0E1A LDA L0ECD ; 
      STA $FA ; 
      LDA L0ECE ; 
      STA $FB ; 
      LDY #00 ; 
      LDA(FA),Y ; 
      CMP #01 ; 
      BNE L0E3A ; 
      LDA L0ED8 ; 
      STA L0ECD ; 
      LDA L0ED9 ; 
      STA L0ECE ; 
      BNE L0E1A ; 
L0E3A LDA(FA),Y ; 
      BEQ L0E57 ; 
      STA L0ECF ; 
      STA $D400 ; Voice 1: Frequency Control - Low-Byte MOS 6581 SOUND INTERFACE DEVICE (SID)
      INY ; 
      LDA(FA),Y ; 
      STA L0ED0 ; 
      STA $D401 ; Voice 1: Frequency Control - High-Byte MOS 6581 SOUND INTERFACE DEVICE (SID)
      LDA #40 ; 
      STA $D404 ; Voice 1: Control Register 7 Select Random Noise Waveform, 1 = On 6 Select Pulse Waveform, 1 = On 5 Select Sawtooth Waveform, 1 = On 4 Select Triangle Waveform, 1 = On 3 Test Bit: 1 = Disable Oscillator 1 2 Ring Modulate Osc. 1 with Osc. 3 Output, 1 = On 1 Synchronize Osc. 1 with Osc. 3 Frequency, 1 = On 0 Gate Bit: 1 = Start Att/Dec/Sus, 0 = Start Release MOS 6581 SOUND INTERFACE DEVICE (SID)
      LDA #41 ; 
      STA $D404 ; Voice 1: Control Register 7 Select Random Noise Waveform, 1 = On 6 Select Pulse Waveform, 1 = On 5 Select Sawtooth Waveform, 1 = On 4 Select Triangle Waveform, 1 = On 3 Test Bit: 1 = Disable Oscillator 1 2 Ring Modulate Osc. 1 with Osc. 3 Output, 1 = On 1 Synchronize Osc. 1 with Osc. 3 Frequency, 1 = On 0 Gate Bit: 1 = Start Att/Dec/Sus, 0 = Start Release MOS 6581 SOUND INTERFACE DEVICE (SID)
L0E57 LDY #00 ; 
      CLC L ; 
      LDA $FA ; 
      ADC #02 ; 
      STA $FA ; 
      LDA $FB ; 
      ADC #00 ; 
      STA $FB ; 
      LDA(FA),Y ; 
      BEQ L0E83 ; 
      STA L0ED1 ; 
      STA $D407 ; Voice 2: Frequency Control - Low-Byte MOS 6581 SOUND INTERFACE DEVICE (SID)
      INY ; 
      LDA(FA),Y ; 
      STA L0ED2 ; 
      STA $D408 ; Voice 2: Frequency Control - High-Byte MOS 6581 SOUND INTERFACE DEVICE (SID)
      LDA #40 ; 
      STA $D40B ; Voice 2: Control Register 7 Select Random Noise Waveform, 1 = On 6 Select Pulse Waveform, 1 = On 5 Select Sawtooth Waveform, 1 = On 4 Select Triangle Waveform, 1 = On 3 Test Bit: 1 = Disable Oscillator 1 2 Ring Modulate Osc. 2 with Osc. 1 Output, 1 = On 1 Synchronize Osc. 2 with Osc. 1 Frequency, 1 = On 0 Gate Bit: 1 = Start Att/Dec/Sus, 0 = Start Release MOS 6581 SOUND INTERFACE DEVICE (SID)
      LDA #41 ; 
      STA $D40B ; Voice 2: Control Register 7 Select Random Noise Waveform, 1 = On 6 Select Pulse Waveform, 1 = On 5 Select Sawtooth Waveform, 1 = On 4 Select Triangle Waveform, 1 = On 3 Test Bit: 1 = Disable Oscillator 1 2 Ring Modulate Osc. 2 with Osc. 1 Output, 1 = On 1 Synchronize Osc. 2 with Osc. 1 Frequency, 1 = On 0 Gate Bit: 1 = Start Att/Dec/Sus, 0 = Start Release MOS 6581 SOUND INTERFACE DEVICE (SID)
L0E83 LDY #00 ; 
      CLC L ; 
      LDA $FA ; 
      ADC #02 ; 
      STA $FA ; 
      LDA $FB ; 
      ADC #00 ; 
      STA $FB ; 
      LDA(FA),Y ; 
      BEQ L0EAF ; 
      STA L0ED3 ; 
      STA $D40E ; Voice 3: Frequency Control - Low-Byte MOS 6581 SOUND INTERFACE DEVICE (SID)
      INY ; 
      LDA(FA),Y ; 
      STA L0ED4 ; 
      STA $D40F ; Voice 3: Frequency Control - High-Byte MOS 6581 SOUND INTERFACE DEVICE (SID)
      LDA #40 ; 
      STA $D412 ; Voice 3: Control Register 7 Select Random Noise Waveform, 1 = On 6 Select Pulse Waveform, 1 = On 5 Select Sawtooth Waveform, 1 = On 4 Select Triangle Waveform, 1 = On 3 Test Bit: 1 = Disable Oscillator 1 2 Ring Modulate Osc. 2 with Osc. 1 Output, 1 = On 1 Synchronize Osc. 2 with Osc. 1 Frequency, 1 = On 0 Gate Bit: 1 = Start Att/Dec/Sus, 0 = Start Release MOS 6581 SOUND INTERFACE DEVICE (SID)
      LDA #41 ; 
      STA $D412 ; Voice 3: Control Register 7 Select Random Noise Waveform, 1 = On 6 Select Pulse Waveform, 1 = On 5 Select Sawtooth Waveform, 1 = On 4 Select Triangle Waveform, 1 = On 3 Test Bit: 1 = Disable Oscillator 1 2 Ring Modulate Osc. 2 with Osc. 1 Output, 1 = On 1 Synchronize Osc. 2 with Osc. 1 Frequency, 1 = On 0 Gate Bit: 1 = Start Att/Dec/Sus, 0 = Start Release MOS 6581 SOUND INTERFACE DEVICE (SID)
L0EAF LDA L0ECD ; 
      CLC L ; 
      ADC #06 ; 
      STA L0ECD ; 
      LDA L0ECE ; 
      ADC #00 ; 
      STA L0ECE ; 
      LDA L0ED6 ; 
      STA $FA ; 
      LDA L0ED7 ; 
      STA $FB ; 
      JMP $EA31 ; 
L0F66 CLC L ; 
      LDA L0ECF ; 
      ADC L0FC7 ; 
      STA $D400 ; Voice 1: Frequency Control - Low-Byte MOS 6581 SOUND INTERFACE DEVICE (SID)
      LDA L0ED0 ; 
      ADC #00 ; 
      STA $D401 ; Voice 1: Frequency Control - High-Byte MOS 6581 SOUND INTERFACE DEVICE (SID)
      CLC ; 
      LDA L0ED1 ; 
      ADC L0FC7 ; 
      STA $D407 ; Voice 2: Frequency Control - Low-Byte MOS 6581 SOUND INTERFACE DEVICE (SID)
      LDA L0ED2 ; 
      ADC #00 ; 
      STA $D408 ; Voice 2: Frequency Control - High-Byte MOS 6581 SOUND INTERFACE DEVICE (SID)
      CLC ; 
      LDA L0ED3 ; 
      ADC L0FC7 ; 
      STA $D40E ; Voice 3: Frequency Control - Low-Byte MOS 6581 SOUND INTERFACE DEVICE (SID)
      LDA L0ED4 ; 
      ADC #00 ; 
      STA $D40F ; Voice 3: Frequency Control - High-Byte MOS 6581 SOUND INTERFACE DEVICE (SID)
      LDA L0FC8 ; 
      BPL L0FB4 ; 
      LDA L0FC7 ; 
      SEC ; 
      SBC #10 ; 
      STA L0FC7 ; 
      CMP #00 ; 
      BNE L0FB3 ; 
      LDA #00 ; 
      STA L0FC8 ; 
L0FB3 RTS ; 
L0FB4 LDA L0FC7 ; 
      CLC L ; 
      ADC #10 ; 
      STA L0FC7 ; 
      CMP #40 ; 
      BNE L0FC6 ; 
      LDA #80 ; 
      STA L0FC8 ; 
L0FC6 RTS ; 
 .BYTE #$20, #$80, #$00, #$00, #$00, #$00, #$00, #$00 ; 
 .BYTE #$00, #$00, #$00, #$00, #$00, #$00, #$00, #$00 ; 
 .BYTE #$00, #$00, #$00, #$00, #$00, #$00, #$00, #$00 ; 
 .BYTE #$00, #$00, #$00, #$00, #$00, #$00, #$00, #$00 ; 
 .BYTE #$00, #$00, #$00, #$00, #$00, #$00, #$00, #$00 ; 
 .BYTE #$00, #$00, #$00, #$00, #$00, #$00, #$00, #$00 ; 
 .BYTE #$00, #$00, #$00, #$00, #$00, #$00, #$00, #$00 ;

 

 

Posted in: Games, Programs

One comment

  1. Pingback: Re-hacking the 80’s-part 2 | Goerp

Leave a Reply

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