Equ - Panasonic PanaXSeries MN1030 Series User Manual

Panasonic microcomputer user's manual
Table of Contents

Advertisement

9.4.14 equ

Syntax
label
name
Functional description
This directive defines the name to be the value of the expression coded in the operand. When that
name is coded in the operand of machine language instructions or directive instructions, the assembler
will reference the name's value.
System constants often used in programs (memory size, clock frequency, etc.) can be assigned to
names that describe those values.
MEMORY
MOTOR
STOP
BASE
This allows numbers used in programs to be coded as descriptive names instead, making programs
easier to read. Furthermore, values can be changed just by modifying the equ directive, which in turn
changes the data wherever it is used. This makes programs easier to maintain.
Operand coding rules
The expression coded in the operand must result in the attribute abs (absolute). Refer to Section 8.7.4,
"Expression Attributes", regarding attributes of expressions.
If the attributes of expressions are not the attribute abs (absolute), #define of the assembler control state-
ment should be used, instead of the equ of the directive statement..
Names defined in other programs cannot be specified within expression.
Names defined once with the equ directive cannot be defined again.
No memory area is reserved when an equ directive statement is executed.
NOTE:
Chapter 9 Writing Machine Language Instructions and Directive Statements
operation
equ
equ
0x20
equ
10
equ
0b00001000
equ
0x1000
Symbols with unresolved values cannot be coded in the operand. In the
following example, the value of ram1 is not resolved at the point where the value
of ram2 is to be resolved, so the assembler will generate an error.
Error example:
ram2
equ
ram1
equ
By changing the order such that the value of ram1 is resolved first, no error will
occur.
No error example:
ram1
equ
ram2
equ
operand
expression
ram1+0x1
0x10
0x10
ram1+0x1
Writing Directive Statements 171

Advertisement

Table of Contents
loading

Table of Contents