Chapter
3.
Instruction
Set
SUI
3ยท64
This instruction subtracts the contents of the memory location addressed
by
the
Hand
L registers from the
contents of the accumulator and stores the result
in
the accumulator. M
is
a symbolic reference to the
Hand
L
registers.
~11
___
0
___
0
______
0
______
1
~
Cycles:
States:
Addressing:
Flags:
Example:
2
7
register indirect
Z,S,P,CY,AC
Assume
that
the accumulator contains 3EH. The instruction
SUB
A subtracts the contents
of
the accumulator
from the accumulator and produces a result
of
zero
as
follows:
3EH
+(-3EH)
carry out = 1
00111110
11000001
1
00000000
The condition flags are set
as
follows:
Carry
Sign
Zero
Parity
Aux. Carry
one's complement
add one to produce two's complement
result
= 0
o
o
Notice that the
SUB
in>truction complements the carry generated
by
the two's complement addition to form a
'borrow'
flag. The auxiliary carry flag
is
set because the particular value used
in
this example causes a carry
out
of
bit 3.
SUBTRACT
IMMEDIATE
SUI
subtracts the contents
of
the second instruction byte from the contents
of
the accumulator and stores the
result
in
the accumulator. Notice that the
SUI
instruction di5.regards the carry ('borrow')
flag
during the sub-
traction
but
sets the flag to indicate the outcome
of
the operation.
Opcode
Operand
SUI
data
The operand must specify the data to
be
subtracted. This data may
be
in
the form
of
a number, an ASCII
constant, the label
of
some previously defined value, or an expression. The data must not exceed one byte.
The assembler's relocation
feature treats
all
external and relocatable symbols
as
16-bit addresses. When one of
these symbols appears
in
the operand expression of
an
immediate instruction, it must
be
preceded
by
either the