Facebook
From Little Meerkat, 1 Month ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 34
  1. ;bubble sort
  2. [org 0x0100]
  3. jmp start
  4. data: dw 60, 55, 45, 40, 40, 35, 80, 30, 20, 0
  5. swap: db 0
  6. start: mov bx,0
  7. mov byte[swap],0
  8. loop1: mov ax,[data+bx]
  9. cmp ax,[data+bx+2]
  10. jbe noswap
  11.  
  12. mov dx,[data+bx+2]
  13. mov [data+bx+2],ax
  14. mov [data+bx],dx
  15. mov byte[swap],1
  16.  
  17. noswap: add bx,2
  18. cmp bx,18
  19. jne loop1
  20.  
  21. cmp byte[swap],1
  22. je start
  23. mov ax,0x4c00
  24. int 0x21quit
  25.