Starting work on v1.16.4: fixed command-line (Node) version of PCjs
This commit is contained in:
parent
eef398a53c
commit
08261fa568
152 changed files with 1498 additions and 1373 deletions
|
|
@ -57,8 +57,8 @@ function C1PCPU(parmsCPU)
|
|||
Component.call(this, "C1PCPU", parmsCPU);
|
||||
|
||||
this.clearRegs();
|
||||
this.bitField.fPowered = false;
|
||||
this.bitField.fRunning = false;
|
||||
this.aFlags.fPowered = false;
|
||||
this.aFlags.fRunning = false;
|
||||
this.fAutoStart = parmsCPU["autoStart"];
|
||||
|
||||
/*
|
||||
|
|
@ -482,7 +482,7 @@ Component.subclass(Component, C1PCPU);
|
|||
*/
|
||||
C1PCPU.prototype.reset = function(fPowerOn)
|
||||
{
|
||||
if (this.bitField.fRunning) {
|
||||
if (this.aFlags.fRunning) {
|
||||
this.halt();
|
||||
}
|
||||
this.clearRegs();
|
||||
|
|
@ -516,7 +516,7 @@ C1PCPU.prototype.setBinding = function(sHTMLType, sBinding, control)
|
|||
this.bindings[sBinding] = control;
|
||||
control.onclick = function(cpu) {
|
||||
return function() {
|
||||
if (!cpu.bitField.fRunning) {
|
||||
if (!cpu.aFlags.fRunning) {
|
||||
cpu.run();
|
||||
} else {
|
||||
cpu.halt();
|
||||
|
|
@ -580,7 +580,7 @@ C1PCPU.prototype.setBuffer = function(abMemory, start, end)
|
|||
*/
|
||||
C1PCPU.prototype.setPower = function(fOn, cmp)
|
||||
{
|
||||
if (fOn && !this.bitField.fPowered) {
|
||||
if (fOn && !this.aFlags.fPowered) {
|
||||
this.cmp = cmp;
|
||||
/*
|
||||
* Attach the Debugger, if any, to the CPU, so that the CPU can periodically
|
||||
|
|
@ -608,7 +608,7 @@ C1PCPU.prototype.setPower = function(fOn, cmp)
|
|||
};
|
||||
}(video);
|
||||
}
|
||||
this.bitField.fPowered = true;
|
||||
this.aFlags.fPowered = true;
|
||||
this.reset(true);
|
||||
this.update();
|
||||
}
|
||||
|
|
@ -881,7 +881,7 @@ C1PCPU.prototype.displayStatus = function()
|
|||
*/
|
||||
C1PCPU.prototype.isRunning = function()
|
||||
{
|
||||
return this.bitField.fRunning;
|
||||
return this.aFlags.fRunning;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -1052,7 +1052,7 @@ C1PCPU.prototype.run = function()
|
|||
if (this.cmp) this.cmp.stop(this.msRunStart, this.nRunCycles);
|
||||
return;
|
||||
}
|
||||
if (!this.bitField.fRunning) {
|
||||
if (!this.aFlags.fRunning) {
|
||||
/*
|
||||
* setSpeed() without a speed parameter leaves the selected speed in place, but also resets the
|
||||
* cycle counter and timestamp for the current series of run() calls, calculates the maximum number
|
||||
|
|
@ -1061,7 +1061,7 @@ C1PCPU.prototype.run = function()
|
|||
*/
|
||||
this.setSpeed();
|
||||
if (this.cmp) this.cmp.start();
|
||||
this.bitField.fRunning = true;
|
||||
this.aFlags.fRunning = true;
|
||||
if (this.bindings["run"]) this.bindings["run"].innerHTML = "Halt";
|
||||
this.setFocus();
|
||||
}
|
||||
|
|
@ -1108,7 +1108,7 @@ C1PCPU.prototype.run = function()
|
|||
this.nCyclesNextYield += this.nCyclesPerYield;
|
||||
break;
|
||||
}
|
||||
} while (this.bitField.fRunning);
|
||||
} while (this.aFlags.fRunning);
|
||||
}
|
||||
catch (e) {
|
||||
this.halt();
|
||||
|
|
@ -1269,8 +1269,8 @@ C1PCPU.prototype.halt = function()
|
|||
this.isBusy(true);
|
||||
this.nBurstCycles -= this.nStepCycles;
|
||||
this.nStepCycles = 0;
|
||||
if (this.bitField.fRunning) {
|
||||
this.bitField.fRunning = false;
|
||||
if (this.aFlags.fRunning) {
|
||||
this.aFlags.fRunning = false;
|
||||
if (this.bindings["run"]) this.bindings["run"].innerHTML = "Run";
|
||||
}
|
||||
};
|
||||
|
|
@ -1304,7 +1304,7 @@ C1PCPU.prototype.update = function()
|
|||
*/
|
||||
C1PCPU.prototype.getCycles = function()
|
||||
{
|
||||
return (this.bitField.fRunning? this.nRunCycles + this.nBurstCycles - this.nStepCycles : 0);
|
||||
return (this.aFlags.fRunning? this.nRunCycles + this.nBurstCycles - this.nStepCycles : 0);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -579,8 +579,8 @@ if (DEBUGGER) {
|
|||
*/
|
||||
C1PDebugger.prototype.setPower = function(fOn, cmp)
|
||||
{
|
||||
if (fOn && !this.bitField.fPowered) {
|
||||
this.bitField.fPowered = true;
|
||||
if (fOn && !this.aFlags.fPowered) {
|
||||
this.aFlags.fPowered = true;
|
||||
this.cpu = cmp.getComponentByType("cpu");
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -217,7 +217,7 @@ function C1PDiskController(parmsDC)
|
|||
{
|
||||
Component.call(this, "C1PDiskController", parmsDC);
|
||||
|
||||
this.bitField.fPowered = false;
|
||||
this.aFlags.fPowered = false;
|
||||
|
||||
/*
|
||||
* Our DiskController simulates the combination of an MC6820 PIA and an MC6850 ACIA.
|
||||
|
|
@ -735,8 +735,8 @@ C1PDiskController.prototype.setBuffer = function(abMemory, start, end, cpu)
|
|||
*/
|
||||
C1PDiskController.prototype.setPower = function(fOn, cmp)
|
||||
{
|
||||
if (fOn && !this.bitField.fPowered) {
|
||||
this.bitField.fPowered = true;
|
||||
if (fOn && !this.aFlags.fPowered) {
|
||||
this.aFlags.fPowered = true;
|
||||
if (DEBUGGER) this.dbg = cmp.getComponentByType("debugger");
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ function C1PKeyboard(parmsKbd)
|
|||
{
|
||||
Component.call(this, "C1PKeyboard", parmsKbd);
|
||||
|
||||
this.bitField.fPowered = false;
|
||||
this.aFlags.fPowered = false;
|
||||
this.nDefaultModel = parmsKbd['model'];
|
||||
|
||||
/*
|
||||
|
|
@ -515,8 +515,8 @@ C1PKeyboard.prototype.setModel = function(nModel)
|
|||
*/
|
||||
C1PKeyboard.prototype.setPower = function(fOn, cmp)
|
||||
{
|
||||
if (fOn && !this.bitField.fPowered) {
|
||||
this.bitField.fPowered = true;
|
||||
if (fOn && !this.aFlags.fPowered) {
|
||||
this.aFlags.fPowered = true;
|
||||
this.cmp = cmp;
|
||||
if (DEBUGGER) this.dbg = cmp.getComponentByType("debugger");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ function C1PPanel(parmsPanel)
|
|||
{
|
||||
Component.call(this, "C1PPanel", parmsPanel);
|
||||
|
||||
this.bitField.fPowered = false;
|
||||
this.aFlags.fPowered = false;
|
||||
}
|
||||
|
||||
Component.subclass(Component, C1PPanel);
|
||||
|
|
@ -76,8 +76,8 @@ C1PPanel.prototype.setBinding = function(sHTMLType, sBinding, control)
|
|||
*/
|
||||
C1PPanel.prototype.setPower = function(fOn, cmp)
|
||||
{
|
||||
if (fOn && !this.bitField.fPowered) {
|
||||
this.bitField.fPowered = true;
|
||||
if (fOn && !this.aFlags.fPowered) {
|
||||
this.aFlags.fPowered = true;
|
||||
this.cmp = cmp;
|
||||
this.cpu = cmp.getComponentByType("cpu");
|
||||
this.kbd = cmp.getComponentByType("keyboard");
|
||||
|
|
|
|||
|
|
@ -108,8 +108,8 @@ C1PROM.prototype.setBuffer = function(abMemory, start, end, cpu)
|
|||
*/
|
||||
C1PROM.prototype.setPower = function(fOn, cmp)
|
||||
{
|
||||
if (fOn && !this.bitField.fPowered) {
|
||||
this.bitField.fPowered = true;
|
||||
if (fOn && !this.aFlags.fPowered) {
|
||||
this.aFlags.fPowered = true;
|
||||
if (DEBUGGER) this.dbg = cmp.getComponentByType("debugger");
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ function C1PSerialPort(parmsSerial)
|
|||
{
|
||||
Component.call(this, "C1PSerialPort", parmsSerial);
|
||||
|
||||
this.bitField.fPowered = false;
|
||||
this.aFlags.fPowered = false;
|
||||
this.fDemo = parmsSerial['demo'];
|
||||
|
||||
this.STATUS_NONE = 0x00;
|
||||
|
|
@ -202,8 +202,8 @@ C1PSerialPort.prototype.setBuffer = function(abMemory, start, end, cpu)
|
|||
*/
|
||||
C1PSerialPort.prototype.setPower = function(fOn, cmp)
|
||||
{
|
||||
if (fOn && !this.bitField.fPowered) {
|
||||
this.bitField.fPowered = true;
|
||||
if (fOn && !this.aFlags.fPowered) {
|
||||
this.aFlags.fPowered = true;
|
||||
this.cmp = cmp;
|
||||
this.kbd = cmp.getComponentByType("keyboard");
|
||||
if (DEBUGGER) this.dbg = cmp.getComponentByType("debugger");
|
||||
|
|
|
|||
|
|
@ -307,8 +307,8 @@ C1PVideo.prototype.setPower = function(fOn, cmp)
|
|||
* it ourselves, too. This also means that updateScreen() need check only fPower and not isReady(),
|
||||
* since we guarantee that the former implies the latter.
|
||||
*/
|
||||
if (fOn && !this.bitField.fPowered && this.isReady()) {
|
||||
this.bitField.fPowered = true;
|
||||
if (fOn && !this.aFlags.fPowered && this.isReady()) {
|
||||
this.aFlags.fPowered = true;
|
||||
if (DEBUGGER) this.dbg = cmp.getComponentByType("debugger");
|
||||
/*
|
||||
* If we have an associated keyboard, then ensure that the keyboard will be notified whenever
|
||||
|
|
@ -327,8 +327,8 @@ C1PVideo.prototype.setPower = function(fOn, cmp)
|
|||
}
|
||||
}
|
||||
else
|
||||
if (!fOn && this.bitField.fPowered) {
|
||||
this.bitField.fPowered = false;
|
||||
if (!fOn && this.aFlags.fPowered) {
|
||||
this.aFlags.fPowered = false;
|
||||
/*
|
||||
* This is where we would add some method of blanking the display, without the disturbing the video
|
||||
* buffer contents, and blocking all further updates to the display.
|
||||
|
|
@ -441,7 +441,7 @@ C1PVideo.prototype.initScreen = function()
|
|||
C1PVideo.prototype.updateScreen = function()
|
||||
{
|
||||
var offset = 0;
|
||||
if (this.bitField.fPowered) {
|
||||
if (this.aFlags.fPowered) {
|
||||
while (offset < this.cbScreen) {
|
||||
var b = this.abMem[this.offVideo + offset];
|
||||
if (this.abScreen[offset] != b) {
|
||||
|
|
|
|||
|
|
@ -17,14 +17,14 @@
|
|||
{ "id": "ibm5150.romBASIC",
|
||||
"name": "",
|
||||
"addr": 0xf6000,
|
||||
"size": 0x8000,
|
||||
"size": 0x08000,
|
||||
"file": "/devices/pc/basic/ibm-basic-1.00.json",
|
||||
"notify": ""
|
||||
},
|
||||
{ "id": "ibm5150.romBIOS",
|
||||
"name": "",
|
||||
"addr": 0xfe000,
|
||||
"size": 0x2000,
|
||||
"size": 0x02000,
|
||||
"file": "/devices/pc/bios/5150/1981-04-24.json",
|
||||
"notify": ""
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,8 +37,9 @@ if (typeof module !== 'undefined') {
|
|||
var usr = require("../../shared/lib/usrlib");
|
||||
var web = require("../../shared/lib/weblib");
|
||||
var Component = require("../../shared/lib/component");
|
||||
var Interrupts = require("./interrupts");
|
||||
var Messages = require("./messages");
|
||||
var State = require("./state");
|
||||
var Debugger = require("./debugger");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -147,7 +148,7 @@ if (typeof module !== 'undefined') {
|
|||
*/
|
||||
function ChipSet(parmsChipSet)
|
||||
{
|
||||
Component.call(this, "ChipSet", parmsChipSet, ChipSet, Debugger.MESSAGE.CHIPSET);
|
||||
Component.call(this, "ChipSet", parmsChipSet, ChipSet, Messages.CHIPSET);
|
||||
|
||||
this.model = parmsChipSet['model'];
|
||||
this.model = (this.model? parseInt(this.model, 10) : ChipSet.MODEL_5150);
|
||||
|
|
@ -967,17 +968,17 @@ ChipSet.prototype.initBus = function(cmp, bus, cpu, dbg)
|
|||
/*
|
||||
* TODO: Add more "dumpers" (eg, for DMA, RTC, 8042, etc)
|
||||
*/
|
||||
dbg.messageDump(Debugger.MESSAGE.PIC, function onDumpPIC() {
|
||||
dbg.messageDump(Messages.PIC, function onDumpPIC() {
|
||||
chipset.dumpPIC();
|
||||
});
|
||||
dbg.messageDump(Debugger.MESSAGE.TIMER, function onDumpTimer() {
|
||||
dbg.messageDump(Messages.TIMER, function onDumpTimer() {
|
||||
chipset.dumpTimer();
|
||||
});
|
||||
dbg.messageDump(Debugger.MESSAGE.CMOS, function onDumpCMOS() {
|
||||
dbg.messageDump(Messages.CMOS, function onDumpCMOS() {
|
||||
chipset.dumpCMOS();
|
||||
});
|
||||
}
|
||||
cpu.addIntNotify(Debugger.INT.RTC, this, this.intBIOSRTC);
|
||||
cpu.addIntNotify(Interrupts.RTC.VECTOR, this, this.intBIOSRTC);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -1331,17 +1332,17 @@ ChipSet.prototype.getRTCCycleLimit = function(nCycles)
|
|||
var nCyclesUpdate = this.nRTCCyclesNextUpdate - this.cpu.getCycles(this.fScaleTimers);
|
||||
if (nCyclesUpdate > 0) {
|
||||
if (nCycles > nCyclesUpdate) {
|
||||
if (DEBUG && this.messageEnabled(Debugger.MESSAGE.RTC)) {
|
||||
if (DEBUG && this.messageEnabled(Messages.RTC)) {
|
||||
this.messageDebugger("getRTCCycleLimit(" + nCycles + "): reduced to " + nCyclesUpdate + " cycles", true);
|
||||
}
|
||||
nCycles = nCyclesUpdate;
|
||||
} else {
|
||||
if (DEBUG && this.messageEnabled(Debugger.MESSAGE.RTC)) {
|
||||
if (DEBUG && this.messageEnabled(Messages.RTC)) {
|
||||
this.messageDebugger("getRTCCycleLimit(" + nCycles + "): already less than " + nCyclesUpdate + " cycles", true);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (DEBUG && this.messageEnabled(Debugger.MESSAGE.RTC)) {
|
||||
if (DEBUG && this.messageEnabled(Messages.RTC)) {
|
||||
this.messageDebugger("RTC next update has passed by " + nCyclesUpdate + " cycles", true);
|
||||
}
|
||||
}
|
||||
|
|
@ -1401,9 +1402,9 @@ ChipSet.prototype.updateRTCTime = function()
|
|||
if (DEBUG) {
|
||||
if (nCyclesUpdate - this.nRTCCyclesNextUpdate > this.nRTCCyclesPerPeriod) {
|
||||
if (bPrev & ChipSet.CMOS.STATUSC.PF) {
|
||||
this.messageDebugger("RTC interrupt handler failed to clear STATUSC", Debugger.MESSAGE.RTC);
|
||||
this.messageDebugger("RTC interrupt handler failed to clear STATUSC", Messages.RTC);
|
||||
} else {
|
||||
this.messageDebugger("CPU took too long trigger new RTC periodic interrupt", Debugger.MESSAGE.RTC);
|
||||
this.messageDebugger("CPU took too long trigger new RTC periodic interrupt", Messages.RTC);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2288,7 +2289,7 @@ ChipSet.prototype.inDMAChannelAddr = function(iDMAC, iChannel, port, addrFrom)
|
|||
var controller = this.aDMACs[iDMAC];
|
||||
var channel = controller.aChannels[iChannel];
|
||||
var b = channel.addrCurrent[controller.bIndex];
|
||||
if (this.messageEnabled(Debugger.MESSAGE.DMA | Debugger.MESSAGE.PORT)) {
|
||||
if (this.messageEnabled(Messages.DMA | Messages.PORT)) {
|
||||
this.messagePort(port, null, addrFrom, "DMA" + iDMAC + ".CHANNEL" + iChannel + ".ADDR[" + controller.bIndex + "]", b, true);
|
||||
}
|
||||
controller.bIndex ^= 0x1;
|
||||
|
|
@ -2325,7 +2326,7 @@ ChipSet.prototype.inDMAChannelAddr = function(iDMAC, iChannel, port, addrFrom)
|
|||
ChipSet.prototype.outDMAChannelAddr = function outDMAChannelAddr(iDMAC, iChannel, port, bOut, addrFrom)
|
||||
{
|
||||
var controller = this.aDMACs[iDMAC];
|
||||
if (this.messageEnabled(Debugger.MESSAGE.DMA | Debugger.MESSAGE.PORT)) {
|
||||
if (this.messageEnabled(Messages.DMA | Messages.PORT)) {
|
||||
this.messagePort(port, bOut, addrFrom, "DMA" + iDMAC + ".CHANNEL" + iChannel + ".ADDR[" + controller.bIndex + "]", null, true);
|
||||
}
|
||||
var channel = controller.aChannels[iChannel];
|
||||
|
|
@ -2348,7 +2349,7 @@ ChipSet.prototype.inDMAChannelCount = function(iDMAC, iChannel, port, addrFrom)
|
|||
var controller = this.aDMACs[iDMAC];
|
||||
var channel = controller.aChannels[iChannel];
|
||||
var b = channel.countCurrent[controller.bIndex];
|
||||
if (this.messageEnabled(Debugger.MESSAGE.DMA | Debugger.MESSAGE.PORT)) {
|
||||
if (this.messageEnabled(Messages.DMA | Messages.PORT)) {
|
||||
this.messagePort(port, null, addrFrom, "DMA" + iDMAC + ".CHANNEL" + iChannel + ".COUNT[" + controller.bIndex + "]", b, true);
|
||||
}
|
||||
controller.bIndex ^= 0x1;
|
||||
|
|
@ -2389,7 +2390,7 @@ ChipSet.prototype.inDMAChannelCount = function(iDMAC, iChannel, port, addrFrom)
|
|||
ChipSet.prototype.outDMAChannelCount = function(iDMAC, iChannel, port, bOut, addrFrom)
|
||||
{
|
||||
var controller = this.aDMACs[iDMAC];
|
||||
if (this.messageEnabled(Debugger.MESSAGE.DMA | Debugger.MESSAGE.PORT)) {
|
||||
if (this.messageEnabled(Messages.DMA | Messages.PORT)) {
|
||||
this.messagePort(port, bOut, addrFrom, "DMA" + iDMAC + ".CHANNEL" + iChannel + ".COUNT[" + controller.bIndex + "]", null, true);
|
||||
}
|
||||
var channel = controller.aChannels[iChannel];
|
||||
|
|
@ -2432,7 +2433,7 @@ ChipSet.prototype.inDMAStatus = function(iDMAC, port, addrFrom)
|
|||
var controller = this.aDMACs[iDMAC];
|
||||
var b = controller.bStatus | ChipSet.DMA_STATUS.CH0_TC;
|
||||
controller.bStatus &= ~ChipSet.DMA_STATUS.ALL_TC;
|
||||
if (this.messageEnabled(Debugger.MESSAGE.DMA | Debugger.MESSAGE.PORT)) {
|
||||
if (this.messageEnabled(Messages.DMA | Messages.PORT)) {
|
||||
this.messagePort(port, null, addrFrom, "DMA" + iDMAC + ".STATUS", b, true);
|
||||
}
|
||||
return b;
|
||||
|
|
@ -2449,7 +2450,7 @@ ChipSet.prototype.inDMAStatus = function(iDMAC, port, addrFrom)
|
|||
*/
|
||||
ChipSet.prototype.outDMACmd = function(iDMAC, port, bOut, addrFrom)
|
||||
{
|
||||
if (this.messageEnabled(Debugger.MESSAGE.DMA | Debugger.MESSAGE.PORT)) {
|
||||
if (this.messageEnabled(Messages.DMA | Messages.PORT)) {
|
||||
this.messagePort(port, bOut, addrFrom, "DMA" + iDMAC + ".CMD", null, true);
|
||||
}
|
||||
this.aDMACs[iDMAC].bCmd = bOut;
|
||||
|
|
@ -2477,7 +2478,7 @@ ChipSet.prototype.outDMACmd = function(iDMAC, port, bOut, addrFrom)
|
|||
ChipSet.prototype.outDMAReq = function(iDMAC, port, bOut, addrFrom)
|
||||
{
|
||||
var controller = this.aDMACs[iDMAC];
|
||||
if (this.messageEnabled(Debugger.MESSAGE.DMA | Debugger.MESSAGE.PORT)) {
|
||||
if (this.messageEnabled(Messages.DMA | Messages.PORT)) {
|
||||
this.messagePort(port, bOut, addrFrom, "DMA" + iDMAC + ".REQ", null, true);
|
||||
}
|
||||
/*
|
||||
|
|
@ -2504,7 +2505,7 @@ ChipSet.prototype.outDMAReq = function(iDMAC, port, bOut, addrFrom)
|
|||
ChipSet.prototype.outDMAMask = function(iDMAC, port, bOut, addrFrom)
|
||||
{
|
||||
var controller = this.aDMACs[iDMAC];
|
||||
if (this.messageEnabled(Debugger.MESSAGE.DMA | Debugger.MESSAGE.PORT)) {
|
||||
if (this.messageEnabled(Messages.DMA | Messages.PORT)) {
|
||||
this.messagePort(port, bOut, addrFrom, "DMA" + iDMAC + ".MASK", null, true);
|
||||
}
|
||||
var iChannel = bOut & ChipSet.DMA_MASK.CHANNEL;
|
||||
|
|
@ -2524,7 +2525,7 @@ ChipSet.prototype.outDMAMask = function(iDMAC, port, bOut, addrFrom)
|
|||
*/
|
||||
ChipSet.prototype.outDMAMode = function(iDMAC, port, bOut, addrFrom)
|
||||
{
|
||||
if (this.messageEnabled(Debugger.MESSAGE.DMA | Debugger.MESSAGE.PORT)) {
|
||||
if (this.messageEnabled(Messages.DMA | Messages.PORT)) {
|
||||
this.messagePort(port, bOut, addrFrom, "DMA" + iDMAC + ".MODE", null, true);
|
||||
}
|
||||
var iChannel = bOut & ChipSet.DMA_MODE.CHANNEL;
|
||||
|
|
@ -2545,7 +2546,7 @@ ChipSet.prototype.outDMAMode = function(iDMAC, port, bOut, addrFrom)
|
|||
*/
|
||||
ChipSet.prototype.outDMAResetFF = function(iDMAC, port, bOut, addrFrom)
|
||||
{
|
||||
if (this.messageEnabled(Debugger.MESSAGE.DMA | Debugger.MESSAGE.PORT)) {
|
||||
if (this.messageEnabled(Messages.DMA | Messages.PORT)) {
|
||||
this.messagePort(port, bOut, addrFrom, "DMA" + iDMAC + ".RESET_FF", null, true);
|
||||
}
|
||||
this.aDMACs[iDMAC].bIndex = 0;
|
||||
|
|
@ -2562,7 +2563,7 @@ ChipSet.prototype.outDMAResetFF = function(iDMAC, port, bOut, addrFrom)
|
|||
*/
|
||||
ChipSet.prototype.outDMAMasterClear = function(iDMAC, port, bOut, addrFrom)
|
||||
{
|
||||
if (this.messageEnabled(Debugger.MESSAGE.DMA | Debugger.MESSAGE.PORT)) {
|
||||
if (this.messageEnabled(Messages.DMA | Messages.PORT)) {
|
||||
this.messagePort(port, bOut, addrFrom, "DMA" + iDMAC + ".MASTER_CLEAR", null, true);
|
||||
}
|
||||
/*
|
||||
|
|
@ -2589,7 +2590,7 @@ ChipSet.prototype.outDMAMasterClear = function(iDMAC, port, bOut, addrFrom)
|
|||
ChipSet.prototype.inDMAPageReg = function(iDMAC, iChannel, port, addrFrom)
|
||||
{
|
||||
var bIn = this.aDMACs[iDMAC].aChannels[iChannel].bPage;
|
||||
if (this.messageEnabled(Debugger.MESSAGE.DMA | Debugger.MESSAGE.PORT)) {
|
||||
if (this.messageEnabled(Messages.DMA | Messages.PORT)) {
|
||||
this.messagePort(port, null, addrFrom, "DMA" + iDMAC + ".CHANNEL" + iChannel + ".PAGE", bIn, true);
|
||||
}
|
||||
return bIn;
|
||||
|
|
@ -2607,7 +2608,7 @@ ChipSet.prototype.inDMAPageReg = function(iDMAC, iChannel, port, addrFrom)
|
|||
*/
|
||||
ChipSet.prototype.outDMAPageReg = function(iDMAC, iChannel, port, bOut, addrFrom)
|
||||
{
|
||||
if (this.messageEnabled(Debugger.MESSAGE.DMA | Debugger.MESSAGE.PORT)) {
|
||||
if (this.messageEnabled(Messages.DMA | Messages.PORT)) {
|
||||
this.messagePort(port, bOut, addrFrom, "DMA" + iDMAC + ".CHANNEL" + iChannel + ".PAGE", null, true);
|
||||
}
|
||||
this.aDMACs[iDMAC].aChannels[iChannel].bPage = bOut;
|
||||
|
|
@ -2625,7 +2626,7 @@ ChipSet.prototype.outDMAPageReg = function(iDMAC, iChannel, port, bOut, addrFrom
|
|||
ChipSet.prototype.inDMAPageSpare = function(iSpare, port, addrFrom)
|
||||
{
|
||||
var bIn = this.abDMAPageSpare[iSpare];
|
||||
if (this.messageEnabled(Debugger.MESSAGE.DMA | Debugger.MESSAGE.PORT)) {
|
||||
if (this.messageEnabled(Messages.DMA | Messages.PORT)) {
|
||||
this.messagePort(port, null, addrFrom, "DMA.SPARE" + iSpare + ".PAGE", bIn, true);
|
||||
}
|
||||
return bIn;
|
||||
|
|
@ -2642,7 +2643,7 @@ ChipSet.prototype.inDMAPageSpare = function(iSpare, port, addrFrom)
|
|||
*/
|
||||
ChipSet.prototype.outDMAPageSpare = function(iSpare, port, bOut, addrFrom)
|
||||
{
|
||||
if (this.messageEnabled(Debugger.MESSAGE.DMA | Debugger.MESSAGE.PORT)) {
|
||||
if (this.messageEnabled(Messages.DMA | Messages.PORT)) {
|
||||
this.messagePort(port, bOut, addrFrom, "DMA.SPARE" + iSpare + ".PAGE", null, true);
|
||||
}
|
||||
this.abDMAPageSpare[iSpare] = bOut;
|
||||
|
|
@ -2712,7 +2713,7 @@ ChipSet.prototype.requestDMA = function(iDMAChannel, done)
|
|||
var channel = controller.aChannels[iChannel];
|
||||
|
||||
if (!channel.component || !channel.fnTransfer || !channel.obj) {
|
||||
if (DEBUG && this.messageEnabled(Debugger.MESSAGE.DMA | Debugger.MESSAGE.DATA)) {
|
||||
if (DEBUG && this.messageEnabled(Messages.DMA | Messages.DATA)) {
|
||||
this.messageDebugger("requestDMA(" + iDMAChannel + "): not connected to a component", true);
|
||||
}
|
||||
if (done) done(true);
|
||||
|
|
@ -2729,7 +2730,7 @@ ChipSet.prototype.requestDMA = function(iDMAChannel, done)
|
|||
if (done) channel.done = done;
|
||||
|
||||
if (channel.masked) {
|
||||
if (DEBUG && this.messageEnabled(Debugger.MESSAGE.DMA | Debugger.MESSAGE.DATA)) {
|
||||
if (DEBUG && this.messageEnabled(Messages.DMA | Messages.DATA)) {
|
||||
this.messageDebugger("requestDMA(" + iDMAChannel + "): channel masked, request queued", true);
|
||||
}
|
||||
return;
|
||||
|
|
@ -2793,7 +2794,7 @@ ChipSet.prototype.advanceDMA = function(channel, fInit)
|
|||
channel.fnTransfer.call(channel.component, channel.obj, -1, function onTransferDMA(b, fAsync) {
|
||||
if (b < 0) {
|
||||
if (!channel.fWarning) {
|
||||
if (DEBUG && obj.messageEnabled(Debugger.MESSAGE.DMA)) {
|
||||
if (DEBUG && obj.messageEnabled(Messages.DMA)) {
|
||||
obj.messageDebugger("advanceDMA(" + iDMAChannel + ") ran out of data, assuming 0xff", true);
|
||||
}
|
||||
channel.fWarning = true;
|
||||
|
|
@ -2842,7 +2843,7 @@ ChipSet.prototype.advanceDMA = function(channel, fInit)
|
|||
}
|
||||
}
|
||||
else {
|
||||
if (DEBUG && this.messageEnabled(Debugger.MESSAGE.DMA | Debugger.MESSAGE.WARN)) {
|
||||
if (DEBUG && this.messageEnabled(Messages.DMA | Messages.WARN)) {
|
||||
this.messageDebugger("advanceDMA(" + iDMAChannel + ") unsupported xfer mode: " + str.toHexWord(channel.xfer), true);
|
||||
}
|
||||
channel.fError = true;
|
||||
|
|
@ -2938,7 +2939,7 @@ ChipSet.prototype.inPICLo = function(iPIC, addrFrom)
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (this.messageEnabled(Debugger.MESSAGE.PIC | Debugger.MESSAGE.PORT | Debugger.MESSAGE.CHIPSET)) {
|
||||
if (this.messageEnabled(Messages.PIC | Messages.PORT | Messages.CHIPSET)) {
|
||||
this.messagePort(pic.port, null, addrFrom, "PIC" + iPIC, b, true);
|
||||
}
|
||||
return b;
|
||||
|
|
@ -2955,7 +2956,7 @@ ChipSet.prototype.inPICLo = function(iPIC, addrFrom)
|
|||
ChipSet.prototype.outPICLo = function(iPIC, bOut, addrFrom)
|
||||
{
|
||||
var pic = this.aPICs[iPIC];
|
||||
if (this.messageEnabled(Debugger.MESSAGE.PIC | Debugger.MESSAGE.PORT | Debugger.MESSAGE.CHIPSET)) {
|
||||
if (this.messageEnabled(Messages.PIC | Messages.PORT | Messages.CHIPSET)) {
|
||||
this.messagePort(pic.port, bOut, addrFrom, "PIC" + iPIC, null, true);
|
||||
}
|
||||
if (bOut & ChipSet.PIC_LO.ICW1) {
|
||||
|
|
@ -3045,7 +3046,7 @@ ChipSet.prototype.outPICLo = function(iPIC, bOut, addrFrom)
|
|||
pic.bISR &= ~bIREnd;
|
||||
this.checkIRR();
|
||||
} else {
|
||||
if (DEBUG && this.messageEnabled(Debugger.MESSAGE.PIC | Debugger.MESSAGE.WARN)) {
|
||||
if (DEBUG && this.messageEnabled(Messages.PIC | Messages.WARN)) {
|
||||
this.messageDebugger("outPIC" + iPIC + "(0x" + str.toHexByte(pic.port) + "): unexpected EOI command, IRQ " + nIRQ + " not in service", true);
|
||||
if (!SAMPLER && MAXDEBUG) this.dbg.stopCPU();
|
||||
}
|
||||
|
|
@ -3053,7 +3054,7 @@ ChipSet.prototype.outPICLo = function(iPIC, bOut, addrFrom)
|
|||
/*
|
||||
* TODO: Support EOI commands with automatic rotation (eg, ChipSet.PIC_LO.OCW2_EOI_ROT and ChipSet.PIC_LO.OCW2_EOI_ROTSPEC)
|
||||
*/
|
||||
if (DEBUG && (bOCW2 & ChipSet.PIC_LO.OCW2_SET_ROTAUTO) && this.messageEnabled(Debugger.MESSAGE.PIC | Debugger.MESSAGE.WARN)) {
|
||||
if (DEBUG && (bOCW2 & ChipSet.PIC_LO.OCW2_SET_ROTAUTO) && this.messageEnabled(Messages.PIC | Messages.WARN)) {
|
||||
this.messageDebugger("outPIC" + iPIC + "(0x" + str.toHexByte(pic.port) + "): unsupported OCW2 rotate command: " + str.toHexByte(bOut), true);
|
||||
this.dbg.stopCPU();
|
||||
}
|
||||
|
|
@ -3068,7 +3069,7 @@ ChipSet.prototype.outPICLo = function(iPIC, bOut, addrFrom)
|
|||
/*
|
||||
* TODO: Remaining commands to support: ChipSet.PIC_LO.OCW2_SET_ROTAUTO and ChipSet.PIC_LO.OCW2_CLR_ROTAUTO
|
||||
*/
|
||||
if (DEBUG && this.messageEnabled(Debugger.MESSAGE.PIC | Debugger.MESSAGE.WARN)) {
|
||||
if (DEBUG && this.messageEnabled(Messages.PIC | Messages.WARN)) {
|
||||
this.messageDebugger("outPIC" + iPIC + "(0x" + str.toHexByte(pic.port) + "): unsupported OCW2 automatic EOI command: " + str.toHexByte(bOut), true);
|
||||
this.dbg.stopCPU();
|
||||
}
|
||||
|
|
@ -3081,7 +3082,7 @@ ChipSet.prototype.outPICLo = function(iPIC, bOut, addrFrom)
|
|||
* that's unfortunate, because I don't support them yet.
|
||||
*/
|
||||
if (bOut & (ChipSet.PIC_LO.OCW3_POLL_CMD | ChipSet.PIC_LO.OCW3_SMM_CMD)) {
|
||||
if (DEBUG && this.messageEnabled(Debugger.MESSAGE.PIC | Debugger.MESSAGE.WARN)) {
|
||||
if (DEBUG && this.messageEnabled(Messages.PIC | Messages.WARN)) {
|
||||
this.messageDebugger("outPIC" + iPIC + "(0x" + str.toHexByte(pic.port) + "): unsupported OCW3 command: " + str.toHexByte(bOut), true);
|
||||
}
|
||||
}
|
||||
|
|
@ -3101,7 +3102,7 @@ ChipSet.prototype.inPICHi = function(iPIC, addrFrom)
|
|||
{
|
||||
var pic = this.aPICs[iPIC];
|
||||
var b = pic.bIMR;
|
||||
if (this.messageEnabled(Debugger.MESSAGE.PIC | Debugger.MESSAGE.PORT | Debugger.MESSAGE.CHIPSET)) {
|
||||
if (this.messageEnabled(Messages.PIC | Messages.PORT | Messages.CHIPSET)) {
|
||||
this.messagePort(pic.port+1, null, addrFrom, "PIC" + iPIC, b, true);
|
||||
}
|
||||
return b;
|
||||
|
|
@ -3118,7 +3119,7 @@ ChipSet.prototype.inPICHi = function(iPIC, addrFrom)
|
|||
ChipSet.prototype.outPICHi = function(iPIC, bOut, addrFrom)
|
||||
{
|
||||
var pic = this.aPICs[iPIC];
|
||||
if (this.messageEnabled(Debugger.MESSAGE.PIC | Debugger.MESSAGE.PORT | Debugger.MESSAGE.CHIPSET)) {
|
||||
if (this.messageEnabled(Messages.PIC | Messages.PORT | Messages.CHIPSET)) {
|
||||
this.messagePort(pic.port+1, bOut, addrFrom, "PIC" + iPIC, null, true);
|
||||
}
|
||||
if (pic.nICW < pic.aICW.length) {
|
||||
|
|
@ -3177,7 +3178,7 @@ ChipSet.prototype.setIRR = function(nIRQ, nDelay)
|
|||
var bIRR = (1 << nIRL);
|
||||
if (!(pic.bIRR & bIRR)) {
|
||||
pic.bIRR |= bIRR;
|
||||
if (DEBUG && this.messageEnabled(this.messageBitsIRQ(nIRQ) | Debugger.MESSAGE.CHIPSET)) {
|
||||
if (DEBUG && this.messageEnabled(this.messageBitsIRQ(nIRQ) | Messages.CHIPSET)) {
|
||||
this.messageDebugger("setIRR(" + nIRQ + ")", true);
|
||||
}
|
||||
pic.nDelay = nDelay || 0;
|
||||
|
|
@ -3199,7 +3200,7 @@ ChipSet.prototype.clearIRR = function(nIRQ)
|
|||
var bIRR = (1 << nIRL);
|
||||
if (pic.bIRR & bIRR) {
|
||||
pic.bIRR &= ~bIRR;
|
||||
if (DEBUG && this.messageEnabled(this.messageBitsIRQ(nIRQ) | Debugger.MESSAGE.CHIPSET)) {
|
||||
if (DEBUG && this.messageEnabled(this.messageBitsIRQ(nIRQ) | Messages.CHIPSET)) {
|
||||
this.messageDebugger("clearIRR(" + nIRQ + ")", true);
|
||||
}
|
||||
this.checkIRR();
|
||||
|
|
@ -3363,7 +3364,7 @@ ChipSet.prototype.inTimer = function(iTimer, addrFrom)
|
|||
}
|
||||
this.updateTimer(iTimer);
|
||||
b = timer.countCurrent[timer.countIndex++];
|
||||
if (this.messageEnabled(Debugger.MESSAGE.TIMER | Debugger.MESSAGE.PORT)) {
|
||||
if (this.messageEnabled(Messages.TIMER | Messages.PORT)) {
|
||||
this.messagePort(ChipSet.TIMER0.PORT + iTimer, null, addrFrom, "TIMER" + iTimer, b, true);
|
||||
}
|
||||
return b;
|
||||
|
|
@ -3388,7 +3389,7 @@ ChipSet.prototype.inTimer = function(iTimer, addrFrom)
|
|||
*/
|
||||
ChipSet.prototype.outTimer = function(iTimer, bOut, addrFrom)
|
||||
{
|
||||
if (this.messageEnabled(Debugger.MESSAGE.TIMER | Debugger.MESSAGE.PORT)) {
|
||||
if (this.messageEnabled(Messages.TIMER | Messages.PORT)) {
|
||||
this.messagePort(ChipSet.TIMER0.PORT + iTimer, bOut, addrFrom, "TIMER" + iTimer, null, true);
|
||||
}
|
||||
var timer = this.aTimers[iTimer];
|
||||
|
|
@ -3442,8 +3443,8 @@ ChipSet.prototype.outTimer = function(iTimer, bOut, addrFrom)
|
|||
*/
|
||||
ChipSet.prototype.inTimerCtrl = function(port, addrFrom)
|
||||
{
|
||||
this.messagePort(port, null, addrFrom, "TIMER_CTRL", null, Debugger.MESSAGE.TIMER);
|
||||
if (DEBUG) this.messageDebugger("TIMER_CTRL: Read-Back command not supported (yet)", Debugger.MESSAGE.TIMER);
|
||||
this.messagePort(port, null, addrFrom, "TIMER_CTRL", null, Messages.TIMER);
|
||||
if (DEBUG) this.messageDebugger("TIMER_CTRL: Read-Back command not supported (yet)", Messages.TIMER);
|
||||
return null;
|
||||
};
|
||||
|
||||
|
|
@ -3458,13 +3459,13 @@ ChipSet.prototype.inTimerCtrl = function(port, addrFrom)
|
|||
ChipSet.prototype.outTimerCtrl = function(port, bOut, addrFrom)
|
||||
{
|
||||
this.bTimerCtrl = bOut;
|
||||
this.messagePort(port, bOut, addrFrom, "TIMER_CTRL", null, Debugger.MESSAGE.TIMER);
|
||||
this.messagePort(port, bOut, addrFrom, "TIMER_CTRL", null, Messages.TIMER);
|
||||
/*
|
||||
* Extract the SC (Select Counter) bits
|
||||
*/
|
||||
var iTimer = (bOut & ChipSet.TIMER_CTRL.SC) >> 6;
|
||||
if (iTimer == 0x3) {
|
||||
if (DEBUG) this.messageDebugger("TIMER_CTRL: Read-Back command not supported (yet)", Debugger.MESSAGE.TIMER);
|
||||
if (DEBUG) this.messageDebugger("TIMER_CTRL: Read-Back command not supported (yet)", Messages.TIMER);
|
||||
return;
|
||||
}
|
||||
/*
|
||||
|
|
@ -3515,7 +3516,7 @@ ChipSet.prototype.outTimerCtrl = function(port, bOut, addrFrom)
|
|||
timer.countStart[0] = timer.countInit[0];
|
||||
timer.countStart[1] = timer.countInit[1];
|
||||
timer.nCyclesStart = this.cpu.getCycles(this.fScaleTimers);
|
||||
if (DEBUG && this.messageEnabled(Debugger.MESSAGE.TIMER)) {
|
||||
if (DEBUG && this.messageEnabled(Messages.TIMER)) {
|
||||
this.messageDebugger("TIMER0 count reset @" + timer.nCyclesStart + " cycles", true);
|
||||
}
|
||||
}
|
||||
|
|
@ -3718,7 +3719,7 @@ ChipSet.prototype.updateTimer = function(iTimer, fCycleReset)
|
|||
var ticksElapsed = ((nCycles - timer.nCyclesStart) / this.nTicksDivisor) | 0;
|
||||
|
||||
if (ticksElapsed < 0) {
|
||||
if (DEBUG && this.messageEnabled(Debugger.MESSAGE.TIMER)) {
|
||||
if (DEBUG && this.messageEnabled(Messages.TIMER)) {
|
||||
this.messageDebugger("updateTimer(" + iTimer + "): negative tick count (" + ticksElapsed + ")", true);
|
||||
}
|
||||
timer.nCyclesStart = nCycles;
|
||||
|
|
@ -3738,7 +3739,7 @@ ChipSet.prototype.updateTimer = function(iTimer, fCycleReset)
|
|||
*/
|
||||
if (timer.mode == ChipSet.TIMER_CTRL.MODE0) {
|
||||
if (count <= 0) count = 0;
|
||||
if (DEBUG && this.messageEnabled(Debugger.MESSAGE.TIMER)) {
|
||||
if (DEBUG && this.messageEnabled(Messages.TIMER)) {
|
||||
this.messageDebugger("updateTimer(" + iTimer + "): MODE0 timer count=" + count, true);
|
||||
}
|
||||
if (!count) {
|
||||
|
|
@ -3773,7 +3774,7 @@ ChipSet.prototype.updateTimer = function(iTimer, fCycleReset)
|
|||
if (count <= 0) {
|
||||
count = countInit + count;
|
||||
if (count <= 0) {
|
||||
if (DEBUG && this.messageEnabled(Debugger.MESSAGE.TIMER)) {
|
||||
if (DEBUG && this.messageEnabled(Messages.TIMER)) {
|
||||
this.messageDebugger("updateTimer(" + iTimer + "): underflow=" + count, true);
|
||||
}
|
||||
count = countInit;
|
||||
|
|
@ -3805,7 +3806,7 @@ ChipSet.prototype.updateTimer = function(iTimer, fCycleReset)
|
|||
timer.fOUT = !timer.fOUT;
|
||||
count = countInit + count;
|
||||
if (count <= 0) {
|
||||
if (DEBUG && this.messageEnabled(Debugger.MESSAGE.TIMER)) {
|
||||
if (DEBUG && this.messageEnabled(Messages.TIMER)) {
|
||||
this.messageDebugger("updateTimer(" + iTimer + "): underflow=" + count, true);
|
||||
}
|
||||
count = countInit;
|
||||
|
|
@ -3826,7 +3827,7 @@ ChipSet.prototype.updateTimer = function(iTimer, fCycleReset)
|
|||
}
|
||||
}
|
||||
|
||||
if (DEBUG && this.messageEnabled(Debugger.MESSAGE.TIMER | Debugger.MESSAGE.LOG)) {
|
||||
if (DEBUG && this.messageEnabled(Messages.TIMER | Messages.LOG)) {
|
||||
this.log("TIMER" + iTimer + " count: " + count + ", ticks: " + ticksElapsed + ", fired: " + (fFired? "true" : "false"));
|
||||
}
|
||||
|
||||
|
|
@ -3990,7 +3991,7 @@ ChipSet.prototype.inPPIC = function(port, addrFrom)
|
|||
* The ROM BIOS polls this port incessantly during its memory tests, checking for memory parity errors
|
||||
* (which of course we never report), so we further restrict these port messages to MESSAGE_MEM.
|
||||
*/
|
||||
this.messagePort(port, null, addrFrom, "PPI_C", b, Debugger.MESSAGE.CHIPSET | Debugger.MESSAGE.MEM);
|
||||
this.messagePort(port, null, addrFrom, "PPI_C", b, Messages.CHIPSET | Messages.MEM);
|
||||
return b;
|
||||
};
|
||||
|
||||
|
|
@ -4048,7 +4049,7 @@ ChipSet.prototype.outPPICtrl = function(port, bOut, addrFrom)
|
|||
ChipSet.prototype.in8042OutBuff = function(port, addrFrom)
|
||||
{
|
||||
var b = this.b8042OutBuff;
|
||||
this.messagePort(port, null, addrFrom, "8042_OUTBUFF", b, Debugger.MESSAGE.C8042);
|
||||
this.messagePort(port, null, addrFrom, "8042_OUTBUFF", b, Messages.C8042);
|
||||
this.b8042Status &= ~(ChipSet.KBC.STATUS.OUTBUFF_FULL | ChipSet.KBC.STATUS.OUTBUFF_DELAY);
|
||||
if (this.kbd) this.kbd.checkScanCode();
|
||||
return b;
|
||||
|
|
@ -4068,7 +4069,7 @@ ChipSet.prototype.in8042OutBuff = function(port, addrFrom)
|
|||
*/
|
||||
ChipSet.prototype.out8042InBuffData = function(port, bOut, addrFrom)
|
||||
{
|
||||
this.messagePort(port, bOut, addrFrom, "8042_INBUF.DATA", null, Debugger.MESSAGE.C8042);
|
||||
this.messagePort(port, bOut, addrFrom, "8042_INBUF.DATA", null, Messages.C8042);
|
||||
|
||||
if (this.b8042Status & ChipSet.KBC.STATUS.CMD_FLAG) {
|
||||
switch (this.b8042InBuff) {
|
||||
|
|
@ -4194,7 +4195,7 @@ ChipSet.prototype.in8042RWReg = function(port, addrFrom)
|
|||
* Thanks to the WAITF function, this has become a very "busy" port, so let's not generate messages
|
||||
* unless both MESSAGE_8042 *and* MESSAGE_LOG are set.
|
||||
*/
|
||||
this.messagePort(port, null, addrFrom, "8042_RWREG", b, Debugger.MESSAGE.C8042);
|
||||
this.messagePort(port, null, addrFrom, "8042_RWREG", b, Messages.C8042);
|
||||
return b;
|
||||
};
|
||||
|
||||
|
|
@ -4208,7 +4209,7 @@ ChipSet.prototype.in8042RWReg = function(port, addrFrom)
|
|||
*/
|
||||
ChipSet.prototype.out8042RWReg = function(port, bOut, addrFrom)
|
||||
{
|
||||
this.messagePort(port, bOut, addrFrom, "8042_RWREG", null, Debugger.MESSAGE.C8042);
|
||||
this.messagePort(port, bOut, addrFrom, "8042_RWREG", null, Messages.C8042);
|
||||
this.updatePPIB(bOut);
|
||||
};
|
||||
|
||||
|
|
@ -4222,7 +4223,7 @@ ChipSet.prototype.out8042RWReg = function(port, bOut, addrFrom)
|
|||
*/
|
||||
ChipSet.prototype.in8042Status = function(port, addrFrom)
|
||||
{
|
||||
this.messagePort(port, null, addrFrom, "8042_STATUS", this.b8042Status, Debugger.MESSAGE.C8042);
|
||||
this.messagePort(port, null, addrFrom, "8042_STATUS", this.b8042Status, Messages.C8042);
|
||||
var b = this.b8042Status & 0xff;
|
||||
/*
|
||||
* There's code in the 5170 BIOS (F000:03BF) that writes an 8042 command (0xAA), waits for
|
||||
|
|
@ -4260,7 +4261,7 @@ ChipSet.prototype.in8042Status = function(port, addrFrom)
|
|||
*/
|
||||
ChipSet.prototype.out8042InBuffCmd = function(port, bOut, addrFrom)
|
||||
{
|
||||
this.messagePort(port, bOut, addrFrom, "8042_INBUFF.CMD", null, Debugger.MESSAGE.C8042);
|
||||
this.messagePort(port, bOut, addrFrom, "8042_INBUFF.CMD", null, Messages.C8042);
|
||||
this.assert(!(this.b8042Status & ChipSet.KBC.STATUS.INBUFF_FULL));
|
||||
this.b8042InBuff = bOut;
|
||||
|
||||
|
|
@ -4289,7 +4290,7 @@ ChipSet.prototype.out8042InBuffCmd = function(port, bOut, addrFrom)
|
|||
|
||||
case ChipSet.KBC.CMD.DISABLE_KBD: // 0xAD
|
||||
this.set8042CmdData(this.b8042CmdData | ChipSet.KBC.DATA.CMD.NO_CLOCK);
|
||||
if (DEBUG) this.messageDebugger("keyboard disabled", Debugger.MESSAGE.KEYBOARD | Debugger.MESSAGE.PORT);
|
||||
if (DEBUG) this.messageDebugger("keyboard disabled", Messages.KEYBOARD | Messages.PORT);
|
||||
/*
|
||||
* NOTE: The MODEL_5170 BIOS calls "KBD_RESET" (F000:17D2) while the keyboard interface is disabled,
|
||||
* yet we must still deliver the Keyboard's CMDRES.BAT_OK response code? Seems like an odd thing for
|
||||
|
|
@ -4300,13 +4301,13 @@ ChipSet.prototype.out8042InBuffCmd = function(port, bOut, addrFrom)
|
|||
case ChipSet.KBC.CMD.ENABLE_KBD: // 0xAE
|
||||
this.set8042CmdData(this.b8042CmdData & ~ChipSet.KBC.DATA.CMD.NO_CLOCK);
|
||||
if (this.kbd) this.kbd.checkScanCode();
|
||||
if (DEBUG) this.messageDebugger("keyboard re-enabled", Debugger.MESSAGE.KEYBOARD | Debugger.MESSAGE.PORT);
|
||||
if (DEBUG) this.messageDebugger("keyboard re-enabled", Messages.KEYBOARD | Messages.PORT);
|
||||
break;
|
||||
|
||||
case ChipSet.KBC.CMD.SELF_TEST: // 0xAA
|
||||
if (this.kbd) this.kbd.flushScanCode();
|
||||
this.set8042CmdData(this.b8042CmdData | ChipSet.KBC.DATA.CMD.NO_CLOCK);
|
||||
if (DEBUG) this.messageDebugger("keyboard disabled on reset", Debugger.MESSAGE.KEYBOARD | Debugger.MESSAGE.PORT);
|
||||
if (DEBUG) this.messageDebugger("keyboard disabled on reset", Messages.KEYBOARD | Messages.PORT);
|
||||
this.set8042OutBuff(ChipSet.KBC.DATA.SELF_TEST.OK);
|
||||
this.set8042OutPort(ChipSet.KBC.OUTPORT.NO_RESET | ChipSet.KBC.OUTPORT.A20_ON);
|
||||
break;
|
||||
|
|
@ -4327,7 +4328,7 @@ ChipSet.prototype.out8042InBuffCmd = function(port, bOut, addrFrom)
|
|||
break;
|
||||
|
||||
default:
|
||||
if (DEBUG && this.messageEnabled(Debugger.MESSAGE.C8042)) {
|
||||
if (DEBUG && this.messageEnabled(Messages.C8042)) {
|
||||
this.messageDebugger("unrecognized 8042 command: " + str.toHexByte(this.b8042InBuff), true);
|
||||
this.dbg.stopCPU();
|
||||
}
|
||||
|
|
@ -4380,7 +4381,7 @@ ChipSet.prototype.set8042OutBuff = function(b)
|
|||
this.b8042OutBuff = b;
|
||||
this.b8042Status &= ~ChipSet.KBC.STATUS.OUTBUFF_FULL;
|
||||
this.b8042Status |= ChipSet.KBC.STATUS.OUTBUFF_DELAY;
|
||||
if (DEBUG && this.messageEnabled(Debugger.MESSAGE.KEYBOARD | Debugger.MESSAGE.PORT)) {
|
||||
if (DEBUG && this.messageEnabled(Messages.KEYBOARD | Messages.PORT)) {
|
||||
this.messageDebugger("set8042OutBuff(0x" + str.toHexByte(b) + ")", true);
|
||||
}
|
||||
}
|
||||
|
|
@ -4402,7 +4403,7 @@ ChipSet.prototype.set8042OutPort = function(b)
|
|||
* KBC.CMD.PULSE_OUTPORT command, so if a RESET is detected via this command, we should try to
|
||||
* determine if that's what the caller intended.
|
||||
*/
|
||||
if (DEBUG && this.messageEnabled(Debugger.MESSAGE.C8042)) {
|
||||
if (DEBUG && this.messageEnabled(Messages.C8042)) {
|
||||
this.messageDebugger("unexpected 8042 output port reset: " + str.toHexByte(b), true);
|
||||
this.dbg.stopCPU();
|
||||
}
|
||||
|
|
@ -4512,12 +4513,12 @@ ChipSet.prototype.notifyKbdData = function(b)
|
|||
this.setIRR(ChipSet.IRQ.KBD, 120);
|
||||
}
|
||||
else {
|
||||
if (DEBUG && this.messageEnabled(Debugger.MESSAGE.KEYBOARD | Debugger.MESSAGE.PORT)) {
|
||||
if (DEBUG && this.messageEnabled(Messages.KEYBOARD | Messages.PORT)) {
|
||||
this.messageDebugger("notifyKbdData(0x" + str.toHexByte(b) + "): output buffer full", true);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (DEBUG && this.messageEnabled(Debugger.MESSAGE.KEYBOARD | Debugger.MESSAGE.PORT)) {
|
||||
if (DEBUG && this.messageEnabled(Messages.KEYBOARD | Messages.PORT)) {
|
||||
this.messageDebugger("notifyKbdData(0x" + str.toHexByte(b) + "): disabled", true);
|
||||
}
|
||||
}
|
||||
|
|
@ -4534,7 +4535,7 @@ ChipSet.prototype.notifyKbdData = function(b)
|
|||
*/
|
||||
ChipSet.prototype.inCMOSAddr = function(port, addrFrom)
|
||||
{
|
||||
this.messagePort(port, null, addrFrom, "CMOS.ADDR", this.bCMOSAddr, Debugger.MESSAGE.CMOS);
|
||||
this.messagePort(port, null, addrFrom, "CMOS.ADDR", this.bCMOSAddr, Messages.CMOS);
|
||||
return this.bCMOSAddr;
|
||||
};
|
||||
|
||||
|
|
@ -4548,7 +4549,7 @@ ChipSet.prototype.inCMOSAddr = function(port, addrFrom)
|
|||
*/
|
||||
ChipSet.prototype.outCMOSAddr = function(port, bOut, addrFrom)
|
||||
{
|
||||
this.messagePort(port, bOut, addrFrom, "CMOS.ADDR", null, Debugger.MESSAGE.CMOS);
|
||||
this.messagePort(port, bOut, addrFrom, "CMOS.ADDR", null, Messages.CMOS);
|
||||
this.bCMOSAddr = bOut;
|
||||
this.bNMI = (bOut & ChipSet.CMOS.ADDR.NMI_DISABLE)? ChipSet.NMI.DISABLE : ChipSet.NMI.ENABLE;
|
||||
};
|
||||
|
|
@ -4565,7 +4566,7 @@ ChipSet.prototype.inCMOSData = function(port, addrFrom)
|
|||
{
|
||||
var bAddr = this.bCMOSAddr & ChipSet.CMOS.ADDR.MASK;
|
||||
var bIn = (bAddr <= ChipSet.CMOS.ADDR.STATUSD? this.getRTCByte(bAddr) : this.abCMOSData[bAddr]);
|
||||
if (this.messageEnabled(Debugger.MESSAGE.CMOS | Debugger.MESSAGE.PORT)) {
|
||||
if (this.messageEnabled(Messages.CMOS | Messages.PORT)) {
|
||||
this.messagePort(port, null, addrFrom, "CMOS.DATA[" + str.toHexByte(bAddr) + "]", bIn, true);
|
||||
}
|
||||
if (addrFrom != null) {
|
||||
|
|
@ -4581,7 +4582,7 @@ ChipSet.prototype.inCMOSData = function(port, addrFrom)
|
|||
* occurs in a timely manner, too.
|
||||
*/
|
||||
if ((bIn & ChipSet.CMOS.STATUSC.PF) && (this.abCMOSData[ChipSet.CMOS.ADDR.STATUSB] & ChipSet.CMOS.STATUSB.PIE)) {
|
||||
if (DEBUG) this.messageDebugger("RTC periodic interrupt cleared", Debugger.MESSAGE.RTC);
|
||||
if (DEBUG) this.messageDebugger("RTC periodic interrupt cleared", Messages.RTC);
|
||||
this.setRTCCycleLimit();
|
||||
}
|
||||
}
|
||||
|
|
@ -4600,17 +4601,17 @@ ChipSet.prototype.inCMOSData = function(port, addrFrom)
|
|||
ChipSet.prototype.outCMOSData = function(port, bOut, addrFrom)
|
||||
{
|
||||
var bAddr = this.bCMOSAddr & ChipSet.CMOS.ADDR.MASK;
|
||||
if (this.messageEnabled(Debugger.MESSAGE.CMOS | Debugger.MESSAGE.PORT)) {
|
||||
if (this.messageEnabled(Messages.CMOS | Messages.PORT)) {
|
||||
this.messagePort(port, bOut, addrFrom, "CMOS.DATA[" + str.toHexByte(bAddr) + "]", null, true);
|
||||
}
|
||||
var bDelta = bOut ^ this.abCMOSData[bAddr];
|
||||
this.abCMOSData[bAddr] = (bAddr <= ChipSet.CMOS.ADDR.STATUSD? this.setRTCByte(bAddr, bOut) : bOut);
|
||||
if (bAddr == ChipSet.CMOS.ADDR.STATUSB && (bDelta & ChipSet.CMOS.STATUSB.PIE)) {
|
||||
if (bOut & ChipSet.CMOS.STATUSB.PIE) {
|
||||
if (DEBUG) this.messageDebugger("RTC periodic interrupts enabled", Debugger.MESSAGE.RTC);
|
||||
if (DEBUG) this.messageDebugger("RTC periodic interrupts enabled", Messages.RTC);
|
||||
this.setRTCCycleLimit();
|
||||
} else {
|
||||
if (DEBUG) this.messageDebugger("RTC periodic interrupts disabled", Debugger.MESSAGE.RTC);
|
||||
if (DEBUG) this.messageDebugger("RTC periodic interrupts disabled", Messages.RTC);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -4720,7 +4721,7 @@ ChipSet.prototype.outCoprocReset = function(port, bOut, addrFrom)
|
|||
ChipSet.prototype.intBIOSRTC = function(addr)
|
||||
{
|
||||
if (DEBUGGER) {
|
||||
if (this.messageEnabled(Debugger.MESSAGE.RTC) && this.dbg.messageInt(Debugger.INT.RTC, addr)) {
|
||||
if (this.messageEnabled(Messages.RTC) && this.dbg.messageInt(Interrupts.RTC.VECTOR, addr)) {
|
||||
/*
|
||||
* By computing AH now, we get the incoming AH value; if we computed it below, along with
|
||||
* the rest of the register values, we'd get the outgoing AH value, which is not what we want.
|
||||
|
|
@ -4739,7 +4740,7 @@ ChipSet.prototype.intBIOSRTC = function(addr)
|
|||
} else if (AH == 0x04 || AH == 0x05) {
|
||||
sResult = " CX(year)=" + str.toHexWord(chipset.cpu.regCX) + " DH(month)=" + str.toHexByte(DH) + " DL(day)=" + str.toHexByte(DL);
|
||||
}
|
||||
chipset.dbg.messageIntReturn(Debugger.INT.RTC, nLevel, nCycles, sResult);
|
||||
chipset.dbg.messageIntReturn(Interrupts.RTC.VECTOR, nLevel, nCycles, sResult);
|
||||
};
|
||||
}(this, this.cpu.getCycles()));
|
||||
}
|
||||
|
|
@ -4790,13 +4791,13 @@ ChipSet.prototype.setSpeaker = function(fOn)
|
|||
if (fOn) {
|
||||
if (this.sourceAudio) {
|
||||
this.sourceAudio['frequency']['value'] = freq;
|
||||
if (this.messageEnabled(Debugger.MESSAGE.SPEAKER)) this.messageDebugger("speaker set to " + freq + "hz", true);
|
||||
if (this.messageEnabled(Messages.SPEAKER)) this.messageDebugger("speaker set to " + freq + "hz", true);
|
||||
} else {
|
||||
this.sourceAudio = this.contextAudio['createOscillator']();
|
||||
this.sourceAudio['type'] = 1; // 0: sine wave, 1: square wave, 2: sawtooth wave, 3: triangle wave
|
||||
this.sourceAudio['connect'](this.contextAudio['destination']);
|
||||
this.sourceAudio['frequency']['value'] = freq;
|
||||
if (this.messageEnabled(Debugger.MESSAGE.SPEAKER)) this.messageDebugger("speaker on at " + freq + "hz", true);
|
||||
if (this.messageEnabled(Messages.SPEAKER)) this.messageDebugger("speaker on at " + freq + "hz", true);
|
||||
this.sourceAudio['noteOn'](0); // aka start()
|
||||
}
|
||||
} else {
|
||||
|
|
@ -4804,11 +4805,11 @@ ChipSet.prototype.setSpeaker = function(fOn)
|
|||
this.sourceAudio['noteOff'](0); // aka stop()
|
||||
this.sourceAudio['disconnect'](); // QUESTION: is this automatic following a stop(), since this particular source cannot be started again?
|
||||
delete this.sourceAudio; // QUESTION: ditto?
|
||||
if (this.messageEnabled(Debugger.MESSAGE.SPEAKER)) this.messageDebugger("speaker off at " + freq + "hz", true);
|
||||
if (this.messageEnabled(Messages.SPEAKER)) this.messageDebugger("speaker off at " + freq + "hz", true);
|
||||
}
|
||||
}
|
||||
} else if (fOn) {
|
||||
this.messageDebugger("BEEP", Debugger.MESSAGE.SPEAKER);
|
||||
this.messageDebugger("BEEP", Messages.SPEAKER);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -4821,11 +4822,11 @@ ChipSet.prototype.setSpeaker = function(fOn)
|
|||
*/
|
||||
ChipSet.prototype.messageBitsDMA = function(iChannel)
|
||||
{
|
||||
var bitsMessage = Debugger.MESSAGE.DATA;
|
||||
var bitsMessage = Messages.DATA;
|
||||
if (iChannel == ChipSet.DMA_FDC) {
|
||||
bitsMessage |= Debugger.MESSAGE.FDC;
|
||||
bitsMessage |= Messages.FDC;
|
||||
} else if (iChannel == ChipSet.DMA_HDC) {
|
||||
bitsMessage |= Debugger.MESSAGE.HDC;
|
||||
bitsMessage |= Messages.HDC;
|
||||
}
|
||||
return bitsMessage;
|
||||
};
|
||||
|
|
@ -4839,21 +4840,21 @@ ChipSet.prototype.messageBitsDMA = function(iChannel)
|
|||
*/
|
||||
ChipSet.prototype.messageBitsIRQ = function(nIRQ)
|
||||
{
|
||||
var bitsMessage = Debugger.MESSAGE.PIC;
|
||||
var bitsMessage = Messages.PIC;
|
||||
if (nIRQ == ChipSet.IRQ.TIMER0) { // IRQ 0
|
||||
bitsMessage |= Debugger.MESSAGE.TIMER;
|
||||
bitsMessage |= Messages.TIMER;
|
||||
} else if (nIRQ == ChipSet.IRQ.KBD) { // IRQ 1
|
||||
bitsMessage |= Debugger.MESSAGE.KEYBOARD;
|
||||
bitsMessage |= Messages.KEYBOARD;
|
||||
} else if (nIRQ == ChipSet.IRQ.SLAVE) { // IRQ 2 (MODEL_5170 and up)
|
||||
bitsMessage |= Debugger.MESSAGE.CHIPSET;
|
||||
bitsMessage |= Messages.CHIPSET;
|
||||
} else if (nIRQ == ChipSet.IRQ.XTC) { // IRQ 5 (MODEL_5160)
|
||||
bitsMessage |= Debugger.MESSAGE.HDC;
|
||||
bitsMessage |= Messages.HDC;
|
||||
} else if (nIRQ == ChipSet.IRQ.FDC) { // IRQ 6
|
||||
bitsMessage |= Debugger.MESSAGE.FDC;
|
||||
bitsMessage |= Messages.FDC;
|
||||
} else if (nIRQ == ChipSet.IRQ.RTC) { // IRQ 8 (MODEL_5170 and up)
|
||||
bitsMessage |= Debugger.MESSAGE.RTC;
|
||||
bitsMessage |= Messages.RTC;
|
||||
} else if (nIRQ == ChipSet.IRQ.ATC) { // IRQ 14 (MODEL_5170 and up)
|
||||
bitsMessage |= Debugger.MESSAGE.HDC;
|
||||
bitsMessage |= Messages.HDC;
|
||||
}
|
||||
return bitsMessage;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -72,9 +72,9 @@ if (typeof module !== 'undefined') {
|
|||
var UserAPI = require("../../shared/lib/userapi");
|
||||
var ReportAPI = require("../../shared/lib/reportapi");
|
||||
var Component = require("../../shared/lib/component");
|
||||
var Messages = require("./messages");
|
||||
var Bus = require("./bus");
|
||||
var State = require("./state");
|
||||
var Debugger = require("./debugger");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -122,9 +122,9 @@ if (typeof module !== 'undefined') {
|
|||
*/
|
||||
function Computer(parmsComputer, parmsMachine, fSuspended) {
|
||||
|
||||
Component.call(this, "Computer", parmsComputer, Computer, Debugger.MESSAGE.COMPUTER);
|
||||
Component.call(this, "Computer", parmsComputer, Computer, Messages.COMPUTER);
|
||||
|
||||
this.bitField.fPowered = false;
|
||||
this.aFlags.fPowered = false;
|
||||
this.nBusWidth = parmsComputer['buswidth'];
|
||||
this.resume = Computer.RESUME_NONE;
|
||||
this.sStateData = null;
|
||||
|
|
@ -543,9 +543,9 @@ Computer.prototype.powerOn = function(resume)
|
|||
*/
|
||||
Computer.prototype.powerRestore = function(component, stateComputer, fRepower, fRestore)
|
||||
{
|
||||
if (!component.bitField.fPowered) {
|
||||
if (!component.aFlags.fPowered) {
|
||||
|
||||
component.bitField.fPowered = true;
|
||||
component.aFlags.fPowered = true;
|
||||
|
||||
if (component.powerUp) {
|
||||
|
||||
|
|
@ -648,11 +648,11 @@ Computer.prototype.donePowerOn = function(aParms)
|
|||
var fRepower = (aParms[1] < 0);
|
||||
var fRestore = aParms[2];
|
||||
|
||||
if (DEBUG && this.bitField.fPowered && this.messageEnabled()) {
|
||||
if (DEBUG && this.aFlags.fPowered && this.messageEnabled()) {
|
||||
this.messageDebugger("Computer.donePowerOn(): redundant");
|
||||
}
|
||||
|
||||
this.bitField.fPowered = true;
|
||||
this.aFlags.fPowered = true;
|
||||
|
||||
if (!this.fInitialized) {
|
||||
this.println(Computer.sAppName + " v" + Computer.sAppVer + "\n" + Computer.sCopyright + "\n" + Computer.LICENSE);
|
||||
|
|
@ -757,7 +757,7 @@ Computer.prototype.powerOff = function(fSave, fShutdown)
|
|||
data = this.cpu.powerDown(fSave, fShutdown);
|
||||
if (typeof data === "object") stateComputer.set(this.cpu.id, data);
|
||||
if (fShutdown) {
|
||||
this.cpu.bitField.fPowered = false;
|
||||
this.cpu.aFlags.fPowered = false;
|
||||
if (data === false) sState = null;
|
||||
}
|
||||
}
|
||||
|
|
@ -765,13 +765,13 @@ Computer.prototype.powerOff = function(fSave, fShutdown)
|
|||
var aComponents = Component.getComponents(this.id);
|
||||
for (var iComponent = 0; iComponent < aComponents.length; iComponent++) {
|
||||
var component = aComponents[iComponent];
|
||||
if (component.bitField.fPowered) {
|
||||
if (component.aFlags.fPowered) {
|
||||
if (component.powerDown) {
|
||||
data = component.powerDown(fSave, fShutdown);
|
||||
if (typeof data === "object") stateComputer.set(component.id, data);
|
||||
}
|
||||
if (fShutdown) {
|
||||
component.bitField.fPowered = false;
|
||||
component.aFlags.fPowered = false;
|
||||
if (data === false) sState = null;
|
||||
}
|
||||
}
|
||||
|
|
@ -823,7 +823,7 @@ Computer.prototype.powerOff = function(fSave, fShutdown)
|
|||
}
|
||||
}
|
||||
|
||||
if (fShutdown) this.bitField.fPowered = false;
|
||||
if (fShutdown) this.aFlags.fPowered = false;
|
||||
|
||||
return sState;
|
||||
};
|
||||
|
|
@ -1219,7 +1219,7 @@ Computer.init = function()
|
|||
var computer = new Computer(parmsComputer, parmsMachine, true);
|
||||
|
||||
if (DEBUG && computer.messageEnabled()) {
|
||||
computer.messageDebugger("onInit(" + computer.bitField.fPowered + ")");
|
||||
computer.messageDebugger("onInit(" + computer.aFlags.fPowered + ")");
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -1251,10 +1251,10 @@ Computer.show = function()
|
|||
if (computer) {
|
||||
|
||||
if (DEBUG && computer.messageEnabled()) {
|
||||
computer.messageDebugger("onShow(" + computer.fInitialized + "," + computer.bitField.fPowered + ")");
|
||||
computer.messageDebugger("onShow(" + computer.fInitialized + "," + computer.aFlags.fPowered + ")");
|
||||
}
|
||||
|
||||
if (computer.fInitialized && !computer.bitField.fPowered) {
|
||||
if (computer.fInitialized && !computer.aFlags.fPowered) {
|
||||
/**
|
||||
* Repower the computer, notifying every component to continue running as-is.
|
||||
*/
|
||||
|
|
@ -1300,10 +1300,10 @@ Computer.exit = function()
|
|||
if (computer) {
|
||||
|
||||
if (DEBUG && computer.messageEnabled()) {
|
||||
computer.messageDebugger("onExit(" + computer.bitField.fPowered + ")");
|
||||
computer.messageDebugger("onExit(" + computer.aFlags.fPowered + ")");
|
||||
}
|
||||
|
||||
if (computer.bitField.fPowered) {
|
||||
if (computer.aFlags.fPowered) {
|
||||
/**
|
||||
* Power "down" the computer, giving every component an opportunity to save its state,
|
||||
* but only if 'resume' has been set AND there is no valid resume path (because if a valid resume
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ if (typeof module !== 'undefined') {
|
|||
var str = require("../../shared/lib/strlib");
|
||||
var usr = require("../../shared/lib/usrlib");
|
||||
var Component = require("../../shared/lib/component");
|
||||
var Debugger = require("./debugger");
|
||||
var Messages = require("./messages");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -75,7 +75,7 @@ if (typeof module !== 'undefined') {
|
|||
*/
|
||||
function CPU(parmsCPU, nCyclesDefault)
|
||||
{
|
||||
Component.call(this, "CPU", parmsCPU, CPU, Debugger.MESSAGE.CPU);
|
||||
Component.call(this, "CPU", parmsCPU, CPU, Messages.CPU);
|
||||
|
||||
var nCycles = parmsCPU['cycles'] || nCyclesDefault;
|
||||
|
||||
|
|
@ -96,15 +96,15 @@ function CPU(parmsCPU, nCyclesDefault)
|
|||
*/
|
||||
this.aCounts.mhzTarget = this.aCounts.mhzDefault * this.aCounts.nCyclesMultiplier;
|
||||
|
||||
this.bitField.fPowered = false;
|
||||
this.bitField.fRunning = false;
|
||||
this.bitField.fStarting = false;
|
||||
this.bitField.fAutoStart = parmsCPU['autoStart'];
|
||||
this.aFlags.fPowered = false;
|
||||
this.aFlags.fRunning = false;
|
||||
this.aFlags.fStarting = false;
|
||||
this.aFlags.fAutoStart = parmsCPU['autoStart'];
|
||||
|
||||
/*
|
||||
* TODO: Add some UI for fDisplayLiveRegs (either an XML property, or a UI checkbox, or both)
|
||||
*/
|
||||
this.bitField.fDisplayLiveRegs = false;
|
||||
this.aFlags.fDisplayLiveRegs = false;
|
||||
|
||||
/*
|
||||
* Provide a power-saving URL-based way of overriding the 'autostart' setting;
|
||||
|
|
@ -113,7 +113,7 @@ function CPU(parmsCPU, nCyclesDefault)
|
|||
*/
|
||||
var sAutoStart = Component.parmsURL['autostart'];
|
||||
if (sAutoStart !== undefined) {
|
||||
this.bitField.fAutoStart = (sAutoStart == "true"? true : (sAutoStart == "false"? false : null));
|
||||
this.aFlags.fAutoStart = (sAutoStart == "true"? true : (sAutoStart == "false"? false : null));
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -125,7 +125,7 @@ function CPU(parmsCPU, nCyclesDefault)
|
|||
* command ("x"); for example, "x cs int 5000" will set nCyclesChecksumInterval to 5000
|
||||
* and call resetChecksum().
|
||||
*/
|
||||
this.bitField.fChecksum = false;
|
||||
this.aFlags.fChecksum = false;
|
||||
this.aCounts.nChecksum = this.aCounts.nCyclesChecksumNext = 0;
|
||||
this.aCounts.nCyclesChecksumStart = parmsCPU["csStart"];
|
||||
this.aCounts.nCyclesChecksumInterval = parmsCPU["csInterval"];
|
||||
|
|
@ -272,7 +272,7 @@ CPU.prototype.powerUp = function(data, fRepower)
|
|||
this.println("No debugger detected");
|
||||
}
|
||||
}
|
||||
this.bitField.fPowered = true;
|
||||
this.aFlags.fPowered = true;
|
||||
if (!this.autoStart() && this.dbg) this.dbg.updateStatus();
|
||||
this.updateCPU();
|
||||
return true;
|
||||
|
|
@ -287,7 +287,7 @@ CPU.prototype.powerUp = function(data, fRepower)
|
|||
*/
|
||||
CPU.prototype.powerDown = function(fSave)
|
||||
{
|
||||
this.bitField.fPowered = false;
|
||||
this.aFlags.fPowered = false;
|
||||
return fSave && this.save ? this.save() : true;
|
||||
};
|
||||
|
||||
|
|
@ -299,7 +299,7 @@ CPU.prototype.powerDown = function(fSave)
|
|||
*/
|
||||
CPU.prototype.autoStart = function()
|
||||
{
|
||||
if (this.bitField.fAutoStart === true || this.bitField.fAutoStart === null && (!DEBUGGER || !this.dbg) && this.bindings["run"] === undefined) {
|
||||
if (this.aFlags.fAutoStart === true || this.aFlags.fAutoStart === null && (!DEBUGGER || !this.dbg) && this.bindings["run"] === undefined) {
|
||||
this.runCPU(); // start running automatically on power-up, assuming there's no Debugger
|
||||
return true;
|
||||
}
|
||||
|
|
@ -326,7 +326,7 @@ CPU.prototype.setFocus = function()
|
|||
*/
|
||||
CPU.prototype.isPowered = function()
|
||||
{
|
||||
if (!this.bitField.fPowered) {
|
||||
if (!this.aFlags.fPowered) {
|
||||
this.println(this.toString() + " not powered");
|
||||
return false;
|
||||
}
|
||||
|
|
@ -341,7 +341,7 @@ CPU.prototype.isPowered = function()
|
|||
*/
|
||||
CPU.prototype.isRunning = function()
|
||||
{
|
||||
return this.bitField.fRunning;
|
||||
return this.aFlags.fRunning;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -372,8 +372,8 @@ CPU.prototype.resetChecksum = function()
|
|||
if (this.aCounts.nCyclesChecksumStart === undefined) this.aCounts.nCyclesChecksumStart = 0;
|
||||
if (this.aCounts.nCyclesChecksumInterval === undefined) this.aCounts.nCyclesChecksumInterval = -1;
|
||||
if (this.aCounts.nCyclesChecksumStop === undefined) this.aCounts.nCyclesChecksumStop = -1;
|
||||
this.bitField.fChecksum = (this.aCounts.nCyclesChecksumStart >= 0 && this.aCounts.nCyclesChecksumInterval > 0);
|
||||
if (this.bitField.fChecksum) {
|
||||
this.aFlags.fChecksum = (this.aCounts.nCyclesChecksumStart >= 0 && this.aCounts.nCyclesChecksumInterval > 0);
|
||||
if (this.aFlags.fChecksum) {
|
||||
this.aCounts.nChecksum = 0;
|
||||
this.aCounts.nCyclesChecksumNext = this.aCounts.nCyclesChecksumStart - this.nTotalCycles;
|
||||
// this.aCounts.nCyclesChecksumNext = this.aCounts.nCyclesChecksumStart + this.aCounts.nCyclesChecksumInterval - (this.nTotalCycles % this.aCounts.nCyclesChecksumInterval);
|
||||
|
|
@ -395,7 +395,7 @@ CPU.prototype.resetChecksum = function()
|
|||
*/
|
||||
CPU.prototype.updateChecksum = function(nCycles)
|
||||
{
|
||||
if (this.bitField.fChecksum) {
|
||||
if (this.aFlags.fChecksum) {
|
||||
/*
|
||||
* Get a 32-bit summation of the current CPU state and add it to our running 32-bit checksum
|
||||
*/
|
||||
|
|
@ -449,7 +449,7 @@ CPU.prototype.displayReg = function(sReg, nVal, cch)
|
|||
this.stopCPU();
|
||||
}
|
||||
var sVal;
|
||||
if (!this.bitField.fRunning || this.bitField.fDisplayLiveRegs) {
|
||||
if (!this.aFlags.fRunning || this.aFlags.fDisplayLiveRegs) {
|
||||
sVal = str.toHex(nVal, cch);
|
||||
} else {
|
||||
sVal = "----".substr(0, cch);
|
||||
|
|
@ -505,7 +505,7 @@ CPU.prototype.setBinding = function(sHTMLType, sBinding, control)
|
|||
case "run":
|
||||
this.bindings[sBinding] = control;
|
||||
control.onclick = function onClickRun() {
|
||||
if (!cpu.bitField.fRunning)
|
||||
if (!cpu.aFlags.fRunning)
|
||||
cpu.runCPU(true);
|
||||
else
|
||||
cpu.stopCPU(true);
|
||||
|
|
@ -559,7 +559,7 @@ CPU.prototype.setBinding = function(sHTMLType, sBinding, control)
|
|||
*/
|
||||
CPU.prototype.setBurstCycles = function(nCycles)
|
||||
{
|
||||
if (this.bitField.fRunning) {
|
||||
if (this.aFlags.fRunning) {
|
||||
var nDelta = this.nStepCycles - nCycles;
|
||||
/*
|
||||
* NOTE: If nDelta is negative, we will actually be increasing nStepCycles and nBurstCycles.
|
||||
|
|
@ -744,7 +744,7 @@ CPU.prototype.getSpeedCurrent = function() {
|
|||
/*
|
||||
* TODO: Has toFixed() been "fixed" in all browsers (eg, IE) to return a rounded value now?
|
||||
*/
|
||||
return ((this.bitField.fRunning && this.aCounts.mhz)? (this.aCounts.mhz.toFixed(2) + "Mhz") : "Stopped");
|
||||
return ((this.aFlags.fRunning && this.aCounts.mhz)? (this.aCounts.mhz.toFixed(2) + "Mhz") : "Stopped");
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -936,7 +936,7 @@ CPU.prototype.calcRemainingTime = function()
|
|||
*/
|
||||
this.aCounts.nCyclesRecalc += this.aCounts.nCyclesThisRun;
|
||||
|
||||
if (DEBUG && this.messageEnabled(Debugger.MESSAGE.LOG) && msRemainsThisRun) {
|
||||
if (DEBUG && this.messageEnabled(Messages.LOG) && msRemainsThisRun) {
|
||||
this.log("calcRemainingTime: " + msRemainsThisRun + "ms to sleep after " + this.aCounts.msEndThisRun + "ms");
|
||||
}
|
||||
|
||||
|
|
@ -967,7 +967,7 @@ CPU.prototype.runCPU = function(fOnClick)
|
|||
this.calcStartTime();
|
||||
try {
|
||||
do {
|
||||
var nCyclesPerBurst = (this.bitField.fChecksum? 1 : this.aCounts.nCyclesPerBurst);
|
||||
var nCyclesPerBurst = (this.aFlags.fChecksum? 1 : this.aCounts.nCyclesPerBurst);
|
||||
|
||||
if (this.chipset) {
|
||||
this.chipset.updateAllTimers();
|
||||
|
|
@ -1009,7 +1009,7 @@ CPU.prototype.runCPU = function(fOnClick)
|
|||
this.aCounts.nCyclesNextYield += this.aCounts.nCyclesPerYield;
|
||||
break;
|
||||
}
|
||||
} while (this.bitField.fRunning);
|
||||
} while (this.aFlags.fRunning);
|
||||
}
|
||||
catch (e) {
|
||||
this.stopCPU();
|
||||
|
|
@ -1031,7 +1031,7 @@ CPU.prototype.runCPU = function(fOnClick)
|
|||
*/
|
||||
CPU.prototype.startCPU = function(fSetFocus)
|
||||
{
|
||||
if (!this.bitField.fRunning) {
|
||||
if (!this.aFlags.fRunning) {
|
||||
/*
|
||||
* setSpeed() without a speed parameter leaves the selected speed in place, but also resets the
|
||||
* cycle counter and timestamp for the current series of runCPU() calls, calculates the maximum number
|
||||
|
|
@ -1040,8 +1040,8 @@ CPU.prototype.startCPU = function(fSetFocus)
|
|||
*/
|
||||
this.setSpeed();
|
||||
if (this.cmp) this.cmp.start(this.aCounts.msStartRun, this.getCycles());
|
||||
this.bitField.fRunning = true;
|
||||
this.bitField.fStarting = true;
|
||||
this.aFlags.fRunning = true;
|
||||
this.aFlags.fStarting = true;
|
||||
if (this.chipset) this.chipset.setSpeaker();
|
||||
var controlRun = this.bindings["run"];
|
||||
if (controlRun) controlRun.textContent = "Halt";
|
||||
|
|
@ -1082,13 +1082,13 @@ CPU.prototype.stopCPU = function(fComplete)
|
|||
this.nStepCycles = 0;
|
||||
this.addCycles(this.nRunCycles);
|
||||
this.nRunCycles = 0;
|
||||
if (this.bitField.fRunning) {
|
||||
this.bitField.fRunning = false;
|
||||
if (this.aFlags.fRunning) {
|
||||
this.aFlags.fRunning = false;
|
||||
if (this.chipset) this.chipset.setSpeaker();
|
||||
var controlRun = this.bindings["run"];
|
||||
if (controlRun) controlRun.textContent = "Run";
|
||||
}
|
||||
this.bitField.fComplete = fComplete;
|
||||
this.aFlags.fComplete = fComplete;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -1117,7 +1117,7 @@ CPU.prototype.updateCPU = function()
|
|||
*/
|
||||
CPU.prototype.yieldCPU = function()
|
||||
{
|
||||
this.aCounts.nCyclesNextYield = 0; // this will break us out of runCPU(), once we break out of stepCPU()
|
||||
this.aCounts.nCyclesNextYield = 0; // this will break us out of runCPU(), once we break out of stepCPU()
|
||||
this.nBurstCycles -= this.nStepCycles;
|
||||
this.nStepCycles = 0; // this will break us out of stepCPU()
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -38,6 +38,8 @@ if (DEBUGGER) {
|
|||
var usr = require("../../shared/lib/usrlib");
|
||||
var web = require("../../shared/lib/weblib");
|
||||
var Component = require("../../shared/lib/component");
|
||||
var Interrupts = require("./interrupts");
|
||||
var Messages = require("./messages");
|
||||
var Bus = require("./bus");
|
||||
var State = require("./state");
|
||||
var CPU = require("./cpu");
|
||||
|
|
@ -180,50 +182,19 @@ function Debugger(parmsDbg)
|
|||
* ...
|
||||
*/
|
||||
var dbg = this;
|
||||
if (window && window['$'] === undefined) {
|
||||
window['$'] = function(s) { return dbg.doCommand(s); };
|
||||
if (window) {
|
||||
if (window['$'] === undefined) {
|
||||
window['$'] = function(s) { return dbg.doCommand(s); };
|
||||
}
|
||||
} else {
|
||||
if (global['$'] === undefined) {
|
||||
global['$'] = function(s) { return dbg.doCommand(s); };
|
||||
}
|
||||
}
|
||||
|
||||
} // endif DEBUGGER
|
||||
}
|
||||
|
||||
/*
|
||||
* Debugger message constants must always be defined, even when DEBUGGER is false, lest the Closure Compiler complain
|
||||
*/
|
||||
Debugger.MESSAGE = {
|
||||
CPU: 0x00000001,
|
||||
SEG: 0x00000002,
|
||||
DESC: 0x00000004,
|
||||
TSS: 0x00000008,
|
||||
INT: 0x00000010,
|
||||
FAULT: 0x00000020,
|
||||
MEM: 0x00000040,
|
||||
PORT: 0x00000080,
|
||||
DMA: 0x00000100,
|
||||
PIC: 0x00000200,
|
||||
TIMER: 0x00000400,
|
||||
CMOS: 0x00000800,
|
||||
RTC: 0x00001000,
|
||||
C8042: 0x00002000,
|
||||
CHIPSET: 0x00004000,
|
||||
KEYBOARD: 0x00008000,
|
||||
KEYS: 0x00010000,
|
||||
VIDEO: 0x00020000,
|
||||
FDC: 0x00040000,
|
||||
HDC: 0x00080000,
|
||||
DISK: 0x00100000,
|
||||
SERIAL: 0x00200000,
|
||||
SPEAKER: 0x00400000,
|
||||
STATE: 0x00800000,
|
||||
MOUSE: 0x01000000,
|
||||
COMPUTER: 0x02000000,
|
||||
DOS: 0x04000000,
|
||||
DATA: 0x08000000,
|
||||
LOG: 0x10000000,
|
||||
WARN: 0x20000000,
|
||||
HALT: 0x40000000
|
||||
};
|
||||
|
||||
if (DEBUGGER) {
|
||||
|
||||
Component.subclass(Component, Debugger);
|
||||
|
|
@ -231,26 +202,15 @@ if (DEBUGGER) {
|
|||
/*
|
||||
* Information regarding interrupts of interest (used by messageInt() and others)
|
||||
*/
|
||||
Debugger.INT = {
|
||||
VIDEO: 0x10,
|
||||
DISK: 0x13,
|
||||
CASSETTE: 0x15,
|
||||
KBD: 0x16,
|
||||
RTC: 0x1a,
|
||||
TIMER_TICK: 0x1c,
|
||||
DOS: 0x21,
|
||||
MOUSE: 0x33
|
||||
};
|
||||
|
||||
Debugger.INT_MESSAGE = {
|
||||
0x10: Debugger.MESSAGE.VIDEO,
|
||||
0x13: Debugger.MESSAGE.FDC,
|
||||
0x15: Debugger.MESSAGE.CHIPSET,
|
||||
0x16: Debugger.MESSAGE.KEYBOARD,
|
||||
// 0x1a: Debugger.MESSAGE.RTC, // ChipSet contains its own specialized messageInt() handler for the RTC
|
||||
0x1c: Debugger.MESSAGE.TIMER,
|
||||
0x21: Debugger.MESSAGE.DOS,
|
||||
0x33: Debugger.MESSAGE.MOUSE
|
||||
Debugger.INT_MESSAGES = {
|
||||
0x10: Messages.VIDEO,
|
||||
0x13: Messages.FDC,
|
||||
0x15: Messages.CHIPSET,
|
||||
0x16: Messages.KEYBOARD,
|
||||
// 0x1a: Messages.RTC, // ChipSet contains its own specialized messageInt() handler for the RTC
|
||||
0x1c: Messages.TIMER,
|
||||
0x21: Messages.DOS,
|
||||
0x33: Messages.MOUSE
|
||||
};
|
||||
|
||||
Debugger.aCommands = {
|
||||
|
|
@ -510,41 +470,41 @@ if (DEBUGGER) {
|
|||
* something to be aware of).
|
||||
*/
|
||||
Debugger.MESSAGES = {
|
||||
"cpu": Debugger.MESSAGE.CPU,
|
||||
"seg": Debugger.MESSAGE.SEG,
|
||||
"desc": Debugger.MESSAGE.DESC,
|
||||
"tss": Debugger.MESSAGE.TSS,
|
||||
"int": Debugger.MESSAGE.INT,
|
||||
"fault": Debugger.MESSAGE.FAULT,
|
||||
"mem": Debugger.MESSAGE.MEM,
|
||||
"port": Debugger.MESSAGE.PORT,
|
||||
"dma": Debugger.MESSAGE.DMA,
|
||||
"pic": Debugger.MESSAGE.PIC,
|
||||
"timer": Debugger.MESSAGE.TIMER,
|
||||
"cmos": Debugger.MESSAGE.CMOS,
|
||||
"rtc": Debugger.MESSAGE.RTC,
|
||||
"8042": Debugger.MESSAGE.C8042,
|
||||
"chipset": Debugger.MESSAGE.CHIPSET, // ie, anything else in ChipSet besides DMA, PIC, TIMER, CMOS, RTC and 8042
|
||||
"keyboard": Debugger.MESSAGE.KEYBOARD,
|
||||
"key": Debugger.MESSAGE.KEYS, // using "keys" instead of "key" causes an unfortunate JavaScript property collision
|
||||
"video": Debugger.MESSAGE.VIDEO,
|
||||
"fdc": Debugger.MESSAGE.FDC,
|
||||
"hdc": Debugger.MESSAGE.HDC,
|
||||
"disk": Debugger.MESSAGE.DISK,
|
||||
"serial": Debugger.MESSAGE.SERIAL,
|
||||
"speaker": Debugger.MESSAGE.SPEAKER,
|
||||
"state": Debugger.MESSAGE.STATE,
|
||||
"mouse": Debugger.MESSAGE.MOUSE,
|
||||
"computer": Debugger.MESSAGE.COMPUTER,
|
||||
"dos": Debugger.MESSAGE.DOS,
|
||||
"data": Debugger.MESSAGE.DATA,
|
||||
"log": Debugger.MESSAGE.LOG,
|
||||
"warn": Debugger.MESSAGE.WARN,
|
||||
"cpu": Messages.CPU,
|
||||
"seg": Messages.SEG,
|
||||
"desc": Messages.DESC,
|
||||
"tss": Messages.TSS,
|
||||
"int": Messages.INT,
|
||||
"fault": Messages.FAULT,
|
||||
"mem": Messages.MEM,
|
||||
"port": Messages.PORT,
|
||||
"dma": Messages.DMA,
|
||||
"pic": Messages.PIC,
|
||||
"timer": Messages.TIMER,
|
||||
"cmos": Messages.CMOS,
|
||||
"rtc": Messages.RTC,
|
||||
"8042": Messages.C8042,
|
||||
"chipset": Messages.CHIPSET, // ie, anything else in ChipSet besides DMA, PIC, TIMER, CMOS, RTC and 8042
|
||||
"keyboard": Messages.KEYBOARD,
|
||||
"key": Messages.KEYS, // using "keys" instead of "key" causes an unfortunate JavaScript property collision
|
||||
"video": Messages.VIDEO,
|
||||
"fdc": Messages.FDC,
|
||||
"hdc": Messages.HDC,
|
||||
"disk": Messages.DISK,
|
||||
"serial": Messages.SERIAL,
|
||||
"speaker": Messages.SPEAKER,
|
||||
"state": Messages.STATE,
|
||||
"mouse": Messages.MOUSE,
|
||||
"computer": Messages.COMPUTER,
|
||||
"dos": Messages.DOS,
|
||||
"data": Messages.DATA,
|
||||
"log": Messages.LOG,
|
||||
"warn": Messages.WARN,
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
"halt": Debugger.MESSAGE.HALT
|
||||
"halt": Messages.HALT
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
@ -1229,9 +1189,9 @@ if (DEBUGGER) {
|
|||
}
|
||||
}
|
||||
|
||||
this.messageDump(Debugger.MESSAGE.DESC, function onDumpDesc(s) { dbg.dumpDesc(s); });
|
||||
this.messageDump(Debugger.MESSAGE.TSS, function onDumpTSS(s) { dbg.dumpTSS(s); });
|
||||
this.messageDump(Debugger.MESSAGE.DOS, function onDumpDOS(s) { dbg.dumpDOS(s); });
|
||||
this.messageDump(Messages.DESC, function onDumpDesc(s) { dbg.dumpDesc(s); });
|
||||
this.messageDump(Messages.TSS, function onDumpTSS(s) { dbg.dumpTSS(s); });
|
||||
this.messageDump(Messages.DOS, function onDumpDOS(s) { dbg.dumpDOS(s); });
|
||||
|
||||
this.setReady();
|
||||
|
||||
|
|
@ -1559,7 +1519,7 @@ if (DEBUGGER) {
|
|||
Debugger.prototype.messageInit = function(sEnable)
|
||||
{
|
||||
this.dbg = this;
|
||||
this.bitsMessage = this.bitsWarning = Debugger.MESSAGE.WARN;
|
||||
this.bitsMessage = this.bitsWarning = Messages.WARN;
|
||||
this.sMessagePrev = null;
|
||||
this.afnDumpers = [];
|
||||
var aEnable = this.parseCommand(sEnable.replace("keys","key").replace("kbd","keyboard"));
|
||||
|
|
@ -1635,19 +1595,19 @@ if (DEBUGGER) {
|
|||
{
|
||||
var AH;
|
||||
var fMessage = false;
|
||||
var nCategory = Debugger.INT_MESSAGE[nInt];
|
||||
var nCategory = Debugger.INT_MESSAGES[nInt];
|
||||
if (nCategory) {
|
||||
AH = this.cpu.regAX >> 8;
|
||||
if (this.messageEnabled(nCategory)) {
|
||||
fMessage = true;
|
||||
} else {
|
||||
fMessage = (nCategory == Debugger.MESSAGE.FDC && this.messageEnabled(nCategory = Debugger.MESSAGE.HDC));
|
||||
fMessage = (nCategory == Messages.FDC && this.messageEnabled(nCategory = Messages.HDC));
|
||||
}
|
||||
}
|
||||
if (fMessage) {
|
||||
var DL = this.cpu.regDX & 0xff;
|
||||
if (nInt == Debugger.INT.DOS && AH == 0x0b ||
|
||||
nCategory == Debugger.MESSAGE.FDC && DL >= 0x80 || nCategory == Debugger.MESSAGE.HDC && DL < 0x80) {
|
||||
if (nInt == Interrupts.DOS.VECTOR && AH == 0x0b ||
|
||||
nCategory == Messages.FDC && DL >= 0x80 || nCategory == Messages.HDC && DL < 0x80) {
|
||||
fMessage = false;
|
||||
}
|
||||
}
|
||||
|
|
@ -1697,7 +1657,7 @@ if (DEBUGGER) {
|
|||
*/
|
||||
Debugger.prototype.messageIO = function(component, port, bOut, addrFrom, name, bIn, bitsMessage)
|
||||
{
|
||||
bitsMessage |= Debugger.MESSAGE.PORT;
|
||||
bitsMessage |= Messages.PORT;
|
||||
if (addrFrom == null || (this.bitsMessage & bitsMessage) == bitsMessage) {
|
||||
var segFrom = null;
|
||||
if (addrFrom != null) {
|
||||
|
|
@ -1728,7 +1688,7 @@ if (DEBUGGER) {
|
|||
this.sMessagePrev = sMessage;
|
||||
|
||||
if (this.cpu) {
|
||||
if (this.bitsMessage & Debugger.MESSAGE.HALT) {
|
||||
if (this.bitsMessage & Messages.HALT) {
|
||||
this.cpu.stopCPU();
|
||||
}
|
||||
/*
|
||||
|
|
@ -2025,8 +1985,8 @@ if (DEBUGGER) {
|
|||
* it here, so that if the CPU is reset while running, we can prevent stop()
|
||||
* from unnecessarily dumping the CPU state.
|
||||
*/
|
||||
if (this.bitField.fRunning !== undefined && !fQuiet) this.println("reset");
|
||||
this.bitField.fRunning = false;
|
||||
if (this.aFlags.fRunning !== undefined && !fQuiet) this.println("reset");
|
||||
this.aFlags.fRunning = false;
|
||||
this.clearTempBreakpoint();
|
||||
if (!fQuiet) this.updateStatus();
|
||||
};
|
||||
|
|
@ -2093,7 +2053,7 @@ if (DEBUGGER) {
|
|||
Debugger.prototype.start = function(ms, nCycles)
|
||||
{
|
||||
if (!this.fProcStep) this.println("running");
|
||||
this.bitField.fRunning = true;
|
||||
this.aFlags.fRunning = true;
|
||||
this.msStart = ms;
|
||||
this.nCyclesStart = nCycles;
|
||||
};
|
||||
|
|
@ -2109,8 +2069,8 @@ if (DEBUGGER) {
|
|||
*/
|
||||
Debugger.prototype.stop = function(ms, nCycles)
|
||||
{
|
||||
if (this.bitField.fRunning) {
|
||||
this.bitField.fRunning = false;
|
||||
if (this.aFlags.fRunning) {
|
||||
this.aFlags.fRunning = false;
|
||||
this.nCycles = nCycles - this.nCyclesStart;
|
||||
if (!this.fProcStep) {
|
||||
var sStopped = "stopped";
|
||||
|
|
@ -2168,7 +2128,7 @@ if (DEBUGGER) {
|
|||
*/
|
||||
Debugger.prototype.checksEnabled = function(fRelease)
|
||||
{
|
||||
return ((DEBUG && !fRelease)? true : (this.aBreakExec.length > 1 || this.messageEnabled(Debugger.MESSAGE.INT) /* || this.aBreakRead.length > 1 || this.aBreakWrite.length > 1 */));
|
||||
return ((DEBUG && !fRelease)? true : (this.aBreakExec.length > 1 || this.messageEnabled(Messages.INT) /* || this.aBreakRead.length > 1 || this.aBreakWrite.length > 1 */));
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -2822,7 +2782,7 @@ if (DEBUGGER) {
|
|||
sLine += " ";
|
||||
sLine = sLine.substr(0, 50);
|
||||
sLine += ";";
|
||||
if (!this.cpu.bitField.fChecksum) {
|
||||
if (!this.cpu.aFlags.fChecksum) {
|
||||
sLine += sComment + (nSequence != null? '=' + nSequence.toString() : "");
|
||||
} else {
|
||||
var nCycles = this.cpu.getCycles();
|
||||
|
|
@ -3830,7 +3790,7 @@ if (DEBUGGER) {
|
|||
*/
|
||||
Debugger.prototype.doHalt = function(sCount)
|
||||
{
|
||||
if (this.bitField.fRunning && sCount === undefined) {
|
||||
if (this.aFlags.fRunning && sCount === undefined) {
|
||||
this.println("halting");
|
||||
this.cpu.stopCPU();
|
||||
return;
|
||||
|
|
@ -4136,7 +4096,7 @@ if (DEBUGGER) {
|
|||
if (sCategory !== undefined) {
|
||||
var bitsMessage = 0;
|
||||
if (sCategory == "all") {
|
||||
bitsMessage = 0xffffffff & ~(Debugger.MESSAGE.HALT | Debugger.MESSAGE.LOG);
|
||||
bitsMessage = 0xffffffff & ~(Messages.HALT | Messages.LOG);
|
||||
sCategory = null;
|
||||
} else if (sCategory == "on") {
|
||||
fCriteria = true;
|
||||
|
|
@ -4234,7 +4194,7 @@ if (DEBUGGER) {
|
|||
if (nCycles !== undefined) {
|
||||
this.cpu.resetChecksum();
|
||||
}
|
||||
this.println("checksums " + (this.cpu.bitField.fChecksum? "enabled" : "disabled"));
|
||||
this.println("checksums " + (this.cpu.aFlags.fChecksum? "enabled" : "disabled"));
|
||||
break;
|
||||
case "sp":
|
||||
if (asArgs[2] !== undefined) {
|
||||
|
|
|
|||
|
|
@ -119,6 +119,7 @@ if (typeof module !== 'undefined') {
|
|||
global.EAFUNCS = EAFUNCS;
|
||||
global.FATARRAYS = FATARRAYS;
|
||||
global.TYPEDARRAYS = TYPEDARRAYS;
|
||||
global.SAMPLER = SAMPLER;
|
||||
/*
|
||||
* TODO: When we're "required" by Node, should we return anything via module.exports?
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@ if (typeof module !== 'undefined') {
|
|||
var DiskAPI = require("../../shared/lib/diskapi");
|
||||
var DumpAPI = require("../../shared/lib/dumpapi");
|
||||
var Component = require("../../shared/lib/component");
|
||||
var Debugger = require("./debugger");
|
||||
var Messages = require("./messages");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -231,7 +231,7 @@ if (typeof module !== 'undefined') {
|
|||
*/
|
||||
function Disk(controller, drive, mode)
|
||||
{
|
||||
Component.call(this, "Disk", {'id': controller.idMachine + ".disk" + Disk.nDisks++}, Disk, Debugger.MESSAGE.DISK);
|
||||
Component.call(this, "Disk", {'id': controller.idMachine + ".disk" + Disk.nDisks++}, Disk, Messages.DISK);
|
||||
|
||||
/*
|
||||
* Route all non-Debugger messages (eg, notice() and println() calls) through
|
||||
|
|
@ -654,7 +654,7 @@ Disk.prototype.doneLoad = function(sDiskFile, sDiskData, nErrorCode, sDiskPath)
|
|||
{
|
||||
var disk = null;
|
||||
this.fWriteProtected = false;
|
||||
var fPrintOnly = (nErrorCode < 0 && this.cmp && !this.cmp.bitField.fPowered);
|
||||
var fPrintOnly = (nErrorCode < 0 && this.cmp && !this.cmp.aFlags.fPowered);
|
||||
|
||||
if (this.fOnDemand) {
|
||||
if (!nErrorCode) {
|
||||
|
|
|
|||
|
|
@ -37,11 +37,11 @@ if (typeof module !== 'undefined') {
|
|||
var web = require("../../shared/lib/weblib");
|
||||
var DiskAPI = require("../../shared/lib/diskapi");
|
||||
var Component = require("../../shared/lib/component");
|
||||
var Messages = require("./messages");
|
||||
var ChipSet = require("./chipset");
|
||||
var Disk = require("./disk");
|
||||
var Computer = require("./computer");
|
||||
var State = require("./state");
|
||||
var Debugger = require("./debugger");
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -137,7 +137,7 @@ function FDC(parmsFDC) {
|
|||
* TODO: Indicate the type of diskette image being loaded (this might help folks understand what's going
|
||||
* on when they try to load a diskette image that's larger than what the selected operating system supports).
|
||||
*/
|
||||
Component.call(this, "FDC", parmsFDC, FDC, Debugger.MESSAGE.FDC);
|
||||
Component.call(this, "FDC", parmsFDC, FDC, Messages.FDC);
|
||||
|
||||
this['dmaRead'] = this.dmaRead;
|
||||
this['dmaWrite'] = this.dmaWrite;
|
||||
|
|
@ -2026,7 +2026,7 @@ FDC.prototype.popCmd = function(name)
|
|||
{
|
||||
this.assert((!this.regDataIndex || name !== undefined) && this.regDataIndex < this.regDataTotal);
|
||||
var bCmd = this.regDataArray[this.regDataIndex];
|
||||
if (DEBUG && this.messageEnabled(Debugger.MESSAGE.PORT | Debugger.MESSAGE.FDC)) {
|
||||
if (DEBUG && this.messageEnabled(Messages.PORT | Messages.FDC)) {
|
||||
var bCmdMasked = bCmd & FDC.REG_DATA.CMD.MASK;
|
||||
if (!name && !this.regDataIndex && FDC.aCmdInfo[bCmdMasked]) name = FDC.aCmdInfo[bCmdMasked].name;
|
||||
this.messageDebugger("FDC.CMD[" + (name || this.regDataIndex) + "]: 0x" + str.toHexByte(bCmd), true);
|
||||
|
|
@ -2080,7 +2080,7 @@ FDC.prototype.beginResult = function()
|
|||
*/
|
||||
FDC.prototype.pushResult = function(bResult, name)
|
||||
{
|
||||
if (DEBUG && this.messageEnabled(Debugger.MESSAGE.PORT | Debugger.MESSAGE.FDC)) {
|
||||
if (DEBUG && this.messageEnabled(Messages.PORT | Messages.FDC)) {
|
||||
this.messageDebugger("FDC.RES[" + (name || this.regDataTotal) + "]: 0x" + str.toHexByte(bResult), true);
|
||||
}
|
||||
this.regDataArray[this.regDataTotal++] = bResult;
|
||||
|
|
|
|||
|
|
@ -37,10 +37,10 @@ if (typeof module !== 'undefined') {
|
|||
var web = require("../../shared/lib/weblib");
|
||||
var DiskAPI = require("../../shared/lib/diskapi");
|
||||
var Component = require("../../shared/lib/component");
|
||||
var Messages = require("./messages");
|
||||
var ChipSet = require("./chipset");
|
||||
var Disk = require("./disk");
|
||||
var State = require("./state");
|
||||
var Debugger = require("./debugger");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -78,7 +78,7 @@ if (typeof module !== 'undefined') {
|
|||
*/
|
||||
function HDC(parmsHDC) {
|
||||
|
||||
Component.call(this, "HDC", parmsHDC, HDC, Debugger.MESSAGE.HDC);
|
||||
Component.call(this, "HDC", parmsHDC, HDC, Messages.HDC);
|
||||
|
||||
this['dmaRead'] = this.dmaRead;
|
||||
this['dmaWrite'] = this.dmaWrite;
|
||||
|
|
@ -1406,13 +1406,13 @@ HDC.prototype.inATCData = function(port, addrFrom)
|
|||
* messagePort() calls, if enabled, can be overwhelming for this port, so limit them to the first byte
|
||||
* of each sector.
|
||||
*/
|
||||
if (this.messageEnabled(Debugger.MESSAGE.PORT | Debugger.MESSAGE.HDC)) {
|
||||
if (this.messageEnabled(Messages.PORT | Messages.HDC)) {
|
||||
this.messagePort(port, null, addrFrom, "DATA[" + this.drive.ibSector + "]", bIn);
|
||||
}
|
||||
}
|
||||
else if (this.drive.ibSector == this.drive.cbSector) {
|
||||
|
||||
if (this.messageEnabled(Debugger.MESSAGE.DATA | Debugger.MESSAGE.HDC)) {
|
||||
if (this.messageEnabled(Messages.DATA | Messages.HDC)) {
|
||||
var sDump = this.drive.disk.dumpSector(this.drive.sector);
|
||||
if (sDump) this.dbg.message(sDump);
|
||||
}
|
||||
|
|
@ -1477,13 +1477,13 @@ HDC.prototype.outATCData = function(port, bOut, addrFrom)
|
|||
* messagePort() calls, if enabled, can be overwhelming for this port, so limit them to the first byte
|
||||
* of each sector.
|
||||
*/
|
||||
if (this.messageEnabled(Debugger.MESSAGE.PORT | Debugger.MESSAGE.HDC)) {
|
||||
if (this.messageEnabled(Messages.PORT | Messages.HDC)) {
|
||||
this.messagePort(port, bOut, addrFrom, "DATA[" + this.drive.ibSector + "]");
|
||||
}
|
||||
}
|
||||
else if (this.drive.ibSector == this.drive.cbSector) {
|
||||
|
||||
if (this.messageEnabled(Debugger.MESSAGE.DATA | Debugger.MESSAGE.HDC)) {
|
||||
if (this.messageEnabled(Messages.DATA | Messages.HDC)) {
|
||||
var sDump = this.drive.disk.dumpSector(this.drive.sector);
|
||||
if (sDump) this.dbg.message(sDump);
|
||||
}
|
||||
|
|
@ -1831,14 +1831,14 @@ HDC.prototype.doATC = function()
|
|||
this.drive = drive;
|
||||
}
|
||||
|
||||
if (DEBUG && this.messageEnabled(Debugger.MESSAGE.HDC)) {
|
||||
if (DEBUG && this.messageEnabled(Messages.HDC)) {
|
||||
this.messageDebugger("HDC.doATC(0x" + str.toHexByte(bCmd) + "): " + HDC.aATCCommands[bCmd], true);
|
||||
}
|
||||
|
||||
switch (bCmd & HDC.ATC.COMMAND.MASK) {
|
||||
|
||||
case HDC.ATC.COMMAND.READ_DATA:
|
||||
if (DEBUG && this.messageEnabled(Debugger.MESSAGE.HDC)) {
|
||||
if (DEBUG && this.messageEnabled(Messages.HDC)) {
|
||||
this.messageDebugger("HDC.doRead(" + iDrive + ',' + drive.wCylinder + ':' + drive.bHead + ':' + drive.bSector + ',' + nSectors + ")", true);
|
||||
}
|
||||
/*
|
||||
|
|
@ -1867,7 +1867,7 @@ HDC.prototype.doATC = function()
|
|||
break;
|
||||
|
||||
case HDC.ATC.COMMAND.WRITE_DATA:
|
||||
if (DEBUG && this.messageEnabled(Debugger.MESSAGE.HDC)) {
|
||||
if (DEBUG && this.messageEnabled(Messages.HDC)) {
|
||||
this.messageDebugger("HDC.doWrite(" + iDrive + ',' + drive.wCylinder + ':' + drive.bHead + ':' + drive.bSector + ',' + nSectors + ")", true);
|
||||
}
|
||||
this.regStatus = HDC.ATC.STATUS.DATA_REQ;
|
||||
|
|
@ -1961,9 +1961,9 @@ HDC.prototype.setATCIRR = function(fWrite)
|
|||
* has a low tolerance for fast controller interrupts during multi-sector operations.
|
||||
*/
|
||||
this.chipset.setIRR(ChipSet.IRQ.ATC, 120);
|
||||
if (DEBUG) this.messageDebugger("HDC.setATCIRR(): enabled", Debugger.MESSAGE.PIC | Debugger.MESSAGE.HDC);
|
||||
if (DEBUG) this.messageDebugger("HDC.setATCIRR(): enabled", Messages.PIC | Messages.HDC);
|
||||
} else {
|
||||
if (DEBUG) this.messageDebugger("HDC.setATCIRR(): disabled", Debugger.MESSAGE.PIC | Debugger.MESSAGE.HDC);
|
||||
if (DEBUG) this.messageDebugger("HDC.setATCIRR(): disabled", Messages.PIC | Messages.HDC);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -2140,7 +2140,7 @@ HDC.prototype.popCmd = function()
|
|||
var bCmdIndex = this.regDataIndex;
|
||||
if (bCmdIndex < this.regDataTotal) {
|
||||
bCmd = this.regDataArray[this.regDataIndex++];
|
||||
if (DEBUG && this.messageEnabled((bCmdIndex > 0? Debugger.MESSAGE.PORT : 0) | Debugger.MESSAGE.HDC)) {
|
||||
if (DEBUG && this.messageEnabled((bCmdIndex > 0? Messages.PORT : 0) | Messages.HDC)) {
|
||||
this.messageDebugger("HDC.CMD[" + bCmdIndex + "]: 0x" + str.toHexByte(bCmd) + (!bCmdIndex && HDC.aXTCCommands[bCmd]? (" (" + HDC.aXTCCommands[bCmd] + ")") : ""), true);
|
||||
}
|
||||
}
|
||||
|
|
@ -2180,7 +2180,7 @@ HDC.prototype.beginResult = function(bResult)
|
|||
*/
|
||||
HDC.prototype.pushResult = function(bResult)
|
||||
{
|
||||
if (DEBUG && this.messageEnabled((this.regDataTotal > 0? Debugger.MESSAGE.PORT : 0) | Debugger.MESSAGE.HDC)) {
|
||||
if (DEBUG && this.messageEnabled((this.regDataTotal > 0? Messages.PORT : 0) | Messages.HDC)) {
|
||||
this.messageDebugger("HDC.RES[" + this.regDataTotal + "]: 0x" + str.toHexByte(bResult), true);
|
||||
}
|
||||
this.regDataArray[this.regDataTotal++] = bResult;
|
||||
|
|
|
|||
78
modules/pcjs/lib/interrupts.js
Normal file
78
modules/pcjs/lib/interrupts.js
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
/**
|
||||
* @fileoverview PCjs-specific BIOS/DOS interrupt definitions.
|
||||
* @author <a href="mailto:Jeff@pcjs.org">Jeff Parsons</a>
|
||||
* @version 1.0
|
||||
* Created 2014-Dec-11
|
||||
*
|
||||
* Copyright © 2012-2014 Jeff Parsons <Jeff@pcjs.org>
|
||||
*
|
||||
* This file is part of PCjs, which is part of the JavaScript Machines Project (aka JSMachines)
|
||||
* at <http://jsmachines.net/> and <http://pcjs.org/>.
|
||||
*
|
||||
* PCjs is free software: you can redistribute it and/or modify it under the terms of the
|
||||
* GNU General Public License as published by the Free Software Foundation, either version 3
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* PCjs is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with PCjs. If not,
|
||||
* see <http://www.gnu.org/licenses/gpl.html>.
|
||||
*
|
||||
* You are required to include the above copyright notice in every source code file of every
|
||||
* copy or modified version of this work, and to display that copyright notice on every screen
|
||||
* that loads or runs any version of this software (see Computer.sCopyright).
|
||||
*
|
||||
* Some PCjs files also attempt to load external resource files, such as character-image files,
|
||||
* ROM files, and disk image files. Those external resource files are not considered part of the
|
||||
* PCjs program for purposes of the GNU General Public License, and the author does not claim
|
||||
* any copyright as to their contents.
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
/*
|
||||
* Components that previously used Debugger interrupt definitions by including:
|
||||
*
|
||||
* var Debugger = require("./debugger");
|
||||
*
|
||||
* and using:
|
||||
*
|
||||
* Debugger.INT.FOO
|
||||
*
|
||||
* must now instead include:
|
||||
*
|
||||
* var Interrupts = require("./interrupts");
|
||||
*
|
||||
* and then replace all occurrences of "Debugger.INT.FOO" with "Interrupts.FOO.VECTOR".
|
||||
*/
|
||||
|
||||
var Interrupts = {
|
||||
VIDEO: {
|
||||
VECTOR: 0x10
|
||||
},
|
||||
DISK: {
|
||||
VECTOR: 0x13
|
||||
},
|
||||
CASSETTE: {
|
||||
VECTOR: 0x15
|
||||
},
|
||||
KBD: {
|
||||
VECTOR: 0x16
|
||||
},
|
||||
RTC: {
|
||||
VECTOR: 0x1a
|
||||
},
|
||||
TIMER_TICK: {
|
||||
VECTOR: 0x1c
|
||||
},
|
||||
DOS: {
|
||||
VECTOR: 0x21
|
||||
},
|
||||
MOUSE: {
|
||||
VECTOR: 0x33
|
||||
}
|
||||
};
|
||||
|
||||
if (typeof module !== 'undefined') module.exports = Interrupts;
|
||||
|
|
@ -36,10 +36,10 @@ if (typeof module !== 'undefined') {
|
|||
var str = require("../../shared/lib/strlib");
|
||||
var web = require("../../shared/lib/weblib");
|
||||
var Component = require("../../shared/lib/component");
|
||||
var Messages = require("./messages");
|
||||
var ChipSet = require("./chipset");
|
||||
var State = require("./state");
|
||||
var CPU = require("./cpu");
|
||||
var Debugger = require("./debugger");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -62,7 +62,7 @@ if (typeof module !== 'undefined') {
|
|||
*/
|
||||
function Keyboard(parmsKbd)
|
||||
{
|
||||
Component.call(this, "Keyboard", parmsKbd, Keyboard, Debugger.MESSAGE.KEYBOARD);
|
||||
Component.call(this, "Keyboard", parmsKbd, Keyboard, Messages.KEYBOARD);
|
||||
|
||||
this.nDefaultModel = parmsKbd['model'];
|
||||
|
||||
|
|
@ -995,7 +995,7 @@ Keyboard.prototype.setBinding = function(sHTMLType, sBinding, control)
|
|||
this.bindings[id] = control;
|
||||
control.onclick = function(kbd, sKey, simCode) {
|
||||
return function onClickKeyboard(event) {
|
||||
if (!COMPILED && kbd.messageEnabled()) kbd.messageDebugger(sKey + " clicked", Debugger.MESSAGE.KEYS);
|
||||
if (!COMPILED && kbd.messageEnabled()) kbd.messageDebugger(sKey + " clicked", Messages.KEYS);
|
||||
if (kbd.cpu) kbd.cpu.setFocus();
|
||||
kbd.updateShiftState(simCode, true); // future-proofing if/when any LOCK keys are added to CLICKCODES
|
||||
kbd.addActiveKey(simCode, true);
|
||||
|
|
@ -1127,7 +1127,7 @@ Keyboard.prototype.resetDevice = function(fNotify)
|
|||
/*
|
||||
* TODO: There's more to reset, like LED indicators, default type rate, and emptying the scan code buffer.
|
||||
*/
|
||||
this.messageDebugger("keyboard reset", Debugger.MESSAGE.KEYBOARD | Debugger.MESSAGE.PORT);
|
||||
this.messageDebugger("keyboard reset", Messages.KEYBOARD | Messages.PORT);
|
||||
this.abScanBuffer = [Keyboard.CMDRES.BAT_OK];
|
||||
if (fNotify && this.chipset) this.chipset.notifyKbdData(this.abScanBuffer[0]);
|
||||
};
|
||||
|
|
@ -1149,7 +1149,7 @@ Keyboard.prototype.setEnable = function(fData, fClock)
|
|||
{
|
||||
var fReset = false;
|
||||
if (this.fClock !== fClock) {
|
||||
if (!COMPILED && this.messageEnabled(Debugger.MESSAGE.KEYBOARD | Debugger.MESSAGE.PORT)) {
|
||||
if (!COMPILED && this.messageEnabled(Messages.KEYBOARD | Messages.PORT)) {
|
||||
this.messageDebugger("keyboard clock line changing to " + fClock, true);
|
||||
}
|
||||
/*
|
||||
|
|
@ -1159,7 +1159,7 @@ Keyboard.prototype.setEnable = function(fData, fClock)
|
|||
this.fClock = this.fResetOnEnable = fClock;
|
||||
}
|
||||
if (this.fData !== fData) {
|
||||
if (!COMPILED && this.messageEnabled(Debugger.MESSAGE.KEYBOARD | Debugger.MESSAGE.PORT)) {
|
||||
if (!COMPILED && this.messageEnabled(Messages.KEYBOARD | Messages.PORT)) {
|
||||
this.messageDebugger("keyboard data line changing to " + fData, true);
|
||||
}
|
||||
this.fData = fData;
|
||||
|
|
@ -1618,7 +1618,7 @@ Keyboard.prototype.updateShiftState = function(simCode, fSim, fDown)
|
|||
Keyboard.prototype.addActiveKey = function(simCode, fPress)
|
||||
{
|
||||
if (!Keyboard.SIMCODES[simCode]) {
|
||||
if (!COMPILED && this.messageEnabled(Debugger.MESSAGE.KEYS)) {
|
||||
if (!COMPILED && this.messageEnabled(Messages.KEYS)) {
|
||||
this.messageDebugger("addActiveKey(" + simCode + "," + (fPress? "press" : "down") + "): unrecognized", true);
|
||||
}
|
||||
return;
|
||||
|
|
@ -1649,7 +1649,7 @@ Keyboard.prototype.addActiveKey = function(simCode, fPress)
|
|||
}
|
||||
}
|
||||
|
||||
if (!COMPILED && this.messageEnabled(Debugger.MESSAGE.KEYS)) {
|
||||
if (!COMPILED && this.messageEnabled(Messages.KEYS)) {
|
||||
this.messageDebugger("addActiveKey(" + simCode + "," + (fPress? "press" : "down") + "): " + (i < 0? "already active" : (i == this.aKeysActive.length? "adding" : "updating")), true);
|
||||
}
|
||||
|
||||
|
|
@ -1750,7 +1750,7 @@ Keyboard.prototype.clearActiveKeys = function()
|
|||
Keyboard.prototype.removeActiveKey = function(simCode, fFlush)
|
||||
{
|
||||
if (!Keyboard.SIMCODES[simCode]) {
|
||||
if (!COMPILED && this.messageEnabled(Debugger.MESSAGE.KEYS)) {
|
||||
if (!COMPILED && this.messageEnabled(Messages.KEYS)) {
|
||||
this.messageDebugger("removeActiveKey(" + simCode + "): unrecognized", true);
|
||||
}
|
||||
return false;
|
||||
|
|
@ -1774,11 +1774,11 @@ Keyboard.prototype.removeActiveKey = function(simCode, fFlush)
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (!COMPILED && !fFlush && this.messageEnabled(Debugger.MESSAGE.KEYS)) {
|
||||
if (!COMPILED && !fFlush && this.messageEnabled(Messages.KEYS)) {
|
||||
this.messageDebugger("removeActiveKey(" + simCode + "): " + (fRemoved? "removed" : "not active"), true);
|
||||
}
|
||||
if (!this.aKeysActive.length && this.fToggleCapsLock) {
|
||||
if (!COMPILED) this.messageDebugger("removeActiveKey(): inverting caps-lock now", Debugger.MESSAGE.KEYS);
|
||||
if (!COMPILED) this.messageDebugger("removeActiveKey(): inverting caps-lock now", Messages.KEYS);
|
||||
this.updateShiftState(Keyboard.SIMCODE.CAPS_LOCK);
|
||||
this.fToggleCapsLock = false;
|
||||
}
|
||||
|
|
@ -1801,7 +1801,7 @@ Keyboard.prototype.updateActiveKey = function(key, msTimer)
|
|||
return;
|
||||
}
|
||||
|
||||
if (!COMPILED && this.messageEnabled(Debugger.MESSAGE.KEYS)) {
|
||||
if (!COMPILED && this.messageEnabled(Messages.KEYS)) {
|
||||
this.messageDebugger((msTimer? '\n' : "") + "updateActiveKey(" + key.simCode + (msTimer? "," + msTimer + "ms" : "") + "): " + (key.fDown? "down" : "up"), true);
|
||||
}
|
||||
|
||||
|
|
@ -1872,7 +1872,7 @@ Keyboard.prototype.getSimCode = function(keyCode, fShifted)
|
|||
*/
|
||||
Keyboard.prototype.onFocusChange = function(fFocus)
|
||||
{
|
||||
if (this.fHasFocus != fFocus && !COMPILED && this.messageEnabled(Debugger.MESSAGE.KEYS)) {
|
||||
if (this.fHasFocus != fFocus && !COMPILED && this.messageEnabled(Messages.KEYS)) {
|
||||
this.messageDebugger("onFocusChange(" + (fFocus? "true" : "false") + ")", true);
|
||||
}
|
||||
this.fHasFocus = fFocus;
|
||||
|
|
@ -1999,7 +1999,7 @@ Keyboard.prototype.onKeyDown = function(event, fDown)
|
|||
event.preventDefault();
|
||||
}
|
||||
|
||||
if (!COMPILED && this.messageEnabled(Debugger.MESSAGE.KEYS)) {
|
||||
if (!COMPILED && this.messageEnabled(Messages.KEYS)) {
|
||||
this.messageDebugger("\nonKey" + (fDown? "Down" : "Up") + "(" + keyCode + "): " + (fIgnore? "ignore" : (fPass? "true" : "false")), true);
|
||||
}
|
||||
|
||||
|
|
@ -2039,7 +2039,7 @@ Keyboard.prototype.onKeyPress = function(event)
|
|||
|
||||
var simCode = this.checkActiveKey();
|
||||
if (simCode && this.isAlphaKey(simCode) && this.isAlphaKey(keyCode) && simCode != keyCode) {
|
||||
if (!COMPILED && this.messageEnabled(Debugger.MESSAGE.KEYS)) {
|
||||
if (!COMPILED && this.messageEnabled(Messages.KEYS)) {
|
||||
this.messageDebugger("onKeyPress(" + keyCode + ") out of sync with " + simCode + ", invert caps-lock", true);
|
||||
}
|
||||
this.fToggleCapsLock = true;
|
||||
|
|
@ -2053,7 +2053,7 @@ Keyboard.prototype.onKeyPress = function(event)
|
|||
|
||||
var fPass = !Keyboard.SIMCODES[keyCode] || !!(this.bitsState & Keyboard.STATE.CMD);
|
||||
|
||||
if (!COMPILED && this.messageEnabled(Debugger.MESSAGE.KEYS)) {
|
||||
if (!COMPILED && this.messageEnabled(Messages.KEYS)) {
|
||||
this.messageDebugger("\nonKeyPress(" + keyCode + "): " + (fPass? "true" : "false"), true);
|
||||
}
|
||||
|
||||
|
|
@ -2143,7 +2143,7 @@ Keyboard.prototype.keySimulate = function(simCode, fDown)
|
|||
fSimulated = true;
|
||||
}
|
||||
|
||||
if (!COMPILED && this.messageEnabled(Debugger.MESSAGE.KEYS)) {
|
||||
if (!COMPILED && this.messageEnabled(Messages.KEYS)) {
|
||||
this.messageDebugger("keySimulate(" + simCode + "," + (fDown? "down" : "up") + "): " + (fSimulated? "true" : "false"), true);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@
|
|||
if (typeof module !== 'undefined') {
|
||||
var str = require("../../shared/lib/strlib");
|
||||
var Component = require("../../shared/lib/component");
|
||||
var Debugger = require("./debugger");
|
||||
var Messages = require("./messages");
|
||||
}
|
||||
/**
|
||||
* @class DataView
|
||||
|
|
@ -165,7 +165,7 @@ Memory.prototype = {
|
|||
* @return {number}
|
||||
*/
|
||||
readNone: function(off) {
|
||||
if (DEBUGGER && this.dbg.messageEnabled(Debugger.MESSAGE.MEM) /* && !off */) {
|
||||
if (DEBUGGER && this.dbg.messageEnabled(Messages.MEM) /* && !off */) {
|
||||
this.dbg.message("attempt to read invalid block %" + str.toHex(this.addr) + " from " + str.toHexAddr(this.cpu.regIP, this.cpu.segCS.sel));
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -178,7 +178,7 @@ Memory.prototype = {
|
|||
* @param {number} v (could be either a byte or word value, since we use the same handler for both kinds of accesses)
|
||||
*/
|
||||
writeNone: function(off, v) {
|
||||
if (DEBUGGER && this.dbg.messageEnabled(Debugger.MESSAGE.MEM) /* && !off */) {
|
||||
if (DEBUGGER && this.dbg.messageEnabled(Messages.MEM) /* && !off */) {
|
||||
this.dbg.message("attempt to write 0x" + str.toHexWord(v) + " to invalid block %" + str.toHex(this.addr), true);
|
||||
}
|
||||
},
|
||||
|
|
|
|||
85
modules/pcjs/lib/messages.js
Normal file
85
modules/pcjs/lib/messages.js
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
/**
|
||||
* @fileoverview PCjs-specific message definitions.
|
||||
* @author <a href="mailto:Jeff@pcjs.org">Jeff Parsons</a>
|
||||
* @version 1.0
|
||||
* Created 2014-Dec-11
|
||||
*
|
||||
* Copyright © 2012-2014 Jeff Parsons <Jeff@pcjs.org>
|
||||
*
|
||||
* This file is part of PCjs, which is part of the JavaScript Machines Project (aka JSMachines)
|
||||
* at <http://jsmachines.net/> and <http://pcjs.org/>.
|
||||
*
|
||||
* PCjs is free software: you can redistribute it and/or modify it under the terms of the
|
||||
* GNU General Public License as published by the Free Software Foundation, either version 3
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* PCjs is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with PCjs. If not,
|
||||
* see <http://www.gnu.org/licenses/gpl.html>.
|
||||
*
|
||||
* You are required to include the above copyright notice in every source code file of every
|
||||
* copy or modified version of this work, and to display that copyright notice on every screen
|
||||
* that loads or runs any version of this software (see Computer.sCopyright).
|
||||
*
|
||||
* Some PCjs files also attempt to load external resource files, such as character-image files,
|
||||
* ROM files, and disk image files. Those external resource files are not considered part of the
|
||||
* PCjs program for purposes of the GNU General Public License, and the author does not claim
|
||||
* any copyright as to their contents.
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
/*
|
||||
* Components that previously used Debugger messages definitions by including:
|
||||
*
|
||||
* var Debugger = require("./debugger");
|
||||
*
|
||||
* and using:
|
||||
*
|
||||
* Debugger.MESSAGE.FOO
|
||||
*
|
||||
* must now instead include:
|
||||
*
|
||||
* var Messages = require("./messages");
|
||||
*
|
||||
* and then replace all occurrences of "Debugger.MESSAGE.FOO" with "Messages.FOO".
|
||||
*/
|
||||
|
||||
var Messages = {
|
||||
CPU: 0x00000001,
|
||||
SEG: 0x00000002,
|
||||
DESC: 0x00000004,
|
||||
TSS: 0x00000008,
|
||||
INT: 0x00000010,
|
||||
FAULT: 0x00000020,
|
||||
MEM: 0x00000040,
|
||||
PORT: 0x00000080,
|
||||
DMA: 0x00000100,
|
||||
PIC: 0x00000200,
|
||||
TIMER: 0x00000400,
|
||||
CMOS: 0x00000800,
|
||||
RTC: 0x00001000,
|
||||
C8042: 0x00002000,
|
||||
CHIPSET: 0x00004000,
|
||||
KEYBOARD: 0x00008000,
|
||||
KEYS: 0x00010000,
|
||||
VIDEO: 0x00020000,
|
||||
FDC: 0x00040000,
|
||||
HDC: 0x00080000,
|
||||
DISK: 0x00100000,
|
||||
SERIAL: 0x00200000,
|
||||
SPEAKER: 0x00400000,
|
||||
STATE: 0x00800000,
|
||||
MOUSE: 0x01000000,
|
||||
COMPUTER: 0x02000000,
|
||||
DOS: 0x04000000,
|
||||
DATA: 0x08000000,
|
||||
LOG: 0x10000000,
|
||||
WARN: 0x20000000,
|
||||
HALT: 0x40000000
|
||||
};
|
||||
|
||||
if (typeof module !== 'undefined') module.exports = Messages;
|
||||
|
|
@ -36,9 +36,9 @@ if (typeof module !== 'undefined') {
|
|||
var str = require("../../shared/lib/strlib");
|
||||
var web = require("../../shared/lib/weblib");
|
||||
var Component = require("../../shared/lib/component");
|
||||
var Messages = require("./messages");
|
||||
var SerialPort = require("./serial");
|
||||
var State = require("./state");
|
||||
var Debugger = require("./debugger");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -71,7 +71,7 @@ if (typeof module !== 'undefined') {
|
|||
*/
|
||||
function Mouse(parmsMouse)
|
||||
{
|
||||
Component.call(this, "Mouse", parmsMouse, Mouse, Debugger.MESSAGE.MOUSE);
|
||||
Component.call(this, "Mouse", parmsMouse, Mouse, Messages.MOUSE);
|
||||
|
||||
this.idAdapter = parmsMouse['serial'];
|
||||
if (this.idAdapter) {
|
||||
|
|
@ -543,7 +543,7 @@ Mouse.prototype.sendPacket = function(sDiag, xDiag, yDiag)
|
|||
var b1 = 0x40 | (this.fButton1? 0x20 : 0) | (this.fButton2? 0x10 : 0) | ((this.yDelta & 0xC0) >> 4) | ((this.xDelta & 0xC0) >> 6);
|
||||
var b2 = this.xDelta & 0x3F;
|
||||
var b3 = this.yDelta & 0x3F;
|
||||
if (this.messageEnabled(Debugger.MESSAGE.SERIAL)) {
|
||||
if (this.messageEnabled(Messages.SERIAL)) {
|
||||
this.messageDebugger((sDiag? (sDiag + ": ") : "") + (yDiag !== undefined? ("mouse (" + xDiag + "," + yDiag + "): ") : "") + "serial packet [" + str.toHexByte(b1) + "," + str.toHexByte(b2) + "," + str.toHexByte(b3) + "]", 0, true);
|
||||
}
|
||||
this.componentAdapter.sendRBR([b1, b2, b3]);
|
||||
|
|
|
|||
|
|
@ -44,10 +44,3 @@
|
|||
* nodebugger.js, to be loaded as early as possible, which explicitly UPDATES the value of DEBUGGER to false.
|
||||
*/
|
||||
DEBUGGER = false;
|
||||
|
||||
/*
|
||||
* We still need some Debugger "stub" objects, so that attempts to reference Debugger constants won't trigger exceptions.
|
||||
*/
|
||||
var Debugger = {
|
||||
MESSAGE: {}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -35,8 +35,8 @@
|
|||
if (typeof module !== 'undefined') {
|
||||
var web = require("../../shared/lib/weblib");
|
||||
var Component = require("../../shared/lib/component");
|
||||
var Messages = require("./messages");
|
||||
var ChipSet = require("./chipset");
|
||||
var Debugger = require("./debugger");
|
||||
var State = require("./state");
|
||||
}
|
||||
|
||||
|
|
@ -87,7 +87,7 @@ function SerialPort(parmsSerial) {
|
|||
*/
|
||||
this.controlIOBuffer = null;
|
||||
|
||||
Component.call(this, "SerialPort", parmsSerial, SerialPort, Debugger.MESSAGE.SERIAL);
|
||||
Component.call(this, "SerialPort", parmsSerial, SerialPort, Messages.SERIAL);
|
||||
|
||||
Component.bindExternalControl(this, parmsSerial['binding'], SerialPort.sIOBuffer);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@
|
|||
if (typeof module !== 'undefined') {
|
||||
var web = require("./../../shared/lib/weblib");
|
||||
var Component = require("./../../shared/lib/component");
|
||||
var Messages = require("./messages");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -394,9 +395,9 @@ State.prototype = {
|
|||
messageEnabled: function(bitsMessage) {
|
||||
if (DEBUGGER && this.dbg) {
|
||||
if (bitsMessage == null) {
|
||||
bitsMessage = Debugger.MESSAGE.STATE;
|
||||
bitsMessage = Messages.STATE;
|
||||
} else {
|
||||
bitsMessage |= Debugger.MESSAGE.STATE;
|
||||
bitsMessage |= Messages.STATE;
|
||||
}
|
||||
return this.dbg.messageEnabled(bitsMessage);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,10 +37,10 @@ if (typeof module !== 'undefined') {
|
|||
var web = require("../../shared/lib/weblib");
|
||||
var DumpAPI = require("../../shared/lib/dumpapi");
|
||||
var Component = require("../../shared/lib/component");
|
||||
var Messages = require("./messages");
|
||||
var ChipSet = require("./chipset");
|
||||
var Keyboard = require("./keyboard");
|
||||
var State = require("./state");
|
||||
var Debugger = require("./debugger");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -96,7 +96,7 @@ if (typeof module !== 'undefined') {
|
|||
*/
|
||||
function Video(parmsVideo, canvas, context, textarea)
|
||||
{
|
||||
Component.call(this, "Video", parmsVideo, Video, Debugger.MESSAGE.VIDEO);
|
||||
Component.call(this, "Video", parmsVideo, Video, Messages.VIDEO);
|
||||
|
||||
/*
|
||||
* This records the model specified (eg, "mda", "cga", "ega" or "" if none specified);
|
||||
|
|
@ -1960,7 +1960,7 @@ Video.prototype.initBus = function(cmp, bus, cpu, dbg)
|
|||
|
||||
if (DEBUGGER && dbg) {
|
||||
var video = this;
|
||||
dbg.messageDump(Debugger.MESSAGE.VIDEO, function onDumpVideo(sParm) {
|
||||
dbg.messageDump(Messages.VIDEO, function onDumpVideo(sParm) {
|
||||
video.dumpVideo(sParm);
|
||||
});
|
||||
}
|
||||
|
|
@ -3862,7 +3862,7 @@ Video.prototype.updateChar = function(col, row, data, context)
|
|||
this.contextScreen.fillRect(xDst, yDst, this.cxScreenCell, this.cyScreenCell);
|
||||
}
|
||||
|
||||
if (MAXDEBUG && this.messageEnabled(Debugger.MESSAGE.VIDEO | Debugger.MESSAGE.LOG)) {
|
||||
if (MAXDEBUG && this.messageEnabled(Messages.VIDEO | Messages.LOG)) {
|
||||
this.log("updateCharBgnd(" + col + "," + row + "," + bChar + "): filled " + xDst + "," + yDst);
|
||||
}
|
||||
|
||||
|
|
@ -3873,7 +3873,7 @@ Video.prototype.updateChar = function(col, row, data, context)
|
|||
var xSrcFgnd = (bChar & 0xf) * font.cxCell;
|
||||
var ySrcFgnd = (bChar >> 4) * font.cyCell;
|
||||
|
||||
if (MAXDEBUG && this.messageEnabled(Debugger.MESSAGE.VIDEO | Debugger.MESSAGE.LOG)) {
|
||||
if (MAXDEBUG && this.messageEnabled(Messages.VIDEO | Messages.LOG)) {
|
||||
this.log("updateCharFgnd(" + col + "," + row + "," + bChar + "): draw from " + xSrcFgnd + "," + ySrcFgnd + " (" + font.cxCell + "," + font.cyCell + ") to " + xDst + "," + yDst);
|
||||
}
|
||||
|
||||
|
|
@ -3943,7 +3943,7 @@ Video.prototype.updateScreen = function(fForce)
|
|||
/*
|
||||
* The Computer component maintains the fPowered setting on our behalf, so we use it.
|
||||
*/
|
||||
if (!this.bitField.fPowered) return;
|
||||
if (!this.aFlags.fPowered) return;
|
||||
|
||||
/*
|
||||
* If the card's video signal is disabled (eg, during a mode change), then skip the update,
|
||||
|
|
|
|||
|
|
@ -193,10 +193,10 @@ var X86 = {
|
|||
*
|
||||
* Interrupts beyond 0x10 (up through 0x1F) are reserved for future exceptions.
|
||||
*
|
||||
* Implementation Detail: For any opcode we know must generate a UD_FAULT interrupt, we invoke opInvalid(),
|
||||
* NOT opUndefined(). UD_FAULT is for INVALID opcodes, Intel's choice of "UD" notwithstanding.
|
||||
* Implementation Detail: For any opcode we know must generate a UD_FAULT interrupt, we invoke opHelpInvalid(),
|
||||
* NOT opHelpUndefined(). UD_FAULT is for INVALID opcodes, Intel's choice of "UD" notwithstanding.
|
||||
*
|
||||
* We reserve the term "undefined" for opcodes that require further investigation, and we invoke opUndefined()
|
||||
* We reserve the term "undefined" for opcodes that require more investigation, and we invoke opHelpUndefined()
|
||||
* ONLY until an opcode's behavior has finally been defined, at which point it becomes either valid or invalid.
|
||||
* The term "illegal" seems completely superfluous; we don't need a third way of describing invalid opcodes.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ if (typeof module !== 'undefined') {
|
|||
var str = require("../../shared/lib/strlib");
|
||||
var web = require("../../shared/lib/weblib");
|
||||
var Component = require("../../shared/lib/component");
|
||||
var Messages = require("./messages");
|
||||
var Bus = require("./bus");
|
||||
var State = require("./state");
|
||||
var CPU = require("./cpu");
|
||||
|
|
@ -46,7 +47,6 @@ if (typeof module !== 'undefined') {
|
|||
var X86Mods = require("./x86mods");
|
||||
var X86OpXX = require("./x86opxx");
|
||||
var X86Op0F = require("./x86op0f");
|
||||
var Debugger = require("./debugger");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -144,7 +144,7 @@ function X86CPU(parmsCPU) {
|
|||
* stepCPU() call, but it's good form to do so.
|
||||
*/
|
||||
this.nBurstCycles = 0;
|
||||
this.bitField.fComplete = this.bitField.fDebugCheck = false;
|
||||
this.aFlags.fComplete = this.aFlags.fDebugCheck = false;
|
||||
|
||||
/*
|
||||
* We're just declaring aMemBlocks and associated Bus parameters here; they'll be initialized by initMemory()
|
||||
|
|
@ -705,15 +705,15 @@ X86CPU.prototype.initProcessor = function()
|
|||
* opOUTSw, opENTER, and opLEAVE.
|
||||
*/
|
||||
this.nShiftCountMask = 0x1f; // on newer processors, all shift counts are MOD 32
|
||||
this.aOps[0x0F] = X86OpXX.opInvalid;
|
||||
this.aOps[0x0F] = X86Help.opHelpInvalid;
|
||||
this.aOps[X86.OPCODE.PUSHA] = X86OpXX.opPUSHA;
|
||||
this.aOps[X86.OPCODE.POPA] = X86OpXX.opPOPA;
|
||||
this.aOps[X86.OPCODE.BOUND] = X86OpXX.opBOUND;
|
||||
this.aOps[0x63] = X86OpXX.opInvalid;
|
||||
this.aOps[0x64] = X86OpXX.opInvalid;
|
||||
this.aOps[0x65] = X86OpXX.opInvalid;
|
||||
this.aOps[0x66] = X86OpXX.opInvalid;
|
||||
this.aOps[0x67] = X86OpXX.opInvalid;
|
||||
this.aOps[0x63] = X86Help.opHelpInvalid;
|
||||
this.aOps[0x64] = X86Help.opHelpInvalid;
|
||||
this.aOps[0x65] = X86Help.opHelpInvalid;
|
||||
this.aOps[0x66] = X86Help.opHelpInvalid;
|
||||
this.aOps[0x67] = X86Help.opHelpInvalid;
|
||||
this.aOps[X86.OPCODE.PUSH16] = X86OpXX.opPUSH16;
|
||||
this.aOps[X86.OPCODE.IMUL16] = X86OpXX.opIMUL16;
|
||||
this.aOps[X86.OPCODE.PUSH8] = X86OpXX.opPUSH8;
|
||||
|
|
@ -751,7 +751,7 @@ X86CPU.prototype.initProcessor = function()
|
|||
*/
|
||||
X86CPU.prototype.reset = function()
|
||||
{
|
||||
if (this.bitField.fRunning) this.stopCPU();
|
||||
if (this.aFlags.fRunning) this.stopCPU();
|
||||
this.resetRegs();
|
||||
this.resetCycles();
|
||||
this.clearError(); // clear any fatal error/exception that setError() may have flagged
|
||||
|
|
@ -965,8 +965,8 @@ X86CPU.prototype.checkIntNotify = function(nInt)
|
|||
* The enabling of MESSAGE_INT messages is one of the criteria that's also included in the Debugger's
|
||||
* checksEnabled() function, and therefore in fDebugCheck, so for maximum speed, we check fDebugCheck first.
|
||||
*/
|
||||
if (DEBUGGER && this.bitField.fDebugCheck) {
|
||||
if (this.messageEnabled(Debugger.MESSAGE.INT) && this.dbg.messageInt(nInt, this.regEIP)) {
|
||||
if (DEBUGGER && this.aFlags.fDebugCheck) {
|
||||
if (this.messageEnabled(Messages.INT) && this.dbg.messageInt(nInt, this.regEIP)) {
|
||||
this.addIntReturn(this.regEIP, function(cpu, nCycles) {
|
||||
return function onIntReturn(nLevel) {
|
||||
cpu.dbg.messageIntReturn(nInt, nLevel, cpu.getCycles() - nCycles);
|
||||
|
|
@ -2398,7 +2398,7 @@ X86CPU.prototype.delayINTR = function()
|
|||
*/
|
||||
X86CPU.prototype.displayStatus = function(fForce)
|
||||
{
|
||||
if (fForce || !this.bitField.fRunning || this.bitField.fDisplayLiveRegs) {
|
||||
if (fForce || !this.aFlags.fRunning || this.aFlags.fDisplayLiveRegs) {
|
||||
this.displayReg("AX", this.regAX);
|
||||
this.displayReg("BX", this.regBX);
|
||||
this.displayReg("CX", this.regCX);
|
||||
|
|
@ -2461,12 +2461,12 @@ X86CPU.prototype.stepCPU = function(nMinCycles)
|
|||
* Debugger is single-stepping (even when performing multiple single-steps), fRunning is never set,
|
||||
* so stopCPU() would have no effect as far as the Debugger is concerned.
|
||||
*/
|
||||
this.bitField.fComplete = true;
|
||||
this.aFlags.fComplete = true;
|
||||
|
||||
/*
|
||||
* fDebugCheck is true if we need to "check" every instruction with the Debugger.
|
||||
*/
|
||||
var fDebugCheck = this.bitField.fDebugCheck = (DEBUGGER && this.dbg && this.dbg.checksEnabled());
|
||||
var fDebugCheck = this.aFlags.fDebugCheck = (DEBUGGER && this.dbg && this.dbg.checksEnabled());
|
||||
|
||||
/*
|
||||
* fDebugSkip is checked only when fDebugCheck is true, and its sole purpose is to tell the first call
|
||||
|
|
@ -2476,8 +2476,8 @@ X86CPU.prototype.stepCPU = function(nMinCycles)
|
|||
* Once we snap fStarting, we clear it, because technically, we've moved beyond "starting" and have officially
|
||||
* "started" now.
|
||||
*/
|
||||
var fDebugSkip = this.bitField.fStarting || !nMinCycles;
|
||||
this.bitField.fStarting = false;
|
||||
var fDebugSkip = this.aFlags.fStarting || !nMinCycles;
|
||||
this.aFlags.fStarting = false;
|
||||
|
||||
/*
|
||||
* We move the minimum cycle count to nStepCycles (the number of cycles left to step), so that other
|
||||
|
|
@ -2505,7 +2505,7 @@ X86CPU.prototype.stepCPU = function(nMinCycles)
|
|||
* One exception I make here is when you've asked the Debugger to display PIC messages, the idea being that
|
||||
* if you're watching the PIC that closely, then you want to hardware interrupts to occur regardless.
|
||||
*/
|
||||
if (!nMinCycles && !this.messageEnabled(Debugger.MESSAGE.PIC)) this.opFlags |= X86.OPFLAG.NOINTR;
|
||||
if (!nMinCycles && !this.messageEnabled(Messages.PIC)) this.opFlags |= X86.OPFLAG.NOINTR;
|
||||
|
||||
do {
|
||||
var opPrefixes = this.opFlags & X86.OPFLAG.PREFIXES;
|
||||
|
|
@ -2618,7 +2618,7 @@ X86CPU.prototype.stepCPU = function(nMinCycles)
|
|||
/*
|
||||
* Make sure that every instruction is assessing a cycle cost, and that the cost is a net positive.
|
||||
*/
|
||||
if (this.bitField.fComplete && this.nStepCycles >= this.nSnapCycles && !(this.opFlags & X86.OPFLAG.PREFIXES)) {
|
||||
if (this.aFlags.fComplete && this.nStepCycles >= this.nSnapCycles && !(this.opFlags & X86.OPFLAG.PREFIXES)) {
|
||||
this.println("cycle miscount: " + (this.nSnapCycles - this.nStepCycles));
|
||||
this.setIP(this.opEA - this.segCS.base);
|
||||
this.stopCPU();
|
||||
|
|
@ -2628,7 +2628,7 @@ X86CPU.prototype.stepCPU = function(nMinCycles)
|
|||
|
||||
} while (this.nStepCycles > 0);
|
||||
|
||||
return (this.bitField.fComplete? this.nBurstCycles - this.nStepCycles : (this.bitField.fComplete === undefined? 0 : -1));
|
||||
return (this.aFlags.fComplete? this.nBurstCycles - this.nStepCycles : (this.aFlags.fComplete === undefined? 0 : -1));
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -35,8 +35,6 @@
|
|||
if (typeof module !== 'undefined') {
|
||||
var X86 = require("./x86");
|
||||
var X86Help = require("./x86help");
|
||||
var X86OpXX = require("./x86opxx");
|
||||
var Debugger = require("./debugger");
|
||||
}
|
||||
|
||||
var X86Grps = {
|
||||
|
|
@ -1238,7 +1236,7 @@ var X86Grps = {
|
|||
* @return {number}
|
||||
*/
|
||||
opGrpInvalid: function(dst, src) {
|
||||
X86OpXX.opInvalid.call(this);
|
||||
X86Help.opHelpInvalid.call(this);
|
||||
return dst;
|
||||
},
|
||||
/**
|
||||
|
|
@ -1248,7 +1246,7 @@ var X86Grps = {
|
|||
* @return {number}
|
||||
*/
|
||||
opGrpUndefined: function(dst, src) {
|
||||
X86OpXX.opUndefined.call(this);
|
||||
X86Help.opHelpUndefined.call(this);
|
||||
return dst;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -34,8 +34,7 @@
|
|||
|
||||
if (typeof module !== 'undefined') {
|
||||
var X86 = require("./x86");
|
||||
var X86OpXX = require("./x86opxx");
|
||||
var Debugger = require("./debugger");
|
||||
var Messages = require("./messages");
|
||||
}
|
||||
|
||||
var X86Help = {
|
||||
|
|
@ -177,7 +176,7 @@ var X86Help = {
|
|||
*/
|
||||
opHelpLEA: function(dst, src) {
|
||||
if (this.regEA < 0) {
|
||||
X86OpXX.opUndefined.call(this);
|
||||
X86Help.opHelpUndefined.call(this);
|
||||
return dst;
|
||||
}
|
||||
this.nStepCycles -= this.CYCLES.nOpCyclesLEA;
|
||||
|
|
@ -191,7 +190,7 @@ var X86Help = {
|
|||
*/
|
||||
opHelpLDS: function(dst, src) {
|
||||
if (this.regEA < 0) {
|
||||
X86OpXX.opUndefined.call(this);
|
||||
X86Help.opHelpUndefined.call(this);
|
||||
return dst;
|
||||
}
|
||||
this.setDS(this.getWord(this.regEA + 2));
|
||||
|
|
@ -206,7 +205,7 @@ var X86Help = {
|
|||
*/
|
||||
opHelpLES: function(dst, src) {
|
||||
if (this.regEA < 0) {
|
||||
X86OpXX.opUndefined.call(this);
|
||||
X86Help.opHelpUndefined.call(this);
|
||||
return dst;
|
||||
}
|
||||
this.setES(this.getWord(this.regEA + 2));
|
||||
|
|
@ -224,7 +223,7 @@ var X86Help = {
|
|||
/*
|
||||
* Generate UD_FAULT (INT 0x06: Invalid Opcode) if src is not a memory operand.
|
||||
*/
|
||||
X86OpXX.opInvalid.call(this);
|
||||
X86Help.opHelpInvalid.call(this);
|
||||
return dst;
|
||||
}
|
||||
/*
|
||||
|
|
@ -576,8 +575,8 @@ var X86Help = {
|
|||
*/
|
||||
opHelpFault: function(nFault, nError, fHalt)
|
||||
{
|
||||
if (!this.bitField.fComplete) {
|
||||
this.messageDebugger("Fault " + str.toHexByte(nFault) + " blocked by Debugger", Debugger.MESSAGE.WARN);
|
||||
if (!this.aFlags.fComplete) {
|
||||
this.messageDebugger("Fault " + str.toHexByte(nFault) + " blocked by Debugger", Messages.WARN);
|
||||
this.setIP(this.opEA - this.segCS.base);
|
||||
return;
|
||||
}
|
||||
|
|
@ -649,7 +648,7 @@ var X86Help = {
|
|||
*/
|
||||
opHelpFaultMessage: function(nFault, nError, fHalt)
|
||||
{
|
||||
var bitsMessage = Debugger.MESSAGE.FAULT;
|
||||
var bitsMessage = Messages.FAULT;
|
||||
var bOpcode = this.bus.getByteDirect(this.regEIP);
|
||||
|
||||
/*
|
||||
|
|
@ -667,7 +666,7 @@ var X86Help = {
|
|||
*/
|
||||
if (bOpcode == X86.OPCODE.INT3) {
|
||||
fHalt = false;
|
||||
bitsMessage |= Debugger.MESSAGE.CPU;
|
||||
bitsMessage |= Messages.CPU;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -683,13 +682,13 @@ var X86Help = {
|
|||
* However, the foregoing notwithstanding, if MESSAGE.HALT is enabled along with all the other required
|
||||
* MESSAGE bits, then we want to halt regardless.
|
||||
*/
|
||||
if (this.messageEnabled(bitsMessage | Debugger.MESSAGE.HALT)) {
|
||||
if (this.messageEnabled(bitsMessage | Messages.HALT)) {
|
||||
fHalt = true;
|
||||
}
|
||||
|
||||
if (this.messageEnabled(bitsMessage) || fHalt) {
|
||||
var sMessage = (fHalt? '\n' : '') + "Fault " + str.toHexByte(nFault) + (nError != null? " (" + str.toHexWord(nError) + ")" : "") + " on opcode 0x" + str.toHexByte(bOpcode) + " at " + str.toHexAddr(this.regIP, this.segCS.sel) + " (%" + str.toHex(this.regEIP, 6) + ")";
|
||||
var fRunning = this.bitField.fRunning;
|
||||
var fRunning = this.aFlags.fRunning;
|
||||
if (this.messageDebugger(sMessage, bitsMessage)) {
|
||||
if (fHalt) {
|
||||
/*
|
||||
|
|
@ -714,6 +713,21 @@ var X86Help = {
|
|||
}
|
||||
}
|
||||
return fHalt;
|
||||
},
|
||||
/**
|
||||
* @this {X86CPU}
|
||||
*/
|
||||
opHelpInvalid: function() {
|
||||
X86Help.opHelpFault.call(this, X86.EXCEPTION.UD_FAULT);
|
||||
this.stopCPU();
|
||||
},
|
||||
/**
|
||||
* @this {X86CPU}
|
||||
*/
|
||||
opHelpUndefined: function() {
|
||||
this.setIP(this.opEA - this.segCS.base);
|
||||
this.setError("Undefined opcode 0x" + str.toHexByte(this.bus.getByteDirect(this.regEIP)) + " at " + str.toHexAddr(this.regIP, this.segCS.sel));
|
||||
this.stopCPU();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@ if (typeof module !== 'undefined') {
|
|||
var X86Grps = require("./x86grps");
|
||||
var X86Help = require("./x86help");
|
||||
var X86Mods = require("./x86mods");
|
||||
var X86OpXX = require("./x86opxx");
|
||||
}
|
||||
|
||||
var X86Op0F = {
|
||||
|
|
@ -297,7 +296,7 @@ var X86Op0F = {
|
|||
*/
|
||||
opSGDT: function(dst, src) {
|
||||
if (this.regEA < 0) {
|
||||
X86OpXX.opInvalid.call(this);
|
||||
X86Help.opHelpInvalid.call(this);
|
||||
} else {
|
||||
/*
|
||||
* We don't need to setWord() the first word of the operand, because the ModRM group decoder that calls
|
||||
|
|
@ -351,7 +350,7 @@ var X86Op0F = {
|
|||
*/
|
||||
opSIDT: function(dst, src) {
|
||||
if (this.regEA < 0) {
|
||||
X86OpXX.opInvalid.call(this);
|
||||
X86Help.opHelpInvalid.call(this);
|
||||
} else {
|
||||
/*
|
||||
* We don't need to setWord() the first word of the operand, because the ModRM group decoder that calls
|
||||
|
|
@ -384,7 +383,7 @@ var X86Op0F = {
|
|||
*/
|
||||
opLGDT: function(dst, src) {
|
||||
if (this.regEA < 0) {
|
||||
X86OpXX.opInvalid.call(this);
|
||||
X86Help.opHelpInvalid.call(this);
|
||||
} else {
|
||||
this.addrGDT = this.getWord(this.regEA + 2) | (this.getByte(this.regEA + 4) << 16);
|
||||
this.addrGDTLimit = this.addrGDT + dst;
|
||||
|
|
@ -407,7 +406,7 @@ var X86Op0F = {
|
|||
*/
|
||||
opLIDT: function(dst, src) {
|
||||
if (this.regEA < 0) {
|
||||
X86OpXX.opInvalid.call(this);
|
||||
X86Help.opHelpInvalid.call(this);
|
||||
} else {
|
||||
this.addrIDT = this.getWord(this.regEA + 2) | (this.getByte(this.regEA + 4) << 16);
|
||||
this.addrIDTLimit = this.addrIDT + dst;
|
||||
|
|
@ -442,73 +441,73 @@ var X86Op0F = {
|
|||
|
||||
X86Op0F.aOps0F = [
|
||||
X86Op0F.opGrp6, X86Op0F.opGrp7, X86Op0F.opLAR, X86Op0F.opLSL, // 0x00-0x03
|
||||
X86OpXX.opUndefined, X86Op0F.opLOADALL, X86Op0F.opCLTS, X86OpXX.opUndefined, // 0x04-0x07
|
||||
X86Help.opHelpUndefined,X86Op0F.opLOADALL, X86Op0F.opCLTS, X86Help.opHelpUndefined,// 0x04-0x07
|
||||
/*
|
||||
* On all processors (except the 8086/8088, of course), 0x0F,0x0B is also referred to as "UD2": an
|
||||
* instruction guaranteed to raise a #UD (Invalid Opcode) exception (INT 0x06) on all future x86 processors.
|
||||
*/
|
||||
X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opInvalid, // 0x08-0x0B
|
||||
X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, // 0x0C-0x0F
|
||||
X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, // 0x10-0x13
|
||||
X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, // 0x14-0x17
|
||||
X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, // 0x18-0x1B
|
||||
X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, // 0x1C-0x1F
|
||||
X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, // 0x20-0x23
|
||||
X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, // 0x24-0x27
|
||||
X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, // 0x28-0x2B
|
||||
X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, // 0x2C-0x2F
|
||||
X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, // 0x30-0x33
|
||||
X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, // 0x34-0x37
|
||||
X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, // 0x38-0x3B
|
||||
X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, // 0x3C-0x3F
|
||||
X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, // 0x40-0x43
|
||||
X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, // 0x44-0x47
|
||||
X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, // 0x48-0x4B
|
||||
X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, // 0x4C-0x4F
|
||||
X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, // 0x50-0x53
|
||||
X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, // 0x54-0x57
|
||||
X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, // 0x58-0x5B
|
||||
X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, // 0x5C-0x5F
|
||||
X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, // 0x60-0x63
|
||||
X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, // 0x64-0x67
|
||||
X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, // 0x68-0x6B
|
||||
X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, // 0x6C-0x6F
|
||||
X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, // 0x70-0x73
|
||||
X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, // 0x74-0x77
|
||||
X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, // 0x78-0x7B
|
||||
X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, // 0x7C-0x7F
|
||||
X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, // 0x80-0x83
|
||||
X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, // 0x84-0x87
|
||||
X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, // 0x88-0x8B
|
||||
X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, // 0x8C-0x8F
|
||||
X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, // 0x90-0x93
|
||||
X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, // 0x94-0x97
|
||||
X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, // 0x98-0x9B
|
||||
X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, // 0x9C-0x9F
|
||||
X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, // 0xA0-0xA3
|
||||
X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, // 0xA4-0xA7
|
||||
X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, // 0xA8-0xAB
|
||||
X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, // 0xAC-0xAF
|
||||
X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, // 0xB0-0xB3
|
||||
X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, // 0xB4-0xB7
|
||||
X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, // 0xB8-0xBB
|
||||
X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, // 0xBC-0xBF
|
||||
X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, // 0xC0-0xC3
|
||||
X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, // 0xC4-0xC7
|
||||
X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, // 0xC8-0xCB
|
||||
X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, // 0xCC-0xCF
|
||||
X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, // 0xD0-0xD3
|
||||
X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, // 0xD4-0xD7
|
||||
X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, // 0xD8-0xDB
|
||||
X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, // 0xDC-0xDF
|
||||
X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, // 0xE0-0xE3
|
||||
X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, // 0xE4-0xE7
|
||||
X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, // 0xE8-0xEB
|
||||
X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, // 0xEC-0xEF
|
||||
X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, // 0xF0-0xF3
|
||||
X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, // 0xF4-0xF7
|
||||
X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, // 0xF8-0xFB
|
||||
X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined, X86OpXX.opUndefined // 0xFC-0xFF
|
||||
X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpInvalid, // 0x08-0x0B
|
||||
X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,// 0x0C-0x0F
|
||||
X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,// 0x10-0x13
|
||||
X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,// 0x14-0x17
|
||||
X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,// 0x18-0x1B
|
||||
X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,// 0x1C-0x1F
|
||||
X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,// 0x20-0x23
|
||||
X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,// 0x24-0x27
|
||||
X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,// 0x28-0x2B
|
||||
X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,// 0x2C-0x2F
|
||||
X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,// 0x30-0x33
|
||||
X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,// 0x34-0x37
|
||||
X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,// 0x38-0x3B
|
||||
X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,// 0x3C-0x3F
|
||||
X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,// 0x40-0x43
|
||||
X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,// 0x44-0x47
|
||||
X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,// 0x48-0x4B
|
||||
X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,// 0x4C-0x4F
|
||||
X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,// 0x50-0x53
|
||||
X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,// 0x54-0x57
|
||||
X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,// 0x58-0x5B
|
||||
X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,// 0x5C-0x5F
|
||||
X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,// 0x60-0x63
|
||||
X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,// 0x64-0x67
|
||||
X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,// 0x68-0x6B
|
||||
X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,// 0x6C-0x6F
|
||||
X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,// 0x70-0x73
|
||||
X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,// 0x74-0x77
|
||||
X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,// 0x78-0x7B
|
||||
X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,// 0x7C-0x7F
|
||||
X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,// 0x80-0x83
|
||||
X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,// 0x84-0x87
|
||||
X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,// 0x88-0x8B
|
||||
X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,// 0x8C-0x8F
|
||||
X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,// 0x90-0x93
|
||||
X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,// 0x94-0x97
|
||||
X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,// 0x98-0x9B
|
||||
X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,// 0x9C-0x9F
|
||||
X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,// 0xA0-0xA3
|
||||
X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,// 0xA4-0xA7
|
||||
X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,// 0xA8-0xAB
|
||||
X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,// 0xAC-0xAF
|
||||
X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,// 0xB0-0xB3
|
||||
X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,// 0xB4-0xB7
|
||||
X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,// 0xB8-0xBB
|
||||
X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,// 0xBC-0xBF
|
||||
X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,// 0xC0-0xC3
|
||||
X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,// 0xC4-0xC7
|
||||
X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,// 0xC8-0xCB
|
||||
X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,// 0xCC-0xCF
|
||||
X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,// 0xD0-0xD3
|
||||
X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,// 0xD4-0xD7
|
||||
X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,// 0xD8-0xDB
|
||||
X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,// 0xDC-0xDF
|
||||
X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,// 0xE0-0xE3
|
||||
X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,// 0xE4-0xE7
|
||||
X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,// 0xE8-0xEB
|
||||
X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,// 0xEC-0xEF
|
||||
X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,// 0xF0-0xF3
|
||||
X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,// 0xF4-0xF7
|
||||
X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,// 0xF8-0xFB
|
||||
X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined,X86Help.opHelpUndefined // 0xFC-0xFF
|
||||
];
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
|
||||
if (typeof module !== 'undefined') {
|
||||
var Component = require("../../shared/lib/component");
|
||||
var Messages = require("./messages");
|
||||
var X86 = require("./x86");
|
||||
var X86Grps = require("./x86grps");
|
||||
var X86Help = require("./x86help");
|
||||
|
|
@ -193,7 +194,7 @@ var X86OpXX = {
|
|||
/**
|
||||
* @this {X86CPU}
|
||||
*
|
||||
* op=0x0F (pop CS) (undocumented on 8086/8088; replaced with opInvalid on 80186/80188, and op0F on 80286 and up)
|
||||
* op=0x0F (pop CS) (undocumented on 8086/8088; replaced with opHelpInvalid on 80186/80188, and op0F on 80286 and up)
|
||||
*/
|
||||
opPOPCS: function() {
|
||||
this.setCS(this.popWord());
|
||||
|
|
@ -1741,7 +1742,7 @@ var X86OpXX = {
|
|||
this.regMD16 = this.segDS.sel;
|
||||
break;
|
||||
default:
|
||||
X86OpXX.opUndefined.call(this);
|
||||
X86Help.opHelpUndefined.call(this);
|
||||
return;
|
||||
}
|
||||
/*
|
||||
|
|
@ -1787,7 +1788,7 @@ var X86OpXX = {
|
|||
break;
|
||||
default:
|
||||
if (this.model >= X86.MODEL_80286) {
|
||||
X86OpXX.opInvalid.call(this);
|
||||
X86Help.opHelpInvalid.call(this);
|
||||
return;
|
||||
}
|
||||
switch(reg) {
|
||||
|
|
@ -1980,7 +1981,7 @@ var X86OpXX = {
|
|||
* op=0x9B (wait)
|
||||
*/
|
||||
opWAIT: function() {
|
||||
this.messageDebugger("WAIT not implemented", Debugger.MESSAGE.CPU);
|
||||
this.messageDebugger("WAIT not implemented", Messages.CPU);
|
||||
this.nStepCycles--;
|
||||
},
|
||||
/**
|
||||
|
|
@ -3144,7 +3145,7 @@ var X86OpXX = {
|
|||
* I still treat this as undefined, until I can verify the behavior on real hardware.
|
||||
*/
|
||||
opINT1: function() {
|
||||
X86OpXX.opUndefined.call(this);
|
||||
X86Help.opHelpUndefined.call(this);
|
||||
},
|
||||
/**
|
||||
* @this {X86CPU}
|
||||
|
|
@ -3338,21 +3339,6 @@ var X86OpXX = {
|
|||
opGrp4w: function() {
|
||||
X86Mods.aOpModsGrpWord[this.getIPByte()].call(this, X86Grps.aOpGrp4w, X86Grps.opGrpNoSrc);
|
||||
if (EAFUNCS) this.setEAWord = this.setEAWordEnabled;
|
||||
},
|
||||
/**
|
||||
* @this {X86CPU}
|
||||
*/
|
||||
opInvalid: function() {
|
||||
X86Help.opHelpFault.call(this, X86.EXCEPTION.UD_FAULT);
|
||||
this.stopCPU();
|
||||
},
|
||||
/**
|
||||
* @this {X86CPU}
|
||||
*/
|
||||
opUndefined: function() {
|
||||
this.setIP(this.opEA - this.segCS.base);
|
||||
this.setError("Undefined opcode 0x" + str.toHexByte(this.bus.getByteDirect(this.regEIP)) + " at " + str.toHexAddr(this.regIP, this.segCS.sel));
|
||||
this.stopCPU();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
|
||||
if (typeof module !== 'undefined') {
|
||||
var str = require("../../shared/lib/strlib");
|
||||
var Messages = require("./messages");
|
||||
var X86 = require("./x86");
|
||||
var X86Help = require("./x86help");
|
||||
}
|
||||
|
|
@ -409,7 +410,7 @@ X86Seg.switchTSS = function switchTSS(selNew, fNest)
|
|||
return false;
|
||||
}
|
||||
var addrNew = cpu.segTSS.base;
|
||||
if (DEBUG && DEBUGGER && this.dbg && this.dbg.messageEnabled(Debugger.MESSAGE.TSS)) {
|
||||
if (DEBUG && DEBUGGER && this.dbg && this.dbg.messageEnabled(Messages.TSS)) {
|
||||
this.dbg.message((fNest? "Task switch" : "Task return") + ": TR " + str.toHexWord(selOld) + " (%" + str.toHex(addrOld, 6) + "), new TR " + str.toHexWord(selNew) + " (%" + str.toHex(addrNew, 6) + ")");
|
||||
}
|
||||
if (fNest) {
|
||||
|
|
@ -866,7 +867,7 @@ X86Seg.prototype.updateMode = function(fProt)
|
|||
X86Seg.prototype.messageSeg = function(sel, base, limit, acc, ext)
|
||||
{
|
||||
if (DEBUG) {
|
||||
if (DEBUGGER && this.dbg && this.dbg.messageEnabled(Debugger.MESSAGE.SEG)) {
|
||||
if (DEBUGGER && this.dbg && this.dbg.messageEnabled(Messages.SEG)) {
|
||||
var ch = (this.sName.length < 3? " " : "");
|
||||
var sDPL = " dpl=" + this.dpl;
|
||||
if (this.id == X86Seg.ID.CODE) sDPL += " cpl=" + this.cpl;
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ function Component(type, parms, constructor, bitsMessage)
|
|||
* Gather all the various component flags (booleans) into a single "flags" object, and encourage
|
||||
* subclasses to do the same, to reduce the property clutter we have to wade through while debugging.
|
||||
*/
|
||||
this.bitField = {
|
||||
this.aFlags = {
|
||||
fReady: false,
|
||||
fBusy: false,
|
||||
fBusyCancel: false,
|
||||
|
|
@ -794,7 +794,7 @@ Component.prototype = {
|
|||
* @param {string} s describes a fatal error condition
|
||||
*/
|
||||
setError: function(s) {
|
||||
this.bitField.fError = true;
|
||||
this.aFlags.fError = true;
|
||||
this.notice("Fatal error: " + s);
|
||||
},
|
||||
/**
|
||||
|
|
@ -805,7 +805,7 @@ Component.prototype = {
|
|||
* @this {Component}
|
||||
*/
|
||||
clearError: function() {
|
||||
this.bitField.fError = false;
|
||||
this.aFlags.fError = false;
|
||||
},
|
||||
/**
|
||||
* isError()
|
||||
|
|
@ -816,7 +816,7 @@ Component.prototype = {
|
|||
* @return {boolean} true if a fatal error condition exists, false if not
|
||||
*/
|
||||
isError: function() {
|
||||
if (this.bitField.fError) {
|
||||
if (this.aFlags.fError) {
|
||||
this.println(this.toString() + " error");
|
||||
return true;
|
||||
}
|
||||
|
|
@ -837,14 +837,14 @@ Component.prototype = {
|
|||
*/
|
||||
isReady: function(fnReady) {
|
||||
if (fnReady) {
|
||||
if (this.bitField.fReady) {
|
||||
if (this.aFlags.fReady) {
|
||||
fnReady();
|
||||
} else {
|
||||
if (DEBUG) this.log("NOT ready");
|
||||
this.fnReady = fnReady;
|
||||
}
|
||||
}
|
||||
return this.bitField.fReady;
|
||||
return this.aFlags.fReady;
|
||||
},
|
||||
/**
|
||||
* setReady(fReady)
|
||||
|
|
@ -855,9 +855,9 @@ Component.prototype = {
|
|||
* @param {boolean} [fReady] is assumed to indicate "ready" unless EXPLICITLY set to false
|
||||
*/
|
||||
setReady: function(fReady) {
|
||||
if (!this.bitField.fError) {
|
||||
this.bitField.fReady = (fReady !== false);
|
||||
if (this.bitField.fReady) {
|
||||
if (!this.aFlags.fError) {
|
||||
this.aFlags.fReady = (fReady !== false);
|
||||
if (this.aFlags.fReady) {
|
||||
if (DEBUG || this.name) this.log("ready");
|
||||
var fnReady = this.fnReady;
|
||||
this.fnReady = null;
|
||||
|
|
@ -875,14 +875,14 @@ Component.prototype = {
|
|||
* @return {boolean} true if "busy", false if not
|
||||
*/
|
||||
isBusy: function(fCancel) {
|
||||
if (this.bitField.fBusy) {
|
||||
if (this.aFlags.fBusy) {
|
||||
if (fCancel) {
|
||||
this.bitField.fBusyCancel = true;
|
||||
this.aFlags.fBusyCancel = true;
|
||||
} else if (fCancel === undefined) {
|
||||
this.println(this.toString() + " busy");
|
||||
}
|
||||
}
|
||||
return this.bitField.fBusy;
|
||||
return this.aFlags.fBusy;
|
||||
},
|
||||
/**
|
||||
* setBusy(fBusy)
|
||||
|
|
@ -894,19 +894,19 @@ Component.prototype = {
|
|||
* @return {boolean}
|
||||
*/
|
||||
setBusy: function(fBusy) {
|
||||
if (this.bitField.fBusyCancel) {
|
||||
if (this.bitField.fBusy) {
|
||||
this.bitField.fBusy = false;
|
||||
if (this.aFlags.fBusyCancel) {
|
||||
if (this.aFlags.fBusy) {
|
||||
this.aFlags.fBusy = false;
|
||||
}
|
||||
this.bitField.fBusyCancel = false;
|
||||
this.aFlags.fBusyCancel = false;
|
||||
return false;
|
||||
}
|
||||
if (this.bitField.fError) {
|
||||
if (this.aFlags.fError) {
|
||||
this.println(this.toString() + " error");
|
||||
return false;
|
||||
}
|
||||
this.bitField.fBusy = fBusy;
|
||||
return this.bitField.fBusy;
|
||||
this.aFlags.fBusy = fBusy;
|
||||
return this.aFlags.fBusy;
|
||||
},
|
||||
/**
|
||||
* powerUp(fSave)
|
||||
|
|
@ -917,7 +917,7 @@ Component.prototype = {
|
|||
* @return {boolean} true if successful, false if failure
|
||||
*/
|
||||
powerUp: function(data, fRepower) {
|
||||
this.bitField.fPowered = true;
|
||||
this.aFlags.fPowered = true;
|
||||
return true;
|
||||
},
|
||||
/**
|
||||
|
|
@ -929,7 +929,7 @@ Component.prototype = {
|
|||
* @return {Object|boolean} component state if fSave; otherwise, true if successful, false if failure
|
||||
*/
|
||||
powerDown: function(fSave, fShutdown) {
|
||||
if (fShutdown) this.bitField.fPowered = false;
|
||||
if (fShutdown) this.aFlags.fPowered = false;
|
||||
return true;
|
||||
},
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -32,4 +32,6 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
var global;
|
||||
|
||||
// var webkitAudioContext;
|
||||
|
|
|
|||
|
|
@ -402,15 +402,17 @@ web.fLocalStorage = null;
|
|||
*/
|
||||
web.hasLocalStorage = function() {
|
||||
if (web.fLocalStorage == null) {
|
||||
var f;
|
||||
var sTest = 'PCjs.localStorage';
|
||||
try {
|
||||
window.localStorage.setItem(sTest, sTest);
|
||||
f = (window.localStorage.getItem(sTest) === sTest);
|
||||
window.localStorage.removeItem(sTest);
|
||||
} catch(e) {
|
||||
web.logLocalStorageError(e);
|
||||
f = false;
|
||||
var f = false;
|
||||
if (window) {
|
||||
var sTest = 'PCjs.localStorage';
|
||||
try {
|
||||
window.localStorage.setItem(sTest, sTest);
|
||||
f = (window.localStorage.getItem(sTest) === sTest);
|
||||
window.localStorage.removeItem(sTest);
|
||||
} catch(e) {
|
||||
web.logLocalStorageError(e);
|
||||
f = false;
|
||||
}
|
||||
}
|
||||
web.fLocalStorage = f;
|
||||
}
|
||||
|
|
@ -438,10 +440,12 @@ web.logLocalStorageError = function(e)
|
|||
web.getLocalStorageItem = function(sKey)
|
||||
{
|
||||
var sValue;
|
||||
try {
|
||||
sValue = window.localStorage.getItem(sKey);
|
||||
} catch(e) {
|
||||
web.logLocalStorageError(e);
|
||||
if (window) {
|
||||
try {
|
||||
sValue = window.localStorage.getItem(sKey);
|
||||
} catch(e) {
|
||||
web.logLocalStorageError(e);
|
||||
}
|
||||
}
|
||||
return sValue;
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue