OBJECT:Write a program to input 5 numbers and arrange them in descending order
INSTRUMENT REQUIRED: 8086 Microprocessor Trainer Kit.
|MEMORY LOCATION||MACHINE CODE||OPCODE||OPERAND|
|0200||BE 00 03||MOV||SI,0300H|
|0209||BE 02 03||MOV||SI,0302H|
|021C||BE 00 03||MOV||SI,0300H|
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.
RESULT: The sorting is in the decreasing order as above using bubble sorting.
- 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.
Most Important Question for Exam
A & B
Set Interrupt Mask
The Interrupt is Marked or not
Both C & D
All of these
Both C & D
Segment base address
The condition of result of ALU
AH & AL
- 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