Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bits 32
- global start
- extern exit; tell nasm that exit exists even if we won't be defining it
- import exit msvcrt.dll; exit is a function that ends the calling process. It is defined in msvcrt.dll
- ; our data is declared here (the variables needed by our program)
- segment data use32 class=data
- sir db 'bcdefgha'
- len equ ($-sir);lungimea sirului (in dublucuvinte)
- swap db 0
- ; our code starts here
- segment code use32 class=code
- start:
- mov esi, 0
- comparison:
- mov al, [sir + esi]
- cmp al, [sir + esi+ 1]
- jb noswap
- mov dl, [sir+esi+1]
- mov [sir+esi+1], al
- mov [sir+esi], dl
- mov byte[swap], 1
- noswap:
- add esi, 1
- cmp esi, len-1
- jnz comparison
- cmp byte[swap], 0
- jnz start
- push dword 0; push the parameter for exit onto the stack
- call [exit]; call exit to terminate the program
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement