Classic Computer Magazine Archive COMPUTE! ISSUE 55 / DECEMBER 1984 / PAGE 10

Disabling Apple's RESET Key

How do you disable the RESET key on the Apple II+ in BASIC?

Alex Tarlecky

The RESET key generates a hardware interrupt on the Apple, not a software interrupt. However, it's still possible to control the interrupt request by altering the RESET vector at memory locations 1010 and 1011 ($3F2 and $3F3). The value stored in these locations (in low-byte, high-byte form) is set at power-up by whatever program is controlling the Apple. If no disk drive is attached and the Apple has an Autostart ROM, the RAM RESET vector points to BASIC. If there is a disk drive, the computer enters the bootstrap program contained in ROM on the disk-controller card. The value of the RAM RESET vector is usually set by software loaded from the disk.

Autostart ROM only boots the disk on RESET when the computer is first turned on. Other RESETs initiate a jump to the address held by the ROM RESET vector. The operating system uses a code stored in location 1012 ($3F4) to determine if the request for a RESET was initiated by a power-up or not. This code is never properly set at power-up, so a "cold start" results, rebooting the BASIC operating system from the disk. Any program can scramble this code and force a cold start by POKEing a new value into this location.

The code byte at address 1012 ($3F4) must be the Exclusive-OR between 165 ($A5) and the contents of 1011 ($3F3), or a power-up RESET will result.

If your intention is to prevent unauthorized people from LISTing your programs, you could enter this as your greeting (HELLO) program:

10 REM AUTO RUN GREETING
20 POKE 1012, PEEK(1012) AND 10
30 END

This alters the RESET vector to an invalid number, so pressing the RESET key to interrupt the program forces a cold start, causing the disk to reboot. One disadvantage is that all users, including you, will be prevented from interrupting or listing the program when booting from this disk.

Line 20 could also be included in the program you wish to protect. Pressing the RESET key would cause the disk to reboot, and the altered location would then be correct until the program was run again. But remember that no protection method is absolutely foolproof—this technique will only discourage people from attempting to tamper with your program.