Skip to content

Instantly share code, notes, and snippets.

@TuurDutoit
Created November 17, 2016 14:07
Show Gist options
  • Save TuurDutoit/cab709ef9c5b6e4fc97ac6663debdcaf to your computer and use it in GitHub Desktop.
Save TuurDutoit/cab709ef9c5b6e4fc97ac6663debdcaf to your computer and use it in GitHub Desktop.
%include "gt.asm"
covar
nums: resd 10
i: dd 10
inleiding
sub esi, esi
mov ecx, 10
input:
inv [nums + esi]
add esi, 4
loop input
outer:
mov ebx, [i] ; for(j = 10; j > 0; j--)
sub ebx, 1
cmp ebx, 0
jle end
mov [i], ebx ; /for
mov eax, [nums] ; eax is previous,
mov esi, 4 ; so start at 2nd number
mov ecx, 9
inner:
mov ebx, [nums + esi]
cmp eax, ebx
jg switch
mov eax, ebx
after_switch:
add esi, 4
loop inner
jmp outer
switch:
mov [nums + esi], eax
sub esi, 4
mov [nums + esi], ebx
add esi, 4
jmp after_switch
end:
mov ecx, 10
sub esi, esi
end_loop:
uit [nums + esi]
add esi, 4
loop end_loop
slot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment