Added support to FileDump for generating binary dumps from MACRO11 listing (.lst) files, since I wasn't having much success with dumpobj or obj2hex.pl; note that this assumes a listing file produced by the macro11 cross-assembler written by Richard Krehbiel in 2001, updated in 2009, and maintained here: https://github.com/shattered/macro11. There are other versions of macro11 floating around, like the one in the simtools project that accompanies simh, and the one built for the Windows-based PDP11GUI app.
This commit is contained in:
parent
342746f2bc
commit
3a7b769fa3
31 changed files with 1117 additions and 751 deletions
|
|
@ -80,7 +80,7 @@ function FileDump(sFormat, fComments, fDecimal, offDump, nWidthDump, sServerRoot
|
|||
FileDump.sAPIURL = "http://www.pcjs.org" + DumpAPI.ENDPOINT;
|
||||
FileDump.sCopyright = "© 2012-2016 by Jeff Parsons (@jeffpar)";
|
||||
FileDump.sNotice = FileDump.sAPIURL + " " + FileDump.sCopyright;
|
||||
FileDump.sUsage = "Usage: " + FileDump.sAPIURL + "?" + DumpAPI.QUERY.FILE + "=({path}|{URL})&" + DumpAPI.QUERY.FORMAT + "=(json|data|hex|bytes|rom)";
|
||||
FileDump.sUsage = "Usage: " + FileDump.sAPIURL + "?" + DumpAPI.QUERY.FILE + "=({path}|{URL})&" + DumpAPI.QUERY.FORMAT + "=(json|data|hex|octal|bytes|words|rom)";
|
||||
|
||||
FileDump.asBadExts = [
|
||||
"js", "log"
|
||||
|
|
@ -97,15 +97,26 @@ FileDump.asBadExts = [
|
|||
*
|
||||
* Usage
|
||||
* ---
|
||||
* filedump --file=({path}|{URL}) [--merge=({path}|{url})] [--format=(json|data|hex|bytes|rom)] [--comments]
|
||||
* [--decimal] [--offset={number}] [--width={number}] [--output={path}] [--overwrite]
|
||||
* filedump --file=({path}|{URL}) [--merge=({path}|{url})] [--format=(json|data|hex|octal|bytes|words|rom)]
|
||||
* [--comments] [--decimal] [--offset={number}] [--width={number}] [--output={path}] [--overwrite]
|
||||
*
|
||||
* Arguments
|
||||
* ---
|
||||
* The default format is "json", which generates an array of signed 32-bit decimal values; "hex" is an older
|
||||
* text format that consists entirely of 2-character hex values (deprecated), and "bytes" is a JSON-like format
|
||||
* that also uses hex values (but with "0x" prefixes) and is normally used only when comments are enabled (use
|
||||
* --decimal to force decimal byte output).
|
||||
* --decimal to force decimal byte output). "words" are like "bytes" except that it outputs 16-bit values
|
||||
* instead of 8-bit values; "octal" is an alias for "words", the only difference being that it includes a comment
|
||||
* alongside each word with the octal form of the word.
|
||||
*
|
||||
* If you want actual octal output, then an --octal option should be added at some point; however, that begs the
|
||||
* question of how to render octal numbers so that all versions of JavaScript interpret them correctly. Prefixing
|
||||
* octal values with an extra zero was the old convention, but it was never formally adopted and it isn't allowed
|
||||
* in "strict" mode. Prefixing them with "0o" is the new convention for ES6 and up, which is great, but we still
|
||||
* have no octal format that works across the board. We can use the new octal format in code, because we always
|
||||
* compile browser-based code back to ES5 (converting all numeric constants to decimal), and current versions of
|
||||
* Node support it as well (we don't care about old versions of Node). But what we store in data files is more
|
||||
* problematic.
|
||||
*
|
||||
* When a second file is "merged", the first file sets all even bytes and the second file sets all odd bytes.
|
||||
* In fact, any number of files can be merged: if there are N files, file #1 sets bytes at "offset mod N == 0",
|
||||
|
|
@ -133,7 +144,7 @@ FileDump.CLI = function()
|
|||
var args = proc.getArgs();
|
||||
|
||||
if (!args.argc) {
|
||||
console.log("usage: filedump --file=({path}|{URL}) [--merge=({path}|{url})] [--format=(json|data|hex|bytes|rom)] [--comments] [--decimal] [--offset={number}] [--width={number}] [--output={path}] [--overwrite]");
|
||||
console.log("usage: filedump --file=({path}|{URL}) [--merge=({path}|{url})] [--format=(json|data|hex|octal|bytes|words|rom)] [--comments] [--decimal] [--offset={number}] [--width={number}] [--output={path}] [--overwrite]");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -239,9 +250,12 @@ FileDump.prototype.loadFile = function(sFile, iStart, nSkip, done)
|
|||
{
|
||||
var obj = this;
|
||||
|
||||
var encoding = null;
|
||||
var sExt = str.getExtension(sFile);
|
||||
var options = {encoding: sExt == DumpAPI.FORMAT.JSON || sExt == DumpAPI.FORMAT.HEX? "utf8" : null};
|
||||
|
||||
if (sExt == DumpAPI.FORMAT.JSON || sExt == DumpAPI.FORMAT.HEX || sExt == "lst") {
|
||||
encoding = "utf8";
|
||||
}
|
||||
var options = {encoding: encoding};
|
||||
var sFilePath = (this.fLocal || net.isRemote(sFile))? sFile : path.join(this.sServerRoot, sFile);
|
||||
|
||||
if (!this.sFilePath) this.sFilePath = sFilePath;
|
||||
|
|
@ -254,7 +268,7 @@ FileDump.prototype.loadFile = function(sFile, iStart, nSkip, done)
|
|||
done(err);
|
||||
return;
|
||||
}
|
||||
obj.setData(buf, iStart, nSkip);
|
||||
obj.setData(buf, iStart, nSkip, sExt);
|
||||
done(null);
|
||||
});
|
||||
} else {
|
||||
|
|
@ -264,14 +278,58 @@ FileDump.prototype.loadFile = function(sFile, iStart, nSkip, done)
|
|||
done(err);
|
||||
return;
|
||||
}
|
||||
obj.setData(buf, iStart, nSkip);
|
||||
obj.setData(buf, iStart, nSkip, sExt);
|
||||
done(null);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* setData(buf, iStart, nSkip)
|
||||
* parseListing(sListing)
|
||||
*
|
||||
* Parses the data within a MACRO11 listing file and produces an array of bytes.
|
||||
*
|
||||
* @this {FileDump}
|
||||
* @param {string} sListing
|
||||
* @return {Array.<number>}
|
||||
*/
|
||||
FileDump.prototype.parseListing = function(sListing)
|
||||
{
|
||||
var ab = [];
|
||||
var matchLine;
|
||||
var re = /^([0-9 ]{9})([0-7]{6})[ ]+([0-7]+)[ ]*([0-7']+|)[ ]+([0-7']+|)[ ]+(.*)$/gm;
|
||||
var addrStart = null;
|
||||
while (matchLine = re.exec(sListing)) {
|
||||
/*
|
||||
* matchLine[1]: line # (optional)
|
||||
* matchLine[2]: address
|
||||
* matchLine[3]: 6-digit opcode or 3-digit data
|
||||
* matchLine[4]: 6-digit operand (with optional apostrophe) or 3-digit data
|
||||
* matchLine[5]: 6-digit operand (with optional apostrophe) or 3-digit data
|
||||
*/
|
||||
var addrLine = parseInt(matchLine[2], 8);
|
||||
if (addrStart == null) addrStart = addrLine;
|
||||
for (var i = 3, s; i <= 5 && (s = matchLine[i]); i++) {
|
||||
var data = parseInt(s.substr(0, 6), 8);
|
||||
if (s.length == 3) {
|
||||
addrLine++;
|
||||
ab.push(data);
|
||||
}
|
||||
else {
|
||||
addrLine += 2;
|
||||
if (s.length == 7) {
|
||||
data -= addrLine;
|
||||
}
|
||||
ab.push(data & 0xff);
|
||||
ab.push(data >> 8);
|
||||
}
|
||||
}
|
||||
}
|
||||
return ab;
|
||||
};
|
||||
|
||||
/**
|
||||
* setData(buf, iStart, nSkip, sExt)
|
||||
*
|
||||
* Records the given file data in the FileDump's buffer
|
||||
*
|
||||
|
|
@ -279,13 +337,17 @@ FileDump.prototype.loadFile = function(sFile, iStart, nSkip, done)
|
|||
* @param {Buffer|string} buf
|
||||
* @param {number} iStart
|
||||
* @param {number} nSkip
|
||||
* @param {string} [sExt]
|
||||
*/
|
||||
FileDump.prototype.setData = function(buf, iStart, nSkip)
|
||||
FileDump.prototype.setData = function(buf, iStart, nSkip, sExt)
|
||||
{
|
||||
var b, i, j, s;
|
||||
if (typeof buf == "string") {
|
||||
var ab = [];
|
||||
if (buf.indexOf('{') >= 0) {
|
||||
if (sExt == "lst") {
|
||||
ab = this.parseListing(buf);
|
||||
}
|
||||
else if (buf.indexOf('{') >= 0) {
|
||||
/*
|
||||
* Treat the incoming string data as JSON data.
|
||||
*/
|
||||
|
|
@ -321,7 +383,6 @@ FileDump.prototype.setData = function(buf, iStart, nSkip)
|
|||
* If we didn't recognize the data, then simply return, leaving this.buf undefined.
|
||||
*/
|
||||
if (!ab.length) return;
|
||||
|
||||
buf = new Buffer(ab);
|
||||
}
|
||||
if (!this.buf) {
|
||||
|
|
@ -406,6 +467,12 @@ FileDump.prototype.dumpBuffer = function(sKey, buf, len, cbItem, offDump, nWidth
|
|||
{
|
||||
var chOpen = '', chClose = '', chSep = ' ', sHexPrefix = "";
|
||||
|
||||
var nBase = 16;
|
||||
if (sKey == DumpAPI.FORMAT.OCTAL) {
|
||||
sKey = DumpAPI.FORMAT.WORDS;
|
||||
nBase = 8;
|
||||
}
|
||||
|
||||
this.sKey = sKey;
|
||||
|
||||
if (this.sFormat != DumpAPI.FORMAT.HEX) {
|
||||
|
|
@ -419,7 +486,7 @@ FileDump.prototype.dumpBuffer = function(sKey, buf, len, cbItem, offDump, nWidth
|
|||
|
||||
var sLine = "";
|
||||
var sASCII = "";
|
||||
var cMaxCols = nWidthDump * cbItem;
|
||||
var cMaxCols = nWidthDump * (cbItem == 2 && nBase == 8? 1 : cbItem);
|
||||
|
||||
for (var off = offDump; off < len; off += cbItem) {
|
||||
|
||||
|
|
@ -431,7 +498,7 @@ FileDump.prototype.dumpBuffer = function(sKey, buf, len, cbItem, offDump, nWidth
|
|||
break;
|
||||
}
|
||||
|
||||
var v = (cbItem == 1? buf.readUInt8(off) : buf.readInt32LE(off));
|
||||
var v = (cbItem == 1? buf.readUInt8(off) : (cbItem == 2? buf.readInt16LE(off) : buf.readInt32LE(off)));
|
||||
|
||||
if (off > offDump) {
|
||||
sLine += chSep;
|
||||
|
|
@ -441,7 +508,11 @@ FileDump.prototype.dumpBuffer = function(sKey, buf, len, cbItem, offDump, nWidth
|
|||
}
|
||||
}
|
||||
if (cbItem > 1) {
|
||||
sLine += v;
|
||||
if (cbItem > 2) {
|
||||
sLine += v;
|
||||
} else {
|
||||
sLine += str.toHexWord(v) + (nBase == 8? " /*" + str.toOct(v & 0xffff, 6) + "*/" : "");
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (this.fDecimal) {
|
||||
|
|
@ -662,6 +733,9 @@ FileDump.prototype.buildJSON = function()
|
|||
// console.log("length of buffer: " + this.buf.length);
|
||||
if (this.fJSONComments || this.sFormat == DumpAPI.FORMAT.HEX || this.sFormat == DumpAPI.FORMAT.BYTES) {
|
||||
this.json += this.dumpBuffer(null, this.buf, this.buf.length, 1);
|
||||
}
|
||||
else if (this.sFormat == DumpAPI.FORMAT.OCTAL || this.sFormat == DumpAPI.FORMAT.WORDS) {
|
||||
this.json += this.dumpBuffer(this.sFormat, this.buf, this.buf.length, 2);
|
||||
} else {
|
||||
this.json += this.dumpBuffer("data", this.buf, this.buf.length, 4);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ function BusPDP11(parmsBus, cpu, dbg)
|
|||
/*
|
||||
* Compute all BusPDP11 memory block parameters, based on the width of the bus. The entire
|
||||
* address space is divided into blocks, using a block size that is (hopefully) appropriate to
|
||||
* the bus width. The following table summarizes our simplistic calculations.
|
||||
* the bus width. The following table summarizes our (original) simplistic calculations:
|
||||
*
|
||||
* Bus Width Block Shift Block Size
|
||||
* --------- ----------- ----------
|
||||
|
|
@ -104,10 +104,19 @@ function BusPDP11(parmsBus, cpu, dbg)
|
|||
*/
|
||||
this.addrTotal = Math.pow(2, this.nBusWidth);
|
||||
this.nBusLimit = this.nBusMask = (this.addrTotal - 1) | 0;
|
||||
this.nBlockShift = (this.nBusWidth >> 1) + 2;
|
||||
if (this.nBlockShift < 10) this.nBlockShift = 10;
|
||||
if (this.nBlockShift > 15) this.nBlockShift = 15;
|
||||
this.nBlockSize = 1 << this.nBlockShift;
|
||||
|
||||
/*
|
||||
* WARNING: Instead of dynamically calculating nBlockShift based on nBusWidth, as described above, we
|
||||
* now force nBlockSize to IOPAGE_LENGTH, because that's what our IOController functions currently require.
|
||||
*
|
||||
* this.nBlockShift = (this.nBusWidth >> 1) + 2;
|
||||
* if (this.nBlockShift < 10) this.nBlockShift = 10;
|
||||
* if (this.nBlockShift > 15) this.nBlockShift = 15;
|
||||
* this.nBlockSize = 1 << this.nBlockShift;
|
||||
*/
|
||||
this.nBlockSize = BusPDP11.IOPAGE_LENGTH;
|
||||
this.nBlockShift = Math.log2(this.nBlockSize); // ES6 ALERT (alternatively: Math.log(this.nBlockSize) / Math.LN2)
|
||||
|
||||
this.nBlockLen = this.nBlockSize >> 2;
|
||||
this.nBlockLimit = this.nBlockSize - 1;
|
||||
this.nBlockTotal = (this.addrTotal / this.nBlockSize) | 0;
|
||||
|
|
@ -272,7 +281,7 @@ BusPDP11.IOController = {
|
|||
}
|
||||
return b;
|
||||
}
|
||||
b = bus.unknownAccess(addr | BusPDP11.IOPAGE_22BIT, -1, 1);
|
||||
b = bus.unknownAccess(addr, -1, true);
|
||||
if (DEBUGGER && this.dbg && this.dbg.messageEnabled(MessagesPDP11.BUS)) {
|
||||
this.dbg.printMessage("warning: unconverted read access to byte @" + this.dbg.toStrBase(addr) + ": " + this.dbg.toStrBase(b), true, true);
|
||||
}
|
||||
|
|
@ -345,7 +354,7 @@ BusPDP11.IOController = {
|
|||
}
|
||||
return;
|
||||
}
|
||||
bus.unknownAccess(addr | BusPDP11.IOPAGE_22BIT, b, 1);
|
||||
bus.unknownAccess(addr, b, true);
|
||||
if (DEBUGGER && this.dbg && this.dbg.messageEnabled(MessagesPDP11.BUS)) {
|
||||
this.dbg.printMessage("warning: unconverted write access to byte @" + this.dbg.toStrBase(addr) + ": " + this.dbg.toStrBase(b), true, true);
|
||||
}
|
||||
|
|
@ -377,7 +386,7 @@ BusPDP11.IOController = {
|
|||
}
|
||||
return w;
|
||||
}
|
||||
w = bus.unknownAccess(addr | BusPDP11.IOPAGE_22BIT, -1, 0);
|
||||
w = bus.unknownAccess(addr, -1);
|
||||
if (DEBUGGER && this.dbg && this.dbg.messageEnabled(MessagesPDP11.BUS)) {
|
||||
this.dbg.printMessage("warning: unconverted read access to word @" + this.dbg.toStrBase(addr) + ": " + this.dbg.toStrBase(w), true, true);
|
||||
}
|
||||
|
|
@ -413,7 +422,7 @@ BusPDP11.IOController = {
|
|||
}
|
||||
return;
|
||||
}
|
||||
bus.unknownAccess(addr | BusPDP11.IOPAGE_22BIT, w, 0);
|
||||
bus.unknownAccess(addr, w);
|
||||
if (DEBUGGER && this.dbg && this.dbg.messageEnabled(MessagesPDP11.BUS)) {
|
||||
this.dbg.printMessage("warning: unconverted write access to word @" + this.dbg.toStrBase(addr) + ": " + this.dbg.toStrBase(w), true, true);
|
||||
}
|
||||
|
|
@ -530,24 +539,23 @@ BusPDP11.prototype.reset = function()
|
|||
};
|
||||
|
||||
/**
|
||||
* unknownAccess(addr, data, byteFlag)
|
||||
* unknownAccess(addr, data, fByte)
|
||||
*
|
||||
* This is our default I/O handler, called whenever there's an IOPAGE access without a corresponding entry
|
||||
* in aIOHandlers.
|
||||
* This is our default I/O handler, called when there's an IOPAGE access without a corresponding entry in aIOHandlers.
|
||||
*
|
||||
* @this {BusPDP11}
|
||||
* @param {number} addr (ie, an IOPAGE address)
|
||||
* @param {number} data (-1 if read, otherwise write)
|
||||
* @param {number} byteFlag (true if byte I/O, otherwise word)
|
||||
* @param {boolean} [fByte] (true if byte access, otherwise word)
|
||||
* @return {number}
|
||||
*/
|
||||
BusPDP11.prototype.unknownAccess = function(addr, data, byteFlag)
|
||||
BusPDP11.prototype.unknownAccess = function(addr, data, fByte)
|
||||
{
|
||||
if (DEBUGGER && this.dbg && this.dbg.messageEnabled(MessagesPDP11.WARN)) {
|
||||
/*
|
||||
* TODO: For 22-bit machines, let's display addr as a 3-byte value (for a total of 9 octal digits)
|
||||
*/
|
||||
this.dbg.printMessage("warning: unknown I/O access (" + this.dbg.toStrBase(addr, 3) + "," + this.dbg.toStrBase(data) + "," + byteFlag + ")", true, true);
|
||||
this.dbg.printMessage("warning: unknown I/O access (" + this.dbg.toStrBase(addr, 3) + "," + this.dbg.toStrBase(data) + "," + fByte + ")", true, true);
|
||||
this.cpu.setPC(this.cpu.getLastPC());
|
||||
this.cpu.stopCPU();
|
||||
}
|
||||
|
|
@ -663,7 +671,7 @@ BusPDP11.prototype.addMemory = function(addr, size, type, controller)
|
|||
}
|
||||
|
||||
if (sizeLeft <= 0) {
|
||||
this.status(Math.floor(size / 1024) + "Kb " + MemoryPDP11.TYPE_NAMES[type] + " at " + str.toHexLong(addr));
|
||||
this.status(str.toDec(size / 1024) + "Kb " + MemoryPDP11.TYPE_NAMES[type] + " at " + str.toOct(addr));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -962,7 +962,7 @@ CPUPDP11.prototype.setTimer = function(iTimer, ms, fReset)
|
|||
*/
|
||||
CPUPDP11.prototype.getMSCycles = function(ms)
|
||||
{
|
||||
return (this.nCyclesPerSecond * this.nCyclesMultiplier) / 1000 * ms;
|
||||
return ((this.nCyclesPerSecond * this.nCyclesMultiplier) / 1000 * ms)|0;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -37,10 +37,12 @@ if (NODE) {
|
|||
}
|
||||
|
||||
/*
|
||||
* Decoding starts at the bottom of this file, in op1170(). The basic decoding approach is to
|
||||
* dispatch on the top 4 bits of the opcode, and if further decoding is required, the dispatched
|
||||
* function will dispatch on the next 4 bits, and so on (although some of the intermediate levels
|
||||
* dispatch only on 2 bits, which could also handled with a switch statement).
|
||||
* Decoding starts at the bottom of this file, in op1120() and op1170().
|
||||
*
|
||||
* The basic decoding approach is to dispatch on the top 4 bits of the opcode, and if further
|
||||
* decoding is required, the dispatched function will dispatch on the next 4 bits, and so on
|
||||
* (although some of the intermediate levels dispatch only on 2 bits, which could also be handled
|
||||
* with a switch statement).
|
||||
*
|
||||
* Eventually, every opcode should end up either in an opXXX() function or opUndefined(). For
|
||||
* opcodes that perform a simple read and/or write operation, the entire operation is handled by
|
||||
|
|
@ -1765,285 +1767,234 @@ PDP11.opUndefined = function(opCode)
|
|||
};
|
||||
|
||||
/**
|
||||
* op0Xnn_1170(opCode)
|
||||
* op1120(opCode)
|
||||
*
|
||||
* @this {CPUStatePDP11}
|
||||
* @param {number} opCode
|
||||
*/
|
||||
PDP11.op0Xnn_1170 = function(opCode)
|
||||
PDP11.op1120 = function(opCode)
|
||||
{
|
||||
PDP11.aOps0Xnn_1170[(opCode >> 8) & 0xf].call(this, opCode);
|
||||
PDP11.aOpXnnn_1120[opCode >> 12].call(this, opCode);
|
||||
};
|
||||
|
||||
/**
|
||||
* op0AXn_1170(opCode)
|
||||
* op0Xnn_1120(opCode)
|
||||
*
|
||||
* @this {CPUStatePDP11}
|
||||
* @param {number} opCode
|
||||
*/
|
||||
PDP11.op0AXn_1170 = function(opCode)
|
||||
PDP11.op0Xnn_1120 = function(opCode)
|
||||
{
|
||||
PDP11.aOps0AXn_1170[(opCode >> 6) & 0x3].call(this, opCode);
|
||||
PDP11.aOp0Xnn_1120[(opCode >> 8) & 0xf].call(this, opCode);
|
||||
};
|
||||
|
||||
/**
|
||||
* op0BXn_1170(opCode)
|
||||
* op0AXn_1120(opCode)
|
||||
*
|
||||
* @this {CPUStatePDP11}
|
||||
* @param {number} opCode
|
||||
*/
|
||||
PDP11.op0BXn_1170 = function(opCode)
|
||||
PDP11.op0AXn_1120 = function(opCode)
|
||||
{
|
||||
PDP11.aOps0BXn_1170[(opCode >> 6) & 0x3].call(this, opCode);
|
||||
PDP11.aOp0AXn_1120[(opCode >> 6) & 0x3].call(this, opCode);
|
||||
};
|
||||
|
||||
/**
|
||||
* op0CXn_1170(opCode)
|
||||
* op0BXn_1120(opCode)
|
||||
*
|
||||
* @this {CPUStatePDP11}
|
||||
* @param {number} opCode
|
||||
*/
|
||||
PDP11.op0CXn_1170 = function(opCode)
|
||||
PDP11.op0BXn_1120 = function(opCode)
|
||||
{
|
||||
PDP11.aOps0CXn_1170[(opCode >> 6) & 0x3].call(this, opCode);
|
||||
PDP11.aOp0BXn_1120[(opCode >> 6) & 0x3].call(this, opCode);
|
||||
};
|
||||
|
||||
/**
|
||||
* op0DXn_1170(opCode)
|
||||
* op0CXn_1120(opCode)
|
||||
*
|
||||
* @this {CPUStatePDP11}
|
||||
* @param {number} opCode
|
||||
*/
|
||||
PDP11.op0DXn_1170 = function(opCode)
|
||||
PDP11.op0CXn_1120 = function(opCode)
|
||||
{
|
||||
PDP11.aOps0DXn_1170[(opCode >> 6) & 0x3].call(this, opCode);
|
||||
PDP11.aOp0CXn_1120[(opCode >> 6) & 0x3].call(this, opCode);
|
||||
};
|
||||
|
||||
/**
|
||||
* op00Xn_1170(opCode)
|
||||
* op00Xn_1120(opCode)
|
||||
*
|
||||
* @this {CPUStatePDP11}
|
||||
* @param {number} opCode
|
||||
*/
|
||||
PDP11.op00Xn_1170 = function(opCode)
|
||||
PDP11.op00Xn_1120 = function(opCode)
|
||||
{
|
||||
PDP11.aOps00Xn_1170[(opCode >> 4) & 0xf].call(this, opCode);
|
||||
PDP11.aOp00Xn_1120[(opCode >> 4) & 0xf].call(this, opCode);
|
||||
};
|
||||
|
||||
/**
|
||||
* op008X_1170(opCode)
|
||||
* op00AX_1120(opCode)
|
||||
*
|
||||
* @this {CPUStatePDP11}
|
||||
* @param {number} opCode
|
||||
*/
|
||||
PDP11.op008X_1170 = function(opCode)
|
||||
PDP11.op00AX_1120 = function(opCode)
|
||||
{
|
||||
PDP11.aOps00AX_1170[opCode & 0xf].call(this, opCode);
|
||||
PDP11.aOp00AX_1120[opCode & 0xf].call(this, opCode);
|
||||
};
|
||||
|
||||
/**
|
||||
* op00AX_1170(opCode)
|
||||
* op00BX_1120(opCode)
|
||||
*
|
||||
* @this {CPUStatePDP11}
|
||||
* @param {number} opCode
|
||||
*/
|
||||
PDP11.op00AX_1170 = function(opCode)
|
||||
PDP11.op00BX_1120 = function(opCode)
|
||||
{
|
||||
PDP11.aOps00AX_1170[opCode & 0xf].call(this, opCode);
|
||||
PDP11.aOp00BX_1120[opCode & 0xf].call(this, opCode);
|
||||
};
|
||||
|
||||
/**
|
||||
* op00BX_1170(opCode)
|
||||
* op000X_1120(opCode)
|
||||
*
|
||||
* @this {CPUStatePDP11}
|
||||
* @param {number} opCode
|
||||
*/
|
||||
PDP11.op00BX_1170 = function(opCode)
|
||||
PDP11.op000X_1120 = function(opCode)
|
||||
{
|
||||
PDP11.aOps00BX_1170[opCode & 0xf].call(this, opCode);
|
||||
PDP11.aOp000X_1120[opCode & 0xf].call(this, opCode);
|
||||
};
|
||||
|
||||
/**
|
||||
* op000X_1170(opCode)
|
||||
* op8Xnn_1120(opCode)
|
||||
*
|
||||
* @this {CPUStatePDP11}
|
||||
* @param {number} opCode
|
||||
*/
|
||||
PDP11.op000X_1170 = function(opCode)
|
||||
PDP11.op8Xnn_1120 = function(opCode)
|
||||
{
|
||||
PDP11.aOps000X_1170[opCode & 0xf].call(this, opCode);
|
||||
PDP11.aOp8Xnn_1120[(opCode >> 8) & 0xf].call(this, opCode);
|
||||
};
|
||||
|
||||
/**
|
||||
* op7Xnn_1170(opCode)
|
||||
* op8AXn_1120(opCode)
|
||||
*
|
||||
* @this {CPUStatePDP11}
|
||||
* @param {number} opCode
|
||||
*/
|
||||
PDP11.op7Xnn_1170 = function(opCode)
|
||||
PDP11.op8AXn_1120 = function(opCode)
|
||||
{
|
||||
PDP11.aOps7Xnn_1170[(opCode >> 8) & 0xf].call(this, opCode);
|
||||
PDP11.aOp8AXn_1120[(opCode >> 6) & 0x3].call(this, opCode);
|
||||
};
|
||||
|
||||
/**
|
||||
* op8Xnn_1170(opCode)
|
||||
* op8BXn_1120(opCode)
|
||||
*
|
||||
* @this {CPUStatePDP11}
|
||||
* @param {number} opCode
|
||||
*/
|
||||
PDP11.op8Xnn_1170 = function(opCode)
|
||||
PDP11.op8BXn_1120 = function(opCode)
|
||||
{
|
||||
PDP11.aOps8Xnn_1170[(opCode >> 8) & 0xf].call(this, opCode);
|
||||
PDP11.aOp8BXn_1120[(opCode >> 6) & 0x3].call(this, opCode);
|
||||
};
|
||||
|
||||
/**
|
||||
* op8AXn_1170(opCode)
|
||||
* op8CXn_1120(opCode)
|
||||
*
|
||||
* @this {CPUStatePDP11}
|
||||
* @param {number} opCode
|
||||
*/
|
||||
PDP11.op8AXn_1170 = function(opCode)
|
||||
PDP11.op8CXn_1120 = function(opCode)
|
||||
{
|
||||
PDP11.aOps8AXn_1170[(opCode >> 6) & 0x3].call(this, opCode);
|
||||
PDP11.aOp8CXn_1120[(opCode >> 6) & 0x3].call(this, opCode);
|
||||
};
|
||||
|
||||
/**
|
||||
* op8BXn_1170(opCode)
|
||||
*
|
||||
* @this {CPUStatePDP11}
|
||||
* @param {number} opCode
|
||||
*/
|
||||
PDP11.op8BXn_1170 = function(opCode)
|
||||
{
|
||||
PDP11.aOps8BXn_1170[(opCode >> 6) & 0x3].call(this, opCode);
|
||||
};
|
||||
|
||||
/**
|
||||
* op8CXn_1170(opCode)
|
||||
*
|
||||
* @this {CPUStatePDP11}
|
||||
* @param {number} opCode
|
||||
*/
|
||||
PDP11.op8CXn_1170 = function(opCode)
|
||||
{
|
||||
PDP11.aOps8CXn_1170[(opCode >> 6) & 0x3].call(this, opCode);
|
||||
};
|
||||
|
||||
/**
|
||||
* op8DXn_1170(opCode)
|
||||
*
|
||||
* @this {CPUStatePDP11}
|
||||
* @param {number} opCode
|
||||
*/
|
||||
PDP11.op8DXn_1170 = function(opCode)
|
||||
{
|
||||
PDP11.aOps8DXn_1170[(opCode >> 6) & 0x3].call(this, opCode);
|
||||
};
|
||||
|
||||
/**
|
||||
* op1170(opCode)
|
||||
*
|
||||
* @this {CPUStatePDP11}
|
||||
* @param {number} opCode
|
||||
*/
|
||||
PDP11.op1170 = function(opCode)
|
||||
{
|
||||
PDP11.aOpsXnnn_1170[opCode >> 12].call(this, opCode);
|
||||
};
|
||||
|
||||
PDP11.aOpsXnnn_1170 = [
|
||||
PDP11.op0Xnn_1170, // 0x0nnn
|
||||
PDP11.opMOV, // 0x1nnn 01SSDD
|
||||
PDP11.opCMP, // 0x2nnn 02SSDD
|
||||
PDP11.opBIT, // 0x3nnn 03SSDD
|
||||
PDP11.opBIC, // 0x4nnn 04SSDD
|
||||
PDP11.opBIS, // 0x5nnn 05SSDD
|
||||
PDP11.opADD, // 0x6nnn 06SSDD
|
||||
PDP11.op7Xnn_1170, // 0x7nnn
|
||||
PDP11.op8Xnn_1170, // 0x8nnn
|
||||
PDP11.opMOVB, // 0x9nnn 11SSDD
|
||||
PDP11.opCMPB, // 0xAnnn 12SSDD
|
||||
PDP11.opBITB, // 0xBnnn 13SSDD
|
||||
PDP11.opBICB, // 0xCnnn 14SSDD
|
||||
PDP11.opBISB, // 0xDnnn 15SSDD
|
||||
PDP11.opSUB, // 0xEnnn 16SSDD
|
||||
PDP11.aOpXnnn_1120 = [
|
||||
PDP11.op0Xnn_1120, // 0x0nnn
|
||||
PDP11.opMOV, // 0x1nnn 01SSDD 11/20+ 2.3
|
||||
PDP11.opCMP, // 0x2nnn 02SSDD 11/20+ 2.3*
|
||||
PDP11.opBIT, // 0x3nnn 03SSDD 11/20+ 2.9*
|
||||
PDP11.opBIC, // 0x4nnn 04SSDD 11/20+ 2.9
|
||||
PDP11.opBIS, // 0x5nnn 05SSDD 11/20+ 2.3
|
||||
PDP11.opADD, // 0x6nnn 06SSDD 11/20+ 2.3
|
||||
PDP11.opUndefined, // 0x7nnn
|
||||
PDP11.op8Xnn_1120, // 0x8nnn
|
||||
PDP11.opMOVB, // 0x9nnn 11SSDD 11/20+ 2.3
|
||||
PDP11.opCMPB, // 0xAnnn 12SSDD 11/20+ 2.3
|
||||
PDP11.opBITB, // 0xBnnn 13SSDD 11/20+ 2.9
|
||||
PDP11.opBICB, // 0xCnnn 14SSDD 11/20+ 2.9
|
||||
PDP11.opBISB, // 0xDnnn 15SSDD 11/20+ 2.3
|
||||
PDP11.opSUB, // 0xEnnn 16SSDD 11/20+ 2.3
|
||||
PDP11.opUndefined // 0xFnnn
|
||||
];
|
||||
|
||||
PDP11.aOps0Xnn_1170 = [
|
||||
PDP11.op00Xn_1170, // 0x00nn
|
||||
PDP11.opBR, // 0x01nn
|
||||
PDP11.opBNE, // 0x02nn
|
||||
PDP11.opBEQ, // 0x03nn
|
||||
PDP11.opBGE, // 0x04nn
|
||||
PDP11.opBLT, // 0x05nn
|
||||
PDP11.opBGT, // 0x06nn
|
||||
PDP11.opBLE, // 0x07nn
|
||||
PDP11.opJSR, // 0x08nn
|
||||
PDP11.opJSR, // 0x09nn
|
||||
PDP11.op0AXn_1170, // 0x0Ann
|
||||
PDP11.op0BXn_1170, // 0x0Bnn
|
||||
PDP11.op0CXn_1170, // 0x0Cnn
|
||||
PDP11.op0DXn_1170, // 0x0Dnn
|
||||
PDP11.aOp0Xnn_1120 = [
|
||||
PDP11.op00Xn_1120, // 0x00nn
|
||||
PDP11.opBR, // 0x01nn 0004XX 11/20+ 2.6
|
||||
PDP11.opBNE, // 0x02nn 0010XX 11/20+ 2.6**
|
||||
PDP11.opBEQ, // 0x03nn 0014XX 11/20+ 2.6**
|
||||
PDP11.opBGE, // 0x04nn 0020XX 11/20+ 2.6**
|
||||
PDP11.opBLT, // 0x05nn 0024XX 11/20+ 2.6**
|
||||
PDP11.opBGT, // 0x06nn 0030XX 11/20+ 2.6**
|
||||
PDP11.opBLE, // 0x07nn 0034XX 11/20+ 2.6**
|
||||
PDP11.opJSR, // 0x08nn 004RDD 11/20+ 4.4
|
||||
PDP11.opJSR, // 0x09nn 004RDD 11/20+ 4.4
|
||||
PDP11.op0AXn_1120, // 0x0Ann
|
||||
PDP11.op0BXn_1120, // 0x0Bnn
|
||||
PDP11.op0CXn_1120, // 0x0Cnn
|
||||
PDP11.opUndefined, // 0x0Dnn
|
||||
PDP11.opUndefined, // 0x0Enn
|
||||
PDP11.opUndefined // 0x0Fnn
|
||||
];
|
||||
|
||||
PDP11.aOps0AXn_1170 = [
|
||||
PDP11.opCLR, // 0x0A0n
|
||||
PDP11.opCOM, // 0x0A4n
|
||||
PDP11.opINC, // 0x0A8n
|
||||
PDP11.opDEC // 0x0ACn
|
||||
PDP11.aOp0AXn_1120 = [
|
||||
PDP11.opCLR, // 0x0A0n 0050DD 11/20+ 2.3
|
||||
PDP11.opCOM, // 0x0A4n 0051DD 11/20+ 2.3
|
||||
PDP11.opINC, // 0x0A8n 0052DD 11/20+ 2.3
|
||||
PDP11.opDEC // 0x0ACn 0053DD 11/20+ 2.3
|
||||
];
|
||||
|
||||
PDP11.aOps0BXn_1170 = [
|
||||
PDP11.opNEG, // 0x0B0n
|
||||
PDP11.opADC, // 0x0B4n
|
||||
PDP11.opSBC, // 0x0B8n
|
||||
PDP11.opTST // 0x0BCn
|
||||
PDP11.aOp0BXn_1120 = [
|
||||
PDP11.opNEG, // 0x0B0n 0054DD 11/20+ 2.3
|
||||
PDP11.opADC, // 0x0B4n 0055DD 11/20+ 2.3
|
||||
PDP11.opSBC, // 0x0B8n 0056DD 11/20+ 2.3
|
||||
PDP11.opTST // 0x0BCn 0057DD 11/20+ 2.3*
|
||||
];
|
||||
|
||||
PDP11.aOps0CXn_1170 = [
|
||||
PDP11.opROR, // 0x0C0n
|
||||
PDP11.opROL, // 0x0C4n
|
||||
PDP11.opASR, // 0x0C8n
|
||||
PDP11.opASL // 0x0CCn
|
||||
PDP11.aOp0CXn_1120 = [
|
||||
PDP11.opROR, // 0x0C0n 0060DD 11/20+ 2.3*
|
||||
PDP11.opROL, // 0x0C4n 0061DD 11/20+ 2.3*
|
||||
PDP11.opASR, // 0x0C8n 0062DD 11/20+ 2.3*
|
||||
PDP11.opASL // 0x0CCn 0063DD 11/20+ 2.3*
|
||||
];
|
||||
|
||||
PDP11.aOps0DXn_1170 = [
|
||||
PDP11.opMARK, // 0x0D0n
|
||||
PDP11.opMFPI, // 0x0D4n
|
||||
PDP11.opMTPI, // 0x0D8n
|
||||
PDP11.opSXT // 0x0DCn
|
||||
];
|
||||
|
||||
PDP11.aOps00Xn_1170 = [
|
||||
PDP11.op000X_1170, // 0x000n 000000-000017
|
||||
PDP11.aOp00Xn_1120 = [
|
||||
PDP11.op000X_1120, // 0x000n 000000-000017
|
||||
PDP11.opUndefined, // 0x001n 000020-000037
|
||||
PDP11.opUndefined, // 0x002n 000040-000057
|
||||
PDP11.opUndefined, // 0x003n 000060-000077
|
||||
PDP11.opJMP, // 0x004n 0001DD
|
||||
PDP11.opJMP, // 0x005n 0001DD
|
||||
PDP11.opJMP, // 0x006n 0001DD
|
||||
PDP11.opJMP, // 0x007n 0001DD
|
||||
PDP11.opRTS, // 0x008n 00020R (opRTS() will also confirm that bit 3 is clear)
|
||||
PDP11.opSPL, // 0x009n 00023N (opSPL() will also confirm that bit 3 is set)
|
||||
PDP11.op00AX_1170, // 0x00An 000240-000257
|
||||
PDP11.op00BX_1170, // 0x00Bn 000260-000277
|
||||
PDP11.opSWAB, // 0x00Cn 0003DD
|
||||
PDP11.opSWAB, // 0x00Dn 0003DD
|
||||
PDP11.opSWAB, // 0x00En 0003DD
|
||||
PDP11.opSWAB // 0x00Fn 0003DD
|
||||
PDP11.opJMP, // 0x004n 0001DD 11/20+ 1.2
|
||||
PDP11.opJMP, // 0x005n 0001DD 11/20+ 1.2
|
||||
PDP11.opJMP, // 0x006n 0001DD 11/20+ 1.2
|
||||
PDP11.opJMP, // 0x007n 0001DD 11/20+ 1.2
|
||||
PDP11.opRTS, // 0x008n 00020R 11/20+ 3.5 (opRTS() will also confirm that bit 3 is clear)
|
||||
PDP11.opUndefined, // 0x009n 00023N
|
||||
PDP11.op00AX_1120, // 0x00An 000240-000257
|
||||
PDP11.op00BX_1120, // 0x00Bn 000260-000277
|
||||
PDP11.opSWAB, // 0x00Cn 0003DD 11/20+ 2.3
|
||||
PDP11.opSWAB, // 0x00Dn 0003DD 11/20+ 2.3
|
||||
PDP11.opSWAB, // 0x00En 0003DD 11/20+ 2.3
|
||||
PDP11.opSWAB // 0x00Fn 0003DD 11/20+ 2.3
|
||||
];
|
||||
|
||||
PDP11.aOps000X_1170 = [
|
||||
PDP11.opHALT, // 0x0000 000000
|
||||
PDP11.opWAIT, // 0x0001 000001
|
||||
PDP11.opRTI, // 0x0002 000002
|
||||
PDP11.opBPT, // 0x0003 000003
|
||||
PDP11.opIOT, // 0x0004 000004
|
||||
PDP11.opRESET, // 0x0005 000005
|
||||
PDP11.opRTT, // 0x0006 000006
|
||||
PDP11.aOp000X_1120 = [
|
||||
PDP11.opHALT, // 0x0000 000000 11/20+ 1.8
|
||||
PDP11.opWAIT, // 0x0001 000001 11/20+ 1.8
|
||||
PDP11.opRTI, // 0x0002 000002 11/20+ 4.8
|
||||
PDP11.opBPT, // 0x0003
|
||||
PDP11.opIOT, // 0x0004 000004 11/20+ 9.3
|
||||
PDP11.opRESET, // 0x0005 000005 11/20+ 20ms
|
||||
PDP11.opUndefined, // 0x0006
|
||||
PDP11.opUndefined, // 0x0007
|
||||
PDP11.opUndefined, // 0x0008
|
||||
PDP11.opUndefined, // 0x0009
|
||||
|
|
@ -2055,106 +2006,296 @@ PDP11.aOps000X_1170 = [
|
|||
PDP11.opUndefined // 0x000F
|
||||
];
|
||||
|
||||
PDP11.aOps00AX_1170 = [
|
||||
PDP11.opNOP, // 0x00A0 000240
|
||||
PDP11.opCLC, // 0x00A1
|
||||
PDP11.opCLV, // 0x00A2
|
||||
PDP11.opCLx, // 0x00A3
|
||||
PDP11.opCLZ, // 0x00A4
|
||||
PDP11.opCLx, // 0x00A5
|
||||
PDP11.opCLx, // 0x00A6
|
||||
PDP11.opCLx, // 0x00A7
|
||||
PDP11.opCLN, // 0x00A8
|
||||
PDP11.opCLx, // 0x00A9
|
||||
PDP11.opCLx, // 0x00AA
|
||||
PDP11.opCLx, // 0x00AB
|
||||
PDP11.opCLx, // 0x00AC
|
||||
PDP11.opCLx, // 0x00AD
|
||||
PDP11.opCLx, // 0x00AE
|
||||
PDP11.opCLx // 0x00AF 000257
|
||||
PDP11.aOp00AX_1120 = [
|
||||
PDP11.opNOP, // 0x00A0 000240 11/20+ 1.5
|
||||
PDP11.opCLC, // 0x00A1 000241 11/20+ 1.5
|
||||
PDP11.opCLV, // 0x00A2 000242 11/20+ 1.5
|
||||
PDP11.opCLx, // 0x00A3 000243 11/20+ 1.5
|
||||
PDP11.opCLZ, // 0x00A4 000244 11/20+ 1.5
|
||||
PDP11.opCLx, // 0x00A5 000245 11/20+ 1.5
|
||||
PDP11.opCLx, // 0x00A6 000246 11/20+ 1.5
|
||||
PDP11.opCLx, // 0x00A7 000247 11/20+ 1.5
|
||||
PDP11.opCLN, // 0x00A8 000250 11/20+ 1.5
|
||||
PDP11.opCLx, // 0x00A9 000251 11/20+ 1.5
|
||||
PDP11.opCLx, // 0x00AA 000252 11/20+ 1.5
|
||||
PDP11.opCLx, // 0x00AB 000253 11/20+ 1.5
|
||||
PDP11.opCLx, // 0x00AC 000254 11/20+ 1.5
|
||||
PDP11.opCLx, // 0x00AD 000255 11/20+ 1.5
|
||||
PDP11.opCLx, // 0x00AE 000256 11/20+ 1.5
|
||||
PDP11.opCLx // 0x00AF 000257 11/20+ 1.5
|
||||
];
|
||||
|
||||
PDP11.aOps00BX_1170 = [
|
||||
PDP11.opNOP, // 0x00B0 000260
|
||||
PDP11.opSEC, // 0x00B1
|
||||
PDP11.opSEV, // 0x00B2
|
||||
PDP11.opSEx, // 0x00B3
|
||||
PDP11.opSEZ, // 0x00B4
|
||||
PDP11.opSEx, // 0x00B5
|
||||
PDP11.opSEx, // 0x00B6
|
||||
PDP11.opSEx, // 0x00B7
|
||||
PDP11.opSEN, // 0x00B8
|
||||
PDP11.opSEx, // 0x00B9
|
||||
PDP11.opSEx, // 0x00BA
|
||||
PDP11.opSEx, // 0x00BB
|
||||
PDP11.opSEx, // 0x00BC
|
||||
PDP11.opSEx, // 0x00BD
|
||||
PDP11.opSEx, // 0x00BE
|
||||
PDP11.opSEx // 0x00BF 000277
|
||||
PDP11.aOp00BX_1120 = [
|
||||
PDP11.opNOP, // 0x00B0 000260 11/20+ 1.5
|
||||
PDP11.opSEC, // 0x00B1 000261 11/20+ 1.5
|
||||
PDP11.opSEV, // 0x00B2 000262 11/20+ 1.5
|
||||
PDP11.opSEx, // 0x00B3 000263 11/20+ 1.5
|
||||
PDP11.opSEZ, // 0x00B4 000264 11/20+ 1.5
|
||||
PDP11.opSEx, // 0x00B5 000265 11/20+ 1.5
|
||||
PDP11.opSEx, // 0x00B6 000266 11/20+ 1.5
|
||||
PDP11.opSEx, // 0x00B7 000267 11/20+ 1.5
|
||||
PDP11.opSEN, // 0x00B8 000270 11/20+ 1.5
|
||||
PDP11.opSEx, // 0x00B9 000271 11/20+ 1.5
|
||||
PDP11.opSEx, // 0x00BA 000272 11/20+ 1.5
|
||||
PDP11.opSEx, // 0x00BB 000273 11/20+ 1.5
|
||||
PDP11.opSEx, // 0x00BC 000274 11/20+ 1.5
|
||||
PDP11.opSEx, // 0x00BD 000275 11/20+ 1.5
|
||||
PDP11.opSEx, // 0x00BE 000276 11/20+ 1.5
|
||||
PDP11.opSEx // 0x00BF 000277 11/20+ 1.5
|
||||
];
|
||||
|
||||
PDP11.aOps7Xnn_1170 = [
|
||||
PDP11.opMUL, // 0x70nn
|
||||
PDP11.opMUL, // 0x71nn
|
||||
PDP11.opDIV, // 0x72nn
|
||||
PDP11.opDIV, // 0x73nn
|
||||
PDP11.opASH, // 0x74nn
|
||||
PDP11.opASH, // 0x75nn
|
||||
PDP11.opASHC, // 0x76nn
|
||||
PDP11.opASHC, // 0x77nn
|
||||
PDP11.opXOR, // 0x78nn
|
||||
PDP11.opXOR, // 0x79nn
|
||||
PDP11.aOp8Xnn_1120 = [
|
||||
PDP11.opBPL, // 0x80nn 1000XX 11/20+ 2.6**
|
||||
PDP11.opBMI, // 0x81nn 1004XX 11/20+ 2.6**
|
||||
PDP11.opBHI, // 0x82nn 1010XX 11/20+ 2.6**
|
||||
PDP11.opBLOS, // 0x83nn 1014XX 11/20+ 2.6**
|
||||
PDP11.opBVC, // 0x84nn 1020XX 11/20+ 2.6**
|
||||
PDP11.opBVS, // 0x85nn 1024XX 11/20+ 2.6**
|
||||
PDP11.opBCC, // 0x86nn 1030XX 11/20+ 2.6**
|
||||
PDP11.opBCS, // 0x87nn 1034XX 11/20+ 2.6**
|
||||
PDP11.opEMT, // 0x88nn 104000-104377 11/20+ 9.3
|
||||
PDP11.opTRAP, // 0x89nn 104400-104777 11/20+ 9.3
|
||||
PDP11.op8AXn_1120, // 0x8Ann
|
||||
PDP11.op8BXn_1120, // 0x8Bnn
|
||||
PDP11.op8CXn_1120, // 0x8Cnn
|
||||
PDP11.opUndefined, // 0x8Dnn
|
||||
PDP11.opUndefined, // 0x8Enn
|
||||
PDP11.opUndefined // 0x8Fnn
|
||||
];
|
||||
|
||||
PDP11.aOp8AXn_1120 = [
|
||||
PDP11.opCLRB, // 0x8A0n 1050DD 11/20+ 2.3
|
||||
PDP11.opCOMB, // 0x8A4n 1051DD 11/20+ 2.3
|
||||
PDP11.opINCB, // 0x8A8n 1052DD 11/20+ 2.3
|
||||
PDP11.opDECB // 0x8ACn 1053DD 11/20+ 2.3
|
||||
];
|
||||
|
||||
PDP11.aOp8BXn_1120 = [
|
||||
PDP11.opNEGB, // 0x8B0n 1054DD 11/20+ 2.3
|
||||
PDP11.opADCB, // 0x8B4n 1055DD 11/20+ 2.3
|
||||
PDP11.opSBCB, // 0x8B8n 1056DD 11/20+ 2.3
|
||||
PDP11.opTSTB // 0x8BCn 1057DD 11/20+ 2.3*
|
||||
];
|
||||
|
||||
PDP11.aOp8CXn_1120 = [
|
||||
PDP11.opRORB, // 0x8C0n 1060DD 11/20+ 2.3*
|
||||
PDP11.opROLB, // 0x8C4n 1061DD 11/20+ 2.3*
|
||||
PDP11.opASRB, // 0x8C8n 1062DD 11/20+ 2.3*
|
||||
PDP11.opASLB // 0x8CCn 1063DD 11/20+ 2.3*
|
||||
];
|
||||
|
||||
/**
|
||||
* op1170(opCode)
|
||||
*
|
||||
* @this {CPUStatePDP11}
|
||||
* @param {number} opCode
|
||||
*/
|
||||
PDP11.op1170 = function(opCode)
|
||||
{
|
||||
PDP11.aOpXnnn_1170[opCode >> 12].call(this, opCode);
|
||||
};
|
||||
|
||||
/**
|
||||
* op0Xnn_1170(opCode)
|
||||
*
|
||||
* @this {CPUStatePDP11}
|
||||
* @param {number} opCode
|
||||
*/
|
||||
PDP11.op0Xnn_1170 = function(opCode)
|
||||
{
|
||||
PDP11.aOp0Xnn_1170[(opCode >> 8) & 0xf].call(this, opCode);
|
||||
};
|
||||
|
||||
/**
|
||||
* op0DXn_1170(opCode)
|
||||
*
|
||||
* @this {CPUStatePDP11}
|
||||
* @param {number} opCode
|
||||
*/
|
||||
PDP11.op0DXn_1170 = function(opCode)
|
||||
{
|
||||
PDP11.aOp0DXn_1170[(opCode >> 6) & 0x3].call(this, opCode);
|
||||
};
|
||||
|
||||
/**
|
||||
* op00Xn_1170(opCode)
|
||||
*
|
||||
* @this {CPUStatePDP11}
|
||||
* @param {number} opCode
|
||||
*/
|
||||
PDP11.op00Xn_1170 = function(opCode)
|
||||
{
|
||||
PDP11.aOp00Xn_1170[(opCode >> 4) & 0xf].call(this, opCode);
|
||||
};
|
||||
|
||||
/**
|
||||
* op000X_1170(opCode)
|
||||
*
|
||||
* @this {CPUStatePDP11}
|
||||
* @param {number} opCode
|
||||
*/
|
||||
PDP11.op000X_1170 = function(opCode)
|
||||
{
|
||||
PDP11.aOp000X_1170[opCode & 0xf].call(this, opCode);
|
||||
};
|
||||
|
||||
/**
|
||||
* op7Xnn_1170(opCode)
|
||||
*
|
||||
* @this {CPUStatePDP11}
|
||||
* @param {number} opCode
|
||||
*/
|
||||
PDP11.op7Xnn_1170 = function(opCode)
|
||||
{
|
||||
PDP11.aOp7Xnn_1170[(opCode >> 8) & 0xf].call(this, opCode);
|
||||
};
|
||||
|
||||
/**
|
||||
* op8Xnn_1170(opCode)
|
||||
*
|
||||
* @this {CPUStatePDP11}
|
||||
* @param {number} opCode
|
||||
*/
|
||||
PDP11.op8Xnn_1170 = function(opCode)
|
||||
{
|
||||
PDP11.aOp8Xnn_1170[(opCode >> 8) & 0xf].call(this, opCode);
|
||||
};
|
||||
|
||||
/**
|
||||
* op8DXn_1170(opCode)
|
||||
*
|
||||
* @this {CPUStatePDP11}
|
||||
* @param {number} opCode
|
||||
*/
|
||||
PDP11.op8DXn_1170 = function(opCode)
|
||||
{
|
||||
PDP11.aOp8DXn_1170[(opCode >> 6) & 0x3].call(this, opCode);
|
||||
};
|
||||
|
||||
PDP11.aOpXnnn_1170 = [
|
||||
PDP11.op0Xnn_1170, // 0x0nnn
|
||||
PDP11.opMOV, // 0x1nnn 01SSDD 11/20+ 2.3
|
||||
PDP11.opCMP, // 0x2nnn 02SSDD 11/20+ 2.3*
|
||||
PDP11.opBIT, // 0x3nnn 03SSDD 11/20+ 2.9*
|
||||
PDP11.opBIC, // 0x4nnn 04SSDD 11/20+ 2.9
|
||||
PDP11.opBIS, // 0x5nnn 05SSDD 11/20+ 2.3
|
||||
PDP11.opADD, // 0x6nnn 06SSDD 11/20+ 2.3
|
||||
PDP11.op7Xnn_1170, // 0x7nnn
|
||||
PDP11.op8Xnn_1170, // 0x8nnn
|
||||
PDP11.opMOVB, // 0x9nnn 11SSDD 11/20+ 2.3
|
||||
PDP11.opCMPB, // 0xAnnn 12SSDD 11/20+ 2.3
|
||||
PDP11.opBITB, // 0xBnnn 13SSDD 11/20+ 2.9
|
||||
PDP11.opBICB, // 0xCnnn 14SSDD 11/20+ 2.9
|
||||
PDP11.opBISB, // 0xDnnn 15SSDD 11/20+ 2.3
|
||||
PDP11.opSUB, // 0xEnnn 16SSDD 11/20+ 2.3
|
||||
PDP11.opUndefined // 0xFnnn
|
||||
];
|
||||
|
||||
PDP11.aOp0Xnn_1170 = [
|
||||
PDP11.op00Xn_1170, // 0x00nn
|
||||
PDP11.opBR, // 0x01nn 0004XX 11/20+ 2.6
|
||||
PDP11.opBNE, // 0x02nn 0010XX 11/20+ 2.6**
|
||||
PDP11.opBEQ, // 0x03nn 0014XX 11/20+ 2.6**
|
||||
PDP11.opBGE, // 0x04nn 0020XX 11/20+ 2.6**
|
||||
PDP11.opBLT, // 0x05nn 0024XX 11/20+ 2.6**
|
||||
PDP11.opBGT, // 0x06nn 0030XX 11/20+ 2.6**
|
||||
PDP11.opBLE, // 0x07nn 0034XX 11/20+ 2.6**
|
||||
PDP11.opJSR, // 0x08nn 004RDD 11/20+ 4.4
|
||||
PDP11.opJSR, // 0x09nn 004RDD 11/20+ 4.4
|
||||
PDP11.op0AXn_1120, // 0x0Ann
|
||||
PDP11.op0BXn_1120, // 0x0Bnn
|
||||
PDP11.op0CXn_1120, // 0x0Cnn
|
||||
PDP11.op0DXn_1170, // 0x0Dnn
|
||||
PDP11.opUndefined, // 0x0Enn
|
||||
PDP11.opUndefined // 0x0Fnn
|
||||
];
|
||||
|
||||
PDP11.aOp0DXn_1170 = [
|
||||
PDP11.opMARK, // 0x0D0n 11/45+
|
||||
PDP11.opMFPI, // 0x0D4n 11/45+
|
||||
PDP11.opMTPI, // 0x0D8n 11/45+
|
||||
PDP11.opSXT // 0x0DCn 11/45+
|
||||
];
|
||||
|
||||
PDP11.aOp00Xn_1170 = [
|
||||
PDP11.op000X_1170, // 0x000n 000000-000017
|
||||
PDP11.opUndefined, // 0x001n 000020-000037
|
||||
PDP11.opUndefined, // 0x002n 000040-000057
|
||||
PDP11.opUndefined, // 0x003n 000060-000077
|
||||
PDP11.opJMP, // 0x004n 0001DD 11/20+ 1.2
|
||||
PDP11.opJMP, // 0x005n 0001DD 11/20+ 1.2
|
||||
PDP11.opJMP, // 0x006n 0001DD 11/20+ 1.2
|
||||
PDP11.opJMP, // 0x007n 0001DD 11/20+ 1.2
|
||||
PDP11.opRTS, // 0x008n 00020R 11/20+ 3.5 (opRTS() will also confirm that bit 3 is clear)
|
||||
PDP11.opSPL, // 0x009n 00023N 11/45+ (opSPL() will also confirm that bit 3 is set)
|
||||
PDP11.op00AX_1120, // 0x00An 000240-000257
|
||||
PDP11.op00BX_1120, // 0x00Bn 000260-000277
|
||||
PDP11.opSWAB, // 0x00Cn 0003DD 11/20+ 2.3
|
||||
PDP11.opSWAB, // 0x00Dn 0003DD 11/20+ 2.3
|
||||
PDP11.opSWAB, // 0x00En 0003DD 11/20+ 2.3
|
||||
PDP11.opSWAB // 0x00Fn 0003DD 11/20+ 2.3
|
||||
];
|
||||
|
||||
PDP11.aOp000X_1170 = [
|
||||
PDP11.opHALT, // 0x0000 000000 11/20+ 1.8
|
||||
PDP11.opWAIT, // 0x0001 000001 11/20+ 1.8
|
||||
PDP11.opRTI, // 0x0002 000002 11/20+ 4.8
|
||||
PDP11.opBPT, // 0x0003 000003
|
||||
PDP11.opIOT, // 0x0004 000004 11/20+ 9.3
|
||||
PDP11.opRESET, // 0x0005 000005 11/20+ 20ms
|
||||
PDP11.opRTT, // 0x0006 000006 11/45+
|
||||
PDP11.opUndefined, // 0x0007
|
||||
PDP11.opUndefined, // 0x0008
|
||||
PDP11.opUndefined, // 0x0009
|
||||
PDP11.opUndefined, // 0x000A
|
||||
PDP11.opUndefined, // 0x000B
|
||||
PDP11.opUndefined, // 0x000C
|
||||
PDP11.opUndefined, // 0x000D
|
||||
PDP11.opUndefined, // 0x000E
|
||||
PDP11.opUndefined // 0x000F
|
||||
];
|
||||
|
||||
PDP11.aOp7Xnn_1170 = [
|
||||
PDP11.opMUL, // 0x70nn 11/45+
|
||||
PDP11.opMUL, // 0x71nn 11/45+
|
||||
PDP11.opDIV, // 0x72nn 11/45+
|
||||
PDP11.opDIV, // 0x73nn 11/45+
|
||||
PDP11.opASH, // 0x74nn 11/45+
|
||||
PDP11.opASH, // 0x75nn 11/45+
|
||||
PDP11.opASHC, // 0x76nn 11/45+
|
||||
PDP11.opASHC, // 0x77nn 11/45+
|
||||
PDP11.opXOR, // 0x78nn 11/45+
|
||||
PDP11.opXOR, // 0x79nn 11/45+
|
||||
PDP11.opUndefined, // 0x7Ann
|
||||
PDP11.opUndefined, // 0x7Bnn
|
||||
PDP11.opUndefined, // 0x7Cnn
|
||||
PDP11.opUndefined, // 0x7Dnn
|
||||
PDP11.opSOB, // 0x7Enn
|
||||
PDP11.opSOB // 0x7Fnn
|
||||
PDP11.opSOB, // 0x7Enn 11/45+
|
||||
PDP11.opSOB // 0x7Fnn 11/45+
|
||||
];
|
||||
|
||||
PDP11.aOps8Xnn_1170 = [
|
||||
PDP11.opBPL, // 0x80nn
|
||||
PDP11.opBMI, // 0x81nn
|
||||
PDP11.opBHI, // 0x82nn
|
||||
PDP11.opBLOS, // 0x83nn
|
||||
PDP11.opBVC, // 0x84nn
|
||||
PDP11.opBVS, // 0x85nn
|
||||
PDP11.opBCC, // 0x86nn
|
||||
PDP11.opBCS, // 0x87nn
|
||||
PDP11.opEMT, // 0x88nn
|
||||
PDP11.opTRAP, // 0x89nn
|
||||
PDP11.op8AXn_1170, // 0x8Ann
|
||||
PDP11.op8BXn_1170, // 0x8Bnn
|
||||
PDP11.op8CXn_1170, // 0x8Cnn
|
||||
PDP11.aOp8Xnn_1170 = [
|
||||
PDP11.opBPL, // 0x80nn 1000XX 11/20+ 2.6**
|
||||
PDP11.opBMI, // 0x81nn 1004XX 11/20+ 2.6**
|
||||
PDP11.opBHI, // 0x82nn 1010XX 11/20+ 2.6**
|
||||
PDP11.opBLOS, // 0x83nn 1014XX 11/20+ 2.6**
|
||||
PDP11.opBVC, // 0x84nn 1020XX 11/20+ 2.6**
|
||||
PDP11.opBVS, // 0x85nn 1024XX 11/20+ 2.6**
|
||||
PDP11.opBCC, // 0x86nn 1030XX 11/20+ 2.6**
|
||||
PDP11.opBCS, // 0x87nn 1034XX 11/20+ 2.6**
|
||||
PDP11.opEMT, // 0x88nn 104000-104377 11/20+ 9.3
|
||||
PDP11.opTRAP, // 0x89nn 104400-104777 11/20+ 9.3
|
||||
PDP11.op8AXn_1120, // 0x8Ann
|
||||
PDP11.op8BXn_1120, // 0x8Bnn
|
||||
PDP11.op8CXn_1120, // 0x8Cnn
|
||||
PDP11.op8DXn_1170, // 0x8Dnn
|
||||
PDP11.opUndefined, // 0x8Enn
|
||||
PDP11.opUndefined // 0x8Fnn
|
||||
];
|
||||
|
||||
PDP11.aOps8AXn_1170 = [
|
||||
PDP11.opCLRB, // 0x8A0n
|
||||
PDP11.opCOMB, // 0x8A4n
|
||||
PDP11.opINCB, // 0x8A8n
|
||||
PDP11.opDECB // 0x8ACn
|
||||
];
|
||||
|
||||
PDP11.aOps8BXn_1170 = [
|
||||
PDP11.opNEGB, // 0x8B0n
|
||||
PDP11.opADCB, // 0x8B4n
|
||||
PDP11.opSBCB, // 0x8B8n
|
||||
PDP11.opTSTB // 0x8BCn
|
||||
];
|
||||
|
||||
PDP11.aOps8CXn_1170 = [
|
||||
PDP11.opRORB, // 0x8C0n
|
||||
PDP11.opROLB, // 0x8C4n
|
||||
PDP11.opASRB, // 0x8C8n
|
||||
PDP11.opASLB // 0x8CCn
|
||||
];
|
||||
|
||||
PDP11.aOps8DXn_1170 = [
|
||||
PDP11.aOp8DXn_1170 = [
|
||||
PDP11.opUndefined, // 0x8D0n
|
||||
PDP11.opMFPD, // 0x8D4n
|
||||
PDP11.opMTPD, // 0x8D8n
|
||||
PDP11.opMFPD, // 0x8D4n 11/45+
|
||||
PDP11.opMTPD, // 0x8D8n 11/45+
|
||||
PDP11.opUndefined // 0x8DCn
|
||||
];
|
||||
|
|
|
|||
|
|
@ -123,7 +123,11 @@ var Trigger;
|
|||
*/
|
||||
CPUStatePDP11.prototype.initProcessor = function()
|
||||
{
|
||||
this.decode = PDP11.op1170.bind(this);
|
||||
if (this.model == PDP11.MODEL_1120) {
|
||||
this.decode = PDP11.op1120.bind(this);
|
||||
} else {
|
||||
this.decode = PDP11.op1170.bind(this);
|
||||
}
|
||||
|
||||
this.initRegs();
|
||||
|
||||
|
|
@ -147,6 +151,7 @@ CPUStatePDP11.prototype.initProcessor = function()
|
|||
*/
|
||||
CPUStatePDP11.prototype.reset = function()
|
||||
{
|
||||
this.status("model " + this.model);
|
||||
if (this.flags.running) this.stopCPU();
|
||||
this.initRegs();
|
||||
this.resetCycles();
|
||||
|
|
@ -826,7 +831,7 @@ CPUStatePDP11.prototype.setPSW = function(newPSW)
|
|||
* an interrupt has been dispatched, because it's dispatched via trap(), and trap() calls setPSW().
|
||||
*
|
||||
* I mean, sure, it's POSSIBLE that the new PSW loaded by trap() actually set a lower priority, allowing a lower
|
||||
* priority interrupt to immediately be acknowledged. But perhaps we should a bit more rigorous here.
|
||||
* priority interrupt to immediately be acknowledged. But perhaps we should be a bit more rigorous here.
|
||||
*
|
||||
* For example, we could avoid setting INTQ unless 1) there's actually an active interrupt trigger (ie, triggerNext
|
||||
* is not null) or 2) an optional fCheckInterrupts flag is passed to us, because the caller has some knowledge
|
||||
|
|
|
|||
|
|
@ -125,6 +125,7 @@ var PDP11 = {
|
|||
/*
|
||||
* CPU model numbers (supported)
|
||||
*/
|
||||
MODEL_1120: 1120,
|
||||
MODEL_1145: 1145,
|
||||
MODEL_1170: 1170,
|
||||
|
||||
|
|
@ -167,7 +168,10 @@ var PDP11 = {
|
|||
TF: 0x0010, // bit 4: Trap Flag
|
||||
PRI: 0x00E0, // bits 5-7: Priority
|
||||
UNUSED: 0x0700, // bits 8-10: unused
|
||||
REGSET: 0x0800, // bit 11: Register Set
|
||||
/*
|
||||
* PSW bits above this point are unused on 11/20-class machines
|
||||
*/
|
||||
REGSET: 0x0800, // bit 11: Register Set (
|
||||
PMODE: 0x3000, // bits 12-13: Prev Mode (see PDP11.MODE)
|
||||
CMODE: 0xC000, // bits 14-15: Curr Mode (see PDP11.MODE)
|
||||
SHIFT: {
|
||||
|
|
@ -498,7 +502,7 @@ var PDP11 = {
|
|||
HSIZE: 0o177762, // Upper Size Register (always zero) (11/70 only)
|
||||
SYSID: 0o177764, // System ID Register (11/70 only)
|
||||
CPUERR: 0o177766, // CPU error (11/70 only)
|
||||
MB: 0o177770, // Microprogram break
|
||||
MB: 0o177770, // Microprogram break (11/70 only)
|
||||
PIR: 0o177772, // Program Interrupt Request
|
||||
SL: 0o177774, // Stack Limit Register
|
||||
PSW: 0o177776 // 777776 17777776 0x3FFFFE Processor Status Word
|
||||
|
|
|
|||
|
|
@ -1059,24 +1059,24 @@ DevicePDP11.prototype.reset = function()
|
|||
* ES6 ALERT: As you can see below, I've finally started using computed property names.
|
||||
*/
|
||||
DevicePDP11.UNIBUS_IOTABLE = {
|
||||
[PDP11.UNIBUS.SISDR0]: /* 172200 */ [null, null, DevicePDP11.prototype.readSISDR, DevicePDP11.prototype.writeSISDR, "SISDR"],
|
||||
[PDP11.UNIBUS.SDSDR0]: /* 172220 */ [null, null, DevicePDP11.prototype.readSDSDR, DevicePDP11.prototype.writeSDSDR, "SDSDR"],
|
||||
[PDP11.UNIBUS.SISAR0]: /* 172240 */ [null, null, DevicePDP11.prototype.readSISAR, DevicePDP11.prototype.writeSISAR, "SISAR"],
|
||||
[PDP11.UNIBUS.SDSAR0]: /* 172260 */ [null, null, DevicePDP11.prototype.readSDSAR, DevicePDP11.prototype.writeSDSAR, "SDSAR"],
|
||||
[PDP11.UNIBUS.KISDR0]: /* 172300 */ [null, null, DevicePDP11.prototype.readKISDR, DevicePDP11.prototype.writeKISDR, "KISDR"],
|
||||
[PDP11.UNIBUS.KDSDR0]: /* 172320 */ [null, null, DevicePDP11.prototype.readKDSDR, DevicePDP11.prototype.writeKDSDR, "KDSDR"],
|
||||
[PDP11.UNIBUS.KISAR0]: /* 172340 */ [null, null, DevicePDP11.prototype.readKISAR, DevicePDP11.prototype.writeKISAR, "KISAR"],
|
||||
[PDP11.UNIBUS.KDSAR0]: /* 172360 */ [null, null, DevicePDP11.prototype.readKDSAR, DevicePDP11.prototype.writeKDSAR, "KDSAR"],
|
||||
[PDP11.UNIBUS.MMR3]: /* 172516 */ [null, null, DevicePDP11.prototype.readMMR3, DevicePDP11.prototype.writeMMR3, "MMR3"],
|
||||
[PDP11.UNIBUS.SISDR0]: /* 172200 */ [null, null, DevicePDP11.prototype.readSISDR, DevicePDP11.prototype.writeSISDR, "SISDR", PDP11.MODEL_1145],
|
||||
[PDP11.UNIBUS.SDSDR0]: /* 172220 */ [null, null, DevicePDP11.prototype.readSDSDR, DevicePDP11.prototype.writeSDSDR, "SDSDR", PDP11.MODEL_1145],
|
||||
[PDP11.UNIBUS.SISAR0]: /* 172240 */ [null, null, DevicePDP11.prototype.readSISAR, DevicePDP11.prototype.writeSISAR, "SISAR", PDP11.MODEL_1145],
|
||||
[PDP11.UNIBUS.SDSAR0]: /* 172260 */ [null, null, DevicePDP11.prototype.readSDSAR, DevicePDP11.prototype.writeSDSAR, "SDSAR", PDP11.MODEL_1145],
|
||||
[PDP11.UNIBUS.KISDR0]: /* 172300 */ [null, null, DevicePDP11.prototype.readKISDR, DevicePDP11.prototype.writeKISDR, "KISDR", PDP11.MODEL_1145],
|
||||
[PDP11.UNIBUS.KDSDR0]: /* 172320 */ [null, null, DevicePDP11.prototype.readKDSDR, DevicePDP11.prototype.writeKDSDR, "KDSDR", PDP11.MODEL_1145],
|
||||
[PDP11.UNIBUS.KISAR0]: /* 172340 */ [null, null, DevicePDP11.prototype.readKISAR, DevicePDP11.prototype.writeKISAR, "KISAR", PDP11.MODEL_1145],
|
||||
[PDP11.UNIBUS.KDSAR0]: /* 172360 */ [null, null, DevicePDP11.prototype.readKDSAR, DevicePDP11.prototype.writeKDSAR, "KDSAR", PDP11.MODEL_1145],
|
||||
[PDP11.UNIBUS.MMR3]: /* 172516 */ [null, null, DevicePDP11.prototype.readMMR3, DevicePDP11.prototype.writeMMR3, "MMR3", PDP11.MODEL_1145],
|
||||
[PDP11.UNIBUS.LKS]: /* 177546 */ [null, null, DevicePDP11.prototype.readLKS, DevicePDP11.prototype.writeLKS, "LKS"],
|
||||
[PDP11.UNIBUS.CNSL]: /* 177570 */ [null, null, DevicePDP11.prototype.readCNSL, DevicePDP11.prototype.writeCNSL, "CNSL"],
|
||||
[PDP11.UNIBUS.MMR0]: /* 177572 */ [null, null, DevicePDP11.prototype.readMMR0, DevicePDP11.prototype.writeMMR0, "MMR0"],
|
||||
[PDP11.UNIBUS.MMR1]: /* 177574 */ [null, null, DevicePDP11.prototype.readMMR1, DevicePDP11.prototype.writeIgnored, "MMR1"],
|
||||
[PDP11.UNIBUS.MMR2]: /* 177576 */ [null, null, DevicePDP11.prototype.readMMR2, DevicePDP11.prototype.writeIgnored, "MMR2"],
|
||||
[PDP11.UNIBUS.UISDR0]: /* 177600 */ [null, null, DevicePDP11.prototype.readUISDR, DevicePDP11.prototype.writeUISDR, "UISDR"],
|
||||
[PDP11.UNIBUS.UDSDR0]: /* 177620 */ [null, null, DevicePDP11.prototype.readUDSDR, DevicePDP11.prototype.writeUDSDR, "UDSDR"],
|
||||
[PDP11.UNIBUS.UISAR0]: /* 177640 */ [null, null, DevicePDP11.prototype.readUISAR, DevicePDP11.prototype.writeUISAR, "UISAR"],
|
||||
[PDP11.UNIBUS.UDSAR0]: /* 177660 */ [null, null, DevicePDP11.prototype.readUDSAR, DevicePDP11.prototype.writeUDSAR, "UDSAR"],
|
||||
[PDP11.UNIBUS.MMR0]: /* 177572 */ [null, null, DevicePDP11.prototype.readMMR0, DevicePDP11.prototype.writeMMR0, "MMR0", PDP11.MODEL_1145],
|
||||
[PDP11.UNIBUS.MMR1]: /* 177574 */ [null, null, DevicePDP11.prototype.readMMR1, DevicePDP11.prototype.writeIgnored, "MMR1", PDP11.MODEL_1145],
|
||||
[PDP11.UNIBUS.MMR2]: /* 177576 */ [null, null, DevicePDP11.prototype.readMMR2, DevicePDP11.prototype.writeIgnored, "MMR2", PDP11.MODEL_1145],
|
||||
[PDP11.UNIBUS.UISDR0]: /* 177600 */ [null, null, DevicePDP11.prototype.readUISDR, DevicePDP11.prototype.writeUISDR, "UISDR", PDP11.MODEL_1145],
|
||||
[PDP11.UNIBUS.UDSDR0]: /* 177620 */ [null, null, DevicePDP11.prototype.readUDSDR, DevicePDP11.prototype.writeUDSDR, "UDSDR", PDP11.MODEL_1145],
|
||||
[PDP11.UNIBUS.UISAR0]: /* 177640 */ [null, null, DevicePDP11.prototype.readUISAR, DevicePDP11.prototype.writeUISAR, "UISAR", PDP11.MODEL_1145],
|
||||
[PDP11.UNIBUS.UDSAR0]: /* 177660 */ [null, null, DevicePDP11.prototype.readUDSAR, DevicePDP11.prototype.writeUDSAR, "UDSAR", PDP11.MODEL_1145],
|
||||
[PDP11.UNIBUS.R0SET0]: /* 177700 */ [null, null, DevicePDP11.prototype.readRSET0, DevicePDP11.prototype.writeRSET0, "R0SET0"],
|
||||
[PDP11.UNIBUS.R1SET0]: /* 177701 */ [null, null, DevicePDP11.prototype.readRSET0, DevicePDP11.prototype.writeRSET0, "R1SET0"],
|
||||
[PDP11.UNIBUS.R2SET0]: /* 177702 */ [null, null, DevicePDP11.prototype.readRSET0, DevicePDP11.prototype.writeRSET0, "R2SET0"],
|
||||
|
|
@ -1085,14 +1085,14 @@ DevicePDP11.UNIBUS_IOTABLE = {
|
|||
[PDP11.UNIBUS.R5SET0]: /* 177705 */ [null, null, DevicePDP11.prototype.readRSET0, DevicePDP11.prototype.writeRSET0, "R5SET0"],
|
||||
[PDP11.UNIBUS.R6KERNEL]:/* 177706 */ [null, null, DevicePDP11.prototype.readR6KERNEL,DevicePDP11.prototype.writeR6KERNEL,"R6KERNEL"],
|
||||
[PDP11.UNIBUS.R7KERNEL]:/* 177707 */ [null, null, DevicePDP11.prototype.readR7KERNEL,DevicePDP11.prototype.writeR7KERNEL,"R7KERNEL"],
|
||||
[PDP11.UNIBUS.R0SET1]: /* 177710 */ [null, null, DevicePDP11.prototype.readRSET1, DevicePDP11.prototype.writeRSET1, "R0SET1"],
|
||||
[PDP11.UNIBUS.R1SET1]: /* 177711 */ [null, null, DevicePDP11.prototype.readRSET1, DevicePDP11.prototype.writeRSET1, "R1SET1"],
|
||||
[PDP11.UNIBUS.R2SET1]: /* 177712 */ [null, null, DevicePDP11.prototype.readRSET1, DevicePDP11.prototype.writeRSET1, "R2SET1"],
|
||||
[PDP11.UNIBUS.R3SET1]: /* 177713 */ [null, null, DevicePDP11.prototype.readRSET1, DevicePDP11.prototype.writeRSET1, "R3SET1"],
|
||||
[PDP11.UNIBUS.R4SET1]: /* 177714 */ [null, null, DevicePDP11.prototype.readRSET1, DevicePDP11.prototype.writeRSET1, "R4SET1"],
|
||||
[PDP11.UNIBUS.R5SET1]: /* 177715 */ [null, null, DevicePDP11.prototype.readRSET1, DevicePDP11.prototype.writeRSET1, "R5SET1"],
|
||||
[PDP11.UNIBUS.R6SUPER]: /* 177716 */ [null, null, DevicePDP11.prototype.readR6SUPER, DevicePDP11.prototype.writeR6SUPER, "R6SUPER"],
|
||||
[PDP11.UNIBUS.R6USER]: /* 177717 */ [null, null, DevicePDP11.prototype.readR6USER, DevicePDP11.prototype.writeR6USER, "R6USER"],
|
||||
[PDP11.UNIBUS.R0SET1]: /* 177710 */ [null, null, DevicePDP11.prototype.readRSET1, DevicePDP11.prototype.writeRSET1, "R0SET1", PDP11.MODEL_1145],
|
||||
[PDP11.UNIBUS.R1SET1]: /* 177711 */ [null, null, DevicePDP11.prototype.readRSET1, DevicePDP11.prototype.writeRSET1, "R1SET1", PDP11.MODEL_1145],
|
||||
[PDP11.UNIBUS.R2SET1]: /* 177712 */ [null, null, DevicePDP11.prototype.readRSET1, DevicePDP11.prototype.writeRSET1, "R2SET1", PDP11.MODEL_1145],
|
||||
[PDP11.UNIBUS.R3SET1]: /* 177713 */ [null, null, DevicePDP11.prototype.readRSET1, DevicePDP11.prototype.writeRSET1, "R3SET1", PDP11.MODEL_1145],
|
||||
[PDP11.UNIBUS.R4SET1]: /* 177714 */ [null, null, DevicePDP11.prototype.readRSET1, DevicePDP11.prototype.writeRSET1, "R4SET1", PDP11.MODEL_1145],
|
||||
[PDP11.UNIBUS.R5SET1]: /* 177715 */ [null, null, DevicePDP11.prototype.readRSET1, DevicePDP11.prototype.writeRSET1, "R5SET1", PDP11.MODEL_1145],
|
||||
[PDP11.UNIBUS.R6SUPER]: /* 177716 */ [null, null, DevicePDP11.prototype.readR6SUPER, DevicePDP11.prototype.writeR6SUPER, "R6SUPER", PDP11.MODEL_1145],
|
||||
[PDP11.UNIBUS.R6USER]: /* 177717 */ [null, null, DevicePDP11.prototype.readR6USER, DevicePDP11.prototype.writeR6USER, "R6USER", PDP11.MODEL_1145],
|
||||
[PDP11.UNIBUS.LAERR]: /* 177740 */ [null, null, DevicePDP11.prototype.readCTRL, DevicePDP11.prototype.writeCTRL, "CTRL", PDP11.MODEL_1170],
|
||||
[PDP11.UNIBUS.LSIZE]: /* 177760 */ [null, null, DevicePDP11.prototype.readSIZE, DevicePDP11.prototype.writeSIZE, "LSIZE", PDP11.MODEL_1170],
|
||||
[PDP11.UNIBUS.HSIZE]: /* 177762 */ [null, null, DevicePDP11.prototype.readSIZE, DevicePDP11.prototype.writeSIZE, "HSIZE", PDP11.MODEL_1170],
|
||||
|
|
|
|||
|
|
@ -691,10 +691,7 @@ if (DEBUGGER) {
|
|||
s = str.toHex(n, nBytes * 2);
|
||||
break;
|
||||
}
|
||||
if (fStripLeadingZeros && s.charAt(0) == '0') {
|
||||
s = s.replace(/^0+([0-9A-F]+)$/i, "$1");
|
||||
}
|
||||
return s;
|
||||
return (fStripLeadingZeros? str.stripLeadingZeros(s) : s);
|
||||
};
|
||||
|
||||
} // endif DEBUGGER
|
||||
|
|
|
|||
|
|
@ -67,7 +67,9 @@ var DumpAPI = {
|
|||
JSON_GZ: "gz", // gzip is currently used ONLY for compressed JSON
|
||||
DATA: "data", // same as "json", but built without JSON.stringify() (DiskDump only)
|
||||
HEX: "hex", // deprecated
|
||||
OCTAL: "octal", // displays data as octal words
|
||||
BYTES: "bytes", // displays data as hex bytes; normally used only when comments are enabled
|
||||
WORDS: "words", // displays data as hex words; normally used only when comments are enabled
|
||||
IMG: "img", // returns the raw disk data (ie, using a Buffer object) (DiskDump only)
|
||||
ROM: "rom" // returns the raw file data (ie, using a Buffer object) (FileDump only)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -240,6 +240,48 @@ str.toOct = function(n, cch, fPrefix)
|
|||
return (fPrefix? "0o" : "") + s;
|
||||
};
|
||||
|
||||
/**
|
||||
* toDec(n, cch)
|
||||
*
|
||||
* Converts an integer to decimal, with the specified number of digits (default of 5; max of 10)
|
||||
*
|
||||
* You might be tempted to use the built-in n.toString(10) instead, but it doesn't zero-pad and it
|
||||
* doesn't properly convert negative values. Moreover, if n is undefined, n.toString() will throw
|
||||
* an exception, whereas this function will return '?' characters.
|
||||
*
|
||||
* @param {number|null|undefined} n is a 32-bit value
|
||||
* @param {number} [cch] is the desired number of decimal digits (0 or undefined for default of either 5 or 10)
|
||||
* @return {string} the octal representation of n
|
||||
*/
|
||||
str.toDec = function(n, cch)
|
||||
{
|
||||
var s = "";
|
||||
|
||||
if (cch) {
|
||||
if (cch > 10) cch = 10;
|
||||
} else {
|
||||
cch = (n & ~0xffff)? 10 : 5;
|
||||
}
|
||||
/*
|
||||
* An initial "falsey" check for null takes care of both null and undefined;
|
||||
* we can't rely entirely on isNaN(), because isNaN(null) returns false, oddly enough.
|
||||
*
|
||||
* Alternatively, we could mask and shift n regardless of whether it's null/undefined/NaN,
|
||||
* since JavaScript coerces such operands to zero, but I think there's "value" in seeing those
|
||||
* values displayed differently.
|
||||
*/
|
||||
if (n == null || isNaN(n)) {
|
||||
while (cch-- > 0) s = '?' + s;
|
||||
} else {
|
||||
while (cch-- > 0) {
|
||||
var d = (n % 10) + 0x30;
|
||||
s = String.fromCharCode(d) + s;
|
||||
n /= 10;
|
||||
}
|
||||
}
|
||||
return s;
|
||||
};
|
||||
|
||||
/**
|
||||
* toHex(n, cch, fPrefix)
|
||||
*
|
||||
|
|
@ -477,6 +519,21 @@ str.pad = function(s, cch, fPadLeft)
|
|||
return fPadLeft? (sPadding + s).slice(-cch) : (s + sPadding).slice(0, cch);
|
||||
};
|
||||
|
||||
/**
|
||||
* stripLeadingZeros(s, fPad)
|
||||
*
|
||||
* @param {string} s
|
||||
* @param {boolean} [fPad]
|
||||
* @return {string}
|
||||
*/
|
||||
str.stripLeadingZeros = function(s, fPad)
|
||||
{
|
||||
var cch = s.length;
|
||||
s = s.replace(/^0+([0-9A-F]+)$/i, "$1");
|
||||
if (fPad) s = str.pad(s, cch, true);
|
||||
return s;
|
||||
};
|
||||
|
||||
/**
|
||||
* trim(s)
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in a new issue