Symbols
You can use a symbol to represent a storage location or an arbitrary value. If you write a symbol in the name field of an instruction, you can then specify this symbol in the operands of other instructions and thus refer to the former instruction symbolically. This symbol represents a relocatable address.
You can also assign an absolute value to a symbol by coding it
in the name field of an EQU instruction with an operand whose value
is absolute. This lets you use this symbol in instruction operands
to represent:
- Registers
- Displacements in explicit addresses
- Immediate data
- Lengths
- Implicit addresses with absolute values
The advantages of symbolic over numeric representation are:
- Symbols are easier to remember and use than numeric values, thus reducing programming errors and increasing programming efficiency.
- You can use meaningful symbols to describe the program elements
they represent. For example,
INPUT
can name a field that is to contain input data, orINDEX
can name a register to be used for indexing. - You can change the value of one symbol that is used in many instructions (through an EQU instruction) more easily than you can change several numeric values in many instructions.
- If the symbols are relocatable, the assembler can calculate displacements and assign base registers for you.
- Symbols are entered into a cross-reference table that is printed
in the Ordinary Symbol and Literal Cross Reference section
of the assembler listing. The cross-reference helps you find a symbol
in the source and object section of the listing because it
shows:
- The number of the statement that defines the symbol. A symbol is defined when it appears in the name entry of a statement.
- The number of all the statements in which the symbol is used as an operand.