Home > Enterprise >  Why do I get db syntax errors with variable names like Dec or Neg?
Why do I get db syntax errors with variable names like Dec or Neg?

Time:11-24

Why did i have this problem in my asm program? "syntax error : db" in line 10 "syntax error : db" in line 11

.386
.model flat, stdcall
option casemap: none

include C:\masm32\include\windows.inc
include C:\masm32\include\kernel32.inc
includelib C:\masm32\lib\kernel32.lib

.data
Dec db 65
Neg db -160
.data?

.code
start:

mov eax, 0
xor eax, 0

end start

I wanted to run my asm program, but i get this.

CodePudding user response:

Both dec and neg are names of instructions, so your assembler considers them as reserved words and won't let you use them as label names. You'll just have to name them something else. (Simply putting an underscore in front or after should be enough to allow you to use those names if you really wanted to.)

  • Related