flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > Determine whether 32bit or 64bit is used

Author
Thread Post new topic Reply to topic
yoshimitsu



Joined: 07 Jul 2011
Posts: 96
yoshimitsu
I'd like to write a macro which includes a corresponding file depending on the generated code like
Code:
if use32
  include '32bitfile'
else if use64
  include '64bitfile'
end if    

Is there an official way for this or do I have to use a virtual-trick like
Code:
local x64
virtual
 nop [eax]
 load x64 from $$
 if x64 = 67h
  x64 = 1
 else
  x64 = 0
 end if
end virtual

if x64
 display '64bit'
else
 display '32bit'
end if    


Last edited by yoshimitsu on 28 Apr 2012, 22:26; edited 1 time in total
Post 28 Apr 2012, 21:34
View user's profile Send private message Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3502
Location: Bulgaria
JohnFound
There is no official way. But IMHO the trick with virtual is OK.
Post 28 Apr 2012, 22:12
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr
yoshimitsu,

Probably somewhat quirky solution can be found there. Note that your mix of preprocessor's and interpreter's directives going to include both files.

Unless you're cross-compiling, include "%Processor_Architecture%.finc" with properly defined x86.finc and such will fit the bill.
Post 02 Jun 2012, 21:37
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17664
Location: In your JS exploiting you and your system
revolution
baldr wrote:
Note that your mix of preprocessor's and interpreter's directives going to include both files.
Yes, both files are included but they are still assembled within the if/else/end if context. This may or mat not work depending upon the exact contents of the two files.
Post 02 Jun 2012, 22:16
View user's profile Send private message Visit poster's website 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.