Copy protection
How Mountain Valley’s Commodore 64 disks were protected: a damaged track, a loader that checks for the damage, and a scrambled game.
The scheme
The disk releases used a protection written by Peter K, who signs himself P.G.K. It has three parts: a deliberately altered track 35, a compiled loader that checks for the alteration, and a main program stored in scrambled form. His master disk of tools and notes survives (below), and so does a 2017 account of how to remaster a disk with it, by Marcus.
Track 35
Two programs on the master disk, DOS and DOS-M/L, rewrite
track 35 of the game disk. In the master disk’s own words, they change
“the track number to track 36”, changing “the header
information”, and alter “the density”. A normal 1541 read of track 35
then fails, and that failure is the signature the loader looks for. A standard copier
reproduces the readable data but not the damage. DOS is a program compiled
with Blitz!, and DOS-M/L is its machine-code helper.
The loader
The first file on a game disk is the loader, named after the game and compiled with
Petspeed. It checks track 35 for the expected error, then loads four data files.
Marcus records two versions of it. The retail loader has red text and retries
indefinitely if the signature is missing. The one on the master disk,
MV.NEW.LOAD, has white text and aborts the load instead, and only that one
worked for remastering.
The game files
Each game disk carries four sequential files, listed in the master disk’s
PROTECT.INFO:
| File | Loads at | What it is |
|---|---|---|
CODE1 | $8C00 | Colour for the loading picture — “COLOR RAM” in the notes, though at this address it is the bitmap’s screen matrix |
CODE2 | $A000 | The hi-res loading picture |
CODE3 | $0801 | The game itself, scrambled |
CODE4 | $C000 | The routine that unscrambles it |
The scrambler
MAKE.CODE3 “will create a scrambled version of the main
program”. It initialises its machine code with SYS 2664
($0A68), asks for the filename twice and refuses to go on unless the two match,
then pokes the name into memory from $C001 and its length into
$C141 (49473). It asks for the source disk and calls SYS 49472
($C140), which writes the scrambled CODE3. The note in its header
warns that “the system will cold start when finished”.
The hardening notes
Four files on the master disk are notes written as REM lines, apparently meant
to be merged into each game’s BASIC:
LINES.-5.BAS— a five-line header, “written by Mountain Valley, protection by P.G.K”. It disables RUN/STOP and RESTORE, sets the border and background black, prints PLEASE STAND BY., clears$C000–$CFFF, and switches to the upper-case character set (POKE 53272,21).RUN/RES.INFO—POKE 808,234andPOKE 792,193disable the RUN/STOP and RESTORE keys. The first changes the low byte of the STOP vector and the second points NMI at anRTIat$FEC1. Use them, the note says, “as soon as possible at start of any BASIC program”.KEYBRD.INFO—POKE 56333,127turns the keyboard off by stopping CIA 1’s interrupts, andPOKE 56333,129turns it back on. Use it around disk access in BASIC, “else DEVICE NOT PRESENT errors break program if the drive is turned off”.DOS.INFOandPROTECT.INFO— the track 35 and file notes quoted above.
The master disk
Peter K’s toolkit, a disk headed MOUNTAIN VALLEY with 574 blocks
free: DOS (27 blocks), DOS-M/L (12), MV.NEW.LOAD (36),
MAKE.CODE3 (7) and LINES.-5.BAS (7), then KEYBRD.INFO,
RUN/RES.INFO and DOS.INFO (2 each) and PROTECT.INFO (1),
divided by two empty DEL entries. The disk image itself is not on this site; these are
screenshots of its files listed in an emulator.
The sign-off
The protection carries a message from its author, in among its data:
“Disk protection by Peter K. Lots of luck pal its pretty simple if you think a little harder. Dont give up theres a back door to everything. Just keep looking. — P.G.K”
Several of the Commodore 64 loading screens are signed “P.K.” in the corner, and since the loader is what displays them, the protection’s author is an obvious candidate for having drawn them. Nothing yet shows that they are the same person.
On the disks here
The Mermaid and the Crown is the
one protected original on this site, kept as a track-level .g64 because a
.d64 cannot hold the damage. Read directly, it matches the scheme above. Its
first file is a loader named MERMAID, 36 blocks, the same size as
MV.NEW.LOAD. The four CODE files follow it. Every sector header
on track 35 claims to be track 36. And the directory sector at track 18,
sector 1 links to itself.
The other fourteen original disks here are not in this form. Each holds the game as a
single program, with no loader and no CODE files, beside the zero-block
(C) BRIAN BETTS entry. How they came to be that way is not recorded.
Remastering, 2017
Marcus’s process for making a working protected disk again, from his notes of May 2017. It is summarised here as he gives it and has not been repeated for this site.
- Dump the originals with nibtools (
nibread, thennibconvto.g64) using a ZoomFloppy and a parallel-modified 1541. The.g64keeps the protection and runs in VICE and CCS64. - Build a new
.d64in DirMaster. CopyCODE1–CODE4from the original game disk, andMV.NEW.LOADfrom the master disk, renamed to the game’s short name. - Write it to a real floppy with
nibwrite. - On a C64, run
DOSfrom the master disk. It alters track 35 of the game disk. - With a sector editor (Di-Sector), change bytes 0–1 of track 18, sector 1
from
00 FFto12 01. That makes the first directory sector point to itself, track 18 sector 1, as it does on The Mermaid and the Crown.