PROGRAM NO.6
OBJECT:Write a program to input 5 numbers and arrange them in descending order
INSTRUMENT REQUIRED: 8086 Microprocessor Trainer Kit.
PROGRAM:
MEMORY LOCATION | MACHINE CODE | OPCODE | OPERAND |
0200 | BE 00 03 | MOV | SI,0300H |
0203 | 8B 1C | MOV | BX,[SI] |
0205 | 4B | DEC | BX |
0206 | 8B 0C | MOV | CX,[SI] |
0208 | 49 | DEC | CX |
0209 | BE 02 03 | MOV | SI,0302H |
020C | 8A 04 | MOV | AL,[SI] |
020E | 46 | INC | SI |
020F | 3A 04 | CMP | AL,[SI] |
0211 | 73 06 | JAE | 0219 |
0213 | 86 04 | XCHG | AL,[SI] |
0215 | 4E | DEC | SI |
0216 | 88 04 | MOV | [SI],AL |
0218 | 46 | INC | SI |
0219 | E2 F1 | LOOP | 020C |
021B | 4B | DEC | BX |
021C | BE 00 03 | MOV | SI,0300H |
021F | 75 E5 | JNZ | 0206 |
0221 | F4 | HLT |
DESCRIPTION:
To solve the given objective we have taken FIVE hexadecimal numbers in the memory locations of 0302H to 0306H and used bubble sorting to sort them up.
To solve the given objective we have taken the following steps:
- Move the source index register (SI) pointer to the location where the total number of given numbers to be sorted is given.
- Store the number pointed by SI in the BX register.
- Decrement the value in BX and simultaneously store the value pointed by SI in another register CX and decrement it as well.
- Move the first number in the AX register using SI.
- Increment SI so as to enable it to point it to the next number.
- Compare the two numbers and jump if the one number is greater than or equal to the other else exchange the two numbers.
- Repeat the above process until all the numbers are arranged in descending order and the counters have been reduced to zero and then finally halt.
INPUT:
MEMORY LOCATION | VALUE |
0300H | 05 |
0301H | 00 |
0302H | 20 |
0303H | 25 |
0304H | 28 |
0305H | 15 |
0306H | 07 |
OUTPUT:
MEMORY LOCATION | VALUE |
0300H | 05 |
0301H | 00 |
0302H | 28 |
0303H | 25 |
0304H | 20 |
0305H | 15 |
0306H | 07 |
RESULT: The sorting is in the decreasing order as above using bubble sorting.
COMMENTS:
- MOV SI, 0300H: 16 bit data can be moved using immediate addressing. 0300 is moved to source index.
- DEC BX: these instruction decrements specified 16-bit register by one.
- JAE: It causes the program execution to jump to the label given in the instruction.
- LOOP: The instruction LOOP is used to repeat a sequence of instructions for the specified number of times.
- XCHG AL,[SI]: This instruction exchanges the contents of an 8-bit or 16-bit specified register with the content of an 8-bit or 16-bit specified register or memory location(s).
- HLT: This instruction stops program execution. The processor stops fetching and executing instructions.
FLOWCHART:

Most Important Question for Exam
1. The External device is connected to a pin caled the ______ pin on the processor chip
Interrupt
2. In 8085 name the 16 bit registers?
A & B
3. What is SIM
Set Interrupt Mask
4. RIM is used to check whether_______
The Interrupt is Marked or not
5. Which are the part of architecture of 8086:
Both C & D
6. Which are the segement
All of these
7. The Accumulator is 16 bit wide and is called:
AX
8. The upper 8 bit are called___________:
AH
9. The lower 8 bit called _________:
AL
10. Which has great important in modular programing:
Stack Segment
11. Which register containing the 8086/8088 flag:
Status Register
12. How many bits the instruction pointer is wide:
16 bit
13. How many type of addressing in memory:
Both C & D
14. The size of each segment 8086 is:
64 kb
15. The Physical address of memory is:
20 bit
16. SBA stand for:
Segment base address
17. Which memory is used to hold the address of data store:
Associative Memory
18. A Microprocessor is a ________ chip integrating all the functions of a CPU of a computer.
Single
19. Microprocessor is a ___________circuite that function as the CPU of the compute
Electronic
20. Microprocessor is the________ of the computer and it perform all the computational tasks
Heart
21. The purpose of the microprocessor is to control________
Memory
22. The first digital electronic computer was built in the year_________
1940
23. In 1960’s texas institute invented__________
Integrated Circuits
24. The Intel 8086 Microprocessor is a ___________processor
16 bit
25. The 16 bit flag of 8086 Microprocessor to indicate_________
The condition of result of ALU
26. The CF is known as ____________
Carry Flag
27. The SF is caled as _________
Sign Flag
28. The OF is called as_________
Overflow Flag
29. The register AX is formed by grouping_________
AH & AL
30. The Index register are used to hold _____
Memory Register
Related Link
- 8086 Instruction Hex Code
- Write a program to two add 16 bit Hexadecimal numbers without carry.
- Write a program to two add 16 bit Hexadecimal numbers with carry.
- Write a program to find the greatest number from an array of 10 numbers.
- Write a program to calculate the factorial of a number.
- Write a program to multiply two 16-bit numbers result should be greater than 16 bit.
- Write a program to input 5 numbers and arrange them in descending order.
- Write a program to convert the string data it’s Two’s complement form.
- Write a program to read 8 bit data from Port B. Complement this data & send it back to Port A of
- Write a program to move a block of data from one memory location to another. Input Value
- Write a program to find Gray code equivalent of a Binary number using Lookup Table.
- Microprocessor 8086 Video Play List