[英]Why can't I print numbers in assembly?
I have my code right but linux won't print the ascii character that I specify 我的代码正确,但是linux不会打印我指定的ascii字符
I haven't tried much else because my code is right, and I followed a tutorial. 我没有做太多尝试,因为我的代码是正确的,并且我遵循了一个教程。
mov rcx, [digitSpacePos]
mov rax, 1
mov rdi, 1
mov rsi, rcx
mov rdx, 1
syscall
It's supposed to print 123 because digitSpace is 123 but it's printing nothing. 它应该打印123,因为digitSpace是123,但是什么也不打印。
This should work: 这应该工作:
global _start
section .data
message: db "123", 10 ; note the newline at the end
section .text
_start: mov rax, 1 ; system call for write
mov rdi, 1 ; file handle 1 is stdout
mov rsi, message ; address of string to output
mov rdx, 4 ; number of bytes
syscall ; invoke operating system to do the write
mov rax, 60 ; system call for exit
xor rdi, rdi ; exit code 0
syscall ; invoke operating system to exit
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.