beautypg.com

2 define instruction (#define) – Epson S5U1C62000A User Manual

Page 77

background image

S5U1C62000A MANUAL

EPSON

65

(S1C60/62 FAMILY ASSEMBLER PACKAGE)

CHAPTER 5: ASSEMBLER

5.7.2 Define Instruction (#define)

Any substitute character string can be left defined as a Define name by the define instruction (#define),
and the details of that definition can be referred to from various parts of the program using the Define
name.

Instruction format

#define

[]

:

• The first character is limited to a–z, A–Z, ? and _.
• The second and the subsequent characters can use a–z, A–Z, 0–9, ? and _.
• Uppercase and lowercase characters are discriminated. (#define itself is not case sensitive.)
• One or more spaces or tabs are necessary between the instruction and the Define name.

:

• The usable characters are limited to a–z, A–Z, 0–9, ?, and _. They must not contain any space or

comma (,).
Values, mnemonics, labels, register names, and expressions using operators can also be specified.

• Uppercase and lowercase characters are discriminated.
• One or more spaces or tabs are necessary between the Define name and the substitute character string.
• The substitute character string can be omitted. In that case, NULL is defined in lieu of the substitute

character string. It can be used for the conditional assembly instruction.

Sample definitions:

#define

TYPE1

#define

L1

LABEL_01

#define

Xreg

x

#define

CONST

(DATA1+DATA2)*2

#define

BtoA

a,b

... Error Comma (,) cannot be used.

Expansion rule

If a Define name defined appears in the source, the assembler substitutes a defined character string
for that Define name.

Sample expansion:

#define INT_F1 0xf

#define INT_F1_RST INT_F1^0xf

#define MEMORY_X mx

:

ldpx MEMORY_X,INT_F1_RST

... Expanded to "ldpx mx, 0".

: