DL205 User Manual, 4th Edition, Rev. B
5–103
Chapter 5: Standard RLL Instructions - Math
1
2
3
4
5
6
7
8
9
10
11
12
13
14
A
B
C
D
Subtract Binary (SUBB)
The Subtract Binary instruction subtracts a 16-bit number (Aaaa)
from the value stored in the accumulator. The number in the
accumulator can be up to 32 bits long. The source of the 16-bit operand can be a constant or
a data value located in V-memory. Subtract Binary performs the subtraction operation on the
full binary representation of the operands, which distinguishes it from the Subtract
instruction (see page 5-91), which treats the operands as BCD numbers. Although the
subtraction operation is performed on the underlying binary values, the native display format
is hexadecimal. For that reason you will need to load constants in hex.
The difference (result) of the Subtract Binary operation occupies the full 32 bits of the
accumulator and requires an Out Double to move the value to V-memory. If the value in the
accumulator occupies fewer than 32 bits, leading zeros are loaded in the left-most empty bit
positions of the accumulator.
NOTE:
Status flags are valid only until another instruction uses the same flag.
In the following example, when X1 is on, the value in V1400 will be loaded into the
accumulator using the Load instruction. The binary value in V1420 is subtracted from the
binary value in the accumulator using the Subtract Binary instruction. The value in the
accumulator is copied to V1500 - V1501 using the Out Double instruction.
ý
ý
þ
þ
230
240
2
5
0
-1
2
6
0
SUBB
A aaa
Discrete Bit Flags
Description
SP63
On when the result of the instruction causes the value in the accumulator to be zero.
SP64
On when the 16-bit subtraction instruction results in a borrow.
SP65
On when the 32-bit subtraction instruction results in a borrow.
SP70
On anytime the value in the accumulator is negative.
Handheld Programmer Keystrokes
LD
V1400
X1
SUBB
V1420
The binary value in V1420 is
subtracted from the value in
the accumulator
OUT
V1500
Copy the value in the lower 16
bits of the accumulator to V1500
V1500
(V1420) A0B (Hex) = 2571 (decimal)
0
1
(Accumulator) 1024 (Hex) = 4132 (decimal)
0
1
0
0
V1400
0 2 4
6 1 9
0 0 0
0 2 4
A 0 B
Acc.
6 1 9
The unused accumulator
bits are set to zero
STR
1
D
1
4
0
0
OUT
1
5
0
0
1
4
0
S
2
SHFT
B
SHFT
ENT
SHFT
L
ENT
U
B
ENT
ENT
SHFT
Use either OR Constant
V-memory
LD
BIN
K1024
Load the value in V1400
into the lower 16 bits of
the accumulator
-
Direct
SOFT
(Accumulator) 619 (Hex) = 1561 (decimal)
Operand Data Type
DL250-1 Range
DL260 Range
A
aaa
aaa
V-memory V
All (See page 3 - 55)
All (See page 3 - 56)
Pointer P
All V mem (See page 3 - 55)
All V mem (See page 3 - 56)
Constant K
0-FFFF
0-FFFF
DS
Used
HPP Used