Implemented my first 4 PDP-10 opcodes (HLL, HLLI, HLLM, HLLS)
This commit is contained in:
parent
0451774bc6
commit
ed4c031035
6 changed files with 1428 additions and 1371 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -174,6 +174,7 @@ class CPUStatePDP10 extends CPUPDP10 {
|
|||
*/
|
||||
initCPU()
|
||||
{
|
||||
this.regOP = 0;
|
||||
this.regEA = 0;
|
||||
this.regPC = this.lastPC = this.addrReset;
|
||||
|
||||
|
|
@ -276,6 +277,7 @@ class CPUStatePDP10 extends CPUPDP10 {
|
|||
{
|
||||
var state = new State(this);
|
||||
state.set(0, [
|
||||
this.regOP,
|
||||
this.regEA,
|
||||
this.regPC,
|
||||
this.lastPC,
|
||||
|
|
@ -303,6 +305,7 @@ class CPUStatePDP10 extends CPUPDP10 {
|
|||
* of what save() does when it collects a bunch of object properties into an array.
|
||||
*/
|
||||
[
|
||||
this.regOP,
|
||||
this.regEA,
|
||||
this.regPC,
|
||||
this.lastPC,
|
||||
|
|
@ -324,8 +327,7 @@ class CPUStatePDP10 extends CPUPDP10 {
|
|||
* getOpcode()
|
||||
*
|
||||
* This fetches the next opcode, decodes the low 23 bits (I,X,Y), sets regEA, and returns the
|
||||
* the high 18 bits for further decoding. While it's true that, in general, only the high 13 bits
|
||||
* are relevant to the operation, it's cleaner to treat the original opcode as two half-words.
|
||||
* the high 13 bits for further decoding.
|
||||
*
|
||||
* @this {CPUStatePDP10}
|
||||
* @return {number}
|
||||
|
|
@ -333,9 +335,9 @@ class CPUStatePDP10 extends CPUPDP10 {
|
|||
getOpcode()
|
||||
{
|
||||
var pc = this.lastPC = this.regPC;
|
||||
var opCode = this.readWord(pc);
|
||||
var r = this.regOP = this.readWord(pc);
|
||||
this.regPC = (pc + 1) % PDP10.ADDR_LIMIT;
|
||||
var e, x, r = opCode, nMaxIndirect = 4;
|
||||
var e, x, nMaxIndirect = 4;
|
||||
while (true) {
|
||||
/*
|
||||
* Bits 0-22 (I,X,Y) contain what we call a "reference address" (R), which is used to calculate the
|
||||
|
|
@ -360,7 +362,7 @@ class CPUStatePDP10 extends CPUPDP10 {
|
|||
r = this.readWord(e);
|
||||
}
|
||||
this.regEA = e;
|
||||
return (opCode / PDP10.ADDR_LIMIT)|0;
|
||||
return (this.regOP / PDP10.OPCODE.ACSHIFT)|0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -807,8 +809,8 @@ class CPUStatePDP10 extends CPUPDP10 {
|
|||
|
||||
this.opFlags &= PDP10.OPFLAG.PRESERVE;
|
||||
|
||||
var opCode = this.getOpcode();
|
||||
this.opDecode(opCode);
|
||||
var op = this.getOpcode();
|
||||
this.opDecode(op);
|
||||
|
||||
} while (this.nStepCycles > 0);
|
||||
|
||||
|
|
|
|||
|
|
@ -1326,7 +1326,7 @@ class DebuggerPDP10 extends Debugger {
|
|||
*/
|
||||
if (!nState) {
|
||||
opCode = this.cpu.readWord(addr);
|
||||
if ((opCode >> PDP10.OPCODE.FNSHIFT) == PDP10.OPCODE.HALT && this.cpu.getLastPC() == addr) {
|
||||
if ((opCode >> PDP10.OPCODE.A_SHIFT) == PDP10.OPCODE.HALT && this.cpu.getLastPC() == addr) {
|
||||
addr = this.cpu.advancePC(1);
|
||||
}
|
||||
}
|
||||
|
|
@ -1420,7 +1420,7 @@ class DebuggerPDP10 extends Debugger {
|
|||
if (opMask == PDP10.OPCODE.OPIO) {
|
||||
sOperation += this.toStrBase((opCode / PDP10.OPCODE.IOSHIFT) & PDP10.OPCODE.IOMASK, -1);
|
||||
} else {
|
||||
sOperation += this.toStrBase((opCode >> PDP10.OPCODE.FNSHIFT) & PDP10.OPCODE.FNMASK, -1);
|
||||
sOperation += this.toStrBase((opCode >> PDP10.OPCODE.A_SHIFT) & PDP10.OPCODE.A_MASK, -1);
|
||||
}
|
||||
sOperation += ',';
|
||||
if (opCode & PDP10.OPCODE.I_BIT) sOperation += '@';
|
||||
|
|
|
|||
|
|
@ -100,6 +100,7 @@ var PDP10 = {
|
|||
ADDR_MASK: Math.pow(2, 18) - 1,
|
||||
DATA_INVALID: -1,
|
||||
DATA_LIMIT: Math.pow(2, 36),
|
||||
RHWORD_MASK: 0o777777,
|
||||
|
||||
/*
|
||||
* PDP-10 opcodes are 36-bit values, most of which use the following layout:
|
||||
|
|
@ -142,10 +143,11 @@ var PDP10 = {
|
|||
OPIO: 0o70034, // input-output operation
|
||||
OPUUO: 0o70000, // unimplemented user operation (UUO) mask
|
||||
OPSHIFT: Math.pow(2, 21), // operation shift
|
||||
FNSHIFT: 23, // accumulator/function shift
|
||||
FNMASK: 0o17, // accumulator/function mask (after shift)
|
||||
IOSHIFT: Math.pow(2, 26), // input-output device code shift
|
||||
IOMASK: 0o177, // input-output device code mask (after shift)
|
||||
ACSHIFT: Math.pow(2, 23), // used to isolate the high 13 bits, with A starting at bit 0
|
||||
A_SHIFT: 23, // A shift
|
||||
A_MASK: 0o17, // A mask (after shift)
|
||||
I_BIT: 0o20000000, // indirect bit
|
||||
X_SHIFT: 18, // X shift
|
||||
X_MASK: 0o17, // X mask (after shift)
|
||||
|
|
|
|||
Loading…
Reference in a new issue