I am using NASM, x86 and it give me this error and I don't understand why
%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
mov ebx,countprobably expecting theebxto load the value 13, but in NASM the memory value must be in brackets, so this will instead store memory addresscountintoebx, not the value from memory. Not sure which tutorial/book you use, but you will either put more effort in the beginning to not just learn x86 asm, but also to learn to recognize MASM vs NASM (small) syntax differences and fix them, or you should switch book or the assembler. All of those options sounds OK (maybe even try all!). - Ped7g