-
Notifications
You must be signed in to change notification settings - Fork 10
/
echo.asm
26 lines (21 loc) · 858 Bytes
/
echo.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
global _main
extern _printf
section .text
_main:
mov ecx, [esp+4] ; argc
mov edx, [esp+8] ; argv
top:
push ecx ; save registers that printf wastes
push edx
push dword [edx] ; the argument string to display
push format ; the format string
call _printf
add esp, 8 ; remove the two parameters
pop edx ; restore registers printf used
pop ecx
add edx, 4 ; point to next argument
dec ecx ; count down
jnz top ; if not done counting keep going
ret
format:
db '%s', 10, 0