Classic Computer Magazine Archive COMPUTE! ISSUE 41 / OCTOBER 1983 / PAGE 272

Protector For VIC-20

George Trepal and Doug Smoak

Disabling certain commands on the VIC can be a very useful way to protect your programs. This article demonstrates how to disable the SAVE, RESTORE, STOP, and LIST commands with a few simple POKEs. There are some techniques here for the 64, too.

Sometimes it's nice to have a VIC that isn't fully functional. Maybe you're a teacher and you don't want your program listed by students. Or perhaps you've written a game you don't want someone to save. Let's look at a few ways to block your VIC's SAVE, RESTORE, STOP, and LIST.

Obviously, it's nice to have a program that can't be SAVEd (that is, copied). When you SAVE a program, the VIC goes to a table (a list of memory addresses in RAM) to get the address of the SAVE routine. Once it has the address, it jumps to the routine and puts the program on tape. Guess what happens if it gets the wrong address.

If you POKE the two values under the protection method for SAVE, the address now points to the LOAD routine. When you tell the VIC to SAVE, it tries to LOAD instead. It would have been just as easy to give the address of the NEW or LIST routine or anything else. In fact, as long as the value of 818 is not 113, or the value of 819 is not 246, the machine will not SAVE. You can try any numbers you want and see what happens. To reactivate the SAVE routine, POKE in the normal values in the table. Or you can press the RUN/ STOP and RESTORE keys at the same time, and that will reassign the correct addresses.

Now let's get the RESTORE key out of action so that it can't correct the wrong address. Check the table and use the two POKEs. Notice that the table doesn't give the normal values for the RESTORE key. The normal values are obtained by PEEKing the table values used before POKEing in your values. With the RESTORE, POKEing in the normal values after the new values are in will not reactivate the RESTORE key.

The STOP key is easy to do away with. If you're using the VIC for a demonstration, it's nice to have it unstoppable.

LISTing is a bit more complicated to disable. One way to do it is to embed a control character that will cause the listed characters to be the same color as the screen. For example, white letters on a white screen result in a blank screen. The table gives the method. Put a REM line in the program and follow the instructions. Everything after the REM" will be invisible.

The super POKE is POKE 808, 100. STOP, RESTORE, and LIST are now all dead. LIST isn't fully dead, but it might as well be since it prints only nonsense.

Before you use any of these commands, make sure that your program is running the way you want it to. Now add the lines that you want from the table. Usually, adding them as the first line of the program is best. Do not RUN the program yet, however. Double-check to make sure all the numbers are right, and SAVE the program. The table POKEs won't take effect until the program is RUN. The program is now safe on tape. When it is LOADed and RUN, the POKEs will take effect.

VIC Memory Addresses In RAM

(Some 64 addresses also given)

Function	Protection Method	Normal Values
STOP,		(VIC) POKE 808,100 	(VIC) POKE 808,112 (64) POKE 808,237
RESTORE,	(64) POKE 808, 225	(64)POKE 808, 237
and LIST
STOP		(VIC) POKE 808,127	(VIC) POKE 808,112
		(64) POKE 788, 52	(64) POKE 788, 49
	 	POKE 793,203
SAVE		POKE 818, 73		POKE 818, 113
		POKE 819, 245		POKE 818,113 POKF 819,246
(VIC or 64)
  1. REM" "
  2. press CONTROL and 9
  3. move cursor to second quote mark
  4. press SHIFT and INST DEL
  5. press SHIFT and M
  6. press SHIFT and INST DEL
  7. press CONTROL and screen color
  8. press RETURN