Minor annotation and name changes; the PDP11 emulator "branded" as PDP11js now, since PDP11 is too generic

This commit is contained in:
Jeff Parsons 2016-09-06 10:06:08 -07:00
commit 483d247491
13 changed files with 137 additions and 135 deletions

View file

@ -73,28 +73,15 @@ function CPUStatePDP11(parmsCPU)
CPUPDP11.call(this, parmsCPU, nCyclesDefault);
/*
* Initialize processor operation to match the requested model
*/
this.initProcessor();
/*
* A variety of stepCPU() state variables that don't strictly need to be initialized before the first
* stepCPU() call, but it's good form to do so.
*/
this.resetCycles();
this.flags.fComplete = this.flags.fDebugCheck = false;
/*
* If there are no live registers to display, then updateStatus() can skip a bit....
*/
this.cLiveRegs = 0;
/*
* This initRegs() call is important to create all the registers, so that if/when we call restore(),
* it will have something to fill in.
* Initialize processor operation to match the requested model
*/
this.initRegs();
this.initProcessor();
}
Component.subclass(CPUStatePDP11, CPUPDP11);
@ -113,6 +100,13 @@ Component.subclass(CPUStatePDP11, CPUPDP11);
CPUStatePDP11.prototype.initProcessor = function()
{
this.aOps = PDP11.aOpsPDP1170;
this.initRegs();
/*
* A variety of stepCPU() state variables that don't strictly need to be initialized before the first
* stepCPU() call, but it's good form to do so.
*/
this.resetCycles();
this.flags.fComplete = this.flags.fDebugCheck = false;
};
/**
@ -269,7 +263,6 @@ CPUStatePDP11.prototype.setBinding = function(sHTMLType, sBinding, control, sVal
switch (sBinding) {
case "PC":
case "PSW":
case "IF":
case "SF":
case "ZF":
case "CF":
@ -298,11 +291,11 @@ CPUStatePDP11.prototype.clearCF = function()
* getCF()
*
* @this {CPUStatePDP11}
* @return {number} 0 or 1 (PDP11.PS.CF)
* @return {number} 0 or 1 (PDP11.PSW.CF)
*/
CPUStatePDP11.prototype.getCF = function()
{
return (this.resultZeroCarry & 0x100)? PDP11.PS.CF : 0;
return (this.resultZeroCarry & 0x100)? PDP11.PSW.CF : 0;
};
/**
@ -340,11 +333,11 @@ CPUStatePDP11.prototype.clearZF = function()
* getZF()
*
* @this {CPUStatePDP11}
* @return {number} 0 or PDP11.PS.ZF
* @return {number} 0 or PDP11.PSW.ZF
*/
CPUStatePDP11.prototype.getZF = function()
{
return (this.resultZeroCarry & 0xff)? 0 : PDP11.PS.ZF;
return (this.resultZeroCarry & 0xff)? 0 : PDP11.PSW.ZF;
};
/**
@ -371,11 +364,11 @@ CPUStatePDP11.prototype.clearSF = function()
* getSF()
*
* @this {CPUStatePDP11}
* @return {number} 0 or PDP11.PS.SF
* @return {number} 0 or PDP11.PSW.SF
*/
CPUStatePDP11.prototype.getSF = function()
{
// return (this.resultParitySign & 0x80)? PDP11.PS.SF : 0;
// return (this.resultParitySign & 0x80)? PDP11.PSW.SF : 0;
return 0;
};
@ -419,7 +412,7 @@ CPUStatePDP11.prototype.setPC = function(addr)
*/
CPUStatePDP11.prototype.getPSW = function()
{
return (this.PSW & ~PDP11.PS.RESULT) | (this.getSF() | this.getZF() | this.getCF());
return (this.PSW & ~PDP11.PSW.RESULT) | (this.getSF() | this.getZF() | this.getCF());
};
/**
@ -513,11 +506,11 @@ CPUStatePDP11.prototype.updateStatus = function(fForce)
{
if (this.cLiveRegs) {
if (fForce || !this.flags.fRunning || this.flags.fDisplayLiveRegs) {
var regPS = this.getPSW();
this.updateReg("PSW", regPS, 4);
this.updateReg("SF", (regPS & PDP11.PS.SF)? 1 : 0, 1);
this.updateReg("ZF", (regPS & PDP11.PS.ZF)? 1 : 0, 1);
this.updateReg("CF", (regPS & PDP11.PS.CF)? 1 : 0, 1);
var regPSW = this.getPSW();
this.updateReg("PSW", regPSW, 4);
this.updateReg("SF", (regPSW & PDP11.PSW.SF)? 1 : 0, 1);
this.updateReg("ZF", (regPSW & PDP11.PSW.ZF)? 1 : 0, 1);
this.updateReg("CF", (regPSW & PDP11.PSW.CF)? 1 : 0, 1);
}
}
var controlSpeed = this.bindings["speed"];
@ -535,10 +528,11 @@ CPUStatePDP11.prototype.updateStatus = function(fForce)
* If the current state is WAIT (runState === 2) then skip any delay and
* go into RUN state.
*
* @param delay
* @param priority
* @param vector
* @param callback
* @this {CPUStatePDP11}
* @param {number} delay
* @param {number} priority
* @param {number} vector
* @param {function()} callback
*/
CPUStatePDP11.prototype.interrupt = function(delay, priority, vector, callback)
{
@ -603,14 +597,14 @@ CPUStatePDP11.prototype.writePSW = function(newPSW)
for (i = 0; i < 6; i++) {
j = this.registerVal[i];
this.registerVal[i] = this.registerAlt[i];
this.registerAlt[i] = j; // swap to alternate register set
this.registerAlt[i] = j; // swap to alternate register set
}
}
if ((this.mmuMode = (newPSW >> 14) & 3) !== (j = (this.PSW >> 14) & 3)) {
if ((this.mmuMode = (newPSW >> 14) & 3) !== ((this.PSW >> 14) & 3)) {
this.stackPointer[j] = this.registerVal[6];
this.registerVal[6] = this.stackPointer[this.mmuMode]; // swap to new mode SP
}
this.priorityReview = 2; // trigger check of priority levels
this.priorityReview = 2; // trigger check of priority levels
this.PSW = newPSW;
};

View file

@ -39,13 +39,14 @@
var APPCLASS = "pdp11"; // this @define is the default application class (eg, "pcx86", "c1pjs")
/**
* APPNAME is used more for display purposes than anything else now. APPCLASS is what matters in terms
* of folder and file names, CSS styles, etc.
*
* @define {string}
*/
var APPNAME = "PDP11"; // this @define is the default application name (eg, "PCx86", "C1Pjs")
var APPNAME = "PDP11js"; // this @define is the default application name (eg, "PCx86", "C1Pjs")
/**
* @define {boolean}
*
* WARNING: DEBUGGER needs to accurately reflect whether or not the Debugger component is (or will be) loaded.
* In the compiled case, we rely on the Closure Compiler to override DEBUGGER as appropriate. When it's *false*,
* nearly all of debugger.js will be conditionally removed by the compiler, reducing it to little more than a
@ -55,16 +56,18 @@ var APPNAME = "PDP11"; // this @define is the default application name
* However, when we're in "development mode" and running uncompiled code in debugger-less configurations,
* I would like to skip loading debugger.js altogether. When doing that, we must ALSO arrange for an additional file
* (nodebugger.js) to be loaded immediately after this file, which *explicitly* overrides DEBUGGER with *false*.
*
* @define {boolean}
*/
var DEBUGGER = true; // this @define is overridden by the Closure Compiler to remove Debugger-related support
/**
* @define {boolean}
*
* BYTEARRAYS is a Closure Compiler compile-time option that allocates an Array of numbers for every Memory block,
* where each a number represents ONE byte; very wasteful, but potentially slightly faster.
*
* See the Memory component for details.
*
* @define {boolean}
*/
var BYTEARRAYS = false;
@ -121,9 +124,9 @@ var PDP11 = {
ADDR_INVALID: -1,
/*
* Processor Status flag definitions (stored in regPS)
* Processor Status flag definitions (stored in regPSW)
*/
PS: {
PSW: {
CF: 0x0001, // bit 0: Carry Flag
OF: 0x0002, // bit 1: Overflow Flag
ZF: 0x0004, // bit 2: Zero Flag
@ -165,10 +168,10 @@ var PDP11 = {
};
/*
* PS "arithmetic" flags are NOT stored in the PS register; they are maintained across separate result registers,
* PSW "arithmetic" flags are NOT stored in the PSW register; they are maintained across separate result registers,
* hence the RESULT designation.
*/
PDP11.PS.RESULT = (PDP11.PS.CF | PDP11.PS.ZF | PDP11.PS.SF);
PDP11.PSW.RESULT = (PDP11.PSW.CF | PDP11.PSW.ZF | PDP11.PSW.SF);
if (NODE) {
global.APPCLASS = APPCLASS;