Support for true physical memory aliases
This commit is contained in:
parent
bc153c3016
commit
7085b72fc4
28 changed files with 2185 additions and 2047 deletions
|
|
@ -3836,7 +3836,7 @@ C1PCPU.prototype.opSim = function()
|
|||
*
|
||||
* eg: %A for this.regA, %X for this.regX, etc
|
||||
*/
|
||||
s = s.replace(/%A/g, str.toHexByte(this.regA)).replace(/%X/g, str.toHexByte(this.regX)).replace(/%Y/g, str.toHexByte(this.regY));
|
||||
s = s.replace(/%A/g, str.toHex(this.regA, 2)).replace(/%X/g, str.toHex(this.regX, 2)).replace(/%Y/g, str.toHex(this.regY, 2));
|
||||
this.println(s);
|
||||
/*
|
||||
* To make printing "smoother", let's force a yield
|
||||
|
|
|
|||
|
|
@ -1238,14 +1238,14 @@ if (DEBUGGER) {
|
|||
*/
|
||||
C1PDebugger.prototype.getIns = function(addr, nIns)
|
||||
{
|
||||
var sLine = str.toHexWord(addr);
|
||||
var sLine = str.toHex(addr, 4);
|
||||
var bOpCode = this.getByte(addr++);
|
||||
var aOpDesc = this.aaOperations[bOpCode];
|
||||
var b = (bOpCode === undefined? 0 : bOpCode);
|
||||
var abOperand = [];
|
||||
var cb = (aOpDesc[1] === undefined? 0 : aOpDesc[1]);
|
||||
do {
|
||||
sLine += " " + str.toHexByte(b);
|
||||
sLine += " " + str.toHex(b, 2);
|
||||
if (!(cb--)) break;
|
||||
b = this.getByte(addr++);
|
||||
if (b === undefined) break;
|
||||
|
|
@ -1262,11 +1262,11 @@ if (DEBUGGER) {
|
|||
var bOpMode = aOpDesc[2];
|
||||
sOperand = this.aOpModes[bOpMode];
|
||||
if (aOpDesc[1] == 1 && bOpMode == this.MODE_DISP) {
|
||||
sOperand = sOperand.replace(/nnnn/, str.toHexWord(this.addSignedByte(addr, b = abOperand.pop())));
|
||||
sOperand = sOperand.replace(/nnnn/, str.toHex(this.addSignedByte(addr, b = abOperand.pop()), 4));
|
||||
}
|
||||
else {
|
||||
while (abOperand.length) {
|
||||
sOperand = sOperand.replace(/nn/, str.toHexByte(b = abOperand.pop()));
|
||||
sOperand = sOperand.replace(/nn/, str.toHex(b = abOperand.pop(), 2));
|
||||
}
|
||||
}
|
||||
if (bOpMode == this.MODE_IMM && aOpDesc[1] == 1) {
|
||||
|
|
@ -1374,7 +1374,7 @@ if (DEBUGGER) {
|
|||
for (i = 0; i < this.aaOperations.length; i++) {
|
||||
if (this.aaOperations[i][0] === iCode) {
|
||||
if (!cModes) this.println("supported opcodes:");
|
||||
this.println(" " + str.toHexByte(i) + ": " + sCode + (this.aaOperations[i][2] !== undefined? (" " + this.aOpModes[this.aaOperations[i][2]]) : ""));
|
||||
this.println(" " + str.toHex(i, 2) + ": " + sCode + (this.aaOperations[i][2] !== undefined? (" " + this.aOpModes[this.aaOperations[i][2]]) : ""));
|
||||
cModes++;
|
||||
}
|
||||
}
|
||||
|
|
@ -1491,12 +1491,12 @@ if (DEBUGGER) {
|
|||
*/
|
||||
C1PDebugger.prototype.getRegs = function()
|
||||
{
|
||||
return "A=" + str.toHexByte(this.cpu.regA) +
|
||||
" X=" + str.toHexByte(this.cpu.regX) +
|
||||
" Y=" + str.toHexByte(this.cpu.regY) +
|
||||
" P=" + str.toHexByte(this.cpu.getRegP()) +
|
||||
" S=" + str.toHexWord(this.cpu.regS) +
|
||||
" PC=" + str.toHexWord(this.cpu.regPC);
|
||||
return "A=" + str.toHex(this.cpu.regA, 2) +
|
||||
" X=" + str.toHex(this.cpu.regX, 2) +
|
||||
" Y=" + str.toHex(this.cpu.regY, 2) +
|
||||
" P=" + str.toHex(this.cpu.getRegP(), 2) +
|
||||
" S=" + str.toHex(this.cpu.regS, 4) +
|
||||
" PC=" + str.toHex(this.cpu.regPC, 4);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -1711,11 +1711,11 @@ if (DEBUGGER) {
|
|||
for (var i=0; i < 8 && addr < this.offLimit; i++) {
|
||||
var b = this.getByte(addr);
|
||||
if (b === undefined) b = 0;
|
||||
sBytes += str.toHexByte(b) + " ";
|
||||
sBytes += str.toHex(b, 2) + " ";
|
||||
sChars += (b >= 32 && b < 128? String.fromCharCode(b) : ".");
|
||||
addr++;
|
||||
}
|
||||
this.println(str.toHexWord(addrLine) + " " + sBytes + sChars);
|
||||
this.println(str.toHex(addrLine, 4) + " " + sBytes + sChars);
|
||||
}
|
||||
this.nextAddr = addr;
|
||||
};
|
||||
|
|
@ -2044,7 +2044,7 @@ if (DEBUGGER) {
|
|||
this.cpu.update();
|
||||
}
|
||||
this.println(this.getRegs());
|
||||
if (fIns) this.doIns(str.toHexWord(this.nextAddr = this.cpu.regPC));
|
||||
if (fIns) this.doIns(str.toHex(this.nextAddr = this.cpu.regPC, 4));
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -2103,7 +2103,7 @@ if (DEBUGGER) {
|
|||
{
|
||||
if (!sCmd.length) {
|
||||
if (dbg.fAssemble) {
|
||||
dbg.println("ended assemble @" + str.toHexWord(dbg.addrAssembleNext));
|
||||
dbg.println("ended assemble @" + str.toHex(dbg.addrAssembleNext, 4));
|
||||
dbg.nextAddr = dbg.addrAssembleNext;
|
||||
dbg.fAssemble = false;
|
||||
}
|
||||
|
|
@ -2114,7 +2114,7 @@ if (DEBUGGER) {
|
|||
if (dbg.isReady() && !dbg.isBusy(true) && sCmd.length > 0) {
|
||||
|
||||
if (dbg.fAssemble) {
|
||||
sCmd = "a " + str.toHexWord(dbg.addrAssembleNext) + " " + sCmd;
|
||||
sCmd = "a " + str.toHex(dbg.addrAssembleNext, 4) + " " + sCmd;
|
||||
}
|
||||
else if (sCmd.length > 1 && sCmd.indexOf(" ") != 1) {
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -202,7 +202,7 @@ C1PROM.prototype.copyImage = function()
|
|||
this.setError("ROM image size (" + str.toHexWord(cbImage) + ") does not match component-specified size (" + str.toHexWord(this.cbROM) + ")");
|
||||
return;
|
||||
}
|
||||
if (DEBUG) this.log("copyImage(): copying ROM to 0x" + str.toHexWord(this.offROM) + " (0x" + str.toHexWord(cbImage) + " bytes)");
|
||||
if (DEBUG) this.log("copyImage(): copying ROM to " + str.toHexWord(this.offROM) + " (" + str.toHexWord(cbImage) + " bytes)");
|
||||
for (var i=0; i < cbImage; i++) {
|
||||
this.abMem[this.offROM + i] = this.abImage[i];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -327,7 +327,7 @@ Bus.prototype.powerUp = function(data, fRepower)
|
|||
* Even so, Bus memory management does NOT provide a general-purpose heap. Most memory
|
||||
* allocations occur during machine initialization and never change. The only notable
|
||||
* exception is the Video frame buffer, which ranges from 4Kb (MDA) to 16Kb (CGA) to
|
||||
* 32Kb/64Kb/128Kb (EGA), and only the EGA changes the buffer address post-initialization.
|
||||
* 32Kb/64Kb/128Kb (EGA), and only the EGA changes its buffer address post-initialization.
|
||||
*
|
||||
* Each Memory block keeps track of a single address (addr) and length (used), indicating
|
||||
* the used space within the block; any free space that precedes or follows that used space
|
||||
|
|
@ -557,6 +557,51 @@ Bus.prototype.removeMemory = function(addr, size)
|
|||
return this.reportError(4, addr, size);
|
||||
};
|
||||
|
||||
/**
|
||||
* getMemoryBlocks(addr, size)
|
||||
*
|
||||
* @this {Bus}
|
||||
* @param {number} addr is the starting physical address
|
||||
* @param {number} size of the request, in bytes
|
||||
* @return {Array} of Memory blocks
|
||||
*/
|
||||
Bus.prototype.getMemoryBlocks = function(addr, size)
|
||||
{
|
||||
var aBlocks = [];
|
||||
var iBlock = addr >>> this.blockShift;
|
||||
while (size > 0 && iBlock < this.aMemBlocks.length) {
|
||||
aBlocks.push(this.aMemBlocks[iBlock++]);
|
||||
size -= this.blockSize;
|
||||
}
|
||||
return aBlocks;
|
||||
};
|
||||
|
||||
/**
|
||||
* setMemoryBlocks(addr, size, aBlocks, type)
|
||||
*
|
||||
* @this {Bus}
|
||||
* @param {number} addr is the starting physical address
|
||||
* @param {number} size of the request, in bytes
|
||||
* @param {Array} aBlocks as returned by getMemoryBlocks()
|
||||
* @param {number} [type] is one of the Memory.TYPE constants
|
||||
*/
|
||||
Bus.prototype.setMemoryBlocks = function(addr, size, aBlocks, type)
|
||||
{
|
||||
var i = 0;
|
||||
var iBlock = addr >>> this.blockShift;
|
||||
while (size > 0 && iBlock < this.aMemBlocks.length) {
|
||||
var block;
|
||||
if (type === undefined) {
|
||||
block = aBlocks[i++];
|
||||
} else {
|
||||
block = new Memory(addr);
|
||||
block.clone(aBlocks[i++], type);
|
||||
}
|
||||
this.aMemBlocks[iBlock++] = block;
|
||||
size -= this.blockSize;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* getByte(addr)
|
||||
*
|
||||
|
|
|
|||
|
|
@ -2195,7 +2195,7 @@ ChipSet.prototype.updateSwitchDesc = function()
|
|||
/*
|
||||
* TODO: Monitor type 0 used to be "No" (as in "No Monitor"), which was correct in the pre-EGA world,
|
||||
* but in the post-EGA world, it depends. We could ask the Video component for a definitive answer, but
|
||||
* but what we print here isn't that critical. Most people won't even bother with a Control Panel,
|
||||
* but what we print here isn't that critical, because most people won't bother with a Control Panel,
|
||||
* which is really the only beneficiary of this code.
|
||||
*/
|
||||
var asMonitorTypes = {
|
||||
|
|
@ -2228,7 +2228,7 @@ ChipSet.prototype.dumpPIC = function()
|
|||
var sDump = "PIC" + iPIC + ":";
|
||||
for (var i = 0; i < pic.aICW.length; i++) {
|
||||
var b = pic.aICW[i];
|
||||
sDump += " IC" + (i + 1) + "=" + str.toHexByte(b);
|
||||
sDump += " IC" + (i + 1) + '=' + str.toHexByte(b);
|
||||
}
|
||||
sDump += " IMR=" + str.toHexByte(pic.bIMR) + " IRR=" + str.toHexByte(pic.bIRR) + " ISR=" + str.toHexByte(pic.bISR) + " DELAY=" + pic.nDelay;
|
||||
this.dbg.println(sDump);
|
||||
|
|
@ -2272,7 +2272,7 @@ ChipSet.prototype.dumpCMOS = function()
|
|||
for (var iCMOS = 0; iCMOS < ChipSet.CMOS.ADDR.TOTAL; iCMOS++) {
|
||||
var b = (iCMOS <= ChipSet.CMOS.ADDR.STATUSD? this.getRTCByte(iCMOS) : this.abCMOSData[iCMOS]);
|
||||
if (sDump) sDump += '\n';
|
||||
sDump += "CMOS[0x" + str.toHexByte(iCMOS) + "]: 0x" + str.toHexByte(b);
|
||||
sDump += "CMOS[" + str.toHexByte(iCMOS) + "]: " + str.toHexByte(b);
|
||||
}
|
||||
this.dbg.println(sDump);
|
||||
}
|
||||
|
|
@ -3043,13 +3043,13 @@ ChipSet.prototype.outPICLo = function(iPIC, bOut, addrFrom)
|
|||
var nIRQ = (nIRL == null? undefined : pic.nIRQBase + nIRL);
|
||||
if (pic.bISR & bIREnd) {
|
||||
if (DEBUG && this.messageEnabled(this.messageBitsIRQ(nIRQ))) {
|
||||
this.printMessage("outPIC" + iPIC + "(0x" + str.toHexByte(pic.port) + "): IRQ " + nIRQ + " ending @" + this.dbg.hexOffset(this.cpu.getIP(), this.cpu.getCS()) + " stack=" + this.dbg.hexOffset(this.cpu.getSP(), this.cpu.getSS()), true);
|
||||
this.printMessage("outPIC" + iPIC + '(' + str.toHexByte(pic.port) + "): IRQ " + nIRQ + " ending @" + this.dbg.hexOffset(this.cpu.getIP(), this.cpu.getCS()) + " stack=" + this.dbg.hexOffset(this.cpu.getSP(), this.cpu.getSS()), true);
|
||||
}
|
||||
pic.bISR &= ~bIREnd;
|
||||
this.checkIRR();
|
||||
} else {
|
||||
if (DEBUG && this.messageEnabled(Messages.PIC | Messages.WARN)) {
|
||||
this.printMessage("outPIC" + iPIC + "(0x" + str.toHexByte(pic.port) + "): unexpected EOI command, IRQ " + nIRQ + " not in service", true);
|
||||
this.printMessage("outPIC" + iPIC + '(' + str.toHexByte(pic.port) + "): unexpected EOI command, IRQ " + nIRQ + " not in service", true);
|
||||
if (!SAMPLER && MAXDEBUG) this.dbg.stopCPU();
|
||||
}
|
||||
}
|
||||
|
|
@ -3057,7 +3057,7 @@ ChipSet.prototype.outPICLo = function(iPIC, bOut, addrFrom)
|
|||
* TODO: Support EOI commands with automatic rotation (eg, ChipSet.PIC_LO.OCW2_EOI_ROT and ChipSet.PIC_LO.OCW2_EOI_ROTSPEC)
|
||||
*/
|
||||
if (bOCW2 & ChipSet.PIC_LO.OCW2_SET_ROTAUTO) {
|
||||
this.notice("PIC" + iPIC + "(0x" + str.toHexByte(pic.port) + "): unsupported OCW2 rotate command: " + str.toHexByte(bOut));
|
||||
this.notice("PIC" + iPIC + '(' + str.toHexByte(pic.port) + "): unsupported OCW2 rotate command: " + str.toHexByte(bOut));
|
||||
this.cpu.stopCPU();
|
||||
}
|
||||
}
|
||||
|
|
@ -3071,7 +3071,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
|
||||
*/
|
||||
this.notice("PIC" + iPIC + "(0x" + str.toHexByte(pic.port) + "): unsupported OCW2 automatic EOI command: " + str.toHexByte(bOut));
|
||||
this.notice("PIC" + iPIC + '(' + str.toHexByte(pic.port) + "): unsupported OCW2 automatic EOI command: " + str.toHexByte(bOut));
|
||||
this.cpu.stopCPU();
|
||||
}
|
||||
} else {
|
||||
|
|
@ -3082,7 +3082,7 @@ ChipSet.prototype.outPICLo = function(iPIC, bOut, addrFrom)
|
|||
* that's unfortunate, because I don't support them yet.
|
||||
*/
|
||||
if (bOut & (ChipSet.PIC_LO.OCW3_POLL_CMD | ChipSet.PIC_LO.OCW3_SMM_CMD)) {
|
||||
this.notice("PIC" + iPIC + "(0x" + str.toHexByte(pic.port) + "): unsupported OCW3 command: " + str.toHexByte(bOut));
|
||||
this.notice("PIC" + iPIC + '(' + str.toHexByte(pic.port) + "): unsupported OCW3 command: " + str.toHexByte(bOut));
|
||||
this.cpu.stopCPU();
|
||||
}
|
||||
pic.bOCW3 = bOut;
|
||||
|
|
@ -4381,7 +4381,7 @@ ChipSet.prototype.set8042OutBuff = function(b)
|
|||
this.b8042Status &= ~ChipSet.KBC.STATUS.OUTBUFF_FULL;
|
||||
this.b8042Status |= ChipSet.KBC.STATUS.OUTBUFF_DELAY;
|
||||
if (DEBUG && this.messageEnabled(Messages.KEYBOARD | Messages.PORT)) {
|
||||
this.printMessage("set8042OutBuff(0x" + str.toHexByte(b) + ")", true);
|
||||
this.printMessage("set8042OutBuff(" + str.toHexByte(b) + ")", true);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -4513,12 +4513,12 @@ ChipSet.prototype.notifyKbdData = function(b)
|
|||
}
|
||||
else {
|
||||
if (DEBUG && this.messageEnabled(Messages.KEYBOARD | Messages.PORT)) {
|
||||
this.printMessage("notifyKbdData(0x" + str.toHexByte(b) + "): output buffer full", true);
|
||||
this.printMessage("notifyKbdData(" + str.toHexByte(b) + "): output buffer full", true);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (DEBUG && this.messageEnabled(Messages.KEYBOARD | Messages.PORT)) {
|
||||
this.printMessage("notifyKbdData(0x" + str.toHexByte(b) + "): disabled", true);
|
||||
this.printMessage("notifyKbdData(" + str.toHexByte(b) + "): disabled", true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1802,7 +1802,7 @@ if (DEBUGGER) {
|
|||
* at the moment. If that changes, then this will have to change as well.
|
||||
*/
|
||||
addr -= 2;
|
||||
this.message("INT 0x" + str.toHexByte(nInt) + ": AH=" + str.toHexByte(AH) + " @" + this.hexOffset(addr - this.cpu.segCS.base, this.cpu.getCS()) + sFunc);
|
||||
this.message("INT " + str.toHexByte(nInt) + ": AH=" + str.toHexByte(AH) + " @" + this.hexOffset(addr - this.cpu.segCS.base, this.cpu.getCS()) + sFunc);
|
||||
}
|
||||
return fMessage;
|
||||
};
|
||||
|
|
@ -1818,7 +1818,7 @@ if (DEBUGGER) {
|
|||
*/
|
||||
Debugger.prototype.messageIntReturn = function(nInt, nLevel, nCycles, sResult)
|
||||
{
|
||||
this.message("INT 0x" + str.toHexByte(nInt) + ": C=" + (this.cpu.getCF()? 1 : 0) + (sResult || "") + " (cycles=" + nCycles + (nLevel? ",level=" + (nLevel+1) : "") + ")");
|
||||
this.message("INT " + str.toHexByte(nInt) + ": C=" + (this.cpu.getCF()? 1 : 0) + (sResult || "") + " (cycles=" + nCycles + (nLevel? ",level=" + (nLevel+1) : "") + ")");
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -1842,7 +1842,7 @@ if (DEBUGGER) {
|
|||
segFrom = this.cpu.getCS();
|
||||
addrFrom -= this.cpu.segCS.base;
|
||||
}
|
||||
this.message(component.idComponent + "." + (bOut != null? "outPort" : "inPort") + "(0x" + str.toHexWord(port) + "," + (name? name : "unknown") + (bOut != null? ",0x" + str.toHexByte(bOut) : "") + ")" + (bIn != null? (": 0x" + str.toHexByte(bIn)) : "") + (addrFrom != null? (" @" + this.hexOffset(addrFrom, segFrom)) : ""));
|
||||
this.message(component.idComponent + "." + (bOut != null? "outPort" : "inPort") + '(' + str.toHexWord(port) + ',' + (name? name : "unknown") + (bOut != null? ',' + str.toHexByte(bOut) : "") + ")" + (bIn != null? (": " + str.toHexByte(bIn)) : "") + (addrFrom != null? (" @" + this.hexOffset(addrFrom, segFrom)) : ""));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -2319,7 +2319,7 @@ if (DEBUGGER) {
|
|||
Debugger.prototype.hexOffset = function(off, sel)
|
||||
{
|
||||
if (sel !== undefined) {
|
||||
return str.toHexWord(sel) + ":" + str.toHex(off, this.cchAddr < 8? 4 : 8);
|
||||
return str.toHex(sel, 4) + ":" + str.toHex(off, this.cchAddr < 8? 4 : 8);
|
||||
}
|
||||
return str.toHex(off);
|
||||
};
|
||||
|
|
@ -2552,7 +2552,7 @@ if (DEBUGGER) {
|
|||
{
|
||||
var b = 0xff;
|
||||
var addr = this.getAddr(aAddr, false, 0);
|
||||
if (addr != X86.ADDR_INVALID) {
|
||||
if (addr !== X86.ADDR_INVALID) {
|
||||
b = this.bus.getByteDirect(addr);
|
||||
this.assert((b == (b & 0xff)), "invalid byte (" + b + ") at address: " + this.hexAddr(aAddr));
|
||||
if (inc !== undefined) this.incAddr(aAddr, inc);
|
||||
|
|
@ -2572,7 +2572,7 @@ if (DEBUGGER) {
|
|||
{
|
||||
var w = 0xffff;
|
||||
var addr = this.getAddr(aAddr, false, 1);
|
||||
if (addr != X86.ADDR_INVALID) {
|
||||
if (addr !== X86.ADDR_INVALID) {
|
||||
w = this.bus.getShortDirect(addr);
|
||||
this.assert((w == (w & 0xffff)), "invalid word (" + w + ") at address: " + this.hexAddr(aAddr));
|
||||
if (inc !== undefined) this.incAddr(aAddr, inc);
|
||||
|
|
@ -2592,7 +2592,7 @@ if (DEBUGGER) {
|
|||
{
|
||||
var l = -1;
|
||||
var addr = this.getAddr(aAddr, false, 3);
|
||||
if (addr != X86.ADDR_INVALID) {
|
||||
if (addr !== X86.ADDR_INVALID) {
|
||||
l = this.bus.getLongDirect(addr);
|
||||
if (inc !== undefined) this.incAddr(aAddr, inc);
|
||||
}
|
||||
|
|
@ -2614,7 +2614,7 @@ if (DEBUGGER) {
|
|||
Debugger.prototype.setByte = function(aAddr, b, inc)
|
||||
{
|
||||
var addr = this.getAddr(aAddr, true, 0);
|
||||
if (addr != X86.ADDR_INVALID) {
|
||||
if (addr !== X86.ADDR_INVALID) {
|
||||
this.bus.setByteDirect(addr, b);
|
||||
if (inc !== undefined) this.incAddr(aAddr, inc);
|
||||
this.cpu.updateCPU();
|
||||
|
|
@ -2632,7 +2632,7 @@ if (DEBUGGER) {
|
|||
Debugger.prototype.setShort = function(aAddr, w, inc)
|
||||
{
|
||||
var addr = this.getAddr(aAddr, true, 1);
|
||||
if (addr != X86.ADDR_INVALID) {
|
||||
if (addr !== X86.ADDR_INVALID) {
|
||||
this.bus.setShortDirect(addr, w);
|
||||
if (inc !== undefined) this.incAddr(aAddr, inc);
|
||||
this.cpu.updateCPU();
|
||||
|
|
@ -2934,7 +2934,7 @@ if (DEBUGGER) {
|
|||
sOperand = this.getImmOperand(type, aAddr);
|
||||
}
|
||||
else if (typeMode == Debugger.TYPE_IMMOFF) {
|
||||
sOperand = "[" + str.toHexWord(this.getShort(aAddr, 2)) + "]";
|
||||
sOperand = "[" + str.toHex(this.getShort(aAddr, 2), 4) + "]";
|
||||
}
|
||||
else if (typeMode == Debugger.TYPE_IMMREL) {
|
||||
var disp;
|
||||
|
|
@ -2947,7 +2947,7 @@ if (DEBUGGER) {
|
|||
}
|
||||
var offset = (aAddr[0] + disp) & 0xffff;
|
||||
var aSymbol = this.findSymbolAtAddr(this.newAddr(offset, aAddr[1]));
|
||||
sOperand = aSymbol[0] || str.toHexWord(offset);
|
||||
sOperand = aSymbol[0] || str.toHex(offset, 4);
|
||||
}
|
||||
else if (typeMode == Debugger.TYPE_IMPREG) {
|
||||
sOperand = this.getRegOperand((type & Debugger.TYPE_IREG) >> 8, type, aAddr);
|
||||
|
|
@ -2972,7 +2972,7 @@ if (DEBUGGER) {
|
|||
var sLine = this.hexAddr(aAddrIns) + " ";
|
||||
var sBytes = "";
|
||||
do {
|
||||
sBytes += str.toHexByte(this.getByte(aAddrIns, 1));
|
||||
sBytes += str.toHex(this.getByte(aAddrIns, 1), 2);
|
||||
} while (aAddrIns[2] != aAddr[2]);
|
||||
sLine += (sBytes + " ").substr(0, 14);
|
||||
sLine += (sOpcode + " ").substr(0, 8);
|
||||
|
|
@ -3014,11 +3014,11 @@ if (DEBUGGER) {
|
|||
* or TYPE_OUT designation (and TYPE_BOTH, as the name implies, includes both).
|
||||
*/
|
||||
if (type & Debugger.TYPE_BOTH) {
|
||||
sOperand = str.toHexByte(this.getByte(aAddr, 1));
|
||||
sOperand = str.toHex(this.getByte(aAddr, 1), 2);
|
||||
}
|
||||
break;
|
||||
case Debugger.TYPE_SBYTE:
|
||||
sOperand = str.toHexWord((this.getByte(aAddr, 1) << 24) >> 24);
|
||||
sOperand = str.toHex((this.getByte(aAddr, 1) << 24) >> 24, 4);
|
||||
break;
|
||||
case Debugger.TYPE_WORDV:
|
||||
if (aAddr[4]) {
|
||||
|
|
@ -3027,7 +3027,7 @@ if (DEBUGGER) {
|
|||
}
|
||||
/* falls through */
|
||||
case Debugger.TYPE_WORD:
|
||||
sOperand = str.toHexWord(this.getShort(aAddr, 2));
|
||||
sOperand = str.toHex(this.getShort(aAddr, 2), 4);
|
||||
break;
|
||||
case Debugger.TYPE_FARP:
|
||||
sOperand = this.hexAddr(this.newAddr(this.getShort(aAddr, 2), this.getShort(aAddr, 2)));
|
||||
|
|
@ -3129,18 +3129,18 @@ if (DEBUGGER) {
|
|||
if (bMod == 1) {
|
||||
disp = this.getByte(aAddr, 1);
|
||||
if (!(disp & 0x80)) {
|
||||
sOperand += "+" + str.toHexByte(disp);
|
||||
sOperand += "+" + str.toHex(disp, 2);
|
||||
}
|
||||
else {
|
||||
disp = ((disp << 24) >> 24);
|
||||
sOperand += "-" + str.toHexByte(-disp);
|
||||
sOperand += "-" + str.toHex(-disp, 2);
|
||||
}
|
||||
}
|
||||
else if (bMod == 2) {
|
||||
if (sOperand) sOperand += '+';
|
||||
if (!aAddr[5]) {
|
||||
disp = this.getShort(aAddr, 2);
|
||||
sOperand += str.toHexWord(disp);
|
||||
sOperand += str.toHex(disp, 4);
|
||||
} else {
|
||||
disp = this.getLong(aAddr, 4);
|
||||
sOperand += str.toHex(disp);
|
||||
|
|
@ -3275,7 +3275,7 @@ if (DEBUGGER) {
|
|||
*/
|
||||
Debugger.prototype.getSegString = function(seg, fProt)
|
||||
{
|
||||
return seg.sName + '=' + str.toHexWord(seg.sel) + (fProt? '[' + str.toHex(seg.base, this.cchAddr) + ',' + str.toHex(seg.limit, (seg.limit & ~0xffff)? 8 : 4) + ']' : "");
|
||||
return seg.sName + '=' + str.toHex(seg.sel, 4) + (fProt? '[' + str.toHex(seg.base, this.cchAddr) + ',' + str.toHex(seg.limit, (seg.limit & ~0xffff)? 8 : 4) + ']' : "");
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -3290,7 +3290,7 @@ if (DEBUGGER) {
|
|||
*/
|
||||
Debugger.prototype.getDTRString = function(sName, sel, addr, addrLimit)
|
||||
{
|
||||
return sName + '=' + (sel != null? str.toHexWord(sel) : "") + '[' + str.toHex(addr, this.cchAddr) + ',' + str.toHexWord(addrLimit - addr) + ']';
|
||||
return sName + '=' + (sel != null? str.toHex(sel, 4) : "") + '[' + str.toHex(addr, this.cchAddr) + ',' + str.toHex(addrLimit - addr, 4) + ']';
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -3355,7 +3355,7 @@ if (DEBUGGER) {
|
|||
this.getSegString(this.cpu.segDS, fProt) + ' ' +
|
||||
this.getSegString(this.cpu.segES, fProt) + ' ';
|
||||
if (fProt) {
|
||||
var sTR = "TR=" + str.toHexWord(this.cpu.segTSS.sel);
|
||||
var sTR = "TR=" + str.toHex(this.cpu.segTSS.sel, 4);
|
||||
var sA20 = "A20=" + (this.bus.getA20()? "ON " : "OFF ");
|
||||
if (this.cpu.model < X86.MODEL_80386) {
|
||||
sTR = '\n' + sTR;
|
||||
|
|
@ -3982,11 +3982,11 @@ if (DEBUGGER) {
|
|||
var b = this.getByte(aAddr, 1);
|
||||
if (fWords) {
|
||||
if (i & 0x1) {
|
||||
sBytes += str.toHexWord(bPrev | (b << 8)) + (i == 7? " - " : " ");
|
||||
sBytes += str.toHex(bPrev | (b << 8), 4) + (i == 7? " - " : " ");
|
||||
}
|
||||
}
|
||||
else {
|
||||
sBytes += str.toHexByte(b) + (i == 7? "-" : " ");
|
||||
sBytes += str.toHex(b, 2) + (i == 7? "-" : " ");
|
||||
}
|
||||
sChars += (b >= 32 && b < 128? String.fromCharCode(b) : ".");
|
||||
bPrev = b;
|
||||
|
|
|
|||
|
|
@ -2149,7 +2149,7 @@ Disk.prototype.dumpSector = function(sector, pba, sDesc)
|
|||
for (var i = 0; i < cbSector; i++) {
|
||||
if ((i % 16) === 0) {
|
||||
if (sDump) sDump += sBytes + ' ' + sChars + '\n';
|
||||
sDump += str.toHexWord(i) + ": ";
|
||||
sDump += str.toHex(i, 4) + ": ";
|
||||
sBytes = sChars = "";
|
||||
}
|
||||
if ((i % 4) === 0) {
|
||||
|
|
@ -2158,7 +2158,7 @@ Disk.prototype.dumpSector = function(sector, pba, sDesc)
|
|||
}
|
||||
var b = dw & 0xff;
|
||||
dw >>>= 8;
|
||||
sBytes += str.toHexByte(b) + (i % 16 == 7? "-" : " ");
|
||||
sBytes += str.toHex(b, 2) + (i % 16 == 7? "-" : " ");
|
||||
sChars += (b >= 32 && b < 128? String.fromCharCode(b) : ".");
|
||||
}
|
||||
if (sBytes) sDump += sBytes + ' ' + sChars;
|
||||
|
|
|
|||
|
|
@ -1953,7 +1953,7 @@ FDC.prototype.doCmd = function()
|
|||
|
||||
default:
|
||||
if (DEBUG && this.messageEnabled()) {
|
||||
this.printMessage("FDC operation unsupported (command=0x: " + str.toHexByte(bCmd) + ")");
|
||||
this.printMessage("FDC operation unsupported (command=" + str.toHexByte(bCmd) + ")");
|
||||
this.dbg.stopCPU();
|
||||
}
|
||||
break;
|
||||
|
|
@ -2034,7 +2034,7 @@ FDC.prototype.popCmd = function(name)
|
|||
if (DEBUG && this.messageEnabled(Messages.PORT | Messages.FDC)) {
|
||||
var bCmdMasked = bCmd & FDC.REG_DATA.CMD.MASK;
|
||||
if (!name && !this.regDataIndex && FDC.aCmdInfo[bCmdMasked]) name = FDC.aCmdInfo[bCmdMasked].name;
|
||||
this.printMessage("FDC.CMD[" + (name || this.regDataIndex) + "]: 0x" + str.toHexByte(bCmd), true);
|
||||
this.printMessage("FDC.CMD[" + (name || this.regDataIndex) + "]: " + str.toHexByte(bCmd), true);
|
||||
}
|
||||
this.regDataIndex++;
|
||||
return bCmd;
|
||||
|
|
@ -2086,7 +2086,7 @@ FDC.prototype.beginResult = function()
|
|||
FDC.prototype.pushResult = function(bResult, name)
|
||||
{
|
||||
if (DEBUG && this.messageEnabled(Messages.PORT | Messages.FDC)) {
|
||||
this.printMessage("FDC.RES[" + (name || this.regDataTotal) + "]: 0x" + str.toHexByte(bResult), true);
|
||||
this.printMessage("FDC.RES[" + (name || this.regDataTotal) + "]: " + str.toHexByte(bResult), true);
|
||||
}
|
||||
this.regDataArray[this.regDataTotal++] = bResult;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1399,7 +1399,7 @@ HDC.prototype.inATCData = function(port, addrFrom)
|
|||
hdc.assert(!fAsync);
|
||||
if (BACKTRACK) {
|
||||
if (!off && obj.file && hdc.messageEnabled(Messages.DISK)) {
|
||||
hdc.printMessage("loading " + obj.file.sPath + '[' + obj.offFile + "] via port 0x" + str.toHexWord(port), true);
|
||||
hdc.printMessage("loading " + obj.file.sPath + '[' + obj.offFile + "] via port " + str.toHexWord(port), true);
|
||||
}
|
||||
/*
|
||||
* TODO: We could define a cached BTO that's reset prior to a new ATC command, and then pass that
|
||||
|
|
@ -1846,7 +1846,7 @@ HDC.prototype.doATC = function()
|
|||
}
|
||||
|
||||
if (DEBUG && this.messageEnabled(Messages.HDC)) {
|
||||
this.printMessage("HDC.doATC(0x" + str.toHexByte(bCmd) + "): " + HDC.aATCCommands[bCmd], true);
|
||||
this.printMessage("HDC.doATC(" + str.toHexByte(bCmd) + "): " + HDC.aATCCommands[bCmd], true);
|
||||
}
|
||||
|
||||
switch (bCmd & HDC.ATC.COMMAND.MASK) {
|
||||
|
|
@ -1931,7 +1931,7 @@ HDC.prototype.doATC = function()
|
|||
|
||||
default:
|
||||
if (DEBUG && this.messageEnabled()) {
|
||||
this.printMessage("HDC.doATC(0x" + str.toHexByte(this.regCommand) + "): " + (bCmd < 0? ("invalid drive (" + iDrive + ")") : "unsupported operation"));
|
||||
this.printMessage("HDC.doATC(" + str.toHexByte(this.regCommand) + "): " + (bCmd < 0? ("invalid drive (" + iDrive + ")") : "unsupported operation"));
|
||||
if (bCmd >= 0) this.dbg.stopCPU();
|
||||
}
|
||||
break;
|
||||
|
|
@ -2096,7 +2096,7 @@ HDC.prototype.doXTC = function()
|
|||
case HDC.XTC.DATA.CMD.RECALIBRATE: // 0x01
|
||||
drive.bControl = bControl;
|
||||
if (DEBUG && this.messageEnabled()) {
|
||||
this.printMessage("HDC.doXTC(): drive " + iDrive + " control byte: 0x" + str.toHexByte(bControl));
|
||||
this.printMessage("HDC.doXTC(): drive " + iDrive + " control byte: " + str.toHexByte(bControl));
|
||||
}
|
||||
this.beginResult(HDC.XTC.DATA.STATUS.OK | bDrive);
|
||||
break;
|
||||
|
|
@ -2134,7 +2134,7 @@ HDC.prototype.doXTC = function()
|
|||
default:
|
||||
this.beginResult(HDC.XTC.DATA.STATUS.ERROR | bDrive);
|
||||
if (DEBUG && this.messageEnabled()) {
|
||||
this.printMessage("HDC.doXTC(0x" + str.toHexByte(bCmdOrig) + "): " + (bCmd < 0? ("invalid drive (" + iDrive + ")") : "unsupported operation"));
|
||||
this.printMessage("HDC.doXTC(" + str.toHexByte(bCmdOrig) + "): " + (bCmd < 0? ("invalid drive (" + iDrive + ")") : "unsupported operation"));
|
||||
if (bCmd >= 0) this.dbg.stopCPU();
|
||||
}
|
||||
break;
|
||||
|
|
@ -2155,7 +2155,7 @@ HDC.prototype.popCmd = function()
|
|||
if (bCmdIndex < this.regDataTotal) {
|
||||
bCmd = this.regDataArray[this.regDataIndex++];
|
||||
if (DEBUG && this.messageEnabled((bCmdIndex > 0? Messages.PORT : 0) | Messages.HDC)) {
|
||||
this.printMessage("HDC.CMD[" + bCmdIndex + "]: 0x" + str.toHexByte(bCmd) + (!bCmdIndex && HDC.aXTCCommands[bCmd]? (" (" + HDC.aXTCCommands[bCmd] + ")") : ""), true);
|
||||
this.printMessage("HDC.CMD[" + bCmdIndex + "]: " + str.toHexByte(bCmd) + (!bCmdIndex && HDC.aXTCCommands[bCmd]? (" (" + HDC.aXTCCommands[bCmd] + ")") : ""), true);
|
||||
}
|
||||
}
|
||||
return bCmd;
|
||||
|
|
@ -2173,7 +2173,7 @@ HDC.prototype.beginResult = function(bResult)
|
|||
|
||||
if (bResult !== undefined) {
|
||||
if (DEBUG && this.messageEnabled()) {
|
||||
this.printMessage("HDC.beginResult(0x" + str.toHexByte(bResult) + ")");
|
||||
this.printMessage("HDC.beginResult(" + str.toHexByte(bResult) + ")");
|
||||
}
|
||||
this.pushResult(bResult);
|
||||
}
|
||||
|
|
@ -2195,7 +2195,7 @@ HDC.prototype.beginResult = function(bResult)
|
|||
HDC.prototype.pushResult = function(bResult)
|
||||
{
|
||||
if (DEBUG && this.messageEnabled((this.regDataTotal > 0? Messages.PORT : 0) | Messages.HDC)) {
|
||||
this.printMessage("HDC.RES[" + this.regDataTotal + "]: 0x" + str.toHexByte(bResult), true);
|
||||
this.printMessage("HDC.RES[" + this.regDataTotal + "]: " + str.toHexByte(bResult), true);
|
||||
}
|
||||
this.regDataArray[this.regDataTotal++] = bResult;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1254,7 +1254,7 @@ Keyboard.prototype.checkScanCode = function()
|
|||
b = this.abScanBuffer[0];
|
||||
if (this.chipset) this.chipset.notifyKbdData(b);
|
||||
}
|
||||
if (this.messageEnabled()) this.printMessage("scan code 0x" + str.toHexByte(b) + " available");
|
||||
if (this.messageEnabled()) this.printMessage("scan code " + str.toHexByte(b) + " available");
|
||||
return b;
|
||||
};
|
||||
|
||||
|
|
@ -1272,7 +1272,7 @@ Keyboard.prototype.readScanCode = function()
|
|||
if (this.abScanBuffer.length) {
|
||||
b = this.abScanBuffer[0];
|
||||
}
|
||||
if (this.messageEnabled()) this.printMessage("scan code 0x" + str.toHexByte(b) + " delivered");
|
||||
if (this.messageEnabled()) this.printMessage("scan code " + str.toHexByte(b) + " delivered");
|
||||
return b;
|
||||
};
|
||||
|
||||
|
|
@ -1480,7 +1480,7 @@ Keyboard.prototype.addScanCode = function(bScan)
|
|||
*/
|
||||
if (this.abScanBuffer) {
|
||||
if (this.abScanBuffer.length < Keyboard.LIMIT.MAX_SCANCODES) {
|
||||
if (this.messageEnabled()) this.printMessage("scan code 0x" + str.toHexByte(bScan) + " buffered");
|
||||
if (this.messageEnabled()) this.printMessage("scan code " + str.toHexByte(bScan) + " buffered");
|
||||
this.abScanBuffer.push(bScan);
|
||||
if (this.abScanBuffer.length == 1) {
|
||||
if (this.chipset) this.chipset.notifyKbdData(bScan);
|
||||
|
|
|
|||
|
|
@ -248,7 +248,7 @@ Memory.readNone = function readNone(off)
|
|||
Memory.writeNone = function writeNone(off, v)
|
||||
{
|
||||
if (DEBUGGER && this.dbg.messageEnabled(Messages.MEM) /* && !off */) {
|
||||
this.dbg.message("attempt to write 0x" + str.toHexWord(v) + " to invalid block %" + str.toHex(this.addr), true);
|
||||
this.dbg.message("attempt to write " + str.toHexWord(v) + " to invalid block %" + str.toHex(this.addr), true);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -780,6 +780,38 @@ if (TYPEDARRAYS) {
|
|||
Memory.prototype = {
|
||||
constructor: Memory,
|
||||
parent: null,
|
||||
/**
|
||||
* clone(mem, type)
|
||||
*
|
||||
* Converts the current Memory block (this) into a clone of the given Memory block (mem),
|
||||
* and optionally overrides the current block's type with the specified type.
|
||||
*
|
||||
* @this {Memory}
|
||||
* @param {Memory} mem
|
||||
* @param {number} [type]
|
||||
*/
|
||||
clone: function(mem, type) {
|
||||
this.size = mem.size;
|
||||
if (type) {
|
||||
this.type = type;
|
||||
this.fReadOnly = (type == Memory.TYPE.ROM);
|
||||
}
|
||||
if (TYPEDARRAYS) {
|
||||
this.buffer = mem.buffer;
|
||||
this.dv = mem.dv;
|
||||
this.ab = mem.ab;
|
||||
this.aw = mem.aw;
|
||||
this.adw = mem.adw;
|
||||
this.setAccess(littleEndian? Memory.afnLittleEndian : Memory.afnBigEndian);
|
||||
} else {
|
||||
if (FATARRAYS) {
|
||||
this.ab = mem.ab;
|
||||
} else {
|
||||
this.adw = mem.adw;
|
||||
}
|
||||
this.setAccess(Memory.afnMemory);
|
||||
}
|
||||
},
|
||||
/**
|
||||
* save()
|
||||
*
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ Color.prototype.randomize = function()
|
|||
*/
|
||||
Color.prototype.toString = function()
|
||||
{
|
||||
if (!this.sValue) this.sValue = '#' + str.toHexByte(this.rgb[0]) + str.toHexByte(this.rgb[1]) + str.toHexByte(this.rgb[2]);
|
||||
if (!this.sValue) this.sValue = '#' + str.toHex(this.rgb[0], 2) + str.toHex(this.rgb[1], 2) + str.toHex(this.rgb[2], 2);
|
||||
return this.sValue;
|
||||
};
|
||||
|
||||
|
|
@ -453,7 +453,7 @@ Panel.prototype.updateMouse = function(event, fDown)
|
|||
* Convert the mouse position into the corresponding memory address, assuming it's over the live memory area
|
||||
*/
|
||||
var addr = this.findAddress(x, y);
|
||||
if (addr != X86.ADDR_INVALID) {
|
||||
if (addr !== X86.ADDR_INVALID) {
|
||||
addr &= ~0xf;
|
||||
if (addr != this.addrDumpLast) {
|
||||
this.dumpMemory(addr, true);
|
||||
|
|
@ -644,7 +644,7 @@ Panel.prototype.findRegions = function()
|
|||
*/
|
||||
Panel.prototype.addRegion = function(addr, iBlock, cBlocks, type)
|
||||
{
|
||||
if (DEBUG) this.log("region " + this.stats.cRegions + " (addr " + str.toHex(addr) + ", type " + Memory.TYPE.NAMES[type] + ") contains " + cBlocks + " blocks");
|
||||
if (DEBUG) this.log("region " + this.stats.cRegions + " (addr " + str.toHexLong(addr) + ", type " + Memory.TYPE.NAMES[type] + ") contains " + cBlocks + " blocks");
|
||||
this.assert(iBlock <= Bus.BLOCK.NUM_MASK && cBlocks <= Bus.BLOCK.COUNT_MASK && type <= Bus.BLOCK.TYPE_MASK);
|
||||
return this.stats.aRegions[this.stats.cRegions++] = (iBlock | (cBlocks << Bus.BLOCK.COUNT_SHIFT) | (type << Bus.BLOCK.TYPE_SHIFT));
|
||||
};
|
||||
|
|
@ -730,12 +730,12 @@ Panel.prototype.dumpMemory = function(addr, fDraw)
|
|||
if (addr == null) {
|
||||
this.drawText("Mouse over memory to dump");
|
||||
} else {
|
||||
this.drawText("0x" + str.toHex(addr), null, 0, 1);
|
||||
this.drawText(str.toHexLong(addr), null, 0, 1);
|
||||
for (var iLine = 1; iLine <= 16; iLine++) {
|
||||
var sChars = "";
|
||||
for (var iCol = 1; iCol <= 8; iCol++) {
|
||||
var b = this.bus.getByteDirect(addr++);
|
||||
this.drawText(str.toHexByte(b), null, 1);
|
||||
this.drawText(str.toHex(b, 2), null, 1);
|
||||
sChars += (b >= 32 && b < 128? String.fromCharCode(b) : ".");
|
||||
}
|
||||
this.drawText(sChars, null, 0, 1);
|
||||
|
|
|
|||
|
|
@ -244,7 +244,7 @@ RAM.init = function()
|
|||
*
|
||||
* DeskPro 386 machines came with a minimum of 1Mb of RAM, which could be configured (via jumpers)
|
||||
* for 256Kb, 512Kb or 640Kb of conventional memory, starting at address 0x00000000, with the
|
||||
* remainder (768Kb, 512Kb, or 384Kb) accessible only at addresses just below 0x01000000. In PCjs,
|
||||
* remainder (768Kb, 512Kb, or 384Kb) accessible only at an address just below 0x01000000. In PCjs,
|
||||
* this second chunk of RAM must be separately allocated, with an ID of "ramCPQ".
|
||||
*
|
||||
* The typical configuration was 640Kb of conventional memory, leaving 384Kb accessible at 0x00FA0000.
|
||||
|
|
@ -254,7 +254,7 @@ RAM.init = function()
|
|||
* The DeskPro 386 also contained two memory-mapped registers at 0x80C00000. The first is a write-only
|
||||
* mapping register that provides the ability to map the 128Kb at 0x00FE0000 to 0x000E0000, replacing
|
||||
* any ROMs in the range 0x000E0000-0x000FFFFF, and optionally write-protecting that 128Kb; internally,
|
||||
* this register corresponds to bMapping.
|
||||
* this register corresponds to bMappings.
|
||||
*
|
||||
* The second register is a read-only diagnostics register that indicates jumper configuration and
|
||||
* parity errors; internally, this register corresponds to bSettings.
|
||||
|
|
@ -275,17 +275,21 @@ RAM.init = function()
|
|||
function CompaqController(ram)
|
||||
{
|
||||
this.ram = ram;
|
||||
this.bMapping = CompaqController.MAPPING.DEFAULT;
|
||||
this.bMappings = CompaqController.MAPPINGS.DEFAULT;
|
||||
this.bSettings = CompaqController.SETTINGS.BASE_640KB;
|
||||
this.aBlocksDst = null;
|
||||
}
|
||||
|
||||
CompaqController.ADDR = 0x80C00000;
|
||||
CompaqController.ADDR = 0x80C00000;
|
||||
CompaqController.MAP_SRC = 0x00FE0000;
|
||||
CompaqController.MAP_DST = 0x000E0000;
|
||||
CompaqController.MAP_SIZE = 0x00020000;
|
||||
|
||||
/*
|
||||
* Bit definitions for the 8-bit write-only memory-mapping register (bMapping)
|
||||
* Bit definitions for the 8-bit write-only memory-mapping register (bMappings)
|
||||
*/
|
||||
CompaqController.MAPPING = {
|
||||
NORELOC: 0x01, // is this bit is CLEAR, the last 128Kb (at 0x00FE0000) is relocated to 0x000E0000
|
||||
CompaqController.MAPPINGS = {
|
||||
UNMAPPED: 0x01, // is this bit is CLEAR, the last 128Kb (at 0x00FE0000) is mapped to 0x000E0000
|
||||
READWRITE: 0x02, // if this bit is CLEAR, the last 128Kb (at 0x00FE0000) is read-only (ie, write-protected)
|
||||
RESERVED: 0xFC, // the remaining 6 bits are reserved and should always be SET
|
||||
DEFAULT: 0xFF
|
||||
|
|
@ -324,11 +328,31 @@ CompaqController.readByte = function readCompaqControllerByte(off)
|
|||
*
|
||||
* @this {Memory}
|
||||
* @param {number} off
|
||||
* @param {number} b (which should already be pre-masked to 8 bits; see Bus.prototype.setByteDirect)
|
||||
* @param {number} b
|
||||
*/
|
||||
CompaqController.writeByte = function writeCompaqControllerByte(off, b)
|
||||
{
|
||||
this.controller.bMapping = b;
|
||||
var aBlocks;
|
||||
var controller = this.controller;
|
||||
var bus = controller.bus;
|
||||
if (b != controller.bMappings) {
|
||||
if (!(b & CompaqController.MAPPINGS.UNMAPPED)) {
|
||||
if (!controller.aBlocksDst) {
|
||||
controller.aBlocksDst = bus.getMemoryBlocks(CompaqController.MAP_DST, CompaqController.MAP_SIZE);
|
||||
}
|
||||
aBlocks = bus.getMemoryBlocks(CompaqController.MAP_SRC, CompaqController.MAP_SIZE);
|
||||
var type = (b & CompaqController.MAPPINGS.READWRITE)? Memory.TYPE.RAM : Memory.TYPE.ROM;
|
||||
bus.setMemoryBlocks(CompaqController.MAP_DST, CompaqController.MAP_SIZE, aBlocks, type);
|
||||
}
|
||||
else {
|
||||
if (controller.aBlocksDst) {
|
||||
bus.setMemoryBlocks(CompaqController.MAP_DST, CompaqController.MAP_SIZE, controller.aBlocksDst);
|
||||
controller.aBlocksDst = null;
|
||||
}
|
||||
}
|
||||
controller.bMappings = b;
|
||||
}
|
||||
if (DEBUG) this.cpu.stopCPU();
|
||||
};
|
||||
|
||||
CompaqController.ACCESS = [CompaqController.readByte, CompaqController.readByte, CompaqController.readByte,
|
||||
|
|
|
|||
|
|
@ -285,7 +285,7 @@ ROM.prototype.copyROM = function()
|
|||
* good idea to stop the machine in its tracks whenever a setError() occurs, but there may also be
|
||||
* times when we'd like to forge ahead anyway.
|
||||
*/
|
||||
this.setError("ROM size (0x" + str.toHex(this.abROM.length) + ") does not match specified size (0x" + str.toHex(this.sizeROM) + ")");
|
||||
this.setError("ROM size (" + str.toHexLong(this.abROM.length) + ") does not match specified size (" + str.toHexLong(this.sizeROM) + ")");
|
||||
}
|
||||
else if (this.addROM(this.addrROM)) {
|
||||
|
||||
|
|
@ -296,7 +296,7 @@ ROM.prototype.copyROM = function()
|
|||
aliases = this.addrAlias;
|
||||
}
|
||||
for (var i = 0; i < aliases.length; i++) {
|
||||
this.addROM(aliases[i]);
|
||||
this.cloneROM(aliases[i]);
|
||||
}
|
||||
/*
|
||||
* If there's a component we should notify, notify it now, and give it the internal byte array, so that
|
||||
|
|
@ -336,7 +336,7 @@ ROM.prototype.copyROM = function()
|
|||
ROM.prototype.addROM = function(addr)
|
||||
{
|
||||
if (this.bus.addMemory(addr, this.sizeROM, Memory.TYPE.ROM)) {
|
||||
if (DEBUG) this.log("addROM(): copying ROM to 0x" + str.toHex(addr) + " (0x" + str.toHex(this.abROM.length) + " bytes)");
|
||||
if (DEBUG) this.log("addROM(): copying ROM to " + str.toHexLong(addr) + " (" + str.toHexLong(this.abROM.length) + " bytes)");
|
||||
var bto = null;
|
||||
for (var off = 0; off < this.abROM.length; off++) {
|
||||
this.bus.setByteDirect(addr + off, this.abROM[off]);
|
||||
|
|
@ -353,6 +353,25 @@ ROM.prototype.addROM = function(addr)
|
|||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* cloneROM(addr)
|
||||
*
|
||||
* For ROMs with one or more alias addresses, we used to call addROM() for each address. However,
|
||||
* that obviously wasted memory, since each alias was an independent copy, and if you used the
|
||||
* Debugger to edit the ROM in one location, the changes would not appear in the other location(s).
|
||||
*
|
||||
* Now that the Bus component provides low-level getMemoryBlocks() and setMemoryBlocks() methods
|
||||
* to manually get and set the blocks of any memory range, it is now possible to create true aliases.
|
||||
*
|
||||
* @this {ROM}
|
||||
* @param {number} addr
|
||||
*/
|
||||
ROM.prototype.cloneROM = function(addr)
|
||||
{
|
||||
var aBlocks = this.bus.getMemoryBlocks(this.addrROM, this.sizeROM);
|
||||
this.bus.setMemoryBlocks(addr, this.sizeROM, aBlocks);
|
||||
};
|
||||
|
||||
/**
|
||||
* ROM.init()
|
||||
*
|
||||
|
|
|
|||
|
|
@ -738,6 +738,10 @@ SerialPort.prototype.updateIRR = function()
|
|||
if (bIIR >= 0) {
|
||||
this.bIIR &= ~(SerialPort.IIR.NO_INT | SerialPort.IIR.INT_BITS);
|
||||
this.bIIR |= bIIR;
|
||||
/*
|
||||
* TODO: Remove this arbitrary 100-instruction delay once we've added support for baud rate throttling
|
||||
* (see TODO above regarding baud rate).
|
||||
*/
|
||||
if (this.chipset && this.nIRQ) this.chipset.setIRR(this.nIRQ, 100);
|
||||
} else {
|
||||
this.bIIR |= SerialPort.IIR.NO_INT;
|
||||
|
|
|
|||
|
|
@ -3153,7 +3153,7 @@ Video.prototype.createFontColor = function(font, iColor, rgbColor, nDouble, offD
|
|||
/*
|
||||
* The colors for cell backgrounds and cursor elements must be converted to CSS color strings.
|
||||
*/
|
||||
font.aCSSColors[iColor] = "#" + str.toHexByte(rgbColor[0]) + str.toHexByte(rgbColor[1]) + str.toHexByte(rgbColor[2]);
|
||||
font.aCSSColors[iColor] = "#" + str.toHex(rgbColor[0], 2) + str.toHex(rgbColor[1], 2) + str.toHex(rgbColor[2], 2);
|
||||
font.aRGBColors[iColor] = rgbColor;
|
||||
|
||||
/*
|
||||
|
|
@ -3440,7 +3440,7 @@ Video.prototype.setAccess = function(nAccess)
|
|||
if (nAccess != null && card && nAccess != card.nAccess) {
|
||||
|
||||
if (DEBUG && this.messageEnabled()) {
|
||||
this.printMessage("setAccess(0x" + str.toHexWord(nAccess) + ")");
|
||||
this.printMessage("setAccess(" + str.toHexWord(nAccess) + ")");
|
||||
}
|
||||
|
||||
card.setMemoryAccess(nAccess);
|
||||
|
|
@ -3777,7 +3777,7 @@ Video.prototype.setMode = function(nMode, fForce)
|
|||
if (nMode != null && (nMode != this.nMode || fForce)) {
|
||||
|
||||
if (DEBUG && this.messageEnabled()) {
|
||||
this.printMessage("setMode(0x" + str.toHexWord(nMode) + (fForce? ",force" : "") + ")");
|
||||
this.printMessage("setMode(" + str.toHexWord(nMode) + (fForce? ",force" : "") + ")");
|
||||
}
|
||||
|
||||
this.cUpdates = 0; // count updateScreen() calls as a means of driving blink updates
|
||||
|
|
@ -3803,7 +3803,7 @@ Video.prototype.setMode = function(nMode, fForce)
|
|||
if (this.addrBuffer) {
|
||||
|
||||
if (DEBUG && this.messageEnabled()) {
|
||||
this.printMessage("setMode(" + nMode + "): removing 0x" + str.toHex(this.sizeBuffer) + " bytes from 0x" + str.toHex(this.addrBuffer));
|
||||
this.printMessage("setMode(" + nMode + "): removing " + str.toHexLong(this.sizeBuffer) + " bytes from " + str.toHexLong(this.addrBuffer));
|
||||
}
|
||||
|
||||
if (!this.bus.removeMemory(this.addrBuffer, this.sizeBuffer)) {
|
||||
|
|
@ -3822,7 +3822,7 @@ Video.prototype.setMode = function(nMode, fForce)
|
|||
this.sizeBuffer = card.sizeBuffer;
|
||||
|
||||
if (DEBUG && this.messageEnabled()) {
|
||||
this.printMessage("setMode(" + nMode + "): adding 0x" + str.toHex(this.sizeBuffer) + " bytes to 0x" + str.toHex(this.addrBuffer));
|
||||
this.printMessage("setMode(" + nMode + "): adding " + str.toHexLong(this.sizeBuffer) + " bytes to " + str.toHexLong(this.addrBuffer));
|
||||
}
|
||||
|
||||
var controller = (card === this.cardEGA? card : null);
|
||||
|
|
|
|||
|
|
@ -51,9 +51,9 @@ var X86 = {
|
|||
*
|
||||
* This value is also used to indicate non-existent EA address calculations, which are usually
|
||||
* detected with "regEA === ADDR_INVALID" and "regEAWrite === ADDR_INVALID" tests. In a 32-bit CPU,
|
||||
* -1 could actually be a valid address, so consider changing it to NaN or null; my concern is that,
|
||||
* by mixing non-numbers (specifically, values outside the range of 32-bit integers), performance
|
||||
* may suffer.
|
||||
* -1 (ie, 0xffffffff) could actually be a valid address, so consider changing it to NaN or null;
|
||||
* my concern is that, by mixing non-numbers (specifically, values outside the range of signed 32-bit
|
||||
* integers), performance may suffer.
|
||||
*/
|
||||
ADDR_INVALID: -1,
|
||||
|
||||
|
|
@ -343,50 +343,51 @@ var X86 = {
|
|||
CS: 0x2E, // opCS()
|
||||
SS: 0x36, // opSS()
|
||||
DS: 0x3E, // opDS()
|
||||
PUSHSP: 0x54,
|
||||
PUSHA: 0x60, // 80186 and up
|
||||
POPA: 0x61, // 80186 and up
|
||||
BOUND: 0x62, // 80186 and up
|
||||
ARPL: 0x63, // 80286 and up
|
||||
FS: 0x64, // 80386 and up
|
||||
GS: 0x65, // 80386 and up
|
||||
OS: 0x66, // 80386 and up
|
||||
AS: 0x67, // 80386 and up
|
||||
PUSH16: 0x68, // 80186 and up
|
||||
IMUL16: 0x69, // 80186 and up
|
||||
PUSH8: 0x6A, // 80186 and up
|
||||
IMUL8: 0x6B, // 80186 and up
|
||||
INSB: 0x6C, // 80186 and up
|
||||
INSW: 0x6D, // 80186 and up
|
||||
OUTSB: 0x6E, // 80186 and up
|
||||
OUTSW: 0x6F, // 80186 and up
|
||||
ENTER: 0xC8, // 80186 and up
|
||||
LEAVE: 0xC9, // 80186 and up
|
||||
CALLF: 0x9A, // opCALLf()
|
||||
PUSHSP: 0x54, // opPUSHSP()
|
||||
PUSHA: 0x60, // opPUHSA() (80186 and up)
|
||||
POPA: 0x61, // opPOPA() (80186 and up)
|
||||
BOUND: 0x62, // opBOUND() (80186 and up)
|
||||
ARPL: 0x63, // opARPL() (80286 and up)
|
||||
FS: 0x64, // opFS() (80386 and up)
|
||||
GS: 0x65, // opGS() (80386 and up)
|
||||
OS: 0x66, // opOS() (80386 and up)
|
||||
AS: 0x67, // opAS() (80386 and up)
|
||||
PUSH16: 0x68, // opPUSH16() (80186 and up)
|
||||
IMUL16: 0x69, // opIMUL16() (80186 and up)
|
||||
PUSH8: 0x6A, // opPUSH8() (80186 and up)
|
||||
IMUL8: 0x6B, // opIMUL8() (80186 and up)
|
||||
INSB: 0x6C, // opINSb() (80186 and up)
|
||||
INSW: 0x6D, // opINSw() (80186 and up)
|
||||
OUTSB: 0x6E, // opOUTSb() (80186 and up)
|
||||
OUTSW: 0x6F, // opOUTSw() (80186 and up)
|
||||
ENTER: 0xC8, // opENTER() (80186 and up)
|
||||
LEAVE: 0xC9, // opLEAVE() (80186 and up)
|
||||
CALLF: 0x9A, // opCALLF()
|
||||
MOVSB: 0xA4, // opMOVSb()
|
||||
MOVSW: 0xA5, // opMOVSw()
|
||||
CMPSB: 0xA6,
|
||||
CMPSW: 0xA7,
|
||||
STOSB: 0xAA,
|
||||
STOSW: 0xAB,
|
||||
LODSB: 0xAC,
|
||||
LODSW: 0xAD,
|
||||
SCASB: 0xAE,
|
||||
SCASW: 0xAF,
|
||||
INT3: 0xCC,
|
||||
INTn: 0xCD,
|
||||
INTO: 0xCE,
|
||||
LOOPNZ: 0xE0,
|
||||
LOOPZ: 0xE1,
|
||||
LOOP: 0xE2,
|
||||
CALL: 0xE8,
|
||||
JMP: 0xE9, // JMP opcode (2-byte displacement)
|
||||
JMPS: 0xEB, // JMP opcode (1-byte displacement)
|
||||
LOCK: 0xF0,
|
||||
REPNZ: 0xF2,
|
||||
REPZ: 0xF3,
|
||||
CALLW: 0x10FF,
|
||||
CALLDW: 0x18FF,
|
||||
CMPSB: 0xA6, // opCMPSb()
|
||||
CMPSW: 0xA7, // opCMPSw()
|
||||
STOSB: 0xAA, // opSTOSb()
|
||||
STOSW: 0xAB, // opSTOSw()
|
||||
LODSB: 0xAC, // opLODSb()
|
||||
LODSW: 0xAD, // opLODSw()
|
||||
SCASB: 0xAE, // opSCASb()
|
||||
SCASW: 0xAF, // opSCASw()
|
||||
INT3: 0xCC, // opINT3()
|
||||
INTn: 0xCD, // opINTn()
|
||||
INTO: 0xCE, // opINTO()
|
||||
LOOPNZ: 0xE0, // opLOOPNZ()
|
||||
LOOPZ: 0xE1, // opLOOPZ()
|
||||
LOOP: 0xE2, // opLOOP()
|
||||
CALL: 0xE8, // opCALL()
|
||||
JMP: 0xE9, // opJMP() (2-byte displacement)
|
||||
JMPF: 0xEA, // opJMPF()
|
||||
JMPS: 0xEB, // opJMPs() (1-byte displacement)
|
||||
LOCK: 0xF0, // opLOCK()
|
||||
REPNZ: 0xF2, // opREPNZ()
|
||||
REPZ: 0xF3, // opREPZ()
|
||||
CALLW: 0x10FF, // fnCALLw()
|
||||
CALLDW: 0x18FF, // fnCALLFdw()
|
||||
UD2: 0x0B0F // UD2 (invalid opcode "guaranteed" to generate UD_FAULT on all post-8086 processors)
|
||||
}
|
||||
};
|
||||
|
|
@ -413,8 +414,6 @@ X86.PS.CACHED = (X86.PS.CF | X86.PS.PF | X86.PS.AF | X86.PS.ZF | X86.PS.SF | X86
|
|||
* These are the default "always set" PS bits for the 8086/8088; other processors must
|
||||
* adjust these bits accordingly. The final adjusted value is then stored in the X86CPU
|
||||
* object as "this.PS_SET"; setPS() must use that value, NOT this one.
|
||||
*
|
||||
* TODO: Verify that PS.BIT1 was always set on reset, even on the 8086/8088.
|
||||
*/
|
||||
X86.PS.SET = (X86.PS.BIT1 | X86.PS.IOPL.MASK | X86.PS.NT | X86.PS.BIT15);
|
||||
|
||||
|
|
|
|||
|
|
@ -843,8 +843,9 @@ X86CPU.prototype.reset = function()
|
|||
*
|
||||
* We've elected to set DX to 0x0304 on a reset, which is consistent with a 80386-C0, since we have no desire to
|
||||
* try to emulate all the bugs in older (eg, B1) steppings. At least not initially. We leave stepping-accurate
|
||||
* emulation for another day. It's also known that the B1 reported 0x0303 in DX, but other than the B1 and C0
|
||||
* steppings, it's not known exactly what other revision numbers Intel used in 80386 CPUs.
|
||||
* emulation for another day. It's also known that the B1 (and possibly B0) reported 0x0303 in DX, and that
|
||||
* the D0 stepping reported 0x0305; beyond that, it's not known exactly what revision numbers Intel used for
|
||||
* other 80386 CPUs.
|
||||
*
|
||||
* We define some additional "registers", such as regLIP. which mirrors the linear address corresponding to
|
||||
* CS:IP (the address of the next opcode byte). In fact, regLIP functions as our internal IP register, so any
|
||||
|
|
@ -889,18 +890,18 @@ X86CPU.prototype.resetRegs = function()
|
|||
|
||||
/*
|
||||
* NOTE: Even though the 8086 doesn't have CR0 (aka MSW) and IDTR, we initialize them for ALL CPUs, so
|
||||
* that functions like X86.fnINT() can use the same code for both. The 8086/8088 have no direct
|
||||
* way of accessing or changing them, so this internal change should be perfectly safe for those processors.
|
||||
* that functions like X86.fnINT() can use the same code for both. The 8086/8088 have no direct way
|
||||
* of accessing or changing them, so this is an implementation detail those processors are unaware of.
|
||||
*/
|
||||
this.regCR0 = X86.CR0.MSW.ON;
|
||||
this.addrIDT = 0; this.addrIDTLimit = 0x03FF;
|
||||
this.regPS = this.nIOPL = 0; // these should be set before the first setPS() call
|
||||
|
||||
/*
|
||||
* Define all the result registers that setPS() relies on for arithmetic and logical flags.
|
||||
* Define all the result registers that can be used to "cache" arithmetic and logical flags.
|
||||
*
|
||||
* In addition, setPS() will initialize resultType, which keeps track of which flags are cached
|
||||
* and the size of the result; initially, none are cached.
|
||||
* In addition, setPS() will initialize resultType, which keeps track of which flags are cached,
|
||||
* and resultSize, which maintains the size of the last result; initially, no flags are cached.
|
||||
*/
|
||||
this.resultDst = this.resultSrc = this.resultArith = this.resultLogic = 0;
|
||||
|
||||
|
|
@ -913,7 +914,7 @@ X86CPU.prototype.resetRegs = function()
|
|||
|
||||
/*
|
||||
* Segment registers used to be defined as separate variables (eg, regCS and regCS0 stored the segment
|
||||
* number and base physical address, respectively), but all segment registers are now defined as X86Seg objects.
|
||||
* number and base physical address, respectively), but segment registers are now defined as X86Seg objects.
|
||||
*/
|
||||
this.segCS = new X86Seg(this, X86Seg.ID.CODE, "CS");
|
||||
this.segDS = new X86Seg(this, X86Seg.ID.DATA, "DS");
|
||||
|
|
@ -1654,7 +1655,7 @@ X86CPU.prototype.setCSIP = function(off, sel, fCall)
|
|||
*/
|
||||
this.regEIP = off;
|
||||
var base = this.segCS.load(sel);
|
||||
if (base != X86.ADDR_INVALID) {
|
||||
if (base !== X86.ADDR_INVALID) {
|
||||
this.regLIP = base + this.regEIP;
|
||||
this.regLIPLimit = base + this.segCS.limit;
|
||||
if (I386) this.resetSizes();
|
||||
|
|
|
|||
|
|
@ -2161,7 +2161,7 @@ X86.fnVERW = function VERW(dst, src)
|
|||
* src would contain AH, and we would return src, which the caller would then store in AL, and we'd be done.
|
||||
*
|
||||
* However, that's only half of what XCHG does, so THIS function must perform the other half; in the previous
|
||||
* example, that entails storing AL (dst) into AH (src).
|
||||
* example, that means storing the original AL (dst) into AH (src).
|
||||
*
|
||||
* BACKTRACK support is incomplete without also passing bti values as parameters, because the caller will
|
||||
* store btiAH in btiAL, but the original btiAL will be lost. Similarly, if src is a memory operand, the
|
||||
|
|
@ -2233,7 +2233,7 @@ X86.fnXCHGrb = function XCHGRb(dst, src)
|
|||
* src would contain DX, and we would return src, which the caller would then store in AX, and we'd be done.
|
||||
*
|
||||
* However, that's only half of what XCHG does, so THIS function must perform the other half; in the previous
|
||||
* example, that entails storing AX (dst) into DX (src).
|
||||
* example, that means storing the original AX (dst) into DX (src).
|
||||
*
|
||||
* TODO: Implement full BACKTRACK support for XCHG instructions (see fnXCHGrb comments).
|
||||
*
|
||||
|
|
@ -2341,8 +2341,7 @@ X86.fnXORd = function XORd(dst, src)
|
|||
*
|
||||
* NOTE: Although I've yet to find confirmation of this for the 8086/8088, OF is undefined on modern x86 CPUs
|
||||
* for shift counts > 1 (in fact, on modern CPUs, OF tends to be clear in those situations). Since I set OF the
|
||||
* same way for all shift counts, my well-defined behavior may or may not match the 8086/8088, but until I see a
|
||||
* defined behavior (or more importantly, some dependency on a different behavior), this seems good enough.
|
||||
* same way for all shift counts, my well-defined behavior may or may not match Intel's undefined behavior.
|
||||
*
|
||||
* @this {X86CPU}
|
||||
* @param {number} result
|
||||
|
|
@ -2540,7 +2539,7 @@ X86.fnFaultMessage = function(nFault, nError, fHalt)
|
|||
* and so whenever we see that opcode, we ignore the caller's fHalt flag, and suppress FAULT messages
|
||||
* unless CPU messages are also enabled.
|
||||
*
|
||||
* When a triple fault shows up, nFault is -1; it displays as "ff" because we display nFault as a byte.
|
||||
* When a triple fault shows up, nFault is -1; it displays as 0xff only because we use toHexByte().
|
||||
*/
|
||||
if (bOpcode == X86.OPCODE.INT3) {
|
||||
fHalt = false;
|
||||
|
|
@ -2550,7 +2549,7 @@ X86.fnFaultMessage = function(nFault, nError, fHalt)
|
|||
/*
|
||||
* Similarly, the PC AT ROM BIOS deliberately generates a couple of GP faults as part of the POST
|
||||
* (Power-On Self Test); we don't want to ignore those, but we don't want to halt on them either. We
|
||||
* detect those faults by virtue of the LIP being in the range %0F0000 to %0FFFFF.
|
||||
* detect those faults by virtue of the LIP being in the range 0x0F0000 to 0x0FFFFF.
|
||||
*/
|
||||
if (this.regLIP >= 0x0F0000 && this.regLIP <= 0x0FFFFF) {
|
||||
fHalt = false;
|
||||
|
|
@ -2565,7 +2564,7 @@ X86.fnFaultMessage = function(nFault, nError, fHalt)
|
|||
}
|
||||
|
||||
if (this.messageEnabled(bitsMessage) || fHalt) {
|
||||
var sMessage = (fHalt? '\n' : '') + "Fault " + str.toHexByte(nFault) + (nError != null? " (" + str.toHexWord(nError) + ")" : "") + " on opcode 0x" + str.toHexByte(bOpcode) + " at " + this.dbg.hexOffset(this.getIP(), this.getCS()) + " (%" + str.toHex(this.regLIP, 6) + ")";
|
||||
var sMessage = (fHalt? '\n' : '') + "Fault " + str.toHexByte(nFault) + (nError != null? " (" + str.toHexWord(nError) + ")" : "") + " on opcode " + str.toHexByte(bOpcode) + " at " + this.dbg.hexOffset(this.getIP(), this.getCS()) + " (%" + str.toHex(this.regLIP, 6) + ")";
|
||||
var fRunning = this.aFlags.fRunning;
|
||||
if (this.printMessage(sMessage, bitsMessage)) {
|
||||
if (fHalt) {
|
||||
|
|
|
|||
|
|
@ -4093,7 +4093,7 @@ X86.opInvalid = function()
|
|||
X86.opUndefined = function()
|
||||
{
|
||||
this.setIP(this.opLIP - this.segCS.base);
|
||||
this.setError("Undefined opcode 0x" + str.toHexByte(this.bus.getByteDirect(this.regLIP)) + " at 0x" + str.toHex(this.regLIP));
|
||||
this.setError("Undefined opcode " + str.toHexByte(this.bus.getByteDirect(this.regLIP)) + " at " + str.toHexLong(this.regLIP));
|
||||
this.stopCPU();
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -415,7 +415,7 @@ X86Seg.switchTSS = function switchTSS(selNew, fNest)
|
|||
}
|
||||
cpu.setShort(cpu.segTSS.addrDesc + X86.DESC.ACC.OFFSET, (cpu.segTSS.acc & ~X86.DESC.ACC.TYPE.TSS_BUSY) | X86.DESC.ACC.TYPE.TSS);
|
||||
}
|
||||
if (cpu.segTSS.load(selNew) == X86.ADDR_INVALID) {
|
||||
if (cpu.segTSS.load(selNew) === X86.ADDR_INVALID) {
|
||||
return false;
|
||||
}
|
||||
var addrNew = cpu.segTSS.base;
|
||||
|
|
@ -649,7 +649,7 @@ X86Seg.prototype.loadDesc8 = function(addrDesc, sel, fSuppress)
|
|||
* TODO: Verify the PRESENT bit of the gate descriptor, and issue NP_FAULT as appropriate.
|
||||
*/
|
||||
cplPrev = this.cpl;
|
||||
if (this.load(selCode, true) == X86.ADDR_INVALID) {
|
||||
if (this.load(selCode, true) === X86.ADDR_INVALID) {
|
||||
cpu.assert(false);
|
||||
base = X86.ADDR_INVALID;
|
||||
break;
|
||||
|
|
@ -909,7 +909,7 @@ X86Seg.prototype.messageSeg = function(sel, base, limit, acc, ext)
|
|||
if (this.id == X86Seg.ID.CODE) sDPL += " cpl=" + this.cpl;
|
||||
this.dbg.message("loadSeg(" + this.sName + "):" + ch + "sel=" + str.toHexWord(sel) + " base=" + str.toHex(base) + " limit=" + str.toHexWord(limit) + " acc=" + str.toHexWord(acc) + sDPL);
|
||||
}
|
||||
this.cpu.assert(/* base != X86.ADDR_INVALID && */ (this.cpu.model >= X86.MODEL_80386 || !ext || ext == X86.DESC.EXT.AVAIL));
|
||||
this.cpu.assert(/* base !== X86.ADDR_INVALID && */ (this.cpu.model >= X86.MODEL_80386 || !ext || ext == X86.DESC.EXT.AVAIL));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -143,27 +143,40 @@ str.toHex = function(n, cch)
|
|||
/**
|
||||
* toHexByte(b)
|
||||
*
|
||||
* Alias for toHex(b, 2)
|
||||
* Alias for "0x" + str.toHex(b, 2)
|
||||
*
|
||||
* @param {number|undefined} b is a byte value
|
||||
* @return {string} the hex representation of b
|
||||
*/
|
||||
str.toHexByte = function(b)
|
||||
{
|
||||
return str.toHex(b, 2);
|
||||
return "0x" + str.toHex(b, 2);
|
||||
};
|
||||
|
||||
/**
|
||||
* toHexWord(w)
|
||||
*
|
||||
* Alias for toHex(w, 4)
|
||||
* Alias for "0x" + str.toHex(w, 4)
|
||||
*
|
||||
* @param {number|undefined} w is a word (16-bit) value
|
||||
* @return {string} the hex representation of w
|
||||
*/
|
||||
str.toHexWord = function(w)
|
||||
{
|
||||
return str.toHex(w, 4);
|
||||
return "0x" + str.toHex(w, 4);
|
||||
};
|
||||
|
||||
/**
|
||||
* toHexLong(l)
|
||||
*
|
||||
* Alias for "0x" + toHex(l)
|
||||
*
|
||||
* @param {number|undefined} l is a dword (32-bit) value
|
||||
* @return {string} the hex representation of w
|
||||
*/
|
||||
str.toHexLong = function(l)
|
||||
{
|
||||
return "0x" + str.toHex(l);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue