Addition - HP 9835A Programming Manual

35 series desktop computer assembly development rom
Table of Contents

Advertisement

Arithmetic
85
The exponent is stored in two's complement form. The exponent and the mantissa are always
adjusted by arithmetic routines so that there is always an implied decimal point following Dl.
Thus, the mantissa of every value stored looks like -
Except possibly for intermediate results within the individual arithmetic algorithms, the most
significant digit of a full-precision value (D1) will never be 0 unless the entire number is O.
Sometimes, after an individual arithmetic operation, the answer needs to be normalized, that
is, the digits of the answer shifted to the left until D1 is no longer O. The exponent then needs to
be adjusted to reflect the change.
An important thing to keep in mind when examining BCD arithmetic, as implemented by the
processor, is that mantissas are represented in a "sign-magnitude" format. This means that the
absolute value is stored as the actual mantissa, and the sign of the mantissa is maintained
separately.
Addition
There is a one-bit Decimal Carry (DC) flag within the processor which serves a BCD function
similar to the Extend flag for binary addition.
DC is set to a one or zero, depending upon the occurrence or absence of a carry from the
addition of the two D1's of the two BCD numbers being added. Since mantissas are represented
in a sign-magnitude form (with the sign in the exponent word rather than part,of what gets
added), DC represents an overflow for 12-digit mantissa additions.
DC itself is part of the addition in the D12 position. This gives it potential use with
multiple-precision floating point arithmetic. The addition process looks like this -
+
Ar1
Ar2
Ar2
There are three instructions which concern themselves exclusively with DC. They are - SDS
(Skip if DC set), SCD (Skip if DC clear), and CDC (Clear DC).

Advertisement

Table of Contents
loading

Table of Contents