Author Topic: unexpecting scalar type  (Read 12150 times)

nobody

  • Guest
unexpecting scalar type
« 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

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: unexpecting scalar type
« Reply #1 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