Department of Computer Science

PDP-11 Processor Handbook

Single Operand Instructions


A word operation uses and affects only 16-bit word operands. If any word resides in memory it must be accessed using an even address, otherwise a memory addressing error (bus error) occurs. A byte operation uses and affects only 8-bit bytes. When the byte is in a register only the low byte of the register is used or affected.


CLR 0 000 101 000 ddd ddd
CLRB 1 000 101 000 ddd ddd
Operation:dest = 0
Condition Codes: N: cleared
Z: set
V: cleared
C: cleared
Description:Contents of the destination operand are replaced with zeroes.
Example:
CLR R1 
Before:After:
(R1)=177777(R1)=000000
NZVC=1111NZVC=0100

DEC 0 000 101 011 ddd ddd
DECB 1 000 101 011 ddd ddd
Operation:dest = dest - 1
Condition Codes: N: set if result < 0; cleared otherwise
Z: set if result is 0; cleared otherwise
V: set if dest was 100000; cleared otherwise
C: not affected
Description:Subtract 1 from the contents of the destination operand.
Example:
DEC R5 
Before:After:
(R5)=000001(R5)=000000
NZVC=1000NZVC=0100

INC 0 000 101 010 ddd ddd
INCB 1 000 101 010 ddd ddd
Operation:dest = dest + 1
Condition Codes: N: set if result is < 0; cleared otherwise
Z: set if result is 0; cleared otherwise
V: set if dest was 077777; cleared otherwise
C: not affected
Description:Add one to the contents of the destination operand.
Example:
INC R2 
Before:After:
(R2)=000333(R2)=000334
NZVC=0000NZVC=0000

NEG 0 000 101 100 ddd ddd
NEGB 1 000 101 100 ddd ddd
Operation:dest = - dest
Condition Codes: N: set if the result is < 0; cleared otherwise
Z: set if result is 0; cleared otherwise
V: set if result is 100000; cleared otherwise
C: cleared if the result is 0; set otherwise
Description:Replaces the contents of the destination operand by its two's complement. Note that word 100000 (or byte 200) is replaced by itself (in two's complement notation the most negative number has no positive counterpart).
Example:
NEG R0 
Before:After:
(R0)=000010(R0)=177770
NZVC=0000NZVC=1001

TST 0 000 101 111 ddd ddd
TSTB 1 000 101 111 ddd ddd
Operation:dest = dest
Condition Codes: N: set if result is < 0; cleared otherwise
Z: set if result is 0; cleared otherwise
V: cleared
C: cleared
Description:Sets the condition codes N and Z according to the contents of the destination operand.
Example:
TST R1 
Before:After:
(R1)=012340(R1)=012340
NZVC=0011NZVC=0000

COM 0 000 101 001 ddd ddd
COMB 1 000 101 001 ddd ddd
Operation:dest = ~ dest
Condition Codes: N: set if most significant bit of result is set; cleared otherwise
Z: set if result is 0; cleared otherwise
V: cleared
C: set
Description:Replaces the contents of the destination operand by their logical complement (each bit equal to 0 is set and each bit equal to 1 is cleared).
Example:
COM R0 
Before:After:
(R0)=013333(R0)=164444
NZVC=0110NZVC=1001

ASR 0 000 110 010 ddd ddd

ASRB 1 000 110 010 ddd ddd

Operation:dest = dest shifted one place to the right
Condition Codes: N: set if the high-order bit of the result is set (result < 0); cleared otherwise
Z: set if the result = 0; cleared otherwise
V: loaded from the Exclusive OR of the N-bit and C-bit (as set by the completion of the shift operation)
C: loaded from low-order bit of the destination
Description:Shifts all bits of the destination operand right one place. The MSB is replicated. The C-bit is loaded from the LSB of the destination. ASR(B) performs signed division of the destination by two. Note: in the PDP-11/60, the ASRB does a DATI/DATIP/DATO bus sequence in the execution portion of the instruction. This allows an interlocking of memory addresses. If an I/O page reference is made, the ASRB does a DATIP/DATIP/DATO bus sequence during instruction execution.

ASL 0 000 110 011 ddd ddd
ASLB 1 000 110 011 ddd ddd
Operation:dest = dest shifted one place to the left
Condition Codes: N: set if the high-order bit of the result is set (result < 0); cleared otherwise
Z: set if the result = 0; cleared otherwise
V: loaded from the exclusive OR of the N-bit and C-bit (as set by the completion of the shift operation)
C: loaded with the high-order bit of the destination
Description:Shifts all bits of the destination operand left one place. The LSB is loaded with a 0. The C-bit of the status word is loaded from the MSB of the destination. ASL(B) performs an equivalent signed multiplication of the destination by 2 with overflow indication.

ROL 0 000 110 001 ddd ddd

ROLB 1 000 110 001 ddd ddd

Operation:dest = dest rotated one place to the left
Condition Codes: N: set if the high-order bit of the result word is set (result < 0); cleared otherwise
Z: set if all bits of the result word = 0; cleared otherwise
V: loaded from the Exclusive OR of the N-bit and C-bit (as set by the completion of the rotate operation)
C: loaded with the high-order bit of the destination
Description:Rotate all bits of the destination operand left one place. The MSB is loaded into the C-bit of the status word and the previous contents of the C-bit are loaded into the LSB of the destination.

ROR 0 000 110 000 ddd ddd

RORB 1 000 110 000 ddd ddd

Operation:dest = dest rotated one place to the right
Condition Codes: N: set if the high-order bit of the result word is set (result < 0); cleared otherwise
Z: set if all bits of result = 0; cleared otherwise
V: loaded with the Exclusive OR of the N-bit and C-bit (as set by the completion of the rotate operation)
C: loaded with the low-order bit of the destination
Description:Rotates all bits of the destination operand right one place. The LSB is loaded into the C-bit and the previous contents of the C-bit are loaded into the MSB of the destination.

SWAB 0 000 000 011 ddd ddd
Operation:Byte 1/Byte 0 = Byte 0/Byte 1
Condition Codes: N: set if high-order bit of low-order byte (bit 7) of result is set; cleared otherwise
Z: set if low-order byte of result = 0; cleared otherwise
V: cleared
C: cleared
Description:Exchanges high-order byte and low-order byte of the destination word.
Example:
SWAB R1 
Before:After:
(R1)=077777(R1)=177577
NZVC=1111NZVC=0000

ADC 0 000 101 101 ddd ddd
ADCB 1 000 101 101 ddd ddd
Operation:dest = dest + (C)
Condition Codes: N: set if result < 0; cleared otherwise
Z: set if result = 0; cleared otherwise
V: set if dest was 077777 and (C) was 1; cleared otherwise
C: set if dest was 177777 and (C) was 1; cleared otherise
Description:Adds the contents of the C-bit into the destination operand. This permits the carry from the addition of the low-order words to be carried into the high-order result. Note: byte operands cannot be used with ADD, so ADCB is not often used. The example below has code that may be used to perform a double precision addition.
Example:
ADD A0,B0;add low-order parts
ADC B1;add carry into high-order
ADD A1,B1;add high order parts

SBC 0 000 101 110 ddd ddd
SBCB 1 000 101 110 ddd ddd
Operation:dest = dest - (C)
Condition Codes: N: set if result < 0; cleared otherwise
Z: set if result 0; cleared otherwise
V: set if dest was 100000; cleared otherwise
C: set if dest was 0 and C was 1; cleared otherwise
Description:Subtracts the contents of the C-bit from the destination. This permits the carry from the subtraction of two low-order words to be subtracted from the high order part of the result. Note: byte operands cannot be used with SUB, so SBCB is not often used. The example below illustrates code that may be used to perform a double precision subtraction.
Example:
SUB A0,B0;subtract low-order parts
SBC B1;subtract borrow from high-order
SUB A1,B1;subtract high order parts

SXT 0 000 110 111 ddd ddd
Operation:the N-bit is replicated through dest: dest = 0 if N is clear; dest = -1 if N is set
Condition Codes: N: unaffected
Z: set if N bit clear
V: cleared
C: unaffected
Description:If the condition code bit N is set then a -1 is placed in the destination operand: if N bit is clear, then a 0 is placed in the destination operand. This instruction is particularly useful in multiple precision arithmetic because it permits the sign to be extended through multiple words.
Example:
SXT A 
Before:After:
(A)=012345(A)=177777
NZVC=1000NZVC=1000


Don S. Bidulock
Department of Computer Science
University of Calgary
Calgary, Alberta
Canada T2N 1N4
Phone: 403 220-7689 Fax: 403 284-4707
email: dsb@cpsc.ucalgary.ca

University of Calgary