flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > source code configuration

Author
Thread Post new topic Reply to topic
llaurrentt



Joined: 02 Nov 2006
Posts: 13
Location: Liège / Belgium
llaurrentt 04 Nov 2006, 09:40
Hi, is the a way to test the (current) mode of FASM, i mean is it possible to know at compile time (and possibly test it for conditional assembly) if FASM is assembling in 16, 32 or 64 bits mode or producing a flat binary, coff, elf32 or elf64.
Post 04 Nov 2006, 09:40
View user's profile Send private message MSN Messenger Reply with quote
coconut



Joined: 02 Apr 2004
Posts: 326
Location: US
coconut 04 Nov 2006, 15:23
well that depends on your chosen format. if you specify format pe then 32 bit, format pe64 64 bit, format mz 16 bit, etc. if no format is specified then flat binary file is produced in 16 bit (well check the manual i believe its 16 bit)
Post 04 Nov 2006, 15:23
View user's profile Send private message Reply with quote
llaurrentt



Joined: 02 Nov 2006
Posts: 13
Location: Liège / Belgium
llaurrentt 04 Nov 2006, 15:31
coconut wrote:
well that depends on your chosen format. if you specify format pe then 32 bit, format pe64 64 bit, format mz 16 bit, etc. if no format is specified then flat binary file is produced in 16 bit (well check the manual i believe its 16 bit)


You did not understand me, I want to do some conditional based on these informations, like in the imaginary following sample:

Code:
if use16
   mov ax, value
else
   if use32
      mov eax, value
   else
      if use64
         mov rax, value
      end if
   endif
end if
    
Post 04 Nov 2006, 15:31
View user's profile Send private message MSN Messenger Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 04 Nov 2006, 16:45
Copy the idea of Win32axp.inc
Code:
virtual at 0

 xchg eax,eax

 detected_16bit = $-1

end virtual



if detected_16bit

 format PE GUI 4.0

end if    


However I don't know how to detect the current format, just the current mode. Maybe using a macro named "format"? Sorry I'm in the middle of a Gentoo instalation so I can't test the posibility now Razz
Post 04 Nov 2006, 16:45
View user's profile Send private message 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.