The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: shaldan on December 13, 2005, 11:00:17 AM

Title: Statement too complex question ..
Post by: shaldan on December 13, 2005, 11:00:17 AM
I would like to know the limitations in declaration. I would like to declare an array of floats for some geometry purposes to:


.data
kostka real4              -1.0,-1.0,1.0,1.0,-1.0,1.0,1.0,1.0,1.0,-1.0,
                               1.0,0.0 ...etc. etc.


but after 36th element of array I get error A2042: statement too complex. And the question is if is there a way to handle this without
storing these values in a file and read it from it ...

thanks ...
Title: Re: Statement too complex question ..
Post by: ramguru on December 13, 2005, 11:13:10 AM
Same rule for db same for any type

.data
    kostka real4 -1.0,-1.0,......,-1.0
           real4 -1.0,-1.0,......,-1.0
           real4 -1.0,-1.0,......,-1.0
           real4 -1.0,-1.0,......,-1.0
           real4 -1.0,-1.0,......,-1.0
Title: Re: Statement too complex question ..
Post by: shaldan on December 13, 2005, 11:34:28 AM
thank you .. actually I tried this before, but there is another problem. I would to use SIZEOF and when I declare:


kostka1     real4     -1.0,-1.0,1.0,1.0,-1.0,1.0,1.0,1.0,1.0
real4 -1.0,1.0,1.0,-1.0,-1.0,-1.0,-1.0,1.0,-1.0
real4 1.0,1.0,-1.0,1.0,-1.0,-1.0,-1.0,1.0,-1.0
real4 -1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,-1.0
real4 -1.0,-1.0,-1.0,1.0,-1.0,-1.0,1.0,-1.0,1.0
real4 -1.0,-1.0,1.0,1.0,-1.0,-1.0,1.0,1.0,-1.0
real4 1.0,1.0,1.0,1.0,-1.0,1.0,-1.0,-1.0,-1.0
real4 -1.0,-1.0,1.0,-1.0,1.0,1.0,-1.0,1.0,-1.0


then SIZEOF kostka1 returns 36 instead .. and I of course need 9x8x4=288 ...
any redeclarations available ? :)) .. (Hope I understand well SIZEOF)
Title: Re: Statement too complex question ..
Post by: hutch-- on December 13, 2005, 11:45:15 AM
You are out of luck with SIZEOF as it is designed to work on a single line. There is a trick though, put a dummy variable after your 32 bit float data and subtract the start address of your data from the dummy variable. That will give you the byte count.
Title: Re: Statement too complex question ..
Post by: shaldan on December 13, 2005, 12:01:59 PM
 :U thank you very much Hutch--, this is perfect...
Title: Re: Statement too complex question ..
Post by: MichaelW on December 13, 2005, 12:54:19 PM
This will set a numeric equate and a dword variable to the total number of bytes allocated.

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
    include \masm32\include\masm32rt.inc
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
    .data
      kostka1 real4 -1.0,-1.0, 1.0, 1.0,-1.0, 1.0, 1.0, 1.0, 1.0
              real4 -1.0, 1.0, 1.0,-1.0,-1.0,-1.0,-1.0, 1.0,-1.0
              real4  1.0, 1.0,-1.0, 1.0,-1.0,-1.0,-1.0, 1.0,-1.0
              real4 -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,-1.0
              real4 -1.0,-1.0,-1.0, 1.0,-1.0,-1.0, 1.0,-1.0, 1.0
              real4 -1.0,-1.0, 1.0, 1.0,-1.0,-1.0, 1.0, 1.0,-1.0
              real4  1.0, 1.0, 1.0, 1.0,-1.0, 1.0,-1.0,-1.0,-1.0
              real4 -1.0,-1.0, 1.0,-1.0, 1.0, 1.0,-1.0, 1.0,-1.0

      _SIZEOF_kostka1 = ($ - kostka1)
      dd_SIZEOF_kostka1 dd ($ - kostka1)

      tmp TEXTEQU %_SIZEOF_kostka1
      % echo _SIZEOF_kostka1 = tmp

    .code
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
start:
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
    print ustr$(dd_SIZEOF_kostka1),13,10
    mov   eax, input(13,10,"Press enter to exit...")
    exit
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
end start




Title: Re: Statement too complex question ..
Post by: shaldan on December 13, 2005, 03:41:46 PM
 :U :dazzled: :))) thank you MichaelW