News:

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

preinitialised array of structs format

Started by RedXVII, August 07, 2006, 09:37:07 PM

Previous topic - Next topic

RedXVII

I thaught it would be

myrect   RECT   3 dup (<0,0,10,10>, <0,0,20,20>, <10,10,20,20>)

or something but then i realised dup probably means duplicate which means serious problems.

it doesnt like me, wont compile, anyone here know the correct format?

Cheers  :U

Phoenix

How about this?
myrect   RECT   <0,0,10,10>
         RECT   <0,0,20,20>
         RECT   <10,10,20,20>

TNick

RedXVII,

Quotemyrect   RECT   3 dup (<0,0,10,10>, <0,0,20,20>, <10,10,20,20>)

is OK. What dup does is to duplicate whatever is inside ( ).

So, when you say:
MyDWArray       DWORD       30    dup    (10)
you will have in your data section 30 DWORD wich will look like this: 00 00 00 0A (in reverse order, of course)

when you say
MyDWArray       DWORD       30    dup    (10, 16)
you will have in your data section 15 QWORD wich will look like this: 00 00 00 0A  00 00 00 10

finally, when you say
MyRectArray     RECT    8     dup    (<10,10,100,100>,<20,20,200,200>)
you will have 8 RECT structures, half of them looking like the first member, and half like the second member

Of course, what Phoenix is saing is correct, and look better in your file.

I hope you get the point.
:U
Best regards,
Nick

RedXVII

Thanks for that, I get it now.  :bg

Sorted - Cheers  :U