flat assembler
Message board for the users of flat assembler.

Index > Main > public symbols

Author
Thread Post new topic Reply to topic
hg



Joined: 24 Jan 2006
Posts: 10
hg 25 Jan 2006, 11:28
I'm trying to convert code which worked in masm to fasm.

Here is an example of such a problem:

Code:
format MS COFF

public A

section '.data' data readable writeable

my_data db 000h,000h,000h,000h,000h,000h,000h,000h,000h,000h
A equ my_data + 4    

The idea is to have a data area and specify a public name in the middle of it.

Is this possible with fasm or do I have to break my data into smaller pieces and create traditional labels?

Thanks in advance.

-- Henrik


Last edited by hg on 25 Jan 2006, 12:28; edited 1 time in total
Post 25 Jan 2006, 11:28
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 25 Jan 2006, 12:22
hg: use <code> tags (with [] insted of <>) to make your code examples more readable
Post 25 Jan 2006, 12:22
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8356
Location: Kraków, Poland
Tomasz Grysztar 25 Jan 2006, 13:37
Use = instead of EQU:
Code:
A = my_data + 4    

In general, use = for addresses and numbers, while EQU for text substitutions (which don't apply backwards).
For more details I suggest reading the sections 2.2.1 and 2.3.2 of fasm's manual.
Post 25 Jan 2006, 13:37
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 25 Jan 2006, 13:44
And for readability: if you use symbol (A) as a numeric constant use "=", but if you are using it as a label (placeholder for somewhere in your program) use "label A dword at my_data+4"
Post 25 Jan 2006, 13:44
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number 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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.