To illustrate the use of the various addressing modes clearly, the following instructions are used in this chapter:
| Mnemonic | Description | Octal Code
| CLR | Clear (Zero the specified destination word). | 0050DD
| CLRB | Clear Byte (Zero the specified destination byte). | 1050DD
| INC | Increment (Add one to contents of destination word). | 0052DD
| INCB | Increment Byte (Add one to the contents of the destination
byte). | 1052DD
| COM | Complement (Replace the contents of the destination
by its logical one's complement. Each 0 bit is set and each 1 bit is
cleared). | 0051DD
| COMB | Complement Byte (Replace the contents of the
destination byte by its logical one's complement. Each 0 bit is set
and each 1 bit is cleared). | 1051DD
| ADD | Add (Add the source operand to the destination
operand and store the results at the destination address). |
| |
Single- and double-operand instructions use the following formats. The instruction format for the first word of all single-operand instructions (such as clear, increment, test) is:

Bits 5:3 of the destination field specify the binary code of the addressing mode chosen. Bits 2:0 specify the general register to be used.
The instruction format for the first word of the double-operand instruction is:

Bits 11:9 of the source or 5:3 of the destination fields specify the binary code of the addressing mode chosen. Bits 8:6 and 2:0 specify the general register to be used.
The four basic addressing modes are:
When bit 3 of the source/destination field is set, indirect addressing is specified and the four basic modes become deferred modes.
Prefacing the register operand(s) with an "@" sign or placing the register in parentheses indicates to the MACRO-11 assembler that deferred (or indirect) addressing mode is being used.
The indirect addressing modes are:
| REGISTER MODE | MODE 0 Rn |
| Symbolic | Instruction Octal Code | Description
| INC R3 | 005203 | Add one to the contents of R3
| |

| Symbolic | Instruction Octal Code | Description
| ADD R2,R4 | 060204
| Add the contents of R2 to the contents of R4,
replacing the original contents of R4 with the sum.
| |

| REGISTER DEFERRED MODE | MODE 1 @Rn or (Rn) |
This mode is used for sequential lists, indirect pointers in data structures, top-of-stack manipulations, and jump tables.
| Symbolic | Instruction Octal Code | Description
| CLR (R5) | 005015
| The Contents of the location specified in R5
are cleared.
| |

| AUTOINCREMENT MODE | MODE 2 (Rn)+ |
To make it easy to remember that the register is incremented after use, the + sign follows the register name.
| Symbolic | Instruction Octal Code | Description
| CLR (R5)+ | 005025
| Contents of R5 are used as the address of the operand.
Clear selected operand and then increment the contents of R5
by two.
| |

| AUTOINCREMENT DEFERRED MODE | MODE 3 @(Rn)+ |
| Symbolic | Instruction Octal Code | Description
| INC @(R2)+ | 005232
| Contents of R2 are used as the address of the operand.
The operand is increased by one, contents of R2 are incremented
by two.
| |

| AUTODECREMENT MODE | MODE 4 -(Rn) |
To remind you that the register is decremented prior to use, the - sign precedes the register name.
| Symbolic | Instruction Octal Code | Description
| INCB -(R0) | 105240
| The contents of R0 are decremented by one, then used
as the address of the operand. The operand byte is increased
by one.
| |

| AUTODECREMENT DEFERRED MODE | MODE 5 @-(Rn) |
| Symbolic | Instruction Octal Code | Description
| COM @-(R0) | 005150
| The contents of R0 are decremented by two and then
used as the address of the operand. The operand is one's
complemented.
| |

| INDEX MODE | MODE 6 X(Rn) |
| Symbolic | Instruction Octal Code | Description
| CLR 200(R4) | 005064 | 000200 The address of the operand is determined by adding
200 to the contents of R4. The resulting location is then cleared.
| |

| INDEX DEFERRED MODE | MODE 7 @X(Rn) |
| Symbolic | Instruction Octal Code | Description
| ADD @1000(R2),R1 | 067201 | 001000 1000 and the contents of R2 are summed to produce
the address of the address of the source operand, the contents
of which are added to the contents of R1. The result is stored
in R1.
| |

The PC can be used with all of the PDP-11 addressing modes. There are four modes in which the PC can provide advantages for handling position-independent code and for handling unstructured data. These modes refer to the PC and are termed immediate, absolute (or immediate deferred), relative, and relative deferred. The respective 6-bit octal codes are 27, 37, 67 and 77.
Note that the other 4 modes having octal codes 07, 17, 47 and 57 should be avoided by the assembly language programmer. Their respective operand syntaxes (to be avoided) would be PC, (PC) or @PC, -(PC), and @-(PC).
| PC IMMEDIATE MODE | MODE 2 #n |
| Symbolic | Instruction Octal Code | Description
| ADD #10,R0 | 062700 | 000010 The value 10 is located in the second word of the
instruction and is added to the contents of R0. Just before
this instruction is fetched and executed, the PC points to the
first word of the instruction. The processor fetches the first
word and increments the PC by two. The source operand mode is
27 (autoincrement the PC). Thus, the PC is used as a pointer to
fetch the operand (the second word of the instruction) before
being incremented by two to point to the next instruction.
| |

| PC ABSOLUTE MODE | MODE 3 @#a |
| Symbolic | Instruction Octal Code | Description
| CLR @#1100 | 005037 | 001100 Clears the contents of location 1100.
| |

| PC RELATIVE MODE | MODE 6 X(PC) or A |
PC + 2 directs the CPU to the offset that follows the instruction. PC + 4 is summed with this offset to produce the effective address of the operand. PC + 4 also represents the address of the next instruction in the program.
With the relatvie addressing mode, the address of the operand is always determined with respect to the updated PC. Therefore, if the entire program is relocated, the oeprand remains the same relative distance away and may be accessed with changing the instruction.
The distance between the updated PC and the operand is called an offset. After a program is assembled, this offset appears in the first word location that follows the instruction. This mode is useful for writing position-independent code. It is the default mode generated by the MACRO assembler.
| Symbolic | Instruction Octal Code | Description
| INC A | 005267 | 000054 To increment A, the contents of the memory location
in the second word of the instruction are added to the updated PC
to produce the address of A (1100). The contents of A are
increased by one.
| |

| PC RELATIVE DEFERRED MODE | MODE 7 @X(PC) or @A |
This mode is similar to the relative mode, except that it involves one additional level of addressing to obtain the operand. The sum of the offset and updated PC (PC+4) serves as a pointer to an address. When the address is retrieved, it can be used to locate the operand.
| Symbolic | Instruction Octal Code | Description
| CLR @A | 005077 | 000020 Adds the second word of the instruction to the
updated PC to produce A - location 1044 - the address of the
address of the operand. Clears operand.
| |

