O'Reilly logo

X86 Assembly Language and C Fundamentals by Joseph Cavanagh

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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:

10n110n2...103 102 101 100.101 102 103...10m

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required