News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

FASM vs MASM style structure reference

Started by johnsa, April 01, 2009, 02:23:08 PM

Previous topic - Next topic

johnsa

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 ;)

johnsa

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?

BlackVortex

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.

johnsa

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.

farrier

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

It is a GOOD day to code!
Some assembly required!
ASM me!
With every mistake, we must surely be learning. (George...Bush)