Added a few PDP-10 byte pointer fixes, along with the ability to pass MACRO-10 text directly into the MACRO-10 assembler (use the Debugger's "as" command)

This commit is contained in:
Jeff 2017-04-04 10:42:41 -07:00 committed by Jeff Parsons
commit d28d1ee940
10 changed files with 481 additions and 375 deletions

View file

@ -257,7 +257,16 @@ PDP10.opFSC = function(op, ac)
*
* From the DEC PDP-10 System Reference Manual (May 1968), p. 2-16:
*
* Increment the byte pointer in location E as explained [below].
* Increment the byte pointer in location E as explained [below]. The pointer has the format:
*
* 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
* P P P P P P S S S S S S - I X X X X Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y
*
* where S is the size of the byte as a number of bits, and P is its position as the number of bits
* remaining at the right of the byte in the word (eg if P is 3 the rightmost bit of the byte is bit 32
* of the word). The rest of the pointer is interpreted in the same way as in an instruction: I, X and Y
* are used to calculate the address of the location that is the source or destination of the byte.
*
* To facilitate processing a series of bytes, several of the byte instructions increment the
* pointer, ie, modify it so that it points to the next byte position in a set of memory locations.
@ -277,9 +286,6 @@ PDP10.opFSC = function(op, ac)
* a byte of size 36 - P is loaded from position P, or the right 36 - P bits of the byte are deposited
* in position P.
*
* NOTE: Until I can conduct real-world testing, I'm assuming when they say "100 - S", DEC really meant "64 - S",
* which is 100 [base 8], which makes much more sense, since P is limited to a range of 00-77 [base 8].
*
* @this {CPUStatePDP10}
* @param {number} op
* @param {number} ac
@ -294,7 +300,7 @@ PDP10.opIBP = function(op, ac)
if (p < 0) {
inc++;
p = 36 - s;
if (p < 0) p = 64 - s; // see SPECIAL CONSIDERATIONS and NOTE above
if (p < 0) p = 100 - s; // see SPECIAL CONSIDERATIONS and NOTE above
}
/*
* Since the documentation above makes clear that the effect of the increment (of w) extends past the Y
@ -378,7 +384,7 @@ PDP10.opLDB = function(op, ac)
}
var p = (this.regBP / PDP10.OPCODE.P_SCALE) & PDP10.OPCODE.P_MASK;
var s = (this.regBP >> PDP10.OPCODE.S_SHIFT) & PDP10.OPCODE.S_MASK;
if (p + s <= 32) {
if (p + s < 32) {
/*
* WARNING: When using JavaScript's 32-bit operators with values that could set bit 31 and produce a
* negative value, it's critical to perform a final right-shift of 0, ensuring that the final result is
@ -389,7 +395,7 @@ PDP10.opLDB = function(op, ac)
/*
* Regarding the SPECIAL CONSIDERATIONS above, even if the P ("shift") and/or S ("mask") values are
* over-large, that should be fine, because nothing but additional zero bits will be included (provided
* our memory is working properly and didn't give us more than 36 bits).
* our memory is working properly and didn't give us more than 36 bits of unsigned data).
*/
w = Math.trunc(w / Math.pow(2, p)) % Math.pow(2, s);
}