Jump to content

360 Assembly/360 Instructions/AL

From Wikibooks, open books for an open world

AL - Add Logical - Opcode 5E

Format

[edit | edit source]
AL 2,N2
AL 11,106(0,10)

The specific syntax is

AL 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 Bytes 3 and 4
target register Source Address
(8 bits)
Opcode
5E
(4 bits)

0..F
(4 bits)
index
register

0..F
(4 bits)
base
register

0..F
(12 bits)
offset
0..FFF
  • The first argument is a target register which contains the first summand before the operation and the result after the operation.
  • The second argument is the source value (the second summand) location.
  • The mask, base_register and index_register values are 0 to 15. The offset value is 0 to 4095.

Availability

[edit | edit source]

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

Operation

[edit | edit source]

The AL instruction reads 32-bit integer value from the memory address specified by the argument and adds it to the value of 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).

The source argument address shall be aligned to word boundary (i.e. 4 bytes).

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]
  • The source address must be within the range of valid memory or an operation exception occurs.
  • The storage key for the source address must be the same as the current process or a memory protect violate exception occurs.

Notes

[edit | edit source]

The AL and ALR instructions are useful to implement adding of integer values longer than 32 bit in code that is intended to run in 24- or 31-bit address spaces. 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]
  • To add value logically from register, see ALR.
  • To add value arithmetically from memory, see A.
  • To subtract integer value, see S, SR, SH, SL or SLR.
  • To check condition code, see BC or BCR.
Previous Instruction
AHI
360 Assembly Instructions
{{{name}}}
Next Instruction
ALC
Previous Opcode
5D
Next Opcode
5F
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