flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > Making Arrays of Struct in the Data section

Author
Thread Post new topic Reply to topic
kas



Joined: 16 Jan 2008
Posts: 36
Location: UK
kas
Hi,

I've been attempting to find a simple way to define arrays of structs in my data section.

Something equivalent to proc's:

Code:
local structarray[64]:MyStruct
    


but the way I've found described in the manual and on various forum pages to to the same for global data i.e.

Code:
bytearray db 64 dup (?)
    


doesn't seem to work with struc or struct. i.e....

Code:
structarray MyStruct 64 dup (?)
    


... fails.

Does anyone know how this should be done - or reasons why it can't be done.


Thanks in advance,

Kas.
Post 03 Nov 2010, 20:26
View user's profile Send private message Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7724
Location: Kraków, Poland
Tomasz Grysztar
There is actually a FAQ entry about this problem - look for "How to define an array of structures?".
Post 03 Nov 2010, 20:29
View user's profile Send private message Visit poster's website Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr
kas,

Search is now behave erratically, but Google helps: here it was.
Post 03 Nov 2010, 20:38
View user's profile Send private message Reply with quote
kas



Joined: 16 Jan 2008
Posts: 36
Location: UK
kas
Tomasz Grysztar wrote:
There is actually a FAQ entry about this problem - look for "How to define an array of structures?".


Thanks for replying so quickly. I had forgotten all about the FAQ sheet in Documentation. What I had been doing instead was reading and re-reading and re-reading the manual - and searching the forum for the past couple of days.

The problem within a problem (because I had already come across the rd sizeof.MyStruct*64 unitialised solution) - is that I want to initialise that struct and keep struct's nice dot naming. Hopefully the "rept" approach also mentioned in that FAQ will work. I'll try it out immediately.

Thanks again,

Kas.
Post 03 Nov 2010, 20:41
View user's profile Send private message Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7724
Location: Kraków, Poland
Tomasz Grysztar
kas wrote:
The problem within a problem (because I had already come across the rd sizeof.MyStruct*64 unitialised solution) - is that I want to initialise that struct and keep struct's nice dot naming. Hopefully the "rept" approach also mentioned in that FAQ will work.

You may try to do it like:
Code:
    rept 100 i { my#i MYSTRUC }    
This way you would get "my1", "my2" up to "my100" structures defined.
Post 03 Nov 2010, 20:46
View user's profile Send private message Visit poster's website Reply with quote
kas



Joined: 16 Jan 2008
Posts: 36
Location: UK
kas
Fantastic... I think that's the solution I've been trying to find.

Thank you again - and thank you Baldr for replying too.

Kas.
Post 03 Nov 2010, 20:55
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-2020, Tomasz Grysztar.

Powered by rwasa.