BCD Conversions

A BYTE in the BCD format contains integers between 0 and 99. Four BITs are used for each decimal place. The ten decimal place is stored in the BITs 4-7. Thus the BCD format is similar to the hexadecimal presen­tation, with the simple difference that only values between 0 and 99 can be stored in a BCD BYTE, whereas a hexadecimal BYTE reaches from 0 to FF.

Example:

The integer 51 should be converted to BCD format: 5 in binary code is 0101, 1 in binary code is 0001, which makes the BYTE 01010001 in BCD code, which corresponds to the value $51=81.