Perform the documented encoding of SIXBIT character data for MACRO-10

This commit is contained in:
Jeff 2017-03-12 11:56:15 -07:00 committed by Jeff Parsons
commit 9ac0ffe679
11 changed files with 20 additions and 12 deletions

View file

@ -594,7 +594,7 @@ class BusPDP10 extends Component {
* [iBlock0, [dw0, dw1, ...], iBlock1, [dw0, dw1, ...], ...]
*
* In a normal 4Kb block, there will be 1K DWORD values in the data array. Remember that each DWORD is a signed 32-bit
* integer (because they are formed using bit-wise operator rather than floating-point math operators), so don't be
* integer (because they are formed using bitwise operator rather than floating-point math operators), so don't be
* surprised to see negative numbers in the data.
*
* The above example assumes "uncompressed" data arrays. If we choose to use "compressed" data arrays, the data arrays

View file

@ -6132,7 +6132,7 @@ PDP10.doDIV = function(dst, ext, src)
* "early out" if the dividend gets "exhausted" first.
*
* Note that each element of these double arrays is a 36-bit value, so it's rarely a good idea
* to use bit-wise operators on them, because those would operate on only the low 32 bits.
* to use bitwise operators on them, because those would operate on only the low 32 bits.
* Stick with the double worker functions I've created, and trust your JavaScript engine to
* inline/optimize the code.
*/

View file

@ -565,7 +565,7 @@ class Macro10 {
/**
* genASCII()
*
* Based on the last operator, generate the appropriate ASCII data.
* Based on the last operator, generate the appropriate ASCII/ASCIZ/SIXBIT data.
*
* @this {Macro10}
*/
@ -588,6 +588,14 @@ class Macro10 {
* get zero, so it's all good.
*/
var c = this.sASCII.charCodeAt(i) & 0o177;
/*
* If we're doing 6-bit encoding, then perform the conversion of lower-case to upper-case,
* and then adjust/mask.
*/
if (bits == 6) {
if (c >= 0x61 && c <= 0x7A) c -= 0x20;
c = (c + 0o40) & 0o77;
}
w += c * Math.pow(2, shift);
shift -= bits;
n++;