Converted all "short" references to "word", since word meant 16-bit in the PDP-11 world, and no one said short back then

This commit is contained in:
Jeff 2016-09-26 08:53:35 -07:00 committed by Jeff Parsons
commit a4613082f8
6 changed files with 328 additions and 337 deletions

View file

@ -109,8 +109,8 @@ function BusPDP11(parmsBus, cpu, dbg)
*
* [0]: readByte(addr)
* [1]: writeByte(b, addr)
* [2]: readShort(addr)
* [3]: writeShort(w, addr)
* [2]: readWord(addr)
* [3]: writeWord(w, addr)
*
* Each of these 4-element arrays are similar to the memory access arrays assigned to entire Memory
* blocks, but these handlers generally target a specific address (or handful of addresses), while
@ -159,9 +159,9 @@ BusPDP11.ERROR = {
/*
* These are our custom controller functions for all IOPAGE accesses.
*
* Note that we try to have reasonable fall-backs for byte reads when only short read handlers exist,
* and short reads if only byte handlers exist. Ditto for writes. These fall-backs may not always be
* appropriate; for example, when a byte write falls back to a short write, the address must be read
* Note that we try to have reasonable fall-backs for byte reads when only word read handlers exist,
* and word reads if only byte handlers exist. Ditto for writes. These fall-backs may not always be
* appropriate; for example, when a byte write falls back to a word write, the address must be read
* first, and depending on the underlying I/O device, that may or may not have side-effects. It's really
* up to the device to know whether that matters, and provide all the necessary handlers if it does.
*
@ -201,6 +201,7 @@ BusPDP11.IOController = {
return afn[2](addr & ~0x1) >> 8;
}
}
bus.println("warning: unconverted read access to byte @" + str.toOct(addr));
return bus.fnAccess(addr, -1, 1);
},
@ -239,18 +240,19 @@ BusPDP11.IOController = {
return;
}
}
bus.println("warning: unconverted write access to byte @" + str.toOct(addr));
bus.fnAccess(addr, b, 1);
},
/**
* readShort(off, addr)
* readWord(off, addr)
*
* @this {MemoryPDP11}
* @param {number} off
* @param {number} addr
* @return {number}
*/
readShort: function(off, addr)
readWord: function(off, addr)
{
var bus = this.controller;
Component.assert(!(addr & 1)); // unaligned addresses should be getting trapped at a higher level
@ -262,18 +264,19 @@ BusPDP11.IOController = {
return afn[0](addr) | (afn[0](addr + 1) << 8);
}
}
bus.println("warning: unconverted read access to word @" + str.toOct(addr));
return bus.fnAccess(addr, -1, 0);
},
/**
* writeShort(off, w, addr)
* writeWord(off, w, addr)
*
* @this {MemoryPDP11}
* @param {number} off
* @param {number} w (which should already be pre-masked to 16 bits)
* @param {number} addr
*/
writeShort: function(off, w, addr)
writeWord: function(off, w, addr)
{
var bus = this.controller;
Component.assert(!(addr & 1)); // unaligned addresses should be getting trapped at a higher level
@ -288,6 +291,7 @@ BusPDP11.IOController = {
return;
}
}
bus.println("warning: unconverted write access to word @" + str.toOct(addr));
bus.fnAccess(addr, w, 0);
}
};
@ -310,8 +314,8 @@ BusPDP11.prototype.initMemory = function()
this.afnIOPage = new Array(4);
this.afnIOPage[0] = BusPDP11.IOController.readByte;
this.afnIOPage[1] = BusPDP11.IOController.writeByte;
this.afnIOPage[2] = BusPDP11.IOController.readShort;
this.afnIOPage[3] = BusPDP11.IOController.writeShort;
this.afnIOPage[2] = BusPDP11.IOController.readWord;
this.afnIOPage[3] = BusPDP11.IOController.writeWord;
/*
* Map IOPAGE at the top of the address space (as determined by nBusWidth), as well as at IOPAGE_VIRT
* (which is the only place that 16-bit code can reach the IOPAGE when memory management is not enabled).
@ -731,37 +735,37 @@ BusPDP11.prototype.getByteDirect = function(addr)
};
/**
* getShort(addr)
* getWord(addr)
*
* @this {BusPDP11}
* @param {number} addr is a physical address
* @return {number} short (16-bit) value at that address
* @return {number} word (16-bit) value at that address
*/
BusPDP11.prototype.getShort = function(addr)
BusPDP11.prototype.getWord = function(addr)
{
var off = addr & this.nBlockLimit;
var iBlock = (addr & this.nBusMask) >>> this.nBlockShift;
if (off != this.nBlockLimit) {
return this.aMemBlocks[iBlock].readShort(off, addr);
return this.aMemBlocks[iBlock].readWord(off, addr);
}
return this.aMemBlocks[iBlock++].readByte(off, addr) | (this.aMemBlocks[iBlock & this.nBlockMask].readByte(0, addr + 1) << 8);
};
/**
* getShortDirect(addr)
* getWordDirect(addr)
*
* This is useful for the Debugger and other components that want to bypass getShort() breakpoint detection.
* This is useful for the Debugger and other components that want to bypass getWord() breakpoint detection.
*
* @this {BusPDP11}
* @param {number} addr is a physical address
* @return {number} short (16-bit) value at that address
* @return {number} word (16-bit) value at that address
*/
BusPDP11.prototype.getShortDirect = function(addr)
BusPDP11.prototype.getWordDirect = function(addr)
{
var off = addr & this.nBlockLimit;
var iBlock = (addr & this.nBusMask) >>> this.nBlockShift;
if (off != this.nBlockLimit) {
return this.aMemBlocks[iBlock].readShortDirect(off, addr);
return this.aMemBlocks[iBlock].readWordDirect(off, addr);
}
return this.aMemBlocks[iBlock++].readByteDirect(off, addr) | (this.aMemBlocks[iBlock & this.nBlockMask].readByteDirect(0, addr + 1) << 8);
};
@ -794,18 +798,18 @@ BusPDP11.prototype.setByteDirect = function(addr, b)
};
/**
* setShort(addr, w)
* setWord(addr, w)
*
* @this {BusPDP11}
* @param {number} addr is a physical address
* @param {number} w is the short (16-bit) value to write (we truncate it to 16 bits to be safe)
* @param {number} w is the word (16-bit) value to write (we truncate it to 16 bits to be safe)
*/
BusPDP11.prototype.setShort = function(addr, w)
BusPDP11.prototype.setWord = function(addr, w)
{
var off = addr & this.nBlockLimit;
var iBlock = (addr & this.nBusMask) >>> this.nBlockShift;
if (off != this.nBlockLimit) {
this.aMemBlocks[iBlock].writeShort(off, w & 0xffff, addr);
this.aMemBlocks[iBlock].writeWord(off, w & 0xffff, addr);
return;
}
this.aMemBlocks[iBlock++].writeByte(off, w & 0xff, addr);
@ -813,21 +817,21 @@ BusPDP11.prototype.setShort = function(addr, w)
};
/**
* setShortDirect(addr, w)
* setWordDirect(addr, w)
*
* This is useful for the Debugger and other components that want to bypass breakpoint detection AND read-only
* memory protection (for example, this is an interface the ROM component could use to initialize ROM contents).
*
* @this {BusPDP11}
* @param {number} addr is a physical address
* @param {number} w is the short (16-bit) value to write (we truncate it to 16 bits to be safe)
* @param {number} w is the word (16-bit) value to write (we truncate it to 16 bits to be safe)
*/
BusPDP11.prototype.setShortDirect = function(addr, w)
BusPDP11.prototype.setWordDirect = function(addr, w)
{
var off = addr & this.nBlockLimit;
var iBlock = (addr & this.nBusMask) >>> this.nBlockShift;
if (off != this.nBlockLimit) {
this.aMemBlocks[iBlock].writeShortDirect(off, w & 0xffff, addr);
this.aMemBlocks[iBlock].writeWordDirect(off, w & 0xffff, addr);
return;
}
this.aMemBlocks[iBlock++].writeByteDirect(off, w & 0xff, addr);
@ -955,7 +959,7 @@ BusPDP11.prototype.restoreMemory = function(a)
};
/**
* addIOHandlers(start, end, fnReadByte, fnWriteByte, fnReadShort, fnWriteShort)
* addIOHandlers(start, end, fnReadByte, fnWriteByte, fnReadWord, fnWriteWord)
*
* Add I/O notification handlers to the master list (aIOHandlers). The start and end addresses are typically
* relative to the starting IOPAGE address, but they can also be absolute; we simply mask all addresses with
@ -966,10 +970,10 @@ BusPDP11.prototype.restoreMemory = function(a)
* @param {number} end address
* @param {function(number)|null|undefined} fnReadByte
* @param {function(number,number)|null|undefined} fnWriteByte
* @param {function(number)|null|undefined} fnReadShort
* @param {function(number,number)|null|undefined} fnWriteShort
* @param {function(number)|null|undefined} fnReadWord
* @param {function(number,number)|null|undefined} fnWriteWord
*/
BusPDP11.prototype.addIOHandlers = function(start, end, fnReadByte, fnWriteByte, fnReadShort, fnWriteShort)
BusPDP11.prototype.addIOHandlers = function(start, end, fnReadByte, fnWriteByte, fnReadWord, fnWriteWord)
{
for (var addr = start; addr <= end; addr += 2) {
var off = addr & BusPDP11.IOPAGE_MASK;
@ -977,7 +981,7 @@ BusPDP11.prototype.addIOHandlers = function(start, end, fnReadByte, fnWriteByte,
Component.warning("I/O address already registered: " + str.toHexLong(addr));
continue;
}
this.aIOHandlers[off] = [fnReadByte, fnWriteByte, fnReadShort, fnWriteShort, false];
this.aIOHandlers[off] = [fnReadByte, fnWriteByte, fnReadWord, fnWriteWord, false];
if (MAXDEBUG) this.log("addIOHandlers(" + str.toHexLong(addr) + ")");
}
};
@ -997,9 +1001,9 @@ BusPDP11.prototype.addIOTable = function(component, table)
var afn = table[port];
var fnReadByte = afn[0]? afn[0].bind(component) : null;
var fnWriteByte = afn[1]? afn[1].bind(component) : null;
var fnReadShort = afn[2]? afn[2].bind(component) : null;
var fnWriteShort = afn[3]? afn[3].bind(component) : null;
this.addIOHandlers(+port, +port, fnReadByte, fnWriteByte, fnReadShort, fnWriteShort);
var fnReadWord = afn[2]? afn[2].bind(component) : null;
var fnWriteWord = afn[3]? afn[3].bind(component) : null;
this.addIOHandlers(+port, +port, fnReadByte, fnWriteByte, fnReadWord, fnWriteWord);
}
};

View file

@ -979,7 +979,7 @@ CPUStatePDP11.prototype.readWordFromPhysical = function(physicalAddress)
// return this.bus.access_iopage(physicalAddress, -1, 0);
// } else {
if (physicalAddress >= 0) {
return this.bus.getShort(physicalAddress);
return this.bus.getWord(physicalAddress);
}
// }
}
@ -1015,7 +1015,7 @@ CPUStatePDP11.prototype.writeWordToPhysical = function(physicalAddress, data)
// return this.bus.access_iopage(physicalAddress, data, 0);
// } else {
if (physicalAddress >= 0) {
this.bus.setShort(physicalAddress, data);
this.bus.setWord(physicalAddress, data);
return data;
}
// }

View file

@ -590,32 +590,19 @@ if (DEBUGGER) {
};
/**
* getWord(dbgAddr, fAdvance)
*
* @this {DebuggerPDP11}
* @param {DbgAddrPDP11} dbgAddr
* @param {boolean} [fAdvance]
* @return {number}
*/
DebuggerPDP11.prototype.getWord = function(dbgAddr, fAdvance)
{
return this.getShort(dbgAddr, fAdvance? 2 : 0);
};
/**
* getShort(dbgAddr, inc)
* getWord(dbgAddr, inc)
*
* @this {DebuggerPDP11}
* @param {DbgAddrPDP11} dbgAddr
* @param {number} [inc]
* @return {number}
*/
DebuggerPDP11.prototype.getShort = function(dbgAddr, inc)
DebuggerPDP11.prototype.getWord = function(dbgAddr, inc)
{
var w = 0xffff;
var addr = this.getAddr(dbgAddr, false, 2);
if (addr !== PDP11.ADDR_INVALID) {
w = this.bus.getShortDirect(addr);
w = this.bus.getWordDirect(addr);
if (inc) this.incAddr(dbgAddr, inc);
}
return w;
@ -640,18 +627,18 @@ if (DEBUGGER) {
};
/**
* setShort(dbgAddr, w, inc)
* setWord(dbgAddr, w, inc)
*
* @this {DebuggerPDP11}
* @param {DbgAddrPDP11} dbgAddr
* @param {number} w
* @param {number} [inc]
*/
DebuggerPDP11.prototype.setShort = function(dbgAddr, w, inc)
DebuggerPDP11.prototype.setWord = function(dbgAddr, w, inc)
{
var addr = this.getAddr(dbgAddr, true, 2);
if (addr !== PDP11.ADDR_INVALID) {
this.bus.setShortDirect(addr, w);
this.bus.setWordDirect(addr, w);
if (inc) this.incAddr(dbgAddr, inc);
this.cpu.updateCPU(true); // we set fForce to true in case video memory was the target
}
@ -1513,7 +1500,7 @@ if (DEBUGGER) {
*/
if (nState >= 0 && this.aaOpcodeCounts.length) {
this.cOpcodes++;
var opCode = this.bus.getShortDirect(addr);
var opCode = this.bus.getWordDirect(addr);
if (opCode != null) {
var dbgAddr = this.aOpcodeHistory[this.iOpcodeHistory];
this.setAddr(dbgAddr, cpu.getPC());
@ -1892,7 +1879,7 @@ if (DEBUGGER) {
{
var opNames = DebuggerPDP11.OPNAMES;
var dbgAddrOp = this.newAddr(dbgAddr.addr);
var opCode = this.getWord(dbgAddr, true);
var opCode = this.getWord(dbgAddr, 2);
var opDesc;
for (var mask in this.opTable) {
@ -1936,7 +1923,7 @@ if (DEBUGGER) {
var sLine = this.toStrAddr(dbgAddrOp) + ":";
if (dbgAddrOp.addr !== PDP11.ADDR_INVALID && dbgAddr.addr !== PDP11.ADDR_INVALID) {
do {
sOpcodes += ' ' + this.toStrBase(this.getWord(dbgAddrOp, true));
sOpcodes += ' ' + this.toStrBase(this.getWord(dbgAddrOp, 2));
if (dbgAddrOp.addr == null) break;
} while (dbgAddrOp.addr != dbgAddr.addr);
}
@ -2028,7 +2015,7 @@ if (DEBUGGER) {
/*
* When using R7 (aka PC), POST-INCREMENT is known as IMMEDIATE
*/
wIndex = this.getWord(dbgAddr, true);
wIndex = this.getWord(dbgAddr, 2);
sOperand = "#" + this.toStrBase(wIndex);
}
break;
@ -2039,7 +2026,7 @@ if (DEBUGGER) {
/*
* When using R7 (aka PC), POST-INCREMENT DEFERRED is known as ABSOLUTE
*/
wIndex = this.getWord(dbgAddr, true);
wIndex = this.getWord(dbgAddr, 2);
sOperand = "@#" + this.toStrBase(wIndex);
}
break;
@ -2050,7 +2037,7 @@ if (DEBUGGER) {
sOperand = "@-(" + this.getRegName(reg) + ")";
break;
case PDP11.OPMODE.INDEX: // 0x6: INDEX
wIndex = this.getWord(dbgAddr, true);
wIndex = this.getWord(dbgAddr, 2);
sOperand = this.toStrBase(wIndex) + '(' + this.getRegName(reg) + ')';
if (reg == 7) {
/*
@ -2060,7 +2047,7 @@ if (DEBUGGER) {
}
break;
case PDP11.OPMODE.INDEXD: // 0x7: INDEX DEFERRED
wIndex = this.getWord(dbgAddr, true);
wIndex = this.getWord(dbgAddr, 2);
sOperand = '@' + this.toStrBase(wIndex) + '(' + this.getRegName(reg) + ')';
if (reg == 7) {
/*
@ -2771,8 +2758,8 @@ if (DEBUGGER) {
if (asArgs[0] == "ew") {
size = 2;
mask = 0xffff;
fnGet = this.getShort;
fnSet = this.setShort;
fnGet = this.getWord;
fnSet = this.setWord;
}
var cch = size << 1;
@ -3348,7 +3335,7 @@ if (DEBUGGER) {
while (cFrames < nFrames) {
var sCall = null, sCallPrev = null, cTests = 256;
while ((dbgAddrStack.addr >>> 0) < 0x10000) {
dbgAddrCall.addr = this.getWord(dbgAddrStack, true);
dbgAddrCall.addr = this.getWord(dbgAddrStack, 2);
/*
* Because we're using the auto-increment feature of getWord(), and because that will automatically
* wrap the offset around the end of the segment, we must also check the addr property to detect the wrap.

View file

@ -384,7 +384,7 @@ MemoryPDP11.prototype = {
* setAccess(afn, fDirect)
*
* The afn parameter should be a 4-entry function table containing two byte handlers and
* two short handlers. See the static afnMemory table for an example.
* two word handlers. See the static afnMemory table for an example.
*
* If no function table is specified, a default is selected based on the MemoryPDP11 type;
* similarly, any undefined entries in the table are filled with default handlers that fall
@ -419,11 +419,11 @@ MemoryPDP11.prototype = {
setReadAccess: function(afn, fDirect) {
if (!fDirect || !this.cReadBreakpoints) {
this.readByte = afn[0] || this.readNone;
this.readShort = afn[2] || this.readShortDefault;
this.readWord = afn[2] || this.readWordDefault;
}
if (fDirect || fDirect === undefined) {
this.readByteDirect = afn[0] || this.readNone;
this.readShortDirect = afn[2] || this.readShortDefault;
this.readWordDirect = afn[2] || this.readWordDefault;
}
},
/**
@ -436,11 +436,11 @@ MemoryPDP11.prototype = {
setWriteAccess: function(afn, fDirect) {
if (!fDirect || !this.cWriteBreakpoints) {
this.writeByte = !this.fReadOnly && afn[1] || this.writeNone;
this.writeShort = !this.fReadOnly && afn[3] || this.writeShortDefault;
this.writeWord = !this.fReadOnly && afn[3] || this.writeWordDefault;
}
if (fDirect || fDirect === undefined) {
this.writeByteDirect = afn[1] || this.writeNone;
this.writeShortDirect = afn[3] || this.writeShortDefault;
this.writeWordDirect = afn[3] || this.writeWordDefault;
}
},
/**
@ -450,7 +450,7 @@ MemoryPDP11.prototype = {
*/
resetReadAccess: function() {
this.readByte = this.readByteDirect;
this.readShort = this.readShortDirect;
this.readWord = this.readWordDirect;
},
/**
* resetWriteAccess()
@ -459,7 +459,7 @@ MemoryPDP11.prototype = {
*/
resetWriteAccess: function() {
this.writeByte = this.fReadOnly? this.writeNone : this.writeByteDirect;
this.writeShort = this.fReadOnly? this.writeShortDefault : this.writeShortDirect;
this.writeWord = this.fReadOnly? this.writeWordDefault : this.writeWordDirect;
},
/**
* printAddr(sMessage)
@ -543,7 +543,7 @@ MemoryPDP11.prototype = {
* if it reads back 0x0000, it will initially think that LOTS of RAM exists, only to be disappointed later
* when it performs a more exhaustive memory test, generating unwanted error messages in the process.
*
* TODO: Determine if we should have separate readByteNone(), readShortNone() and readLongNone() functions
* TODO: Determine if we should have separate readByteNone(), readWordNone() and readLongNone() functions
* to return 0xff, 0xffff and 0xffffffff|0, respectively. This seems sufficient for now, as it seems unlikely
* that a system would require nonexistent memory locations to return ALL bits set.
*
@ -575,25 +575,25 @@ MemoryPDP11.prototype = {
}
},
/**
* readShortDefault(off, addr)
* readWordDefault(off, addr)
*
* @this {MemoryPDP11}
* @param {number} off
* @param {number} addr
* @return {number}
*/
readShortDefault: function readShortDefault(off, addr) {
readWordDefault: function readWordDefault(off, addr) {
return this.readByte(off++, addr++) | (this.readByte(off, addr) << 8);
},
/**
* writeShortDefault(off, w, addr)
* writeWordDefault(off, w, addr)
*
* @this {MemoryPDP11}
* @param {number} off
* @param {number} w
* @param {number} addr
*/
writeShortDefault: function writeShortDefault(off, w, addr) {
writeWordDefault: function writeWordDefault(off, w, addr) {
this.writeByte(off++, w & 0xff, addr++);
this.writeByte(off, w >> 8, addr);
},
@ -612,14 +612,14 @@ MemoryPDP11.prototype = {
return ((this.adw[off >> 2] >>> ((off & 0x3) << 3)) & 0xff);
},
/**
* readShortMemory(off, addr)
* readWordMemory(off, addr)
*
* @this {MemoryPDP11}
* @param {number} off
* @param {number} addr
* @return {number}
*/
readShortMemory: function readShortMemory(off, addr) {
readWordMemory: function readWordMemory(off, addr) {
if (BYTEARRAYS) {
return this.ab[off] | (this.ab[off + 1] << 8);
}
@ -653,14 +653,14 @@ MemoryPDP11.prototype = {
this.fDirty = true;
},
/**
* writeShortMemory(off, w, addr)
* writeWordMemory(off, w, addr)
*
* @this {MemoryPDP11}
* @param {number} off
* @param {number} w
* @param {number} addr
*/
writeShortMemory: function writeShortMemory(off, w, addr) {
writeWordMemory: function writeWordMemory(off, w, addr) {
if (BYTEARRAYS) {
this.ab[off] = (w & 0xff);
this.ab[off + 1] = (w >> 8);
@ -692,18 +692,18 @@ MemoryPDP11.prototype = {
return this.readByteDirect(off, addr);
},
/**
* readShortChecked(off, addr)
* readWordChecked(off, addr)
*
* @this {MemoryPDP11}
* @param {number} off
* @param {number} addr
* @return {number}
*/
readShortChecked: function readShortChecked(off, addr) {
readWordChecked: function readWordChecked(off, addr) {
if (DEBUGGER && this.dbg && this.addr != null) {
this.dbg.checkMemoryRead(this.addr + off, 2);
}
return this.readShortDirect(off, addr);
return this.readWordDirect(off, addr);
},
/**
* writeByteChecked(off, b, addr)
@ -720,18 +720,18 @@ MemoryPDP11.prototype = {
if (this.fReadOnly) this.writeNone(off, b, addr); else this.writeByteDirect(off, b, addr);
},
/**
* writeShortChecked(off, w, addr)
* writeWordChecked(off, w, addr)
*
* @this {MemoryPDP11}
* @param {number} off
* @param {number} addr
* @param {number} w
*/
writeShortChecked: function writeShortChecked(off, w, addr) {
writeWordChecked: function writeWordChecked(off, w, addr) {
if (DEBUGGER && this.dbg && this.addr != null) {
this.dbg.checkMemoryWrite(this.addr + off, 2)
}
if (this.fReadOnly) this.writeNone(off, w, addr); else this.writeShortDirect(off, w, addr);
if (this.fReadOnly) this.writeNone(off, w, addr); else this.writeWordDirect(off, w, addr);
},
/**
* readByteBE(off, addr)
@ -756,28 +756,28 @@ MemoryPDP11.prototype = {
return this.ab[off];
},
/**
* readShortBE(off, addr)
* readWordBE(off, addr)
*
* @this {MemoryPDP11}
* @param {number} off
* @param {number} addr
* @return {number}
*/
readShortBE: function readShortBE(off, addr) {
readWordBE: function readWordBE(off, addr) {
return this.dv.getUint16(off, true);
},
/**
* readShortLE(off, addr)
* readWordLE(off, addr)
*
* @this {MemoryPDP11}
* @param {number} off
* @param {number} addr
* @return {number}
*/
readShortLE: function readShortLE(off, addr) {
readWordLE: function readWordLE(off, addr) {
/*
* TODO: It remains to be seen if there's any advantage to checking the offset for an aligned read
* vs. always reading the bytes separately; it seems a safe bet for longs, but it's less clear for shorts.
* vs. always reading the bytes separately.
*/
return (off & 0x1)? (this.ab[off] | (this.ab[off+1] << 8)) : this.aw[off >> 1];
},
@ -806,29 +806,29 @@ MemoryPDP11.prototype = {
this.fDirty = true;
},
/**
* writeShortBE(off, w, addr)
* writeWordBE(off, w, addr)
*
* @this {MemoryPDP11}
* @param {number} off
* @param {number} addr
* @param {number} w
*/
writeShortBE: function writeShortBE(off, w, addr) {
writeWordBE: function writeWordBE(off, w, addr) {
this.dv.setUint16(off, w, true);
this.fDirty = true;
},
/**
* writeShortLE(off, w, addr)
* writeWordLE(off, w, addr)
*
* @this {MemoryPDP11}
* @param {number} off
* @param {number} addr
* @param {number} w
*/
writeShortLE: function writeShortLE(off, w, addr) {
writeWordLE: function writeWordLE(off, w, addr) {
/*
* TODO: It remains to be seen if there's any advantage to checking the offset for an aligned write
* vs. always writing the bytes separately; it seems a safe bet for longs, but it's less clear for shorts.
* vs. always writing the bytes separately.
*/
if (off & 0x1) {
this.ab[off] = w;
@ -842,13 +842,13 @@ MemoryPDP11.prototype = {
/*
* This is the effective definition of afnNone, but we need not fully define it, because setAccess()
* uses these defaults when any of the 4 handlers (ie, 2 byte handlers and 2 short handlers) are undefined.
* uses these defaults when any of the 4 handlers (ie, 2 byte handlers and 2 word handlers) are undefined.
*
MemoryPDP11.afnNone = [
MemoryPDP11.prototype.readNone,
MemoryPDP11.prototype.writeNone,
MemoryPDP11.prototype.readShortDefault,
MemoryPDP11.prototype.writeShortDefault
MemoryPDP11.prototype.readWordDefault,
MemoryPDP11.prototype.writeWordDefault
];
*/
MemoryPDP11.afnNone = [];
@ -856,30 +856,30 @@ MemoryPDP11.afnNone = [];
MemoryPDP11.afnMemory = [
MemoryPDP11.prototype.readByteMemory,
MemoryPDP11.prototype.writeByteMemory,
MemoryPDP11.prototype.readShortMemory,
MemoryPDP11.prototype.writeShortMemory
MemoryPDP11.prototype.readWordMemory,
MemoryPDP11.prototype.writeWordMemory
];
MemoryPDP11.afnChecked = [
MemoryPDP11.prototype.readByteChecked,
MemoryPDP11.prototype.writeByteChecked,
MemoryPDP11.prototype.readShortChecked,
MemoryPDP11.prototype.writeShortChecked
MemoryPDP11.prototype.readWordChecked,
MemoryPDP11.prototype.writeWordChecked
];
if (TYPEDARRAYS) {
MemoryPDP11.afnArrayBE = [
MemoryPDP11.prototype.readByteBE,
MemoryPDP11.prototype.writeByteBE,
MemoryPDP11.prototype.readShortBE,
MemoryPDP11.prototype.writeShortBE
MemoryPDP11.prototype.readWordBE,
MemoryPDP11.prototype.writeWordBE
];
MemoryPDP11.afnArrayLE = [
MemoryPDP11.prototype.readByteLE,
MemoryPDP11.prototype.writeByteLE,
MemoryPDP11.prototype.readShortLE,
MemoryPDP11.prototype.writeShortLE
MemoryPDP11.prototype.readWordLE,
MemoryPDP11.prototype.writeWordLE
];
}