Pastebin launched a little side project called HostCabi.net, check it out ;-)Don't like ads? PRO users don't see any ads ;-)

bubblesort

By: GGMethos on Oct 3rd, 2013  |  syntax: ASM (NASM)  |  size: 0.23 KB  |  hits: 44  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. LXI H F000h
  2. MOV C M
  3. LOOP1: LXI H F001h
  4. MOV A M
  5. MOV E A
  6. DCR C
  7. MOV B C
  8. JZ END
  9. LOOP2: INX H
  10. CMP M
  11. JNC SWAP
  12. HERE: DCR B
  13. JNZ LOOP2
  14. JMP LOOP1
  15. SWAP: MOV D A
  16. MOV A M
  17. MOV M D
  18. DCX H
  19. MOV M A
  20. INX H
  21. MOV A E
  22. JMP HERE
  23. END: HLT