我正在尝试在linux上的nasm程序集中打印单个数字的整数。我目前编译的很好,但没有任何内容正在写入屏幕。任何人都可以向我解释我在这里做错了什么?NASM Linux程序集打印整数
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.它可能在那里。 – Josh
[如何在组件NASM中打印数字?](http://stackoverflow.com/questions/8194141/how-to-print-a-number-in-assembly-nasm)可能的重复相关:http:// stackoverflow.com/questions/4117422/more-efficient-way-to-output-an-integer-in-pure-assembly –