Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .model small
- .stack 100h
- .data
- arr dw 5, -14, 9, 2, -5, 90, -60, 0, 3, -8
- len db 9
- .code
- entry:
- mov ax, @data
- mov ds, ax
- mov es, ax
- mov bx, offset arr
- xor ax, ax
- mov al, len
- push ax ;15
- xor cx, cx
- outerloop:
- xor si, si
- innerloop:
- pop ax
- cmp si, ax
- push ax
- je innerloop_end
- push si
- add si, si
- mov ax, [bx][si]
- add si, 2
- mov dx, [bx][si]
- cmp ax, dx
- jb end_swap
- swap:
- mov [bx][si], ax
- sub si, 2
- mov [bx][si], dx
- end_swap:
- pop si
- inc si
- jmp innerloop
- innerloop_end:
- pop ax
- cmp cx, ax
- push ax
- je exit
- inc cx
- jmp outerloop
- exit:
- mov ax, 4c00h
- int 21h
- end entry
Add Comment
Please, Sign In to add comment