Chapter 5: Standard RLL Instructions - Math
Divide Binary (DIVB)
1
The Divide Binary instruction divides a 16-bit number
230
(Aaaa) into the value stored in the accumulator. The
240
number in the accumulator can be up to 32 bits long. The
2
250-1
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
260
3
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
DS
Used
performed on the underlying binary values, the native display format is hexadecimal. For that
4
HPP Used
reason you will need to load constants in hex.
At the completion of the division operation, the quotient resides in the accumulator and the
5
remainder resides in the first stack location.
The quotient occupies the full 32-bit accumulator and requires an Out Double to move the
6
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.
7
Operand Data Type
8
V-memory
Pointer
Constant
9
Discrete Bit Flags
SP53
10
SP63
SP70
11
NOTE: Status flags are valid only until another instruction uses the same flag.
12
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
13
the binary value in V1420 using the Divide Binary instruction. The value in the accumulator
is copied to V1500 using the Out Double instruction.
14
DirectSOFT
X1
A
B
C
D
5–106
DL205 User Manual, 4th Edition, Rev. B
DL250-1 Range
A
V
All (See page 3 - 55)
P
All V mem (See page 3 - 55)
K
On when the value of the operand is larger than the accumulator can work with.
On when the result of the instruction causes the value in the accumulator to be zero.
On anytime the value in the accumulator is negative.
Use either
OR
Constant
V-memory
LD
L DD
V1400
K64001
Load the value in V1400
into the lower 16 bits of
BIN
the accumulator
DIVB
V1420
The binary value in the
accumulator is divided by
the binary value in V1420
OUT
V1500
Handheld Programmer Keystrokes
Copy the value in the lower 16
bits of the accumulator to V1500
STR
SHFT
SHFT
OUT
aaa
0-FFFF
Description
V1400
F
A
0
1
The unused accumulator
bits are set to zero
0
0
0
0
F
A 0
1
(Accumulator)
_ . .
(V1420)
0
0
5
0
(Accumulator)
0
0
0
0
0
3
2
0
0
0
0
0
0
3
2
0
V1501
V1500
1
ENT
L
D
1
4
0
0
D
I
V
B
1
SHFT
V
1
5
0
DIVB
A aaa
DL260 Range
aaa
All (See page 3 - 56)
All V mem (See page 3 - 56)
0-FFFF
FA01 (Hex) = 64001 (decimal)
50 (Hex) = 80 (decimal)
320 (Hex) = 800 (decimal)
0
0
0
0
0
0
0
1
1 (Hex) = 1 (decimal)
Top of stack holds remainder
ENT
4
2
0
ENT
0
ENT
Need help?
Do you have a question about the DirectLOGIC DL205 Series and is the answer not in the manual?