Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- section .text
- [GLOBAL printnum:]
- _nl db 0x0A
- printnum:
- enter 0,0
- mov eax, [ebp+8]
- xor ebx, ebx
- xor ecx, ecx
- xor edx, edx
- push ebx
- mov ebx, 10
- startLoop:
- idiv ebx
- add edx, 0x30
- push dx ; With an odd number of digits this will screw up the stack, but that's ok
- ; because we'll reset the stack at the end of this function anyway
- inc ecx
- xor edx, edx
- cmp eax, 0
- jne startLoop
- push ecx
- imul ecx, 2
- mov edx, ecx
- mov eax, 4
- mov ebx, 1
- mov ecx, esp
- add ecx, 4
- int 80h
- mov eax, 4
- mov ebx, 1
- mov ecx, _nl
- mov edx, 2
- int 80h
- pop eax
- leave
- ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement