NASM - The Netwide Assembler

NASM Forum => Using NASM => Topic started by: nobody on July 01, 2005, 11:26:58 AM

Title: unexpecting scalar type
Post by: nobody on July 01, 2005, 11:26:58 AM
an example:

data segment
  var1 db 5
  var2 db var1 ; this line is not compile
data ends

why the compiler could not get the value of var1 and put into the var2?
i need the deepest explain you can give.
thanks from eden
Title: Re: unexpecting scalar type
Post by: Frank Kotler on July 01, 2005, 12:42:55 PM
Hi Eden,

What syntax is that??? Try:

section .data
var1 db 5
var2 dd var1

An address won't fit into a byte. (dw is enough for var2 if this is 16-bit code)

If you're getting errors about "scalar value", it's because a label/variable is a relocatable value. Try "var1 - $$", or some difference between two labels, if you're getting that error.

What are you trying to do, anyway?

Best,
Frank