我正在学习x86_64汇编,并编写一个简单的代码来打印字符串的各个字母。我知道如何打印整个字符串,但是为什么在尝试显示单个字母时却没有输出?
代码:
global _start
section .data
msg db 'Hello!', 0x0a
len equ $ - msg
section .text
_start:
mov eax, 4
mov ebx, 0
loop1:
mov ecx, dword [msg+ebx]
mov edx, 1
int 0x80
cmp ebx, dword len
jg exit
add ebx, 1
jmp loop1
exit:
mov eax, 1
mov ebx, 0
int 0x80