8086 Program to determine largest number in an array of n numbers


OBJECT:Write a program to find the greatest number from an array of 10 numbers.
INSTRUMENT REQUIRED: 8086 Microprocessor Trainer Kit.

020B B1 09 MOV CL,09H
020D BE 00 02 MOV SI,0200H
0210 8A 04 MOV AL,[SI]
0212 46 L1 : INC SI
0213 3A 04 CMP AL,[SI]
0215 73 02 JNB  L2  
0217 8A 04 MOV AL,[SI]
0219 FE C9 L2 : DEC CL
021B 75 F5 JNZ L1  
021D BF 0A 02 MOV DI,020AH
0220 88 05 MOV [DI],AL
0222 F4 HLT  


To solve the given objective, we have taken ten hexadecimal numbers in the memory locations from 0200H and 0209H. In order to find the greatest number amongst them we need to compare each number with the other. The greatest number will be stored in the memory location 020AH.
To solve the given objective, we have taken the following steps:

  1. Initially we initialize the counter register CL to 9 because the number of comparisons with any one number would be 9. In other words, it will compare 9 times.
  2. Move the source index register (SI) pointer to the location of the first number.
  3. Store the first number in the Al register using SI.
  4. Initiate a loop and compare each element with the element stored in AL while simultaneously decrementing counter CL.
  5. If the number is greater than that stored in AL then we store that number in AL else we do not change the value in AL.
  6. The above mentioned process goes on until CL becomes zero, at this point we have the greatest number in the AL register.
  7. Move the destination index (DI) pointer to point to the memory location where the result is to be stored.
  8. Finally move the result from the AL register to the destination using DI and Halt.


0200H A1
0201H B1
0202H C1
0203H D1
0204H E1
0205H E2
0206H E3
0207H E4
0208H E5
0209H E6
020AH 00



RESULT:The greatest of the 10 hexadecimal numbers is E6H, which gets stored in the memory location 020AH.


1.  INC SI: The content of a specified 8-bit or 16-bit register or memory location(s) is incremented by one by this instruction.

2.  CMP AL,[SI]: The compare instruction compares two specified operands. For comparison one operand is subtracted from the other.

3.  JNC: It causes the program execution to jump to the label given in the instruction.

4.  HLT: This instruction stops program execution. The processor stops fetching and executing instructions.

8086 Program to determine largest number in an array of n numbers

Most Important Question for Exam

1. BCD Stand for:

Answer is C)
Binary Code Decimal

2. Which use to store critical pieces of data during subroutines and interrupts:

Answer is B)

3. The Calculator is 16 bit wide and is called:

Answer is B)

4. How many bits the instruction pointer is wide:

Answer is C)
16 bit

5. The size of each segment in 8086 is:

Answer is B)
64 kb

6. The ___________ address of memory 20 bit address for the 8086 Microprocessor:

Answer is B)

7. The PIN configuration of 8086 is available in the _______

Answer is C)
40 Pin

8. DIP stand for:

Answer is A)
Dual inline package

9. BP Stand for:

Answer is A)
Base Pointer

10. DI Stand for:

Answer is B)
Destination Index register

11. SI Stand for:

Answer is A)
Source Index

12. ALE Stand for:

Answer is B)
Address Latche Enable

13. NMI Stand for:

Answer is B)
Non Mask able Interrupt

14. ____________ is the most important segment and it contains the actual assembly language instruction to be executed by the Microprocessor

Answer is C)
Code Segment

15. The offset of a particular segment varies from ______________:

Answer is C)
0000H to FFFFH

16. Which are the factor of cache memory

Answer is D)
Properties of the programs being executed

17. _________ is usually the first level of memory by the Microprocessor:

Answer is B)
Cache Memory

18. Which is the small amount of high-speed memory used to work directoly with the Microprocessor:

Answer is B)

19. The cache usually gets its data from the _____________ whenever the instruction or data is required by the CPU:

Answer is C)
Main Memory

20. Microprocessor reference that are available in the cache are called___________:

Answer is B)
Cache Hits

21. Microprocessor reference that are not available in the cache are called____________:

Answer is A)
Cache Misses

22. Which causes the Microprocessor to immediately its present activity:

Answer is B)
RESET Signal

23. Which is responsible for all the outside world communiction by the Microprocessor:

Answer is C)

24. INTR: it implies the ___________ signal:

Answer is B)
Interrupts Request

25. Which of the following are the two main components of the CPU?

Answer is A)
Control Unit and ALU

26. Different components the Motherboard of a PC unite are linked togther by sets of parallel eletrical conducting lines. What are these lines called?

Answer is A)

27. The Language that the Computer can understand execute is called

Answer is C)
Machine Language

28. Which of the following is used as a primary storage device?

Answer is C)

29. Which of the following memories needs refresh?

Answer is A)

30. The memory which is programmed at the time is manufacturerd

Answer is B)

Related Link