Problem – Write a assembly language program to find maximum of two 8 bit numbers in 8085 microprocessor.
Assumptions – Starting memory locations and output memory locations are 2050, 2051 and 3050 respectively.
- Load value in the accumulator
- Then, copy the value to any of the register
- Load next value in the accumulator
- Compare both values
- Check carry flag, if reset then jump to the required address to store the value
- Copy the result in the accumulator
- Store the result at the required address
|2003||MOV B, A||B<-25|
|2008||JNC 200C||Jump if Carry flag is Reset(Carry flag = 0)|
|200B||MOV A, B||A<-25|
|200F||HLT||Terminates the program|
- LDA 2050: loads value at memory location 2050
- MOV B, A: assigns value of A to B
- LDA 2051: loads value at memory location 2051
- CMP B: compare values by subtracting B from A
- JNC 200C: jump at memory location 200C if carry flag is Reset(Carry flag = 0)
- STA 3050: store result at memory location 3050
- HLT: terminates the program
Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.