Fixed a hardware interrupt signalling check in MAINDEC Test #15

This commit is contained in:
Jeff 2016-11-13 19:08:00 -08:00 committed by Jeff Parsons
commit d533ae69aa
10 changed files with 342 additions and 334 deletions

View file

@ -745,7 +745,7 @@ CPUStatePDP11.prototype.removeTrigger = function(trigger)
triggerPrev = triggerNext;
}
}
// We could also set trigger.next to null now, but strictly speaking, that shouldn't be necessary
// We could also set trigger.next to null now, but strictly speaking, that shouldn't be necessary.
};
/**
@ -757,16 +757,12 @@ CPUStatePDP11.prototype.removeTrigger = function(trigger)
*/
CPUStatePDP11.prototype.setTrigger = function(trigger)
{
/*
* We COULD dispatch interrupts immediately, but there are compatibility reasons for ONLY doing so
* inside the stepCPU() loop; see that function for details.
*
* if (this.dispatchInterrupt(trigger.vector, trigger.priority)) {
* return true;
* }
*/
this.insertTrigger(trigger);
this.opFlags |= PDP11.OPFLAG.INTQ;
/*
* See the writeXCSR() function for an explanation of why signalling an INTQ hardware interrupt condition
* should be done using INTQ_DELAY rather than setting INTQ directly.
*/
this.opFlags |= PDP11.OPFLAG.INTQ_DELAY;
return false;
};

View file

@ -663,7 +663,19 @@ SerialPortPDP11.prototype.writeXCSR = function(data, addr)
{
/*
* If the device is READY, and TIE is being set, then request an interrupt.
*
* Conversely, if TIE is being cleared, remove the request; this satisfies a test in MAINDEC TEST 15,
* which appears to clear, set, and clear the Transmitter Interrupt Enable (TIE) bit in rapid succession,
* with the expectation that NO interrupt will be generated. However, this fix also required a
* complementary change in setTrigger(), to signal an interrupt using INTQ_DELAY rather than INTQ.
*/
if (this.xcsr & PDP11.DL11.XCSR.READY) {
if (data & PDP11.DL11.XCSR.TIE) {
this.cpu.setTrigger(this.triggerTransmitInterrupt);
} else {
this.cpu.removeTrigger(this.triggerTransmitInterrupt);
}
}
if ((this.xcsr & PDP11.DL11.XCSR.READY) && (data & PDP11.DL11.XCSR.TIE)) {
this.cpu.setTrigger(this.triggerTransmitInterrupt);
}