/asm/sort/sort.s

http://github.com/dennis-gemini/tests · Assembly · 35 lines · 29 code · 6 blank · 0 comment · 0 complexity · c0d4b341559e77da3fb0c9ce99150c87 MD5 · raw file

  1. .section .data
  2. values:
  3. .int 105, 235, 61, 315, 134, 221, 53, 145, 117, 5
  4. .section .text
  5. .globl _start
  6. _start:
  7. nop
  8. movl $values, %esi
  9. movl $9, %ecx
  10. movl $9, %ebx
  11. loop:
  12. movl (%esi), %eax
  13. cmp %eax, 4(%esi)
  14. jge skip
  15. xchg %eax, 4(%esi)
  16. movl %eax, (%esi)
  17. skip:
  18. add $4, %esi
  19. dec %ebx
  20. jnz loop
  21. dec %ecx
  22. jz end
  23. movl $values, %esi
  24. movl %ecx, %ebx
  25. jmp loop
  26. end:
  27. movl $1, %eax
  28. movl $0, %ebx
  29. int $0x80