Hareraiser Deprotection and 128k Compatibility

Background

I found out about Hareraiser, and why it might be the worst game ever made, from Stuart Ashen's presentation to the Norwich Gaming Festival 2017.

Hareraiser Prelude was released for just about every format available at the time but the Spectrum version was the most advanced. Hareraiser Finale was only available on the BBC Micro, C64 and Spectrum.

Hareraiser Prelude was released in 1984 and Hareraiser Finale in December 1984. The original games do not work on the Spectrum 128k or higher and both are protected in that if you try to break into the program by pressing caps lock and space then the Spectrum will crash. The games predate the Spectrum 128k but they are mainly written in BASIC and should work.

I aim to deprotect the games so we can access the source code and make them work on the Spectrum 128k.

Download

Download the modified games and listings here.

Notes
  1. This version is compatible with 128k Spectrum if it is loaded using 48k compatibilty mode.
  2. The clouds in the game contain the word Spectrum in 128K mode, but the game runs correctly. I believe the Spectrum 128k cannot use the last 2 UDGs, which probably explains this anomaly.
  3. Finale also uses lines 22 and 23 on the screen and because system variable 23659 is set to the default to allow us to break into the code the scroll? prompt may appear on some screens. This isn't user friendly but necessary if you want to be able to break into the program. Simply press the enter key to continue.

Incompatibility

By default the original games do not run on 128k Spectrums, even in 48k Mode. The following errors occur on 128k and 128k+2 machines.

Spectrum 128k (Toastrack)

Spectrum 128k+2

When the original games are loaded in 48k Mode on 128k Spectrums the computer will reset.


Code examination

The TAP image includes 1 large data block which contains the loading screen, BASIC code and some machine code.

It has 2 means of protection:

1. Reset on L-Break Into Program,

2. Embedded white on white paper and ink colours in the listing to prevent a user seeing the listing by stopping the tape before (1) executes.

Separation of the code

In Prelude the tape has one data block containing the loading screen, BASIC code and machine code all in one saved data block.

This was popular with the 48k because it meant the loading screen would not be corrupted with filenames of later data blocks. The user would have to load the game with LOAD "" CODE rather than LOAD "" to load a BASIC loader before the loading screen and then game code after that that.

With the advent of the 128k LOAD "" CODE was discouraged and the BASIC loader became standard practice. I decided to put additional load statements in the main BASIC program in Prelude and rewrite the BASIC loader for Finale. LOAD "" CODE with a large data block could trash 128k reserved system variables.


Hareraiser Prelude

128k incompatibility

Does 128k BASIC or ROM functions change how variables stored after CLEAR is called?

What machine code routines are in memory in Hareraiser?

If we save a snapshot we can use snaplist.exe to retrieve the BASIC source code.

Loading the game into a 128k we see line 120 prevents execution with a code error:

120 CLEAR 30400: LOAD ""CODE : LOAD ""SCREEN$ : SAVE "HS"CODE 16384,16384: POKE f3613,176: POKE 23614,13: LET l=21: LET x=l*l

This should be:

120 CLEAR 30400: LOAD ""CODE : LOAD ""SCREEN$ : SAVE "HS"CODE 16384,16384: POKE 23613,176: POKE 23614,13: LET l=21: LET x=l*l

This is part of the original data block writer showing it goes upto memory address 32768.

Change this to the minimum for when the game loads:

120 LET l=21: LET x=l*l

Deprotecting the code

The POKE 23613,176 and 23614,13 give us a clue as to how to fix the ability to break into the code.

23613: ERR-SP - Address of item on machine stack to use as error return

PRINT PEEK(23613) : PRINT PEEK(23614) => default values: 84, 255

So in 48k Mode we can use Spin Debugger to POKE 23613,84: POKE 23614,255

Then we can break into the program and save the BASIC listing and memory dump from 30000-33000 to an empty tape.

Prelude Loader

To make this run cleanly on a 128k we should have a BASIC loader which in this case is in the game code itself.

Change game code:


119 LOAD "" CODE 30000 : LOAD "" SCREEN$ : PRINT #1;"     PRESS ANY KEY TO START" : PAUSE 0

Save Sequence

The game code can be saved to a new tape like so:

SAVE "HS" LINE 119
SAVE "HS" SCREEN$ (or point to original tape block, LOAD "HS" CODE 49152 : SAVE "HS" CODE 49152,6192)
SAVE "HS" CODE 30000,3000


Hareraiser Finale

Finale is a bit different in that it has a BASIC loader by default. A small piece of machine code loaded at address 30370.

Deprotecting the code

Again in 48k Mode we can use Spin Debugger to POKE 23613,84: POKE 23614,255

Black paper is shown and the editor is unresponsive. Refering to the Your Spectrum document:

Location 23659, unmemorably called DF-SZ, is used to record the number of lines in the edit area of the screen.

Test: PRINT PEEK(23659), default value: 2

So POKE 23659,2 using the Spin Debugger.

Then we can break into the program and save the BASIC listing and memory dump from 30000-33000 to an empty tape.

Finale Loader


10 INK O: BORDER O: PAPER O: CLS
20 POKE 23659,0
30 PRINT AT 22,0;
40 PRINT INK 7;TAB 3;"HARERAISER";TAB 21;"FINALE": PRINT AT O,O;
50 POKE 23659,2
60 LOAD "" SCREEN$
70 LOAD "" CODE 30370
80 LOAD ""

The game code can be saved to a new tape with the following auto start at line 499 so you can see the loading screen on a fast load emulator:


499 PRINT #0;"     PRESS A KEY TO START    " : PAUSE 0
500 BORDER 6 : PAPER 4 : INK 0

There are 7 spaces before and after the message in line 499. Don't overwrite line 500 as this is the first line of the intro.

Save Sequence

SAVE "HS" LINE 10
SAVE "HS" SCREEN$ (or point to original tape block, LOAD "HS" CODE 49152 : SAVE "HS" CODE 49152,6192)
SAVE "4-10.c1" CODE 30370,2398
SAVE "HS" LINE 499


Tools used

ZX Spin v0.622 Spectrum Emulator

Links

Why did some spectrum games need load code - Retro Computing Stack Exchange.
The Protection Racket - Your Spectrum Issue 2 (1984).
ZX Spin - ZX Spin download.

Back to index.