EMS6500 EM Microelectronic, EMS6500 Datasheet - Page 60

no-image

EMS6500

Manufacturer Part Number
EMS6500
Description
Microcontroller Development System 4-bit (Emmon), Simulators 4-bit
Manufacturer
EM Microelectronic
Datasheet
Copyright  2003, EM Microelectronic-Marin SA
4.9.
Macros are significant assembly time facilities, which are widely used to simplify
program writing. In essence, a macro represents several assembly language
statements, which are assigned to a symbol name. When the symbol name is
specified as an instruction (i.e. a 'macro call') it will automatically be replaced with
the appropriate list of statements. EM66xx assembler fully supports macro
definitions including:
Flexible Parameter Passing.
Local Symbols.
Conditional Assembly.
Using these definition capabilities macros can be written which represent
complicated program actions and can adjust the object code according to the 'macro
call' operands.
A definition is created by surrounding the required assembly language statements
by the MACRO and MACEND directives as follows:
All the symbols in a macro are local symbols. Formal parameters defined by the
MACRO directive are replaced by the actual parameters when the macro is
expanded by a macro call.
From the above program example, which includes 'macro calls' you, can see how
this facility can also greatly improves program readability. However, you should be
wary of creating a macro that would best be defined as a subroutine as you will
cause the assembly program to be much larger than necessary.
The EM66xx assembler supports very flexible parameter passing. You can specify
any number of parameters as the operand of the 'macro call' statement (all
Macro Definitions
;Program example
Start
MoveAll
STI
MoveAll VA, WA, VB, WB
CALL
MoveAll WA, VA, WB, VB
LDA
STA
LDA
STA
.macend
STI
VB, 1
Test
.macro
PA
TA
PB
TB
VA, 0
PA, TA, PB, TB
Fig. 30 Macro implementation
Fig. 29 Macro definition
;Start of prog
52
Development System
www.emmicroelectronic.com
EM66xx
Binder 4.3-01/03 Rev. B/495

Related parts for EMS6500