The programming manual does not explicitly give examples of how the difference of absolute values instructions were to be used. However, it appears to be the easiest and fastest way to perform an absolute value, by using zero as the other operand. You can also perform a negative absolute value, which is consistent with the fact that all of the other arithmetic operations have negative versions.
The NORC has 2000 decimal words of memory, with each word being 16 binary-coded-decimal digits. That makes 64 bits per word. A "bit count" of the number of bits set to one, modulo 4, was also stored in 2 additional bits as a form of parity error checking. The memory is painted as 2000 dots (one dot per address) on the face of 66 cathode ray tubes (one per bit). The CRTs were periodically refreshed. If the 64 bits of a word did not match the bit count, or if a nibble encoded outside the binary-coded-decimal range, then an error indicator was lit and the machine halted.
Memory was shared for instructions and data. The first two of the 16 decimal digits of a word (called the P
field) specified the contents of the word:
P
from 00 to 30 represents a floating point value with an exponent from 100 to 1030. The next decimal digit of the word is the sign (0 for positive, 1 for negative). This made inverting the sign easy, and most arithmetic operations had both normal and inverted sign versions. The remaining 13 decimal digits of the word are the mantissa.
P
from 70 to 99 represents a floating point value with an exponent from 10-30 to 10-1. The next decimal digit of the word is the sign (0 for positive, 1 for negative). The remaining 13 decimal digits of the word are the mantissa.
P
from 40 to 59 represents an instruction word. It appears that the instruction decoder completely ignored the P
field; rather, it was a hint for the human operators examining memory that such a word was instruction rather than data. By convention, only the number 50 was actually used for P
.
The remaining 14 decimal digits of an instruction word were then split into fields:
Two decimal digits called Q
specified the opcode of the instruction.
Four decimal digits called R
specified the memory address of the first operand of the instruction.
Four decimal digits called S
specified the memory address of the second operand of the instruction.
Four decimal digits called T
specified the memory address to store the result.
Values of R
, S
, or T
in the range 0000 to 1999 were treated as direct memory addresses. Values above 3999 selected an index register, which was added to the value, and then modulo 2000 specified the actual memory address.
Q
opcodes below 20 seem to be unused. Opcodes from 20 to 28 performed floating-point arithmetic on the R
and S
operands, with a rounded result stored in T
:
20 Addition R+S
21 Addition with inverse result sign -(R+S)
22 Subtraction R-S
23 Subtraction with inverse result sign -(R-S)
24 Multiplication R*S
25 Multiplication with inverse result sign -(R*S)
26 Division R/S
27 Division with inverse result sign -(R/S)
28 Difference of absolute values |R| - |S|
It's worth noting that only subtraction was directly implemented in hardware, and that the other arithmetic operations were implemented by subtraction:
The arithmetic unit adds, multiplies, and divides with subtraction performed by adding the tens complement of one operand to another.
Q
opcodes from 30 to 38 are identical to the 2X opcodes, except that the floating-point result is not rounded.
Opcode 40 performs an unsigned, 16-decimal-digit integer addition of the operands in R
and S
, storing the result in T
. Opcode 41 similarly performs and integer subtraction. The manual suggests that this was intended for self-modifying code.
Opcodes in the 5X range modify the index registers.
Opcodes in the 6X and 7X range are conditional and unconditional jumps, and halt. It is possible to implement subroutine calls and returns. There are jumps conditioned on an operand's sign, but implementing absolute value using conditional jumps requires several instructions, compared to the one instruction of the difference of absolute values.
The 8X opcodes operate the printer, and the 9X opcodes operate magnetic tape storage.
There are 24 suboperations that are used for instruction execution. As previously mentioned, the only floating-point arithmetic suboperation was subtraction.