Micro processor Lab Manual / Decimal subtraction of two 8-bit numbers

Program Name

Write a Assembly Language Program for Decimal subtraction of two 8-bit numbers.
Theory
Instruction Mnemonic Operand Comments
LDA 8100 load the first i/p from 8100 to Accumulator
MOV B,A move the content of accumulator to reg.B
MVI A,99H Move immediately 99H to accumulator (largest two digit decimal number )
SUB B subtract from the accumulator, the contents of reg.B to get the 9's complement
INR A increment the content of accumulator to get 10's complement
(Add 1 to 9’s complement to get 10’s complement)
MOV C,A move accumulator contents into reg.C
LDA 8101 load the second i/p of sub into accumulator through memory 8101
ADD C add the contents of accumulator
(-ve number ) with reg.C
DAA decimal adjust after addition
convert the content of accumulator into decimal format after addtion
STA 8102 store the result(content of accumulator) at 8102
HLT stop
Program Code


Online compiler for 8085 Microprocess Compiler


Home     Back