NASM - The Netwide Assembler

NASM Forum => Programming with NASM => Topic started by: xparmenides on January 22, 2016, 04:41:06 PM

Title: Expression error while compiling
Post by: xparmenides on January 22, 2016, 04:41:06 PM
Hi all,
    The following expression calculates a segment's address by shifting its start address 4 bits left:
                       code_entry   dd (section.code_1.start)<<4
I think the 'section.code_1.start' is a constant address. So, it is valid to shift it. But, there is an error while compiling:
                        error: shift operator may only be applied to scalar values
The 'section.code_1.start' should be a 'scalar value'. Why the expression can not be calculated?

Thanks.
 
Title: Re: Expression error while compiling
Post by: Frank Kotler on January 22, 2016, 08:07:35 PM
Nasm apparently does not agree that "section.code_1.start" is a scalar value. While "segment" is an alias for "section", flat binary format (I ASSume this is flat binary) doesn't have "real segments". I'm guessing that "section.code_1.start" may be the value you want without shifting it left. I may be confused. Get back to me if you think I am.

Best,
Frank