在 DOS 汇编中我们可以这样做:
mov dl, 41h
mov ah, 02h
int 21h
但是 Linux nasm x86 汇编怎么样?
最佳答案
section .data
msg db 'H'
len equ $ - msg
section .text
global _start
_start:
mov edx,len
mov ecx,msg
mov ebx,1 ;file descriptor (stdout)
mov eax,4 ;system call number (sys_write)
int 0x80
mov eax,1 ;system call number (sys_exit)
int 0x80
写入单个字符可能不会产生所需的输出,因为根据终端设置,它可能会被缓存,因此您可能需要刷新输出,以确保它出现在您写入的任何地方。
这是 linux 32 Bit system calls 的列表.
关于linux - 如何打印单个 ASCII 字符?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20466018/