flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > arrays in struct question

Author
Thread Post new topic Reply to topic
IronFelix



Joined: 09 Dec 2004
Posts: 141
Location: Russia, Murmansk region
IronFelix 28 Mar 2009, 16:57
Hi all!
Please tell me, is it possible to make array of structures in other structure, something like this:
Code:
struct RECTS

 rects RECT [10] 

ends

 ; something to work like this:

struct RECTS
 
 rects RECT
       RECT
       RECT
       ; ... according to count

ends    


Thanks.

_________________
Flat Assembler is the best!
Post 28 Mar 2009, 16:57
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 28 Mar 2009, 17:33
The way I know is this one:
Code:
struct rects
  rect rb 10*sizeof.RECT
ends    


Don't know if there is something better.
Post 28 Mar 2009, 17:33
View user's profile Send private message Reply with quote
IronFelix



Joined: 09 Dec 2004
Posts: 141
Location: Russia, Murmansk region
IronFelix 28 Mar 2009, 18:04
Thank you, LocoDelAssembly. Next code work as i need, but don't know, how to apply it to struct:
Code:
 struc CHAR init
 {
  DONE equ NO
  match , init \{ . db ? \}
  match [count] , init
  \{
   . db ?
   repeat count - 1
    db ?
   end repeat
   restore DONE
   DONE equ YES
  \}
  match =NO any , DONE init \{ . db init \}
  restore DONE
 }

 virtual at 0
  CHAR CHAR
  sizeof.CHAR = $
 end virtual

 struc A
 {
  .bytearr CHAR [10]
 }

 virtual at 0
  A A
  sizeof.A = $
 end virtual

 a A

 ; next work correct
 mov eax,A.bytearr
 mov al,[a.bytearr]
 mov eax,sizeof.CHAR
 mov eax,sizeof.A              


Is it possible to extend struct with such thing?
Post 28 Mar 2009, 18:04
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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.