background - Subtract 8 Bit BCD Numbers

Subtract 8 Bit BCD Numbers

Posted on

Subtract 8 bit BCD numbers

Introduction 

Binary Coded Decimal Number system uses binary numbers to represent a decimal number.

Here Each decimal digit is represented by either 4-digit or 8-digit bits.

BCD is extensively used to display the numeric values in all electronic systems containing only digital logic without microprocessors.

BCD is more powerful than the binary representations. It helps in rounding off decimal values more effectively into human readable formats. 

The Disadvantages of BDC are some operations will be more complex to implement. Also BCD consumes around 20% more space compared to binary representation.

Below is the BCD representation chart for decimal digits from 0-15

Decimal Number Binary Number Binary Coded Decimal Number (BCD) 
0 0000 0000
1 0001 0001
2 0010 0010
3 0011 0011
4 0100 0100
5 0101 0101
6 0110 0110
7 0111 0111
8 1000 1000
9 1001 1001
10 1010 0001 0000
11 1011 0001 0001
12 1100 0001 0010
13 1101 0001 0011
14 1110 0001 0100
15 1111 0001 0101

 

background - Subtract 8 Bit BCD Numbers

Algorithm to subtract 8-bit BCD numbers

Step I       :    Initialize the data memory.

Step II     :    Get the first BCD number in AL.

Step III   :    Get the second BCD number in BL.

Step IV    :    Subtract the two BCD numbers.

Step V     :    Adjust result to valid BCD number.

Step VI    :    Display the result.

Step VII  :    Stop.

Subtract 8 Bit BCD Numbers Program

For  more assembly language codes, please visit this page.

Source projectgeek.com