flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > rva macro

Author
Thread Post new topic Reply to topic
mindcooler



Joined: 01 Dec 2009
Posts: 423
Location: Västerås, Sweden
mindcooler
I can't find the definition of rva. I need something like this:

Code:
imgbase = $400000

org imgbase

macro rva address
{
   address-imgbase
}

dd rva needrvaofthislabel <---- Error: Invalid expression

...

needrvaofthislabel:    

_________________
This is a block of text that can be added to posts you make.
Post 12 Jun 2010, 05:00
View user's profile Send private message Visit poster's website MSN Messenger ICQ Number Reply with quote
Tyler



Joined: 19 Nov 2009
Posts: 1216
Location: NC, USA
Tyler
The definition:("rva" is also mentioned in the COFF and ELF sections of the manual)

The rva operator can be used inside the numerical expressions to obtain the RVA of the item addressed by the value it is applied to.

I wish I could explain it, but I don't know what an RVA is.
Post 12 Jun 2010, 05:25
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
RVA only makes sense in context of PE file (and is used for similar purpose in ELF shared library IIRC). Not in pure binary.

What you want is called "inline macro", and FASM doesn't support it. Search forum for more info.
Post 12 Jun 2010, 11:13
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
mindcooler



Joined: 01 Dec 2009
Posts: 423
Location: Västerås, Sweden
mindcooler
vid wrote:
RVA only makes sense in context of PE file (and is used for similar purpose in ELF shared library IIRC). Not in pure binary.


Well, it IS in the context of a PE file. A pure binary one.

Quote:

What you want is called "inline macro", and FASM doesn't support it. Search forum for more info.


So I'd have to do like this to achieve desired effect?

Code:
macro dwrva address
{
   dw address-imgbase
}

macro ddrva address
{
   dd address-imgbase
}  

macro orgup n,level
{
   org (((n+(level-1))/level)*level)
}    

_________________
This is a block of text that can be added to posts you make.
Post 12 Jun 2010, 13:43
View user's profile Send private message Visit poster's website MSN Messenger ICQ Number Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
Quote:
So I'd have to do like this to achieve desired effect?

Basically, yes.

However, it might be easier for typing & maintenace to overload every data directive using some form of "irp" with a common macro that checks for pseudo-operator (probably not "rva", as it is an existing operator already). Sorry, no time to write one right now.
Post 13 Jun 2010, 21:22
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
mindcooler



Joined: 01 Dec 2009
Posts: 423
Location: Västerås, Sweden
mindcooler
Either that, or I can type somethingsomething-imgbase at a few places Razz
Post 13 Jun 2010, 21:25
View user's profile Send private message Visit poster's website MSN Messenger ICQ Number Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr
mindcooler,

If you like to stick with rva name syntax, rva equ -imgbase+ can be useful.
Post 13 Jun 2010, 21:54
View user's profile Send private message Reply with quote
mindcooler



Joined: 01 Dec 2009
Posts: 423
Location: Västerås, Sweden
mindcooler
baldr wrote:
mindcooler,

If you like to stick with rva name syntax, rva equ -imgbase+ can be useful.


That's nice, perhaps I'll go with such a solution.

_________________
This is a block of text that can be added to posts you make.
Post 14 Jun 2010, 02:14
View user's profile Send private message Visit poster's website 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-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.