Very Common Instructions

These instructions are used frequently and you should become familiar with them, so you are able to use them without having to look them up. You should know a good many other instructions almost as well.

In general, an "address" in thesse descriptions is something that evaluates to an address. This could be, such as:

An important detail to remember about D(B) and D(X,B) addresses is that if we use 0 as the value of B or X, the value in register 0 is treated as if it is 0. That is, a D(B) address such as 16(0) will be evaluated simply as 16, regardless of the value in register 0.

It is useful to remember that with the exception of Store instructions and CVD (Convert to Decimal) and perhaps one or two more, most machine instructions move data from right to left, so the first operand is the one to change value (if anything changes).

It is also useful to remember that some instructions are fussy about boundaries: L, ST, CVD, AH, etc.


Load

L   register,address

Load a fullword value into a register from an address.

Load Address

LA  register,address

Load an address into a register.

Load Multiple

LM  registerfirst,registerlast,address

Load consective fullwords into several consecutive registers.

Store

ST  register,address

Store the contents of a register at a fullword address.

Store Multiple

STM registerfirst,registerlast,address

Store the contents of several consecutive registers in consecutive fullwords starting at the address.

Move Character

MVC address1(length),address2

Copy N = length bytes from the second address to the first address. The length is at most 256.

Move Character Immediate

MVI address,immediate byte

Copy the hard-coded immediate byte to an address. (Do not confuse this with MVC and a length of 1.)

Compare Character

CLC address1(length),address2

Compare N = length bytes at the two addresses, one byte at a time, left to right. The length is at most 256. Notice that we are using the EBCDIC collating sequence, not ASCII.

Compare Character Immediate

CLI address,immediate byte

Compare the byte at the address to the hard-coded immediate byte. (Do not confuse this with CLC and a length of 1.)

Compare

C   register,address

Compare a register value to the 4-byte value at an address and set the condition code to report the result.

Branch on Condition

BC  mask,address

Compare the condition code to the mask, and if they match, branch to the address. This is frequently used with one of the mnemonics instead of a mask: BE, BH, BL, BZ, etc.


Common families of instructions

It can be difficult to remember the various machine instructions and choose the one you need. Many of the instructions fall into families:

Notice that the mnemonics have been carefully designed to make sense of this: 'P' for "packed", 'R' for "register", 'H' for "half", 'C' for "compare", 'A' for "Add", etc.

Obviously, some of these overlap.