hewlett-packard HP 9835A — 084

84 Arithmetic A BCD number within this manual has its digits represented as 01, 02, 03, etc., with each digit 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. corresponding to some BCD digit. 01 is the most significant digit in a number. Since full- 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 are pre-defined by the assembly language to the registers' locations in memory (see Chapter There are two registers in the machine used for BCD arithmetic - Arl and Ar2. These symbols 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 E Six gp n: ! J J J ExJ p oneI nt I I I I 0 I o I 0 J 0 I 0 I S~ ia gn n 01 (most significant digit) 02 03 04 05 06 07 08 09 010 011 012 (least significant)