Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/assembly/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Assembly db、mov、字符串文字_Assembly_Nasm - Fatal编程技术网

Assembly db、mov、字符串文字

Assembly db、mov、字符串文字,assembly,nasm,Assembly,Nasm,信息中的以下说明:正确吗?具体来说,因为“Hello,World”总共是12字节,所以右操作数有“10” 我想知道这是否是一个错误。如果不是,为什么它指定10作为右操作数?我从这里得到了这个代码:() 另外,在mov-rdx中,13为什么指定13个字节而不是消息的实际大小 global _start section .text _start: ; write(1, message, 13) mov rax, 1 ; system c

信息中的以下说明:
正确吗?具体来说,因为“Hello,World”总共是
12
字节,所以右操作数有“10”

我想知道这是否是一个错误。如果不是,为什么它指定10作为右操作数?我从这里得到了这个代码:()

另外,在
mov-rdx中,13
为什么指定13个字节而不是
消息的实际大小

    global _start

    section .text
_start:
    ; write(1, message, 13)
    mov     rax, 1            ; system call write is 1
    mov     rdi, 1            ; 1 is stdout
    mov     rsi, message      ; address of string
    mov     rdx, 13           ; number of bytes
    syscall           ; invoke operating system call

    ; exit(0)
    mov eax, 60       ; system call 60 is exit
    xor rdi, rdi      ; exit code 0
    syscall           ; invoke exit
message:
    db  "Hello, World", 10
如果不是,为什么它指定10作为右操作数

10是字符串后面的换行符。ASCII中的10是LF(换行符),在Unix/Linux系统中是换行符

为什么它指定了13个字节而不是消息的实际大小

13字节是消息的大小(12字节)加上换行符(1字节)