The MASM Forum Archive 2004 to 2012

General Forums => The Workshop => Topic started by: johnsa on April 01, 2009, 02:23:08 PM

Title: FASM vs MASM style structure reference
Post by: johnsa on April 01, 2009, 02:23:08 PM
Hey all,
I know this is a masm forum.. but I've recently been using FASM too and the one thing I really love in MASM which I haven't been able to get right in FASM is the following syntax to access data/structures:

mov eax,(MyStructureType PTR [edi]).member

Obviously this doesn't work in FASM, does anyone know a similar type of syntax for FASM? Google and the manual haven't been very helpful ;)
Title: Re: FASM vs MASM style structure reference
Post by: johnsa on April 01, 2009, 02:29:20 PM
Ok I found it...

mov eax,[edi+MyStructureType.member]

that works... however, RADASM doesn't pickup the autocomplete due to the structure being declared as:

struct MyStructureType
val dd 0
ends

instead of:

MyStructureType struct
val dd 0
ends

Is there a way to get RADASM to pickup both?
Title: Re: FASM vs MASM style structure reference
Post by: BlackVortex on April 01, 2009, 03:05:41 PM
I see in Radmasm's page that the ASM programming pack also supports fasm. You need to specify fasm instead of masm in its ini file.
Title: Re: FASM vs MASM style structure reference
Post by: johnsa on April 02, 2009, 07:58:06 AM
Ok I eventualllly got it right... the steps are:

Use the fasm.ini file
in your fasm code include the struct macro file to support more classic struc style as follows:

include 'c:/fasm/include/macro/struct.inc'            ; FASM Structures.

Then you can declare structures using
struc NAME
member dd ?
ends

then you need to update the main ini file for struct members and code blocks to support the name post identifier and an ends without a name.. and it all comes together.
Title: Re: FASM vs MASM style structure reference
Post by: farrier on April 02, 2009, 11:49:05 AM
johnsa,

Concerning the structure question:

One of the many uses of virtual

struc MyStructureType
      val dd 0
ends

mov   edi, "address of MyStructureType"
virtual at edi
   myStruc   MyStructureType
end virtual

mov eax, [myStruc.val]


hth,

farrier