Subtract (SUB)
Subtract is a 16-bit instruction that subtracts the BCD
230
value (Aaaa) in a V-memory location from the BCD value
240
in the lower 16 bits of the accumulator. The result resides
250-1
in the accumulator.
260
DS
Used
Operand Data Type
HPP Used
V-memory
Pointer
Discrete Bit Flags
SP63
SP66
SP67
SP70
SP75
NOTE: A constant (K) cannot be used for the BCD value.
Status flags are only valid until another instruction that uses the same flags is executed.
In the following example, when X1 is on, the value in V2000 will be loaded into the
accumulator using the Load instruction. The value in V2006 is subtracted from the value in
the accumulator using the Subtract instruction. The value in the accumulator is copied to
V2010 using the Out instruction.
Direct SOFT
Handheld Programmer Keystrokes
DL230 Range DL240 Range DL250-1 Range DL260 Range
A
aaa
All
V
See memory map
P
-
On when the result of the instruction causes the value in the accumulator to be zero
On when the 16 bit addition instruction results in a carry
On when the 32 bit addition instruction results in a carry
On anytime the value in the accumulator is negative
On when a BCD instruction is executed and a NON-BCD number is encountered
X1
LD
V2000
Load the value in V2000 into
the lower 16 bits of the
accumulator
SUB
V2006
Subtract the value in V2006
from the value in the lower
16 bits of the accumulator
OUT
V2010
Copy the value in the lower
16 bits of the accumulator to
V2010
$
B
ENT
STR
1
L
D
C
SHFT
ANDST
3
2
S
U
B
SHFT
RST
ISG
1
GX
V
C
SHFT
OUT
AND
2
Chapter 5: Standard RLL Instructions - Math
aaa
All
See memory map
All V-memory.
See memory map
Description
V2000
2
4
7
The unused accumulator
bits are set to zero
0
0
0
0
2
4
7
_
1
5
9
0
8
8
Acc.
0
8
8
V2010
A
A
A
ENT
0
0
0
V
C
A
A
SHFT
AND
2
0
0
A
B
A
ENT
0
1
0
DL205 User Manual, 4th Edition, Rev. B
SUB
A aaa
aaa
aaa
All
All
See memory map
See memory map
All V-memory.
All V-memory.
See memory map
See memory map
5
5
(Accumulator)
(V2006)
2
3
3
G
ENT
6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
A
B
C
D
5–91
Need help?
Do you have a question about the DirectLOGIC DL205 Series and is the answer not in the manual?