【发布时间】:2011-10-17 17:18:46
【问题描述】:
我正在尝试在 linux 上的 nasm 程序集中打印一个数字整数。我目前的编译很好,但没有任何内容被写入屏幕。谁能向我解释我在这里做错了什么?
section .text
global _start
_start:
mov ecx, 1 ; stores 1 in rcx
add edx, ecx ; stores ecx in edx
add edx, 30h ; gets the ascii value in edx
mov ecx, edx ; ascii value is now in ecx
jmp write ; jumps to write
write:
mov eax, ecx ; moves ecx to eax for writing
mov eax, 4 ; sys call for write
mov ebx, 1 ; stdout
int 80h ; call kernel
mov eax,1 ; system exit
mov ebx,0 ; exit 0
int 80h ; call the kernel again
【问题讨论】:
-
您将 eax 分配给 ecx,然后是 4。它可能就在那里。