There is a code:

X STRUC UNION STRUC A1 BYTE ? BYTE ? BYTE ? ENDS STRUC A2 WORD ? WORD ? WORD ? ENDS STRUC A3 DWORD ? DWORD ? DWORD ? ENDS ENDS X ENDS 

How do I set a variable with initialized values? If I write this:

 ZX <{<1,2,3>}> 

Then I get 3 elements of type BYTE (from structure A1). And if I want it to be not bytes, but DWORDs (i.e., initialize the values ​​of the A3 structure), how can I write this?

In TASM, you can write this:

 X STRUC UNION STRUC DB ? DB ? DB ? ENDS STRUC DW ? DW ? DW ? ENDS STRUC DD ? DD ? DD ? ENDS ENDS X ENDS ZX <<?,?,<1,2,3>>> 

But in MASM32 so not a ride. How then ???

  • EMNIP, in MASM, you can initialize only the first element of the union. That is, in your case, simply swap the structures. But this needs to be clarified in the documentation (actually, isn't it there?) - PinkTux
  • There are a lot of things written in the documentation, but specifically about this I found only "For unions," :( people.sju.edu/~ggrevera/arch/references/MASM61PROGUIDE.pdf - Jin X
  • Well, this is it. If the first to put the structure with dd , then ZX <<1,2,3>> or something like that (neither masm nor winds in the household have been around for a long time to check). - PinkTux

0