flat assembler
Message board for the users of flat assembler.

Index > Main > How to handle define and EQU ?

Author
Thread Post new topic Reply to topic
shutdownall



Joined: 02 Apr 2010
Posts: 518
Location: Munich
shutdownall
I want to write some useful definitions in my source and have a problem resolving EQU's.

I want to make some EQU in my source and check them with "if defined" but don't have success.

Here my definition:

Code:
MEM_1K:

if defined MEM_1K
   MEMAVL  EQU     1024
end if
if defined MEM_2K
 MEMAVL  EQU     2048
end if
if defined MEM_4K
 MEMAVL  EQU     4096
end if
if defined MEM_8K
 MEMAVL  EQU     8192
end if
    


This does not work. I don't know why.
I always get MEMAVL=8192 when defined the label MEM_1K first.
Anyway there is no define at all for MEM_8K.

So how can this be handled in an easy way ?
I just want to define the available memory at start of program.
And there is a check done at end of the program which works fine with assert (when MEMAVL set correctly).

Code:
assert ($-MEMST)<MEMAVL
    


I just want to have a definition of available/allowed config fields.
I don't like to write simply MEMAVL EQU 32768 for example.
Is there a chance to get this under fasm ? Very Happy
Post 16 Dec 2012, 22:45
View user's profile Send private message Send e-mail Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3500
Location: Bulgaria
JohnFound
Use "=" instead of "equ". For all numeric constants always use "=" and never "equ"
"equ" is preprocessor directive, while "if" is assembly stage directive.
Post 16 Dec 2012, 23:30
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
shutdownall



Joined: 02 Apr 2010
Posts: 518
Location: Munich
shutdownall
Okay - thanks for this hint.
Now it is working.
Post 17 Dec 2012, 00:44
View user's profile Send private message Send e-mail Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar.

Powered by rwasa.