Write an assembly language program to find the LARGEST and SMALLEST number from an array. Store the largest or smallest number into the memory location A400H.
#ORG 8000H
START: LXI H,9000H
MOV C,M
INX H
MOV A,M
DCR C
LOOP1: INX H
CMP M
JNC AHEAD1
MOV A,M
AHEAD1: DCR C
JNZ LOOP1
STA A400H
LXI H,9000H
MOV C,M
INX H
MOV A,M
DCR C
LOOP2: INX H
CMP M
JC AHEAD2
MOV A,M
AHEAD2: DCR C
JNZ LOOP2
STA A401H
HLT
Post a Comment
0 Comments