You use symbols in MACRO-64 source statements to represent an instruction, directive, register name, or value. You can use four types of symbols in MACRO-64 source programs: permanent symbols, predefined symbols, user-defined symbols, and macro names.
1 – Permanent Symbols
Permanent symbols consist of MACRO-64 directives and instruction mnemonics. You need not define directives before you use them in the operator field of a MACRO-64 source statement. It is also not necessary to define instruction mnemonics before using them in the instruction statements.
2 – Predefined Symbols
Predefined symbols are MACRO-64 register symbols that are not permanently reserved. You can delete the definition of any of these predefined register symbols. You can also define your own register symbols. You can express the 32 general registers and the 32 floating- point registers of the Alpha processor in a source program as follows: Register Name Description R0 General register 0. R1 General register 1. . . . . . . R29 General register 29 or frame pointer. If you use R29 as a or FP frame pointer, Digital recommends you use the name FP. If you use R29 as a general register, Digital recommends you use the name R29. R30 General register 30 or stack pointer. If you use R30 as a or stack pointer, the name SP is recommended; if you use R30 SP as a general register, the name R30 is recommended. R31 General register 31. F0 Floating-point register 0. . . . . . . F31 Floating-point register 31. NOTE When MACRO-64 operates in /NAMES=AS_IS mode, all of the previous register symbols are defined in all uppercase and all lowercase. To define your own register symbols, use either the .DEFINE_ FREG or .DEFINE_IREG directive for floating-point or integer registers, respectively. For more information about the .DEFINE_ FREG or .DEFINE_IREG directives, see .DEFINE_FREG and .DEFINE_ IREG, respectively. You can delete a register symbol definition with the .UNDEFINE_ REG directive. For more information about the .UNDEFINE_REG directive, see .UNDEFINE_REG. While an identifier is defined as a register symbol, it can only be used in those contexts that allow a register.
3 – User-Defined Symbols and Macro Names
You can use symbols to define labels, or you can equate them to a specific value by a direct assignment statement. You can also use these symbols in expressions. Use the following rules to create user-defined symbols: o Use alphanumeric characters, underscores (_), dollar signs ($), and periods (.). Any other character terminates the symbol. o The first character of a symbol cannot be a number. o The symbol must be no more than 31 characters long and must be unique. o The symbol must not be a register name. o The symbol cannot be one of the following conditional or macro directives: .ELSE .ENDC .ENDM .ENDR .IF .IF_FALSE (.IFF) .IF_TRUE .IF_TRUE_ .IIF (.IFT) FALSE (.IFTF) .INCLUDE .IRP .IRPC .LIBRARY .MACRO .MCALL .MDELETE .MEXIT .NARG .NCHAR .REPEAT In addition, by Digital convention: o The dollar sign ($) is reserved for names defined by Digital. This convention ensures that a user-defined name (that does not have a dollar sign) will not conflict with a Digital- defined name (that does have a dollar sign). o Do not use the period (.) in any global symbol name because many languages, such as Fortran, do not allow periods in symbol names. Macro names follow the same rules and conventions as user-defined symbols. User-defined symbols and macro names do not conflict; that is, you can use the same name for a user-defined symbol and a macro.
4 – Determining Symbol Values
The value of a symbol depends on its use in the program. MACRO-64 uses a different method to determine the values of symbols in the operator field than it uses to determine the values of symbols in the operand field.
5 – Using Symbols in the Operator Field
A symbol in the operator field can be either a permanent symbol or a macro name. MACRO-64 searches for a symbol definition in the following order: 1. Macro and conditional directives: .ELSE .ENDC .ENDM .ENDR .IF .IF_FALSE (.IFF) .IF_TRUE .IF_TRUE_ .IIF (.IFT) FALSE (.IFTF) .INCLUDE .IRP .IRPC .LIBRARY .MACRO .MCALL .MDELETE .MEXIT .NARG .NCHAR .REPEAT 2. Previously defined macro names 3. Permanent symbols (instructions and other directives) This search order allows most permanent symbols, except conditional directives and macro directives, to be redefined as macro names. If a symbol in the operator field is not defined as a macro or a permanent symbol, the assembler displays an error message.
6 – Using Symbols in the Operand Field
A symbol in the operand field must be either a user-defined numeric symbol, a label, or a register name. User-defined numeric symbols and labels can be either local (internal) symbols or global (external) symbols. Whether numeric symbols and labels are local or global depends on their use in the source program. You can reference a local numeric symbol or label only in the module in which it is defined. If local numeric symbols or labels with the same names are defined in different modules, the symbols and labels are completely independent. The definition of a global numeric symbol or label, however, can be referenced from any module in the program. MACRO-64 treats all user-defined numeric symbols and labels as local unless you explicitly declare them to be global by doing one of the following: o Use the double colon (::) in defining a label. o Use the double equal sign (==) in a direct assignment statement. o Use the .WEAK directive. You can only use user-defined lexical string symbols with the lexical string operators. You can define a macro using the same name as a previously defined local numeric symbol, global numeric symbol, or a lexical string symbol. However, you cannot define a lexical string symbol and a numeric symbol using the same name. In addition, you cannot use the same name for both a local and global numeric symbol. You cannot use the same symbol name for both a numeric symbol (local or global) and a label (local or global).