Statement: Subtract the BCD number stored in E register from the number stored in the D register.
| Source Program: MVI A,99H SUB E : Find the 99's complement of subtrahend INR A : Find 100's complement of subtrahend ADD D : Add minuend to 100's complement of subtrahend DAA : Adjust for BCD HLT : Terminate program execution Note: When two BCD numbers are subtracted, we can use DAA instruction for ajusting the result to BCD. Therefore, the subtraction of BCD number is carried out 10's complement or 100's complement. The 10's complement of a decimal number is equal to the 99's complement plus 1. The 99's complement of a number can be found by subtracting the number from 99. The steps for finding 100's complement BCD subtraction are :
- Find the 100's complement of subtrahend
- Add two numbers using BCD adition
|
Related Programs (Click down)
Find the negative numbers in a block of data.
Find the largest of given numbers
Count number of one's in a number
Arrange in ascending order