# Decimal Divide (Dp); Exercises - RCA Spectra 70 Training Manual

System
Also See for Spectra 70:

It
should be noted, based on the above example, that
with only two significant digits in the multiplier the
leftmost zero-filled byte in the product was not need-
ed. However, if the field NUNT contained three
significant digits the added zero byte would be re-
quired as in the following example:
Example #2
HSM BEFORE
EXECUTION
HSM BEFORE
AND AFTER
EXECUTION
ASSEMBLY
l
INSTRUCTION
GENERATED
INSTRUCTION
HSM AFTER
EXECUTION
DIVIDE DECIMAL
22
22
22
WPRC
00
01
02
03
04
00
00
21
57
2+
30
31
87
5+
See Example 1 above
WPRC
00
01
02
03
04
01
88
75
50
0+
Division is performed on two packed operands with
the quotient and remainder replacing the first oper-
and (dividend) following execution of the instruction.
Two conditions cause a divide-exception interrupt
1.
Dividend does not contain at least one signifi-
Example:
VALID
INVALID
5
BYTE
DIVIDEND FIELD
I
02 11 7
I
54
I
31
I
8+
I
112 11 7
I
54
I
31
I
8+
I
2.
The divisor digits, when aligned with the digits
one position to the right of the leading zero of
the dividend, have a lesser or equal value.
31
Example:
I
01
I
751 42
1
1 +
I
DIVIDEND
VALID
1411 7+
I
DIVISOR
-
-
-
-
1 01
I
751 42 1 1 +
I
DIVIDEND
INVALID
1
04
1
1 +
I
DIVISOR
A divide-exception interrupt is avoided by position-
ing the dividend with sufficient leading zero digits.
For example, a two-byte divisor containing from one
to three Significant digits would not cause a divide
exception if two or more of the most significant bytes
of the dividend were zero.
Example:
HSM BEFORE
AND AFTER
EXECUTION
HSM BEFORE
EXECUTION
ASSEMBLY
INSTR UCTION
NAME
OPERATION
OPERAND
DP
DIVD(4), DIVS(2)
~:S~~~~~~~N
1 FD \3 10 1110
I
2 1
0030
10
I
21000010
I
HSM AFTER
EXECUTION
General Register 2
=
2200 10
DIVD
Following the execution of a Divide instruction, the
remainder appears right justified in the dividend
field and is equal in length to the divisor. The length
of the quotient, therefore, is Ll - L2.
Exercise:
1.
Assume HSM has been allocat ed as indicated on
Line 1 and that each location contains the values
as shown.