问题描述
我知道如何打印字符串,但上打印整数的文档是出奇的稀少。我甚至不知道我的问题是正确的。
I know how to print a string, but the documentation on printing integers is surprisingly scarce. I'm not even sure if my question is right.
推荐答案
如果你能对C库链接,你可以调用的printf
功能。在大多数x86系统,可变参数的函数使用 CDECL
调用约定 - 参数推右堆栈上向左(所以,第一寄存器的值,则包含字符串%d个
),和你有调用后清理堆栈(添加到%ESP
)。
If you can link against the C library, you could call the printf
function. On most x86 systems, variadic functions use the cdecl
calling convention - arguments are pushed on the stack from right to left (so, first the register value, then the string containing %d
), and you have to clean up the stack (add to %esp
) after the call.
有关详细信息,请注明你在(什么系统,如果你不能对C库链接,你需要手动生成字符串将其转换成你想在打印任何基地。
For more details please specify what system you're on (and if you can't link against the C library, you'll need to generate a string by hand to convert it into whatever base you want to print in.
这篇关于如何打印一个寄存器的内容在x86汇编到控制台?我运行Linux的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!