Array operations such as searching and sorting using 16-bit values is performed using Assembly programming.
Searching of 16-bit value in an array
Aim:
To search for a 16-bit value and provide its count using Assembly language for 8086 microprocessor.
Software Used:
MASM
Program Code:
Sample Input and Output:
Consider the array elements: 1234, ABF0, 1234, 1234, CB07
Input |
|
Address |
Data |
3000 |
34 |
3001 |
12 |
3002 |
F0 |
3003 |
AB |
3004 |
34 |
3005 |
12 |
3006 |
34 |
3007 |
12 |
3008 |
07 |
3009 |
CB |
DX: 1234 (Element to be searched)
Result:
BL: 03. This indicates that the element 1234 is present 3-times in the given array.
Sorting of 16-bit values in ascending/descending order in an array
To perform the sorting of 16-bit values in an array using Assembly language for 8086 microprocessor.
Software Used:
MASM
Program Code:
Sample Input and Output:
Consider the array elements: 3567, 1234, CDAB, DEF0, 5678
Input |
|
Address |
Data |
3000 |
67 |
3001 |
35 |
3002 |
34 |
3003 |
12 |
3004 |
AB |
3005 |
CD |
3006 |
F0 |
3007 |
DE |
3008 |
78 |
3009 |
56 |
Output |
|
Address |
Data |
3000 |
34 |
3001 |
12 |
3002 |
67 |
3003 |
35 |
3004 |
78 |
3005 |
56 |
3006 |
AB |
3007 |
CD |
3008 |
F0 |
3009 |
DE |
Result:
The output table shows the array arranged in ascending order: 1234, 3567, 5678, CDAB, DEF0.
No comments:
Post a Comment