Cleaned up DMA port handling and minor tweaks
This commit is contained in:
parent
b063387357
commit
158cc65da3
16 changed files with 453 additions and 175 deletions
|
|
@ -326,7 +326,7 @@ ChipSet.aMonitorSwitches = {
|
|||
* For FDC DMA notes, refer to http://wiki.osdev.org/ISA_DMA
|
||||
* For general DMA notes, refer to http://www.freebsd.org/doc/en/books/developers-handbook/dma.html
|
||||
*
|
||||
* TODO: Determine why the MODEL_5150 ROM BIOS sets the page register for channel 1 (port 0x83) to zero
|
||||
* TODO: Determine why the MODEL_5150 ROM BIOS sets the DMA channel 1 page register (port 0x83) to zero
|
||||
*/
|
||||
ChipSet.DMA0 = {
|
||||
INDEX: 0,
|
||||
|
|
@ -359,7 +359,7 @@ ChipSet.DMA1 = {
|
|||
CH6_PAGE: 0x89, // OUT: DMA channel 6 page register (MODEL_5170)
|
||||
CH7_PAGE: 0x8A, // OUT: DMA channel 7 page register (MODEL_5170)
|
||||
CH5_PAGE: 0x8B, // OUT: DMA channel 5 page register (MODEL_5170)
|
||||
CH4_PAGE: 0x8F, // OUT: DMA channel 4 page register (MODEL_5170; unusable; aka "refresh" page register?)
|
||||
CH4_PAGE: 0x8F, // OUT: DMA channel 4 page register (MODEL_5170; unusable; aka "Refresh" page register?)
|
||||
CH4_ADDR: 0xC0, // OUT: starting address IN: current address
|
||||
CH4_COUNT: 0xC2, // OUT: starting word count IN: remaining word count
|
||||
CH5_ADDR: 0xC4, // OUT: starting address IN: current address
|
||||
|
|
@ -890,22 +890,54 @@ ChipSet.CMOS = {
|
|||
};
|
||||
|
||||
/*
|
||||
* Manufacturing Test Ports (MODEL_5170)
|
||||
* DMA Page Registers
|
||||
*
|
||||
* The MODEL_5170 TechRef lists 0x80-0x9F as the range for DMA page registers, but that seems a bit
|
||||
* overbroad; at one point, it says:
|
||||
* The MODEL_5170 TechRef lists 0x80-0x9F as the range for DMA page registers, but that may be a bit
|
||||
* overbroad. There are a total of 8 (7 usable) DMA channels on the MODEL_5170, each of which has the
|
||||
* following assigned DMA page registers:
|
||||
*
|
||||
* Channel # Page Reg
|
||||
* --------- --------
|
||||
* 0 0x87
|
||||
* 1 0x83
|
||||
* 2 0x81
|
||||
* 3 0x82
|
||||
* 4 0x8F (not usable; the 5170 TechRef refers to this as the "Refresh" page register)
|
||||
* 5 0x8B
|
||||
* 6 0x89
|
||||
* 7 0x8A
|
||||
*
|
||||
* That leaves 0x80, 0x84, 0x85, 0x86, 0x88, 0x8C, 0x8D and 0x8E unaccounted for in the range 0x80-0x8F.
|
||||
* (I'm saving the question of what, if anything, is available in the range 0x90-0x9F for another day.)
|
||||
*
|
||||
* As for port 0x80, the TechRef says:
|
||||
*
|
||||
* "I/O address hex 080 is used as a diagnostic-checkpoint port or register.
|
||||
* This port corresponds to a read/write register in the DMA page register (74LS6I2)."
|
||||
* This port corresponds to a read/write register in the DMA page register (74LS612)."
|
||||
*
|
||||
* 0x80 is the neighborhood, but that particular port is not documented as a DMA page register.
|
||||
* We'll refer to it as a "manufacturing port" (see bMFGData). Be aware that the MODEL_5170 BIOS is
|
||||
* littered with manufacturing test ("MFG_TST") code which, if enabled, writes to other DMA page
|
||||
* registers, presumably treating them as scratch registers.
|
||||
* so I used to have dedicated handlers and storage (bMFGData) for the register at port 0x80, but I've since
|
||||
* appended it to abDMAPageSpare, an 8-element array that captures all I/O to the 8 unassigned (aka "spare")
|
||||
* DMA page registers. The 5170 BIOS uses 0x80 as a "checkpoint" register, and the DESKPRO386 uses 0x84 in a
|
||||
* similar fashion. The 5170 also contains "MFG_TST" code that uses other unassigned DMA page registers as
|
||||
* scratch registers, which come in handy when RAM hasn't been tested/initialized yet.
|
||||
*
|
||||
* Here's our mapping of entries in the abDMAPageSpare array to the unassigned ("spare") DMA page registers:
|
||||
*
|
||||
* Index # Page Reg
|
||||
* -------- --------
|
||||
* 0 0x84
|
||||
* 1 0x85
|
||||
* 2 0x86
|
||||
* 3 0x88
|
||||
* 4 0x8C
|
||||
* 5 0x8D
|
||||
* 6 0x8E
|
||||
* 7 0x80
|
||||
*
|
||||
* The only reason port 0x80 is out of sequence (ie, at the end of the array, at index 7 instead of index 0) is
|
||||
* because it was added the array later, and the entire array gets written to our save/restore data structures, so
|
||||
* reordering the elements would be a bad idea.
|
||||
*/
|
||||
ChipSet.MFG = { // this.bMFGData
|
||||
PORT: 0x80
|
||||
};
|
||||
|
||||
/*
|
||||
* NMI Mask Register (MODEL_5150 and MODEL_5160 only)
|
||||
|
|
@ -1125,8 +1157,7 @@ ChipSet.prototype.reset = function(fHard)
|
|||
|
||||
this.b8042OutPort = ChipSet.KBC.OUTPORT.NO_RESET | ChipSet.KBC.OUTPORT.A20_ON;
|
||||
|
||||
this.bMFGData = 0;
|
||||
this.abDMAPageSpare = new Array(7);
|
||||
this.abDMAPageSpare = new Array(8);
|
||||
|
||||
this.bCMOSAddr = 0; // NMI is enabled, since the ChipSet.CMOS.ADDR.NMI_DISABLE bit is not set in bCMOSAddr
|
||||
|
||||
|
|
@ -1679,7 +1710,7 @@ ChipSet.prototype.save = function()
|
|||
if (this.model >= ChipSet.MODEL_5170) {
|
||||
state.set(5, [this.b8042Status, this.b8042InBuff, this.b8042CmdData,
|
||||
this.b8042OutBuff, this.b8042InPort, this.b8042OutPort]);
|
||||
state.set(6, [this.bMFGData, this.abDMAPageSpare, this.bCMOSAddr, this.abCMOSData, this.nRTCCyclesLastUpdate, this.nRTCCyclesNextUpdate]);
|
||||
state.set(6, [this.abDMAPageSpare[7], this.abDMAPageSpare, this.bCMOSAddr, this.abCMOSData, this.nRTCCyclesLastUpdate, this.nRTCCyclesNextUpdate]);
|
||||
}
|
||||
return state.data();
|
||||
};
|
||||
|
|
@ -1739,8 +1770,8 @@ ChipSet.prototype.restore = function(data)
|
|||
a = data[6];
|
||||
if (a) {
|
||||
this.assert(this.model >= ChipSet.MODEL_5170);
|
||||
this.bMFGData = a[0];
|
||||
this.abDMAPageSpare = a[1];
|
||||
this.abDMAPageSpare[7] = a[0]; // formerly bMFGData
|
||||
this.bCMOSAddr = a[2];
|
||||
this.abCMOSData = a[3];
|
||||
this.nRTCCyclesLastUpdate = a[4];
|
||||
|
|
@ -2675,7 +2706,11 @@ ChipSet.prototype.inDMAPageSpare = function(iSpare, port, addrFrom)
|
|||
*/
|
||||
ChipSet.prototype.outDMAPageSpare = function(iSpare, port, bOut, addrFrom)
|
||||
{
|
||||
if (this.messageEnabled(Messages.DMA | Messages.PORT)) {
|
||||
/*
|
||||
* TODO: Remove the DEBUG-only DESKPRO386 code once we're done debugging DeskPro 386 ROMs;
|
||||
* it enables logging of all DeskPro ROM checkpoint I/O to port 0x84.
|
||||
*/
|
||||
if (this.messageEnabled(Messages.DMA | Messages.PORT) || DEBUG && this.model == ChipSet.MODEL_DESKPRO386 && port == 0x84) {
|
||||
this.printMessageIO(port, bOut, addrFrom, "DMA.SPARE" + iSpare + ".PAGE", null, true);
|
||||
}
|
||||
this.abDMAPageSpare[iSpare] = bOut;
|
||||
|
|
@ -4680,34 +4715,6 @@ ChipSet.prototype.outCMOSData = function(port, bOut, addrFrom)
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* inMFGData(port, addrFrom)
|
||||
*
|
||||
* @this {ChipSet}
|
||||
* @param {number} port (0x80)
|
||||
* @param {number} [addrFrom] (not defined if the Debugger is trying to read the specified port)
|
||||
* @return {number} simulated port value
|
||||
*/
|
||||
ChipSet.prototype.inMFGData = function(port, addrFrom)
|
||||
{
|
||||
this.printMessageIO(port, null, addrFrom, "MFG_DATA", this.bMFGData);
|
||||
return this.bMFGData;
|
||||
};
|
||||
|
||||
/**
|
||||
* outMFGData(port, bOut, addrFrom)
|
||||
*
|
||||
* @this {ChipSet}
|
||||
* @param {number} port (0x80)
|
||||
* @param {number} bOut
|
||||
* @param {number} [addrFrom] (not defined if the Debugger is trying to write the specified port)
|
||||
*/
|
||||
ChipSet.prototype.outMFGData = function(port, bOut, addrFrom)
|
||||
{
|
||||
this.printMessageIO(port, bOut, addrFrom, "MFG_DATA");
|
||||
this.bMFGData = bOut;
|
||||
};
|
||||
|
||||
/**
|
||||
* outNMI(port, bOut, addrFrom)
|
||||
*
|
||||
|
|
@ -4985,7 +4992,7 @@ ChipSet.aPortInput5170 = {
|
|||
0x64: ChipSet.prototype.in8042Status,
|
||||
0x70: ChipSet.prototype.inCMOSAddr,
|
||||
0x71: ChipSet.prototype.inCMOSData,
|
||||
0x80: ChipSet.prototype.inMFGData,
|
||||
0x80: /** @this {ChipSet} */ function(port, addrFrom) { return this.inDMAPageSpare(7, port, addrFrom); },
|
||||
0x84: /** @this {ChipSet} */ function(port, addrFrom) { return this.inDMAPageSpare(0, port, addrFrom); },
|
||||
0x85: /** @this {ChipSet} */ function(port, addrFrom) { return this.inDMAPageSpare(1, port, addrFrom); },
|
||||
0x86: /** @this {ChipSet} */ function(port, addrFrom) { return this.inDMAPageSpare(2, port, addrFrom); },
|
||||
|
|
@ -5054,7 +5061,7 @@ ChipSet.aPortOutput5170 = {
|
|||
0x64: ChipSet.prototype.out8042InBuffCmd,
|
||||
0x70: ChipSet.prototype.outCMOSAddr,
|
||||
0x71: ChipSet.prototype.outCMOSData,
|
||||
0x80: ChipSet.prototype.outMFGData,
|
||||
0x80: /** @this {ChipSet} */ function(port, bOut, addrFrom) { this.outDMAPageSpare(7, port, bOut, addrFrom); },
|
||||
0x84: /** @this {ChipSet} */ function(port, bOut, addrFrom) { this.outDMAPageSpare(0, port, bOut, addrFrom); },
|
||||
0x85: /** @this {ChipSet} */ function(port, bOut, addrFrom) { this.outDMAPageSpare(1, port, bOut, addrFrom); },
|
||||
0x86: /** @this {ChipSet} */ function(port, bOut, addrFrom) { this.outDMAPageSpare(2, port, bOut, addrFrom); },
|
||||
|
|
|
|||
|
|
@ -876,6 +876,10 @@ Computer.prototype.powerOff = function(fSave, fShutdown)
|
|||
Computer.prototype.reset = function()
|
||||
{
|
||||
if (this.bus && this.bus.reset) {
|
||||
/*
|
||||
* TODO: Why does WebStorm think that this.bus.type is undefined? The base class (Component)
|
||||
* constructor defines it.
|
||||
*/
|
||||
this.printMessage("Resetting " + this.bus.type);
|
||||
this.bus.reset();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2549,7 +2549,7 @@ if (DEBUGGER) {
|
|||
* @this {Debugger}
|
||||
* @param {Array} aAddr
|
||||
* @param {boolean} [fWrite]
|
||||
* @param {number} [cb] is number of extra bytes to check (0, 1 or 3)
|
||||
* @param {number} [cb] is number of bytes to check (1, 2 or 4); default is 1
|
||||
* @return {number} is the corresponding physical address, or X86.ADDR_INVALID
|
||||
*/
|
||||
Debugger.prototype.getAddr = function(aAddr, fWrite, cb)
|
||||
|
|
@ -2564,9 +2564,9 @@ if (DEBUGGER) {
|
|||
if (addr == null) {
|
||||
var seg = this.getSegment(aAddr[1]);
|
||||
if (!fWrite) {
|
||||
addr = seg.checkRead(aAddr[0], cb || 0, true);
|
||||
addr = seg.checkRead(aAddr[0], cb || 1, true);
|
||||
} else {
|
||||
addr = seg.checkWrite(aAddr[0], cb || 0, true);
|
||||
addr = seg.checkWrite(aAddr[0], cb || 1, true);
|
||||
}
|
||||
aAddr[2] = addr;
|
||||
}
|
||||
|
|
@ -2587,7 +2587,7 @@ if (DEBUGGER) {
|
|||
Debugger.prototype.getByte = function(aAddr, inc)
|
||||
{
|
||||
var b = 0xff;
|
||||
var addr = this.getAddr(aAddr, false, 0);
|
||||
var addr = this.getAddr(aAddr, false, 1);
|
||||
if (addr !== X86.ADDR_INVALID) {
|
||||
b = this.bus.getByteDirect(addr);
|
||||
this.assert((b == (b & 0xff)), "invalid byte (" + b + ") at address: " + this.hexAddr(aAddr));
|
||||
|
|
@ -2623,7 +2623,7 @@ if (DEBUGGER) {
|
|||
Debugger.prototype.getShort = function(aAddr, inc)
|
||||
{
|
||||
var w = 0xffff;
|
||||
var addr = this.getAddr(aAddr, false, 1);
|
||||
var addr = this.getAddr(aAddr, false, 2);
|
||||
if (addr !== X86.ADDR_INVALID) {
|
||||
w = this.bus.getShortDirect(addr);
|
||||
this.assert((w == (w & 0xffff)), "invalid word (" + w + ") at address: " + this.hexAddr(aAddr));
|
||||
|
|
@ -2643,7 +2643,7 @@ if (DEBUGGER) {
|
|||
Debugger.prototype.getLong = function(aAddr, inc)
|
||||
{
|
||||
var l = -1;
|
||||
var addr = this.getAddr(aAddr, false, 3);
|
||||
var addr = this.getAddr(aAddr, false, 4);
|
||||
if (addr !== X86.ADDR_INVALID) {
|
||||
l = this.bus.getLongDirect(addr);
|
||||
if (inc !== undefined) this.incAddr(aAddr, inc);
|
||||
|
|
@ -2665,7 +2665,7 @@ if (DEBUGGER) {
|
|||
*/
|
||||
Debugger.prototype.setByte = function(aAddr, b, inc)
|
||||
{
|
||||
var addr = this.getAddr(aAddr, true, 0);
|
||||
var addr = this.getAddr(aAddr, true, 1);
|
||||
if (addr !== X86.ADDR_INVALID) {
|
||||
this.bus.setByteDirect(addr, b);
|
||||
if (inc !== undefined) this.incAddr(aAddr, inc);
|
||||
|
|
@ -2683,7 +2683,7 @@ if (DEBUGGER) {
|
|||
*/
|
||||
Debugger.prototype.setShort = function(aAddr, w, inc)
|
||||
{
|
||||
var addr = this.getAddr(aAddr, true, 1);
|
||||
var addr = this.getAddr(aAddr, true, 2);
|
||||
if (addr !== X86.ADDR_INVALID) {
|
||||
this.bus.setShortDirect(addr, w);
|
||||
if (inc !== undefined) this.incAddr(aAddr, inc);
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ RAM.prototype.reset = function()
|
|||
if (this.bus.addMemory(this.addrRAM, this.sizeRAM, Memory.TYPE.RAM)) {
|
||||
this.fAllocated = true;
|
||||
|
||||
this.status(Math.floor(this.sizeRAM / 1024) + "Kb");
|
||||
this.status(Math.floor(this.sizeRAM / 1024) + "Kb allocated");
|
||||
|
||||
/*
|
||||
* NOTE: I'm specifying MAXDEBUG for status() messages because I'm not yet sure I want these
|
||||
|
|
@ -175,6 +175,7 @@ RAM.prototype.reset = function()
|
|||
* for these components, which the Computer component will display as it "powers up" components.
|
||||
*/
|
||||
if (MAXDEBUG && this.fInstalled) this.status("specified size overrides SW1");
|
||||
|
||||
/*
|
||||
* Memory with an ID of "ramCPQ" is reserved for built-in memory located just below the 16Mb
|
||||
* boundary on Compaq DeskPro 386 machines.
|
||||
|
|
|
|||
|
|
@ -67,17 +67,17 @@ function SerialPort(parmsSerial) {
|
|||
this.iAdapter = parmsSerial['adapter'];
|
||||
|
||||
switch (this.iAdapter) {
|
||||
case 1:
|
||||
this.portBase = 0x3F8;
|
||||
this.nIRQ = ChipSet.IRQ.COM1;
|
||||
break;
|
||||
case 2:
|
||||
this.portBase = 0x2F8;
|
||||
this.nIRQ = ChipSet.IRQ.COM2;
|
||||
break;
|
||||
default:
|
||||
Component.warning("Unrecognized serial adapter #" + this.iAdapter);
|
||||
return;
|
||||
case 1:
|
||||
this.portBase = 0x3F8;
|
||||
this.nIRQ = ChipSet.IRQ.COM1;
|
||||
break;
|
||||
case 2:
|
||||
this.portBase = 0x2F8;
|
||||
this.nIRQ = ChipSet.IRQ.COM2;
|
||||
break;
|
||||
default:
|
||||
Component.warning("Unrecognized serial adapter #" + this.iAdapter);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -322,6 +322,7 @@ SerialPort.prototype.syncMouse = function()
|
|||
SerialPort.prototype.setBinding = function(sHTMLType, sBinding, control)
|
||||
{
|
||||
var serial = this;
|
||||
|
||||
switch (sBinding) {
|
||||
case SerialPort.sIOBuffer:
|
||||
this.bindings[sBinding] = this.controlIOBuffer = control;
|
||||
|
|
|
|||
|
|
@ -1249,7 +1249,7 @@ Card.ACCESS.WRITE.MASK = 0xff00;
|
|||
*/
|
||||
Card.ACCESS.readShort = function readShort(off)
|
||||
{
|
||||
return this.readByte(off) | (this.readByte(off + 1) << 8);
|
||||
return this.readByteDirect(off) | (this.readByteDirect(off + 1) << 8);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -1261,7 +1261,7 @@ Card.ACCESS.readShort = function readShort(off)
|
|||
*/
|
||||
Card.ACCESS.readLong = function readLong(off)
|
||||
{
|
||||
return this.readByte(off) | (this.readByte(off + 1) << 8) | (this.readByte(off + 2) << 16) | (this.readByte(off + 3) << 24);
|
||||
return this.readByteDirect(off) | (this.readByteDirect(off + 1) << 8) | (this.readByteDirect(off + 2) << 16) | (this.readByteDirect(off + 3) << 24);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -1274,8 +1274,8 @@ Card.ACCESS.readLong = function readLong(off)
|
|||
Card.ACCESS.writeShort = function writeShort(off, w)
|
||||
{
|
||||
Component.assert(!(w & ~0xffff));
|
||||
this.writeByte(off, w & 0xff);
|
||||
this.writeByte(off + 1, w >> 8);
|
||||
this.writeByteDirect(off, w & 0xff);
|
||||
this.writeByteDirect(off + 1, w >> 8);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -1287,10 +1287,10 @@ Card.ACCESS.writeShort = function writeShort(off, w)
|
|||
*/
|
||||
Card.ACCESS.writeLong = function writeLong(off, w)
|
||||
{
|
||||
this.writeByte(off, w & 0xff);
|
||||
this.writeByte(off + 1, (w >> 8) & 0xff);
|
||||
this.writeByte(off + 2, (w >> 16) & 0xff);
|
||||
this.writeByte(off + 3, (w >>> 24));
|
||||
this.writeByteDirect(off, w & 0xff);
|
||||
this.writeByteDirect(off + 1, (w >> 8) & 0xff);
|
||||
this.writeByteDirect(off + 2, (w >> 16) & 0xff);
|
||||
this.writeByteDirect(off + 3, (w >>> 24));
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1386,8 +1386,8 @@ X86CPU.prototype.setProtMode = function(fProt)
|
|||
if (fProt === undefined) {
|
||||
fProt = !!(this.regCR0 & X86.CR0.MSW.PE);
|
||||
}
|
||||
if (!fProt) {
|
||||
this.printMessage("returning to real-mode");
|
||||
if (!fProt != !(this.regCR0 & X86.CR0.MSW.PE)) {
|
||||
this.printMessage("CPU switching to " + (fProt? "protected" : "real") + "-mode", this.bitsMessage, true);
|
||||
}
|
||||
this.aOpGrp6 = (fProt? X86.aOpGrp6Prot : X86.aOpGrp6Real);
|
||||
this.segCS.updateMode(fProt);
|
||||
|
|
@ -2650,7 +2650,7 @@ X86CPU.prototype.setLong = function(addr, l)
|
|||
X86CPU.prototype.getEAByte = function(seg, off)
|
||||
{
|
||||
this.segEA = seg;
|
||||
this.regEA = seg.checkRead(this.offEA = off, 0);
|
||||
this.regEA = seg.checkRead(this.offEA = off, 1);
|
||||
if (this.opFlags & X86.OPFLAG.NOREAD) return 0;
|
||||
var b = this.getByte(this.regEA);
|
||||
if (BACKTRACK) this.backTrack.btiEALo = this.backTrack.btiMemLo;
|
||||
|
|
@ -2692,7 +2692,7 @@ X86CPU.prototype.getEAByteStack = function(off)
|
|||
X86CPU.prototype.getEAWord = function(seg, off)
|
||||
{
|
||||
this.segEA = seg;
|
||||
this.regEA = seg.checkRead(this.offEA = off, (I386? this.dataSize-1 : 1));
|
||||
this.regEA = seg.checkRead(this.offEA = off, (I386? this.dataSize : 2));
|
||||
if (this.opFlags & X86.OPFLAG.NOREAD) return 0;
|
||||
var w = this.getWord(this.regEA);
|
||||
if (BACKTRACK) {
|
||||
|
|
@ -2737,7 +2737,7 @@ X86CPU.prototype.getEAWordStack = function(off)
|
|||
X86CPU.prototype.modEAByte = function(seg, off)
|
||||
{
|
||||
this.segEA = seg;
|
||||
this.regEAWrite = this.regEA = seg.checkRead(this.offEA = off, 0);
|
||||
this.regEAWrite = this.regEA = seg.checkRead(this.offEA = off, 1);
|
||||
if (this.opFlags & X86.OPFLAG.NOREAD) return 0;
|
||||
var b = this.getByte(this.regEA);
|
||||
if (BACKTRACK) this.backTrack.btiEALo = this.backTrack.btiMemLo;
|
||||
|
|
@ -2779,7 +2779,7 @@ X86CPU.prototype.modEAByteStack = function(off)
|
|||
X86CPU.prototype.modEAWord = function(seg, off)
|
||||
{
|
||||
this.segEA = seg;
|
||||
this.regEAWrite = this.regEA = seg.checkRead(this.offEA = off, (I386? this.dataSize-1 : 1));
|
||||
this.regEAWrite = this.regEA = seg.checkRead(this.offEA = off, (I386? this.dataSize : 2));
|
||||
if (this.opFlags & X86.OPFLAG.NOREAD) return 0;
|
||||
var w = this.getWord(this.regEA);
|
||||
if (BACKTRACK) {
|
||||
|
|
@ -2823,7 +2823,7 @@ X86CPU.prototype.setEAByte = function(b)
|
|||
{
|
||||
if (this.opFlags & X86.OPFLAG.NOWRITE) return;
|
||||
if (BACKTRACK) this.backTrack.btiMemLo = this.backTrack.btiEALo;
|
||||
this.setByte(this.segEA.checkWrite(this.offEA, 0), b);
|
||||
this.setByte(this.segEA.checkWrite(this.offEA, 1), b);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -2840,9 +2840,9 @@ X86CPU.prototype.setEAWord = function(w)
|
|||
this.backTrack.btiMemHi = this.backTrack.btiEAHi;
|
||||
}
|
||||
if (!I386) {
|
||||
this.setShort(this.segEA.checkWrite(this.offEA, 1), w);
|
||||
this.setShort(this.segEA.checkWrite(this.offEA, 2), w);
|
||||
} else {
|
||||
this.setWord(this.segEA.checkWrite(this.offEA, this.dataSize-1), w);
|
||||
this.setWord(this.segEA.checkWrite(this.offEA, this.dataSize), w);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -2858,7 +2858,7 @@ X86CPU.prototype.setEAWord = function(w)
|
|||
*/
|
||||
X86CPU.prototype.getSOByte = function(seg, off)
|
||||
{
|
||||
return this.getByte(seg.checkRead(off, 0));
|
||||
return this.getByte(seg.checkRead(off, 1));
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -2874,9 +2874,9 @@ X86CPU.prototype.getSOByte = function(seg, off)
|
|||
X86CPU.prototype.getSOWord = function(seg, off)
|
||||
{
|
||||
if (!I386) {
|
||||
return this.getShort(seg.checkRead(off, 1));
|
||||
return this.getShort(seg.checkRead(off, 2));
|
||||
} else {
|
||||
return this.getWord(seg.checkRead(off, this.dataSize-1));
|
||||
return this.getWord(seg.checkRead(off, this.dataSize));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -2892,7 +2892,7 @@ X86CPU.prototype.getSOWord = function(seg, off)
|
|||
*/
|
||||
X86CPU.prototype.setSOByte = function(seg, off, b)
|
||||
{
|
||||
this.setByte(seg.checkWrite(off, 0), b);
|
||||
this.setByte(seg.checkWrite(off, 1), b);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -2908,9 +2908,9 @@ X86CPU.prototype.setSOByte = function(seg, off, b)
|
|||
X86CPU.prototype.setSOWord = function(seg, off, w)
|
||||
{
|
||||
if (!I386) {
|
||||
this.setShort(seg.checkWrite(off, 1), w);
|
||||
this.setShort(seg.checkWrite(off, 2), w);
|
||||
} else {
|
||||
this.setWord(seg.checkWrite(off, this.dataSize-1), w);
|
||||
this.setWord(seg.checkWrite(off, this.dataSize), w);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@
|
|||
"use strict";
|
||||
|
||||
if (typeof module !== 'undefined') {
|
||||
var str = require("../../shared/lib/strlib");
|
||||
var Messages = require("./messages");
|
||||
var X86 = require("./x86");
|
||||
}
|
||||
|
|
@ -172,8 +173,8 @@ X86.fnBOUND = function BOUND(dst, src)
|
|||
* Note that BOUND performs signed comparisons, so we must transform all arguments into signed values.
|
||||
*/
|
||||
var wIndex = (dst << 16) >> 16;
|
||||
var wLower = (this.getShort(this.regEA) << 16) >> 16;
|
||||
var wUpper = (this.getShort(this.regEA + 2) << 16) >> 16;
|
||||
var wLower = (this.getWord(this.regEA) << 16) >> 16;
|
||||
var wUpper = (this.getWord(this.regEA + this.dataSize) << 16) >> 16;
|
||||
this.nStepCycles -= this.cycleCounts.nOpCyclesBound;
|
||||
if (wIndex < wLower || wIndex > wUpper) {
|
||||
/*
|
||||
|
|
@ -332,6 +333,7 @@ X86.fnBTS = function BTS(dst, src)
|
|||
*/
|
||||
X86.fnCALLw = function CALLw(dst, src)
|
||||
{
|
||||
if (DEBUG) this.printMessage("calling " + str.toHex(dst, this.dataSize << 1), this.bitsMessage, true);
|
||||
this.pushWord(this.getIP());
|
||||
this.setIP(dst);
|
||||
this.nStepCycles -= (this.regEA === X86.ADDR_INVALID? this.cycleCounts.nOpCyclesCallWR : this.cycleCounts.nOpCyclesCallWM);
|
||||
|
|
@ -351,11 +353,12 @@ X86.fnCALLw = function CALLw(dst, src)
|
|||
*/
|
||||
X86.fnCALLF = function CALLF(off, sel)
|
||||
{
|
||||
var regCS = this.getCS();
|
||||
var regEIP = this.getIP();
|
||||
if (DEBUG) this.printMessage("calling " + str.toHex(sel, 4) + ':' + str.toHex(off, this.dataSize << 1), this.bitsMessage, true);
|
||||
var oldCS = this.getCS();
|
||||
var oldIP = this.getIP();
|
||||
if (this.setCSIP(off, sel, true) != null) {
|
||||
this.pushWord(regCS);
|
||||
this.pushWord(regEIP);
|
||||
this.pushWord(oldCS);
|
||||
this.pushWord(oldIP);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -372,7 +375,7 @@ X86.fnCALLFdw = function CALLFdw(dst, src)
|
|||
if (this.regEA === X86.ADDR_INVALID) {
|
||||
return X86.fnGRPUndefined.call(this, dst, src);
|
||||
}
|
||||
X86.fnCALLF.call(this, dst, this.getShort(this.regEA + 2));
|
||||
X86.fnCALLF.call(this, dst, this.getShort(this.regEA + this.dataSize));
|
||||
this.nStepCycles -= this.cycleCounts.nOpCyclesCallDM;
|
||||
this.opFlags |= X86.OPFLAG.NOWRITE;
|
||||
return dst;
|
||||
|
|
@ -917,16 +920,16 @@ X86.fnINT = function INT(nIDT, nError, nCycles)
|
|||
*/
|
||||
this.nStepCycles -= this.cycleCounts.nOpCyclesInt + nCycles;
|
||||
this.segCS.fCall = true;
|
||||
var regPS = this.getPS();
|
||||
var regCS = this.getCS();
|
||||
var regEIP = this.getIP();
|
||||
var oldPS = this.getPS();
|
||||
var oldCS = this.getCS();
|
||||
var oldIP = this.getIP();
|
||||
var addr = this.segCS.loadIDT(nIDT);
|
||||
if (addr != X86.ADDR_INVALID) {
|
||||
this.regLIP = addr;
|
||||
if (PREFETCH) this.flushPrefetch(this.regLIP);
|
||||
this.pushWord(regPS);
|
||||
this.pushWord(regCS);
|
||||
this.pushWord(regEIP);
|
||||
this.pushWord(oldPS);
|
||||
this.pushWord(oldCS);
|
||||
this.pushWord(oldIP);
|
||||
if (nError != null) this.pushWord(nError);
|
||||
this.nFault = -1;
|
||||
}
|
||||
|
|
@ -952,11 +955,12 @@ X86.fnIRET = function IRET()
|
|||
}
|
||||
}
|
||||
var cpl = this.segCS.cpl;
|
||||
var regEIP = this.popWord();
|
||||
var regCS = this.popWord();
|
||||
var regPS = this.popWord();
|
||||
if (this.setCSIP(regEIP, regCS, false) != null) {
|
||||
this.setPS(regPS, cpl);
|
||||
var newIP = this.popWord();
|
||||
var newCS = this.popWord();
|
||||
var newPS = this.popWord();
|
||||
if (DEBUG) this.printMessage(" returning to " + str.toHex(newCS, 4) + ':' + str.toHex(newIP, this.dataSize << 1), this.bitsMessage, true);
|
||||
if (this.setCSIP(newIP, newCS, false) != null) {
|
||||
this.setPS(newPS, cpl);
|
||||
if (this.cIntReturn) this.checkIntReturn(this.regLIP);
|
||||
}
|
||||
};
|
||||
|
|
@ -990,7 +994,7 @@ X86.fnJMPFdw = function JMPFdw(dst, src)
|
|||
if (this.regEA === X86.ADDR_INVALID) {
|
||||
return X86.fnGRPUndefined.call(this, dst, src);
|
||||
}
|
||||
this.setCSIP(dst, this.getShort(this.regEA + 2));
|
||||
this.setCSIP(dst, this.getShort(this.regEA + this.dataSize));
|
||||
if (this.cIntReturn) this.checkIntReturn(this.regLIP);
|
||||
this.nStepCycles -= this.cycleCounts.nOpCyclesJmpDM;
|
||||
this.opFlags |= X86.OPFLAG.NOWRITE;
|
||||
|
|
@ -1055,7 +1059,7 @@ X86.fnLDS = function LDS(dst, src)
|
|||
X86.opUndefined.call(this);
|
||||
return dst;
|
||||
}
|
||||
this.setDS(this.getShort(this.regEA + 2));
|
||||
this.setDS(this.getShort(this.regEA + this.dataSize));
|
||||
this.nStepCycles -= this.cycleCounts.nOpCyclesLS;
|
||||
return src;
|
||||
};
|
||||
|
|
@ -1101,7 +1105,7 @@ X86.fnLES = function LES(dst, src)
|
|||
X86.opUndefined.call(this);
|
||||
return dst;
|
||||
}
|
||||
this.setES(this.getShort(this.regEA + 2));
|
||||
this.setES(this.getShort(this.regEA + this.dataSize));
|
||||
this.nStepCycles -= this.cycleCounts.nOpCyclesLS;
|
||||
return src;
|
||||
};
|
||||
|
|
@ -1120,7 +1124,7 @@ X86.fnLFS = function LFS(dst, src)
|
|||
X86.opUndefined.call(this);
|
||||
return dst;
|
||||
}
|
||||
this.setFS(this.getShort(this.regEA + 2));
|
||||
this.setFS(this.getShort(this.regEA + this.dataSize));
|
||||
this.nStepCycles -= this.cycleCounts.nOpCyclesLS;
|
||||
return src;
|
||||
};
|
||||
|
|
@ -1170,7 +1174,7 @@ X86.fnLGS = function LGS(dst, src)
|
|||
X86.opUndefined.call(this);
|
||||
return dst;
|
||||
}
|
||||
this.setGS(this.getShort(this.regEA + 2));
|
||||
this.setGS(this.getShort(this.regEA + this.dataSize));
|
||||
this.nStepCycles -= this.cycleCounts.nOpCyclesLS;
|
||||
return src;
|
||||
};
|
||||
|
|
@ -1287,7 +1291,7 @@ X86.fnLSS = function LSS(dst, src)
|
|||
X86.opUndefined.call(this);
|
||||
return dst;
|
||||
}
|
||||
this.setSS(this.getShort(this.regEA + 2));
|
||||
this.setSS(this.getShort(this.regEA + this.dataSize));
|
||||
this.nStepCycles -= this.cycleCounts.nOpCyclesLS;
|
||||
return src;
|
||||
};
|
||||
|
|
@ -1738,11 +1742,12 @@ X86.fnRCRd = function RCRd(dst, src)
|
|||
*/
|
||||
X86.fnRETF = function RETF(n)
|
||||
{
|
||||
var regEIP = this.popWord();
|
||||
var regCS = this.popWord();
|
||||
var newIP = this.popWord();
|
||||
var newCS = this.popWord();
|
||||
if (DEBUG) this.printMessage(" returning to " + str.toHex(newCS, 4) + ':' + str.toHex(newIP, this.dataSize << 1), this.bitsMessage, true);
|
||||
n <<= (this.dataSize >> 2);
|
||||
if (n) this.setSP(this.getSP() + n); // TODO: optimize
|
||||
if (this.setCSIP(regEIP, regCS, false)) {
|
||||
if (this.setCSIP(newIP, newCS, false)) {
|
||||
if (n) this.setSP(this.getSP() + n); // TODO: optimize
|
||||
/*
|
||||
* As per Intel documentation: "If any of [the DS or ES] registers refer to segments whose DPL is
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@
|
|||
"use strict";
|
||||
|
||||
if (typeof module !== 'undefined') {
|
||||
var str = require("../../shared/lib/strlib");
|
||||
var Component = require("../../shared/lib/component");
|
||||
var Messages = require("./messages");
|
||||
var X86 = require("./x86");
|
||||
|
|
@ -1562,8 +1563,7 @@ X86.opOUTSb = function OUTSb()
|
|||
|
||||
/*
|
||||
* NOTE: 5 + 4n is the cycle time for the 80286; the 80186/80188 has different values: 14 cycles for
|
||||
* an unrepeated INS, and 8 + 8n for a repeated INS. However, accurate cycle times for the 80186/80188 is
|
||||
* low priority. TODO: Fix this someday.
|
||||
* an unrepeated INS, and 8 + 8n for a repeated INS. TODO: Fix this someday.
|
||||
*/
|
||||
var nCycles = 5;
|
||||
|
||||
|
|
@ -1608,8 +1608,7 @@ X86.opOUTSw = function OUTSw()
|
|||
|
||||
/*
|
||||
* NOTE: 5 + 4n is the cycle time for the 80286; the 80186/80188 has different values: 14 cycles for
|
||||
* an unrepeated INS, and 8 + 8n for a repeated INS. However, accurate cycle times for the 80186/80188 is
|
||||
* low priority. TODO: Fix this someday.
|
||||
* an unrepeated INS, and 8 + 8n for a repeated INS. TODO: Fix this someday.
|
||||
*/
|
||||
var nCycles = 5;
|
||||
|
||||
|
|
@ -3190,7 +3189,9 @@ X86.opGRP2wn = function GRP2wn()
|
|||
X86.opRETn = function RETn()
|
||||
{
|
||||
var n = this.getIPWord() << (this.dataSize >> 2);
|
||||
this.setIP(this.popWord());
|
||||
var newIP = this.popWord();
|
||||
if (DEBUG) this.printMessage(" returning to " + str.toHex(this.segCS.sel, 4) + ':' + str.toHex(newIP, this.dataSize << 1), this.bitsMessage, true);
|
||||
this.setIP(newIP);
|
||||
if (n) this.setSP(this.getSP() + n); // TODO: optimize
|
||||
this.nStepCycles -= this.cycleCounts.nOpCyclesRetn;
|
||||
};
|
||||
|
|
@ -3202,7 +3203,9 @@ X86.opRETn = function RETn()
|
|||
*/
|
||||
X86.opRET = function RET()
|
||||
{
|
||||
this.setIP(this.popWord());
|
||||
var newIP = this.popWord();
|
||||
if (DEBUG) this.printMessage(" returning to " + str.toHex(this.segCS.sel, 4) + ':' + str.toHex(newIP, this.dataSize << 1), this.bitsMessage, true);
|
||||
this.setIP(newIP);
|
||||
this.nStepCycles -= this.cycleCounts.nOpCyclesRet;
|
||||
};
|
||||
|
||||
|
|
@ -3286,8 +3289,7 @@ X86.opENTER = function ENTER()
|
|||
var bLevel = this.getIPByte() & 0x1f;
|
||||
/*
|
||||
* NOTE: 11 is the minimum cycle time for the 80286; the 80186/80188 has different cycle times: 15, 25 and
|
||||
* 22 + 16 * (bLevel - 1) for bLevel 0, 1 and > 1, respectively. However, accurate cycle times for the 80186/80188
|
||||
* is low priority. TODO: Fix this someday.
|
||||
* 22 + 16 * (bLevel - 1) for bLevel 0, 1 and > 1, respectively. TODO: Fix this someday.
|
||||
*/
|
||||
this.nStepCycles -= 11;
|
||||
this.pushWord(this.regEBP);
|
||||
|
|
@ -3316,8 +3318,7 @@ X86.opLEAVE = function LEAVE()
|
|||
this.setSP((this.getSP() & ~this.segSS.addrMask) | (this.regEBP & this.segSS.addrMask));
|
||||
this.regEBP = (this.regEBP & ~this.dataMask) | (this.popWord() & this.dataMask);
|
||||
/*
|
||||
* NOTE: 5 is the cycle time for the 80286; the 80186/80188 has a cycle time of 8. However, accurate cycle
|
||||
* counts for the 80186/80188 is low priority. TODO: Fix this someday.
|
||||
* NOTE: 5 is the cycle time for the 80286; the 80186/80188 has a cycle time of 8. TODO: Fix this someday.
|
||||
*/
|
||||
this.nStepCycles -= 5;
|
||||
};
|
||||
|
|
@ -3648,8 +3649,11 @@ X86.opOUTw = function OUTw()
|
|||
X86.opCALL = function CALL()
|
||||
{
|
||||
var disp = this.getIPWord();
|
||||
this.pushWord(this.getIP());
|
||||
this.setIP(this.getIP() + disp);
|
||||
var oldIP = this.getIP();
|
||||
var newIP = oldIP + disp;
|
||||
if (DEBUG) this.printMessage("calling " + str.toHex(newIP, this.dataSize << 1), this.bitsMessage, true);
|
||||
this.pushWord(oldIP);
|
||||
this.setIP(newIP);
|
||||
this.nStepCycles -= this.cycleCounts.nOpCyclesCall;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -243,12 +243,12 @@ X86Seg.prototype.loadIDTProt = function loadIDTProt(nIDT)
|
|||
/**
|
||||
* checkReadReal(off, cb, fSuppress)
|
||||
*
|
||||
* TODO: Invoke X86.fnFault.call(this.cpu, X86.EXCEPTION.GP_FAULT) if off is 0xffff and cb is 1;
|
||||
* TODO: Invoke X86.fnFault.call(this.cpu, X86.EXCEPTION.GP_FAULT) if off is 0xffff and cb > 1;
|
||||
* also, whether or not the fnFault() call should include an error code, since this is happening in real-mode.
|
||||
*
|
||||
* @this {X86Seg}
|
||||
* @param {number} off is a segment-relative offset
|
||||
* @param {number} cb is number of extra bytes to check (0 or 1)
|
||||
* @param {number} cb is number of bytes to check (1, 2 or 4)
|
||||
* @param {boolean} [fSuppress] is true to suppress any errors
|
||||
* @return {number} corresponding physical address if valid, or ADDR_INVALID if error (TODO: No error conditions exist yet)
|
||||
*/
|
||||
|
|
@ -260,12 +260,12 @@ X86Seg.prototype.checkReadReal = function checkReadReal(off, cb, fSuppress)
|
|||
/**
|
||||
* checkWriteReal(off, cb, fSuppress)
|
||||
*
|
||||
* TODO: Invoke X86.fnFault.call(this.cpu, X86.EXCEPTION.GP_FAULT) if off is 0xffff and cb is 1;
|
||||
* TODO: Invoke X86.fnFault.call(this.cpu, X86.EXCEPTION.GP_FAULT) if off is 0xffff and cb > 1;
|
||||
* also, whether or not the fnFault() call should include an error code, since this is happening in real-mode.
|
||||
*
|
||||
* @this {X86Seg}
|
||||
* @param {number} off is a segment-relative offset
|
||||
* @param {number} cb is number of extra bytes to check (0 or 1)
|
||||
* @param {number} cb is number of bytes to check (1, 2 or 4)
|
||||
* @param {boolean} [fSuppress] is true to suppress any errors
|
||||
* @return {number} corresponding physical address if valid, or ADDR_INVALID if error (TODO: No error conditions exist yet)
|
||||
*/
|
||||
|
|
@ -279,13 +279,13 @@ X86Seg.prototype.checkWriteReal = function checkWriteReal(off, cb, fSuppress)
|
|||
*
|
||||
* @this {X86Seg}
|
||||
* @param {number} off is a segment-relative offset
|
||||
* @param {number} cb is number of extra bytes to check (0 or 1)
|
||||
* @param {number} cb is number of bytes to check (1, 2 or 4)
|
||||
* @param {boolean} [fSuppress] is true to suppress any errors
|
||||
* @return {number} corresponding physical address if valid, or ADDR_INVALID if not
|
||||
*/
|
||||
X86Seg.prototype.checkReadProt = function checkReadProt(off, cb, fSuppress)
|
||||
{
|
||||
if (off + cb <= this.limit) {
|
||||
if (off + cb - 1 <= this.limit) {
|
||||
return (this.base + off)|0;
|
||||
}
|
||||
return this.checkReadProtDisallowed(off, cb, fSuppress);
|
||||
|
|
@ -296,13 +296,13 @@ X86Seg.prototype.checkReadProt = function checkReadProt(off, cb, fSuppress)
|
|||
*
|
||||
* @this {X86Seg}
|
||||
* @param {number} off is a segment-relative offset
|
||||
* @param {number} cb is number of extra bytes to check (0 or 1)
|
||||
* @param {number} cb is number of bytes to check (1, 2 or 4)
|
||||
* @param {boolean} [fSuppress] is true to suppress any errors
|
||||
* @return {number} corresponding physical address if valid, ADDR_INVALID if not
|
||||
*/
|
||||
X86Seg.prototype.checkReadProtDown = function checkReadProtDown(off, cb, fSuppress)
|
||||
{
|
||||
if (off + cb > this.limit) {
|
||||
if (off + cb - 1 > this.limit) {
|
||||
return (this.base + off)|0;
|
||||
}
|
||||
return this.checkReadProtDisallowed(off, cb, fSuppress);
|
||||
|
|
@ -313,7 +313,7 @@ X86Seg.prototype.checkReadProtDown = function checkReadProtDown(off, cb, fSuppre
|
|||
*
|
||||
* @this {X86Seg}
|
||||
* @param {number} off is a segment-relative offset
|
||||
* @param {number} cb is number of extra bytes to check (0 or 1)
|
||||
* @param {number} cb is number of bytes to check (1, 2 or 4)
|
||||
* @param {boolean} [fSuppress] is true to suppress any errors
|
||||
* @return {number} corresponding physical address if valid, ADDR_INVALID if not
|
||||
*/
|
||||
|
|
@ -330,13 +330,13 @@ X86Seg.prototype.checkReadProtDisallowed = function checkReadProtDisallowed(off,
|
|||
*
|
||||
* @this {X86Seg}
|
||||
* @param {number} off is a segment-relative offset
|
||||
* @param {number} cb is number of extra bytes to check (0 or 1)
|
||||
* @param {number} cb is number of bytes to check (1, 2 or 4)
|
||||
* @param {boolean} [fSuppress] is true to suppress any errors
|
||||
* @return {number} corresponding physical address if valid, ADDR_INVALID if not
|
||||
*/
|
||||
X86Seg.prototype.checkWriteProt = function checkWriteProt(off, cb, fSuppress)
|
||||
{
|
||||
if (off + cb <= this.limit) {
|
||||
if (off + cb - 1 <= this.limit) {
|
||||
return (this.base + off)|0;
|
||||
}
|
||||
return this.checkWriteProtDisallowed(off, cb, fSuppress);
|
||||
|
|
@ -347,13 +347,13 @@ X86Seg.prototype.checkWriteProt = function checkWriteProt(off, cb, fSuppress)
|
|||
*
|
||||
* @this {X86Seg}
|
||||
* @param {number} off is a segment-relative offset
|
||||
* @param {number} cb is number of extra bytes to check (0 or 1)
|
||||
* @param {number} cb is number of bytes to check (1, 2 or 4)
|
||||
* @param {boolean} [fSuppress] is true to suppress any errors
|
||||
* @return {number} corresponding physical address if valid, ADDR_INVALID if not
|
||||
*/
|
||||
X86Seg.prototype.checkWriteProtDown = function checkWriteProtDown(off, cb, fSuppress)
|
||||
{
|
||||
if (off + cb > this.limit) {
|
||||
if (off + cb - 1 > this.limit) {
|
||||
return (this.base + off)|0;
|
||||
}
|
||||
return this.checkWriteProtDisallowed(off, cb, fSuppress);
|
||||
|
|
@ -364,7 +364,7 @@ X86Seg.prototype.checkWriteProtDown = function checkWriteProtDown(off, cb, fSupp
|
|||
*
|
||||
* @this {X86Seg}
|
||||
* @param {number} off is a segment-relative offset
|
||||
* @param {number} cb is number of extra bytes to check (0 or 1)
|
||||
* @param {number} cb is number of bytes to check (1, 2 or 4)
|
||||
* @param {boolean} [fSuppress] is true to suppress any errors
|
||||
* @return {number} corresponding physical address if valid, ADDR_INVALID if not
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
/* global window: true, XSLTProcessor: false, web: true, Component: true, APPNAME: false, APPVERSION: false, DEBUG: true */
|
||||
/* global window: true, XSLTProcessor: false, APPNAME: false, APPVERSION: false, DEBUG: true */
|
||||
|
||||
if (typeof module !== 'undefined') {
|
||||
var Component;
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ str.toHex = function(n, cch)
|
|||
*
|
||||
* Alias for "0x" + str.toHex(b, 2)
|
||||
*
|
||||
* @param {number|undefined} b is a byte value
|
||||
* @param {number|null|undefined} b is a byte value
|
||||
* @return {string} the hex representation of b
|
||||
*/
|
||||
str.toHexByte = function(b)
|
||||
|
|
@ -158,7 +158,7 @@ str.toHexByte = function(b)
|
|||
*
|
||||
* Alias for "0x" + str.toHex(w, 4)
|
||||
*
|
||||
* @param {number|undefined} w is a word (16-bit) value
|
||||
* @param {number|null|undefined} w is a word (16-bit) value
|
||||
* @return {string} the hex representation of w
|
||||
*/
|
||||
str.toHexWord = function(w)
|
||||
|
|
@ -171,7 +171,7 @@ str.toHexWord = function(w)
|
|||
*
|
||||
* Alias for "0x" + toHex(l)
|
||||
*
|
||||
* @param {number|undefined} l is a dword (32-bit) value
|
||||
* @param {number|null|undefined} l is a dword (32-bit) value
|
||||
* @return {string} the hex representation of w
|
||||
*/
|
||||
str.toHexLong = function(l)
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ var usr = {};
|
|||
*
|
||||
* @param {Array} a is an array
|
||||
* @param {number|string|Array|Object} v
|
||||
* @param {function((number|string), (number|string))} [fnCompare]
|
||||
* @param {function((number|string|Array|Object), (number|string|Array|Object))} [fnCompare]
|
||||
* @return {number} the index of matching entry if non-negative, otherwise the index of the insertion point
|
||||
*/
|
||||
usr.binarySearch = function(a, v, fnCompare) {
|
||||
|
|
@ -73,7 +73,7 @@ usr.binarySearch = function(a, v, fnCompare) {
|
|||
*
|
||||
* @param {Array} a is an array
|
||||
* @param {number|string|Array|Object} v is the value to insert
|
||||
* @param {function((number|string), (number|string))} [fnCompare]
|
||||
* @param {function((number|string|Array|Object), (number|string|Array|Object))} [fnCompare]
|
||||
*/
|
||||
usr.binaryInsert = function(a, v, fnCompare) {
|
||||
var index = usr.binarySearch(a, v, fnCompare);
|
||||
|
|
|
|||
Loading…
Reference in a new issue