DL205 User Manual, 4th Edition, Rev. B
5–106
Chapter 5: Standard RLL Instructions - Math
1
2
3
4
5
6
7
8
9
10
11
12
13
14
A
B
C
D
Divide Binary (DIVB)
The Divide Binary instruction divides a 16-bit number
(Aaaa) into the value stored in the accumulator. The
number in the accumulator can be up to 32 bits long. The
source of the 16-bit divisor can be a constant or a data
value located in V-memory. Divide Binary performs the division operation on the full binary
representation of the operands, which distinguishes it from the Divide instruction (see page
5-97), which treats the operands as BCD numbers. Although the division 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.
At the completion of the division operation, the quotient resides in the accumulator and the
remainder resides in the first stack location.
The quotient occupies the full 32-bit accumulator and requires an Out Double to move the
quotient 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.
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 the accumulator is divided by
the binary value in V1420 using the Divide Binary instruction. The value in the accumulator
is copied to V1500 using the Out Double instruction.
Discrete Bit Flags Description
SP53 On when the value of the operand is larger than the accumulator can work with.
SP63 On when the result of the instruction causes the value in the accumulator to be zero.
SP70 On anytime the value in the accumulator is negative.
V1500
0
(Accumulator )F
0
0
F
(V1420)
0
V1400
A01
320
000 A01
05 0
320
The unused accum ulator
bits are set to zero
00 10 000 0
STR 1
D140 0
OUT
V1500
14 0
D
2
SHF T B
SHF T
ENT
SHF T
LENT
IV
ENT
ENT
_
.
.
0000
0000
V1501
FA01 (Hex) = 64001 (decimal)
50 (Hex) = 80 (decimal)
320 (Hex) = 800 (decimal)
1 (Hex) = 1 (decimal)
(Accumulator)
Top of stack holds remainder
LD
V1400
X1
DIVB
V1420
The binar y value in the
accum ul ator is divided by
the bi nar y val ue i n V1420
OUT
V1500
Copy the value i n the l ow er 16
bits of the accumulator to V1500
Use either OR Constant
V-memory
LD D
BIN
K64001
Load the value in V1400
into the lower 16 bits of
the accumulator
DirectSOFT
Handheld Programmer Keystrokes
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