Guest User

Untitled

a guest
Oct 1st, 2017
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. .model small
  2. .stack 100h
  3. .data
  4.     arr dw 5, -14, 9, 2, -5, 90, -60, 0, 3, -8
  5.     len db 9
  6. .code
  7. entry:
  8.     mov ax, @data
  9.     mov ds, ax
  10.     mov es, ax ;10
  11.     mov bx, offset arr
  12.  
  13.     xor ax, ax
  14.     mov al, len
  15.     push ax ;15
  16.  
  17.     xor cx, cx
  18. outerloop:
  19.     xor si, si
  20.     innerloop: ;20
  21.         pop ax
  22.         cmp si, ax
  23.         push ax
  24.         je innerloop_end
  25.         ;if
  26.         push si
  27.         add si, si
  28.         mov ax, [bx][si]
  29.         add si, 2 ;30
  30.         mov dx, [bx][si]
  31.         cmp ax, dx
  32.         jb end_swap
  33.         swap:
  34.             mov [bx][si], ax
  35.             sub si, 2
  36.             mov [bx][si], dx
  37.         end_swap:
  38.         pop si
  39.         inc si
  40.            
  41.         jmp innerloop
  42.        
  43.     innerloop_end:
  44.  
  45.     pop ax
  46.     cmp cx, ax
  47.     push ax
  48.     je exit
  49.     inc cx
  50.     jmp outerloop
  51.    
  52. exit:
  53.     mov ax, 4c00h
  54.     int 21h
  55. end entry
Advertisement
Add Comment
Please, Sign In to add comment