Classic Computer Magazine Archive COMPUTE! ISSUE 75 / AUGUST 1986 / PAGE 74

Guardian Angel For Apple DOS 3.3

Boris Troyanovsky

This program lets you protect Apple DOS 3.3 disks against unauthorized use or copying. Once a disk is protected, it cannot be copied with ordinary copy programs—including advanced nybble copiers, unless the would-be copier knows the proper parameters. It works on ail Apple II-series computers with DOS 3.3 and a disk drive. If you're using ProDOS and want similar protection, see "Apple ProDOS Protector" elsewhere in this issue.

Would you like the ability to protect your personal disks against unauthorized, copying? No matter where you stand on the copy protection controversy, nearly every computer user has disks that he or she doesn't want others to duplicate. "Guardian Angel" lets you protect any DOS 3.3 disk against unauthorized copying, yet allows you access to the disk with a simple, four-digit code.

To use Guardian Angel, you must enter and save five programs. The first four are very short machine language files which can be entered directly from the Apple II's built-in machine language monitor. To enter the monitor, type CALL-151 and press RETURN. Then type in the lines shown here:

0300: A9 03 A0 10 20 D9 03 60

0310: 01 60 01 00 01 09 30 03

0318: 00 20 00 00 01 F0 FE 60

0330: 00 01 EF D8

1B58: 20 00 03 EE 19 03 CE 15

1B60: 03 F0 03 4C 58 1B 20 00

1B68: 03 60

B78D: A8 86 2B 4C DF BC AD E5

BCDF: C9 05 90 08 C8 A9 D9 A2

BCE7: DA 4C EE BC A9 D5 AA 8D

BCEF: 53 B8 8D E7 B8 8E 7A BC

BCF7: 8E 55 B9 84 2A 98 4C A4

BCFF: B9

When you finish entering these lines, press CONTROL-RESET to exit the monitor and return to BASIC.

Now you must BSAVE each file to disk. Because these files are loaded under program control, you must save them using the exact filenames shown here. Enter these lines in direct mode (without line numbers) to BSAVE the four machine language files:

BSAVE IOB,A$300,L$33

BSAVE HTR.OBJ,A$BCDF,L$21

BSAVE HPREM.OBJ,A$B78D,L$0C

BSAVE COPY.OBJ,A$1B58,L$E6

Next, type in and save the Guardian Angel program following this article. This program is in Apple soft BASIC and may be saved under any filename.

Protecting Disks

To protect a disk, load and run Guardian Angel. It automatically loads the four machine language files into memory, then displays a menu on the screen. Press C to select the copy protection option.

The program then asks you to enter a unique, four-digit combination lock for that disk. Each digit can be a number from 0-9; press the ESC key if you make a mistake. Be sure to write down the combination and store it in a safe place. If you forget the combination, you may not be able to gain access to the protected disk yourself.

After you have entered the combination, the program prompts you to put the disk you want to protect into drive 1. To be on the safe side, you may want to write -protect this disk by covering its notch with tape. Insert the disk and press RETURN. The program considers this disk the original, which serves as a model for the new, copy-protected destination disk.

Next, you are prompted when it is time to insert the destination disk. Since the destination disk will be completely erased prior to being copied, be sure that it doesn't contain any valuable information. The program will continue to give you instructions as it completes the protection process. Simply follow the onscreen prompts until you see the message DONE.

At this point the original disk is unchanged, and the destination disk contains a copy-protected version of the original. The new disk will boot normally and behave normally, except that it is protected from unauthorized access and copying.

Restricted Access

Although Guardian Angel protects the disk, you are responsible for seeing that nobody using the disk has an opportunity to examine its contents. If you intend to let others use the disk, no program should give control of the system back to the user. That is, the program must not let the user exit to Apple soft BASIC or the machine language monitor. To prevent exit to BASIC, add the following lines to any Apple soft program:

0 ONERR GOTO 63999: POKE 1011,0 63999 RESUME

These lines protect an Apple soft program from being interrupted by CTRL-C or RESET.

To protect a machine language program the same way, include these two commands at the beginning of the program:

LDA #$00

STA $03F3

If you take these precautions, the disk cannot be copied and the programs on it can't be LISTed by anyone except you. However, since the disk will boot normally, other people can still use the programs it contains.

Denying All Access

In some cases you may want to prevent others from using anything on a protected disk. To accomplish this, save the following program on your original disk using the filename HELLO. When typing this program, replace XXXX with the four-digit combination you intend to use for that disk, and replace MYPROG with the filename of the program you wish to run.

0 ONERR GOTO 63999: POKE 1011,0

10 INPUT A$

20 IF A$ <> "XXXX" THEN PRINT "WRONG ACCESS CODE": PR#6

30 PRINT "CORRECT ACCESS CODE"

40 PRINT CHR$(4); "RUN MYPROG" 63999 RESUME

After saving the special HELLO program, copy-protect the disk as described above. When you boot the protected disk, it immediately prints a question mark, which is the signal to enter the secret combination. No one can proceed any further until the right combination is entered.

Reopening The Lock

There may be times when you need to access a disk after protecting it. To do this, run Guardian Angel and choose the A option from the main menu, then enter the combination for that disk when prompted. If the combination is correct, Guardian Angel returns you to Apple soft BASIC. Now you can use all the DOS commands (CATALOG, SAVE, LOAD, etc.) which were previously denied.

If you respond with the wrong combination, the computer will report an I/O ERROR every time you try to access the disk.

Guardian Angel

For instructions on entering this listing, please refer to "COMPUTE!s Guide to Typing In Programs" in this Issue of COMPUTE!.