# 360 Assembly/360 Instructions/S

S - Add - Opcode 5B

## Format

    S 2,N2
    S 11,106(0,10)
The specific syntax is
    S target register, offset (index register, base register)
Where the offset, index register and base register values will be determined automatically by the assembler if the USING pseudo-instruction has been used, and the target address label used is within 4096 bytes of the value of some base register.
RX Instruction (4 bytes) :
| Byte 1 | Byte 2 | Byte 2 | Bytes 3 and 4 | Bytes 3 and 4 | Bytes 3 and 4 |
| Byte 1 | target register | Source Address | Source Address | Source Address | Source Address |
| (8 bits) Opcode 5B | (4 bits) 0..F | (4 bits) index register 0..F | (4 bits) base register 0..F | (12 bits) offset 0..FFF | (12 bits) offset 0..FFF |
* The first argument is a target register which value is affected by the instruction.
* The second argument is the source value location.
* The mask, base_register and index_register values are 0 to 15. The offset value is 0 to 4095.

## Availability

The S instruction is available on all models of the 360, 370 and z/System.

## Operation

The S instruction reads a 32-bit integer value from the memory address specified by the argument and subtracts it from the value of the register specified by the first argument. The register specified by the first argument holds the operation result after the instruction is executed. The Condition Code field in the Program Status Word is changed according to the resulting value.
The source argument address shall be aligned to the word boundary (i.e. 4 bytes).

## Condition Codes

If signed integer overflow occurs, i.e. difference is not between -2**31 and 2**31-1, CC is set to 3. Otherwise, CC is set to 0, 1 or 2, if difference is equal to zero, below zero or above zero accordingly.

## Exceptions and Faults

* If signed integer overflow is detected and the bit 36 in PSW is set, an operation exception occurs.
* The target address must be within the range of valid memory or an operation exception occurs.
* The storage key for the target address must be the same as the current process or a memory protect violate exception occurs.

## Related instructions

* To subtract by value from register, see SR.
* To subtract by half-word value from memory, see SH.
* To subtract by value and set condition codes according to unsigned arithmetic, or subtract not the most significant part of a multi-word integer value, see SL or SLR.
* To subtract floating-point values, see SE, SER, SD or SDR.
* To add integer value, see A, AR, AH, AL or ALR.
* To check condition code, see BC or BCR.
| Previous Instruction RSCH | 360 Assembly Instructions {{{name}}} | Next Instruction SAC |
| Previous Opcode 5A | 360 Assembly Instructions {{{name}}} | Next Opcode 5C |
360 Assembly Language :
| 360 Family | Introduction · Basic FAQ · 360 Family · 360 Architecture |
| 360 Instruction Set | 360 Instructions · Branch Instructions · Data Transfer Instructions · Control Flow Instructions · Arithmetic Instructions · Logic Instructions · Shift and Rotate Instructions · Priveleged Instructions · Other Instructions |
| Syntaxes and Assemblers | 360 Assemblers· Pseudo Instructions |
| Instruction Extensions | Floating Point · High-Level Languages |