Here is my code
segment .data
; initialized data is put in the data segment here
;
segment .text
global main
main:
enter 0,0 ; setup stack frame
pusha
call func
;
;
;
;
popa
mov eax, 0 ;
leave ;
ret
func:
push ebp
mov ebp,esp
sub esp,4 ;this is for local variable
mov eax,dword [ebp+12]
call print_int
call print_nl
mov eax,dword [ebp+8]
call print_int
call print_nl
mov esp,ebp
pop ebp
ret
If I type command $./test 1 2 3
then, in stack
---------------
pointer to argv-------->ebp+12
---------------
argc -------->ebp+8
---------------
return address -------->ebp+4
---------------
saved ebp -------->ebp
---------------
it should print out 3(the number of argument) but there's only 0 in console.
what is wrong?