Fixed XXDP disk boot (haven't tried any tests yet, but it's still good progress)

This commit is contained in:
Jeff 2016-11-07 17:20:53 -08:00 • committed by Jeff Parsons
commit eb3b38a5ad
11 changed files with 163 additions and 125 deletions

View file

@ -676,7 +676,7 @@ BusPDP11.prototype.addMemory = function(addr, size, type, controller)
}
if (sizeLeft <= 0) {
if (type == MemoryPDP11.TYPE.RAM && !this.cbRAM) {
if (type == MemoryPDP11.TYPE.RAM) {
this.cbRAM += size;
}
this.status((size >> 10) + "Kb " + MemoryPDP11.TYPE_NAMES[type] + " at " + str.toOct(addr));

View file

@ -884,7 +884,7 @@ PDP11.opCLR = function(opCode)
*/
PDP11.opCLRB = function(opCode)
{
this.updateAllFlags(this.writeDstByte(opCode, 0));
this.updateAllFlags(this.writeDstByte(opCode, 0, PDP11.WRITE.BYTE));
this.nStepCycles -= (this.dstMode? (8 + 1) : (2 + 1) + (this.dstReg == 7? 2 : 0));
};
@ -1269,6 +1269,31 @@ PDP11.opMFPI = function(opCode)
this.nStepCycles -= (10 + 1);
};
/**
* opMFPT(opCode)
*
* 000007 MFPT - Move From Processor Type
*
* Loads R0 with a value indicating the processor type.
*
* R0 Hardware
* 1 PDP-11/44
* 3 PDP-11/24 (should be 2)
* 3 PDP-11/23
* 4 SBC-11/21
* 5 All J11 chips including 11/73, 11/83, 11/93
*
* @this {CPUStatePDP11}
* @param {number} opCode
*/
PDP11.opMFPT = function(opCode)
{
/*
* TODO: Review
*/
this.trap(PDP11.TRAP.RESERVED, PDP11.REASON.RESERVED);
};
PDP11.MOV_CYCLES = [
2 + 1, 8 + 1, 8 + 1, 11 + 2, 9 + 1, 12 + 2, 10 + 2, 13 + 3,
3 + 1, 8 + 1, 8 + 1, 11 + 2, 9 + 1, 12 + 2, 11 + 2, 14 + 3
@ -1301,7 +1326,7 @@ PDP11.opMOV = function(opCode)
PDP11.opMOVB = function(opCode)
{
var data = this.readSrcByte(opCode);
this.updateNZVFlags(this.writeDstByte(opCode, data, PDP11.WRITE.SIGNEXT) << 8);
this.updateNZVFlags(this.writeDstByte(opCode, data, PDP11.WRITE.SBYTE) << 8);
this.nStepCycles -= (this.dstMode? (8 + 1) + (this.srcReg && this.dstReg >= 6? 1 : 0) : (this.srcMode? (3 + 2) : (2 + 1)) + (this.dstReg == 7? 2 : 0));
};
@ -2270,7 +2295,7 @@ PDP11.aOp000X_1145 = [
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.opMFPT, // 0x0007 000007 TBD
PDP11.opUndefined, // 0x0008
PDP11.opUndefined, // 0x0009
PDP11.opUndefined, // 0x000A

View file

@ -2042,20 +2042,26 @@ CPUStatePDP11.prototype.updateDstWord = function(opCode, src, fnOp)
* @this {CPUStatePDP11}
* @param {number} opCode
* @param {number} data
* @param {number} [writeFlags]
* @param {number} writeFlags (WRITE.BYTE aka 0xff, or WRITE.SBYTE aka 0xffff)
* @return {number}
*/
CPUStatePDP11.prototype.writeDstByte = function(opCode, data, writeFlags)
{
this.assert(writeFlags);
var reg = this.dstReg = opCode & PDP11.OPREG.MASK;
var mode = this.dstMode = (opCode & PDP11.OPMODE.MASK) >> PDP11.OPMODE.SHIFT;
if (!mode) {
if (!data) {
this.regsGen[reg] &= ~0xff; // TODO: Profile to determine if this is a win
} else if (writeFlags & PDP11.WRITE.SIGNEXT) {
this.regsGen[reg] = ((data << 24) >> 24) & 0xffff;
/*
* Potentially worthless optimization (but it looks good on "paper").
*/
this.regsGen[reg] &= ~writeFlags;
} else {
this.regsGen[reg] = (this.regsGen[reg] & ~0xff) | (data & 0xff);
/*
* Potentially worthwhile optimization: skipping the sign-extending data shifts
* if writeFlags is WRITE.BYTE (but that requires an extra test and separate code paths).
*/
this.regsGen[reg] = (this.regsGen[reg] & ~writeFlags) | (((data << 24) >> 24) & writeFlags);
}
} else {
this.writeByteToPhysical(this.getAddr(mode, reg, PDP11.ACCESS.WRITE_BYTE), data);

View file

@ -296,11 +296,13 @@ var PDP11 = {
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.
* Internal flags passed to writeDstByte()
*
* The BYTE and SBYTE values have been chosen so that they can be used directly as masks.
*/
WRITE: {
NORMAL: 0x0, // write byte or word normally
SIGNEXT: 0x1 // sign-extend a byte to a word
BYTE: 0xff, // write byte normally
SBYTE: 0xffff // sign-extend byte to word
},
CPUERR: {
RED: 0x0004, // red zone stack limit

View file

@ -872,6 +872,11 @@ DevicePDP11.prototype.writeCTRL = function(data, addr)
*/
DevicePDP11.prototype.readSIZE = function(addr)
{
/*
* TODO: getMemorySize() returns an aggregate total, so if there are multiple discontiguous
* chunks of RAM, this could return the wrong result; another interface, getHighestAddress(),
* might be required.
*/
return addr == PDP11.UNIBUS.LSIZE? ((this.bus.getMemorySize(MemoryPDP11.TYPE.RAM) >> 6) - 1) : 0;
};

View file

@ -939,7 +939,7 @@ RL11.prototype.processCommand = function()
case PDP11.RL11.FUNC.WDATA:
if (!fnReadWrite) fnReadWrite = this.writeData;
iCylinder = this.dar >> PDP11.RL11.RLDA.SHIFT.RW_CA;
iHead = (this.dar & PDP11.RL11.RLDA.RW_HS)? 0 : 1;
iHead = (this.dar & PDP11.RL11.RLDA.RW_HS)? 1 : 0;
iSector = this.dar & PDP11.RL11.RLDA.RW_SA;
if (iCylinder >= drive.nCylinders || iSector >= drive.nSectors) {
this.csr |= PDP11.RL11.ERRC.HNF | PDP11.RL11.RLCS.ERR;