Debugger tweaks for FDC and HDC
This commit is contained in:
parent
1809543577
commit
3850850fd0
5 changed files with 279 additions and 294 deletions
|
|
@ -942,16 +942,13 @@ ChipSet.prototype.initBus = function(cmp, bus, cpu, dbg)
|
|||
if (dbg) {
|
||||
var chipset = this;
|
||||
dbg.messageInit(ChipSet);
|
||||
dbg.messageDump(ChipSet.MESSAGE_PIC, function onDumpPIC()
|
||||
{
|
||||
dbg.messageDump(ChipSet.MESSAGE_PIC, function onDumpPIC() {
|
||||
chipset.dumpPIC();
|
||||
});
|
||||
dbg.messageDump(ChipSet.MESSAGE_TIMER, function onDumpTimer()
|
||||
{
|
||||
dbg.messageDump(ChipSet.MESSAGE_TIMER, function onDumpTimer() {
|
||||
chipset.dumpTimer();
|
||||
});
|
||||
dbg.messageDump(ChipSet.MESSAGE_CMOS, function onDumpCMOS()
|
||||
{
|
||||
dbg.messageDump(ChipSet.MESSAGE_CMOS, function onDumpCMOS() {
|
||||
chipset.dumpCMOS();
|
||||
});
|
||||
}
|
||||
|
|
@ -4252,15 +4249,11 @@ ChipSet.prototype.setSpeaker = function(fOn)
|
|||
ChipSet.prototype.messageDebugger = function(sMessage, bitsMessage, nIRQ)
|
||||
{
|
||||
if (DEBUGGER && this.dbg) {
|
||||
if (bitsMessage == null) {
|
||||
bitsMessage = ChipSet.MESSAGE_CHIPSET;
|
||||
}
|
||||
if (bitsMessage == null) bitsMessage = ChipSet.MESSAGE_CHIPSET;
|
||||
if (nIRQ !== undefined) {
|
||||
bitsMessage |= (nIRQ == ChipSet.IRQ.TIMER0? ChipSet.MESSAGE_TIMER : (nIRQ == ChipSet.IRQ.KBD? ChipSet.MESSAGE_KBD : (nIRQ == ChipSet.IRQ.FDC? ChipSet.MESSAGE_FDC : 0)));
|
||||
}
|
||||
if (this.dbg.messageEnabled(bitsMessage)) {
|
||||
this.dbg.message(sMessage);
|
||||
}
|
||||
if (this.dbg.messageEnabled(bitsMessage)) this.dbg.message(sMessage);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -4283,9 +4276,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 = ChipSet.MESSAGE_CHIPSET;
|
||||
}
|
||||
if (bitsMessage == null) bitsMessage = ChipSet.MESSAGE_CHIPSET;
|
||||
this.dbg.messagePort(this, port, bOut, addrFrom, name, bitsMessage, bIn);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -553,7 +553,10 @@ 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 (DEBUGGER) {
|
||||
if (dbg) dbg.messageInit(FDC);
|
||||
cpu.addIntNotify(FDC.BIOS.INT_DISKETTE, this, this.intBIOSDiskette);
|
||||
}
|
||||
|
||||
if (!this.autoMount()) this.setReady();
|
||||
};
|
||||
|
|
@ -1810,7 +1813,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((this.regDataIndex > 0? this.dbg.MESSAGE_PORT : 0) | this.dbg.MESSAGE_FDC)) {
|
||||
if (DEBUG && DEBUGGER && this.dbg && this.dbg.messageEnabled((this.regDataIndex > 0? FDC.MESSAGE_PORT : 0) | FDC.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));
|
||||
|
|
@ -1864,7 +1867,7 @@ FDC.prototype.beginResult = function()
|
|||
*/
|
||||
FDC.prototype.pushResult = function(bResult, name)
|
||||
{
|
||||
if (DEBUG && DEBUGGER && this.dbg && this.dbg.messageEnabled(this.dbg.MESSAGE_PORT | this.dbg.MESSAGE_FDC)) this.dbg.message("FDC.RES[" + (name || this.regDataTotal) + "]: 0x" + str.toHexByte(bResult));
|
||||
if (DEBUG) this.messageDebugger("FDC.RES[" + (name || this.regDataTotal) + "]: 0x" + str.toHexByte(bResult), FDC.MESSAGE_PORT | FDC.MESSAGE_FDC);
|
||||
this.regDataArray[this.regDataTotal++] = bResult;
|
||||
};
|
||||
|
||||
|
|
@ -2043,8 +2046,6 @@ FDC.prototype.doFormat = function(drive)
|
|||
{
|
||||
drive.resCode = FDC.REG_DATA.RES.NOT_READY | FDC.REG_DATA.RES.INCOMPLETE;
|
||||
|
||||
//if (DEBUG) this.messageDebugger("doFormat()");
|
||||
|
||||
if (drive.disk) {
|
||||
drive.sector = null;
|
||||
drive.resCode = FDC.REG_DATA.RES.NONE;
|
||||
|
|
@ -2254,7 +2255,7 @@ FDC.prototype.intBIOSDiskette = function(addr)
|
|||
{
|
||||
if (DEBUGGER) {
|
||||
var DL = this.cpu.regDX & 0xff;
|
||||
if (this.dbg && this.dbg.messageEnabled(this.dbg.MESSAGE_FDC) && DL < 0x80) {
|
||||
if (this.dbg && (this.dbg.messageEnabled(FDC.MESSAGE_FDC) || this.dbg.messageEnabled(FDC.MESSAGE_INT)) && DL < 0x80) {
|
||||
this.dbg.messageInt(FDC.BIOS.INT_DISKETTE, addr);
|
||||
this.cpu.addIntReturn(addr, function(fdc, nCycles) {
|
||||
return function onBIOSDisketteReturn(nLevel) {
|
||||
|
|
@ -2267,19 +2268,19 @@ FDC.prototype.intBIOSDiskette = function(addr)
|
|||
};
|
||||
|
||||
/**
|
||||
* messageDebugger(sMessage)
|
||||
* messageDebugger(sMessage, bitsMessage)
|
||||
*
|
||||
* This is a combination of the Debugger's messageEnabled(MESSAGE_FDC) and message() functions, for convenience.
|
||||
*
|
||||
* @this {FDC}
|
||||
* @param {string} sMessage is any caller-defined message string
|
||||
* @param {number} [bitsMessage] is one or more Debugger MESSAGE_* category flag(s)
|
||||
*/
|
||||
FDC.prototype.messageDebugger = function(sMessage)
|
||||
FDC.prototype.messageDebugger = function(sMessage, bitsMessage)
|
||||
{
|
||||
if (DEBUGGER && this.dbg) {
|
||||
if (this.dbg.messageEnabled(this.dbg.MESSAGE_FDC)) {
|
||||
this.dbg.message(sMessage);
|
||||
}
|
||||
if (bitsMessage == null) bitsMessage = FDC.MESSAGE_FDC;
|
||||
if (this.dbg.messageEnabled(bitsMessage)) this.dbg.message(sMessage);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -2297,9 +2298,7 @@ FDC.prototype.messageDebugger = function(sMessage)
|
|||
*/
|
||||
FDC.prototype.messagePort = function(port, bOut, addrFrom, name, bIn)
|
||||
{
|
||||
if (DEBUGGER && this.dbg) {
|
||||
this.dbg.messagePort(this, port, bOut, addrFrom, name, this.dbg.MESSAGE_FDC, bIn);
|
||||
}
|
||||
if (DEBUGGER && this.dbg) this.dbg.messagePort(this, port, bOut, addrFrom, name, FDC.MESSAGE_FDC, bIn);
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -527,6 +527,7 @@ HDC.prototype.initBus = function(cmp, bus, cpu, dbg)
|
|||
bus.addPortOutputTable(this, this.fATC? HDC.aATCPortOutput : HDC.aXTCPortOutput);
|
||||
|
||||
if (DEBUGGER) {
|
||||
if (dbg) dbg.messageInit(HDC);
|
||||
cpu.addIntNotify(HDC.BIOS.INT_DISK, this, this.intBIOSDisk);
|
||||
cpu.addIntNotify(HDC.BIOS.INT_DISKETTE, this, this.intBIOSDiskette);
|
||||
}
|
||||
|
|
@ -1747,9 +1748,7 @@ HDC.prototype.doATCommand = function()
|
|||
this.drive = drive;
|
||||
}
|
||||
|
||||
if (DEBUG && DEBUGGER && this.dbg && this.dbg.messageEnabled(this.dbg.MESSAGE_PORT | this.dbg.MESSAGE_HDC)) {
|
||||
this.dbg.message("HDC.doATCommand(" + str.toHexByte(bCmd) + "): " + HDC.aATCCommands[bCmd]);
|
||||
}
|
||||
if (DEBUG) this.messageDebugger("HDC.doATCommand(" + str.toHexByte(bCmd) + "): " + HDC.aATCCommands[bCmd], HDC.MESSAGE_PORT | HDC.MESSAGE_HDC);
|
||||
|
||||
switch (bCmd & HDC.ATC.COMMAND.MASK) {
|
||||
|
||||
|
|
@ -1835,7 +1834,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(this.dbg.MESSAGE_HDC) && bCmd >= 0) this.cpu.haltCPU();
|
||||
if (DEBUG && DEBUGGER && this.dbg && this.dbg.messageEnabled(HDC.MESSAGE_HDC) && bCmd >= 0) this.cpu.haltCPU();
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -1992,7 +1991,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(this.dbg.MESSAGE_HDC) && bCmd >= 0) this.cpu.haltCPU();
|
||||
if (DEBUG && DEBUGGER && this.dbg && this.dbg.messageEnabled(HDC.MESSAGE_HDC) && bCmd >= 0) this.cpu.haltCPU();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -2010,9 +2009,7 @@ HDC.prototype.popCmd = function()
|
|||
var bCmdIndex = this.regDataIndex;
|
||||
if (bCmdIndex < this.regDataTotal) {
|
||||
bCmd = this.regDataArray[this.regDataIndex++];
|
||||
if (DEBUG && DEBUGGER && this.dbg && this.dbg.messageEnabled((bCmdIndex > 0? this.dbg.MESSAGE_PORT : 0) | this.dbg.MESSAGE_HDC)) {
|
||||
this.dbg.message("HDC.CMD[" + bCmdIndex + "]: 0x" + str.toHexByte(bCmd) + (!bCmdIndex && HDC.aXTCCommands[bCmd]? (" (" + HDC.aXTCCommands[bCmd] + ")") : ""));
|
||||
}
|
||||
if (DEBUG) this.messageDebugger("HDC.CMD[" + bCmdIndex + "]: 0x" + str.toHexByte(bCmd) + (!bCmdIndex && HDC.aXTCCommands[bCmd]? (" (" + HDC.aXTCCommands[bCmd] + ")") : ""), (bCmdIndex > 0? HDC.MESSAGE_PORT : 0) | HDC.MESSAGE_HDC);
|
||||
}
|
||||
return bCmd;
|
||||
};
|
||||
|
|
@ -2048,7 +2045,7 @@ HDC.prototype.beginResult = function(bResult)
|
|||
*/
|
||||
HDC.prototype.pushResult = function(bResult)
|
||||
{
|
||||
if (DEBUG && DEBUGGER && this.dbg && this.dbg.messageEnabled((this.regDataTotal > 0? this.dbg.MESSAGE_PORT : 0) | this.dbg.MESSAGE_HDC)) this.dbg.message("HDC.RES[" + this.regDataTotal + "]: 0x" + str.toHexByte(bResult));
|
||||
if (DEBUG) this.messageDebugger("HDC.RES[" + this.regDataTotal + "]: 0x" + str.toHexByte(bResult), (this.regDataTotal > 0? HDC.MESSAGE_PORT : 0) | HDC.MESSAGE_HDC);
|
||||
this.regDataArray[this.regDataTotal++] = bResult;
|
||||
};
|
||||
|
||||
|
|
@ -2580,7 +2577,7 @@ HDC.prototype.intBIOSDisk = function(addr)
|
|||
var DL = this.cpu.regDX & 0xff;
|
||||
if (!AH && DL > 0x80) this.iDriveAllowFail = DL - 0x80;
|
||||
if (DEBUGGER) {
|
||||
if (this.dbg && this.dbg.messageEnabled(this.dbg.MESSAGE_HDC) && DL >= 0x80) {
|
||||
if (this.dbg && (this.dbg.messageEnabled(HDC.MESSAGE_HDC) || this.dbg.messageEnabled(HDC.MESSAGE_INT)) && DL >= 0x80) {
|
||||
this.dbg.messageInt(HDC.BIOS.INT_DISK, addr);
|
||||
this.cpu.addIntReturn(addr, function (hdc, nCycles) {
|
||||
return function onBIOSDiskReturn(nLevel) {
|
||||
|
|
@ -2632,19 +2629,19 @@ HDC.prototype.intBIOSDiskette = function(addr)
|
|||
};
|
||||
|
||||
/**
|
||||
* messageDebugger(sMessage)
|
||||
* messageDebugger(sMessage, bitsMessage)
|
||||
*
|
||||
* This is a combination of the Debugger's messageEnabled(MESSAGE_HDC) and message() functions, for convenience.
|
||||
*
|
||||
* @this {HDC}
|
||||
* @param {string} sMessage is any caller-defined message string
|
||||
* @param {number} [bitsMessage] is one or more Debugger MESSAGE_* category flag(s)
|
||||
*/
|
||||
HDC.prototype.messageDebugger = function(sMessage)
|
||||
HDC.prototype.messageDebugger = function(sMessage, bitsMessage)
|
||||
{
|
||||
if (DEBUGGER && this.dbg) {
|
||||
if (this.dbg.messageEnabled(this.dbg.MESSAGE_HDC)) {
|
||||
this.dbg.message(sMessage);
|
||||
}
|
||||
if (bitsMessage == null) bitsMessage = HDC.MESSAGE_HDC;
|
||||
if (this.dbg.messageEnabled(bitsMessage)) this.dbg.message(sMessage);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -2662,9 +2659,7 @@ HDC.prototype.messageDebugger = function(sMessage)
|
|||
*/
|
||||
HDC.prototype.messagePort = function(port, bOut, addrFrom, name, bIn)
|
||||
{
|
||||
if (DEBUGGER && this.dbg) {
|
||||
this.dbg.messagePort(this, port, bOut, addrFrom, name, this.dbg.MESSAGE_HDC, bIn);
|
||||
}
|
||||
if (DEBUGGER && this.dbg) this.dbg.messagePort(this, port, bOut, addrFrom, name, HDC.MESSAGE_HDC, bIn);
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -910,11 +910,19 @@ X86CPU.prototype.addIntNotify = function(nInt, component, fn)
|
|||
*/
|
||||
X86CPU.prototype.checkIntNotify = function(nInt)
|
||||
{
|
||||
/*
|
||||
* Enabling MESSAGE_INT messages is one of the criteria that's also included in fDebugCheck, so for maximum
|
||||
* speed, check fDebugCheck first.
|
||||
*/
|
||||
if (DEBUGGER && this.fDebugCheck) {
|
||||
var aNotify = this.aIntNotify[nInt];
|
||||
if (aNotify !== undefined) {
|
||||
for (var i = 0; i < aNotify.length; i++) {
|
||||
if (!aNotify[i][1].call(aNotify[i][0], this.regEIP)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (DEBUGGER && this.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(this.dbg.MESSAGE_INT)) {
|
||||
this.dbg.messageInt(nInt, this.regEIP);
|
||||
this.addIntReturn(this.regEIP, function(cpu, nCycles) {
|
||||
|
|
@ -924,14 +932,6 @@ X86CPU.prototype.checkIntNotify = function(nInt)
|
|||
}(this, this.getCycles()));
|
||||
}
|
||||
}
|
||||
var aNotify = this.aIntNotify[nInt];
|
||||
if (aNotify !== undefined) {
|
||||
for (var i = 0; i < aNotify.length; i++) {
|
||||
if (!aNotify[i][1].call(aNotify[i][0], this.regEIP)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue