user8388653
user8388653

Reputation:

nasm "error: comma, colon, decorator or end of line expected after operand"

I'm on Debian 9. These are the errors:

andrea@debian:~/Assembly/sandbox$ nasm -f elf -g -F stabs sandbox.asm
sandbox.asm:8: error: comma, colon, decorator or end of line expected after operand
sandbox.asm:9: error: comma, colon, decorator or end of line expected after operand
sandbox.asm:11: error: comma, colon, decorator or end of line expected after operand
sandbox.asm:12: error: comma, colon, decorator or end of line expected after operand

This is the code:

section .data
section .text

global _start

_start:
    nop
    mov eax 10
    mov ebx 12

    mov eax 1
    mov ebx 0
    int 80H
    nop

section .bss

What's the problem causing these errors and how can I fix it?

If I use the following code where I fix the commas between operands I get a different error:

section .data
section .text

    global_start

_start:
    nop
    mov eax,10
    mov ebx,12

    mov eax,1
    mov ebx,0
    int 80H
    nop

section .bss

The error I get is:

sandbox.asm:4: warning: label alone on a line without a colon might be in error

Why do I get this error and how can I fix it?

Upvotes: 0

Views: 1800

Answers (1)

Lukasz M
Lukasz M

Reputation: 5723

I suppose there is a space missing and it should be:

global _start

in line 4.

I also suspected that the hexadecimal constant may be in incorrect format, because of missing 0 prefix, but it should be ok as long as the number starts with a digit, as Michael Petch mentioned in the comments (and according to the documentation of NASM available here: http://www.nasm.us/doc/nasmdoc3.html).

Upvotes: 3

Related Questions