The Intel BCD opcodes are a set of six x86 instructions that operate with binary-coded decimal numbers. The radix used for the representation of numbers in the x86 processors is 2. This is called a binary numeral system. However, the x86 processors do have limited support for the decimal numeral system. In addition, the x87 part supports a unique 18-digit (ten-byte) BCD format that can be loaded into and stored from the floating point registers, from where ordinary FP computations can be performed. The integer BCD instructions are no longer supported in long mode. Usage Number representation BCD numbers can be represented in two ways in integer registers: packed decimal and unpacked decimal. Packed (4 bits) In packed decimal representation a decimal digit is stored in one nibble. The values 10 to 15 are not used. Unpacked (8 bits) In unpacked decimal representation a decimal digit is stored in one byte. The values 10 to 255 are not used. The upper nibble is ignored, and can either be zero, or the leading-nibble for the ASCII character (value 3). BCD numbers are generally assumed to be stored in the lowest byte of a register, e.g. AL; operations on unpacked BCD numbers expect the least significant digit in the lowest byte of a register, e.g. AL, and the most significant digit in the second lowest byte, e.g. AH. Adding Only the decimal numbers 0 to 99 can be added directly. First the numbers are added as usual using add (or adc if you need the carry flag). The processor will set the adjust flag if the sum of both lower nibbles is 16 or higher, and the carry flag if the sum of both bytes is 256 or higher. Then the result is adjusted, depending on the number representation. Packed The result is adjusted using daa (decimal adjust after addition): If the least significant nibble of the result is 10 or higher, or if the adjust flag is set, then the processor adds 6 to the result and discards any overflow of the nibble. Then, if the most significant nibble of the result is 10 or higher, or if the carry flag is set, then the processor adds 96 (6 times 16) to the result and sets the carry flag. Unpacked The result is adjusted using aaa (ASCII adjust after addition): If the least significant nibble of the result is 10 or