There is a difference with fasm and tasm (ideal).
in tasm, I can write

Struc tStatic
hz dd ?
endS

ChainOfStatic db 20000 dup (?)

and than in program
....
mov edi,offset ChainOfStatic
mov ,eax ;fill 1st object field
add edi,SIZE tStatic
mov ,eax ;2nd object

in this case I fill the "Chain" with "Objects".

In FASM
struc tStatic
{.hz dd 0}

....
mov ,eax ;-fails with error
mov .tStatic.hz,eax ;same rez

How it must be?
Posted on 2003-05-08 01:01:14 by Zet
Peoples! No one solved this problem? It can be done also as

struc tStatic
{.hz dd ?}
vStatic tStatic virtual at 0 (or same)

than next edi+vStatic.hz -works, but this method is dirty, because of doubling t->v.

Is where better solution?
Posted on 2003-05-09 00:56:02 by Zet
howsit,



mov edi,ChainOfStatic

virtual at edi
tStatic tStatic_
end virtual

mov [tStatic.hz],eax


i think this works fine.
Posted on 2003-05-09 03:39:48 by keyoke
Standard solution:




struc tStatic {
.hz dd 0
}

virtual at 0
tStatic tStatic ; FASM allows the same name for structures and labels
end virtual

....
mov [edi+tStatic.hz],eax ; works :)
mov [edi].tStatic.hz,eax ; error :(



There is standard macro: "struct", so if you want to use it:



struc tStatic {
.hz dd 0
}

struct tStatic
....
mov [edi+tStatic.hz],eax
Posted on 2003-05-09 07:02:59 by JohnFound
Privalov, just a little suggestion to the structure syntax. When you declare a structure, you can choose to add params so that you can decide the structures init-values... But if you have added support for this in your structure-declaration, you can't drop the params. Wouldn't it be better if you could do both of it?

Example:

struc RECT left,top,right,bottom
{
.left dd left
.top dd top
.right dd right
.bottom dd bottom
}

rc1 RECT 1,2,3,4 ; this works
rc2 RECT ; but this doesn't

And maybe the sizeof.x constant should be automatically declared when you declare a stucture (I mean inside FASM, not by using macros)...

Take care (and sorry my English)!
Posted on 2003-05-09 07:35:25 by Tommy
Hi Tommy:



struc ddc param { ; conditional 'dd'
if ~param eq
dd [param]
else
dd ?
}

struc RECT left,top,right,bottom
{
.left ddc left
.top ddc top
.right ddc right
.bottom ddc bottom
}

rc1 RECT 1,2,3,4 ; this works
rc2 RECT ; this works too
Posted on 2003-05-09 07:50:39 by JohnFound
Yes, thanks! Fasm is very flexible by using macros, but wouldn't it be better to add this feature to the assembler itself? You know, when we add macro by macro to solve our problems, the compilation process will require more and more time... Since we have the sources and Privalov :), it shouldn't be any problem to add this feature - to make Fasm faster in cases which require this syntax.....

So long!
Posted on 2003-05-09 08:22:17 by Tommy
BTW, without any changes to fasm and without using macroses you can simply use:

rect1 RECT ?,?,?,?

And I think this will be most "assembly like" style. ;)

IMHO: Only "struct" macro must be implemented directly to FASM. I never saw "struc" defined without "virtual at 0" definition and without "sizeof." definition. So, this will be usable to be implemented in FASM.
Posted on 2003-05-09 11:42:37 by JohnFound
Thanks for replies, solved )
top close.
Posted on 2003-05-12 00:39:47 by Zet