Changed serial mouse reset code to send two 'M' ID bytes; fixes #5
This commit is contained in:
parent
ebf6933536
commit
7908dcfda0
18 changed files with 1156 additions and 1246 deletions
|
|
@ -872,13 +872,6 @@ ChipSet.COPROC = { // TODO: Define a variable for this
|
|||
PORT_RESET: 0xF1 // reset the coprocessor
|
||||
};
|
||||
|
||||
/*
|
||||
* ChipSet-related BIOS interrupts, functions, and other parameters
|
||||
*/
|
||||
ChipSet.BIOS = {
|
||||
INT_RTC: 0x1A
|
||||
};
|
||||
|
||||
/**
|
||||
* @this {ChipSet}
|
||||
* @param {string|null} sHTMLClass is the class of the HTML control (eg, "input", "output")
|
||||
|
|
@ -952,17 +945,17 @@ ChipSet.prototype.initBus = function(cmp, bus, cpu, dbg)
|
|||
if (DEBUGGER) {
|
||||
if (dbg) {
|
||||
var chipset = this;
|
||||
dbg.messageDump(Debugger.MESSAGE_PIC, function onDumpPIC() {
|
||||
dbg.messageDump(Debugger.MESSAGE.PIC, function onDumpPIC() {
|
||||
chipset.dumpPIC();
|
||||
});
|
||||
dbg.messageDump(Debugger.MESSAGE_TIMER, function onDumpTimer() {
|
||||
dbg.messageDump(Debugger.MESSAGE.TIMER, function onDumpTimer() {
|
||||
chipset.dumpTimer();
|
||||
});
|
||||
dbg.messageDump(Debugger.MESSAGE_CMOS, function onDumpCMOS() {
|
||||
dbg.messageDump(Debugger.MESSAGE.CMOS, function onDumpCMOS() {
|
||||
chipset.dumpCMOS();
|
||||
});
|
||||
}
|
||||
cpu.addIntNotify(ChipSet.BIOS.INT_RTC, this, this.intBIOSRTC);
|
||||
cpu.addIntNotify(Debugger.INT.RTC, this, this.intBIOSRTC);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -2097,7 +2090,7 @@ ChipSet.prototype.inDMAChannelAddr = function(iDMAC, iChannel, port, addrFrom)
|
|||
var channel = controller.aChannels[iChannel];
|
||||
var b = channel.addrCurrent[controller.bIndex];
|
||||
controller.bIndex ^= 0x1;
|
||||
this.messagePort(port, null, addrFrom, "DMA" + iDMAC + ".CHANNEL" + iChannel + ".ADDR[" + controller.bIndex + "]", Debugger.MESSAGE_DMA, b);
|
||||
this.messagePort(port, null, addrFrom, "DMA" + iDMAC + ".CHANNEL" + iChannel + ".ADDR[" + controller.bIndex + "]", Debugger.MESSAGE.DMA, b);
|
||||
return b;
|
||||
};
|
||||
|
||||
|
|
@ -2114,7 +2107,7 @@ ChipSet.prototype.inDMAChannelAddr = function(iDMAC, iChannel, port, addrFrom)
|
|||
ChipSet.prototype.outDMAChannelAddr = function outDMAChannelAddr(iDMAC, iChannel, port, bOut, addrFrom)
|
||||
{
|
||||
var controller = this.aDMACs[iDMAC];
|
||||
this.messagePort(port, bOut, addrFrom, "DMA" + iDMAC + ".CHANNEL" + iChannel + ".ADDR[" + controller.bIndex + "]", Debugger.MESSAGE_DMA);
|
||||
this.messagePort(port, bOut, addrFrom, "DMA" + iDMAC + ".CHANNEL" + iChannel + ".ADDR[" + controller.bIndex + "]", Debugger.MESSAGE.DMA);
|
||||
var channel = controller.aChannels[iChannel];
|
||||
channel.addrCurrent[controller.bIndex] = channel.addrInit[controller.bIndex] = bOut;
|
||||
controller.bIndex ^= 0x1;
|
||||
|
|
@ -2136,7 +2129,7 @@ ChipSet.prototype.inDMAChannelCount = function(iDMAC, iChannel, port, addrFrom)
|
|||
var channel = controller.aChannels[iChannel];
|
||||
var b = channel.countCurrent[controller.bIndex];
|
||||
controller.bIndex ^= 0x1;
|
||||
this.messagePort(port, null, addrFrom, "DMA" + iDMAC + ".CHANNEL" + iChannel + ".COUNT[" + controller.bIndex + "]", Debugger.MESSAGE_DMA, b);
|
||||
this.messagePort(port, null, addrFrom, "DMA" + iDMAC + ".CHANNEL" + iChannel + ".COUNT[" + controller.bIndex + "]", Debugger.MESSAGE.DMA, b);
|
||||
return b;
|
||||
};
|
||||
|
||||
|
|
@ -2153,7 +2146,7 @@ ChipSet.prototype.inDMAChannelCount = function(iDMAC, iChannel, port, addrFrom)
|
|||
ChipSet.prototype.outDMAChannelCount = function(iDMAC, iChannel, port, bOut, addrFrom)
|
||||
{
|
||||
var controller = this.aDMACs[iDMAC];
|
||||
this.messagePort(port, bOut, addrFrom, "DMA" + iDMAC + ".CHANNEL" + iChannel + ".COUNT[" + controller.bIndex + "]", Debugger.MESSAGE_DMA);
|
||||
this.messagePort(port, bOut, addrFrom, "DMA" + iDMAC + ".CHANNEL" + iChannel + ".COUNT[" + controller.bIndex + "]", Debugger.MESSAGE.DMA);
|
||||
var channel = controller.aChannels[iChannel];
|
||||
channel.countCurrent[controller.bIndex] = channel.countInit[controller.bIndex] = bOut;
|
||||
controller.bIndex ^= 0x1;
|
||||
|
|
@ -2194,7 +2187,7 @@ ChipSet.prototype.inDMAStatus = function(iDMAC, port, addrFrom)
|
|||
var controller = this.aDMACs[iDMAC];
|
||||
var b = controller.bStatus | 0x1;
|
||||
controller.bStatus &= ~0xf;
|
||||
this.messagePort(port, null, addrFrom, "DMA" + iDMAC + ".STATUS", Debugger.MESSAGE_DMA, b);
|
||||
this.messagePort(port, null, addrFrom, "DMA" + iDMAC + ".STATUS", Debugger.MESSAGE.DMA, b);
|
||||
return b;
|
||||
};
|
||||
|
||||
|
|
@ -2209,7 +2202,7 @@ ChipSet.prototype.inDMAStatus = function(iDMAC, port, addrFrom)
|
|||
*/
|
||||
ChipSet.prototype.outDMACmd = function(iDMAC, port, bOut, addrFrom)
|
||||
{
|
||||
this.messagePort(port, bOut, addrFrom, "DMA" + iDMAC + ".CMD", Debugger.MESSAGE_DMA);
|
||||
this.messagePort(port, bOut, addrFrom, "DMA" + iDMAC + ".CMD", Debugger.MESSAGE.DMA);
|
||||
this.aDMACs[iDMAC].bCmd = bOut;
|
||||
};
|
||||
|
||||
|
|
@ -2235,7 +2228,7 @@ ChipSet.prototype.outDMACmd = function(iDMAC, port, bOut, addrFrom)
|
|||
ChipSet.prototype.outDMAReq = function(iDMAC, port, bOut, addrFrom)
|
||||
{
|
||||
var controller = this.aDMACs[iDMAC];
|
||||
this.messagePort(port, bOut, addrFrom, "DMA" + iDMAC + ".REQ", Debugger.MESSAGE_DMA);
|
||||
this.messagePort(port, bOut, addrFrom, "DMA" + iDMAC + ".REQ", Debugger.MESSAGE.DMA);
|
||||
/*
|
||||
* Bits 0-1 contain the channel number
|
||||
*/
|
||||
|
|
@ -2260,7 +2253,7 @@ ChipSet.prototype.outDMAReq = function(iDMAC, port, bOut, addrFrom)
|
|||
ChipSet.prototype.outDMAMask = function(iDMAC, port, bOut, addrFrom)
|
||||
{
|
||||
var controller = this.aDMACs[iDMAC];
|
||||
this.messagePort(port, bOut, addrFrom, "DMA" + iDMAC + ".MASK", Debugger.MESSAGE_DMA);
|
||||
this.messagePort(port, bOut, addrFrom, "DMA" + iDMAC + ".MASK", Debugger.MESSAGE.DMA);
|
||||
var iChannel = bOut & ChipSet.DMA_MASK.CHANNEL;
|
||||
var channel = controller.aChannels[iChannel];
|
||||
channel.masked = (bOut & ChipSet.DMA_MASK.CHANNEL_SET? true : false);
|
||||
|
|
@ -2278,7 +2271,7 @@ ChipSet.prototype.outDMAMask = function(iDMAC, port, bOut, addrFrom)
|
|||
*/
|
||||
ChipSet.prototype.outDMAMode = function(iDMAC, port, bOut, addrFrom)
|
||||
{
|
||||
this.messagePort(port, bOut, addrFrom, "DMA" + iDMAC + ".MODE", Debugger.MESSAGE_DMA);
|
||||
this.messagePort(port, bOut, addrFrom, "DMA" + iDMAC + ".MODE", Debugger.MESSAGE.DMA);
|
||||
var iChannel = bOut & ChipSet.DMA_MODE.CHANNEL;
|
||||
this.aDMACs[iDMAC].aChannels[iChannel].mode = bOut;
|
||||
};
|
||||
|
|
@ -2297,7 +2290,7 @@ ChipSet.prototype.outDMAMode = function(iDMAC, port, bOut, addrFrom)
|
|||
*/
|
||||
ChipSet.prototype.outDMAIndex = function(iDMAC, port, bOut, addrFrom)
|
||||
{
|
||||
this.messagePort(port, bOut, addrFrom, "DMA" + iDMAC + ".INDEX", Debugger.MESSAGE_DMA);
|
||||
this.messagePort(port, bOut, addrFrom, "DMA" + iDMAC + ".INDEX", Debugger.MESSAGE.DMA);
|
||||
this.aDMACs[iDMAC].bIndex = 0;
|
||||
};
|
||||
|
||||
|
|
@ -2312,7 +2305,7 @@ ChipSet.prototype.outDMAIndex = function(iDMAC, port, bOut, addrFrom)
|
|||
*/
|
||||
ChipSet.prototype.outDMAClear = function(iDMAC, port, bOut, addrFrom)
|
||||
{
|
||||
this.messagePort(port, bOut, addrFrom, "DMA" + iDMAC + ".CLEAR", Debugger.MESSAGE_DMA);
|
||||
this.messagePort(port, bOut, addrFrom, "DMA" + iDMAC + ".CLEAR", Debugger.MESSAGE.DMA);
|
||||
/*
|
||||
* The value written to this port doesn't matter; any write triggers a "master clear" operation
|
||||
*/
|
||||
|
|
@ -2335,7 +2328,7 @@ ChipSet.prototype.outDMAClear = function(iDMAC, port, bOut, addrFrom)
|
|||
ChipSet.prototype.inDMAPageReg = function(iDMAC, iChannel, port, addrFrom)
|
||||
{
|
||||
var bIn = this.aDMACs[iDMAC].aChannels[iChannel].bPage;
|
||||
this.messagePort(port, null, addrFrom, "DMA" + iDMAC + ".CHANNEL" + iChannel + ".PAGE", Debugger.MESSAGE_DMA, bIn);
|
||||
this.messagePort(port, null, addrFrom, "DMA" + iDMAC + ".CHANNEL" + iChannel + ".PAGE", Debugger.MESSAGE.DMA, bIn);
|
||||
return bIn;
|
||||
};
|
||||
|
||||
|
|
@ -2351,7 +2344,7 @@ ChipSet.prototype.inDMAPageReg = function(iDMAC, iChannel, port, addrFrom)
|
|||
*/
|
||||
ChipSet.prototype.outDMAPageReg = function(iDMAC, iChannel, port, bOut, addrFrom)
|
||||
{
|
||||
this.messagePort(port, bOut, addrFrom, "DMA" + iDMAC + ".CHANNEL" + iChannel + ".PAGE", Debugger.MESSAGE_DMA);
|
||||
this.messagePort(port, bOut, addrFrom, "DMA" + iDMAC + ".CHANNEL" + iChannel + ".PAGE", Debugger.MESSAGE.DMA);
|
||||
this.aDMACs[iDMAC].aChannels[iChannel].bPage = bOut;
|
||||
};
|
||||
|
||||
|
|
@ -2367,7 +2360,7 @@ ChipSet.prototype.outDMAPageReg = function(iDMAC, iChannel, port, bOut, addrFrom
|
|||
ChipSet.prototype.inDMAPageSpare = function(iSpare, port, addrFrom)
|
||||
{
|
||||
var bIn = this.abDMAPageSpare[iSpare];
|
||||
this.messagePort(port, null, addrFrom, "DMA.SPARE" + iSpare + ".PAGE", Debugger.MESSAGE_DMA, bIn);
|
||||
this.messagePort(port, null, addrFrom, "DMA.SPARE" + iSpare + ".PAGE", Debugger.MESSAGE.DMA, bIn);
|
||||
return bIn;
|
||||
};
|
||||
|
||||
|
|
@ -2382,7 +2375,7 @@ ChipSet.prototype.inDMAPageSpare = function(iSpare, port, addrFrom)
|
|||
*/
|
||||
ChipSet.prototype.outDMAPageSpare = function(iSpare, port, bOut, addrFrom)
|
||||
{
|
||||
this.messagePort(port, bOut, addrFrom, "DMA.SPARE" + iSpare + ".PAGE", Debugger.MESSAGE_DMA);
|
||||
this.messagePort(port, bOut, addrFrom, "DMA.SPARE" + iSpare + ".PAGE", Debugger.MESSAGE.DMA);
|
||||
this.abDMAPageSpare[iSpare] = bOut;
|
||||
};
|
||||
|
||||
|
|
@ -2450,7 +2443,7 @@ ChipSet.prototype.requestDMA = function(iDMAChannel, done)
|
|||
var channel = controller.aChannels[iChannel];
|
||||
|
||||
if (!channel.component || !channel.fnTransfer || !channel.obj) {
|
||||
if (DEBUG) this.messageDebugger("requestDMA(" + iDMAChannel + "): not connected to a component", Debugger.MESSAGE_DMA);
|
||||
if (DEBUG) this.messageDebugger("requestDMA(" + iDMAChannel + "): not connected to a component", Debugger.MESSAGE.DMA);
|
||||
if (done) done(true);
|
||||
return;
|
||||
}
|
||||
|
|
@ -2465,7 +2458,7 @@ ChipSet.prototype.requestDMA = function(iDMAChannel, done)
|
|||
if (done) channel.done = done;
|
||||
|
||||
if (channel.masked) {
|
||||
if (DEBUG) this.messageDebugger("requestDMA(" + iDMAChannel + "): channel masked, request queued", Debugger.MESSAGE_DMA);
|
||||
if (DEBUG) this.messageDebugger("requestDMA(" + iDMAChannel + "): channel masked, request queued", Debugger.MESSAGE.DMA);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -2516,7 +2509,7 @@ ChipSet.prototype.advanceDMA = function(channel, fInit)
|
|||
var addr = (channel.bPage << 16) | (channel.addrCurrent[1] << 8) | channel.addrCurrent[0];
|
||||
if (DEBUG && DEBUGGER && channel.sAddrDebug === null) {
|
||||
channel.sAddrDebug = str.toHex(addr >> 4, 4) + ":" + str.toHex(addr & 0xf, 4);
|
||||
if (this.dbg && this.dbg.messageEnabled(Debugger.MESSAGE_DMA | (iDMAChannel == ChipSet.DMA_FDC? Debugger.MESSAGE_FDC : (iDMAChannel == ChipSet.DMA_HDC? Debugger.MESSAGE_HDC : Debugger.MESSAGE_LOG))) && channel.xfer != ChipSet.DMA_MODE.XFER_WRITE) {
|
||||
if (this.dbg && this.dbg.messageEnabled(Debugger.MESSAGE.DMA | (iDMAChannel == ChipSet.DMA_FDC? Debugger.MESSAGE.FDC : (iDMAChannel == ChipSet.DMA_HDC? Debugger.MESSAGE.HDC : Debugger.MESSAGE.LOG))) && channel.xfer != ChipSet.DMA_MODE.XFER_WRITE) {
|
||||
this.dbg.message("advanceDMA(" + iDMAChannel + ") transferring " + channel.cbDebug + " bytes from " + channel.sAddrDebug);
|
||||
this.dbg.doDump("db", channel.sAddrDebug, "l" + Math.floor((channel.cbDebug + 15) / 16));
|
||||
}
|
||||
|
|
@ -2527,7 +2520,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.messageDebugger("advanceDMA(" + iDMAChannel + ") ran out of data, assuming 0xff", Debugger.MESSAGE_DMA);
|
||||
if (DEBUG) obj.messageDebugger("advanceDMA(" + iDMAChannel + ") ran out of data, assuming 0xff", Debugger.MESSAGE.DMA);
|
||||
channel.fWarning = true;
|
||||
}
|
||||
/*
|
||||
|
|
@ -2574,7 +2567,7 @@ ChipSet.prototype.advanceDMA = function(channel, fInit)
|
|||
}
|
||||
}
|
||||
else {
|
||||
if (DEBUG) this.messageDebugger("advanceDMA(" + iDMAChannel + ") unsupported xfer mode: " + str.toHexWord(channel.xfer), Debugger.MESSAGE_DMA);
|
||||
if (DEBUG) this.messageDebugger("advanceDMA(" + iDMAChannel + ") unsupported xfer mode: " + str.toHexWord(channel.xfer), Debugger.MESSAGE.DMA);
|
||||
channel.fError = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -2626,7 +2619,7 @@ ChipSet.prototype.updateDMA = function(channel)
|
|||
channel.component = channel.obj = null;
|
||||
}
|
||||
|
||||
if (DEBUG && DEBUGGER && this.dbg && this.dbg.messageEnabled(Debugger.MESSAGE_DMA | (iDMAChannel == ChipSet.DMA_FDC? Debugger.MESSAGE_FDC : (iDMAChannel == ChipSet.DMA_HDC? Debugger.MESSAGE_HDC : Debugger.MESSAGE_LOG))) && channel.xfer == ChipSet.DMA_MODE.XFER_WRITE && channel.sAddrDebug) {
|
||||
if (DEBUG && DEBUGGER && this.dbg && this.dbg.messageEnabled(Debugger.MESSAGE.DMA | (iDMAChannel == ChipSet.DMA_FDC? Debugger.MESSAGE.FDC : (iDMAChannel == ChipSet.DMA_HDC? Debugger.MESSAGE.HDC : Debugger.MESSAGE.LOG))) && channel.xfer == ChipSet.DMA_MODE.XFER_WRITE && channel.sAddrDebug) {
|
||||
this.dbg.message("updateDMA(" + iDMAChannel + ") transferred " + channel.cbDebug + " bytes to " + channel.sAddrDebug);
|
||||
this.dbg.doDump("db", channel.sAddrDebug, "l" + Math.floor((channel.cbDebug + 15) / 16));
|
||||
}
|
||||
|
|
@ -2668,7 +2661,7 @@ ChipSet.prototype.inPICLo = function(iPIC, addrFrom)
|
|||
break;
|
||||
}
|
||||
}
|
||||
this.messagePort(pic.port, null, addrFrom, "PIC" + iPIC, Debugger.MESSAGE_PIC, b);
|
||||
this.messagePort(pic.port, null, addrFrom, "PIC" + iPIC, Debugger.MESSAGE.PIC, b);
|
||||
return b;
|
||||
};
|
||||
|
||||
|
|
@ -2683,7 +2676,7 @@ ChipSet.prototype.inPICLo = function(iPIC, addrFrom)
|
|||
ChipSet.prototype.outPICLo = function(iPIC, bOut, addrFrom)
|
||||
{
|
||||
var pic = this.aPICs[iPIC];
|
||||
this.messagePort(pic.port, bOut, addrFrom, "PIC" + iPIC, Debugger.MESSAGE_PIC);
|
||||
this.messagePort(pic.port, bOut, addrFrom, "PIC" + iPIC, Debugger.MESSAGE.PIC);
|
||||
if (bOut & ChipSet.PIC_LO.ICW1) {
|
||||
/*
|
||||
* This must be an ICW1...
|
||||
|
|
@ -2765,11 +2758,11 @@ ChipSet.prototype.outPICLo = function(iPIC, bOut, addrFrom)
|
|||
}
|
||||
var nIRQ = (nIRL == null? undefined : pic.nIRQBase + nIRL);
|
||||
if (pic.bISR & bIREnd) {
|
||||
if (DEBUG) this.messageDebugger("outPIC" + iPIC + "(" + str.toHexByte(pic.port) + "): IRQ " + nIRQ + " going out of service", Debugger.MESSAGE_PIC, nIRQ);
|
||||
if (DEBUG) this.messageDebugger("outPIC" + iPIC + "(" + str.toHexByte(pic.port) + "): IRQ " + nIRQ + " going out of service", Debugger.MESSAGE.PIC, nIRQ);
|
||||
pic.bISR &= ~bIREnd;
|
||||
this.checkIRR(iPIC);
|
||||
} else {
|
||||
if (DEBUG) this.messageDebugger("outPIC" + iPIC + "(" + str.toHexByte(pic.port) + "): unexpected EOI command, IRQ " + nIRQ + " not in service", Debugger.MESSAGE_PIC);
|
||||
if (DEBUG) this.messageDebugger("outPIC" + iPIC + "(" + str.toHexByte(pic.port) + "): unexpected EOI command, IRQ " + nIRQ + " not in service", Debugger.MESSAGE.PIC);
|
||||
}
|
||||
/*
|
||||
* TODO: Support EOI commands with automatic rotation (eg, ChipSet.PIC_LO.OCW2_EOI_ROT and ChipSet.PIC_LO.OCW2_EOI_ROTSPEC)
|
||||
|
|
@ -2785,7 +2778,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.messageDebugger("outPIC" + iPIC + "(" + str.toHexByte(pic.port) + "): unsupported OCW2 command: " + str.toHexByte(bOut), Debugger.MESSAGE_PIC);
|
||||
if (DEBUG) this.messageDebugger("outPIC" + iPIC + "(" + str.toHexByte(pic.port) + "): unsupported OCW2 command: " + str.toHexByte(bOut), Debugger.MESSAGE.PIC);
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
|
|
@ -2795,7 +2788,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.messageDebugger("outPIC" + iPIC + "(" + str.toHexByte(pic.port) + "): unsupported OCW3 command: " + str.toHexByte(bOut), Debugger.MESSAGE_PIC);
|
||||
if (DEBUG) this.messageDebugger("outPIC" + iPIC + "(" + str.toHexByte(pic.port) + "): unsupported OCW3 command: " + str.toHexByte(bOut), Debugger.MESSAGE.PIC);
|
||||
}
|
||||
pic.bOCW3 = bOut;
|
||||
}
|
||||
|
|
@ -2813,7 +2806,7 @@ ChipSet.prototype.inPICHi = function(iPIC, addrFrom)
|
|||
{
|
||||
var pic = this.aPICs[iPIC];
|
||||
var b = pic.bIMR;
|
||||
this.messagePort(pic.port+1, null, addrFrom, "PIC" + iPIC, Debugger.MESSAGE_PIC, b);
|
||||
this.messagePort(pic.port+1, null, addrFrom, "PIC" + iPIC, Debugger.MESSAGE.PIC, b);
|
||||
return b;
|
||||
};
|
||||
|
||||
|
|
@ -2828,7 +2821,7 @@ ChipSet.prototype.inPICHi = function(iPIC, addrFrom)
|
|||
ChipSet.prototype.outPICHi = function(iPIC, bOut, addrFrom)
|
||||
{
|
||||
var pic = this.aPICs[iPIC];
|
||||
this.messagePort(pic.port+1, bOut, addrFrom, "PIC" + iPIC, Debugger.MESSAGE_PIC);
|
||||
this.messagePort(pic.port+1, bOut, addrFrom, "PIC" + iPIC, Debugger.MESSAGE.PIC);
|
||||
if (pic.nICW < pic.aICW.length) {
|
||||
pic.aICW[pic.nICW++] = bOut;
|
||||
if (pic.nICW == 2 && (pic.aICW[0] & ChipSet.PIC_LO.ICW1_SNGL))
|
||||
|
|
@ -2886,7 +2879,7 @@ ChipSet.prototype.setIRR = function(nIRQ, nDelay)
|
|||
var nIRL = nIRQ & 0x7;
|
||||
var pic = this.aPICs[iPIC];
|
||||
pic.bIRR |= 1 << nIRL;
|
||||
if (DEBUG) this.messageDebugger("setIRR(" + nIRQ + ")", Debugger.MESSAGE_PIC, nIRQ);
|
||||
if (DEBUG) this.messageDebugger("setIRR(" + nIRQ + ")", Debugger.MESSAGE.PIC, nIRQ);
|
||||
pic.nDelay = nDelay || 0;
|
||||
/*
|
||||
* When any slave IRR goes high, I'm assuming that the master's slave IRR line should go high as well
|
||||
|
|
@ -2909,7 +2902,7 @@ ChipSet.prototype.clearIRR = function(nIRQ)
|
|||
var bIRR = (1 << nIRL);
|
||||
if (pic.bIRR & bIRR) {
|
||||
pic.bIRR &= ~bIRR;
|
||||
if (DEBUG) this.messageDebugger("clearIRR(" + nIRQ + ")", Debugger.MESSAGE_PIC, nIRQ);
|
||||
if (DEBUG) this.messageDebugger("clearIRR(" + nIRQ + ")", Debugger.MESSAGE.PIC, nIRQ);
|
||||
/*
|
||||
* When all slave IRRs go low, I'm assuming that the master's slave IRR line should go low as well
|
||||
*/
|
||||
|
|
@ -3041,7 +3034,7 @@ ChipSet.prototype.inTimer = function(iTimer, addrFrom)
|
|||
}
|
||||
this.updateTimer(iTimer);
|
||||
b = timer.countCurrent[timer.countIndex++];
|
||||
this.messagePort(ChipSet.TIMER0.PORT + iTimer, null, addrFrom, "TIMER" + iTimer, Debugger.MESSAGE_TIMER, b);
|
||||
this.messagePort(ChipSet.TIMER0.PORT + iTimer, null, addrFrom, "TIMER" + iTimer, Debugger.MESSAGE.TIMER, b);
|
||||
return b;
|
||||
};
|
||||
|
||||
|
|
@ -3055,7 +3048,7 @@ ChipSet.prototype.inTimer = function(iTimer, addrFrom)
|
|||
*/
|
||||
ChipSet.prototype.outTimer = function(iTimer, bOut, addrFrom)
|
||||
{
|
||||
this.messagePort(ChipSet.TIMER0.PORT + iTimer, bOut, addrFrom, "TIMER" + iTimer, Debugger.MESSAGE_TIMER);
|
||||
this.messagePort(ChipSet.TIMER0.PORT + iTimer, bOut, addrFrom, "TIMER" + iTimer, Debugger.MESSAGE.TIMER);
|
||||
|
||||
var timer = this.aTimers[iTimer];
|
||||
if (timer.countIndex == timer.countBytes) this.resetTimerIndex(iTimer);
|
||||
|
|
@ -3138,8 +3131,8 @@ ChipSet.prototype.outTimer = function(iTimer, bOut, addrFrom)
|
|||
*/
|
||||
ChipSet.prototype.inTimerCtrl = function(port, addrFrom)
|
||||
{
|
||||
this.messagePort(port, null, addrFrom, "TIMER_CTRL", 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", Debugger.MESSAGE.TIMER);
|
||||
if (DEBUG) this.messageDebugger("TIMER_CTRL: Read-Back command not supported (yet)", Debugger.MESSAGE.TIMER);
|
||||
return null;
|
||||
};
|
||||
|
||||
|
|
@ -3153,14 +3146,14 @@ ChipSet.prototype.inTimerCtrl = function(port, addrFrom)
|
|||
*/
|
||||
ChipSet.prototype.outTimerCtrl = function(port, bOut, addrFrom)
|
||||
{
|
||||
this.messagePort(port, bOut, addrFrom, "TIMER_CTRL", Debugger.MESSAGE_TIMER);
|
||||
this.messagePort(port, bOut, addrFrom, "TIMER_CTRL", Debugger.MESSAGE.TIMER);
|
||||
this.bTimerCtrl = bOut;
|
||||
/*
|
||||
* 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)", Debugger.MESSAGE.TIMER);
|
||||
return;
|
||||
}
|
||||
/*
|
||||
|
|
@ -3211,7 +3204,7 @@ ChipSet.prototype.outTimerCtrl = function(port, bOut, addrFrom)
|
|||
timer.countStart[0] = timer.countInit[0];
|
||||
timer.countStart[1] = timer.countInit[1];
|
||||
timer.nStartCycles = this.cpu.getCycles(this.fScaleTimers);
|
||||
if (DEBUG) this.messageDebugger("TIMER0 count reset @" + timer.nStartCycles + " cycles", Debugger.MESSAGE_TIMER);
|
||||
if (DEBUG) this.messageDebugger("TIMER0 count reset @" + timer.nStartCycles + " cycles", Debugger.MESSAGE.TIMER);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3397,7 +3390,7 @@ ChipSet.prototype.updateTimer = function(iTimer, fCycleReset)
|
|||
var ticks = ((nCycles - timer.nStartCycles) / this.nTicksDivisor) | 0;
|
||||
|
||||
if (ticks < 0) {
|
||||
if (DEBUG) this.messageDebugger("updateTimer(" + iTimer + "): negative tick count (" + ticks + ")", Debugger.MESSAGE_TIMER);
|
||||
if (DEBUG) this.messageDebugger("updateTimer(" + iTimer + "): negative tick count (" + ticks + ")", Debugger.MESSAGE.TIMER);
|
||||
timer.nStartCycles = nCycles;
|
||||
ticks = 0;
|
||||
}
|
||||
|
|
@ -3415,7 +3408,7 @@ ChipSet.prototype.updateTimer = function(iTimer, fCycleReset)
|
|||
*/
|
||||
if (timer.mode == ChipSet.TIMER_CTRL.MODE0) {
|
||||
if (count <= 0) count = 0;
|
||||
if (DEBUG) this.messageDebugger("updateTimer(" + iTimer + "): MODE0 timer count=" + count, Debugger.MESSAGE_TIMER);
|
||||
if (DEBUG) this.messageDebugger("updateTimer(" + iTimer + "): MODE0 timer count=" + count, Debugger.MESSAGE.TIMER);
|
||||
if (!count) {
|
||||
timer.fOUT = true;
|
||||
timer.fCounting = false;
|
||||
|
|
@ -3448,7 +3441,7 @@ ChipSet.prototype.updateTimer = function(iTimer, fCycleReset)
|
|||
if (count <= 0) {
|
||||
count = countInit + count;
|
||||
if (count <= 0) {
|
||||
// this.messageDebugger("updateTimer(" + iTimer + "): underflow=" + count, Debugger.MESSAGE_TIMER);
|
||||
// this.messageDebugger("updateTimer(" + iTimer + "): underflow=" + count, Debugger.MESSAGE.TIMER);
|
||||
count = countInit;
|
||||
}
|
||||
timer.countStart[0] = count & 0xff;
|
||||
|
|
@ -3478,7 +3471,7 @@ ChipSet.prototype.updateTimer = function(iTimer, fCycleReset)
|
|||
timer.fOUT = !timer.fOUT;
|
||||
count = countInit + count;
|
||||
if (count <= 0) {
|
||||
// this.messageDebugger("updateTimer(" + iTimer + "): underflow=" + count, Debugger.MESSAGE_TIMER);
|
||||
// this.messageDebugger("updateTimer(" + iTimer + "): underflow=" + count, Debugger.MESSAGE.TIMER);
|
||||
count = countInit;
|
||||
}
|
||||
if (MAXDEBUG && DEBUGGER && !iTimer) {
|
||||
|
|
@ -3498,7 +3491,7 @@ ChipSet.prototype.updateTimer = function(iTimer, fCycleReset)
|
|||
}
|
||||
}
|
||||
|
||||
if (DEBUG && DEBUGGER && this.dbg && this.dbg.messageEnabled(Debugger.MESSAGE_TIMER)) {
|
||||
if (DEBUG && DEBUGGER && this.dbg && this.dbg.messageEnabled(Debugger.MESSAGE.TIMER)) {
|
||||
this.log("TIMER" + iTimer + " count: " + count + ", ticks: " + ticks + ", fired: " + (fFired? "true" : "false"));
|
||||
}
|
||||
|
||||
|
|
@ -3542,7 +3535,7 @@ ChipSet.prototype.inPPIA = function(port, addrFrom)
|
|||
b = this.kbd.readScanCode();
|
||||
}
|
||||
}
|
||||
this.messagePort(port, null, addrFrom, "PPI_A", Debugger.MESSAGE_CHIPSET, b);
|
||||
this.messagePort(port, null, addrFrom, "PPI_A", Debugger.MESSAGE.CHIPSET, b);
|
||||
return b;
|
||||
};
|
||||
|
||||
|
|
@ -3556,7 +3549,7 @@ ChipSet.prototype.inPPIA = function(port, addrFrom)
|
|||
*/
|
||||
ChipSet.prototype.outPPIA = function(port, bOut, addrFrom)
|
||||
{
|
||||
this.messagePort(port, bOut, addrFrom, "PPI_A", Debugger.MESSAGE_CHIPSET);
|
||||
this.messagePort(port, bOut, addrFrom, "PPI_A", Debugger.MESSAGE.CHIPSET);
|
||||
this.bPPIA = bOut;
|
||||
};
|
||||
|
||||
|
|
@ -3571,7 +3564,7 @@ ChipSet.prototype.outPPIA = function(port, bOut, addrFrom)
|
|||
ChipSet.prototype.inPPIB = function(port, addrFrom)
|
||||
{
|
||||
var b = this.bPPIB;
|
||||
this.messagePort(port, null, addrFrom, "PPI_B", Debugger.MESSAGE_CHIPSET, b);
|
||||
this.messagePort(port, null, addrFrom, "PPI_B", Debugger.MESSAGE.CHIPSET, b);
|
||||
return b;
|
||||
};
|
||||
|
||||
|
|
@ -3585,7 +3578,7 @@ ChipSet.prototype.inPPIB = function(port, addrFrom)
|
|||
*/
|
||||
ChipSet.prototype.outPPIB = function(port, bOut, addrFrom)
|
||||
{
|
||||
this.messagePort(port, bOut, addrFrom, "PPI_B", Debugger.MESSAGE_CHIPSET);
|
||||
this.messagePort(port, bOut, addrFrom, "PPI_B", Debugger.MESSAGE.CHIPSET);
|
||||
this.updatePPIB(bOut);
|
||||
if (this.kbd) this.kbd.setEnable((bOut & ChipSet.PPI_B.CLEAR_KBD)? false : true, (bOut & ChipSet.PPI_B.CLK_KBD)? true : false);
|
||||
};
|
||||
|
|
@ -3662,7 +3655,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", Debugger.MESSAGE_CHIPSET | Debugger.MESSAGE_MEM, b);
|
||||
this.messagePort(port, null, addrFrom, "PPI_C", Debugger.MESSAGE.CHIPSET | Debugger.MESSAGE.MEM, b);
|
||||
return b;
|
||||
};
|
||||
|
||||
|
|
@ -3676,7 +3669,7 @@ ChipSet.prototype.inPPIC = function(port, addrFrom)
|
|||
*/
|
||||
ChipSet.prototype.outPPIC = function(port, bOut, addrFrom)
|
||||
{
|
||||
this.messagePort(port, bOut, addrFrom, "PPI_C", Debugger.MESSAGE_CHIPSET);
|
||||
this.messagePort(port, bOut, addrFrom, "PPI_C", Debugger.MESSAGE.CHIPSET);
|
||||
this.bPPIC = bOut;
|
||||
};
|
||||
|
||||
|
|
@ -3691,7 +3684,7 @@ ChipSet.prototype.outPPIC = function(port, bOut, addrFrom)
|
|||
ChipSet.prototype.inPPICtrl = function(port, addrFrom)
|
||||
{
|
||||
var b = this.bPPICtrl;
|
||||
this.messagePort(port, null, addrFrom, "PPI_CTRL", Debugger.MESSAGE_CHIPSET, b);
|
||||
this.messagePort(port, null, addrFrom, "PPI_CTRL", Debugger.MESSAGE.CHIPSET, b);
|
||||
return b;
|
||||
};
|
||||
|
||||
|
|
@ -3705,7 +3698,7 @@ ChipSet.prototype.inPPICtrl = function(port, addrFrom)
|
|||
*/
|
||||
ChipSet.prototype.outPPICtrl = function(port, bOut, addrFrom)
|
||||
{
|
||||
this.messagePort(port, bOut, addrFrom, "PPI_CTRL", Debugger.MESSAGE_CHIPSET);
|
||||
this.messagePort(port, bOut, addrFrom, "PPI_CTRL", Debugger.MESSAGE.CHIPSET);
|
||||
this.bPPICtrl = bOut;
|
||||
};
|
||||
|
||||
|
|
@ -3720,7 +3713,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", Debugger.MESSAGE_8042, b);
|
||||
this.messagePort(port, null, addrFrom, "8042_OUTBUFF", Debugger.MESSAGE.C8042, b);
|
||||
this.b8042Status &= ~(ChipSet.KBC.STATUS.OUTBUFF_FULL | ChipSet.KBC.STATUS.OUTBUFF_DELAY);
|
||||
var bNext = this.kbd && this.kbd.readScanCode(true);
|
||||
if (bNext) this.set8042OutBuff(bNext);
|
||||
|
|
@ -3741,7 +3734,7 @@ ChipSet.prototype.in8042OutBuff = function(port, addrFrom)
|
|||
*/
|
||||
ChipSet.prototype.out8042InBuffData = function(port, bOut, addrFrom)
|
||||
{
|
||||
this.messagePort(port, bOut, addrFrom, "8042_INBUF.DATA", Debugger.MESSAGE_8042);
|
||||
this.messagePort(port, bOut, addrFrom, "8042_INBUF.DATA", Debugger.MESSAGE.C8042);
|
||||
|
||||
if (this.b8042Status & ChipSet.KBC.STATUS.CMD_FLAG) {
|
||||
switch (this.b8042InBuff) {
|
||||
|
|
@ -3867,7 +3860,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", Debugger.MESSAGE_8042 | Debugger.MESSAGE_LOG, b);
|
||||
this.messagePort(port, null, addrFrom, "8042_RWREG", Debugger.MESSAGE.C8042 | Debugger.MESSAGE.LOG, b);
|
||||
return b;
|
||||
};
|
||||
|
||||
|
|
@ -3881,7 +3874,7 @@ ChipSet.prototype.in8042RWReg = function(port, addrFrom)
|
|||
*/
|
||||
ChipSet.prototype.out8042RWReg = function(port, bOut, addrFrom)
|
||||
{
|
||||
this.messagePort(port, bOut, addrFrom, "8042_RWREG", Debugger.MESSAGE_8042);
|
||||
this.messagePort(port, bOut, addrFrom, "8042_RWREG", Debugger.MESSAGE.C8042);
|
||||
this.updatePPIB(bOut);
|
||||
};
|
||||
|
||||
|
|
@ -3895,7 +3888,7 @@ ChipSet.prototype.out8042RWReg = function(port, bOut, addrFrom)
|
|||
*/
|
||||
ChipSet.prototype.in8042Status = function(port, addrFrom)
|
||||
{
|
||||
this.messagePort(port, null, addrFrom, "8042_STATUS", Debugger.MESSAGE_8042, this.b8042Status);
|
||||
this.messagePort(port, null, addrFrom, "8042_STATUS", Debugger.MESSAGE.C8042, this.b8042Status);
|
||||
var b = this.b8042Status & 0xff;
|
||||
/*
|
||||
* There's code in the 5170 BIOS (F000:03BF) that writes an 8042 command (0xAA), waits for
|
||||
|
|
@ -3933,7 +3926,7 @@ ChipSet.prototype.in8042Status = function(port, addrFrom)
|
|||
*/
|
||||
ChipSet.prototype.out8042InBuffCmd = function(port, bOut, addrFrom)
|
||||
{
|
||||
this.messagePort(port, bOut, addrFrom, "8042_INBUFF.CMD", Debugger.MESSAGE_8042);
|
||||
this.messagePort(port, bOut, addrFrom, "8042_INBUFF.CMD", Debugger.MESSAGE.C8042);
|
||||
Component.assert(!(this.b8042Status & ChipSet.KBC.STATUS.INBUFF_FULL));
|
||||
this.b8042InBuff = bOut;
|
||||
|
||||
|
|
@ -3962,7 +3955,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_KBD | Debugger.MESSAGE_PORT);
|
||||
if (DEBUG) this.messageDebugger("keyboard disabled", Debugger.MESSAGE.KBD | Debugger.MESSAGE.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_SUCC response code? Seems like an odd thing for
|
||||
|
|
@ -3972,13 +3965,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 (DEBUG) this.messageDebugger("keyboard re-enabled", Debugger.MESSAGE_KBD | Debugger.MESSAGE_PORT);
|
||||
if (DEBUG) this.messageDebugger("keyboard re-enabled", Debugger.MESSAGE.KBD | Debugger.MESSAGE.PORT);
|
||||
break;
|
||||
|
||||
case ChipSet.KBC.CMD.SELF_TEST: // 0xAA
|
||||
if (this.kbd) this.kbd.shiftScanCode(true);
|
||||
this.set8042CmdData(this.b8042CmdData | ChipSet.KBC.DATA.CMD.NO_CLOCK);
|
||||
if (DEBUG) this.messageDebugger("keyboard disabled on reset", Debugger.MESSAGE_KBD | Debugger.MESSAGE_PORT);
|
||||
if (DEBUG) this.messageDebugger("keyboard disabled on reset", Debugger.MESSAGE.KBD | Debugger.MESSAGE.PORT);
|
||||
this.set8042OutBuff(ChipSet.KBC.DATA.SELF_TEST.OK);
|
||||
this.set8042OutPort(ChipSet.KBC.OUTPORT.NO_RESET | ChipSet.KBC.OUTPORT.A20_ON);
|
||||
break;
|
||||
|
|
@ -4191,7 +4184,7 @@ ChipSet.prototype.notifyKbdData = function(fAvail)
|
|||
*/
|
||||
ChipSet.prototype.inCMOSAddr = function(port, addrFrom)
|
||||
{
|
||||
this.messagePort(port, null, addrFrom, "CMOS_ADDR", Debugger.MESSAGE_CMOS, this.bCMOSAddr);
|
||||
this.messagePort(port, null, addrFrom, "CMOS_ADDR", Debugger.MESSAGE.CMOS, this.bCMOSAddr);
|
||||
return this.bCMOSAddr;
|
||||
};
|
||||
|
||||
|
|
@ -4205,7 +4198,7 @@ ChipSet.prototype.inCMOSAddr = function(port, addrFrom)
|
|||
*/
|
||||
ChipSet.prototype.outCMOSAddr = function(port, bOut, addrFrom)
|
||||
{
|
||||
this.messagePort(port, bOut, addrFrom, "CMOS_ADDR", Debugger.MESSAGE_CMOS);
|
||||
this.messagePort(port, bOut, addrFrom, "CMOS_ADDR", Debugger.MESSAGE.CMOS);
|
||||
this.bCMOSAddr = bOut;
|
||||
this.bNMI = (bOut & ChipSet.CMOS.ADDR.NMI_DISABLE)? ChipSet.NMI.DISABLE : ChipSet.NMI.ENABLE;
|
||||
};
|
||||
|
|
@ -4222,7 +4215,7 @@ ChipSet.prototype.inCMOSData = function(port, addrFrom)
|
|||
{
|
||||
var bAddr = this.bCMOSAddr & ChipSet.CMOS.ADDR.MASK;
|
||||
var bIn = (bAddr <= ChipSet.CMOS.ADDR.RTC_STATUSD? this.getRTCByte(bAddr) : this.abCMOSData[bAddr]);
|
||||
this.messagePort(port, null, addrFrom, "CMOS_DATA[" + str.toHexByte(bAddr) + "]", Debugger.MESSAGE_CMOS, bIn);
|
||||
this.messagePort(port, null, addrFrom, "CMOS_DATA[" + str.toHexByte(bAddr) + "]", Debugger.MESSAGE.CMOS, bIn);
|
||||
return bIn;
|
||||
};
|
||||
|
||||
|
|
@ -4237,7 +4230,7 @@ ChipSet.prototype.inCMOSData = function(port, addrFrom)
|
|||
ChipSet.prototype.outCMOSData = function(port, bOut, addrFrom)
|
||||
{
|
||||
var bAddr = this.bCMOSAddr & ChipSet.CMOS.ADDR.MASK;
|
||||
this.messagePort(port, bOut, addrFrom, "CMOS_DATA[" + str.toHexByte(bAddr) + "]", Debugger.MESSAGE_CMOS);
|
||||
this.messagePort(port, bOut, addrFrom, "CMOS_DATA[" + str.toHexByte(bAddr) + "]", Debugger.MESSAGE.CMOS);
|
||||
this.abCMOSData[bAddr] = (bAddr <= ChipSet.CMOS.ADDR.RTC_STATUSD? this.setRTCByte(bAddr, bOut) : bOut);
|
||||
};
|
||||
|
||||
|
|
@ -4251,7 +4244,7 @@ ChipSet.prototype.outCMOSData = function(port, bOut, addrFrom)
|
|||
*/
|
||||
ChipSet.prototype.inMFGData = function(port, addrFrom)
|
||||
{
|
||||
this.messagePort(port, null, addrFrom, "MFG_DATA", Debugger.MESSAGE_CHIPSET, this.bMFGData);
|
||||
this.messagePort(port, null, addrFrom, "MFG_DATA", Debugger.MESSAGE.CHIPSET, this.bMFGData);
|
||||
return this.bMFGData;
|
||||
};
|
||||
|
||||
|
|
@ -4265,7 +4258,7 @@ ChipSet.prototype.inMFGData = function(port, addrFrom)
|
|||
*/
|
||||
ChipSet.prototype.outMFGData = function(port, bOut, addrFrom)
|
||||
{
|
||||
this.messagePort(port, bOut, addrFrom, "MFG_DATA", Debugger.MESSAGE_CHIPSET);
|
||||
this.messagePort(port, bOut, addrFrom, "MFG_DATA", Debugger.MESSAGE.CHIPSET);
|
||||
this.bMFGData = bOut;
|
||||
};
|
||||
|
||||
|
|
@ -4281,7 +4274,7 @@ ChipSet.prototype.outMFGData = function(port, bOut, addrFrom)
|
|||
*/
|
||||
ChipSet.prototype.outNMI = function(port, bOut, addrFrom)
|
||||
{
|
||||
this.messagePort(port, bOut, addrFrom, "NMI", Debugger.MESSAGE_CHIPSET);
|
||||
this.messagePort(port, bOut, addrFrom, "NMI", Debugger.MESSAGE.CHIPSET);
|
||||
this.bNMI = bOut;
|
||||
};
|
||||
|
||||
|
|
@ -4309,8 +4302,8 @@ ChipSet.prototype.intBIOSRTC = function(addr)
|
|||
{
|
||||
if (DEBUGGER) {
|
||||
var AH = this.cpu.regAX >> 8;
|
||||
if (this.dbg && this.dbg.messageEnabled(Debugger.MESSAGE_RTC)) {
|
||||
this.dbg.messageInt(ChipSet.BIOS.INT_RTC, addr);
|
||||
if (this.dbg && this.dbg.messageEnabled(Debugger.MESSAGE.RTC)) {
|
||||
this.dbg.messageInt(Debugger.INT.RTC, addr);
|
||||
this.cpu.addIntReturn(addr, function(chipset, nCycles) {
|
||||
return function onBIOSRTCReturn(nLevel) {
|
||||
nCycles = chipset.cpu.getCycles() - nCycles;
|
||||
|
|
@ -4324,7 +4317,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(ChipSet.BIOS.INT_RTC, nLevel, nCycles, sResult);
|
||||
chipset.dbg.messageIntReturn(Debugger.INT.RTC, nLevel, nCycles, sResult);
|
||||
};
|
||||
}(this, this.cpu.getCycles()));
|
||||
}
|
||||
|
|
@ -4375,13 +4368,13 @@ ChipSet.prototype.setSpeaker = function(fOn)
|
|||
if (fOn) {
|
||||
if (this.sourceAudio) {
|
||||
this.sourceAudio['frequency']['value'] = freq;
|
||||
this.messageDebugger("speaker set to " + freq + "hz", Debugger.MESSAGE_SPEAKER);
|
||||
this.messageDebugger("speaker set to " + freq + "hz", Debugger.MESSAGE.SPEAKER);
|
||||
} 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;
|
||||
this.messageDebugger("speaker on at " + freq + "hz", Debugger.MESSAGE_SPEAKER);
|
||||
this.messageDebugger("speaker on at " + freq + "hz", Debugger.MESSAGE.SPEAKER);
|
||||
this.sourceAudio['noteOn'](0); // aka start()
|
||||
}
|
||||
} else {
|
||||
|
|
@ -4389,11 +4382,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?
|
||||
this.messageDebugger("speaker off at " + freq + "hz", Debugger.MESSAGE_SPEAKER);
|
||||
this.messageDebugger("speaker off at " + freq + "hz", Debugger.MESSAGE.SPEAKER);
|
||||
}
|
||||
}
|
||||
} else if (fOn) {
|
||||
this.messageDebugger("BEEP", Debugger.MESSAGE_SPEAKER);
|
||||
this.messageDebugger("BEEP", Debugger.MESSAGE.SPEAKER);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -4413,9 +4406,9 @@ ChipSet.prototype.setSpeaker = function(fOn)
|
|||
ChipSet.prototype.messageDebugger = function(sMessage, bitsMessage, nIRQ)
|
||||
{
|
||||
if (DEBUGGER && this.dbg) {
|
||||
if (bitsMessage == null) bitsMessage = Debugger.MESSAGE_CHIPSET;
|
||||
if (bitsMessage == null) bitsMessage = Debugger.MESSAGE.CHIPSET;
|
||||
if (nIRQ !== undefined) {
|
||||
bitsMessage |= (nIRQ == ChipSet.IRQ.TIMER0? Debugger.MESSAGE_TIMER : (nIRQ == ChipSet.IRQ.KBD? Debugger.MESSAGE_KBD : (nIRQ == ChipSet.IRQ.FDC? Debugger.MESSAGE_FDC : Debugger.MESSAGE_PIC)));
|
||||
bitsMessage |= (nIRQ == ChipSet.IRQ.TIMER0? Debugger.MESSAGE.TIMER : (nIRQ == ChipSet.IRQ.KBD? Debugger.MESSAGE.KBD : (nIRQ == ChipSet.IRQ.FDC? Debugger.MESSAGE.FDC : Debugger.MESSAGE.PIC)));
|
||||
}
|
||||
if (this.dbg.messageEnabled(bitsMessage)) this.dbg.message(sMessage);
|
||||
}
|
||||
|
|
@ -4440,7 +4433,7 @@ ChipSet.prototype.messageDebugger = function(sMessage, bitsMessage, nIRQ)
|
|||
ChipSet.prototype.messagePort = function(port, bOut, addrFrom, name, bitsMessage, bIn)
|
||||
{
|
||||
if (DEBUGGER && this.dbg) {
|
||||
if (bitsMessage == null) bitsMessage = Debugger.MESSAGE_CHIPSET;
|
||||
if (bitsMessage == null) bitsMessage = Debugger.MESSAGE.CHIPSET;
|
||||
this.dbg.messagePort(this, port, bOut, addrFrom, name, bitsMessage, bIn);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1186,7 +1186,7 @@ Computer.prototype.getComponentByType = function(sType, componentPrev)
|
|||
Computer.prototype.messageDebugger = function(sMessage, fForce)
|
||||
{
|
||||
if (DEBUGGER && this.dbg) {
|
||||
if (fForce || this.dbg.messageEnabled(Debugger.MESSAGE_COMPUTER)) this.dbg.message(sMessage);
|
||||
if (fForce || this.dbg.messageEnabled(Debugger.MESSAGE.COMPUTER)) this.dbg.message(sMessage);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -915,7 +915,7 @@ CPU.prototype.calcRemainingTime = function()
|
|||
*/
|
||||
this.aCounts.nCyclesRecalc += this.aCounts.nCyclesThisRun;
|
||||
|
||||
if (DEBUG && this.dbg && this.dbg.messageEnabled(Debugger.MESSAGE_LOG) && msRemainsThisRun) {
|
||||
if (DEBUG && this.dbg && this.dbg.messageEnabled(Debugger.MESSAGE.LOG) && msRemainsThisRun) {
|
||||
this.dbg.message("at " + this.aCounts.msEndThisRun + "ms, calcRemainingTime returned " + msRemainsThisRun + "ms to sleep");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -169,36 +169,63 @@ function Debugger(parmsDbg)
|
|||
} // endif DEBUGGER
|
||||
}
|
||||
|
||||
Debugger.MESSAGE_MEM = 0x00000001;
|
||||
Debugger.MESSAGE_PORT = 0x00000002;
|
||||
Debugger.MESSAGE_DMA = 0x00000004;
|
||||
Debugger.MESSAGE_PIC = 0x00000008;
|
||||
Debugger.MESSAGE_TIMER = 0x00000010;
|
||||
Debugger.MESSAGE_CMOS = 0x00000020;
|
||||
Debugger.MESSAGE_RTC = 0x00000040;
|
||||
Debugger.MESSAGE_8042 = 0x00000080;
|
||||
Debugger.MESSAGE_CHIPSET = 0x00000100;
|
||||
Debugger.MESSAGE_KBD = 0x00000200;
|
||||
Debugger.MESSAGE_KEYS = 0x00000400;
|
||||
Debugger.MESSAGE_VIDEO = 0x00000800;
|
||||
Debugger.MESSAGE_FDC = 0x00001000;
|
||||
Debugger.MESSAGE_HDC = 0x00002000;
|
||||
Debugger.MESSAGE_DISK = 0x00004000;
|
||||
Debugger.MESSAGE_SERIAL = 0x00008000;
|
||||
Debugger.MESSAGE_SPEAKER = 0x00010000;
|
||||
Debugger.MESSAGE_STATE = 0x00020000;
|
||||
Debugger.MESSAGE_MOUSE = 0x00040000;
|
||||
Debugger.MESSAGE_COMPUTER = 0x00080000;
|
||||
Debugger.MESSAGE_CPU = 0x00100000;
|
||||
Debugger.MESSAGE_DOS = 0x00200000;
|
||||
Debugger.MESSAGE_INT = 0x00400000;
|
||||
Debugger.MESSAGE_LOG = 0x01000000;
|
||||
Debugger.MESSAGE_HALT = 0x10000000;
|
||||
/*
|
||||
* Debugger message constants must always be defined, even when DEBUGGER is false, lest the Closure Compiler complain
|
||||
*/
|
||||
Debugger.MESSAGE = {
|
||||
MEM: 0x00000001,
|
||||
PORT: 0x00000002,
|
||||
DMA: 0x00000004,
|
||||
PIC: 0x00000008,
|
||||
TIMER: 0x00000010,
|
||||
CMOS: 0x00000020,
|
||||
RTC: 0x00000040,
|
||||
C8042: 0x00000080,
|
||||
CHIPSET: 0x00000100,
|
||||
KBD: 0x00000200,
|
||||
KEYS: 0x00000400,
|
||||
VIDEO: 0x00000800,
|
||||
FDC: 0x00001000,
|
||||
HDC: 0x00002000,
|
||||
DISK: 0x00004000,
|
||||
SERIAL: 0x00008000,
|
||||
SPEAKER: 0x00010000,
|
||||
STATE: 0x00020000,
|
||||
MOUSE: 0x00040000,
|
||||
COMPUTER: 0x00080000,
|
||||
CPU: 0x00100000,
|
||||
DOS: 0x00200000,
|
||||
INT: 0x00400000,
|
||||
LOG: 0x01000000,
|
||||
HALT: 0x10000000
|
||||
};
|
||||
|
||||
if (DEBUGGER) {
|
||||
|
||||
Component.subclass(Component, Debugger);
|
||||
|
||||
/*
|
||||
* Information regarding interrupts of interest (used by messageInt() and others)
|
||||
*/
|
||||
Debugger.INT = {
|
||||
VIDEO: 0x10,
|
||||
CASSETTE: 0x15,
|
||||
KBD: 0x16,
|
||||
RTC: 0x1a,
|
||||
TIMER_TICK: 0x1c,
|
||||
DOS: 0x21,
|
||||
MOUSE: 0x33
|
||||
};
|
||||
|
||||
Debugger.INT_MESSAGE = {
|
||||
0x10: Debugger.MESSAGE.VIDEO,
|
||||
0x16: Debugger.MESSAGE.KBD,
|
||||
// 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.aCommands = {
|
||||
'?': "help",
|
||||
'a [#]': "assemble",
|
||||
|
|
@ -456,35 +483,35 @@ if (DEBUGGER) {
|
|||
* something to be aware of).
|
||||
*/
|
||||
Debugger.MESSAGES = {
|
||||
"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_8042,
|
||||
"chipset": Debugger.MESSAGE_CHIPSET, // ie, anything else in ChipSet besides DMA, PIC, TIMER, CMOS, RTC and 8042
|
||||
"kbd": Debugger.MESSAGE_KBD,
|
||||
"keys": Debugger.MESSAGE_KEYS,
|
||||
"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,
|
||||
"cpu": Debugger.MESSAGE_CPU,
|
||||
"dos": Debugger.MESSAGE_DOS,
|
||||
"int": Debugger.MESSAGE_INT,
|
||||
"log": Debugger.MESSAGE_LOG,
|
||||
"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
|
||||
"kbd": Debugger.MESSAGE.KBD,
|
||||
"keys": Debugger.MESSAGE.KEYS,
|
||||
"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,
|
||||
"cpu": Debugger.MESSAGE.CPU,
|
||||
"dos": Debugger.MESSAGE.DOS,
|
||||
"int": Debugger.MESSAGE.INT,
|
||||
"log": Debugger.MESSAGE.LOG,
|
||||
/*
|
||||
* 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": Debugger.MESSAGE.HALT
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
@ -678,23 +705,23 @@ if (DEBUGGER) {
|
|||
/* 0x6E */ [Debugger.INS.OUTS, Debugger.TYPE_DX | Debugger.TYPE_IN | Debugger.TYPE_286, Debugger.TYPE_DSSI | Debugger.TYPE_BYTE | Debugger.TYPE_IN],
|
||||
/* 0x6F */ [Debugger.INS.OUTS, Debugger.TYPE_DX | Debugger.TYPE_IN | Debugger.TYPE_286, Debugger.TYPE_DSSI | Debugger.TYPE_VWORD | Debugger.TYPE_IN],
|
||||
|
||||
/* 0x70 */ [Debugger.INS.JO, Debugger.TYPE_IMMREL | Debugger.TYPE_BYTE | Debugger.TYPE_IN],
|
||||
/* 0x71 */ [Debugger.INS.JNO, Debugger.TYPE_IMMREL | Debugger.TYPE_BYTE | Debugger.TYPE_IN],
|
||||
/* 0x72 */ [Debugger.INS.JC, Debugger.TYPE_IMMREL | Debugger.TYPE_BYTE | Debugger.TYPE_IN],
|
||||
/* 0x73 */ [Debugger.INS.JNC, Debugger.TYPE_IMMREL | Debugger.TYPE_BYTE | Debugger.TYPE_IN],
|
||||
/* 0x74 */ [Debugger.INS.JZ, Debugger.TYPE_IMMREL | Debugger.TYPE_BYTE | Debugger.TYPE_IN],
|
||||
/* 0x75 */ [Debugger.INS.JNZ, Debugger.TYPE_IMMREL | Debugger.TYPE_BYTE | Debugger.TYPE_IN],
|
||||
/* 0x76 */ [Debugger.INS.JBE, Debugger.TYPE_IMMREL | Debugger.TYPE_BYTE | Debugger.TYPE_IN],
|
||||
/* 0x77 */ [Debugger.INS.JNBE, Debugger.TYPE_IMMREL | Debugger.TYPE_BYTE | Debugger.TYPE_IN],
|
||||
/* 0x70 */ [Debugger.INS.JO, Debugger.TYPE_IMMREL | Debugger.TYPE_BYTE | Debugger.TYPE_IN],
|
||||
/* 0x71 */ [Debugger.INS.JNO, Debugger.TYPE_IMMREL | Debugger.TYPE_BYTE | Debugger.TYPE_IN],
|
||||
/* 0x72 */ [Debugger.INS.JC, Debugger.TYPE_IMMREL | Debugger.TYPE_BYTE | Debugger.TYPE_IN],
|
||||
/* 0x73 */ [Debugger.INS.JNC, Debugger.TYPE_IMMREL | Debugger.TYPE_BYTE | Debugger.TYPE_IN],
|
||||
/* 0x74 */ [Debugger.INS.JZ, Debugger.TYPE_IMMREL | Debugger.TYPE_BYTE | Debugger.TYPE_IN],
|
||||
/* 0x75 */ [Debugger.INS.JNZ, Debugger.TYPE_IMMREL | Debugger.TYPE_BYTE | Debugger.TYPE_IN],
|
||||
/* 0x76 */ [Debugger.INS.JBE, Debugger.TYPE_IMMREL | Debugger.TYPE_BYTE | Debugger.TYPE_IN],
|
||||
/* 0x77 */ [Debugger.INS.JNBE, Debugger.TYPE_IMMREL | Debugger.TYPE_BYTE | Debugger.TYPE_IN],
|
||||
|
||||
/* 0x78 */ [Debugger.INS.JS, Debugger.TYPE_IMMREL | Debugger.TYPE_BYTE | Debugger.TYPE_IN],
|
||||
/* 0x79 */ [Debugger.INS.JNS, Debugger.TYPE_IMMREL | Debugger.TYPE_BYTE | Debugger.TYPE_IN],
|
||||
/* 0x7A */ [Debugger.INS.JP, Debugger.TYPE_IMMREL | Debugger.TYPE_BYTE | Debugger.TYPE_IN],
|
||||
/* 0x7B */ [Debugger.INS.JNP, Debugger.TYPE_IMMREL | Debugger.TYPE_BYTE | Debugger.TYPE_IN],
|
||||
/* 0x7C */ [Debugger.INS.JL, Debugger.TYPE_IMMREL | Debugger.TYPE_BYTE | Debugger.TYPE_IN],
|
||||
/* 0x7D */ [Debugger.INS.JGE, Debugger.TYPE_IMMREL | Debugger.TYPE_BYTE | Debugger.TYPE_IN],
|
||||
/* 0x7E */ [Debugger.INS.JLE, Debugger.TYPE_IMMREL | Debugger.TYPE_BYTE | Debugger.TYPE_IN],
|
||||
/* 0x7F */ [Debugger.INS.JG, Debugger.TYPE_IMMREL | Debugger.TYPE_BYTE | Debugger.TYPE_IN],
|
||||
/* 0x78 */ [Debugger.INS.JS, Debugger.TYPE_IMMREL | Debugger.TYPE_BYTE | Debugger.TYPE_IN],
|
||||
/* 0x79 */ [Debugger.INS.JNS, Debugger.TYPE_IMMREL | Debugger.TYPE_BYTE | Debugger.TYPE_IN],
|
||||
/* 0x7A */ [Debugger.INS.JP, Debugger.TYPE_IMMREL | Debugger.TYPE_BYTE | Debugger.TYPE_IN],
|
||||
/* 0x7B */ [Debugger.INS.JNP, Debugger.TYPE_IMMREL | Debugger.TYPE_BYTE | Debugger.TYPE_IN],
|
||||
/* 0x7C */ [Debugger.INS.JL, Debugger.TYPE_IMMREL | Debugger.TYPE_BYTE | Debugger.TYPE_IN],
|
||||
/* 0x7D */ [Debugger.INS.JGE, Debugger.TYPE_IMMREL | Debugger.TYPE_BYTE | Debugger.TYPE_IN],
|
||||
/* 0x7E */ [Debugger.INS.JLE, Debugger.TYPE_IMMREL | Debugger.TYPE_BYTE | Debugger.TYPE_IN],
|
||||
/* 0x7F */ [Debugger.INS.JG, Debugger.TYPE_IMMREL | Debugger.TYPE_BYTE | Debugger.TYPE_IN],
|
||||
|
||||
/* 0x80 */ [Debugger.INS.GRP1B, Debugger.TYPE_MODRM | Debugger.TYPE_BYTE | Debugger.TYPE_BOTH, Debugger.TYPE_IMM | Debugger.TYPE_BYTE | Debugger.TYPE_IN],
|
||||
/* 0x81 */ [Debugger.INS.GRP1W, Debugger.TYPE_MODRM | Debugger.TYPE_VWORD | Debugger.TYPE_BOTH, Debugger.TYPE_IMM | Debugger.TYPE_VWORD | Debugger.TYPE_IN],
|
||||
|
|
@ -804,14 +831,14 @@ if (DEBUGGER) {
|
|||
/* 0xDE */ [Debugger.INS.ESC, Debugger.TYPE_MODRM | Debugger.TYPE_VWORD | Debugger.TYPE_IN],
|
||||
/* 0xDF */ [Debugger.INS.ESC, Debugger.TYPE_MODRM | Debugger.TYPE_VWORD | Debugger.TYPE_IN],
|
||||
|
||||
/* 0xE0 */ [Debugger.INS.LOOPNZ,Debugger.TYPE_IMMREL | Debugger.TYPE_BYTE | Debugger.TYPE_IN],
|
||||
/* 0xE1 */ [Debugger.INS.LOOPZ, Debugger.TYPE_IMMREL | Debugger.TYPE_BYTE | Debugger.TYPE_IN],
|
||||
/* 0xE2 */ [Debugger.INS.LOOP, Debugger.TYPE_IMMREL | Debugger.TYPE_BYTE | Debugger.TYPE_IN],
|
||||
/* 0xE3 */ [Debugger.INS.JCXZ, Debugger.TYPE_IMMREL | Debugger.TYPE_BYTE | Debugger.TYPE_IN],
|
||||
/* 0xE4 */ [Debugger.INS.IN, Debugger.TYPE_AL | Debugger.TYPE_OUT, Debugger.TYPE_IMM | Debugger.TYPE_BYTE | Debugger.TYPE_IN],
|
||||
/* 0xE5 */ [Debugger.INS.IN, Debugger.TYPE_AX | Debugger.TYPE_OUT, Debugger.TYPE_IMM | Debugger.TYPE_BYTE | Debugger.TYPE_IN],
|
||||
/* 0xE6 */ [Debugger.INS.OUT, Debugger.TYPE_IMM | Debugger.TYPE_BYTE | Debugger.TYPE_IN, Debugger.TYPE_AL | Debugger.TYPE_IN],
|
||||
/* 0xE7 */ [Debugger.INS.OUT, Debugger.TYPE_IMM | Debugger.TYPE_BYTE | Debugger.TYPE_IN, Debugger.TYPE_AX | Debugger.TYPE_IN],
|
||||
/* 0xE0 */ [Debugger.INS.LOOPNZ,Debugger.TYPE_IMMREL | Debugger.TYPE_BYTE | Debugger.TYPE_IN],
|
||||
/* 0xE1 */ [Debugger.INS.LOOPZ, Debugger.TYPE_IMMREL | Debugger.TYPE_BYTE | Debugger.TYPE_IN],
|
||||
/* 0xE2 */ [Debugger.INS.LOOP, Debugger.TYPE_IMMREL | Debugger.TYPE_BYTE | Debugger.TYPE_IN],
|
||||
/* 0xE3 */ [Debugger.INS.JCXZ, Debugger.TYPE_IMMREL | Debugger.TYPE_BYTE | Debugger.TYPE_IN],
|
||||
/* 0xE4 */ [Debugger.INS.IN, Debugger.TYPE_AL | Debugger.TYPE_OUT, Debugger.TYPE_IMM | Debugger.TYPE_BYTE | Debugger.TYPE_IN],
|
||||
/* 0xE5 */ [Debugger.INS.IN, Debugger.TYPE_AX | Debugger.TYPE_OUT, Debugger.TYPE_IMM | Debugger.TYPE_BYTE | Debugger.TYPE_IN],
|
||||
/* 0xE6 */ [Debugger.INS.OUT, Debugger.TYPE_IMM | Debugger.TYPE_BYTE | Debugger.TYPE_IN, Debugger.TYPE_AL | Debugger.TYPE_IN],
|
||||
/* 0xE7 */ [Debugger.INS.OUT, Debugger.TYPE_IMM | Debugger.TYPE_BYTE | Debugger.TYPE_IN, Debugger.TYPE_AX | Debugger.TYPE_IN],
|
||||
|
||||
/* 0xE8 */ [Debugger.INS.CALL, Debugger.TYPE_IMMREL | Debugger.TYPE_VWORD | Debugger.TYPE_IN],
|
||||
/* 0xE9 */ [Debugger.INS.JMP, Debugger.TYPE_IMMREL | Debugger.TYPE_VWORD | Debugger.TYPE_IN],
|
||||
|
|
@ -828,7 +855,7 @@ if (DEBUGGER) {
|
|||
/* 0xF3 */ [Debugger.INS.REPZ, Debugger.TYPE_PREFIX],
|
||||
/* 0xF4 */ [Debugger.INS.HLT],
|
||||
/* 0xF5 */ [Debugger.INS.CMC],
|
||||
/* 0xF6 */ [Debugger.INS.GRP3B, Debugger.TYPE_MODRM | Debugger.TYPE_BYTE | Debugger.TYPE_BOTH],
|
||||
/* 0xF6 */ [Debugger.INS.GRP3B, Debugger.TYPE_MODRM | Debugger.TYPE_BYTE | Debugger.TYPE_BOTH],
|
||||
/* 0xF7 */ [Debugger.INS.GRP3W, Debugger.TYPE_MODRM | Debugger.TYPE_VWORD | Debugger.TYPE_BOTH],
|
||||
|
||||
/* 0xF8 */ [Debugger.INS.CLC],
|
||||
|
|
@ -837,15 +864,15 @@ if (DEBUGGER) {
|
|||
/* 0xFB */ [Debugger.INS.STI],
|
||||
/* 0xFC */ [Debugger.INS.CLD],
|
||||
/* 0xFD */ [Debugger.INS.STD],
|
||||
/* 0xFE */ [Debugger.INS.GRP4B, Debugger.TYPE_MODRM | Debugger.TYPE_BYTE | Debugger.TYPE_BOTH],
|
||||
/* 0xFE */ [Debugger.INS.GRP4B, Debugger.TYPE_MODRM | Debugger.TYPE_BYTE | Debugger.TYPE_BOTH],
|
||||
/* 0xFF */ [Debugger.INS.GRP4W, Debugger.TYPE_MODRM | Debugger.TYPE_VWORD | Debugger.TYPE_BOTH]
|
||||
];
|
||||
|
||||
Debugger.aaOp0FDescs = {
|
||||
0x00: [Debugger.INS.GRP6, Debugger.TYPE_MODRM | Debugger.TYPE_WORD | Debugger.TYPE_BOTH],
|
||||
0x01: [Debugger.INS.GRP7, Debugger.TYPE_MODRM | Debugger.TYPE_WORD | Debugger.TYPE_BOTH],
|
||||
0x02: [Debugger.INS.LAR, Debugger.TYPE_REG | Debugger.TYPE_WORD | Debugger.TYPE_IN | Debugger.TYPE_286, Debugger.TYPE_MEM | Debugger.TYPE_WORD | Debugger.TYPE_IN],
|
||||
0x03: [Debugger.INS.LSL, Debugger.TYPE_REG | Debugger.TYPE_WORD | Debugger.TYPE_IN | Debugger.TYPE_286, Debugger.TYPE_MEM | Debugger.TYPE_WORD | Debugger.TYPE_IN],
|
||||
0x00: [Debugger.INS.GRP6, Debugger.TYPE_MODRM | Debugger.TYPE_WORD | Debugger.TYPE_BOTH],
|
||||
0x01: [Debugger.INS.GRP7, Debugger.TYPE_MODRM | Debugger.TYPE_WORD | Debugger.TYPE_BOTH],
|
||||
0x02: [Debugger.INS.LAR, Debugger.TYPE_REG | Debugger.TYPE_WORD | Debugger.TYPE_IN | Debugger.TYPE_286, Debugger.TYPE_MEM | Debugger.TYPE_WORD | Debugger.TYPE_IN],
|
||||
0x03: [Debugger.INS.LSL, Debugger.TYPE_REG | Debugger.TYPE_WORD | Debugger.TYPE_IN | Debugger.TYPE_286, Debugger.TYPE_MEM | Debugger.TYPE_WORD | Debugger.TYPE_IN],
|
||||
0x05: [Debugger.INS.LOADALL,Debugger.TYPE_286]
|
||||
};
|
||||
|
||||
|
|
@ -1018,11 +1045,6 @@ if (DEBUGGER) {
|
|||
]
|
||||
];
|
||||
|
||||
/*
|
||||
* Information regarding interrupts of interest
|
||||
*/
|
||||
Debugger.INT_DOS = 0x21;
|
||||
|
||||
Debugger.INT_FUNCS = {
|
||||
0x13: {
|
||||
0x00: "disk reset",
|
||||
|
|
@ -1171,7 +1193,7 @@ if (DEBUGGER) {
|
|||
}
|
||||
}
|
||||
|
||||
this.messageDump(Debugger.MESSAGE_DOS, function onDumpDOS(s) {
|
||||
this.messageDump(Debugger.MESSAGE.DOS, function onDumpDOS(s) {
|
||||
dbg.dumpDOS(s);
|
||||
});
|
||||
|
||||
|
|
@ -1396,16 +1418,16 @@ if (DEBUGGER) {
|
|||
Debugger.prototype.updateRegValues = function() {
|
||||
var cpu = this.cpu;
|
||||
var asRegs = Debugger.asRegs;
|
||||
this.aRegValues[asRegs[0]] = str.toHexByte(cpu.regAX & 0xff);
|
||||
this.aRegValues[asRegs[1]] = str.toHexByte(cpu.regCX & 0xff);
|
||||
this.aRegValues[asRegs[2]] = str.toHexByte(cpu.regDX & 0xff);
|
||||
this.aRegValues[asRegs[3]] = str.toHexByte(cpu.regBX & 0xff);
|
||||
this.aRegValues[asRegs[4]] = str.toHexByte(cpu.regAX >> 8);
|
||||
this.aRegValues[asRegs[5]] = str.toHexByte(cpu.regCX >> 8);
|
||||
this.aRegValues[asRegs[6]] = str.toHexByte(cpu.regDX >> 8);
|
||||
this.aRegValues[asRegs[7]] = str.toHexByte(cpu.regBX >> 8);
|
||||
this.aRegValues[asRegs[8]] = str.toHexWord(cpu.regAX);
|
||||
this.aRegValues[asRegs[9]] = str.toHexWord(cpu.regCX);
|
||||
this.aRegValues[asRegs[0]] = str.toHexByte(cpu.regAX & 0xff);
|
||||
this.aRegValues[asRegs[1]] = str.toHexByte(cpu.regCX & 0xff);
|
||||
this.aRegValues[asRegs[2]] = str.toHexByte(cpu.regDX & 0xff);
|
||||
this.aRegValues[asRegs[3]] = str.toHexByte(cpu.regBX & 0xff);
|
||||
this.aRegValues[asRegs[4]] = str.toHexByte(cpu.regAX >> 8);
|
||||
this.aRegValues[asRegs[5]] = str.toHexByte(cpu.regCX >> 8);
|
||||
this.aRegValues[asRegs[6]] = str.toHexByte(cpu.regDX >> 8);
|
||||
this.aRegValues[asRegs[7]] = str.toHexByte(cpu.regBX >> 8);
|
||||
this.aRegValues[asRegs[8]] = str.toHexWord(cpu.regAX);
|
||||
this.aRegValues[asRegs[9]] = str.toHexWord(cpu.regCX);
|
||||
this.aRegValues[asRegs[10]] = str.toHexWord(cpu.regDX);
|
||||
this.aRegValues[asRegs[11]] = str.toHexWord(cpu.regBX);
|
||||
this.aRegValues[asRegs[12]] = str.toHexWord(cpu.regSP);
|
||||
|
|
@ -1429,15 +1451,15 @@ if (DEBUGGER) {
|
|||
*/
|
||||
Debugger.prototype.messageInt = function(nInt, addr)
|
||||
{
|
||||
/*
|
||||
* TODO: Filtering of interrupt numbers below should be user-definable; this is very quick-and-dirty.
|
||||
*/
|
||||
var fMessage = false;
|
||||
var AH = this.cpu.regAX >> 8;
|
||||
if (this.messageEnabled(Debugger.MESSAGE_DOS)) {
|
||||
fMessage = (nInt == 0x21 && AH != 0x0b);
|
||||
} else {
|
||||
fMessage = (nInt != 0x10 && nInt != 0x15 && nInt != 0x16 && nInt != 0x1A && nInt != 0x1C);
|
||||
var nCategory = Debugger.INT_MESSAGE[nInt];
|
||||
var fMessage = nCategory && this.messageEnabled(nCategory);
|
||||
if (fMessage) {
|
||||
var AH = this.cpu.regAX >> 8;
|
||||
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) {
|
||||
fMessage = false;
|
||||
}
|
||||
}
|
||||
if (fMessage) {
|
||||
var aFuncs = Debugger.INT_FUNCS[nInt];
|
||||
|
|
@ -1504,7 +1526,7 @@ if (DEBUGGER) {
|
|||
Debugger.prototype.messagePort = function(component, port, bOut, addrFrom, name, bitsMessage, bIn)
|
||||
{
|
||||
if (!bitsMessage) bitsMessage = 0;
|
||||
bitsMessage |= Debugger.MESSAGE_PORT;
|
||||
bitsMessage |= Debugger.MESSAGE.PORT;
|
||||
if (addrFrom == null || (this.bitsMessageEnabled & bitsMessage) == bitsMessage) {
|
||||
var segFrom = null;
|
||||
if (addrFrom != null) {
|
||||
|
|
@ -1526,7 +1548,7 @@ if (DEBUGGER) {
|
|||
this.println(sMessage); // + " (" + this.cpu.getCycles() + " cycles)"
|
||||
|
||||
if (this.cpu) {
|
||||
if (this.bitsMessageEnabled & Debugger.MESSAGE_HALT) {
|
||||
if (this.bitsMessageEnabled & Debugger.MESSAGE.HALT) {
|
||||
this.cpu.haltCPU();
|
||||
}
|
||||
/*
|
||||
|
|
@ -1629,7 +1651,7 @@ if (DEBUGGER) {
|
|||
for (i = 0; i < this.aOpcodeHistory.length; i++) {
|
||||
/*
|
||||
* Preallocate dummy Addr (Array) objects in every history slot, so that checkInstruction()
|
||||
* doesn't need to call newAddr() on every instruction check.
|
||||
* doesn't need to call newAddr() on every slot update.
|
||||
*/
|
||||
this.aOpcodeHistory[i] = [0, null, 0];
|
||||
}
|
||||
|
|
@ -1965,7 +1987,7 @@ if (DEBUGGER) {
|
|||
*/
|
||||
Debugger.prototype.checksEnabled = function(fBreak)
|
||||
{
|
||||
return ((DEBUG && !fBreak)? true : (this.aBreakExec.length > 1 || this.messageEnabled(Debugger.MESSAGE_INT) /* || this.aBreakRead.length > 1 || this.aBreakWrite.length > 1 */));
|
||||
return ((DEBUG && !fBreak)? true : (this.aBreakExec.length > 1 || this.messageEnabled(Debugger.MESSAGE.INT) /* || this.aBreakRead.length > 1 || this.aBreakWrite.length > 1 */));
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -2005,7 +2027,7 @@ if (DEBUGGER) {
|
|||
|
||||
/*
|
||||
* This is a good example of what NOT to do in a high-frequency function, and defeats
|
||||
* the entire purpose of preallocating and preinitializing the history array in initHistory():
|
||||
* the purpose of preallocating and preinitializing the history array in initHistory():
|
||||
*
|
||||
* this.aOpcodeHistory[this.iOpcodeHistory] = this.newAddr(this.cpu.regIP, this.cpu.segCS.sel, addr);
|
||||
*
|
||||
|
|
@ -2725,43 +2747,6 @@ if (DEBUGGER) {
|
|||
/**
|
||||
* parseInstruction(sOp, sOperand, addr)
|
||||
*
|
||||
* This generally requires an exact match of both the operation code (sOp) and mode operand
|
||||
* (sOperand) against the aOps[] and aOpMods[] arrays, respectively; however, the regular
|
||||
* expression built from aOpMods and stored in regexOpModes does relax the matching criteria
|
||||
* slightly; ie, a 4-digit hex value ("nnnn") will be satisfied with either 3 or 4 digits, and
|
||||
* similarly, a 2-digit hex address (nn) will be satisfied with either 1 or 2 digits.
|
||||
*
|
||||
* Note that this function does not actually store the instruction into memory, even though it requires
|
||||
* a target address (addr); that parameter is currently needed ONLY for "branch" instructions, because in
|
||||
* order to calculate the branch displacement, it needs to know where the instruction will ultimately be
|
||||
* stored, relative to its target address.
|
||||
*
|
||||
* Another handy feature of this function is its ability to display all available modes for a particular
|
||||
* operation. For example, while in "assemble mode", if one types:
|
||||
*
|
||||
* ldy?
|
||||
*
|
||||
* the Debugger will display:
|
||||
*
|
||||
* supported opcodes:
|
||||
* A0: LDY nn
|
||||
* A4: LDY [nn]
|
||||
* AC: LDY [nnnn]
|
||||
* B4: LDY [nn+X]
|
||||
* BC: LDY [nnnn+X]
|
||||
*
|
||||
* Use of a trailing "?" on any opcode will display all variations of that opcode; no instruction will be
|
||||
* assembled, and the operand parameter, if any, will be ignored.
|
||||
*
|
||||
* Although this function is capable of reporting numerous errors, roughly half of them indicate internal
|
||||
* consistency errors, not user errors; the former should really be asserts, but I'm not comfortable bombing
|
||||
* out because of my error as opposed to their error. The only errors a user should expect to see:
|
||||
*
|
||||
* "unknown operation": sOp is not a valid operation (per aOps)
|
||||
* "unknown operand": sOperand is not a valid operand (per aOpMods)
|
||||
* "unknown instruction": the combination of sOp + sOperand does not exist (per aaOpDescs)
|
||||
* "branch out of range": the branch address, relative to addr, is too far away
|
||||
*
|
||||
* @this {Debugger}
|
||||
* @param {string} sOp
|
||||
* @param {string|undefined} sOperand
|
||||
|
|
@ -3656,7 +3641,7 @@ if (DEBUGGER) {
|
|||
/**
|
||||
* doHalt(sCount)
|
||||
*
|
||||
* If the CPU is running and no count is provided, then we simply haltCPU(); otherwise we treat this as a history command.
|
||||
* If the CPU is running and no count is provided, we halt the CPU; otherwise we treat this as a history command.
|
||||
*
|
||||
* @this {Debugger}
|
||||
* @param {string|undefined} sCount is the number of instructions to rewind to (default is 10)
|
||||
|
|
|
|||
|
|
@ -691,7 +691,7 @@ Disk.prototype.doneLoad = function(sDiskFile, sDiskData, nErrorCode, sDiskPath)
|
|||
* conversion to a forward-compatible 'data' array.
|
||||
*/
|
||||
else {
|
||||
if (MAXDEBUG && DEBUGGER && this.dbg && this.dbg.messageEnabled(Debugger.MESSAGE_DISK)) {
|
||||
if (MAXDEBUG && DEBUGGER && this.dbg && this.dbg.messageEnabled(Debugger.MESSAGE.DISK)) {
|
||||
var sCylinders = aDiskData.length + " track" + (aDiskData.length > 1 ? "s" : "");
|
||||
var nHeads = aDiskData[0].length;
|
||||
var sHeads = nHeads + " head" + (nHeads > 1 ? "s" : "");
|
||||
|
|
@ -1534,7 +1534,7 @@ Disk.prototype.restore = function(deltas)
|
|||
Disk.prototype.messageDebugger = function(sMessage)
|
||||
{
|
||||
if (DEBUGGER && this.dbg) {
|
||||
if (this.dbg.messageEnabled(Debugger.MESSAGE_DISK)) {
|
||||
if (this.dbg.messageEnabled(Debugger.MESSAGE.DISK)) {
|
||||
this.dbg.message(sMessage);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -400,13 +400,6 @@ FDC.aCmdInfo = {
|
|||
0x0F: {cbReq: 3, cbRes: 0, name: FDC.CMDS.SEEK}
|
||||
};
|
||||
|
||||
/*
|
||||
* FDC BIOS interrupts, functions, and other parameters
|
||||
*/
|
||||
FDC.BIOS = {
|
||||
INT_DISKETTE: 0x13
|
||||
};
|
||||
|
||||
/**
|
||||
* setBinding(sHTMLClass, sHTMLType, sBinding, control)
|
||||
*
|
||||
|
|
@ -561,9 +554,6 @@ FDC.prototype.initBus = function(cmp, bus, cpu, dbg)
|
|||
|
||||
bus.addPortInputTable(this, FDC.aPortInput);
|
||||
bus.addPortOutputTable(this, FDC.aPortOutput);
|
||||
if (DEBUGGER) {
|
||||
cpu.addIntNotify(FDC.BIOS.INT_DISKETTE, this, this.intBIOSDiskette);
|
||||
}
|
||||
|
||||
if (!this.autoMount()) this.setReady();
|
||||
};
|
||||
|
|
@ -1879,7 +1869,7 @@ FDC.prototype.popCmd = function(name)
|
|||
{
|
||||
Component.assert((!this.regDataIndex || name !== undefined) && this.regDataIndex < this.regDataTotal);
|
||||
var bCmd = this.regDataArray[this.regDataIndex];
|
||||
if (DEBUG && DEBUGGER && this.dbg && this.dbg.messageEnabled(Debugger.MESSAGE_FDC)) {
|
||||
if (DEBUG && DEBUGGER && this.dbg && this.dbg.messageEnabled(Debugger.MESSAGE.FDC)) {
|
||||
var bCmdMasked = bCmd & FDC.REG_DATA.CMD.MASK;
|
||||
if (!name && !this.regDataIndex && FDC.aCmdInfo[bCmdMasked]) name = FDC.aCmdInfo[bCmdMasked].name;
|
||||
this.dbg.message("FDC.CMD[" + (name || this.regDataIndex) + "]: 0x" + str.toHexByte(bCmd));
|
||||
|
|
@ -1933,7 +1923,7 @@ FDC.prototype.beginResult = function()
|
|||
*/
|
||||
FDC.prototype.pushResult = function(bResult, name)
|
||||
{
|
||||
if (DEBUG) this.messageDebugger("FDC.RES[" + (name || this.regDataTotal) + "]: 0x" + str.toHexByte(bResult), Debugger.MESSAGE_FDC);
|
||||
if (DEBUG) this.messageDebugger("FDC.RES[" + (name || this.regDataTotal) + "]: 0x" + str.toHexByte(bResult), Debugger.MESSAGE.FDC);
|
||||
this.regDataArray[this.regDataTotal++] = bResult;
|
||||
};
|
||||
|
||||
|
|
@ -2287,52 +2277,6 @@ FDC.prototype.writeFormat = function(drive, b)
|
|||
return b;
|
||||
};
|
||||
|
||||
/**
|
||||
* intBIOSDiskette(addr)
|
||||
*
|
||||
* NOTE: This function tries to differentiate FDC requests from HDC requests, by whether the INT 0x13 drive number
|
||||
* in DL is < 0x80; however, not all INT 0x13 functions required a drive number in DL, and not all callers supplied one.
|
||||
*
|
||||
* INT 0x13 Quick Reference:
|
||||
*
|
||||
* AH
|
||||
* ----
|
||||
* 0x00 Reset
|
||||
* 0x01 Get status (from last operation)
|
||||
* 0x02 Read sectors
|
||||
* 0x03 Write sectors
|
||||
* 0x04 Verify sectors
|
||||
* 0x05 Format track
|
||||
*
|
||||
* For Read, Write, Verify and Format commands:
|
||||
*
|
||||
* DL drive number (0-3 allowed, value checked)
|
||||
* DH head number (0-1 allowed, not value checked)
|
||||
* CH track number (0-39 allowed, not value checked [which is good, because high-density diskettes go up to 80 tracks])
|
||||
* CL sector number (1-8 allowed, not value checked [which is good, because support for 9-sector tracks was later added])
|
||||
* AL number of sectors (max of 8, not value checked)
|
||||
* ES:BX sector buffer
|
||||
*
|
||||
* @this {FDC}
|
||||
* @param {number} addr
|
||||
* @return {boolean} true to proceed with the INT 0x13 software interrupt, false to skip
|
||||
*/
|
||||
FDC.prototype.intBIOSDiskette = function(addr)
|
||||
{
|
||||
if (DEBUGGER) {
|
||||
var DL = this.cpu.regDX & 0xff;
|
||||
if (this.dbg && this.dbg.messageEnabled(Debugger.MESSAGE_FDC | Debugger.MESSAGE_INT) && DL < 0x80) {
|
||||
this.dbg.messageInt(FDC.BIOS.INT_DISKETTE, addr);
|
||||
this.cpu.addIntReturn(addr, function(fdc, nCycles) {
|
||||
return function onBIOSDisketteReturn(nLevel) {
|
||||
fdc.dbg.messageIntReturn(FDC.BIOS.INT_DISKETTE, nLevel, fdc.cpu.getCycles() - nCycles);
|
||||
};
|
||||
}(this, this.cpu.getCycles()));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
* messageDebugger(sMessage, bitsMessage)
|
||||
*
|
||||
|
|
@ -2345,7 +2289,7 @@ FDC.prototype.intBIOSDiskette = function(addr)
|
|||
FDC.prototype.messageDebugger = function(sMessage, bitsMessage)
|
||||
{
|
||||
if (DEBUGGER && this.dbg) {
|
||||
if (bitsMessage == null) bitsMessage = Debugger.MESSAGE_FDC;
|
||||
if (bitsMessage == null) bitsMessage = Debugger.MESSAGE.FDC;
|
||||
if (this.dbg.messageEnabled(bitsMessage)) this.dbg.message(sMessage);
|
||||
}
|
||||
};
|
||||
|
|
@ -2364,7 +2308,7 @@ FDC.prototype.messageDebugger = function(sMessage, bitsMessage)
|
|||
*/
|
||||
FDC.prototype.messagePort = function(port, bOut, addrFrom, name, bIn)
|
||||
{
|
||||
if (DEBUGGER && this.dbg) this.dbg.messagePort(this, port, bOut, addrFrom, name, Debugger.MESSAGE_FDC, bIn);
|
||||
if (DEBUGGER && this.dbg) this.dbg.messagePort(this, port, bOut, addrFrom, name, Debugger.MESSAGE.FDC, bIn);
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -535,10 +535,8 @@ HDC.prototype.initBus = function(cmp, bus, cpu, dbg)
|
|||
bus.addPortInputTable(this, this.fATC? HDC.aATCPortInput : HDC.aXTCPortInput);
|
||||
bus.addPortOutputTable(this, this.fATC? HDC.aATCPortOutput : HDC.aXTCPortOutput);
|
||||
|
||||
if (DEBUGGER) {
|
||||
cpu.addIntNotify(HDC.BIOS.INT_DISK, this, this.intBIOSDisk);
|
||||
cpu.addIntNotify(HDC.BIOS.INT_DISKETTE, this, this.intBIOSDiskette);
|
||||
}
|
||||
cpu.addIntNotify(HDC.BIOS.INT_DISK, this, this.intBIOSDisk);
|
||||
cpu.addIntNotify(HDC.BIOS.INT_DISKETTE, this, this.intBIOSDiskette);
|
||||
|
||||
/*
|
||||
* The following code used to be performed in the HDC constructor, but now we need to wait for information
|
||||
|
|
@ -1794,7 +1792,7 @@ HDC.prototype.doATCommand = function()
|
|||
this.drive = drive;
|
||||
}
|
||||
|
||||
if (DEBUG) this.messageDebugger("HDC.doATCommand(" + str.toHexByte(bCmd) + "): " + HDC.aATCCommands[bCmd], Debugger.MESSAGE_PORT | Debugger.MESSAGE_HDC);
|
||||
if (DEBUG) this.messageDebugger("HDC.doATCommand(" + str.toHexByte(bCmd) + "): " + HDC.aATCCommands[bCmd], Debugger.MESSAGE.PORT | Debugger.MESSAGE.HDC);
|
||||
|
||||
switch (bCmd & HDC.ATC.COMMAND.MASK) {
|
||||
|
||||
|
|
@ -1880,7 +1878,7 @@ HDC.prototype.doATCommand = function()
|
|||
|
||||
default:
|
||||
if (DEBUG) this.messageDebugger("HDC.doATCommand(" + str.toHexByte(this.regCommand) + "): " + (bCmd < 0? ("invalid drive (" + iDrive + ")") : "unsupported operation"));
|
||||
if (DEBUG && DEBUGGER && this.dbg && this.dbg.messageEnabled(Debugger.MESSAGE_HDC) && bCmd >= 0) this.cpu.haltCPU();
|
||||
if (DEBUG && DEBUGGER && this.dbg && this.dbg.messageEnabled(Debugger.MESSAGE.HDC) && bCmd >= 0) this.cpu.haltCPU();
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -2049,7 +2047,7 @@ HDC.prototype.doXTCommand = function()
|
|||
default:
|
||||
if (DEBUG) this.messageDebugger("HDC.doXTCommand(" + str.toHexByte(bCmdOrig) + "): " + (bCmd < 0? ("invalid drive (" + iDrive + ")") : "unsupported operation"));
|
||||
this.beginResult(HDC.XTC.DATA.STATUS_ERROR | bDrive);
|
||||
if (DEBUG && DEBUGGER && this.dbg && this.dbg.messageEnabled(Debugger.MESSAGE_HDC) && bCmd >= 0) this.cpu.haltCPU();
|
||||
if (DEBUG && DEBUGGER && this.dbg && this.dbg.messageEnabled(Debugger.MESSAGE.HDC) && bCmd >= 0) this.cpu.haltCPU();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -2067,7 +2065,7 @@ HDC.prototype.popCmd = function()
|
|||
var bCmdIndex = this.regDataIndex;
|
||||
if (bCmdIndex < this.regDataTotal) {
|
||||
bCmd = this.regDataArray[this.regDataIndex++];
|
||||
if (DEBUG) this.messageDebugger("HDC.CMD[" + bCmdIndex + "]: 0x" + str.toHexByte(bCmd) + (!bCmdIndex && HDC.aXTCCommands[bCmd]? (" (" + HDC.aXTCCommands[bCmd] + ")") : ""), (bCmdIndex > 0? Debugger.MESSAGE_PORT : 0) | Debugger.MESSAGE_HDC);
|
||||
if (DEBUG) this.messageDebugger("HDC.CMD[" + bCmdIndex + "]: 0x" + str.toHexByte(bCmd) + (!bCmdIndex && HDC.aXTCCommands[bCmd]? (" (" + HDC.aXTCCommands[bCmd] + ")") : ""), (bCmdIndex > 0? Debugger.MESSAGE.PORT : 0) | Debugger.MESSAGE.HDC);
|
||||
}
|
||||
return bCmd;
|
||||
};
|
||||
|
|
@ -2103,7 +2101,7 @@ HDC.prototype.beginResult = function(bResult)
|
|||
*/
|
||||
HDC.prototype.pushResult = function(bResult)
|
||||
{
|
||||
if (DEBUG) this.messageDebugger("HDC.RES[" + this.regDataTotal + "]: 0x" + str.toHexByte(bResult), (this.regDataTotal > 0? Debugger.MESSAGE_PORT : 0) | Debugger.MESSAGE_HDC);
|
||||
if (DEBUG) this.messageDebugger("HDC.RES[" + this.regDataTotal + "]: 0x" + str.toHexByte(bResult), (this.regDataTotal > 0? Debugger.MESSAGE.PORT : 0) | Debugger.MESSAGE.HDC);
|
||||
this.regDataArray[this.regDataTotal++] = bResult;
|
||||
};
|
||||
|
||||
|
|
@ -2638,16 +2636,6 @@ HDC.prototype.intBIOSDisk = function(addr)
|
|||
var AH = this.cpu.regAX >> 8;
|
||||
var DL = this.cpu.regDX & 0xff;
|
||||
if (!AH && DL > 0x80) this.iDriveAllowFail = DL - 0x80;
|
||||
if (DEBUGGER) {
|
||||
if (this.dbg && this.dbg.messageEnabled(Debugger.MESSAGE_HDC | Debugger.MESSAGE_INT) && DL >= 0x80) {
|
||||
this.dbg.messageInt(HDC.BIOS.INT_DISK, addr);
|
||||
this.cpu.addIntReturn(addr, function (hdc, nCycles) {
|
||||
return function onBIOSDiskReturn(nLevel) {
|
||||
hdc.dbg.messageIntReturn(HDC.BIOS.INT_DISK, nLevel, hdc.cpu.getCycles() - nCycles);
|
||||
};
|
||||
}(this, this.cpu.getCycles()));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
|
|
@ -2702,7 +2690,7 @@ HDC.prototype.intBIOSDiskette = function(addr)
|
|||
HDC.prototype.messageDebugger = function(sMessage, bitsMessage)
|
||||
{
|
||||
if (DEBUGGER && this.dbg) {
|
||||
if (bitsMessage == null) bitsMessage = Debugger.MESSAGE_HDC;
|
||||
if (bitsMessage == null) bitsMessage = Debugger.MESSAGE.HDC;
|
||||
if (this.dbg.messageEnabled(bitsMessage)) this.dbg.message(sMessage);
|
||||
}
|
||||
};
|
||||
|
|
@ -2721,7 +2709,7 @@ HDC.prototype.messageDebugger = function(sMessage, bitsMessage)
|
|||
*/
|
||||
HDC.prototype.messagePort = function(port, bOut, addrFrom, name, bIn)
|
||||
{
|
||||
if (DEBUGGER && this.dbg) this.dbg.messagePort(this, port, bOut, addrFrom, name, Debugger.MESSAGE_HDC, bIn);
|
||||
if (DEBUGGER && this.dbg) this.dbg.messagePort(this, port, bOut, addrFrom, name, Debugger.MESSAGE.HDC, bIn);
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -917,7 +917,7 @@ Keyboard.prototype.resetDevice = function()
|
|||
/*
|
||||
* TODO: There's more to reset, like LED indicators, default type rate, and emptying the scan code buffer.
|
||||
*/
|
||||
this.messageDebugger("keyboard reset", Debugger.MESSAGE_PORT);
|
||||
this.messageDebugger("keyboard reset", Debugger.MESSAGE.PORT);
|
||||
this.abScanBuffer = [Keyboard.CMDRES.BAT_SUCC];
|
||||
if (this.chipset) this.chipset.notifyKbdData(true);
|
||||
};
|
||||
|
|
@ -939,7 +939,7 @@ Keyboard.prototype.setEnable = function(fData, fClock)
|
|||
{
|
||||
var fReset = false;
|
||||
if (this.fClock !== fClock) {
|
||||
if (DEBUG) this.messageDebugger("keyboard clock line changing to " + fClock, Debugger.MESSAGE_PORT);
|
||||
if (DEBUG) this.messageDebugger("keyboard clock line changing to " + fClock, Debugger.MESSAGE.PORT);
|
||||
/*
|
||||
* Toggling the clock line low and then high signals a "reset", which we acknowledge once the
|
||||
* data line is high as well.
|
||||
|
|
@ -947,7 +947,7 @@ Keyboard.prototype.setEnable = function(fData, fClock)
|
|||
this.fClock = this.fResetOnEnable = fClock;
|
||||
}
|
||||
if (this.fData !== fData) {
|
||||
if (DEBUG) this.messageDebugger("keyboard data line changing to " + fData, Debugger.MESSAGE_PORT);
|
||||
if (DEBUG) this.messageDebugger("keyboard data line changing to " + fData, Debugger.MESSAGE.PORT);
|
||||
this.fData = fData;
|
||||
/*
|
||||
* TODO: Review this code; it was added during the early days of MODEL_5150 testing and may not be
|
||||
|
|
@ -1480,7 +1480,7 @@ Keyboard.prototype.keyUpDown = function(event, fDown)
|
|||
fPass = !this.keySimulateUpDown(keyCodeSim, fDown, Keyboard.SIMCODE.KEYUPDOWN);
|
||||
}
|
||||
|
||||
if (DEBUG) this.messageDebugger(/*(fDown?"\n":"") +*/ "key" + (fDown? "Down" : "Up") + "(" + keyCode + "): " + (fPass? "pass" : "consume"), Debugger.MESSAGE_KEYS);
|
||||
if (DEBUG) this.messageDebugger(/*(fDown?"\n":"") +*/ "key" + (fDown? "Down" : "Up") + "(" + keyCode + "): " + (fPass? "pass" : "consume"), Debugger.MESSAGE.KEYS);
|
||||
return fPass;
|
||||
};
|
||||
|
||||
|
|
@ -1518,7 +1518,7 @@ Keyboard.prototype.keyPress = function(event)
|
|||
if (this.bitsShift & Keyboard.STATE.COMMAND)
|
||||
this.bitsShift &= ~Keyboard.STATE.COMMAND;
|
||||
else {
|
||||
// if (DEBUG && event.altKey) this.messageDebugger("ALT press: keyCode " + keyCode, Debugger.MESSAGE_KEYS);
|
||||
// if (DEBUG && event.altKey) this.messageDebugger("ALT press: keyCode " + keyCode, Debugger.MESSAGE.KEYS);
|
||||
if (this.bitsShift & (Keyboard.STATE.CTRL | Keyboard.STATE.ALT))
|
||||
fPass = false;
|
||||
else
|
||||
|
|
@ -1526,7 +1526,7 @@ Keyboard.prototype.keyPress = function(event)
|
|||
}
|
||||
}
|
||||
|
||||
if (DEBUG) this.messageDebugger("keyPress(" + keyCode + "): " + (fPass? "pass" : "consume"), Debugger.MESSAGE_KEYS);
|
||||
if (DEBUG) this.messageDebugger("keyPress(" + keyCode + "): " + (fPass? "pass" : "consume"), Debugger.MESSAGE.KEYS);
|
||||
return fPass;
|
||||
};
|
||||
|
||||
|
|
@ -1581,7 +1581,7 @@ Keyboard.prototype.keySimulatePress = function(keyCode, fQuickRelease)
|
|||
}
|
||||
fSimulated = true;
|
||||
}
|
||||
if (DEBUG) this.messageDebugger("keySimulatePress(" + keyCode + "): " + (fSimulated? "true" : "false"), Debugger.MESSAGE_KEYS);
|
||||
if (DEBUG) this.messageDebugger("keySimulatePress(" + keyCode + "): " + (fSimulated? "true" : "false"), Debugger.MESSAGE.KEYS);
|
||||
return fSimulated;
|
||||
};
|
||||
|
||||
|
|
@ -1666,7 +1666,7 @@ Keyboard.prototype.keySimulateUpDown = function(keyCode, fDown, simCode)
|
|||
|
||||
fSimulated = true;
|
||||
}
|
||||
if (DEBUG && DEBUGGER) this.messageDebugger("keySimulateUpDown(" + keyCode + "," + (fDown? "down" : "up") + "," + Keyboard.aSimCodeDescs[simCode] + "): " + (fSimulated? "true" : "false"), Debugger.MESSAGE_KEYS);
|
||||
if (DEBUG && DEBUGGER) this.messageDebugger("keySimulateUpDown(" + keyCode + "," + (fDown? "down" : "up") + "," + Keyboard.aSimCodeDescs[simCode] + "): " + (fSimulated? "true" : "false"), Debugger.MESSAGE.KEYS);
|
||||
return fSimulated;
|
||||
};
|
||||
|
||||
|
|
@ -1682,8 +1682,8 @@ Keyboard.prototype.keySimulateUpDown = function(keyCode, fDown, simCode)
|
|||
Keyboard.prototype.messageDebugger = function(sMessage, bitsMessage)
|
||||
{
|
||||
if (DEBUGGER && this.dbg) {
|
||||
if (bitsMessage == null) bitsMessage = Debugger.MESSAGE_KBD;
|
||||
if (bitsMessage == Debugger.MESSAGE_PORT) bitsMessage |= Debugger.MESSAGE_KBD;
|
||||
if (bitsMessage == null) bitsMessage = Debugger.MESSAGE.KBD;
|
||||
if (bitsMessage == Debugger.MESSAGE.PORT) bitsMessage |= Debugger.MESSAGE.KBD;
|
||||
if (this.dbg.messageEnabled(bitsMessage)) this.dbg.message(sMessage);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ Memory.prototype = {
|
|||
* @return {number}
|
||||
*/
|
||||
readNone: function(off) {
|
||||
if (DEBUGGER && this.dbg.messageEnabled(Debugger.MESSAGE_MEM) && !off) {
|
||||
if (DEBUGGER && this.dbg.messageEnabled(Debugger.MESSAGE.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;
|
||||
|
|
@ -181,7 +181,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(Debugger.MESSAGE.MEM) && !off) {
|
||||
this.dbg.message("attempt to write 0x" + str.toHexWord(v) + " to invalid block %" + str.toHex(this.addr) + " from " + str.toHexAddr(this.cpu.regIP, this.cpu.segCS.sel));
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -159,6 +159,8 @@ function Mouse(parmsMouse) {
|
|||
|
||||
Component.subclass(Component, Mouse);
|
||||
|
||||
Mouse.ID_SERIAL = 0x4D;
|
||||
|
||||
/**
|
||||
* initBus(cmp, bus, cpu, dbg)
|
||||
*
|
||||
|
|
@ -182,7 +184,7 @@ Mouse.prototype.initBus = function(cmp, bus, cpu, dbg) {
|
|||
* @return {boolean} true if active, false if not
|
||||
*/
|
||||
Mouse.prototype.isActive = function() {
|
||||
return this.fActive && (this.cpu ? this.cpu.isRunning() : false);
|
||||
return this.fActive && (this.cpu? this.cpu.isRunning() : false);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -245,7 +247,7 @@ Mouse.prototype.powerUp = function(data, fRepower) {
|
|||
* @return {Object|boolean}
|
||||
*/
|
||||
Mouse.prototype.powerDown = function(fSave) {
|
||||
return fSave && this.save ? this.save() : true;
|
||||
return fSave && this.save? this.save() : true;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -439,14 +441,14 @@ Mouse.prototype.clickMouse = function(iButton, fDown) {
|
|||
case 0:
|
||||
if (this.fButton1 != fDown) {
|
||||
this.fButton1 = fDown;
|
||||
sDiag = DEBUGGER ? ("mouse button1 " + (fDown ? "dn" : "up")) : null;
|
||||
sDiag = DEBUGGER? ("mouse button1 " + (fDown? "dn" : "up")) : null;
|
||||
this.sendPacket(sDiag);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (this.fButton2 != fDown) {
|
||||
this.fButton2 = fDown;
|
||||
sDiag = DEBUGGER ? ("mouse button2 " + (fDown ? "dn" : "up")) : null;
|
||||
sDiag = DEBUGGER? ("mouse button2 " + (fDown? "dn" : "up")) : null;
|
||||
this.sendPacket(sDiag);
|
||||
}
|
||||
break;
|
||||
|
|
@ -474,10 +476,10 @@ Mouse.prototype.clickMouse = function(iButton, fDown) {
|
|||
* @param {number} [yDiag] original y-coordinate (optional; for diagnostic use only)
|
||||
*/
|
||||
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 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;
|
||||
this.messageDebugger((sDiag ? (sDiag + ": ") : "") + (yDiag !== undefined ? ("mouse (" + xDiag + "," + yDiag + "): ") : "") + "serial packet [" + str.toHexByte(b1) + "," + str.toHexByte(b2) + "," + str.toHexByte(b3) + "]");
|
||||
this.messageDebugger((sDiag? (sDiag + ": ") : "") + (yDiag !== undefined? ("mouse (" + xDiag + "," + yDiag + "): ") : "") + "serial packet [" + str.toHexByte(b1) + "," + str.toHexByte(b2) + "," + str.toHexByte(b3) + "]");
|
||||
this.componentAdapter.sendRBR([b1, b2, b3]);
|
||||
this.xDelta = this.yDelta = 0;
|
||||
};
|
||||
|
|
@ -489,7 +491,7 @@ Mouse.prototype.sendPacket = function(sDiag, xDiag, yDiag) {
|
|||
*
|
||||
* During normal serial mouse operation, both RTS and DTR must be "positive".
|
||||
*
|
||||
* Setting RTS "negative" for 100ms resets the mouse. Toggling DTR requests an identification byte (0x4D).
|
||||
* Setting RTS "negative" for 100ms resets the mouse. Toggling DTR requests an identification byte (ID_SERIAL).
|
||||
*
|
||||
* NOTES: The above 3rd-party information notwithstanding, I've observed that Windows v1.01 initially writes 0x01
|
||||
* to the MCR (DTR on, RTS off), spins in a loop that reads the RBR (probably to avoid a bogus identification byte
|
||||
|
|
@ -515,7 +517,27 @@ Mouse.prototype.notifyMCR = function(bMCR) {
|
|||
fIdentify = true;
|
||||
}
|
||||
if (fIdentify) {
|
||||
this.componentAdapter.sendRBR([0x4D]);
|
||||
/*
|
||||
* HEADS UP: Everything I'd read about the (original) Microsoft Serial Mouse "reset" protocol says
|
||||
* that the device sends a single byte (0x4D aka 'M'). It's not surprising to think that newer mice
|
||||
* might send additional bytes, but you would think that newer mouse drivers (eg, MOUSE.COM v8.20)
|
||||
* would always be able to deal with mice that sent only one byte.
|
||||
*
|
||||
* You would be wrong. On an INT 0x33 reset, the v8.20 driver looks for an 'M', then it waits for
|
||||
* another byte (0x42 aka 'B'). If it doesn't receive a 'B', it will accept another 'M'. But if it
|
||||
* receives something else (or nothing at all), it will spend a long time waiting for it, and then
|
||||
* return an error.
|
||||
*
|
||||
* It's entirely possible that I've done something wrong and inadvertently "tricked" MOUSE.COM into
|
||||
* using the wrong detection logic. But given the other problems I've seen in MOUSE.COM v8.20, including
|
||||
* its failure to properly terminate-and-stay-resident when its initial INT 0x33 reset returns an error,
|
||||
* I'm not in the mood to give it the benefit of the doubt.
|
||||
*
|
||||
* So, anyway, I solve the terminate-and-stay-resident bug in MOUSE.COM v8.20 by feeding it *two* ID_SERIAL
|
||||
* bytes on a reset. This doesn't seem to adversely affect serial mouse emulation for Windows 1.01, so
|
||||
* I'm calling this good enough for now.
|
||||
*/
|
||||
this.componentAdapter.sendRBR([Mouse.ID_SERIAL, Mouse.ID_SERIAL]);
|
||||
this.messageDebugger("serial mouse ID sent");
|
||||
}
|
||||
this.captureMouse(this.canvasScreen);
|
||||
|
|
@ -553,8 +575,8 @@ Mouse.prototype.notifyMCR = function(bMCR) {
|
|||
*/
|
||||
Mouse.prototype.messageDebugger = function(sMessage) {
|
||||
if (DEBUGGER && this.dbg) {
|
||||
if (this.dbg.messageEnabled(Debugger.MESSAGE_MOUSE)) {
|
||||
this.dbg.message(sMessage);
|
||||
if (this.dbg.messageEnabled(Debugger.MESSAGE.MOUSE)) {
|
||||
this.dbg.message(sMessage + " @" + str.toHexAddr(this.cpu.regIP, this.cpu.segCS.sel));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -46,6 +46,8 @@
|
|||
DEBUGGER = false;
|
||||
|
||||
/*
|
||||
* We still need a Debugger "stub" object, so that attempts to reference Debugger constants won't trigger exceptions.
|
||||
* We still need some Debugger "stub" objects, so that attempts to reference Debugger constants won't trigger exceptions.
|
||||
*/
|
||||
var Debugger = {};
|
||||
var Debugger = {
|
||||
MESSAGE: {}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -152,16 +152,17 @@ SerialPort.sIOBuffer = "buffer";
|
|||
* 0x0002 56000 2.86%
|
||||
* 0x0001 128000
|
||||
*/
|
||||
SerialPort.RBR = {REG: 0}; // Receiver Buffer Register (read)
|
||||
SerialPort.DLL = {REG: 0}; // Divisor Latch LSB (only when SerialPort.LCR.DLAB is set)
|
||||
SerialPort.THR = {REG: 0}; // Transmitter Holding Register (write)
|
||||
SerialPort.DLM = {REG: 1}; // Divisor Latch MSB (only when SerialPort.LCR.DLAB is set)
|
||||
SerialPort.SCR = {REG: 7}; // Scratch Register
|
||||
|
||||
SerialPort.DL_DEFAULT = 0x180; // we select an arbitrary default Divisor Latch equivalent to 300 baud
|
||||
|
||||
/*
|
||||
* Interrupt Enable Register (IER.REG, offset 1)
|
||||
* Receiver Buffer Register (RBR.REG, offset 0; eg, 0x3F8 or 0x2F8)
|
||||
*/
|
||||
SerialPort.RBR = {REG: 0}; // (read)
|
||||
|
||||
/*
|
||||
* Interrupt Enable Register (IER.REG, offset 1; eg, 0x3F9 or 0x2F9)
|
||||
*/
|
||||
SerialPort.IER = {};
|
||||
SerialPort.IER.REG = 1; // Interrupt Enable Register
|
||||
|
|
@ -171,8 +172,10 @@ SerialPort.IER.LSR_DELTA = 0x04;
|
|||
SerialPort.IER.MSR_DELTA = 0x08;
|
||||
SerialPort.IER.UNUSED = 0xF0; // always zero
|
||||
|
||||
SerialPort.DLM = {REG: 1}; // Divisor Latch MSB (only when SerialPort.LCR.DLAB is set)
|
||||
|
||||
/*
|
||||
* Interrupt ID Register (IIR.REG, offset 2)
|
||||
* Interrupt ID Register (IIR.REG, offset 2; eg, 0x3FA or 0x2FA)
|
||||
*
|
||||
* All interrupt conditions cleared by reading the corresponding register (or, in the case of IRR_INT_THR, writing a new value to THR.REG)
|
||||
*/
|
||||
|
|
@ -187,7 +190,7 @@ SerialPort.IIR.INT_BITS = 0x06;
|
|||
SerialPort.IIR.UNUSED = 0xF8; // always zero (the ROM BIOS relies on these bits "floating to 1" when no SerialPort is present)
|
||||
|
||||
/*
|
||||
* Line Control Register (LCR.REG, offset 3)
|
||||
* Line Control Register (LCR.REG, offset 3; eg, 0x3FB or 0x2FB)
|
||||
*/
|
||||
SerialPort.LCR = {};
|
||||
SerialPort.LCR.REG = 3; // Line Control Register
|
||||
|
|
@ -203,7 +206,7 @@ SerialPort.LCR.BREAK = 0x40; // if set, serial output (SOUT) signal i
|
|||
SerialPort.LCR.DLAB = 0x80; // Divisor Latch Access Bit; if set, DLL.REG and DLM.REG can be read or written
|
||||
|
||||
/*
|
||||
* Modem Control Register (MCR.REG, offset 4)
|
||||
* Modem Control Register (MCR.REG, offset 4; eg, 0x3FC or 0x2FC)
|
||||
*/
|
||||
SerialPort.MCR = {};
|
||||
SerialPort.MCR.REG = 4; // Modem Control Register
|
||||
|
|
@ -215,7 +218,7 @@ SerialPort.MCR.LOOPBACK = 0x10; // when set, enables loop-back mode
|
|||
SerialPort.MCR.UNUSED = 0xE0; // always zero
|
||||
|
||||
/*
|
||||
* Line Status Register (LSR.REG, offset 5)
|
||||
* Line Status Register (LSR.REG, offset 5; eg, 0x3FD or 0x2FD)
|
||||
*
|
||||
* NOTE: I've seen different specs for the LSR_TSRE. I'm following the IBM Tech Ref's lead here, but the data sheet I have calls it TEMT
|
||||
* instead of TSRE, and claims that it is set whenever BOTH the THR and TSR are empty, and clear whenever EITHER the THR or TSR contain data.
|
||||
|
|
@ -232,7 +235,7 @@ SerialPort.LSR.TSRE = 0x40; // Transmitter Shift Register Empty (set
|
|||
SerialPort.LSR.UNUSED = 0x80; // always zero
|
||||
|
||||
/*
|
||||
* Modem Status Register (MSR.REG, offset 6)
|
||||
* Modem Status Register (MSR.REG, offset 6; eg, 0x3FE or 0x2FE)
|
||||
*/
|
||||
SerialPort.MSR = {};
|
||||
SerialPort.MSR.REG = 6; // Modem Status Register
|
||||
|
|
@ -245,6 +248,11 @@ SerialPort.MSR.DSR = 0x20; // when set, the modem or data set is re
|
|||
SerialPort.MSR.RI = 0x40; // complement of the RI (Ring Indicator) input
|
||||
SerialPort.MSR.RLSD = 0x80; // complement of the RLSD (Received Line Signal Detect) input
|
||||
|
||||
/*
|
||||
* Scratch Register (SCR.REG, offset 7; eg, 0x3FF or 0x2FF)
|
||||
*/
|
||||
SerialPort.SCR = {REG: 7};
|
||||
|
||||
/**
|
||||
* attachMouse(id, mouse)
|
||||
*
|
||||
|
|
@ -718,7 +726,7 @@ SerialPort.prototype.echoByte = function(b) {
|
|||
*/
|
||||
SerialPort.prototype.messageDebugger = function(sMessage) {
|
||||
if (DEBUGGER && this.dbg) {
|
||||
if (this.dbg.messageEnabled(Debugger.MESSAGE_SERIAL)) {
|
||||
if (this.dbg.messageEnabled(Debugger.MESSAGE.SERIAL)) {
|
||||
this.dbg.message(sMessage);
|
||||
}
|
||||
}
|
||||
|
|
@ -738,7 +746,7 @@ SerialPort.prototype.messageDebugger = function(sMessage) {
|
|||
*/
|
||||
SerialPort.prototype.messagePort = function(port, bOut, addrFrom, name, bIn) {
|
||||
if (DEBUGGER && this.dbg) {
|
||||
this.dbg.messagePort(this, port, bOut, addrFrom, name, Debugger.MESSAGE_SERIAL, bIn);
|
||||
this.dbg.messagePort(this, port, bOut, addrFrom, name, Debugger.MESSAGE.SERIAL, bIn);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -381,7 +381,7 @@ State.prototype = {
|
|||
*/
|
||||
messageDebugger: function(sMessage) {
|
||||
if (DEBUGGER && this.dbg) {
|
||||
if (this.dbg.messageEnabled(Debugger.MESSAGE_STATE)) this.dbg.message(sMessage);
|
||||
if (this.dbg.messageEnabled(Debugger.MESSAGE.STATE)) this.dbg.message(sMessage);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1920,13 +1920,6 @@ Video.cardSpecs[Video.CARDS.MDA] = ["MDA", Card.MDA.CRTC.INDX.PORT, 0xB0000, 0x0
|
|||
Video.cardSpecs[Video.CARDS.CGA] = ["CGA", Card.CGA.CRTC.INDX.PORT, 0xB8000, 0x04000, 0, ChipSet.MONITOR.COLOR];
|
||||
Video.cardSpecs[Video.CARDS.EGA] = ["EGA", Card.CGA.CRTC.INDX.PORT, 0xB8000, 0x04000, 0x10000, ChipSet.MONITOR.EGACOLOR];
|
||||
|
||||
/*
|
||||
* BIOS video interrupts, modes, and other parameters
|
||||
*/
|
||||
Video.BIOS = {
|
||||
INT_VIDEO: 0x10
|
||||
};
|
||||
|
||||
/**
|
||||
* initBus(cmp, bus, cpu, dbg)
|
||||
*
|
||||
|
|
@ -1955,8 +1948,7 @@ Video.prototype.initBus = function(cmp, bus, cpu, dbg)
|
|||
|
||||
if (DEBUGGER && dbg) {
|
||||
var video = this;
|
||||
this.cpu.addIntNotify(Video.BIOS.INT_VIDEO, this, this.intBIOSVideo);
|
||||
dbg.messageDump(Debugger.MESSAGE_VIDEO, function onDumpVideo(sParm) {
|
||||
dbg.messageDump(Debugger.MESSAGE.VIDEO, function onDumpVideo(sParm) {
|
||||
video.dumpVideo(sParm);
|
||||
});
|
||||
}
|
||||
|
|
@ -1979,28 +1971,6 @@ Video.prototype.initBus = function(cmp, bus, cpu, dbg)
|
|||
if (this.kbd && this.fTouchScreen) this.captureTouch();
|
||||
};
|
||||
|
||||
/**
|
||||
* intBIOSVideo(addr)
|
||||
*
|
||||
* @this {Video}
|
||||
* @param {number} addr
|
||||
* @return {boolean} true to proceed with the INT 0x10 software interrupt, false to skip
|
||||
*/
|
||||
Video.prototype.intBIOSVideo = function(addr)
|
||||
{
|
||||
if (DEBUGGER) {
|
||||
if (this.dbg && this.dbg.messageEnabled(Debugger.MESSAGE_VIDEO | Debugger.MESSAGE_INT)) {
|
||||
this.dbg.messageInt(Video.BIOS.INT_VIDEO, addr);
|
||||
this.cpu.addIntReturn(addr, function (video, nCycles) {
|
||||
return function onBIOSVideoReturn(nLevel) {
|
||||
video.dbg.messageIntReturn(Video.BIOS.INT_VIDEO, nLevel, video.cpu.getCycles() - nCycles);
|
||||
};
|
||||
}(this, this.cpu.getCycles()));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
* setBinding(sHTMLClass, sHTMLType, sBinding, control)
|
||||
*
|
||||
|
|
@ -3742,7 +3712,7 @@ Video.prototype.updateChar = function(col, row, data, context)
|
|||
this.contextScreen.fillRect(xDst, yDst, this.cxScreenCell, this.cyScreenCell);
|
||||
}
|
||||
|
||||
if (MAXDEBUG && DEBUGGER && this.dbg && this.dbg.messageEnabled(Debugger.MESSAGE_VIDEO | Debugger.MESSAGE_LOG)) {
|
||||
if (MAXDEBUG && DEBUGGER && this.dbg && this.dbg.messageEnabled(Debugger.MESSAGE.VIDEO | Debugger.MESSAGE.LOG)) {
|
||||
this.log("updateCharBgnd(" + col + "," + row + "," + bChar + "): filled " + xDst + "," + yDst);
|
||||
}
|
||||
|
||||
|
|
@ -3753,7 +3723,7 @@ Video.prototype.updateChar = function(col, row, data, context)
|
|||
var xSrcFgnd = (bChar & 0xf) * font.cxCell;
|
||||
var ySrcFgnd = (bChar >> 4) * font.cyCell;
|
||||
|
||||
if (MAXDEBUG && DEBUGGER && this.dbg && this.dbg.messageEnabled(Debugger.MESSAGE_VIDEO | Debugger.MESSAGE_LOG)) {
|
||||
if (MAXDEBUG && DEBUGGER && this.dbg && this.dbg.messageEnabled(Debugger.MESSAGE.VIDEO | Debugger.MESSAGE.LOG)) {
|
||||
this.log("updateCharFgnd(" + col + "," + row + "," + bChar + "): draw from " + xSrcFgnd + "," + ySrcFgnd + " (" + font.cxCell + "," + font.cyCell + ") to " + xDst + "," + yDst);
|
||||
}
|
||||
|
||||
|
|
@ -4926,7 +4896,7 @@ Video.prototype.dumpVideo = function(sParm)
|
|||
Video.prototype.messageDebugger = function(sMessage, fForce)
|
||||
{
|
||||
if (DEBUGGER && this.dbg) {
|
||||
if (fForce || this.dbg.messageEnabled(Debugger.MESSAGE_VIDEO)) {
|
||||
if (fForce || this.dbg.messageEnabled(Debugger.MESSAGE.VIDEO)) {
|
||||
this.dbg.message(sMessage);
|
||||
}
|
||||
}
|
||||
|
|
@ -4947,7 +4917,7 @@ Video.prototype.messageDebugger = function(sMessage, fForce)
|
|||
Video.prototype.messagePort = function(port, bOut, addrFrom, name, bIn)
|
||||
{
|
||||
if (DEBUGGER && this.dbg) {
|
||||
this.dbg.messagePort(this, port, bOut, addrFrom, name, Debugger.MESSAGE_VIDEO, bIn);
|
||||
this.dbg.messagePort(this, port, bOut, addrFrom, name, Debugger.MESSAGE.VIDEO, bIn);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -922,12 +922,12 @@ X86CPU.prototype.checkIntNotify = function(nInt)
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (DEBUGGER && this.aFlags.fDebugCheck) {
|
||||
/*
|
||||
* Enabling MESSAGE_INT messages is one of the criteria that's also included in fDebugCheck,
|
||||
* so for maximum speed, we check fDebugCheck first.
|
||||
*/
|
||||
if (this.dbg.messageEnabled(Debugger.MESSAGE_INT) && this.dbg.messageInt(nInt, this.regEIP)) {
|
||||
/*
|
||||
* 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.aFlags.fDebugCheck) {
|
||||
if (this.dbg.messageEnabled(Debugger.MESSAGE.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);
|
||||
|
|
@ -2490,7 +2490,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.dbg && !this.dbg.messageEnabled(Debugger.MESSAGE_PIC)) this.opFlags |= X86.OPFLAG.NOINTR;
|
||||
if (!nMinCycles && this.dbg && !this.dbg.messageEnabled(Debugger.MESSAGE.PIC)) this.opFlags |= X86.OPFLAG.NOINTR;
|
||||
|
||||
do {
|
||||
var opPrefixes = this.opFlags & X86.OPFLAG.PREFIXES;
|
||||
|
|
@ -2597,7 +2597,7 @@ X86CPU.prototype.stepCPU = function(nMinCycles)
|
|||
X86CPU.prototype.messageDebugger = function(sMessage)
|
||||
{
|
||||
if (DEBUGGER && this.dbg) {
|
||||
if (this.dbg.messageEnabled(Debugger.MESSAGE_CPU)) {
|
||||
if (this.dbg.messageEnabled(Debugger.MESSAGE.CPU)) {
|
||||
this.dbg.message(sMessage);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -475,7 +475,7 @@ var X86Help = {
|
|||
/*
|
||||
* NOTE: By using Debugger.message(), we have the option of setting "m halt on" and halting on messages like this.
|
||||
*/
|
||||
if (this.dbg.messageEnabled(Debugger.MESSAGE_CPU)) {
|
||||
if (this.dbg.messageEnabled(Debugger.MESSAGE.CPU)) {
|
||||
this.dbg.message("Fault 0x" + str.toHexByte(nFault) + (nError != null? " (0x" + str.toHexWord(nError) + ")" : "") + " on opcode 0x" + str.toHexByte(this.bus.getByteDirect(this.regEIP)) + " at " + str.toHexAddr(this.regIP, this.segCS.sel));
|
||||
}
|
||||
if (fHalt) this.haltCPU();
|
||||
|
|
|
|||
Loading…
Reference in a new issue