The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: Jeff on May 20, 2005, 11:31:41 PM

Title: declaring nested structures with DUP
Post by: Jeff on May 20, 2005, 11:31:41 PM
hello,
im having trouble declaring this array of structures.  the assembler keeps giving me the error: "error A2177: nested structure improperly initialized" for this portion of code:
POSITION STRUCT
    X WORD ?
    Y WORD ?
POSITION ENDS

MOVER STRUCT
    Keys POSITION 12 DUP(<>)
    NumKeys WORD ?
MOVER ENDS

.DATA?
pole POSITION 20 DUP(<>)
car MOVER 10 DUP(<>)                ;A2177


i cant figure out how to get it done since MSDN's reference isnt very helpful.  could you guys help me out?
Title: Re: declaring nested structures with DUP
Post by: MazeGen on May 21, 2005, 11:34:44 AM
Hello,
try DUP (?) instead of DUP(<>).
Title: Re: declaring nested structures with DUP
Post by: Jeff on May 21, 2005, 05:46:15 PM
unfortunately, it isnt that simple.  i want the variable "car" to reference an array of "MOVER" structures (multiple cars) which each also contains an array of "POSITION" structures.

i cant use DUP (?) since im trying to declare structures.  of course i could manually initialize each individual structure but i just cant see why i cant use DUP.


car MOVER <>,<>,<>,<>,<>,<>,<>,<>,<>,<>     ;works
car MOVER 10 DUP(<>)                        ;A2177
Title: Re: declaring nested structures with DUP
Post by: MichaelW on May 22, 2005, 12:12:01 AM
Hi Jeff,

Using individual initializers was the only thing I could find that would work. The MASM Programmer's Guide does not seem to cover nested structure arrays:

http://webster.cs.ucr.edu/Page_TechDocs/MASMDoc/ProgrammersGuide/Chap_05.htm

Title: Re: declaring nested structures with DUP
Post by: Jeff on May 22, 2005, 03:24:27 AM
yeah, thanks guys.  ive been reading through the reference and programmers guide for anything on declaring nested structures/unions and arrays of structures/unions but it never went over structures/unions with an array of structures.  its just very inconvenient to not be able to have a true array of these.

and, if anyone's interested, http://www.visualassembler.com/ has both guides as pdfs available for download.  (both containing all graphics in the manual and not grayed out)  scroll to the bottom.