程序集x86子程序参数

时间:2017-11-28 13:19:28

标签: assembly x86 nasm calling-convention

我的问题是,我不懂print_string和read_int参数。我读了其他问题,我理解了如何在堆栈上推送参数。我没有看到这里发生的事情。 print_string有一个参数是有意义的,它在eax中。我已经读过维基百科文章x86调用约定,参数可以在寄存器中传递。

如果有人可以解释哪些参数同时兼顾了原因,我会很感激。谢谢。

_asm_main:

enter   0,0 
pusha
mov eax, prompt
call    print_string
call    read_int
mov [input], eax

print_string:

enter   0,0
pusha
pushf
push    eax
push    dword string_format
call    _printf
pop ecx
pop ecx

popf
popa
leave
ret

和 read_int:

enter   4,0
pusha
pushf
lea eax, [ebp-4]
push    eax
push    dword int_format
call    _scanf
pop ecx
pop ecx

popf
popa
mov eax, [ebp-4]
leave
ret

0 个答案:

没有答案
相关问题