We Color Computer users have a special place in our hearts for Diecom games. They were of the highest quality and very fun to play. But Dave Dies decided to use copy-protection on his program disks to thwart illegal distribution of his games.
I am of the opinion that copy-protection on good, high quality software will increase sales. It will also alienate a few of your customers. It is a trade-off every publisher has to deal with.
While hardware will cease to operate over time, software should last forever. Twenty years later copy-protection has an unintended consequence of causing software to become non functional along with it’s hardware.
Best practices for software archival require us to move the data forward onto new media after a certain amount of time. But this is complicated by publisher’s use of copy-protection. Below I describe a method of “moving forward” your Diecom games.
Diecom’s disks have a two pronged attack for software thieves. Half the floppy disk is formatted with an unusual sector count and size. Secondly tack zero is formatted with no sectors at all, but a pattern is placed there to be inspected by the game loader.
There is no easy way for Color Disk BASIC to query the disk to determine its physical geometry. So instead the authors of Color Disk BASIC invented a predetermined format. On a normal Color Computer floppy disk every track is formatted the same. Each track has eighteen 256 bytes sectors, numbered 1 to 18. If this standard is deviated from all the Color Disk BASIC utilities (and Disk BASIC itself) will have trouble getting information off the disk.
Here is Diecom’s format
|Track Number||Sector Coun||Sector Size||Sector IDs||Notes|
|0||0||N/A||N/A||Formatted with a pattern, not sectors|
|1||1||1024 bytes||10||Sector ID field contains the track number zero|
|2||2||1024 bytes||10, 20||Sector ID field contains the track number zero|
|3||2||1024 bytes||10, 20||Sector ID field contains the track number zero|
|4||2||1024 bytes||10, 20||Sector ID field contains the track number zero|
|5||2||1024 bytes||10, 20||Sector ID field contains the track number zero|
|6||2||1024 bytes||10, 20||Sector ID field contains the track number zero|
|7||2||1024 bytes||10, 20||Sector ID field contains the track number zero|
|8||2||1024 bytes||10, 20||Sector ID field contains the track number zero|
|9||2||1024 bytes||10, 20||Sector ID field contains the track number zero|
|10||2||1024 bytes||10, 20||Sector ID field contains the track number zero|
|11||2||1024 bytes||10, 20||Sector ID field contains the track number zero|
|12||2||1024 bytes||10, 20||Sector ID field contains the track number zero|
|13||2||1024 bytes||10, 20||Sector ID field contains the track number zero|
|14||2||1024 bytes||10, 20||Sector ID field contains the track number zero|
|15||2||1024 bytes||10, 20||Sector ID field contains the track number zero|
|16||2||1024 bytes||10, 20||Sector ID field contains the track number zero|
Here is a visual representation of the layout:
The thin red lines represent the ID fields and the dark blue blocks represent the data fields. If you would like more information regarding how data is organized on a floppy disk see the wd179x data sheet.
The Color Computer hardware is capable of reading this disk (as evidenced by the fact the game will play). But Color BASIC is of no help for copying this data. Or is it?
Color Disk BASIC can be modified to help us read this data. So let’s plan our attack. Tracks 17-34 would normally be copyable by Disk BASIC, but since they are after the non standard tracks, Disk BASIC fails before even attempting them. We can use the DSKI$ command to read these sectors and the DSKO$ comand to write them back out. I then can modify Color Disk BASIC so DSKI$ will read the large 1024 bytes sectors without overwriting any low memory global variables.
We can also modify Disk BASIC’s ROM DSKCON routine to read entire tracks.
The object of this exercise to to create a DMK disk image of the original Diecom program disks. These DMK disk images can be used to play the games in emulation on modern hardware. A Catweasel (in addition with Tim Mann’s excellent DMK2CW software) can be used to write these DMK images back to a real floppy.
If there is enough interest I may be able to write a Color Computer program to write these images back to a real floppy. But this is non trivial.
- Color Computer
- Color Computer floppy disk drive
- Three blank, formatted floppies
- Your Diecom program disks
- PC with a 5 1/4 inch drive
- David Keil’s CoCo 2 or CoCo 3 emulator *or* the MESS emulator
- Your favorite Hex Editor
- Your favorite PC based ‘C’ compiler
- How to use your Color Computer floppy disk system.
- How to image a disk using Jeff Vavasour’s RETRIEVE and DSKINI programs.
- How to configure David Keil’s emulators or the MESS emulator.
- How to compile a ‘C’ program.
I developed these programs and this process using a CoCo 3. But it should also work with a CoCo 1/2 put into “All RAM Mode”. Also, these programs were written for Color Disk BASIC version 1.1. They will not work with version 1.0. If there is any demand I can modify them to work with version 1.0.
On this disk image there are two programs: TRANSFER/BAS and TRACK0/BAS. The first step is to copy this disk image (using Jeff Vavsour’s DSKINI program) to a real floppy disk. Then run each of the programs. They both require a newly formatted floppy before they are started.
TRANSFER/BAS copies tracks 1-34 onto a normally formatted floppy disk. It handles the large 1024 byte sectors by splitting them into 256 bytes chunks and writing them onto four normal sectors. TRANSFER/BAS ignores track zero.
TRACK0/BAS issues four “Track Read” commands to the CoCo’s Floppy Disk Controller on track zero. It then writes these four tracks to a normal disk. The track data is split into 256 byte chunks and written on to two tracks worth of sectors. Tracks 0 and 1 contain one copy, Tracks 2 and 3 contain another copy, etc.
The reason I make four copies is because the track read command in the CoCo’s FDC is really a diagnostic tool and not a data retrieval tool. So we need to compare the tracks returned to ensure we have valid data.
After running those two programs, the next step is to use Jeff Vavasour’s RETRIEVE program to make an image of the resulting floppies on your PC. Then you need to do some detective work.
Open the disk image that was created by the TRACK0/BAS program in a Hex Editor. You’ll need to compare the track zeros contained in that file. The first track starts at the beginning of the file and extends for 0x186A (6,250) bytes. The next track zero starts at 0×2400, then 0×4800 and the last one is at 0x6C00. If they all look similar then you can choose any one of them. If one is totally different then ignore it and pick one of the other three. If all four are different then you may want to rerun TRACK0/BAS and try again.
After you pick a track you’ll want to copy the data to its own file. Remember to copy at least 0x186A (6,250) bytes — no fewer. Now it is time to fix-up some of the data on the track zero you choose. Look over the data and find the sequence ‘A1 A1 FB’. The numbers before this sequence needs to be ’00 00 00 00 00 00 00 A1′. So it reads: ’00 00 00 00 00 00 00 A1 A1 A1 FB’. Do not add this data, it needs to replace existing bytes. Don’t make the file longer! Do this to any other ‘A1 A1 FB’ sequences you find on the track. Save your changes and note the name of the file you chose for the track data.
Now it is time to compile a ‘C’ program that will take disk image and track zero you created and build a DMK image file. Download this, and unzip it into it’s own directory. Here are the command I use to finish this process on my Mac OS X box:
$ cd path/to/diecom2dmk
$ gcc -o diecom2dmk diecom2dmk.c libdmk.c
$ ./diecom2dmk diecom_game.dsk track0.data
The -o option sets the name of the executable. You can name the executable anything you like. The first argument to the “diecom2dmk” program is the disk image created by the TRANSFER/BAS program. The second argument is the name of the 0x186A (6,250) byte file that conatins the track zero data you extracted from the image created by the TRACK0/BAS program.
The newly created file (“diecom_game.dmk” in the example above) will be playable in David Keil’s or the MESS emulator.
MESS versions after 0.61b to 0.87 have a bug that cause DMK disk images like these not to work. But the bug has been fixed and MESS version 0.88 (to be released) will work fine.
10 CLEAR 5000, &H5FFF;
20 ATTR 3,2:WIDTH80
30 DIM A$(18), B$(18)
40 POKE &HD540;, &HFF; : REM ADJUST DSKI$/DSKO$ TO ACCEPT SECTOR IDS GREATER THAN 18
50 REM COPY PATCH TO UNUSED RAM
60 FOR X=&HDF59; TO &HDF59;+9
70 READ A$: POKE X, VAL("&H;"+A$)
80 NEXT X
90 DATA 4F, B7, FF, 49, B6, FF, 48, 7E, D8, 3C
100 PRINT "THIS PROGRAM WILL COPY THE NON STANDARD SECTORS ON DIECOM DISKS (TRACKS 1-16) AND THE STANDARD SECTORS (TRACKS 17-34) TO A NEW DISK."
110 PRINT "THE NEW DISK WILL BE A STANDARD RSDOS FLOPPY, AND WILL NOT BE A PLAYABLE DISK"
120 PRINT "MORE PROCESSING WILL BE NEEDED TO TURN THE DISK INTO A PLAYABLE DISK"
130 PRINT : PRINT "BEFORE RUNNING THIS PROGRAM HAVE TWO DISKS READY: THE DIECOM DISK AND A NEWLY FORMATTED BLANK FLOPPY"
140 PRINT : PRINT "THIS PROGRAM REQUIRES 34 DISK SWAPS. PLEASE BE GENTIAL WHEN OPENING AND CLOSING THE FLOPPY DRIVE DOOR. IF THE HEAD MOVES FROM TRACK TO TRACK BETWEEN A DISK SWAP WE'LL NEVER KNOW"
150 PRINT:PRINT"THIS PROGRAM IS COPYRIGHT BY TIM LINDNER (TLINDNER AT MACMESS.ORG) AND IS LICENSED UNDER THE GPL":PRINT
160 INPUT "INSERT THE BLANK FLOPPY AND PRESS ENTER"; A$
170 FOR X = 1 TO 16
180 PRINT "POSITION HEAD ON TRACK";X
190 DSKI$ 0, X, 10, A$, B$
220 INPUT "PLACE DIECOM DISK IN DRIVE 0";A$
230 PRINT "TRACK";X;"READ SECTOR";Y
240 GOSUB 630 : REM INSTALL DSKI$ PATCHES
250 DSKI$ 0, X, Y, A$, B$
260 IF X=1 THEN 300 : REM SKIP SECTOR ID 20 ON TRACK 1
270 POKE &HD590;, &H64; : REM ADVANCE BUFFER POINTER
280 PRINT "TRACK";X;"READ SECTOR";Y+10
290 DSKI$ 0, X, Y+10, A$, B$
300 GOSUB 690 : REM REMOVE DSKI$ PATCHES
310 INPUT "INSERT BLANK DISK IN DRIVE ZERO";A$
320 FOR D = 0 TO 1
330 IF X=1 AND D=1 THEN 410
340 FOR C = 0 TO 3
360 A$="":FOR A = Z TO Z+127: A$=A$+CHR$(PEEK(A)): NEXT A
370 B$="":FOR B = Z+128 TO Z+255: B$=B$+CHR$(PEEK(B)):NEXT B
380 PRINT "WRITING TRACK";X;"SECTOR";Y+(D*10);"PART";C+1;"TO BLANK DISK SECTOR";(D*4)+C+1;"FROM ADDRESS ";HEX$(Z)
390 DSKO$ 0, X, (D*4)+C+1, A$, B$
400 NEXT C
410 NEXT D
420 NEXT X
430 REM ALL DONE WITH TRACKS 1-16
440 FOR X = 17 TO 34
450 INPUT "INSERT DIECOM DISK";A$
460 PRINT "READING ALL SECTORS ON TRACK";X
470 FOR Y = 1 TO 18
480 DSKI$ 0, X, Y, A$(Y), B$(Y)
490 PRINT Y;
500 NEXT Y
520 INPUT "INSERT BLANK DISK";C$
530 PRINT "WRITING ALL SECTORS ON TRACK";X
540 FOR Y = 1 TO 18
550 DSKO$ 0, X, Y, A$(Y), B$(Y)
560 PRINT Y;
570 NEXT Y
590 NEXT X
600 PRINT "BLANK DISK IS NO LONGER BLANK"
610 PRINT "ALL DONE"
630 REM INSTALL PATCHES
640 POKE &HD590;, &H60;
650 POKE &HD839;, &H7E;
660 POKE &HD83A;, &HDF;
670 POKE &HD83B;, &H59;
690 REM REMOVE PATCHES
700 POKE &HD590;, &H06;
710 POKE &HD839;, &HB6;
720 POKE &HD83A;, &HFF;
730 POKE &HD83B;, &H48;
10 CLEAR 500, &H5FFF;
40 PRINT "THIS PROGRAM MODIFIES COLOR DISK BASIC TO ISSUE A READ TRACK COMMAND ON TRACK ZERO OF DRIVE ZERO"
50 PRINT "IT THEN WRITES THAT TRACK TO A BLANK DISK ACROSS TWO TRACKS WORTH OF SECTORS"
60 PRINT "IT DOES THIS FOUR TIMES. FILLING THE FIRST EIGHT TRACKS OF THE BLANK DISK WITH FOUR COPIES OF THE TRACK DATA FROM THE DIECOM DISK"
70 PRINT "THIS PROGRAM IS COPYRIGHT TIM LINDNER (TLINDNER AT IX.NETCOM.COM) AND IS LICENSED UNDER THE GPL"
90 FOR A = 0 TO 7 STEP 2
100 INPUT "INSERT DIECOM PROGRAM DISK";A$
110 POKE DV,0 : REM SET COMMAND TO RESTORE TO TRACK ZERO
120 POKE DV+1,0 : REM SET DRIVE TO DRIVE ZERO
130 POKE DV+2, 0 : REM SET TRACK TO ZERO
140 EXEC DC : REM GO DO COMMAND
150 PRINT "HEAD POSITIONED ON TRACK ZERO"
160 POKE DV, 2 : REM SET COMMAND TO READ SECTOR
170 POKE DV+4,&H60;
180 POKE DV+5,&H00; : REM SET BUFFER TO &H6000;
190 POKE &HD7F9;, &HE0; : REM CHANGE READ SECTOR COMMAND TO READ TRACK COMMAND
200 POKE &HD856;, &HE0;
210 POKE &HD762;, 1 : REM SET RETRY COUNT TO ONE
220 EXEC DC : REM GO DO COMMAND
230 POKE &HD7F9;, &H80; : REM CHANGE READ SECTOR COMMAND BACK TO READ SECTOR
240 POKE &HD856;, &H80;
250 POKE &HD762;, 5 : REM SET RETRY COUNT BACK TO 5
260 INPUT "INSERT BLANK DISK";A$
280 A$=" ":B$=" "
290 FOR C = 0 TO 1
300 FOR B = 1 TO 18
310 PRINT "WRITING ADDRESS ";HEX$(X);" TO TRACK";A+C;"SECTOR";B
320 D=VARPTR(A$):POKE D,128:POKE D+2, X/256:POKE D+3,(&H8000-X;) AND &H00FF;:X=X+128
330 D=VARPTR(B$):POKE D,128:POKE D+2, X/256:POKE D+3,(&H8000-X;) AND &H00FF;:X=X+128
340 DSKO$ 0, A+C, B, A$, B$
350 NEXT B
360 NEXT C
370 NEXT A
This article was written to help people preserve their old Diecom games. All of the software on this page is licensed under the GPL.