Support for message buffering (PC8080 only; needs to be added to PCx86, too)

This commit is contained in:
Jeff Parsons 2016-05-31 09:59:19 -07:00
commit 43355dec6f
3 changed files with 37 additions and 5 deletions

View file

@ -696,7 +696,11 @@ if (DEBUGGER) {
/* /*
* Now we turn to message actions rather than message types; for example, setting "halt" * Now we turn to message actions rather than message types; for example, setting "halt"
* on or off doesn't enable "halt" messages, but rather halts the CPU on any message above. * on or off doesn't enable "halt" messages, but rather halts the CPU on any message above.
*
* Similarly, "m buffer on" turns on message buffering, defering the display of all messages
* until "m buffer off" is issued.
*/ */
"buffer": Messages.BUFFER,
"halt": Messages.HALT "halt": Messages.HALT
}; };
@ -1302,6 +1306,7 @@ if (DEBUGGER) {
this.dbg = this; this.dbg = this;
this.bitsMessage = this.bitsWarning = Messages.WARN; this.bitsMessage = this.bitsWarning = Messages.WARN;
this.sMessagePrev = null; this.sMessagePrev = null;
this.aMessageBuffer = [];
/* /*
* Internally, we use "key" instead of "keys", since the latter is a method on JavasScript objects, * Internally, we use "key" instead of "keys", since the latter is a method on JavasScript objects,
* but externally, we allow the user to specify "keys"; "kbd" is also allowed as shorthand for "keyboard". * but externally, we allow the user to specify "keys"; "kbd" is also allowed as shorthand for "keyboard".
@ -1548,6 +1553,11 @@ if (DEBUGGER) {
sMessage += " at " + this.toHexAddr(this.newAddr(this.cpu.getPC())); sMessage += " at " + this.toHexAddr(this.newAddr(this.cpu.getPC()));
} }
if (this.bitsMessage & Messages.BUFFER) {
this.aMessageBuffer.push(sMessage);
return;
}
if (this.sMessagePrev && sMessage == this.sMessagePrev) return; if (this.sMessagePrev && sMessage == this.sMessagePrev) return;
this.sMessagePrev = sMessage; this.sMessagePrev = sMessage;
@ -3921,6 +3931,12 @@ if (DEBUGGER) {
else if (asArgs[2] == "off") { else if (asArgs[2] == "off") {
this.bitsMessage &= ~bitsMessage; this.bitsMessage &= ~bitsMessage;
fCriteria = false; fCriteria = false;
if (bitsMessage == Messages.BUFFER) {
for (var i = 0; i < this.aMessageBuffer.length; i++) {
this.println(this.aMessageBuffer[i]);
}
this.aMessageBuffer = [];
}
} }
} }
} }

View file

@ -45,8 +45,9 @@ var Messages = {
SERIAL: 0x00800000, SERIAL: 0x00800000,
SPEAKER: 0x02000000, SPEAKER: 0x02000000,
COMPUTER: 0x04000000, COMPUTER: 0x04000000,
LOG: 0x20000000, LOG: 0x10000000,
WARN: 0x40000000, WARN: 0x20000000,
BUFFER: 0x40000000,
HALT: 0x80000000|0 HALT: 0x80000000|0
}; };

View file

@ -206,6 +206,8 @@ function Video(parmsVideo, canvas, context, textarea, container)
} }
} }
} }
if (DEBUG) this.nCyclesPrev = 0;
} }
Component.subclass(Video); Component.subclass(Video);
@ -484,6 +486,9 @@ Video.prototype.setPixel = function(imageBuffer, x, y, bPixel)
*/ */
Video.prototype.updateScreen = function(n) Video.prototype.updateScreen = function(n)
{ {
var fClean;
var fUpdate = true;
if (n >= 0) { if (n >= 0) {
if (!(n & 1)) { if (!(n & 1)) {
/* /*
@ -497,17 +502,27 @@ Video.prototype.updateScreen = function(n)
* update the bottom half of the frame buffer after acknowledging this interrupt. * update the bottom half of the frame buffer after acknowledging this interrupt.
*/ */
this.cpu.requestINTR(2); this.cpu.requestINTR(2);
return; fUpdate = false;
} }
/* /*
* Since this is not a forced update, if our cell cache is valid AND the buffer is clean, then do nothing. * Since this is not a forced update, if our cell cache is valid AND the buffer is clean, then do nothing.
*/ */
if (this.fCellCacheValid && this.bus.cleanMemory(this.addrBuffer, this.sizeBuffer)) { if (fUpdate && this.fCellCacheValid) {
return; if ((fClean = this.bus.cleanMemory(this.addrBuffer, this.sizeBuffer))) {
fUpdate = false;
}
} }
} }
if (DEBUG) {
var nCycles = this.cpu.getCycles();
var nCyclesDelta = nCycles - this.nCyclesPrev;
this.nCyclesPrev = nCycles;
this.printMessage("updateScreen(" + n + "): clean=" + fClean + ", update=" + fUpdate + ", cycles=" + nCycles + ", delta=" + nCyclesDelta);
}
if (!fUpdate) return;
var addr = this.addrBuffer; var addr = this.addrBuffer;
var addrLimit = addr + this.sizeBuffer; var addrLimit = addr + this.sizeBuffer;