Write and execute an alp to 8086 Microprocessor to pick the median from the given array of numbers.
Aim:
To write and execute an Assembly language Program (ALP) to 8086 processor to pick the median from the given array of numbers.
Tools:
PC installed with TASM.
Program:
.MODEL SMALL .STACK 45H ASSUME CS : CODE, DS : DATA DATA SEGMENT ARRY DW 0125H, 0144H, 3001H, 0003H, 0002H MEDIAN DW ? COUNT EQU 05H DATA ENDS CODE SEGMENT START : MOV AX, DATA MOV DS, AX MOV DX, COUNT - 1 BACK: MOV CX, DX MOV SI, OFFSET ARRY AGAIN: MOV AX, [SI] CMP AX, [SI + 2] JC GO XCHG AX, [SI + 2] XCHG AX, [SI] GO: INC SI INC SI LOOP AGAIN DEC DX JNZ BACK MOV SI, OFFSET ARRY MOV AX, [SI + 4] MOV MEDIAN, AX INT 03H CODE ENDS END START END
Result:
Input:
0125H, 0144H, 3001H, 0003H, 0002H
Output:
Median = 3001H
Viva-voce questions:
1. What is meant by median of an array? 2. what do you mean by addressing mode? 3. What is the addressing mode of an instruction communicated to the cpu? 4. What are the assembler directives? 5. Depending on what value, Loop repeats for no. of times?
-
UpdatedNov 05, 2014
-
Views7,374
Write and execute an alp to 8086 Microprocessor to add, subtract and multiply two 16 bit unsigned numbers. Store the result in extra segment
Write and execute an alp to 8086 Microprocessor to a sort the give array of 32 bit number in ascending and descending order.
Program to generate following waveforms
- Ramp waveform
- Square waveform
- Step waveform
- Triangle waveform
Write and execute an alp to 8086 Microprocessor to find the length of a given string which terminates with a special character
Write and execute an alp to 8086 Microprocessor to divide a 32 bit unsigned numbers by a 16 bit unsigned number. Store the result in stack segment
Interface a stepper motor to 8086 and operate it in clock wise and anticlockwise by choosing variable stepsize.