Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bubblesort16:
- ;; inputs: pointer in ds:si, size in in cx
- ;; clobbers: al, cx=0
- dec cx ; cx = max valid index. (Inner loop stops 1 before cx, because it loads i and i+1).
- .outer: ; do{
- push cx
- .inner: ; do{
- lodsb ; al = arr[i++]
- cmp [si],al ; compare with arr[i (new one)]
- jge .noswap
- rol word [si-1], 8 ; swap
- .noswap:
- loop .inner ; } while(i < size);
- pop cx
- sub si,cx
- loop .outer ; while(--size);
- ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement