error: comma, colon, decorator or end of line expected after operand
我正在使用NASM,x86,它给了我这个错误,我不明白为什么
%include "io.inc"
section .data
msg: db "hello world",0
msg2: db 13
count: dw 13
section .text
extern printf
global CMAIN
CMAIN:
push ebp
mov ebp,esp
mov eax,msg
mov ebx,count
mov esi,0
mov edi,0
add edi,count
dec edi
again:
mov eax, msg[esi]
mov msg2[edi],eax
inc esi
dec edi
loop again
call printf
mov esp,ebp
pop ebp
ret
Because those two lines are not in NASM syntax.
The mov eax, msg[esi] is almost parsed as mov eax,msg (load eax with address of msg ), but then unexpected [esi] happens instead of new line.
The mov msg2[edi],eax is hard to guess, what it is like for parser ( mov immediate,eax doesn't exist), but nothing legal either.
If you want to work with memory values, put whole address calculation inside brackets, like:
mov eax, [msg+esi]
mov [msg2+edi], eax
See NASM documentation - 3.3 Effective Addresses for full syntax of memory operands.
链接地址: http://www.djcxy.com/p/86848.html上一篇: 与GCC 5.4.0一起昂贵的跳跃
