Sorting of numbers using 8086 hardware kit
Arrange the following 16-bit numbers in ascending order using 8086-kit (Hardware experiment).
0075H,0072H,0080H,0018H,0076H,0009H (Total SIX 16-bit numbers)
Enter these numbers in the memory locations starting from 2000
Type SB 2000 from the keyboard
Replace existing numbers with the given numbers in the memory locations. (MSB in even location and LSB in odd location)
For example 0075 can be entered as
Press interrupt after entering all the given numbers.
To assemble the program, type A and give starting address e.g. 1000.
Start typing the following program. (Few images are appended after the program)
MOV DX, 05 //Should be one less than the total numbers//
LOOP1: MOV CX,DX // Note the address of this line//
LOOP2:MOV AX,[SI] // Note the address of this line//
JC END1 // Note address of this line for future editing and write temporary address 1050 in place of label END1//
END1: ADD SI,02H // Note the address of this line to be replaced the temp location 1050 used earlier//
LOOP LOOP2 // address of LOOP2 in place of label LOOP2//
JNZ LOOP1 // address of LOOP1 inplace of label LOOP1//
HLT // LAST ADDRESS//
To replace temp address in the line of JC END1.
Type A and start address i.e 1014 of the line to be edited. Type JC 1022 (new address i.e. actual address). And press enter twice.
To check full program, type U via keyboard. For a quick review watch the video below.
Run the program
GB 1000 10XX(i.e.HLT address)
Brk pt reached
Press interrupt and verify the sorted numbers.
DB 2000 200B
Numbers are arranged in increasing order.
Comments for any clarification