Weekly Classic Computer Trivia Question (20150112)

Johnny Billquist bqt at update.uu.se
Mon Jan 12 14:38:38 CST 2015


On 2015-01-12 20:43, Vincent Slyngstad wrote:
> From: Johnny Billquist: Monday, January 12, 2015 10:55 AM
>> A more correct statement would be that if you enable interrupts in
>> your interrupt handler you must first save all the context of the
>> current interrupt, so you can restore it before returning from the
>> current interrupt.
>> It's not really that hard. Essentially you must store the contents of
>> address 0, and probably also make sure you do not get a second
>> interrupt from the same device, since I doubt you want to write a
>> reentrant interrupt handler. (But that is normally the case anyway,
>> since most devices need some kind of operation to enable a new
>> interrupt to be generated.)
>
> You've never tried to do it on a PDP-8, I expect.  Since there's no
> stack, and static storage won't be reentrant, it's a nightmare.  At a
> minimum, you'd need a routine to emulate "push"/"pop" and "call" type
> operations, and you'll have to remember to have interrupts off when you
> call them, unless you want to use MQ to store the return address or
> something. (Even then the stack routines will need to disable interrupts
> while they do their thing).

Of course I've done it. I suspect there is not much I have not done on a 
PDP-8. I've written programs on PDP-8 systems for over 30 years by now...
No, you do not need a push/pop to have interrupts enabled while in an 
interrupt handler on a PDP-8. As long as you know the same interrupt 
will not trigger, all you need to do is store the return address from 0 
somewhere else before ION, and then write it back to 0 after IOFF.

Like I said, with the provisions that you do not reuse the same 
functions from different interrupt handlers, and you know that the same 
device don't interrupt again.

> Another way to view it is that interrupts effectively introduce a kind
> of multi-threading, with the attendant complexity.  That's really
> incompatible with an "all static storage" machine like the PDP-8, as
> everyone's always stomping your variables (even temporaries
> and return addresses).

Yes. And some of the same issues are true no matter what architecture.

	Johnny

-- 
Johnny Billquist                  || "I'm on a bus
                                   ||  on a psychedelic trip
email: bqt at softjar.se             ||  Reading murder books
pdp is alive!                     ||  tryin' to stay hip" - B. Idol


More information about the cctalk mailing list