Implemented all four primary half-word moves (HLL, HLR, HRL, HRR) but none of the flavors (Z, O, E); need to test the primary instructions first

This commit is contained in:
Jeff Parsons 2017-02-27 09:50:28 -08:00 • committed by Jeff Parsons
commit 0255b7b891
7 changed files with 507 additions and 359 deletions

View file

@ -2,6 +2,6 @@
"load": 0o100,
"exec": 0o100,
"data": [
0o500000000000
0o505040111111, // HRLI 1,111111
]
}

View file

@ -53,7 +53,7 @@ PDP10.opKA10 = function(op)
};
/**
* opUUO(0o0xx000): Unimplemented User Operation
* opUUO(0o0NN000): Unimplemented User Operation
*
* From the DEC PDP-10 System Reference Manual (May 1968), p. 2-64:
*
@ -2668,18 +2668,20 @@ PDP10.opHLL = function(op)
var a = op & PDP10.OPCODE.A_MASK;
var src = this.readWord(this.regEA);
var dst = this.readWord(a);
dst = (dst & PDP10.RHWORD_MASK) + (src - (src & PDP10.RHWORD_MASK));
dst = (dst & PDP10.WORD_MASK) + (src - (src & PDP10.WORD_MASK));
this.writeWord(a, dst);
};
/**
* opHLLI(0o501000)
* opHLLI(0o501000): Half Word Left to Left, Immediate
*
* From the DEC PDP-10 System Reference Manual (May 1968), p. 2-3:
*
* Move the left half of the source word specified by M to the left half of the specified destination.
* The source and the destination right half are unaffected; the original contents of the destination are lost.
*
* SIDEBAR: HLLI merely clears AC left.
*
* For HLLI, the source is 0,E and the destination is [A]. But since this is a left-half-only operation, src is
* effectively 0.
*
@ -2690,12 +2692,12 @@ PDP10.opHLLI = function(op)
{
var a = op & PDP10.OPCODE.A_MASK;
var dst = this.readWord(a);
dst = (dst & PDP10.RHWORD_MASK);
dst = (dst & PDP10.WORD_MASK);
this.writeWord(a, dst);
};
/**
* opHLLM(0o502000)
* opHLLM(0o502000): Half Word Left to Left, Memory
*
* From the DEC PDP-10 System Reference Manual (May 1968), p. 2-3:
*
@ -2712,19 +2714,19 @@ PDP10.opHLLM = function(op)
var a = op & PDP10.OPCODE.A_MASK;
var src = this.readWord(a);
var dst = this.readWord(this.regEA);
dst = (dst & PDP10.RHWORD_MASK) + (src - (src & PDP10.RHWORD_MASK));
dst = (dst & PDP10.WORD_MASK) + (src - (src & PDP10.WORD_MASK));
this.writeWord(this.regEA, dst);
};
/**
* opHLLS(0o503000)
* opHLLS(0o503000): Half Word Left to Left, Self
*
* From the DEC PDP-10 System Reference Manual (May 1968), p. 2-3:
*
* Move the left half of the source word specified by M to the left half of the specified destination.
* The source and the destination right half are unaffected; the original contents of the destination are lost.
*
* If A is zero, HLLS is a no-op, otherwise it is equivalent to HLL.
* SIDEBAR: If A is zero, HLLS is a no-op, otherwise it is equivalent to HLL.
*
* For HLLS, the source is [E] and the destination is [E] (and also [A] if A is non-zero).
*
@ -2733,53 +2735,100 @@ PDP10.opHLLM = function(op)
*/
PDP10.opHLLS = function(op)
{
if (op & PDP10.OPCODE.A_MASK) {
PDP10.opHLL.call(this, op);
}
if (op & PDP10.OPCODE.A_MASK) PDP10.opHLL.call(this, op);
};
/**
* opHRL(0o504000)
* opHRL(0o504000): Half Word Right to Left
*
* From the DEC PDP-10 System Reference Manual (May 1968), p. 2-4:
*
* Move the right half of the source word specified by M to the left half of the specified destination.
* The source and the destination right half are unaffected; the original contents of the destination left
* half are lost.
*
* For HRL, the source is [E] and the destination is [A].
*
* @this {CPUStatePDP10}
* @param {number} op
*/
PDP10.opHRL = function(op)
{
this.opUndefined(op);
var a = op & PDP10.OPCODE.A_MASK;
var src = this.readWord(this.regEA) & PDP10.WORD_MASK;
var dst = this.readWord(a);
dst = (dst & PDP10.WORD_MASK) + src * PDP10.WORD_SHIFT;
this.writeWord(a, dst);
};
/**
* opHRLI(0o505000)
* opHRLI(0o505000): Half Word Right to Left, Immediate
*
* From the DEC PDP-10 System Reference Manual (May 1968), p. 2-4:
*
* Move the right half of the source word specified by M to the left half of the specified destination.
* The source and the destination right half are unaffected; the original contents of the destination left
* half are lost.
*
* For HRLI, the source is 0,E and the destination is [A].
*
* @this {CPUStatePDP10}
* @param {number} op
*/
PDP10.opHRLI = function(op)
{
this.opUndefined(op);
var a = op & PDP10.OPCODE.A_MASK;
var dst = this.readWord(a);
dst = (dst & PDP10.WORD_MASK) + this.regEA * PDP10.WORD_SHIFT;
this.writeWord(a, dst);
};
/**
* opHRLM(0o506000)
* opHRLM(0o506000): Half Word Right to Left, Memory
*
* From the DEC PDP-10 System Reference Manual (May 1968), p. 2-4:
*
* Move the right half of the source word specified by M to the left half of the specified destination.
* The source and the destination right half are unaffected; the original contents of the destination left
* half are lost.
*
* For HRLM, the source is [A] and the destination is [E].
*
* @this {CPUStatePDP10}
* @param {number} op
*/
PDP10.opHRLM = function(op)
{
this.opUndefined(op);
var a = op & PDP10.OPCODE.A_MASK;
var src = this.readWord(a) & PDP10.WORD_MASK;
var dst = this.readWord(this.regEA);
dst = (dst & PDP10.WORD_MASK) + src * PDP10.WORD_SHIFT;
this.writeWord(this.regEA, dst);
};
/**
* opHRLS(0o507000)
* opHRLS(0o507000): Half Word Right to Left, Self
*
* From the DEC PDP-10 System Reference Manual (May 1968), p. 2-4:
*
* Move the right half of the source word specified by M to the left half of the specified destination.
* The source and the destination right half are unaffected; the original contents of the destination left
* half are lost.
*
* For HRLS, the source is [E] and the destination is [E] (and also [A] if A is non-zero).
*
* @this {CPUStatePDP10}
* @param {number} op
*/
PDP10.opHRLS = function(op)
{
this.opUndefined(op);
var dst = this.readWord(this.regEA) & PDP10.WORD_MASK;
this.writeWord(this.regEA, dst + dst * PDP10.WORD_SHIFT);
var a = op & PDP10.OPCODE.A_MASK;
if (a) {
dst = this.readWord(a) & PDP10.WORD_MASK;
this.writeWord(a, dst + dst * PDP10.WORD_SHIFT);
}
};
/**
@ -3047,91 +3096,183 @@ PDP10.opHRLES = function(op)
};
/**
* opHRR(0o540000)
* opHRR(0o540000): Half Word Right to Right
*
* From the DEC PDP-10 System Reference Manual (May 1968), p. 2-6:
*
* Move the right half of the source word specified by M to the right half of the specified destination.
* The source and the destination left half are unaffected; the original contents of the destination right
* half are lost.
*
* For HRR, the source is [E] and the destination is [A].
*
* @this {CPUStatePDP10}
* @param {number} op
*/
PDP10.opHRR = function(op)
{
this.opUndefined(op);
var a = op & PDP10.OPCODE.A_MASK;
var src = this.readWord(this.regEA) & PDP10.WORD_MASK;
var dst = this.readWord(a);
dst = (dst - (dst & PDP10.WORD_MASK)) + src;
this.writeWord(a, dst);
};
/**
* opHRRI(0o541000)
* opHRRI(0o541000): Half Word Right to Right, Immediate
*
* From the DEC PDP-10 System Reference Manual (May 1968), p. 2-6:
*
* Move the right half of the source word specified by M to the right half of the specified destination.
* The source and the destination left half are unaffected; the original contents of the destination right
* half are lost.
*
* For HRRI, the source is 0,E and the destination is [A].
*
* @this {CPUStatePDP10}
* @param {number} op
*/
PDP10.opHRRI = function(op)
{
this.opUndefined(op);
var a = op & PDP10.OPCODE.A_MASK;
var dst = this.readWord(a);
dst = (dst - (dst & PDP10.WORD_MASK)) + this.regEA;
this.writeWord(a, dst);
};
/**
* opHRRM(0o542000)
* opHRRM(0o542000): Half Word Right to Right, Memory
*
* From the DEC PDP-10 System Reference Manual (May 1968), p. 2-6:
*
* Move the right half of the source word specified by M to the right half of the specified destination.
* The source and the destination left half are unaffected; the original contents of the destination right
* half are lost.
*
* For HRRM, the source is [A] and the destination is [E].
*
* @this {CPUStatePDP10}
* @param {number} op
*/
PDP10.opHRRM = function(op)
{
this.opUndefined(op);
var a = op & PDP10.OPCODE.A_MASK;
var src = this.readWord(a) & PDP10.WORD_MASK;
var dst = this.readWord(this.regEA);
dst = (dst - (dst & PDP10.WORD_MASK)) + src;
this.writeWord(this.regEA, dst);
};
/**
* opHRRS(0o543000)
* opHRRS(0o543000): Half Word Right to Right, Self
*
* From the DEC PDP-10 System Reference Manual (May 1968), p. 2-6:
*
* Move the right half of the source word specified by M to the right half of the specified destination.
* The source and the destination left half are unaffected; the original contents of the destination right
* half are lost.
*
* SIDEBAR: If A is zero, HRRS is a no-op; otherwise it is equivalent to HRR.
*
* For HRRS, the source is [E] and the destination is [E] (and also [A] if A is non-zero).
*
* @this {CPUStatePDP10}
* @param {number} op
*/
PDP10.opHRRS = function(op)
{
this.opUndefined(op);
if (op & PDP10.OPCODE.A_MASK) PDP10.opHRR.call(this, op);
};
/**
* opHLR(0o544000)
* opHLR(0o544000): Half Word Left to Right
*
* From the DEC PDP-10 System Reference Manual (May 1968), p. 2-7:
*
* Move the left half of the source word specified by M to the right half of the specified destination.
* The source and the destination left half are unaffected; the original contents of the destination right half are lost.
*
* For HLR, the source is [E] and the destination is [A].
*
* @this {CPUStatePDP10}
* @param {number} op
*/
PDP10.opHLR = function(op)
{
this.opUndefined(op);
var a = op & PDP10.OPCODE.A_MASK;
var src = (this.readWord(this.regEA) / PDP10.WORD_SHIFT)|0;
var dst = this.readWord(a);
dst = (dst - (dst & PDP10.WORD_MASK)) + src;
this.writeWord(a, dst);
};
/**
* opHLRI(0o545000)
* opHLRI(0o545000): Half Word Left to Right, Immediate
*
* From the DEC PDP-10 System Reference Manual (May 1968), p. 2-7:
*
* Move the left half of the source word specified by M to the right half of the specified destination.
* The source and the destination left half are unaffected; the original contents of the destination right half are lost.
*
* SIDEBAR: HLRI merely clears AC right.
*
* For HLRI, the source is 0,E and the destination is [A].
*
* @this {CPUStatePDP10}
* @param {number} op
*/
PDP10.opHLRI = function(op)
{
this.opUndefined(op);
var a = op & PDP10.OPCODE.A_MASK;
var dst = this.readWord(a);
dst = (dst - (dst & PDP10.WORD_MASK));
this.writeWord(a, dst);
};
/**
* opHLRM(0o546000)
* opHLRM(0o546000): Half Word Left to Right, Memory
*
* From the DEC PDP-10 System Reference Manual (May 1968), p. 2-7:
*
* Move the left half of the source word specified by M to the right half of the specified destination.
* The source and the destination left half are unaffected; the original contents of the destination right half are lost.
*
* For HLRM, the source is [A] and the destination is [E].
*
* @this {CPUStatePDP10}
* @param {number} op
*/
PDP10.opHLRM = function(op)
{
this.opUndefined(op);
var a = op & PDP10.OPCODE.A_MASK;
var src = (this.readWord(a) / PDP10.WORD_SHIFT)|0;
var dst = this.readWord(this.regEA);
dst = (dst - (dst & PDP10.WORD_MASK)) + src;
this.writeWord(this.regEA, dst);
};
/**
* opHLRS(0o547000)
* opHLRS(0o547000): Half Word Left to Right, Self
*
* From the DEC PDP-10 System Reference Manual (May 1968), p. 2-7:
*
* Move the left half of the source word specified by M to the right half of the specified destination.
* The source and the destination left half are unaffected; the original contents of the destination right half are lost.
*
* For HLRS, the source is [E] and the destination is [E] (and also [A] if A is non-zero).
*
* @this {CPUStatePDP10}
* @param {number} op
*/
PDP10.opHLRS = function(op)
{
this.opUndefined(op);
var dst = this.readWord(this.regEA);
this.writeWord(this.regEA, (dst & PDP10.WORD_MASK) + ((dst / PDP10.WORD_SHIFT)|0));
var a = op & PDP10.OPCODE.A_MASK;
if (a) {
dst = this.readWord(a);
this.writeWord(a, (dst & PDP10.WORD_MASK) + ((dst / PDP10.WORD_SHIFT)|0));
}
};
/**

View file

@ -100,7 +100,8 @@ var PDP10 = {
ADDR_MASK: Math.pow(2, 18) - 1,
DATA_INVALID: -1,
DATA_LIMIT: Math.pow(2, 36),
RHWORD_MASK: 0o777777,
WORD_SHIFT: Math.pow(2, 18),
WORD_MASK: 0o777777,
/*
* PDP-10 opcodes are 36-bit values, most of which use the following layout:

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long