NASM-Tutorial
NASM-Tutorial copied to clipboard
A small mistake
In the section '入门', we have an assembly program hello.asm. It seems that there is a small mistake in the translation of comments:
; write(1, message, 13)
mov rax, 1 ; system call 1 is write
mov rdi, 1 ; file handle 1 is stdout
mov rsi, message ; address of string to output
mov rdx, 13 ; number of bytes
syscall ; invoke operating system to do the write
; exit(0)
mov eax, 60 ; system call 60 is exit
xor rdi, rdi ; exit code 0
syscall ; invoke operating system to exit
The translation are:
; write(1, message, 13)
mov rax, 1 ; 1号系统调用是写操作
mov rdi, 1 ; 1号文件系统调用是标准输出
mov rsi, message ; 输出字符串的地址
mov rdx, 13 ; 字符串的长度
syscall ; 调用系统执行写操作
; exit(0)
mov eax, 60 ; 60号系统调用是退出
xor rdi, rdi ; 0号系统调用作为退出
syscall ; 调用系统执行退出
Here are the suggestions:
- Change the comment on line XOR to '0作为程序返回值';
- The term '系统执行' is a little strange. It may be better to replace it with '系统调用'.