Can any one please let me know the meaning of EQU, when two parameters are mentioned after EQU. For example, in the below example, in the first EQU 4 and 4 is quoted and in the second EQU 8 and 4 is quoted.
PUTPTR EQU 4,4
EOBO EQU 8,4
I understand that if it is
PUTPTR EQU 4,
that implies that PUTPTR will be replaced by 4 in the program, but I am not sure what does the second parameter do?
Second perameter of EQU indicates length attribute of the field. If it is not specified assembler will assign the length attribute from first expression.
Manual reads like this.
The EQU instruction allows you to assign absolute or relocatable values to symbols. You can use it to:
: Assign single absolute values to symbols.
: Assign the values of previously defined symbols or expressions to new symbols, thus allowing you to use different mnemonics for different purposes.
: Compute expressions whose values are unknown at coding time or difficult to calculate. The value of the expressions is then assigned to a symbol.
FORMAT
symbol EQU expression_1,expression_2,expression_3
symbol is one of the following:
: An ordinary symbol
: A variable symbol that has been assigned a character string with a value that is valid for an ordinary symbol
expression_1
represents a value that the assembler assigns to the symbol in the name field. Expression_1 may have any value allowed for an assembly expression: absolute (including negative), relocatable, or complexly relocatable. The assembler carries this value as a signed 4-byte (32-bit) number; all four bytes are printed in the program listings opposite the symbol.
Any symbols used in expression_1 need not be previously defined. However, if any symbol is not previously defined, the value of expression_1 is not assigned to the symbol in the name field until assembly time and therefore may not be used during conditional assembly.
If expression_1 is a complexly relocatable expression, the whole expression, rather than its value, is assigned to the symbol. During the evaluation of any expression that includes a complexly relocatable symbol, that symbol is replaced by its own defining expression.
Consider the following example, in which A1 and A2 are defined in one control section, and B1 and B2 in another:
X EQU A1+B1
Y EQU X–A2–B2
The first EQU statement assigns a complexly relocatable expression (A1+B1) to X. During the evaluation of the expression in the second EQU statement, X is replaced by its defining relocatable expression (A1+B1), and the assembler evaluates the resulting expression (A1+B1-A2-B2) and assigns an absolute value to Y, because the relocatable terms in the expression are paired.
expression_2
represents a value that the assembler assigns as a length attribute value to the symbol in the name field. It is optional, but, if specified, must be an absolute value in the range 0 to 65,535. This value overrides the normal length attribute value implicitly assigned from expression_1.
All symbols appearing in expression_2 must have been previously defined. If expression_2 is omitted, the assembler assigns a length attribute value to the symbol in the name field according to the length attribute value of the extreme left (or only) term of expression_1, as follows:
1. If the extreme left term of expression_1 is a location counter reference (*), a self-defining term, or a symbol length attribute value reference, the length attribute is 1. This also applies if the extreme left term is a symbol that is equated to any of these values.
2. If the extreme left term of expression_1 is a symbol that is used in the name field of a DC or DS instruction, the length attribute value is equal to the implicit or explicit length of the first (or only) constant specified in the DC or DS operand field.
3. If the extreme left term is a symbol that is used in the name field of a machine instruction, the length attribute value is equal to the length of the assembled instruction.
4. Symbols that name assembler instructions, except the DC, DS, CCW, CCW0, and CCW1 instructions, have a length attribute value of 1. Symbols that name a CCW, CCW0, or CCW1 instruction have a length attribute value of 8.
5. The length attribute value described in cases 2, 3, and 4 above is the assembly-time value of the attribute. The length attribute value assigned by the assembler during conditional assembly processing is always 1.