Write an 8085 program to find the larger number among two 8-bit hexadecimal numbers
In the last program, we saw how we can perform 2’s complement on an 8-bit and 16-bit hexadecimal numbers.
In this program, we are going give a look at how we can find the larger number among two 8-bit hexadecimal number.
Now as far as addressing mode is concerned, for this program, we are going to use immediate addressing mode.
For this program, we are going to need three memory locations, we are going to start from the 2000H memory location.
In the 2000H memory location, we are going to store the first 8-bit number i.e. 25H, and in the 2001H memory location, we are going to store our 2nd 8-bit number i.e. 15H.
And last but not the least, in 2002H ML, we are going to store the result.
LXI H,2000H //using LXI instruction, we will point HL register pair to 2000H memory location
MOV A, M //using MOV instruction we will copy the content of 2000H to the accumulator
INX H //using INX we will increment the memory location to 2001H memory location
MOV B, M //once again we will use MOV instruction to copy the content of 2001H memory location to B register
CMP B //using CMP we will compare the content of accumulator with the content of B register
JNC 200EH//we will Jump No Carry control instruction so that when no carry is generated then it will jump to 200E memory location
MOV A, B //if carry is generated then using MOV we will copy the content of B register to the accumulator
INX H// using INX H we will point the HL register to 2002H memory location
MOV M, A //we will copy the content of accumulator to 2002H memory location
|Memory Location||OPCODE||Operand||Label||Hex Code|