Applesoft: Simple Ways To Protect Programs

Some programmers prefer to conceal their code from inquisitive users. Keep in mind that if users are determined to LIST a program, they will. Be that as it may, here are a few obstacles to deter less tenacious users.
To prevent a user from LOADing your program in the first place, type control characters in the name of the program when you save it. These characters cannot be seen in a Catalog. However, users may know of a program in the DOS manual that they can use to find control characters in your program's name and modify it.

By the techniques below, you will discourage most attempts by preventing Applesoft from executing a LIST command properly.

Disable the LIST command by placing POKE 214,128 in the first statement line of the startup program HELLO. Once this command is executed, any Applesoft command is interpreted as RUN. When the user types LIST, the program RUNs. If NEW is entered, the program RUNs. Whenever the value of memory location 214 is greater than 128, your program will do nothing but execute.

NOTE: On some systems, a CTRL-RESET keystroke may disable the POKE 214,128 that is essential to this technique. To disable the RESET key, use POKE 1010,102: POKE 1011,213: CALL -1169 in your startup program, preferably on the second statement line.

With this arrangement, the program re-runs itself every time the user presses a CTRL-RESET.

CAUTION: These POKEs disable DOS; therefore, after the startup program runs, your program is unable to execute DOS commands such as "LOAD", "SAVE", and so on, unless your program enables the RESET key with the statements POKE 1010,191: POKE 1011,157: CALL -1169.

While this technique prevents a LOAD and LIST on a single drive system, someone with a multi-drive system could boot DOS and then LOAD and LIST the program from a second drive. There is still another protection the program can contain. You can program a DOS command to execute when your program is Listed without affecting a RUN of the program. Within the listing, you program a DOS command to Catalog the disk, reboot, or lock or delete files, just as though the command had been typed at the keyboard. Following the execution of the DOS command, the listing will disappear.

Here is a sample of this technique. Be sure to save any program you modify before using this method.

1. Load a Basic program into memory.

2. Add a remark as the new first line of the program. After the word REM, type 3 spaces and a DOS command, such as CATALOG, PR#6, DELETE filename, and so on.

Example: 10 REM CATALOG (three spaces between REM and CATALOG)

3. From the keyboard, enter: POKE 2055,13 : POKE 2056,4

4. Save this revised version of your program with a unique name.

5. Now type LIST.

The Apple will begin to list your program, but will stop the listing to execute the DOS command and CATALOG the disk. No further program statements will be seen. Experiment with various DOS commands to get the desired effect.

NOTE: Anyone distributing software for sale running on an Apple computer should become licensed through Apple Software Licensing. Search on Software Licensing for address information.
Published Date: Feb 18, 2012