Mnemonic
S 
Description
The subtract instruction is used to subtract one 16bit operand from the 16bit operand in the accumulator. The accumulator must first be loaded with the 16bit value; then the subtract instruction addresses the other operand during execution of the subtract instruction. The operand in core storage and the operand in the accumulator can have the same or different signs; negative numbers are in two's complement form.
Result of the subtraction is in the accumulator at the end of the operation. The operand addressed in core storage by the subtract instruction is unchanged by the operation. Several examples are:
Example 1
0 000 0000 0000 0011 = Operand in accumulator 0 000 0000 0000 0010 = Operand addressed by subtract instruction 0 000 0000 0000 0001 = Result placed in accumulator
(In decimal: 32=1)
Example 2
1 000 0000 0000 0011 = Operand in accumulator 0 000 0000 0000 0010 = Operand addressed by subtract instruction 1 000 0000 0000 0001 = Result placed in accumulator
(In decimal: 32,765  2 = 32,767)
Example 3
1 000 0000 0000 0011 = Operand in accumulator 1 000 0000 0000 0000 = Operand addressed by subtract instruction 0 000 0000 0000 0011 = Result placed in accumulator
(In decimal: 32,765  ()32,768 = 32,765 + 32,768 = +3)
The sign of the result is dependent upon the signs and magnitudes of both operands. Possible combinations (where operand B is always numerically greater than operand A, regardless of signs) are:
Operand in Accumulator  Operand in Core Storage  Sign of Result in Accumulator  

+B    (+)A  =  + 
+B    ()A  =  + 
B    (+)A  =   
B    ()A  =   
+A    (+)B  =   
+A    ()B  =  + 
A    (+)B  =   
A    ()B  =  + 
There are no addressing exceptions for the subtract instruction; all forms of addressing that are described under "EffectiveAddress Generation" apply to the S instruction.
Indicators: The carry indicator is automatically reset to 0 at the beginning of execution of a subtract instruction. If, during execution of the subtract instruction, a borrow occurs beyond the leftmost position of the accumulator, the carry indicator is set to 1 (on). It can subsequently be set or reset by the various actions listed under "Carry and Overflow Indicators" (see Figure 13).
The overflow indicator must be reset to 0 if it is to be used during execution of a subtract instruction. If the overflow indicator is at a value of 1 at the start of a subtract operation, it is not changed regardless of the result of the subtract operation.
If the overflow indicator is at a value of 0 at the start of an add operation, it is set to a value of 1 if the subtraction produces a result that exceeds the capacity of the accumulator. For example, assume that the following subtraction operation is performed:
S 1 000 0000 0000 0000 Operand in accumulator  a negative number 0 000 0000 0000 0001 Operand in main storage  a positive number 0 111 1111 1111 1111 Result in accumulator  a positive number (S = sign bit)
In the first place, subtracting any positive number from any negative number should produce a negative result. But the sign bit is at a value of 0 in the result, and an overflow has occurred. The correct answer is obtained by appending (via programming) a 1 to the left of the sign bit. The overflow indicator is turned on (set to 1) for this operation. Refer to "Carry and Overflow Indicators" for a discussion of how these two indicators can be used together in certain arithmetic operations.
Maximum capacity of the accumulator is:
Powerof2 Notation  Decimal Notation  Hexadecimal Notation 

+2^{15}1  +32,767  +7FFF 
2^{15}  32,768  8000 
Examples
Subtract
Assembler Language Coding  Hexadecimal Value  Description of Instruction  

Label  Operation  F  T  


32  33  35..40..  
S  DISP  90XX  Subtract contents of CSL at EA (I+DISP) from A  
S  1  DISP  91XX  Subtract contents of CSL at EA (XR1+DISP) from A  
S  2  DISP  92XX  Subtract contents of CSL at EA (XR2+DISP) from A  
S  3  DISP  93XX  Subtract contents of CSL at EA (XR3+DISP) from A  
S  L  ADDR  9400XXXX  Subtract contents of CSL at EA (Addr) from A  
S  L  1  ADDR  9500XXXX  Subtract contents of CSL at EA (Addr+XR1) from A  
S  L  2  ADDR  9600XXXX  Subtract contents of CSL at EA (Addr+XR2) from A  
S  L  3  ADDR  9700XXXX  Subtract contents of CSL at EA (Addr+XR3) from A  
S  I  ADDR  9480XXXX  Subtract contents of CSL at EA (V in CSL at Addr) from A  
S  I  1  ADDR  9580XXXX  Subtract contents of CSL at EA (V in CSL at "Addr+XR1") from A  
S  I  2  ADDR  9680XXXX  Subtract contents of CSL at EA (V in CSL at "Addr+XR2") from A  
S  I  3  ADDR  9780XXXX  Subtract contents of CSL at EA (V in CSL at "Addr+XR3") from A 
But wait, there's MORE...