Arithmetic Machine Instructions; Bcd Registers; Bcd Arithmetic - HP 9835A Programming Manual

35 series desktop computer assembly development rom
Table of Contents

Advertisement

84
Arithmetic
A BCD number within this manual has its digits represented as 01, 02, 03, etc., with each digit
corresponding to some BCD digit. 01 is the most significant digit in a number. Since full-
precison numbers within the 9835A/B contain 12-digit BCD mantissas, 12-digit BCD numbers
are used as the most frequent examples in this discussion. In that case, 012 is the least signific-
ant digit in a number.
Arithmetic Machine Instructions
There are some machine instructions which specifically operate upon the BCD registers. The
discussions in this chapter will make use of the capabilities of these instructions to develop the
techniques to write BCD arithmetic routines. If you have not done so already, you should
familiarize yourself with the instructions before moving on in this chapter. A description of the
instructions can be found in "Arithmetic Group" in Chapter 3.
BCD Registers
There are two registers in the machine used for BCD arithmetic - Arl and Ar2. These symbols
are pre-defined by the assembly language to the registers' locations in memory (see Chapter
3). The mnemonics for some instructions occasionally refer to these registers as X and Y
respectively (see Chapter 3).
BCD Arithmetic
To understand BCD arithmetic in the context of the 9835A/B, recall from Chapter 3 that a
full-precision value is represented in four words which contain its information as follows -
15
14
13
12
11
10
9
8
7
6
5
4
3
2
OBit
Exp:
J
J
J
J
I
I
I
I
I 0 I
I
J
I
I~an
Sign!
Exponent
o
0
0
0 Sign
01
(most significant digit)
02
03
04
05
06
07
08
012
09
010
011
(least significant)

Advertisement

Table of Contents
loading

Table of Contents