Implemented opJSR, removed more "negative address" tests (eg, in pushWord); bad addresses should result in special exceptions, not negative return values

This commit is contained in:
Jeff 2016-09-26 09:43:05 -07:00 committed by Jeff Parsons
commit 1ec60573d5
6 changed files with 1315 additions and 1308 deletions

View file

@ -854,10 +854,11 @@ PDP11.opIOT = function(opCode)
*/
PDP11.opJSR = function(opCode)
{
/*
* TODO: Implement
*/
this.regOp = -1;
var addr = this.getVirtualByMode(opCode, PDP11.ACCESS.VIRT);
var reg = (opCode >> PDP11.SRCMODE.SHIFT) & PDP11.OPREG.MASK;
this.pushWord(this.regsGen[reg]);
this.regsGen[reg] = this.regsGen[PDP11.REG.PC];
this.regsGen[PDP11.REG.PC] = addr;
this.nStepCycles -= 1;
};

File diff suppressed because it is too large Load diff

View file

@ -203,6 +203,10 @@ var PDP11 = {
MASK: 0x0FC0,
SHIFT: 6
},
REG: {
SP: 6,
PC: 7,
},
/*
* PDP-11 trap vectors
*/
@ -222,12 +226,13 @@ var PDP11 = {
* Internal memory access flags
*/
ACCESS: {
WORD: 0x0,
BYTE: 0x1,
READ: 0x2,
WRITE: 0x4,
UPDATE: 0x6,
DSPACE: 0x10000 // set bit 17 in any 16-bit virtual address that refers to D space (as opposed to I space)
WORD: 0x00,
BYTE: 0x01,
READ: 0x02,
WRITE: 0x04,
UPDATE: 0x06,
VIRT: 0x08, // getVirtualByMode() leaves bit 17 clear if this is set (otherwise the caller would have to clear it again)
DSPACE: 0x10000, // getVirtualByMode() sets bit 17 in any 16-bit virtual address that refers to D space (as opposed to I space)
},
/*
* Internal flags passed to writeByteByMode(), etc.

View file

@ -48,8 +48,8 @@ if (NODE) {
* name: the name of the device to be supported (eg, "unibus" for generic UNIBUS support)
*
* TODO: This is currently a "catch-all" device; ideally, each of the assorted devices emulated here
* (eg, KW11, RK11, RL11, etc) would be a separate component. But because we're in the middle of porting
* all this code from a common module (iopage.js), that's the way it is.
* (eg, DL11, KW11, RK11, RL11, etc) would be a separate component. But because we're in the middle of
* porting all this code from a common module (iopage.js), that's the way it is.
*
* @constructor
* @extends Component
@ -63,7 +63,7 @@ function DevicePDP11(parmsDevice)
this.tty = {
rbuf: [],
rcsr: 0,
xcsr: 0x80, /*0200*/
xcsr: PDP11.DL11.XCSR.READY,
delCode: 127,
del: 0
};
@ -248,17 +248,17 @@ DevicePDP11.prototype.readXCSR = function(addr)
DevicePDP11.prototype.writeXCSR = function(data, addr)
{
/*
* If the device is READY and INT_ENABLE is transitioning to *set*, generate an interrupt.
* If the device is READY, and INT_ENABLE is transitioning to *set*, then generate an interrupt.
*/
var device = this;
if ((this.tty.xcsr & (PDP11.DL11.XCSR.READY | PDP11.DL11.XCSR.INT_ENABLE)) == PDP11.DL11.XCSR.READY && (data & PDP11.DL11.XCSR.INT_ENABLE)) {
var device = this;
this.cpu.interrupt(PDP11.DL11.DELAY, PDP11.DL11.PRI, PDP11.DL11.VEC, function() {
device.tty.xcsr |= PDP11.DL11.XCSR.READY;
return !!(device.tty.xcsr & PDP11.DL11.XCSR.INT_ENABLE);
});
}
/*
* In any event, update all bits from data *except* for READY.
* In any event, propagate all bits from data *except* for READY.
*/
this.tty.xcsr = (this.tty.xcsr & PDP11.DL11.XCSR.READY) | (data & ~PDP11.DL11.XCSR.READY);
};