I have been trying to learn x86 Assembly on Linux and this is my code:
.386
.model flat
.code
start PROC
mov eax, 100
add eax, 200
ret
start endp
end start
whenever I try to compile it with nasm, like this:
nasm -f elf32 -o <filename>.o <filename>.asm
ld -m elf_i386 -o <filename> <filename>.o
I get this error:
simple.asm:1: warning: label alone on a line without a colon might be in error [-w+orphan-labels]
simple.asm:1: error: attempt to define a local label before any non-local labels
simple.asm:2: error: attempt to define a local label before any non-local labels
simple.asm:2: error: parser: instruction expected
simple.asm:3: warning: label alone on a line without a colon might be in error [-w+orphan-labels]
simple.asm:3: error: attempt to define a local label before any non-local labels
simple.asm:4: error: parser: instruction expected
simple.asm:9: error: symbol `start' redefined
simple.asm:9: error: parser: instruction expected
simple.asm:10: error: parser: instruction expected
Why do I get that error? is it the compiler or the code? and how to fix it?