20

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?

Brian H
  • 60,767
  • 20
  • 200
  • 362
  • 5
    Commodore started including a reset switch with the CBM-II line. The Commodore 16 and Plus/4 came out after the CBM-II line, and before the Commodore 128 line, and have a reset switch. – Tim Locke May 28 '21 at 00:06
  • poke 808, 225 :) – Peter Parker May 28 '21 at 10:08
  • Related: https://retrocomputing.stackexchange.com/questions/3045/what-was-the-purpose-and-history-of-the-c64s-special-keys – bjb May 29 '21 at 22:01

1 Answers1

35

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.

Raffzahn
  • 222,541
  • 22
  • 631
  • 918
  • I remember the RESET button on my Apple//c at school growing up, and the Reset button by itself never did anything. You had to hit Ctrl-Reset. I also seem to remember that it would sometimes just interrupt the program and give you a prompt, rather than reset the machine. – trlkly May 28 '21 at 10:33
  • 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 '21 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 '21 at 14:12
  • @ilkkachu True, I should have worded that different. Done. Better? – Raffzahn May 28 '21 at 14:14
  • 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 '21 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) – Jean-François Fabre May 28 '21 at 20:48
  • I remember my favorite reset on the C64 was grounding a pin on one of the rear ports. I got so good at it, i could do it with my eyes closed. – Will I Am May 28 '21 at 23:13
  • 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 '21 at 23:22
  • @Raffzahn That makes sense. What's funny is that we were all convinced you had to also hit the open Apple key. I suspect the student who showed us that was familiar with IBMs and Ctrl-Alt-Delete, and the rest of us never questioned it since it worked. I only found out later when reading the some books about Apple BASIC which were going to be discarded. – trlkly May 29 '21 at 04:16
  • 1
    @trlkly: The Apple //e and Apple //c reset code checks whether the paddle-button input wired to the Open-Apple key is pressed and, if so, it trashes the contents of a few bytes in each group of 256. Because the trashed bytes include the soft-reset vector and validation key, this will ensure that the Apple performs a reboot rather than a software-controlled reset. – supercat May 29 '21 at 19:27
  • Incidentally, I remember a magazine article back in the day describing how to modify the Apple II keyboard so that the reset key wouldn't do anything unless the control key was pressed. The article mentioned that people had done a variety of mods to their machine, such as adding a push-button somewhere else on the case, or building a cardboard shield around the key, but the control-key mode seemed like the most practical. – supercat May 29 '21 at 19:31
  • BTW, I wonder if anyone back in the day suggested that people with a pre-auto-start ROM Apple II copy down instructions for how to recover from an accidental reset: type 3F2.3F3, read the numbers, and if they were e.g. 12 34, type 3412G [swapping the first and second two pairs] – supercat May 29 '21 at 19:37