8086 STRING MANIPULATION – SORTING
ASSUME CS: CODE,
DS: DATA
DATA SEGMENT
LIST DW 53H, 25H,
19H, 02H
COUNT EQU 04H
DATA ENDS
CODE SEGMENT
START: MOV AX, DATA
MOV DS, AX
MOV DX, COUNT-1
LOOP2: MOV CX, DX
MOV SI, OFFSET LIST
AGAIN: MOV AX, [SI]
CMP AX,
[SI+2]
JC LOOP1
XCHG [SI +2], AX
XCHG [SI], AX
LOOP1: ADD SI, 02
LOOP AGAIN
DEC DX
JNZ LOOP2
MOV AH, 4CH
INT 21H
CODE ENDS
END START
Comments
Post a Comment