8085 program to subtract two BCD numbers
Problem – Write an assembly language program in 8085 microprocessor to subtract two 8 bit BCD numbers.
- Load the data from address 2051 in A
- Move the data from A to C
- Move the data 99 in A
- Subtract the contents of registers A and C
- Increment the content of A by 1
- Move the data from A to B
- Load the data from address 2050 in A
- Add the contents of A and C and adjust it in BCD format by using DAA instruction
- Store the result at memory address 3050
|2000||LDA 2051||A <- 2051|
|2003||MOV C, A||C <- A|
|2004||MVI A 99||A <- 99||2006||SUB C||A = A – C||2007||INR A||A = A + 1|
|2008||MOV B, A||B <- A|
|2009||LDA 2050||A <- 2050||200C||ADD B||A = A + B||200D||DAA||Convert the hexadecimal value to BCD value||200E||STA 3050||3050 <- A||2011||HLT||Stop|
- LDA 2051 is used to load the data from address 2051 in A.
- MOV C, A is used to move the data from A to C.
- MVI A 99 is used to move the data to register A.
- SUB C is used to subtract the contents of registers A and C.
- INR A is used to increment the content of A by 1.
- MOV B, A is used to move the data from A to B.
- LDA 2050 is used to load the data from address 2050 in A.
- ADD B is used to add the contents of registers A and B.
- DAA is used to convert the hexadecimal value in Accumulator to BCD value.
- STA 3050 is used to store the contents of A to 3050.
- HLT is used end the program.
My Personal Notes arrow_drop_up
Please Login to comment...