Jump to content

360 Assembly/360 Instructions/ALR

From Wikibooks, open books for an open world

ALR - Add Logical Register - Opcode 1E

Format

[edit | edit source]
ALR 2,1

The specific syntax is

ALR target register, source register.
RR Instruction (2 bytes)
Byte 1 Byte 2
target register source register
(8 bits)
Opcode
1E
(4 bits)

0..F
(4 bits)

0..F
  • The first argument is a target register which value is affected by the instruction.
  • The second argument is the source value register.

Availability

[edit | edit source]

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

Operation

[edit | edit source]

The ALR instruction reads 32-bit integer value from the register specified by the second argument and adds it to the value of the register specified by the first argument. The least significant 32 bits of the 33-bit result sum is placed to the target register. The Condition Code field in the Program Status Word is changed according to the resulting value (sum), treated as unsigned integer (see below).

As this is a 32-bit instruction, on the zSystem, the high 32 bits of the register are unaffected.

Condition Codes

[edit | edit source]

The least significant bit of CC field of the PSW is set if sum is not zero and cleared otherwise. The most significant bit of CC field of the PSW keeps carry bit (i.e. the most significant bit of the 33-bit sum).

Exceptions and Faults

[edit | edit source]

None.

Notes

[edit | edit source]

The AL and ALR instructions are useful to implement adding of integer values longer than 32 bit. In that case, one should use AL or ALR to count all parts of the sum (possibly except the most significant one), and, if CC is 2 or 3 after the adding (i.e. carry have happened), increment the nearest higher part of the sum.

[edit | edit source]

16 bit

[edit | edit source]
  • To add half-word see AH
  • To subtract haLF-word, see SH

32-bit

[edit | edit source]
  • To add logical word value from memory, see AL.
  • To add signed value from memory, see A
  • To add signed value from register, see AR
  • To subtract logical value, see SL or SLR.
  • To subtract signed value, see SR, S,

Floating Point

[edit | edit source]
  • To add floating-point values, see AE, AER, AD or ADR.

Condition Code

[edit | edit source]
  • To check condition code, see BC or BCR.
Previous Instruction
ALGR
360 Assembly Instructions
{{{name}}}
Next Instruction
AP
Previous Opcode
1D
Next Opcode
1F
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