Apple II and IIe: Controlling the Reset key

On an Apple II or Apple IIe computer, the programmer can control how a BASIC program will react when reset or control-reset is pressed. DOS uses three special locations which it consults whenever reset or control-reset is pressed. Based on the values contained in these memory locations, DOS may halt a program, rerun the program, reboot a disk, or take another action you specify.
This article has been archived and is no longer updated by Apple.
Changing these values changes the results of typing reset or control-reset from the keyboard.

To discourage users from breaking into a Basic program, some programmers change the reset vector to restart a running program whenever reset is pressed. Put the following line at the beginning of your program to get this effect:

10 POKE 1010, 102 : POKE 1011, 213 : CALL -1169

A value is not POKEd into location 1012 because the CALL statement sets location 1012 to the correct value for the current situation. When you wish to return reset to its normal action, include this Basic line:

20 POKE 1010, 191 : POKE 1011, 157 : CALL -1169

You can also force a disk boot to occur whenever reset is pressed. Simply change the value of one of the three reset vector locations. An example is:

30 POKE 1012,1

You may instruct the reset vector to call one of your own machine language routines by placing the address of this routine in locations 1010 and 1011, and CALLing the ROM routine at location -1169 to set location 1012. Your routine may process information, display a warning message, or do anything else you wish.
Published Date: Feb 19, 2012