我一直在学习《汇编语言循序渐进:第三版》,并且正在阅读最后一章“走向 C”。我试图获得一种一致的方法来转换 32 位代码,该代码puts在我的 64 位 Ubuntu 系统上调用 C 库 (glibc) 函数。(我想继续阅读本文的最后 50 页,这些内容可能会更深入地探讨 C [更多极客双关语],但来自用 32 位代码编写的汇编基础)。代码是:
SECTION .data ; Section containing initialised data
EatMsg: db "Eat at Joe's!",0
SECTION .text ; Section containing code
extern puts ; Simple "put string" routine from clib
global main ; Required so linker can find entry point
main:
push ebp ; Set up stack frame for debugger
mov ebp,esp
push ebx ; Must preserve ebp, ebx, esi, & …Run Code Online (Sandbox Code Playgroud)