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

Page 79

Advertising
background image

CHAPTER 4: ASSEMBLER

S5U1C63000A MANUAL

EPSON

65

(S1C63 FAMILY ASSEMBLER PACKAGE)

4.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

<Define name> [<Substitute character string>]

<Define name>:

• 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 case insensitive.)

When assembling with the "-c" option, all symbols are case insensitive.

• One or more spaces or tabs are necessary between the instruction and the Define name.

<Substitute character string>:

• When writing all characters can be used, but a semicolon (;) is interpreted as the start of a comment.
• 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

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

0xfff0

#define INT_F1_1

0

:

set

[INT_F1], INT_F1_1

... Expanded to "set [0xfff0],0".

:

Advertising