Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- section .data
- str: db "Hello world!", 0xa
- strlen equ $-str
- num: dd 1337
- buf: db '0000000000'
- section .text
- global _start
- _start:
- mov eax, 1337;start value
- ;inits
- mov ebx,buf+9 ;schreibe ergebnis hierhin
- mov ecx,10
- mov edi,10 ;dividor 10
- call _loop
- call _print
- call _exit
- _loop:
- mov edx,0 ;clear before divide
- div edi ;divide by 10
- add edx,48 ;convert to ascii value
- mov [ebx],dl ;write into memory
- dec ebx ;decrement pointer
- loop _loop ;loop it
- ret
- _print:
- mov eax,4 ;schreibe
- mov ebx,1 ;auf Terminal
- mov ecx,buf
- mov edx,11 ;11 Bytes
- int 80h
- ret
- _exit:
- mov eax, 1
- mov ebx, 0
- int 80h
- ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement