14

I'm playing around with building an Altair 8800 emulator in my free time in C#. I've read through the Operator's Manual many times in the past, and I'm refreshing my memory of late.

I'm struggling to understand exactly how interrupts work. So, presumably, some kind of signal from outside the machine is capable of triggering an interrupt. What does that do?

I can see from the operator's manual, page 44, that when the machine is HALT'd, an interrupt will allow it to resume.

Page 45 goes on to tell us than an external device can "cause a RST instruction to be executed during an interrupt". What is meant by "during an interrupt"? Isn't an interrupt an instantaneous thing, in terms of execution?

Finally, certain instructions take multiple machine cycles to be processed. If an interrupt occurs during such an instruction, is the instruction allowed to finish processing? Is it cancelled outright? Is it paused midway through the cycles and resumed? That last one definitely doesn't seem right to me.

I feel like I'm fundamentally misunderstanding something very important here, but the manual isn't much help.

EDIT: Also, what signal specifically caused the interrupt? How did this signal reach the machine?

2
  • 3
    stackoverflow.com/questions/2165914/… seems relevant.
    – Jon Custer
    Aug 1 at 18:11
  • 1
    An interrupt is just a kind of function call. For a regular function call, the programmer calls a function to be called. An interrupt on the other hand calls a function (the interrupt handler) with a hardware signal regardless of what the program is currently doing.
    – slebetman
    Aug 2 at 9:58

1 Answer 1

22

I feel like I'm fundamentally misunderstanding something very important here, but the manual isn't much help.

Yes, looks quite like it.

The Altair is a very basic 8080 computer, so any handling is straight out of the MCS80 manual. It'll explain all of the above questions.

In fact, starting with a the CPU manual is always a good idea, no matter what computer. Everything else may just add modifications on top.


For the start some short pointers for your questions:

So, presumably, some kind of signal from outside the machine is capable of triggering an interrupt.

Not really outside the machine - if at all, from outside the CPU card.

It'll always come via the (S100) Bus.

What does that do?

Well, initiate an interrupt when pulled.

Page 45 goes on to tell us than an external device can "cause a RST instruction to be executed during an interrupt". What is meant by "during an interrupt"?

8080 interrupt management is made by inserting an instruction. An interrupt source pulling /INT has to deliver a regular 8080 instruction during the /INTA cycle. The CPU will then execute that instruction before continuing from there. Quite a nifty way, extreme flexible, see here for some ideas :))

Using RST command is just the most simple way as they are single byte instructions. In most cases one would add an 8259 handling all of that.

Isn't an interrupt an instantaneous thing, in terms of execution?

Sure,but in real world even an interrupt needs to be executed, which means it takes some cycles of real time.

Finally, certain instructions take multiple machine cycles to be processed. If an interrupt occurs during such an instruction, is the instruction allowed to finish processing?

Yes.

Is it cancelled outright?

No, after all, how would the instruction restart, when broken somewhere in the middle, leaving the CPU in an unfinished state?

Is it paused midway through the cycles and resumed?

Again, a half way executed instruction means the CPU is in an intermediate stage of high complexity. Nothing anyone wants to deal with.

Also, what signal specifically caused the interrupt?

Pin 73 of the bus is titled /INT and that's what any card wishing to initiate an interrupt has to pull low.

See here for a description of all pins.

How did this signal reach the machine?

Via the bus, like any other signal that reaches the CPU.

2
  • 7
    Incredibly useful and comprehensive answer, thank you so much. This has cleared my understanding up leaps and bounds and given me a really cool avenue to explore. Thanks for your help! Aug 2 at 0:40
  • Can't find a datasheet for the 8259 online in a quick search, but the 8259A is backwards-compatible, so its datasheet should be useful enough in terms of figuring out what it can do.
    – occipita
    Aug 9 at 18:36

You must log in to answer this question.

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