Home

Find the largest of given numbers

Statement: Find the largest number in a block of data. The length of the block is in memory location 2200H and the block itself starts from memory location 2201H.

Store the maximum number in memory location 2300H. Assume that the numbers in the block are all 8 bit unsigned binary numbers.

Sample problem 1:

(2200H) =  04

(2201H) = 34H

(2202H) = A9H

(2203H) = 78H

(2204H) =56H

Result = (2202H) = A9H

Source program :

  • LDA 2200H
  • MOV C, A : Initialize counter
  • XRA A : Maximum = Minimum possible value = 0
  • LXI H, 2201H : Initialize pointer
  • BACK: CMP M : Is number> maximum
  • JNC SKIP : Yes, replace maximum
  • MOV A, M
  • SKIP: INX H
  • DCR C
  • JNZ BACK
  • STA 2300H : Store maximum number
  • HLT : Terminate program execution


Flowchart for program

20-Find the largest of given numbers

Related Programs for Beginners: (Click down)

Calculate the sum of series of numbers

Multiply two 8-bit numbers

Divide a 16 bit number by a 8-bit number

Find the negative numbers in a block of data.