6.2.1. GBLA, GBLL, and GBLS

The GBLA directive declares a global arithmetic variable, and initializes its value to 0.

The GBLL directive declares a global logical variable, and initializes its value to {FALSE}.

The GBLS directive declares a global string variable and initializes its value to a null string, "".

Syntax

<gblx> variable

where:

<gblx>

is one of GBLA, GBLL, or GBLS.

variable

is the name of the variable. variable must be unique among symbols within a source file.

Usage

Using one of these directives for a variable that is already defined re-initializes the variable to the same values given above.

The scope of the variable is limited to the source file that contains it.

Set the value of the variable with a SETA, SETL, or SETS directive (see SETA, SETL, and SETS).

See LCLA, LCLL, and LCLS for information on declaring local variables.

Global variables can also be set with the -predefine assembler command-line option. See Command syntax for more information.

Examples

Example 6.1 declares a variable objectsize, sets the value of objectsize to 0xFF, and then uses it later in a SPACE directive.

Example 6.1. 

            GBLA    objectsize    ; declare the variable name
objectsize  SETA    0xFF          ; set its value
            .
            .                     ; other code
            .
            SPACE   objectsize    ; quote the variable

Example 6.2 shows how to declare and set a variable when you invoke armasm. Use this when you want to set the value of a variable at assembly time. --pd is a synonym for --predefine.

Example 6.2. 

armasm --pd "objectsize SETA 0xFF" --o objectfile sourcefile
Copyright © 2002-2005 ARM Limited. All rights reserved.ARM DUI 0204F
Non-Confidential