From 8ac1219c1347fca82a2b1e29db1fbac9eab3d74a Mon Sep 17 00:00:00 2001 From: Jeff Parsons Date: Tue, 31 Mar 2015 17:23:18 -0700 Subject: [PATCH] Assorted changes after upgrading WebStorm and Node --- modules/pcjs/lib/debugger.js | 2 +- modules/pcjs/lib/x86.js | 12 ++++++------ modules/pcjs/lib/x86cpu.js | 15 ++++++--------- modules/pcjs/lib/x86func.js | 2 +- modules/pcjs/lib/{x86opxx.js => x86ops.js} | 6 +++--- modules/pcjs/package.json | 2 +- package.json | 2 +- 7 files changed, 19 insertions(+), 22 deletions(-) rename modules/pcjs/lib/{x86opxx.js => x86ops.js} (99%) diff --git a/modules/pcjs/lib/debugger.js b/modules/pcjs/lib/debugger.js index 1de62cd2a..77e98300f 100644 --- a/modules/pcjs/lib/debugger.js +++ b/modules/pcjs/lib/debugger.js @@ -2075,7 +2075,7 @@ if (DEBUGGER) { this.nCycles = 0; this.cpu.setError(e.message || e); } - } while (this.cpu.opFlags & X86.OPFLAG.PREFIXES); + } while (this.cpu.opFlags & X86.OPFLAG_PREFIXES); /* * Because we called cpu.stepCPU() and not cpu.runCPU(), we must nudge the cpu's update code, diff --git a/modules/pcjs/lib/x86.js b/modules/pcjs/lib/x86.js index 04ebc3265..cf49591d9 100644 --- a/modules/pcjs/lib/x86.js +++ b/modules/pcjs/lib/x86.js @@ -411,25 +411,25 @@ X86.BACKTRACK = { * "direct" designation; other processors must adjust these bits accordingly. The final * adjusted value is stored in PS_DIRECT. */ -X86.PS.DIRECT_8086 = (X86.PS.TF | X86.PS.IF | X86.PS.DF); +X86.PS_DIRECT_8086 = (X86.PS.TF | X86.PS.IF | X86.PS.DF); /* * These are the default "always set" PS bits for the 8086/8088; other processors must * adjust these bits accordingly. The final adjusted value is stored in PS_SET. */ -X86.PS.SET_8086 = (X86.PS.BIT1 | X86.PS.IOPL.MASK | X86.PS.NT | X86.PS.BIT15); +X86.PS_SET_8086 = (X86.PS.BIT1 | X86.PS.IOPL.MASK | X86.PS.NT | X86.PS.BIT15); /* * These PS arithmetic and logical flags may be "cached" across several result registers; * whether or not they're currently cached depends on the RESULT bits in resultType. */ -X86.PS.CACHED = (X86.PS.CF | X86.PS.PF | X86.PS.AF | X86.PS.ZF | X86.PS.SF | X86.PS.OF); +X86.PS_CACHED = (X86.PS.CF | X86.PS.PF | X86.PS.AF | X86.PS.ZF | X86.PS.SF | X86.PS.OF); /* - * PS.SAHF is a subset of the arithmetic flags, and refers only to those flags that the + * PS_SAHF is a subset of the arithmetic flags, and refers only to those flags that the * SAHF and LAHF "8080 legacy" opcodes affect. */ -X86.PS.SAHF = (X86.PS.CF | X86.PS.PF | X86.PS.AF | X86.PS.ZF | X86.PS.SF); +X86.PS_SAHF = (X86.PS.CF | X86.PS.PF | X86.PS.AF | X86.PS.ZF | X86.PS.SF); /* * Before we zero opFlags, we first see if any of the following PREFIX bits were set. If any were set, @@ -437,6 +437,6 @@ X86.PS.SAHF = (X86.PS.CF | X86.PS.PF | X86.PS.AF | X86.PS.ZF | X86.PS.SF); * instructions like LODS, MOVS, STOS, CMPS, etc, a way of determining which prefixes, if any, immediately * preceded them. */ -X86.OPFLAG.PREFIXES = (X86.OPFLAG.SEG | X86.OPFLAG.LOCK | X86.OPFLAG.REPZ | X86.OPFLAG.REPNZ | X86.OPFLAG.DATASIZE | X86.OPFLAG.ADDRSIZE); +X86.OPFLAG_PREFIXES = (X86.OPFLAG.SEG | X86.OPFLAG.LOCK | X86.OPFLAG.REPZ | X86.OPFLAG.REPNZ | X86.OPFLAG.DATASIZE | X86.OPFLAG.ADDRSIZE); if (typeof module !== 'undefined') module.exports = X86; diff --git a/modules/pcjs/lib/x86cpu.js b/modules/pcjs/lib/x86cpu.js index ba176b3ff..6b6bac433 100644 --- a/modules/pcjs/lib/x86cpu.js +++ b/modules/pcjs/lib/x86cpu.js @@ -42,9 +42,6 @@ if (typeof module !== 'undefined') { var CPU = require("./cpu"); var X86 = require("./x86"); var X86Seg = require("./x86seg"); - var X86Func = require("./x86func"); - var X86OpXX = require("./x86opxx"); - var X86Op0F = require("./x86op0f"); var X86ModB = require("./x86modb"); var X86ModW = require("./x86modw"); } @@ -712,8 +709,8 @@ X86CPU.prototype.setAddressMask = function(busMask) */ X86CPU.prototype.initProcessor = function() { - this.PS_SET = X86.PS.SET_8086; - this.PS_DIRECT = X86.PS.DIRECT_8086; + this.PS_SET = X86.PS_SET_8086; + this.PS_DIRECT = X86.PS_DIRECT_8086; this.OPFLAG_NOINTR_8086 = X86.OPFLAG.NOINTR; this.nShiftCountMask = 0xff; // on an 8086/8088, all shift counts are used as-is @@ -2251,7 +2248,7 @@ X86CPU.prototype.setOF = function() */ X86CPU.prototype.getPS = function() { - return (this.regPS & ~X86.PS.CACHED) | (this.getCF() | this.getPF() | this.getAF() | this.getZF() | this.getSF() | this.getOF()); + return (this.regPS & ~X86.PS_CACHED) | (this.getCF() | this.getPF() | this.getAF() | this.getZF() | this.getSF() | this.getOF()); }; /** @@ -2324,7 +2321,7 @@ X86CPU.prototype.setPS = function(regPS, cpl) } this.resultType = X86.RESULT.BYTE; - this.regPS = (this.regPS & ~(this.PS_DIRECT|X86.PS.CACHED)) | (regPS & (this.PS_DIRECT|X86.PS.CACHED)) | this.PS_SET; + this.regPS = (this.regPS & ~(this.PS_DIRECT|X86.PS_CACHED)) | (regPS & (this.PS_DIRECT|X86.PS_CACHED)) | this.PS_SET; if (this.regPS & X86.PS.TF) { this.intFlags |= X86.INTFLAG.TRAP; @@ -3432,7 +3429,7 @@ X86CPU.prototype.stepCPU = function(nMinCycles) if (!nMinCycles && !this.messageEnabled(Messages.PIC)) this.opFlags |= X86.OPFLAG.NOINTR; do { - var opPrefixes = this.opFlags & X86.OPFLAG.PREFIXES; + var opPrefixes = this.opFlags & X86.OPFLAG_PREFIXES; if (opPrefixes) { this.opPrefixes |= opPrefixes; } else { @@ -3554,7 +3551,7 @@ X86CPU.prototype.stepCPU = function(nMinCycles) /* * Make sure that every instruction is assessing a cycle cost, and that the cost is a net positive. */ - if (this.aFlags.fComplete && this.nStepCycles >= this.nSnapCycles && !(this.opFlags & X86.OPFLAG.PREFIXES)) { + if (this.aFlags.fComplete && this.nStepCycles >= this.nSnapCycles && !(this.opFlags & X86.OPFLAG_PREFIXES)) { this.println("cycle miscount: " + (this.nSnapCycles - this.nStepCycles)); this.setIP(this.opLIP - this.segCS.base); this.stopCPU(); diff --git a/modules/pcjs/lib/x86func.js b/modules/pcjs/lib/x86func.js index de708181f..e669a0e72 100644 --- a/modules/pcjs/lib/x86func.js +++ b/modules/pcjs/lib/x86func.js @@ -963,7 +963,7 @@ X86.fnIRET = function IRET() if (this.regPS & X86.PS.NT) { var addrNew = this.segTSS.base; var sel = this.getShort(addrNew + X86.TSS.PREV_TSS); - X86Seg.switchTSS.call(this.segCS, sel, false); + this.segCS.switchTSS(sel, false); return; } } diff --git a/modules/pcjs/lib/x86opxx.js b/modules/pcjs/lib/x86ops.js similarity index 99% rename from modules/pcjs/lib/x86opxx.js rename to modules/pcjs/lib/x86ops.js index 097b94403..6a0d46aae 100644 --- a/modules/pcjs/lib/x86opxx.js +++ b/modules/pcjs/lib/x86ops.js @@ -2559,7 +2559,7 @@ X86.opSAHF = function SAHF() /* * NOTE: While it make seem more efficient to do this: * - * this.setPS((this.getPS() & ~X86.PS.SAHF) | ((this.regEAX >> 8) & X86.PS.SAHF)); + * this.setPS((this.getPS() & ~X86.PS_SAHF) | ((this.regEAX >> 8) & X86.PS_SAHF)); * * getPS() forces any "cached" flags to be resolved first, and setPS() must do extra work above * and beyond setting the arithmetic and logical flags, so on balance, the code below may be more @@ -2572,7 +2572,7 @@ X86.opSAHF = function SAHF() if (ah & X86.PS.ZF) this.setZF(); else this.clearZF(); if (ah & X86.PS.SF) this.setSF(); else this.clearSF(); this.nStepCycles -= this.CYCLES.nOpCyclesLAHF; - this.assert((this.getPS() & X86.PS.SAHF) == (ah & X86.PS.SAHF)); + this.assert((this.getPS() & X86.PS_SAHF) == (ah & X86.PS_SAHF)); }; /** @@ -2582,7 +2582,7 @@ X86.opSAHF = function SAHF() */ X86.opLAHF = function LAHF() { - this.regEAX = (this.regEAX & ~0xff00) | (this.getPS() & X86.PS.SAHF) << 8; + this.regEAX = (this.regEAX & ~0xff00) | (this.getPS() & X86.PS_SAHF) << 8; this.nStepCycles -= this.CYCLES.nOpCyclesLAHF; }; diff --git a/modules/pcjs/package.json b/modules/pcjs/package.json index 3a2cb32fe..961f05145 100644 --- a/modules/pcjs/package.json +++ b/modules/pcjs/package.json @@ -1,6 +1,6 @@ { "name": "PCjs", - "version": "1.15.9", + "version": "1.17.5", "description": "IBM PC Emulator", "author": "Jeff Parsons ", "licenses": [ diff --git a/package.json b/package.json index 8e89b7120..79f0d2aca 100644 --- a/package.json +++ b/package.json @@ -107,7 +107,7 @@ "./modules/pcjs/lib/x86seg.js", "./modules/pcjs/lib/x86cpu.js", "./modules/pcjs/lib/x86func.js", - "./modules/pcjs/lib/x86opxx.js", + "./modules/pcjs/lib/x86ops.js", "./modules/pcjs/lib/x86op0f.js", "./modules/pcjs/lib/x86modb.js", "./modules/pcjs/lib/x86modw.js",