19

Most early microcomputers provided either a dedicated key (e.g. Apple ][), keyboard combination (e.g. PC clones), or dedicated hardware button (countless examples) to "Reset" the computer. This was the preferred way to perform a warm restart, which was needed often on early computers, since cycling the power creates unnecessary wear-and-tear.

However, on early Commodore computers (e.g. PET, VIC-20, C-64), there is no similar reset function. Instead, most machines had a weird key called RESTORE that is wired up to, of all things, the CPU's non-maskable interrupt line. This resulted in many Commodore users either routinely power-cycling their machines to reset them, or hacking a hardware reset switch to make up for this shortcoming. Notably, Commodore did add a reset switch to the C-128, and the Amiga always supported 3-key reset.

So what was Commodore thinking in providing a dedicated key for RESTORE while leaving out the reset functionality?

3

1 Answer 1

34

TL;DR:

There is no fundamental difference just because a different interrupt is used. For all practical purpose the Restore-key works like the Apple II's Reset-key or the PC's Ctrl-Alt-Del key combination.


In Detail

Most early microcomputers provided either a dedicated key (e.g. Apple ][), keyboard combination (e.g. PC clones), or dedicated hardware button (countless examples) to "Reset" the computer

Erm, sorry for nit-picking, but

  • the Apple II's Reset key is a dedicated reset button as it is direct connected to the CPU's reset line.

  • The PC's Ctrl-Alt-Del does not handle a dedicated CPU input like reset, but is a normal key press, detected by the BIOS keyboard handler if that one is still active.

However, on early Commodore computers (e.g. PET, VIC-20, C-64), there is no similar reset function. Instead, most machines had a weird key called RESTORE that is wired up to, of all things, the CPU's non-maskable interrupt line.

Exactly. NMI is, like Reset, an interrupt of the CPU that can not be ignored. Perfect for the purpose of pulling a system from any unwanted state - except unlike Reset, NMI allows resuming operation if deemed useful. And that's what Commodore did, depending on NMI handling.

This resulted in many Commodore users either routinely power-cycling their machines to reset them, or hacking a hardware reset switch to make up for this shortcoming.

I wouldn't blame that on the key combination, but rather on software that hijacked the NMI handler to provide some kind of 'protection'.

Notably, Commodore did add a reset switch to the C-128,

To support factual usage. Much like IBM with Ctrl-Alt-Del - that was also not intended for use by customers. :))

So what was Commodore thinking in providing a dedicated key for RESTORE while leaving out the reset functionality?

It provided exactly the same functionality as IBM or Apple did. A key (combination) that pulls the CPU from whatever it's doing, puts it under control of the KERNAL/BIOS/MONITOR to decide what to do next. In that aspect Commodore's way is not only the most clean, but also the most versatile one. Apple and IBM only left a choice of

  • warm start as default, or
  • whatever a user program wants to do

For the IBM-PC this means that when the keyboard interrupt handler detects the designated key-combination it calls the BIOS reset routine with a shortened sequence. This will of course only work as long as the default keyboard handler is invoked with a INT 9h. As soon as some software installs their own, the machine will do whatever that software prefers - like opening the Windows login. :))

If the handler is taken over by a program, then only a real hardware reset will help - that's why all my PCs always had one. Also, modern power supplies simply cut off and shut down whenever the power button is pressed long enough - an addition in hindsight to enable a PC to "reset" even with the vector hooked by unfriendly software. Sounds kinda like Commodore's addition of a reset button with the C128, doesn't it?

On the Apple II Woz repurposed the CPU reset - or enhanced it - to handle reset vs. BASIC restart. When Reset is pressed a RESET is issued:

  • the CPU fetches the RESET vector, pointing to
  • the monitor reset routine to be invoked
  • it does (like the PC) some initialization
  • then checks if the warm-start vector in RAM at $03F2 is valid
    • if no it performs a cold-start
    • if yes, it jumps to wherever that vector points.

Ultimately whatever routine is hooked is executed - which of course again can be some user program. So not much different from the PC in the way that it can be hooked to suppress a warm boot/restart.

If not hooked, it uses the BASIC warm start entry point.

On the C64 it works like on the Apple. By pressing RESTORE an NMI is issued, the CPU fetches the NMI ​vector and

  • the CPU fetches the RESET vector, pointing to ​- the KERNAL NMI routine to be invoked
  • It transfers control to the vector located at $0318
    • if a user program hooked that vector, it does whatever this program wants
  • If not, it checks if it's a CIA-NMI
  • If not, it checks if there is a ROM-module to be activated
  • If not, it tests for the RUN/STOP key was pressed
    • if yes, BASIC warm start is executed
  • If not, RS-232 functions are handled.
  • It returns.

All three

  • offer the ability to do a warm start when invoked,
  • can be hooked by user programs
  • let user programs disable standard workings

Commodore's system offers in addition

  • the ability to recover from unintended invocation
  • is complete software controlled

So Commodore offered the same services as IBM or Apple do, but in addition it handles additional devices and allows a quiet recovery if nothing is to be done. Especially the last point is of interest, because it inherently swallows accidentally pressing of that dangerous Restore-key - in the Apple II there is no way to recover from an accidentally pressed Reset-key. They had to add a hardware switch to make it a two key combination.


Long story short: Commodore's implementation is a good implementation and on par, with what IBM or Apple offered. All three do have the same issues when their vectors get mangled.


P.S.: I guess it's obvious that I'm not even remotely a Commodore fanboi, and Woz' solution is for sure the most creative, using the least resources. Still, Commodore's middle of the road, schoolbook approach is to me the most favorable.

12
  • 2
    @trlkly yes, but using CTRL is a later add-on. The very first keyboard had a direct wired Reset, which did lead to users hitting it by accident, so the later II(+) became a switch on the keyboard-PCB that could enable/disable the additional use of CTRL. but unlike with Commodore, where the RUN/STOP key was detected by software, Applestill kept it a direct button - just now routed as well thru a second pair of contacts within the CTRL key. Again later models, like the IIc, had that modification always active - and RESET moved out of the regular keyboard.
    – Raffzahn
    May 28, 2021 at 12:50
  • 1
    Don't modern PC's shut down instead of reset if you long-press the power button? I have one HP small form-factor machine that's missing the reset button and I've had to power cycle it that way a few times. It takes longer than a direct reset. (Yes, I should check if the motherboard has the pins for a reset button and add one.)
    – ilkkachu
    May 28, 2021 at 14:12
  • 1
    @Raffzahn, yep, matches my experience better now. (Blah, I just think it's a bad substitute for proper reset, but never mind.)
    – ilkkachu
    May 28, 2021 at 14:24
  • 1
    there's the exact same NMI button on the Oric 1 and atmos. It's under the computer but it also calls 6502 NMI. And can fail if the NMI has been redirected. I sometimes used that to unprotect games (that didn't tamper with that NMI switch) May 28, 2021 at 20:48
  • 3
    On a 6502, NMI can be ignored. This will happen when the CPU has locked up by executing an illegal instruction such that the PLA outputs decoding the instruction do not reset the ring counter that (partly) indexes the PLA. Once the ring counter overflows, the CPU will lock up and respond only to hard reset. An example of such an illegal opcode is 0x02. This is why C64 developers install user-port reset switches.
    – d3jones
    May 28, 2021 at 23:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .