Subtract From Accumulator
SUB
7-175
Assembly Language Instructions
Execution
Increment PC, then ...
Event
Addressing mode
(ACC) – ((data-memory address)
2
shift
)
→
ACC
Direct or indirect
(ACC) – ( (data-memory address)
2
16
)
→
ACC
Direct or indirect
(shift of 16)
(ACC) – k
→
ACC
Short immediate
(ACC) – lk
2
shift
→
ACC
Long immediate
Status Bits
Affected by
Affects
Addressing mode
OVM and SXM
OV and C
Direct or indirect
OVM
OV and C
Short immediate
OVM and SXM
OV and C
Long immediate
Description
In direct, indirect, and long immediate addressing, the content of the ad-
dressed data-memory location or a 16-bit constant are left shifted and sub-
tracted from the accumulator. During shifting, low-order bits are zero filled.
High-order bits are sign extended if SXM = 1 and zero filled if SXM = 0. The
result is then stored in the accumulator.
If short immediate addressing is used, an 8-bit positive constant is subtracted
from the accumulator. In this case, no shift value may be specified, the subtrac-
tion is unaffected by SXM, and the instruction is not repeatable.
Normally, the carry bit is cleared (C = 0) if the result of the subtraction gener-
ates a borrow and is set (C = 1) if it does not generate a borrow. However, if
a 16-bit shift is specified with the subtraction, the instruction will clear the carry
bit if a borrow is generated but will not affect the carry bit otherwise.
Words
Words
Addressing mode
1
Direct, indirect
or short immediate
2
Long immediate