我正在嘗試在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 –