Jump to content

360 Assembly/360 Instructions/AH

From Wikibooks, open books for an open world

AH - Add Halfword - Opcode 4A

Format

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

The specific syntax is

AH 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
4A
(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 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

[edit | edit source]

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

Operation

[edit | edit source]

The AH instruction reads 16-bit integer value from the memory address specified by the argument, expands it to 32 bits as signed and adds it to the value of register specified by the first argument. The Condition Code field in the Program Status Word is changed according to the resulting value.

Expansion is done as duplication of the most significant bit of the source value to higher 16 bits of expanded value.

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

Condition Codes

[edit | edit source]

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

Exceptions and Faults

[edit | edit source]
  • If signed integer overflow is detected and the bit 36 in PSW is set, operation exception occurs.
  • The target 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.
[edit | edit source]
  • To add value from register, see AR.
  • To add word value from memory, see A.
  • To add value and set condition codes according to unsigned arithmetic, or add not most significant part of multi-word integer value, see AL or ALR.
  • To add floating-point values, see AE, AER, AD or ADR.
  • To subtract half-word value from memory, see SH.
Previous Instruction
AER
360 Assembly Instructions
{{{name}}}
Next Instruction
AR
Previous Opcode
49
Next Opcode
4B
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