Skip to content

Instantly share code, notes, and snippets.

@MericBERBER
Created November 9, 2017 09:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MericBERBER/0839b393c0e3b0c7deb26fe44ae57558 to your computer and use it in GitHub Desktop.
Save MericBERBER/0839b393c0e3b0c7deb26fe44ae57558 to your computer and use it in GitHub Desktop.
org 100h
LEA SI, STR
MOV DX, 2000h
MOV ES, DX
MOV CL, 10 ; 10 ELEMAN VAR
MOV BP, 0
LOOP1:
MOV SI, BP
MOV AL, STR[SI]
PUSH CX
LOOP2:
INC SI
MOV BL, STR[SI]
CMP AL, BL
JA SWAP ; it is sorted array.
JMP JUMP
SWAP:
XCHG STR[BP],BL
MOV STR[SI],BL
MOV AL, STR[BP]
JUMP:
LOOP LOOP2
POP CX
INC BP
LOOP LOOP1
MOVE:;move STR to ES:2000h
CLD
LEA SI, STR
MOV DI, 2000h
MOV CX, 10
REP MOVSB
MOV CX, 10
MOV DI, 2000h
LEA SI, STR
PRINT:
MOV AL, [SI]
MOV AH, 0Eh
INT 10h
INC SI
LOOP PRINT
END:
ret
STR DB 'H', 'F', 'T', 'C', 'B', 'L', 'A', 'S', 'D', 'F'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment