Macro Control Statements - Panasonic PanaXSeries MN1030 Series User Manual

Panasonic microcomputer user's manual
Table of Contents

Advertisement

7.5

Macro Control Statements

Macro control statements reduce coding effort by replacing strings coded in source statements with other
strings. This enables low-level assembly language for a program block to be abstracted as a macro
name.
Macros are coded in two formats: macro definitions and macro calls.
A macro definition defines a macro name and macro body. The macro body uses multiple machine lan-
guage instructions to construct a single program process.
A macro call is just a macro name coded as a source statement. The assembler will replace it with all
the machine language instructions coded in the macro body. This process is called macro expansion.
The basic difference between a macro call and a subroutine call is that a macro call actually outputs ma-
chine language instructions as source statements, with arguments used to output different machine lan-
guage instructions for each call.
The example below shows macro control statements.
*macro definition-------------------------------
adr_set
*macro call-------------------------------------
macro
data, reg
mov
reg, A0
mov
data, D0
mov
D0, (A0)
endm
.
.
.
adr_set
.
.
.
adr_set
.
.
.
Chapter 7 Type of Source Statements
data1, reg1
data2, reg2
Macro Control Statements 123

Advertisement

Table of Contents
loading

Table of Contents