LARGEST ELEMENT IN AN ARRAY



ADDRE
SS
OPCO
DE
LABEL
MNEM
ONICS
OPER
AND
COMMENTS
8001


LXI
H,8100
Initialize HL reg. to
8100H
8002




8003




8004


MVI
B,04
Initialize B reg with no. of comparisons(n-1)
8005




8006


MOV
A,M
Transfer first data to acc.
8007

LOOP1
INX
H
Increment HL reg.  to point next memory location
8008


CMP
M
Compare M & A
8009


JNC
LOOP
If A is greater than M then go to loop
800A




800B




800C


MOV
A,M
Transfer data from M to A reg
800D

LOOP
DCR
 B
Decrement B reg
800E


JNZ
LOOP1
If B is not Zero go to loop1
800F




8010




8011


STA
8105
Store the result in a memory location.
8012




8013




8014


HLT

Stop the program

Comments

Popular posts from this blog

8086 STRING MANIPULATION –FIND AND REPLACE A WORD

Animated Circles In C++

C program to find out the sum of series 1 + 2 + …. + n.