Resolved a problem with the original timer implementation, where a call to setTimer() made in the middle of a CPU burst would not properly account for cycles already executed as part of the current burst

This commit is contained in:
Jeff Parsons 2016-10-12 22:08:45 -07:00 committed by Jeff Parsons
commit 8bb978d7a9
7 changed files with 423 additions and 406 deletions

View file

@ -262,7 +262,7 @@ SerialPortPDP11.prototype.initBus = function(cmp, bus, cpu, dbg)
this.triggerReceiveInterrupt = this.cpu.addTrigger(PDP11.DL11.RVEC, PDP11.DL11.PRI);
this.timerReceiveInterrupt = this.cpu.addTimer(function() {
this.timerReceiveInterrupt = this.cpu.addTimer(function readyReceiver() {
if (!(serial.rcsr & PDP11.DL11.RCSR.RD)) {
if (serial.abReceive.length) {
serial.rbuf = serial.abReceive.shift();
@ -276,7 +276,7 @@ SerialPortPDP11.prototype.initBus = function(cmp, bus, cpu, dbg)
this.triggerTransmitInterrupt = this.cpu.addTrigger(PDP11.DL11.XVEC, PDP11.DL11.PRI);
this.timerTransmitInterrupt = this.cpu.addTimer(function() {
this.timerTransmitInterrupt = this.cpu.addTimer(function readyTransmitter() {
serial.xcsr |= PDP11.DL11.XCSR.READY;
if (serial.xcsr & PDP11.DL11.XCSR.TIE) {
serial.cpu.setTrigger(serial.triggerTransmitInterrupt);