[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference turris::macro

Title:VAX MACRO assembler issues
Moderator:TLE::TROWEL
Created:Mon Mar 30 1987
Last Modified:Wed Jun 04 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:257
Total number of notes:916

252.0. "Simple question but a big help (for me)" by COPS02::LECORRE () Thu Feb 13 1997 15:07

Hi,

I have a simple question concerning the initialization of parameters like
for ex

	gbl_flags:	.long	sec$m_gbl!sec$m_expreg!sec$m_wrt!sec$m_perm

I had %AMAC-E-ILLSTATINI

	the compiler limiting at 2 the number of such expression

I've tried 
		f1:	.long	a!b
		f2:	.long	c!d
		f:	.long	f1!f2

	No errors but wrong value in f

I like to keep the flags literal expression in the source code
and not the hex value

Any ideas

Thanks

Christian.
T.RTitleUserPersonal
Name
DateLines
252.1Run-Time?XDELTA::HOFFMANSteve, OpenVMS EngineeringThu Feb 13 1997 15:3538
   When in doubt, work around it.  Perform a MOVL of a constant value
   into a cell on the stack, and be done with it (at run time).

HELP/MESSAGE

 ILLSTATINI,  illegal static initialization

  Facility:     AMAC, MACRO-32 Compiler for OpenVMS AXP

  Explanation:  An invalid static initialization was detected. The compiler
                restricts operations to:

                <symbol + or - constant> opr <symbol + or - constant>

                where 'opr' represents all MACRO operators and 'constant' can
                be an expression that equates to a compile-time constant. This
                restriction applies to external symbols and operands that are
                labels in other program sections (psects).

                Static initialization directives using any operations are
                supported on literals, symbols with constant values, and
                labels in the same psect.

  User Action:  Revise the code to contain no more than two external symbols.

        .LIBRARY        "SYS$LIBRARY:LIB.MLB"
        .psect $data,noexe,rd,wrt,long
gbl_flags:
        .long        0
        .psect $code,exe,rd,nowrt,long
gbl_code:
        .call_entry max_args=0
        MOVL #sec$m_gbl!sec$m_expreg!sec$m_wrt!sec$m_perm,gbl_flags
        movl #SS$_NORMAL,R0
        ret
        .end gbl_code

252.2Confusing address with value?WIBBIN::NOYCEPulling weeds, pickin&#039; stonesThu Feb 13 1997 16:2433
>		f1:	.long	a!b
>		f2:	.long	c!d
>		f:	.long	f1!f2

This tells the assembler to store the bitwise-or of a with b into
a longword, and define symbol f1 to be the address of that longword.
Then store the bitwise-or of c with d into the following longword
and define symbol f2 to be the address of that longword.  Finally
compute the bitwise-or of the two addresses, and store that into the
third longword, and define symbol f to be the address of that longword.

Perhaps what you meant to do was to define f1 as equal to the bitwise-or
of a with b, and similarly with f2:
	f1 = a!b
	f2 = c!d

Now, if you want f to represent the address of a longword containing
all the flags together, you would write
	f: .long f1!f2
This would be appropriate if you next intend to reference the memory,
perhaps like this:
	movl f, 4(sp)
or	pushal f

On the other hand, if you want f to be defined as the value that results
from or-ing together all the flags, you would write
	f = f1!f2
This would be appropriate if you intend to use the value directly, perhaps
like this:
	movl #f, 4(sp)

If this doesn't help, perhaps we need a more complete example, and explanation
of what it's supposed to do.
252.3ThanksCOPS02::LECORREFri Feb 14 1997 11:195
    So simple
    
    Thanks a lot
    
    Christian
252.4STAR::BENSONMy other fiddle is a StradMon Feb 17 1997 16:2113
    It sounds like you have a fix but... I haven't seen the REAL
    explanation here, which is this:  In order to report this message, the
    compiler must think these (SEC$M_GBL, etc) are external symbols, not 
    constants. This says to me that you are not including their definitions, 
    which I believe are in $SECDEF.  Try including $SECDEF (which should come 
    out of sys$library:starlet.mlb) and see if that solves it.
    
    Note that you can compile with /disable=global to tell the compiler not
    to assume that symbols which haven't been defined are global
    references. If you compile this way, you should be told that SEC$M_GBL,
    etc, are undefined. (Until you add $SECDEF).
    
    Tom