8085 Program to Find the Maximum of N Numbers

8085 is a Microprocessor which was developed by Intel in 1970s. All the instructions in this microprocessor are encoded in a single byte. Some of the instructions are followed by one or two bytes of data, which can be a memory address, an immediate operand or a port number.

In this post, we will write a program in 8085 to Find the Maximum of N Numbers.

Algorithm

Start
Address <- 2200H
C <- M[Address]
Address <- Address + 1
A <- M[Address]
C <- C - 1
Address <- Address + 1
If A >= M[Address], go to 10
A <- M[Address]
Address <- Address + 1
C <- C - 1
If C != 0, go to 8
M[Address] <- A
Stop

Flow Chart

Program

      LXI H, 2200H
      MOV C, M
      INX H
      MOV A, M
      DCR C
BACK: INX H
      CMP M
      JNC NEXT
      MOV A, M
NEXT: DCR C
      JNZ BACK
      INX H
      MOV M,A
      RST 5

Example

2200H: 04
2201H: 02
2202H: 03
2203H: 04
2204H: 03
2205H: 04  ->  Output

Check out our other 8085 programs

Let us know in the comments if you are having any questions regarding this microprocessor program.

And if you found this post helpful, then please help us by sharing this post with your friends. Thank You

Leave a Reply