More PDP-11 debugger work

This commit is contained in:
Jeff Parsons 2016-09-16 16:04:28 -07:00
commit 75918a6edc
3 changed files with 335 additions and 449 deletions

View file

@ -131,13 +131,13 @@ CPUStatePDP11.prototype.initRegs = function()
this.flagV = 0x8000; // PSW V bit
this.flagZ = 0xffff; // ~ PSW Z bit
this.PSW = 0xf; // PSW other bits
this.registerVal = [ // Current R0 - R7
this.regsCur = [ // Current R0 - R7
0, 0, 0, 0, 0, 0, 0, 0
];
this.registerAlt = [ // Alternate R0 - R5
this.regsAlt = [ // Alternate R0 - R5
0, 0, 0, 0, 0, 0
];
this.stackPointer = [ // Alternate R6 (kernel, super, illegal; user)
this.regsStack = [ // Alternate R6 (kernel, super, illegal, user)
0, 0, 0, 0
];
this.memory = []; // Main memory (words)
@ -385,7 +385,7 @@ CPUStatePDP11.prototype.setSF = function()
*/
CPUStatePDP11.prototype.getPC = function()
{
return this.registerVal[7];
return this.regsCur[7];
};
/**
@ -396,7 +396,7 @@ CPUStatePDP11.prototype.getPC = function()
*/
CPUStatePDP11.prototype.setPC = function(addr)
{
this.registerVal[7] = addr;
this.regsCur[7] = addr;
};
/**
@ -418,7 +418,7 @@ CPUStatePDP11.prototype.getPSW = function()
*/
CPUStatePDP11.prototype.getSP = function()
{
return this.registerVal[6];
return this.regsCur[6];
};
/**
@ -590,14 +590,14 @@ CPUStatePDP11.prototype.writePSW = function(newPSW)
this.flagC = newPSW << 16;
if ((newPSW ^ this.PSW) & 0x800) {
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
j = this.regsCur[i];
this.regsCur[i] = this.regsAlt[i];
this.regsAlt[i] = j; // swap to alternate register set
}
}
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.regsStack[j] = this.regsCur[6];
this.regsCur[6] = this.regsStack[this.mmuMode]; // swap to new mode SP
}
this.priorityReview = 2; // trigger check of priority levels
this.PSW = newPSW;
@ -663,10 +663,10 @@ CPUStatePDP11.prototype.trap = function(vector, reason)
this.writePSW((newPSW & 0xcfff) | ((this.trapPSW >> 2) & 0x3000)); // set new this.PSW with previous mode
if (doubleTrap) {
this.CPU_Error |= 4;
this.registerVal[6] = 4;
this.regsCur[6] = 4;
}
if (this.pushWord(this.trapPSW) >= 0 && this.pushWord(this.registerVal[7]) >= 0) {
this.registerVal[7] = newPC;
if (this.pushWord(this.trapPSW) >= 0 && this.pushWord(this.regsCur[7]) >= 0) {
this.regsCur[7] = newPC;
}
}
}
@ -860,7 +860,7 @@ CPUStatePDP11.prototype.mapVirtualToPhysical = function(virtualAddress, accessMa
CPUStatePDP11.prototype.readWordByAddr = function(physicalAddress)
{
if (physicalAddress >= PDP11.MAX_ADDRESS) {
return this.registerVal[physicalAddress - PDP11.MAX_ADDRESS];
return this.regsCur[physicalAddress - PDP11.MAX_ADDRESS];
} else {
if (physicalAddress >= PDP11.IOBASE_UNIBUS) {
return this.bus.access_iopage(physicalAddress, -1, 0);
@ -885,7 +885,7 @@ CPUStatePDP11.prototype.writeWordByAddr = function(physicalAddress, data)
{
data &= 0xffff;
if (physicalAddress >= PDP11.MAX_ADDRESS) {
return (this.registerVal[physicalAddress - PDP11.MAX_ADDRESS] = data);
return (this.regsCur[physicalAddress - PDP11.MAX_ADDRESS] = data);
} else {
if (physicalAddress >= PDP11.IOBASE_UNIBUS) {
return this.bus.access_iopage(physicalAddress, data, 0);
@ -909,7 +909,7 @@ CPUStatePDP11.prototype.readByteByAddr = function(physicalAddress)
{
var result;
if (physicalAddress >= PDP11.MAX_ADDRESS) {
return (this.registerVal[physicalAddress - PDP11.MAX_ADDRESS] & 0xff);
return (this.regsCur[physicalAddress - PDP11.MAX_ADDRESS] & 0xff);
} else {
if (physicalAddress >= PDP11.IOBASE_UNIBUS) {
return this.bus.access_iopage(physicalAddress, -1, 1);
@ -938,7 +938,7 @@ CPUStatePDP11.prototype.writeByteByAddr = function(physicalAddress, data)
{
data &= 0xff;
if (physicalAddress >= PDP11.MAX_ADDRESS) {
return (this.registerVal[physicalAddress - PDP11.MAX_ADDRESS] = (this.registerVal[physicalAddress - PDP11.MAX_ADDRESS] & 0xff00) | data);
return (this.regsCur[physicalAddress - PDP11.MAX_ADDRESS] = (this.regsCur[physicalAddress - PDP11.MAX_ADDRESS] & 0xff00) | data);
} else {
if (physicalAddress >= PDP11.IOBASE_UNIBUS) {
return this.bus.access_iopage(physicalAddress, data, 1);
@ -974,9 +974,9 @@ CPUStatePDP11.prototype.readWordByVirtual = function(virtualAddress)
*/
CPUStatePDP11.prototype.popWord = function()
{
var result = this.readWordByVirtual(this.registerVal[6] | 0x10000);
var result = this.readWordByVirtual(this.regsCur[6] | 0x10000);
if (result >= 0) {
this.registerVal[6] = (this.registerVal[6] + 2) & 0xffff;
this.regsCur[6] = (this.regsCur[6] + 2) & 0xffff;
}
return result;
};
@ -991,14 +991,14 @@ CPUStatePDP11.prototype.popWord = function()
CPUStatePDP11.prototype.pushWord = function(data)
{
var physicalAddress, virtualAddress;
this.registerVal[6] = virtualAddress = (this.registerVal[6] - 2) & 0xffff; // BSD needs SP updated before any fault :-(
this.regsCur[6] = virtualAddress = (this.regsCur[6] - 2) & 0xffff; // BSD needs SP updated before any fault :-(
if (!(this.MMR0 & 0xe000)) {
this.MMR1 = (this.MMR1 << 8) | 0xf6;
}
if ((!this.mmuMode) && virtualAddress <= this.stackLimit && virtualAddress > 4) {
if (virtualAddress <= this.stackLimit - 32) {
this.CPU_Error |= 4; // Red stack
this.registerVal[6] = 4;
this.regsCur[6] = 4;
return this.trap(4, 32);
}
this.CPU_Error |= 8; // Yellow
@ -1048,19 +1048,19 @@ CPUStatePDP11.prototype.getVirtualByMode = function(addressMode, accessMode)
return this.trap(4, 34); // trap for invalid virtual address
case 1: // Mode 1: (R)
if (reg === 6 && (!this.mmuMode) && (accessMode & PDP11.WRITE_MODE) &&
(this.registerVal[6] <= this.stackLimit || this.registerVal[6] >= 0xfffe)) {
if (this.registerVal[6] <= this.stackLimit - 32 || this.registerVal[6] >= 0xfffe) {
(this.regsCur[6] <= this.stackLimit || this.regsCur[6] >= 0xfffe)) {
if (this.regsCur[6] <= this.stackLimit - 32 || this.regsCur[6] >= 0xfffe) {
this.CPU_Error |= 4; // Red stack
this.registerVal[6] = 4;
this.regsCur[6] = 4;
return this.trap(4, 36);
}
this.CPU_Error |= 8; // Yellow
this.trapMask |= 4;
}
return (reg === 7 ? this.registerVal[reg] : (this.registerVal[reg] | 0x10000));
return (reg === 7 ? this.regsCur[reg] : (this.regsCur[reg] | 0x10000));
case 2: // Mode 2: (R)+
stepSize = 2;
virtualAddress = this.registerVal[reg];
virtualAddress = this.regsCur[reg];
if (reg !== 7) {
virtualAddress |= 0x10000;
if (reg < 6 && (accessMode & PDP11.BYTE_MODE)) {
@ -1070,7 +1070,7 @@ CPUStatePDP11.prototype.getVirtualByMode = function(addressMode, accessMode)
break;
case 3: // Mode 3: @(R)+
stepSize = 2;
virtualAddress = this.registerVal[reg];
virtualAddress = this.regsCur[reg];
if (reg !== 7) virtualAddress |= 0x10000;
if ((virtualAddress = this.readWordByVirtual(virtualAddress)) < 0) {
return virtualAddress;
@ -1081,14 +1081,14 @@ CPUStatePDP11.prototype.getVirtualByMode = function(addressMode, accessMode)
case 4: // Mode 4: -(R)
stepSize = -2;
if (reg < 6 && (accessMode & PDP11.BYTE_MODE)) stepSize = -1;
virtualAddress = (this.registerVal[reg] + stepSize) & 0xffff;
virtualAddress = (this.regsCur[reg] + stepSize) & 0xffff;
if (reg !== 7) {
virtualAddress |= 0x10000;
}
break;
case 5: // Mode 5: @-(R)
stepSize = -2;
virtualAddress = (this.registerVal[reg] - 2) & 0xffff;
virtualAddress = (this.regsCur[reg] - 2) & 0xffff;
if (reg !== 7) virtualAddress |= 0x10000;
if ((virtualAddress = this.readWordByVirtual(virtualAddress)) < 0) {
return virtualAddress;
@ -1096,28 +1096,28 @@ CPUStatePDP11.prototype.getVirtualByMode = function(addressMode, accessMode)
virtualAddress |= 0x10000;
break;
case 6: // Mode 6: d(R)
if ((virtualAddress = this.readWordByVirtual(this.registerVal[7])) < 0) {
if ((virtualAddress = this.readWordByVirtual(this.regsCur[7])) < 0) {
return virtualAddress;
}
this.registerVal[7] = (this.registerVal[7] + 2) & 0xffff;
this.regsCur[7] = (this.regsCur[7] + 2) & 0xffff;
if (reg < 7) {
//LOG_ADDRESS(virtualAddress);
virtualAddress = (virtualAddress + this.registerVal[reg]) & 0xffff;
virtualAddress = (virtualAddress + this.regsCur[reg]) & 0xffff;
} else {
virtualAddress = (virtualAddress + this.registerVal[reg]) & 0xffff;
virtualAddress = (virtualAddress + this.regsCur[reg]) & 0xffff;
//LOG_ADDRESS(virtualAddress);
}
return virtualAddress | 0x10000;
case 7: // Mode 7: @d(R)
if ((virtualAddress = this.readWordByVirtual(this.registerVal[7])) < 0) {
if ((virtualAddress = this.readWordByVirtual(this.regsCur[7])) < 0) {
return virtualAddress;
}
this.registerVal[7] = (this.registerVal[7] + 2) & 0xffff;
this.regsCur[7] = (this.regsCur[7] + 2) & 0xffff;
if (reg < 7) {
//LOG_ADDRESS(virtualAddress);
virtualAddress = (virtualAddress + this.registerVal[reg]) & 0xffff;
virtualAddress = (virtualAddress + this.regsCur[reg]) & 0xffff;
} else {
virtualAddress = (virtualAddress + this.registerVal[reg]) & 0xffff;
virtualAddress = (virtualAddress + this.regsCur[reg]) & 0xffff;
//LOG_ADDRESS(virtualAddress);
}
if ((virtualAddress = this.readWordByVirtual(virtualAddress | 0x10000)) < 0) {
@ -1125,15 +1125,15 @@ CPUStatePDP11.prototype.getVirtualByMode = function(addressMode, accessMode)
}
return virtualAddress | 0x10000; // @x
}
this.registerVal[reg] = (this.registerVal[reg] + stepSize) & 0xffff;
this.regsCur[reg] = (this.regsCur[reg] + stepSize) & 0xffff;
if (!(this.MMR0 & 0xe000)) {
this.MMR1 = (this.MMR1 << 8) | ((stepSize << 3) & 0xf8) | reg;
}
if (reg === 6 && (!this.mmuMode) && (accessMode & PDP11.WRITE_MODE) && stepSize <= 0 &&
(this.registerVal[6] <= this.stackLimit || this.registerVal[6] >= 0xfffe)) {
if (this.registerVal[6] <= this.stackLimit - 32) {
(this.regsCur[6] <= this.stackLimit || this.regsCur[6] >= 0xfffe)) {
if (this.regsCur[6] <= this.stackLimit - 32) {
this.CPU_Error |= 4; // Red stack
this.registerVal[6] = 4;
this.regsCur[6] = 4;
return this.trap(4, 38);
}
this.CPU_Error |= 8; // Yellow
@ -1174,7 +1174,7 @@ CPUStatePDP11.prototype.readWordByMode = function(addressMode)
{
var result;
if (!(addressMode & 0x38)) {
result = this.registerVal[addressMode & 7];
result = this.regsCur[addressMode & 7];
//LOG_SOURCE(result);
} else {
if ((result = this.getAddrByMode(addressMode, PDP11.READ_MODE)) >= 0) {
@ -1197,7 +1197,7 @@ CPUStatePDP11.prototype.readByteByMode = function(addressMode)
{
var result;
if (!(addressMode & 0x38)) {
result = this.registerVal[addressMode & 7] & 0xff;
result = this.regsCur[addressMode & 7] & 0xff;
//LOG_SOURCE(result);
} else {
if ((result = this.getAddrByMode(addressMode, PDP11.READ_MODE | PDP11.BYTE_MODE)) >= 0) {
@ -1340,25 +1340,25 @@ CPUStatePDP11.prototype.stepCPU = function(nMinCycles)
}
}
}
//if (this.registerVal[7] === this.debugPC) {
//if (this.regsCur[7] === this.debugPC) {
//LOG_PRINT();
//
//}
// Initialize this.memory before getting an instruction
if (!(this.MMR0 & 0xe000)) {
this.MMR1 = 0;
this.MMR2 = this.registerVal[7];
this.MMR2 = this.regsCur[7];
}
// If needed T-bit trap at the end of this instruction
this.trapMask = this.PSW & 0x10;
if ((instruction = this.readWordByVirtual(this.registerVal[7])) >= 0) {
this.registerVal[7] = (this.registerVal[7] + 2) & 0xffff;
if ((instruction = this.readWordByVirtual(this.regsCur[7])) >= 0) {
this.regsCur[7] = (this.regsCur[7] + 2) & 0xffff;
switch (instruction & 0xF000) /*0170000*/ { // Double operand instructions xxSSDD
case 0x1000: /*0010000*/ // MOV 01SSDD
//LOG_INSTRUCTION(instruction, 2, "MOV");
if ((src = this.readWordByMode(instruction >> 6)) >= 0) {
if (!(instruction & 0x38)) {
this.registerVal[instruction & 7] = src;
this.regsCur[instruction & 7] = src;
this.flagN = this.flagZ = src;
this.flagV = 0;
} else {
@ -1394,7 +1394,7 @@ CPUStatePDP11.prototype.stepCPU = function(nMinCycles)
//LOG_INSTRUCTION(instruction, 2, "BIC");
if ((src = this.readWordByMode(instruction >> 6)) >= 0) {
if (!(instruction & 0x38)) {
result = this.registerVal[instruction & 7] &= ~src;
result = this.regsCur[instruction & 7] &= ~src;
this.flagN = this.flagZ = result;
this.flagV = 0;
} else {
@ -1412,7 +1412,7 @@ CPUStatePDP11.prototype.stepCPU = function(nMinCycles)
//LOG_INSTRUCTION(instruction, 2, "BIS");
if ((src = this.readWordByMode(instruction >> 6)) >= 0) {
if (!(instruction & 0x38)) {
result = this.registerVal[instruction & 7] |= src;
result = this.regsCur[instruction & 7] |= src;
this.flagN = this.flagZ = result;
this.flagV = 0;
} else {
@ -1431,8 +1431,8 @@ CPUStatePDP11.prototype.stepCPU = function(nMinCycles)
if ((src = this.readWordByMode(instruction >> 6)) >= 0) {
if (!(instruction & 0x38)) {
reg = instruction & 7;
dst = this.registerVal[reg];
this.registerVal[reg] = (result = src + dst) & 0xffff;
dst = this.regsCur[reg];
this.regsCur[reg] = (result = src + dst) & 0xffff;
this.flagN = this.flagZ = this.flagC = result;
this.flagV = (src ^ result) & (dst ^ result);
} else {
@ -1451,7 +1451,7 @@ CPUStatePDP11.prototype.stepCPU = function(nMinCycles)
if ((src = this.readByteByMode(instruction >> 6)) >= 0) {
if (!(instruction & 0x38)) {
if (src & 0x80) /*0200*/ src |= 0xff00; // movb sign extends register to word size
this.registerVal[instruction & 7] = src;
this.regsCur[instruction & 7] = src;
this.flagN = this.flagZ = src;
this.flagV = 0;
} else {
@ -1512,8 +1512,8 @@ CPUStatePDP11.prototype.stepCPU = function(nMinCycles)
if ((src = this.readWordByMode(instruction >> 6)) >= 0) {
if (!(instruction & 0x38)) {
reg = instruction & 7;
dst = this.registerVal[reg];
this.registerVal[reg] = (result = dst - src) & 0xffff;
dst = this.regsCur[reg];
this.regsCur[reg] = (result = dst - src) & 0xffff;
this.flagN = this.flagZ = this.flagC = result;
this.flagV = (src ^ dst) & (dst ^ result);
} else {
@ -1533,9 +1533,9 @@ CPUStatePDP11.prototype.stepCPU = function(nMinCycles)
//LOG_INSTRUCTION(instruction, 3, "JSR");
if ((virtualAddress = this.getVirtualByMode(instruction, 0)) >= 0) {
reg = (instruction >> 6) & 7;
if (this.pushWord(this.registerVal[reg]) >= 0) {
this.registerVal[reg] = this.registerVal[7];
this.registerVal[7] = virtualAddress & 0xffff;
if (this.pushWord(this.regsCur[reg]) >= 0) {
this.regsCur[reg] = this.regsCur[7];
this.regsCur[7] = virtualAddress & 0xffff;
}
}
break;
@ -1544,11 +1544,11 @@ CPUStatePDP11.prototype.stepCPU = function(nMinCycles)
if ((src = this.readWordByMode(instruction)) >= 0) {
reg = (instruction >> 6) & 7;
if (src & 0x8000) src |= ~0xffff;
dst = this.registerVal[reg];
dst = this.regsCur[reg];
if (dst & 0x8000) dst |= ~0xffff;
result = ~~(src * dst);
this.registerVal[reg] = (result >> 16) & 0xffff;
this.registerVal[reg | 1] = result & 0xffff;
this.regsCur[reg] = (result >> 16) & 0xffff;
this.regsCur[reg | 1] = result & 0xffff;
this.flagN = result >> 16;
this.flagZ = this.flagN | result;
this.flagC = this.flagV = 0;
@ -1565,21 +1565,21 @@ CPUStatePDP11.prototype.stepCPU = function(nMinCycles)
this.flagC = 0x10000; // divide by zero
} else {
reg = (instruction >> 6) & 7;
dst = (this.registerVal[reg] << 16) | this.registerVal[reg | 1];
dst = (this.regsCur[reg] << 16) | this.regsCur[reg | 1];
this.flagC = this.flagV = 0;
if (src & 0x8000) src |= ~0xffff;
result = ~~(dst / src);
if (result >= -32768 && result <= 32767) {
this.registerVal[reg] = result & 0xffff;
this.registerVal[reg | 1] = (dst - (result * src)) & 0xffff;
this.regsCur[reg] = result & 0xffff;
this.regsCur[reg | 1] = (dst - (result * src)) & 0xffff;
this.flagZ = (result >> 16) | result;
this.flagN = result >> 16;
} else {
this.flagV = 0x8000; // overflow - following are indeterminate
this.flagZ = (result >> 15) | result; // dodgy
this.flagN = dst >> 16; // just as dodgy
if (src === -1 && this.registerVal[reg] ===
0xfffe) this.registerVal[reg] = this.registerVal[reg | 1] = 1; // etc
if (src === -1 && this.regsCur[reg] ===
0xfffe) this.regsCur[reg] = this.regsCur[reg | 1] = 1; // etc
}
}
}
@ -1588,7 +1588,7 @@ CPUStatePDP11.prototype.stepCPU = function(nMinCycles)
//LOG_INSTRUCTION(instruction, 3, "ASH");
if ((src = this.readWordByMode(instruction)) >= 0) {
reg = (instruction >> 6) & 7;
result = this.registerVal[reg];
result = this.regsCur[reg];
if (result & 0x8000) result |= 0xffff0000;
this.flagC = this.flagV = 0;
src &= 0x3F; /*077*/
@ -1610,7 +1610,7 @@ CPUStatePDP11.prototype.stepCPU = function(nMinCycles)
}
}
}
this.registerVal[reg] = result & 0xffff;
this.regsCur[reg] = result & 0xffff;
this.flagN = this.flagZ = result;
}
break;
@ -1618,7 +1618,7 @@ CPUStatePDP11.prototype.stepCPU = function(nMinCycles)
//LOG_INSTRUCTION(instruction, 3, "ASHC");
if ((src = this.readWordByMode(instruction)) >= 0) {
reg = (instruction >> 6) & 7;
dst = (this.registerVal[reg] << 16) | this.registerVal[reg | 1];
dst = (this.regsCur[reg] << 16) | this.regsCur[reg | 1];
this.flagC = this.flagV = 0;
src &= 0x3F; /*077*/
if (src & 0x20) /*040*/ {
@ -1643,8 +1643,8 @@ CPUStatePDP11.prototype.stepCPU = function(nMinCycles)
result = dst;
}
}
this.registerVal[reg] = (result >> 16) & 0xffff;
this.registerVal[reg | 1] = result & 0xffff;
this.regsCur[reg] = (result >> 16) & 0xffff;
this.regsCur[reg | 1] = result & 0xffff;
this.flagN = result >> 16;
this.flagZ = result >> 16 | result;
}
@ -1652,12 +1652,12 @@ CPUStatePDP11.prototype.stepCPU = function(nMinCycles)
case 0x7800: /*0074000*/ // XOR 074RSS
//LOG_INSTRUCTION(instruction, 3, "XOR");
if (!(instruction & 0x38)) {
dst = this.registerVal[instruction & 7] ^= this.registerVal[(instruction >> 6) & 7];
dst = this.regsCur[instruction & 7] ^= this.regsCur[(instruction >> 6) & 7];
this.flagN = this.flagZ = dst;
this.flagV = 0;
} else {
if ((dst = this.readWordByAddr(dstAddr = this.getAddrByMode(instruction, PDP11.MODIFY_WORD))) >= 0) {
dst ^= this.registerVal[(instruction >> 6) & 7];
dst ^= this.regsCur[(instruction >> 6) & 7];
if (this.writeWordByAddr(dstAddr, dst) >= 0) {
this.flagN = this.flagZ = dst;
this.flagV = 0;
@ -1668,78 +1668,78 @@ CPUStatePDP11.prototype.stepCPU = function(nMinCycles)
case 0x7E00: /*0077000*/ // SOB 077Rnn
//LOG_INSTRUCTION(instruction, 5, "SOB");
reg = (instruction >> 6) & 7;
if ((this.registerVal[reg] = ((this.registerVal[reg] - 1) & 0xffff))) {
this.registerVal[7] = (this.registerVal[7] - ((instruction & 0x3F) /*077*/ << 1)) & 0xffff;
if ((this.regsCur[reg] = ((this.regsCur[reg] - 1) & 0xffff))) {
this.regsCur[7] = (this.regsCur[7] - ((instruction & 0x3F) /*077*/ << 1)) & 0xffff;
}
break;
default:
switch (instruction & 0xFF00) /*0177400*/ { // Program control instructions & traps
case 0x100: /*0000400*/ // BR
//LOG_INSTRUCTION(instruction, 4, "BR");
this.registerVal[7] = this.branch(this.registerVal[7], instruction);
this.regsCur[7] = this.branch(this.regsCur[7], instruction);
break;
case 0x200: /*0001000*/ // BNE
//LOG_INSTRUCTION(instruction, 4, "BNE");
if (this.flagZ & 0xffff) this.registerVal[7] = this.branch(this.registerVal[7], instruction);
if (this.flagZ & 0xffff) this.regsCur[7] = this.branch(this.regsCur[7], instruction);
break;
case 0x300: /*0001400*/ // BEQ
//LOG_INSTRUCTION(instruction, 4, "BEQ");
if (!(this.flagZ & 0xffff)) this.registerVal[7] = this.branch(this.registerVal[7], instruction);
if (!(this.flagZ & 0xffff)) this.regsCur[7] = this.branch(this.regsCur[7], instruction);
break;
case 0x400: /*0002000*/ // BGE
//LOG_INSTRUCTION(instruction, 4, "BGE");
if ((this.flagN & 0x8000) ===
(this.flagV & 0x8000)) this.registerVal[7] = this.branch(this.registerVal[7], instruction);
(this.flagV & 0x8000)) this.regsCur[7] = this.branch(this.regsCur[7], instruction);
break;
case 0x500: /*0002400*/ // BLT
//LOG_INSTRUCTION(instruction, 4, "BLT");
if ((this.flagN & 0x8000) !==
(this.flagV & 0x8000)) this.registerVal[7] = this.branch(this.registerVal[7], instruction);
(this.flagV & 0x8000)) this.regsCur[7] = this.branch(this.regsCur[7], instruction);
break;
case 0x600: /*0003000*/ // BGT
//LOG_INSTRUCTION(instruction, 4, "BGT");
if ((this.flagZ & 0xffff) && ((this.flagN & 0x8000) ===
(this.flagV & 0x8000))) this.registerVal[7] = this.branch(this.registerVal[7], instruction);
(this.flagV & 0x8000))) this.regsCur[7] = this.branch(this.regsCur[7], instruction);
break;
case 0x700: /*0003400*/ // BLE
//LOG_INSTRUCTION(instruction, 4, "BLE");
if (!(this.flagZ & 0xffff) || ((this.flagN & 0x8000) !==
(this.flagV & 0x8000))) this.registerVal[7] = this.branch(this.registerVal[7], instruction);
(this.flagV & 0x8000))) this.regsCur[7] = this.branch(this.regsCur[7], instruction);
break;
case 0x8000: /*0100000*/ // BPL
//LOG_INSTRUCTION(instruction, 4, "BPL");
if (!(this.flagN & 0x8000)) this.registerVal[7] = this.branch(this.registerVal[7], instruction);
if (!(this.flagN & 0x8000)) this.regsCur[7] = this.branch(this.regsCur[7], instruction);
break;
case 0x8200: /*0101000*/ // BHI
//LOG_INSTRUCTION(instruction, 4, "BHI");
if (!(this.flagC & 0x10000) &&
(this.flagZ & 0xffff)) this.registerVal[7] = this.branch(this.registerVal[7], instruction);
(this.flagZ & 0xffff)) this.regsCur[7] = this.branch(this.regsCur[7], instruction);
break;
case 0x8100: /*0100400*/ // BMI
//LOG_INSTRUCTION(instruction, 4, "BMI");
if ((this.flagN & 0x8000)) this.registerVal[7] = this.branch(this.registerVal[7], instruction);
if ((this.flagN & 0x8000)) this.regsCur[7] = this.branch(this.regsCur[7], instruction);
break;
case 0x8300: /*0101400*/ // BLOS
//LOG_INSTRUCTION(instruction, 4, "BLOS");
if ((this.flagC & 0x10000) ||
!(this.flagZ & 0xffff)) this.registerVal[7] = this.branch(this.registerVal[7], instruction);
!(this.flagZ & 0xffff)) this.regsCur[7] = this.branch(this.regsCur[7], instruction);
break;
case 0x8400: /*0102000*/ // BVC
//LOG_INSTRUCTION(instruction, 4, "BVC");
if (!(this.flagV & 0x8000)) this.registerVal[7] = this.branch(this.registerVal[7], instruction);
if (!(this.flagV & 0x8000)) this.regsCur[7] = this.branch(this.regsCur[7], instruction);
break;
case 0x8500: /*0102400*/ // BVS
//LOG_INSTRUCTION(instruction, 4, "BVS");
if ((this.flagV & 0x8000)) this.registerVal[7] = this.branch(this.registerVal[7], instruction);
if ((this.flagV & 0x8000)) this.regsCur[7] = this.branch(this.regsCur[7], instruction);
break;
case 0x8600: /*0103000*/ // BCC
//LOG_INSTRUCTION(instruction, 4, "BCC");
if (!(this.flagC &
0x10000)) this.registerVal[7] = this.branch(this.registerVal[7], instruction);
0x10000)) this.regsCur[7] = this.branch(this.regsCur[7], instruction);
break;
case 0x8700: /*0103400*/ // BCS
//LOG_INSTRUCTION(instruction, 4, "BCS");
if (this.flagC & 0x10000) this.registerVal[7] = this.branch(this.registerVal[7], instruction);
if (this.flagC & 0x10000) this.regsCur[7] = this.branch(this.regsCur[7], instruction);
break;
case 0x8800: /*0104000*/ // EMT 104000 -> 104377
//LOG_INSTRUCTION(instruction, 7, "EMT");
@ -1754,15 +1754,15 @@ CPUStatePDP11.prototype.stepCPU = function(nMinCycles)
case 0x40: /*0000100*/ // JMP 0001DD
//LOG_INSTRUCTION(instruction, 1, "JMP");
if ((virtualAddress = this.getVirtualByMode(instruction, 0)) >= 0) {
this.registerVal[7] = virtualAddress & 0xffff;
this.regsCur[7] = virtualAddress & 0xffff;
}
break;
case 0xC0: /*0000300*/ // SWAB 0003DD
//LOG_INSTRUCTION(instruction, 1, "SWAB");
if (!(instruction & 0x38)) {
reg = instruction & 7;
dst = this.registerVal[reg];
this.registerVal[reg] = ((dst << 8) | (dst >> 8)) & 0xffff;
dst = this.regsCur[reg];
this.regsCur[reg] = ((dst << 8) | (dst >> 8)) & 0xffff;
this.flagN = this.flagZ = dst & 0xff00;
this.flagV = this.flagC = 0;
} else {
@ -1779,7 +1779,7 @@ CPUStatePDP11.prototype.stepCPU = function(nMinCycles)
case 0xA00: /*0005000*/ // CLR 0050DD
//LOG_INSTRUCTION(instruction, 1, "CLR");
if (!(instruction & 0x38)) {
this.registerVal[instruction & 7] = 0;
this.regsCur[instruction & 7] = 0;
this.flagN = this.flagC = this.flagV = this.flagZ = 0;
} else {
if ((dstAddr = this.getAddrByMode(instruction, PDP11.WRITE_MODE)) >= 0) { // write word
@ -1805,9 +1805,9 @@ CPUStatePDP11.prototype.stepCPU = function(nMinCycles)
//LOG_INSTRUCTION(instruction, 1, "INC");
if (!(instruction & 0x38)) {
reg = instruction & 7;
dst = this.registerVal[reg];
dst = this.regsCur[reg];
result = dst + 1;
this.registerVal[reg] = result & 0xffff;
this.regsCur[reg] = result & 0xffff;
this.flagN = this.flagZ = result;
this.flagV = result & (result ^ dst);
} else {
@ -1825,9 +1825,9 @@ CPUStatePDP11.prototype.stepCPU = function(nMinCycles)
//LOG_INSTRUCTION(instruction, 1, "DEC");
if (!(instruction & 0x38)) {
reg = instruction & 7;
dst = this.registerVal[reg];
dst = this.regsCur[reg];
result = dst - 1;
this.registerVal[reg] = result & 0xffff;
this.regsCur[reg] = result & 0xffff;
this.flagN = this.flagZ = result;
this.flagV = (result ^ dst) & dst;
} else {
@ -1885,9 +1885,9 @@ CPUStatePDP11.prototype.stepCPU = function(nMinCycles)
//LOG_INSTRUCTION(instruction, 1, "ROR");
if (!(instruction & 0x38)) {
reg = instruction & 7;
dst = this.registerVal[reg];
dst = this.regsCur[reg];
result = ((this.flagC & 0x10000) | dst) >> 1;
this.registerVal[reg] = result & 0xffff;
this.regsCur[reg] = result & 0xffff;
this.flagC = (dst << 16);
this.flagN = this.flagZ = result;
this.flagV = result ^ (this.flagC >> 1);
@ -1907,9 +1907,9 @@ CPUStatePDP11.prototype.stepCPU = function(nMinCycles)
//LOG_INSTRUCTION(instruction, 1, "ROL");
if (!(instruction & 0x38)) {
reg = instruction & 7;
dst = this.registerVal[reg];
dst = this.regsCur[reg];
result = (dst << 1) | ((this.flagC >> 16) & 1);
this.registerVal[reg] = result & 0xffff;
this.regsCur[reg] = result & 0xffff;
this.flagC = this.flagN = this.flagZ = result;
this.flagV = result ^ dst;
} else {
@ -1927,9 +1927,9 @@ CPUStatePDP11.prototype.stepCPU = function(nMinCycles)
//LOG_INSTRUCTION(instruction, 1, "ASR");
if (!(instruction & 0x38)) {
reg = instruction & 7;
dst = this.registerVal[reg];
dst = this.regsCur[reg];
result = (dst & 0x8000) | (dst >> 1);
this.registerVal[reg] = result & 0xffff;
this.regsCur[reg] = result & 0xffff;
this.flagC = dst << 16;
this.flagN = this.flagZ = result;
this.flagV = this.flagN ^ (this.flagC >> 1);
@ -1949,9 +1949,9 @@ CPUStatePDP11.prototype.stepCPU = function(nMinCycles)
//LOG_INSTRUCTION(instruction, 1, "ASL");
if (!(instruction & 0x38)) {
reg = instruction & 7;
dst = this.registerVal[reg];
dst = this.regsCur[reg];
result = dst << 1;
this.registerVal[reg] = result & 0xffff;
this.regsCur[reg] = result & 0xffff;
this.flagC = this.flagN = this.flagZ = result;
this.flagV = result ^ dst;
} else {
@ -1967,11 +1967,11 @@ CPUStatePDP11.prototype.stepCPU = function(nMinCycles)
break;
case 0xD00: /*0006400*/ // MARK 0064nn
//LOG_INSTRUCTION(instruction, 8, "MARK");
virtualAddress = (this.registerVal[7] + ((instruction & 0x3F) /*077*/ << 1)) & 0xffff;
virtualAddress = (this.regsCur[7] + ((instruction & 0x3F) /*077*/ << 1)) & 0xffff;
if ((src = this.readWordByVirtual(virtualAddress | 0x10000)) >= 0) {
this.registerVal[7] = this.registerVal[5];
this.registerVal[5] = src;
this.registerVal[6] = (virtualAddress + 2) & 0xffff;
this.regsCur[7] = this.regsCur[5];
this.regsCur[5] = src;
this.regsCur[6] = (virtualAddress + 2) & 0xffff;
}
break;
case 0xD40: /*0006500*/ // MFPI 0065SS
@ -1979,9 +1979,9 @@ CPUStatePDP11.prototype.stepCPU = function(nMinCycles)
if (!(instruction & 0x38)) {
reg = instruction & 7;
if (6 !== reg || ((this.PSW >> 2) & 0x3000) === (this.PSW & 0x3000)) {
src = this.registerVal[reg];
src = this.regsCur[reg];
} else {
src = this.stackPointer[(this.PSW >> 12) & 3];
src = this.regsStack[(this.PSW >> 12) & 3];
}
if (this.pushWord(src) >= 0) {
this.flagN = this.flagZ = src;
@ -2008,9 +2008,9 @@ CPUStatePDP11.prototype.stepCPU = function(nMinCycles)
if (!(instruction & 0x38)) {
reg = instruction & 7;
if (6 !== reg || ((this.PSW >> 2) & 0x3000) === (this.PSW & 0x3000)) {
this.registerVal[reg] = dst;
this.regsCur[reg] = dst;
} else {
this.stackPointer[(this.PSW >> 12) & 3] = dst;
this.regsStack[(this.PSW >> 12) & 3] = dst;
}
this.flagN = this.flagZ = dst;
this.flagV = 0;
@ -2042,7 +2042,7 @@ CPUStatePDP11.prototype.stepCPU = function(nMinCycles)
case 0x8A00: /*0105000*/ // CLRB 1050DD
//LOG_INSTRUCTION(instruction, 1, "CLRB");
if (!(instruction & 0x38)) {
this.registerVal[instruction & 7] &= 0xff00;
this.regsCur[instruction & 7] &= 0xff00;
this.flagN = this.flagC = this.flagV = this.flagZ = 0;
} else {
if ((dstAddr = this.getAddrByMode(instruction, PDP11.WRITE_MODE | PDP11.BYTE_MODE)) >= 0) { // write byte
@ -2183,9 +2183,9 @@ CPUStatePDP11.prototype.stepCPU = function(nMinCycles)
if (!(instruction & 0x38)) {
reg = instruction & 7;
if (6 !== reg || ((this.PSW >> 2) & 0x3000) === (this.PSW & 0x3000)) {
src = this.registerVal[reg];
src = this.regsCur[reg];
} else {
src = this.stackPointer[(this.PSW >> 12) & 3];
src = this.regsStack[(this.PSW >> 12) & 3];
}
if (this.pushWord(src) >= 0) {
this.flagN = this.flagZ = src;
@ -2211,9 +2211,9 @@ CPUStatePDP11.prototype.stepCPU = function(nMinCycles)
if (!(instruction & 0x38)) {
reg = instruction & 7;
if (6 !== reg || ((this.PSW >> 2) & 0x3000) === (this.PSW & 0x3000)) {
this.registerVal[reg] = dst;
this.regsCur[reg] = dst;
} else {
this.stackPointer[(this.PSW >> 12) & 3] = dst;
this.regsStack[(this.PSW >> 12) & 3] = dst;
}
this.flagN = this.flagZ = dst;
this.flagV = 0;
@ -2244,7 +2244,7 @@ CPUStatePDP11.prototype.stepCPU = function(nMinCycles)
// }
// } else {
// if (src & 0200) src |= 0xff00;
// this.registerVal[instruction & 7] = src;
// this.regsCur[instruction & 7] = src;
// this.flagN = this.flagZ = src << 8;
// this.flagV = 0;
// } // Temporary PDP 11/34A
@ -2255,8 +2255,8 @@ CPUStatePDP11.prototype.stepCPU = function(nMinCycles)
//LOG_INSTRUCTION(instruction, 6, "RTS");
if ((src = this.popWord()) >= 0) {
reg = instruction & 7;
this.registerVal[7] = this.registerVal[reg];
this.registerVal[reg] = src;
this.regsCur[7] = this.regsCur[reg];
this.regsCur[reg] = src;
}
break;
case 0x98: /*0000230*/ // SPL 00023N
@ -2293,7 +2293,7 @@ CPUStatePDP11.prototype.stepCPU = function(nMinCycles)
this.runState = 3; // halt
this.endBurst();
//LOG_PRINT();
console.log("HALT at " + this.registerVal[7].toString(8));
console.log("HALT at " + this.regsCur[7].toString(8));
}
break;
case 0x1: /*0000001*/ // WAIT 000001
@ -2323,23 +2323,23 @@ CPUStatePDP11.prototype.stepCPU = function(nMinCycles)
if (!(this.PSW & 0xc000)) {
this.resetRegs();
this.bus.reset_iopage();
// display.data = this.registerVal[0]; // TODO: Review
// display.data = this.regsCur[0]; // TODO: Review
}
break;
case 0x2: /*0000002*/ // RTI 000002
case 0x6: /*0000006*/ // RTT 000006
//LOG_INSTRUCTION(instruction, 0, "RTT");
dstAddr = this.registerVal[6];
dstAddr = this.regsCur[6];
if ((virtualAddress = this.readWordByVirtual(dstAddr | 0x10000)) >= 0) {
dstAddr = (dstAddr + 2) & 0xffff;
if ((savePSW = this.readWordByVirtual(dstAddr | 0x10000)) >= 0) {
this.registerVal[6] = (dstAddr + 2) & 0xffff;
this.regsCur[6] = (dstAddr + 2) & 0xffff;
savePSW &= 0xf8ff;
if (this.PSW & 0xc000) { // user / super restrictions
// keep SPL and allow lower only for modes and register set
savePSW = (savePSW & 0xf81f) | (this.PSW & 0xf8e0);
}
this.registerVal[7] = virtualAddress;
this.regsCur[7] = virtualAddress;
this.writePSW(savePSW);
this.trapMask &= ~0x10; // turn off Trace trap
if (instruction === 2) this.trapMask |= this.PSW & 0x10; // RTI enables immediate trace
@ -2348,7 +2348,7 @@ CPUStatePDP11.prototype.stepCPU = function(nMinCycles)
break;
//case 0000007: // MFPT 000007
// //LOG_INSTRUCTION(instruction, 0, "MFPT");
// this.registerVal[0] = 1;
// this.regsCur[0] = 1;
// break; // Exists on pdp 11/44 & KB11-EM
default: // We don't know this instruction
//LOG_INSTRUCTION(instruction, 11, "-unknown-");

View file

@ -251,12 +251,12 @@ if (DEBUGGER) {
"SXT", "TST", "TSTB", "WAIT"
];
DebuggerPDP11.REG_PC = 0x0C;
DebuggerPDP11.REG_PSW = 0x0E;
DebuggerPDP11.REGS = [
"PC", "PSW"
];
/*
* Register numbers 0-7 are reserved for cpu.regsCur, 8-15 are reserved for cpu.regsAlt, and 16-19 for cpu.regsStack.
*/
DebuggerPDP11.REG_SP = 6; // aka R6
DebuggerPDP11.REG_PC = 7; // aka R7
DebuggerPDP11.REG_PSW = 20;
DebuggerPDP11.MODE_REG = 0x0; // REGISTER (register is operand)
DebuggerPDP11.MODE_REGD = 0x1; // REGISTER DEFERRED (register is address of operand)
@ -1035,75 +1035,6 @@ if (DEBUGGER) {
return false;
};
/**
* getRegIndex(sReg, off)
*
* @this {DebuggerPDP11}
* @param {string} sReg
* @param {number} [off] optional offset into sReg
* @return {number} register index, or -1 if not found
*/
DebuggerPDP11.prototype.getRegIndex = function(sReg, off)
{
var i;
sReg = sReg.toUpperCase();
if (off == null) {
i = usr.indexOf(DebuggerPDP11.REGS, sReg);
} else {
i = usr.indexOf(DebuggerPDP11.REGS, sReg.substr(off, 2));
if (i < 0) i = usr.indexOf(DebuggerPDP11.REGS, sReg.substr(off, 1));
}
return i;
};
/**
* getRegString(iReg)
*
* @this {DebuggerPDP11}
* @param {number} iReg
* @return {string}
*/
DebuggerPDP11.prototype.getRegString = function(iReg)
{
var cch = 0;
var n = this.getRegValue(iReg);
if (n !== undefined) {
switch(iReg) {
case DebuggerPDP11.REG_PC:
case DebuggerPDP11.REG_PSW:
cch = 4;
break;
}
}
return cch? str.toHex(n, cch) : "??";
};
/**
* getRegValue(iReg)
*
* @this {DebuggerPDP11}
* @param {number} iReg
* @return {number|undefined}
*/
DebuggerPDP11.prototype.getRegValue = function(iReg)
{
var n;
if (iReg >= 0) {
var cpu = this.cpu;
switch(iReg) {
case DebuggerPDP11.REG_PC:
n = cpu.getPC();
break;
case DebuggerPDP11.REG_PSW:
n = cpu.getPSW();
break;
default:
break;
}
}
return n;
};
/**
* replaceRegs(s)
*
@ -1113,70 +1044,6 @@ if (DEBUGGER) {
*/
DebuggerPDP11.prototype.replaceRegs = function(s)
{
/*
* Replace any references first; this means that register references inside the reference
* do NOT need to be prefixed with '@'.
*/
s = this.parseReference(s);
/*
* Replace every @XX (or @XXX), where XX (or XXX) is a register, with the register's value.
*/
var i = 0;
var b, sChar, sAddr, dbgAddr, sReplace;
while ((i = s.indexOf('@', i)) >= 0) {
var iReg = this.getRegIndex(s, i + 1);
if (iReg >= 0) {
s = s.substr(0, i) + this.getRegString(iReg) + s.substr(i + 1 + DebuggerPDP11.REGS[iReg].length);
}
i++;
}
/*
* Replace every #XX, where XX is a hex byte value, with the corresponding ASCII character (if printable).
*/
i = 0;
while ((i = s.indexOf('#', i)) >= 0) {
sChar = s.substr(i+1, 2);
b = str.parseInt(sChar, 16);
if (b != null && b >= 32 && b < 128) {
sReplace = sChar + " '" + String.fromCharCode(b) + "'";
s = s.replace('#' + sChar, sReplace);
i += sReplace.length;
continue;
}
i++;
}
/*
* Replace every $XXXX:XXXX, where XXXX:XXXX is a segmented address, with the zero-terminated string at that address.
*/
i = 0;
while ((i = s.indexOf('$', i)) >= 0) {
sAddr = s.substr(i+1, 9);
dbgAddr = this.parseAddr(sAddr);
if (dbgAddr) {
sReplace = sAddr + ' "' + this.getSZ(dbgAddr) + '"';
s = s.replace('$' + sAddr, sReplace);
i += sReplace.length;
continue;
}
i++;
}
/*
* Replace every ^XXXX:XXXX, where XXXX:XXXX is a segmented address, with the FCB filename stored at that address.
*/
i = 0;
while ((i = s.indexOf('^', i)) >= 0) {
sAddr = s.substr(i+1, 9);
dbgAddr = this.parseAddr(sAddr);
if (dbgAddr) {
this.incAddr(dbgAddr);
sReplace = sAddr + ' "' + this.getSZ(dbgAddr, 11) + '"';
s = s.replace('^' + sAddr, sReplace);
i += sReplace.length;
continue;
}
i++;
}
return s;
};
@ -2016,6 +1883,7 @@ if (DEBUGGER) {
opDesc = opMask[bits];
if (opDesc) break;
}
if (!opDesc) opDesc = [DebuggerPDP11.OPS.NONE];
var sOperands = "";
@ -2039,7 +1907,7 @@ if (DEBUGGER) {
}
var sBytes = "";
var sLine = this.toHexAddr(dbgAddrOp) + ' ';
var sLine = this.toHexAddr(dbgAddrOp) + ": ";
if (dbgAddrOp.addr !== PDP11.ADDR_INVALID && dbgAddr.addr !== PDP11.ADDR_INVALID) {
do {
sBytes += str.toHex(this.getByte(dbgAddrOp, 1), 2);
@ -2075,6 +1943,10 @@ if (DEBUGGER) {
DebuggerPDP11.prototype.getOperand = function(opCode, type, dbgAddr)
{
var sOperand = "";
/*
* Take care of TYPE_BRANCH opcodes first; then all we'll have to worry about
* next are TYPE_SRC or TYPE_DST opcodes.
*/
if (type & DebuggerPDP11.TYPE_BRANCH) {
var disp = ((opCode & 0xff) << 24) >> 24;
var addr = (dbgAddr.addr + disp) & 0xffff;
@ -2082,11 +1954,11 @@ if (DEBUGGER) {
}
else {
/*
* Isolate all SRC or DST bits from opcode in the mode variable.
* Isolate all TYPE_SRC or TYPE_DST bits from opcode in the mode variable.
*/
var mode = opCode & type;
/*
* Convert SRC bits into DST bits, since they use the same format.
* Convert TYPE_SRC bits into TYPE_DST bits, since they use the same format.
*/
if (type & DebuggerPDP11.TYPE_SRC) {
mode >>= 6;
@ -2154,20 +2026,6 @@ if (DEBUGGER) {
return sOperand;
};
/**
* getRegOperand(iReg, type, dbgAddr)
*
* @this {DebuggerPDP11}
* @param {number} iReg
* @param {number} type
* @param {DbgAddrPDP11} dbgAddr
* @return {string} operand
*/
DebuggerPDP11.prototype.getRegOperand = function(iReg, type, dbgAddr)
{
return DebuggerPDP11.REGS[iReg];
};
/**
* parseInstruction(sOp, sOperand, addr)
*
@ -2197,13 +2055,13 @@ if (DEBUGGER) {
{
var b;
switch (sFlag) {
case "SF":
case 'N':
b = this.cpu.getSF();
break;
case "ZF":
case 'Z':
b = this.cpu.getZF();
break;
case "CF":
case 'C':
b = this.cpu.getCF();
break;
default:
@ -2222,19 +2080,48 @@ if (DEBUGGER) {
*/
DebuggerPDP11.prototype.getRegOutput = function(iReg)
{
var sReg = DebuggerPDP11.REGS[iReg];
return sReg + '=' + this.getRegString(iReg) + ' ';
var sReg = "";
var cpu = this.cpu;
if (iReg < 8) {
sReg = (iReg < 6? ("R" + iReg) : (iReg == 6? "SP" : "PC"));
sReg += '=' + str.toHex(cpu.regsCur[iReg], 4);
}
else if (iReg < 13) {
sReg = "A" + (iReg - 8) + '=' + str.toHex(cpu.regsAlt[iReg - 8], 4);
}
else if (iReg >= 16 && iReg < 20) {
sReg = "S" + (iReg - 16) + '=' + str.toHex(cpu.regsStack[iReg - 16], 4);
}
else if (iReg == DebuggerPDP11.REG_PSW) {
sReg = "PS=" + str.toHex(cpu.getPSW(), 4);
}
if (sReg) sReg += ' ';
return sReg;
};
/**
* getRegDump()
*
* Sample register dump:
*
* R0=xxxx R1=xxxx R2=xxxx R3=xxxx R4=xxxx R5=xxxx
* SP=xxxx PC=xxxx PS=xxxx T0 N0 Z0 V0 C0
*
* @this {DebuggerPDP11}
* @return {string}
*/
DebuggerPDP11.prototype.getRegDump = function()
{
return "no regs";
var i;
var sDump = "";
for (i = 0; i < DebuggerPDP11.REG_SP; i++) {
sDump += this.getRegOutput(i);
}
sDump += '\n';
sDump += this.getRegOutput(DebuggerPDP11.REG_SP) + this.getRegOutput(DebuggerPDP11.REG_PC);
sDump += this.getFlagOutput('T') + this.getFlagOutput('N') + this.getFlagOutput('Z') + this.getFlagOutput('V') + this.getFlagOutput('C');
return sDump;
};
/**