Fixed inspections

This commit is contained in:
Jeff Parsons 2015-12-15 11:25:29 -08:00
commit 66456ecf54
6 changed files with 38 additions and 46 deletions

View file

@ -39,7 +39,6 @@ if (NODE) {
var Memory = require("./memory"); var Memory = require("./memory");
var Messages = require("./messages"); var Messages = require("./messages");
var State = require("./state"); var State = require("./state");
var X86 = require("./x86");
} }
/** /**
@ -768,7 +767,7 @@ Bus.prototype.getLong = function(addr)
* @this {Bus} * @this {Bus}
* @param {number} addr is a physical address * @param {number} addr is a physical address
* @return {number} long (32-bit) value at that address * @return {number} long (32-bit) value at that address
*/ *
Bus.prototype.getLongDirect = function(addr) Bus.prototype.getLongDirect = function(addr)
{ {
var off = addr & this.nBlockLimit; var off = addr & this.nBlockLimit;
@ -776,12 +775,12 @@ Bus.prototype.getLongDirect = function(addr)
if (off < this.nBlockLimit - 2) { if (off < this.nBlockLimit - 2) {
return this.aMemBlocks[iBlock].readLongDirect(off, addr); return this.aMemBlocks[iBlock].readLongDirect(off, addr);
} }
/* //
* I think the previous version of this function tried to be too clever (ie, reading the last // I think the previous version of this function tried to be too clever (ie, reading the last
* long in the current block and the first long in the next block and masking/combining the results), // long in the current block and the first long in the next block and masking/combining the results),
* which may have also created some undesirable side-effects for custom memory controllers. // which may have also created some undesirable side-effects for custom memory controllers.
* This simpler (and probably more reliable) approach is to simply read the long as individual bytes. // This simpler (and probably more reliable) approach is to simply read the long as individual bytes.
*/ //
var l = 0; var l = 0;
var cb = 4, nShift = 0; var cb = 4, nShift = 0;
var cbBlock = 4 - (off & 0x3); // (off & 0x3) will be 1, 2 or 3, so cbBlock will be 3, 2, or 1 var cbBlock = 4 - (off & 0x3); // (off & 0x3) will be 1, 2 or 3, so cbBlock will be 3, 2, or 1
@ -795,6 +794,7 @@ Bus.prototype.getLongDirect = function(addr)
} }
return l; return l;
}; };
*/
/** /**
* setByte(addr, b) * setByte(addr, b)
@ -912,7 +912,7 @@ Bus.prototype.setLong = function(addr, l)
* @this {Bus} * @this {Bus}
* @param {number} addr is a physical address * @param {number} addr is a physical address
* @param {number} l is the long (32-bit) value to write * @param {number} l is the long (32-bit) value to write
*/ *
Bus.prototype.setLongDirect = function(addr, l) Bus.prototype.setLongDirect = function(addr, l)
{ {
var off = addr & this.nBlockLimit; var off = addr & this.nBlockLimit;
@ -921,12 +921,12 @@ Bus.prototype.setLongDirect = function(addr, l)
this.aMemBlocks[iBlock].writeLongDirect(off, l, addr); this.aMemBlocks[iBlock].writeLongDirect(off, l, addr);
return; return;
} }
/* //
* I think the previous version of this function tried to be too clever (ie, reading and rewriting // I think the previous version of this function tried to be too clever (ie, reading and rewriting
* the last long in the current block, and then reading and rewriting the first long in the next // the last long in the current block, and then reading and rewriting the first long in the next
* block), which may have also created some undesirable side-effects for custom memory controllers. // block), which may have also created some undesirable side-effects for custom memory controllers.
* This simpler (and probably more reliable) approach is to simply write the long as individual bytes. // This simpler (and probably more reliable) approach is to simply write the long as individual bytes.
*/ //
var cb = 4; var cb = 4;
var cbBlock = 4 - (off & 0x3); // (off & 0x3) will be 1, 2 or 3, so cbBlock will be 3, 2, or 1 var cbBlock = 4 - (off & 0x3); // (off & 0x3) will be 1, 2 or 3, so cbBlock will be 3, 2, or 1
while (cb--) { while (cb--) {
@ -938,6 +938,7 @@ Bus.prototype.setLongDirect = function(addr, l)
l >>>= 8; l >>>= 8;
} }
}; };
*/
/** /**
* addBackTrackObject(obj, bto, off) * addBackTrackObject(obj, bto, off)
@ -1207,11 +1208,12 @@ Bus.prototype.getBackTrackObject = function(bti)
* @this {Bus} * @this {Bus}
* @param {number} addr * @param {number} addr
* @return {Object|null} * @return {Object|null}
*/ *
Bus.prototype.getBackTrackObjectFromAddr = function(addr) Bus.prototype.getBackTrackObjectFromAddr = function(addr)
{ {
return BACKTRACK? this.getBackTrackObject(this.readBackTrack(addr)) : null; return BACKTRACK? this.getBackTrackObject(this.readBackTrack(addr)) : null;
}; };
*/
/** /**
* getBackTrackInfo(bti, fSymbol, fNearest) * getBackTrackInfo(bti, fSymbol, fNearest)
@ -1247,11 +1249,12 @@ Bus.prototype.getBackTrackInfo = function(bti, fSymbol, fNearest)
* @this {Bus} * @this {Bus}
* @param {number} addr * @param {number} addr
* @return {string|null} * @return {string|null}
*/ *
Bus.prototype.getBackTrackInfoFromAddr = function(addr) Bus.prototype.getBackTrackInfoFromAddr = function(addr)
{ {
return BACKTRACK? this.getBackTrackInfo(this.readBackTrack(addr)) : null; return BACKTRACK? this.getBackTrackInfo(this.readBackTrack(addr)) : null;
}; };
*/
/** /**
* getSymbol(addr, fNearest) * getSymbol(addr, fNearest)

View file

@ -2830,7 +2830,7 @@ ChipSet.prototype.outDMAPageSpare = function(iSpare, port, bOut, addrFrom)
* Called by the CPU whenever INTR.DMA is set. * Called by the CPU whenever INTR.DMA is set.
* *
* @return {boolean} true if one or more async DMA channels are still active (unmasked), false to reset INTR.DMA * @return {boolean} true if one or more async DMA channels are still active (unmasked), false to reset INTR.DMA
*/ *
ChipSet.prototype.checkDMA = function() ChipSet.prototype.checkDMA = function()
{ {
var fActive = false; var fActive = false;
@ -2846,6 +2846,7 @@ ChipSet.prototype.checkDMA = function()
} }
return fActive; return fActive;
}; };
*/
/** /**
* connectDMA(iDMAChannel, component, sFunction, obj) * connectDMA(iDMAChannel, component, sFunction, obj)

View file

@ -33,8 +33,8 @@
/* /*
* BUILD INSTRUCTIONS * BUILD INSTRUCTIONS
* *
* To build PCjs (pc.js), run Google's Closure Compiler, replacing "*.js" with * To build PCjs (pc.js), run Google's Closure Compiler, replacing "*.js" with the input file sequence defined
* the input file sequence defined by the "pcJSFiles" property in package.json: * by the "pcJSFiles" property in package.json:
* *
* java -jar compiler.jar * java -jar compiler.jar
* --compilation_level ADVANCED_OPTIMIZATIONS * --compilation_level ADVANCED_OPTIMIZATIONS
@ -43,23 +43,19 @@
* --js *.js * --js *.js
* --js_output_file pc.js * --js_output_file pc.js
* *
* Google's Closure Compiler (compiler.jar) is documented at * Google's Closure Compiler (compiler.jar) is documented at https://developers.google.com/closure/compiler/
* https://developers.google.com/closure/compiler/ and is available * and is available for download here:
* for download here:
* *
* http://closure-compiler.googlecode.com/files/compiler-latest.zip * http://closure-compiler.googlecode.com/files/compiler-latest.zip
* *
* The PCjs JavaScript files do have some initialization-order dependencies. * The PCjs JavaScript files do have some initialization-order dependencies. If you load the files individually,
* If you load the files individually, it's recommended that you load them in * it's recommended that you load them in the same order that they're compiled.
* the same order that they're compiled.
* *
* Generally speaking, component.js should be first, computer.js should be * Generally speaking, component.js should be first, computer.js should be last (of the files based on component.js),
* last (of the files based on component.js), and panel.js should be listed * and panel.js should be listed early so that the Control Panel is ready as soon as possible.
* early so that the Control Panel is ready as soon as possible.
* *
* Another recent ordering requirement is that rom.js must be loaded before * Another recent ordering requirement is that rom.js must be loaded before ram.js; this was true before, but now
* ram.js; this was true before, but now it's required, because I'm starting * it's required, because I'm starting to add ROM BIOS Data Area definitions to rom.js, and since the data area
* to add ROM BIOS Data Area definitions to rom.js, and since the data area
* is in RAM, ram.js may want access to some of those definitions. * is in RAM, ram.js may want access to some of those definitions.
*/ */

View file

@ -590,7 +590,7 @@ CPU.prototype.setBurstCycles = function(nCycles)
* TODO: If the delta is negative, we could simply ignore the request, but we must first carefully * TODO: If the delta is negative, we could simply ignore the request, but we must first carefully
* consider the impact on the ChipSet timers. * consider the impact on the ChipSet timers.
*/ */
if (DEBUG) this.nSnapCycles -= nDelta; // if (DEBUG) this.nSnapCycles -= nDelta;
this.nStepCycles -= nDelta; this.nStepCycles -= nDelta;
this.nBurstCycles -= nDelta; this.nBurstCycles -= nDelta;
return true; return true;
@ -1160,7 +1160,7 @@ CPU.prototype.yieldCPU = function()
this.aCounts.nCyclesNextYield = 0; // this will break us out of runCPU(), once we break out of stepCPU() this.aCounts.nCyclesNextYield = 0; // this will break us out of runCPU(), once we break out of stepCPU()
this.nBurstCycles -= this.nStepCycles; this.nBurstCycles -= this.nStepCycles;
this.nStepCycles = 0; // this will break us out of stepCPU() this.nStepCycles = 0; // this will break us out of stepCPU()
if (DEBUG) this.nSnapCycles = this.nBurstCycles; // if (DEBUG) this.nSnapCycles = this.nBurstCycles;
/* /*
* The Debugger calls yieldCPU() after every message() to ensure browser responsiveness, but it looks * The Debugger calls yieldCPU() after every message() to ensure browser responsiveness, but it looks
* odd for those messages to show CPU state changes but for the CPU's own status display to not (ditto * odd for those messages to show CPU state changes but for the CPU's own status display to not (ditto

View file

@ -40,7 +40,6 @@ if (DEBUGGER) {
var Component = require("../../shared/lib/component"); var Component = require("../../shared/lib/component");
var Interrupts = require("./interrupts"); var Interrupts = require("./interrupts");
var Messages = require("./messages"); var Messages = require("./messages");
var Bus = require("./bus");
var Memory = require("./memory"); var Memory = require("./memory");
var Keyboard = require("./keyboard"); var Keyboard = require("./keyboard");
var State = require("./state"); var State = require("./state");
@ -124,7 +123,6 @@ function Debugger(parmsDbg)
* updated by initBus(). * updated by initBus().
*/ */
this.cchReg = 4; this.cchReg = 4;
this.maskReg = 0xffff;
this.cchAddr = 5; this.cchAddr = 5;
this.maskAddr = 0xfffff; this.maskAddr = 0xfffff;
@ -1464,10 +1462,7 @@ if (DEBUGGER) {
* pre-80286 CPUs. But at least I'm being up front about it. * pre-80286 CPUs. But at least I'm being up front about it.
*/ */
this.aaOpDescs[0x0F] = Debugger.aOpDesc0F; this.aaOpDescs[0x0F] = Debugger.aOpDesc0F;
if (I386 && this.cpu.model >= X86.MODEL_80386) { if (I386 && this.cpu.model >= X86.MODEL_80386) this.cchReg = 8;
this.cchReg = 8;
this.maskReg = 0xffffffff|0;
}
} }
} }
@ -1857,7 +1852,6 @@ if (DEBUGGER) {
*/ */
Debugger.prototype.intWindowsDebuggerRM = function(addr) Debugger.prototype.intWindowsDebuggerRM = function(addr)
{ {
var dbgAddr;
var cpu = this.cpu; var cpu = this.cpu;
var AL = cpu.regEAX & 0xff; var AL = cpu.regEAX & 0xff;
var AH = (cpu.regEAX >> 8) & 0xff; var AH = (cpu.regEAX >> 8) & 0xff;
@ -2936,7 +2930,7 @@ if (DEBUGGER) {
var blockPTE = bus.aMemBlocks[(addrPTE & bus.nBusMask) >>> bus.nBlockShift]; var blockPTE = bus.aMemBlocks[(addrPTE & bus.nBusMask) >>> bus.nBlockShift];
var lPTE = blockPTE.readLong(offPTE); var lPTE = blockPTE.readLong(offPTE);
var addrPhys = (lPTE & X86.PTE.FRAME) + (addr & X86.LADDR.OFFSET); var addrPhys = (lPTE & X86.PTE.FRAME) + (addr & X86.LADDR.OFFSET);
var blockPhys = bus.aMemBlocks[(addrPhys & bus.nBusMask) >>> bus.nBlockShift]; //var blockPhys = bus.aMemBlocks[(addrPhys & bus.nBusMask) >>> bus.nBlockShift];
/* /*
* And here ends the code that is remarkably similar to mapPageBlock(), with fSuppress set. * And here ends the code that is remarkably similar to mapPageBlock(), with fSuppress set.
*/ */
@ -6960,7 +6954,6 @@ if (DEBUGGER) {
Debugger.prototype.doMouse = function(sAction, sDelta) Debugger.prototype.doMouse = function(sAction, sDelta)
{ {
if (this.mouse) { if (this.mouse) {
var xDelta = 0, yDelta = 0;
var sign = 1; var sign = 1;
if (sDelta.charAt(0) == '-') { if (sDelta.charAt(0) == '-') {
sign = -1; sign = -1;
@ -7753,7 +7746,6 @@ if (DEBUGGER) {
while (cb > 0 && n--) { while (cb > 0 && n--) {
var bOpcode = this.getByte(dbgAddr);
var addr = dbgAddr.addr; var addr = dbgAddr.addr;
var nSequence = (this.isBusy(false) || this.nStep)? this.nCycles : null; var nSequence = (this.isBusy(false) || this.nStep)? this.nCycles : null;
var sComment = (nSequence != null? "cycles" : null); var sComment = (nSequence != null? "cycles" : null);

View file

@ -35,7 +35,6 @@
if (NODE) { if (NODE) {
var str = require("../../shared/lib/strlib"); var str = require("../../shared/lib/strlib");
var Messages = require("./messages"); var Messages = require("./messages");
var Memory = require("./memory");
var X86 = require("./x86"); var X86 = require("./x86");
} }
@ -528,7 +527,7 @@ X86Seg.prototype.checkWriteDebugger = function checkWriteDebugger(off, cb)
* @param {number} sel (protected-mode only) * @param {number} sel (protected-mode only)
* @param {boolean} [fGDT] is true if sel must be in the GDT * @param {boolean} [fGDT] is true if sel must be in the GDT
* @return {number} ACC field from descriptor, or X86.DESC.ACC.INVALID if error * @return {number} ACC field from descriptor, or X86.DESC.ACC.INVALID if error
*/ *
X86Seg.prototype.loadAcc = function(sel, fGDT) X86Seg.prototype.loadAcc = function(sel, fGDT)
{ {
var addrDT; var addrDT;
@ -551,6 +550,7 @@ X86Seg.prototype.loadAcc = function(sel, fGDT)
X86.fnFault.call(cpu, X86.EXCEPTION.GP_FAULT, sel & X86.ERRCODE.SELMASK); X86.fnFault.call(cpu, X86.EXCEPTION.GP_FAULT, sel & X86.ERRCODE.SELMASK);
return X86.DESC.ACC.INVALID; return X86.DESC.ACC.INVALID;
}; };
*/
/** /**
* loadDesc6(addrDesc, sel) * loadDesc6(addrDesc, sel)