APPENDIX B CREATING PROCEDURE OF ASSEMBLY SOURCE FILE (Sub tool chain)
S5U1C88000C MANUAL II
EPSON
239
WORKBENCH/DEV TOOLS/OLD ASSEMBLER
B.2.8 Expressions
Constants are set at many points within programs, for example, the operands for CPU instruction set and
the parameters for pseudo-instructions. Moreover, constants can be shown using expressions. The cross
assembler asm88 evaluates expressions and can make the result value into the constant. A variable of the
same size as the numbers used by the CPU or a larger one may be used for the expression evaluation
during assembly.
NOTE:
(1) When a relocatable code is made, the address can only be used within the expression of which the
result will be a quantity that becomes relocatable or a constant.
Consequently, the following expressions may be used.
label1
- label2
;
When two labels are in the same program selection
label1
+ <constant>
label1
- <constant>
The following expressions may not be used because the result will not be a relocatable quantity or a
constant.
label1
+ label2
label1
& label2
label1
* <constant>
label1
/ <constant>
label1
% <constant>
label1
* label2
label1
/ label2
label1
% label2
<constant> + label2
label1
- label2
;
When two labels are in the different program selection
(2) Since the results do not become relocatable quantity, logic operations using a relocatable address
become errors during assembly.
Expressions are composed of several terms linked by binary operators (for example, +). In the evaluation,
these expressions are calculated with 16-bit precision.
The following terms may be used within the expressions.
1
Numbers
2
Variables which have been defined by the user to use the EQU and SET instructions, and declared
labels
3
Location counters $
When $ is used as the operand for the CPU instructions, the address immediately preceding the instruc-
tion is applied.
The asm88 is a two pass assembler and the values for several variables which are used in program are not
defined in the pass 1 stage. When variables for which values are undefined appear within expressions
during the pass 1 execution, 0 is assigned for them. And if there are variables for which values are still
undefined in pass 2 execution, an error results. Also, if variables which were undefined when used for
the expression in pass 1 are used in pass 2, it causes a phase error. Consequently, you should define the
values for variables prior to using them in an expression.