Chapter 10

# Binary-Coded Decimal Arithmetic Instructions

The radix is 10 in the decimal number system; therefore, ten digits are used, 0 through 9. The low-value digit is 0 and the high-value digit is (r – 1) = 9. The weight assigned to each position of a decimal number is as follows:

${10}^{n-1}{10}^{n-2}...{10}^{3}\text{}{10}^{2}\text{}{10}^{1}\text{}{10}^{0}{.10}^{-1}\text{}{10}^{-2}\text{}{10}^{-3}...{10}^{-m}$

where the integer and fraction are separated by the radix point (decimal point).

Binary-coded decimal (BCD) instructions operate on decimal numbers that are encoded as 4-bit binary numbers in the 8421 code. For example, the decimal number 576 is encoded in BCD as 0101 0111 0110. BCD numbers have a range of 0 to 9; therefore, any number greater than 9 must be adjusted by adding a value of 6 to the number to yield ...

Get *X86 Assembly Language and C Fundamentals* now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.