Classic Computer Magazine Archive COMPUTE! ISSUE 8 / JANUARY 1981 / PAGE 132

Caveat Interruptor or Placating a Rebellious KIM Without Sacrificing RAM

Philip K. Hooper

Summary: The dialog below presents a bizarre experiment that is easy to perform with a KIM-1, creating a runaway computer which no longer responds to ‘reset’. Fortunately, the use of an unusual keypad sequence will restore normal monitor control. Moreover, KIM's peculiar behaviour is shown to be a perfectly proper response to an abnormal situation.

O: If you have your interval timer set up to generate a non-maskable interrupt, i.e. a connection between PB7 and NMI (Figure 1), then you can try a strange little experiment. Game?

I: Sure, I'll give it a try. What do I do?

O: Turn on the power and set your NMI vector (17FA,B) so it points to some very long program-like cassette read (1872) without input or the 4C4C4C loop at 4C4C. You can even try just leaving it as it ‘comes up’, and still the experiment will probably work.

I: That's nothing new. Sometimes I DO point NMI to 1873, so I can load in consecutive files by just pressing ‘ST’ between loads. And sometimes I don't even bother setting it. What next?

O: Take a look into location 0170.

I: So? Looks pretty unremarkable - just another meaningless byte of hex garbage.

O: That's right. Whatever your KIM happens to drop into that location at ‘power up’. Now, pretend you are reaching for the ‘AD’ key but miss it and press ‘C’ instead.

I: Come on. I thought you said we were doing some sort of wierd experiement, but this is just stu ... Hey! What's happening? The display is gone, and I can't seem to bring it back using the keypad. Even ‘ST’ doesn't help. But reset will always … What the devil IS this, anyway? How come all I get when I press the ‘RS’ key is a brief flash and then nothing? Have you tricked me into ruining my computer or something? What can I do? Isn't reset always supposed to bring KIM back in a known starting state?

O: It is - and it does. Of course, you could switch the power off and back on. That would probably put things right. But suppose you had just keyed in two full pages of code and were about to save them on tape when this pathological behaviour started. Surely you don't want to lose all that code and have to key it in again! Can you regain control without losing your RAM?

I: Well I don't see how. The only control I have is from the keypad, and not a single one of the keys does me any good!

O: True. Not a single key will help - but three will.

I: Eh?

O: Hold down ‘ST’, momentarily press ‘RS’ and then ‘+’, and then release ‘ST’.

I: Say that again.

O: No! You just go back and read it again, from two lines above this and then do it.

I: How about that. It worked! And without losing all that imaginary RAM. You know, this could have accidentally happened to me, and with you not around I would have had to turn it off to fix it. Say, what happened, anyway?

O: Well, when you pressed the ‘wrong key’, you inadvertantly addressed the interval timer, at 170C*, and it responded by generating an interrupt, i.e. a signal to follow the NMI vector ‘somewhere’. Naturally, unless this ‘somewhere’ included a routine to sample and respond to the keypad, no keys other than ‘ST’ or ‘RS’ could possibly have had any effect. However, pressing ‘ST’ generates another NMI. Instead of helping get KIM back, it just sends it off to wherever it went before, again. ‘RS’ does bring it back, but only long enough to summon another interrupt. You see, when it returns control to the monitor, the monitor immediately accesses 170C again, unless the address stored in the pointer 00FA, B has been altered meanwhile.

However, holding ‘ST’ down will prevent recognition of this interrupt (the one invoked by the monitor after ‘RS’), while pressing ‘+’ will alter the pointer** so that the monitor no longer interrogates 170C. Then, since no further interrupt is being generated, releasing ‘ST’ restores normal operation at this point. Now, aren't you glad you asked?

I: Well, I ....

O: Say, give that ‘+’ key another quick press, will ya;?

Author's Notes:

*several other addresses produce the same effect as 170C

**the hex keys, ‘0’ - ‘F’, and also ‘PC’, alter the pointer as well and may be used in place of the ‘+’ key

Figure 1 - Enabling the Timer Interrupt

Although a single wire between A-15 and E-6 is sufficient for the experiment explained above, a SPDT switch permitting the selection of either NMI or IRQ provides for more varied use of the timer interrupt.