RESTORE (Key)
The special key <RESTORE> or RESTORE causes on Commodore computers as the C64/128 or VIC-20 an interrupt (NMI). On the VIC-20, the signal from the key is routed through one of the VIA interrupt chips to the CPU and thus can be blocked in the VIA; on the C64/C128 it is connected directly to the CPU and can't normally be blocked (you can block it indirectly by causing an NMI through the CIA 2 chip and then, in your NMI handler, keeping the CIA 2's interrupt ouput line in its active low state instead of resetting it back to its inactive high state; since the NMI signal is only detected on the falling edge, this effectively shuts out any further NMIs, including those caused by the RESTORE key ). By utilizing the NMI system interruption, interesting effects can be programmed.
If all storage locations are in a normal state, the C64 is set back to its initial state again by pressing the combination RUN/STOP +RESTORE , while the program that was in the memory stays in the memory and can be started normally. This also works from situations in which the BASIC interpreter has no control (in machine language routines) and the RUN/STOP -key fails.
The initial state is the classic bright blue/dark blue design with bright blue text colour , followed by an empty screen with the word READY. and the blinking cursor below it.
Hints[edit | edit source]
By changing the storage locations 792 and 793 (normal standard values: 71 and 254, corresponds to the address $FE47, The standard NMI routine in the KERNAL) can be redirected to another routine.
An example: With this one can trigger a reset by pressing the RESTORE -key:
POKE 792,226: POKE 793,252
This corresponds to the address $FCE2, the RESET routine in the KERNAL.
Ignoring the RESTORE -key is activated with
POKE 792,193
and deactivated again (and with this the original behaviour is restored) with
POKE 792,71
(provided that the content of the storage location 793 is unchanged).
This corresponds to a change to the KERNAL-address $FEC1, by which the NMI routine only consists of an RTI (and with this has no function any more).