Q. Is it possible to protect programs on the Amstrad CPC464 without using the ,P option when SAVEing them, and without using the ON BREAK command?
Christopher Johnson
Northwich, Cheshire
A. Not really. The ,P option ensures that a program can only be RUN or CHAINed (which also RUNs the program). The only other way you could protect a program is to use KEY and KEY DEF to disable the ENTER keys so that one a program's running, the user can stop it with two ESCapes, but can't do anything else.
KEY DEF 18,0,0,0,0 makes the large ENTER key generate nothing at all and KEY 139,"" disables the small ENTER key of the numeric keypad. To complete the ENTER disable you also have to KEY DEF 38,1,109,77,0 which means CTRL-M will not generate a carriage return either. (109 and 77 are the ASCII codes for lower and upper case 'm' respectively.)
Now, while a user may break into a program, there's no way they can LIST or do anything to the program, because they can't enter a command - none of the ENTER keys generate anything. However, all these definitions only occur once the program's started, so they don't really protect it at all - the 'breaker' can just LOAD and LIST your program.