Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %include "io.inc"
- section .bss
- arr resd 10000
- section .data
- index dd 0
- section .text
- global CMAIN
- CMAIN:
- mov ebp, esp; for correct debugging
- GET_DEC 4, eax
- mov ecx, 0
- .readarr:
- cmp ecx, eax
- jge .readarr_end
- GET_DEC 4, edx
- mov dword [arr + ecx * 4], edx
- inc ecx
- jmp .readarr
- .readarr_end:
- mov ebx, 1
- .loop1:
- cmp ebx, eax
- jge .loop1_end
- mov ecx, ebx
- dec ecx
- mov edx, dword [arr + ebx * 4]
- .loop2:
- cmp ecx, 0
- jl .loop2_end
- cmp edx, dword [arr + ecx * 4]
- jge .loop2_end
- mov edi, dword [arr + ecx * 4 + 4]
- mov esi, dword [arr + ecx * 4]
- mov dword [arr + ecx * 4 + 4], esi
- mov dword [arr + ecx * 4], edi
- .endif:
- dec ecx
- jmp .loop2
- .loop2_end:
- inc ebx
- jmp .loop1
- .loop1_end:
- xor ecx, ecx
- .print:
- cmp ecx, eax
- jge .print_end
- mov edx, dword [arr + ecx * 4]
- PRINT_DEC 4, edx
- PRINT_CHAR 32
- inc ecx
- jmp .print
- .print_end:
- xor eax, eax
- ret
Add Comment
Please, Sign In to add comment