EasyManua.ls Logo

Intel 8080 - B4_Page_12

Intel 8080
224 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Chapter
5. Macros
MAIN
PROGRAM
SUBSTITUTION
JNZ
NEXT
JNZ
NEXT
LOAD
FLD,FLD+1,FLD+2
??OOOl
:
LHLD
FLD
MOY
M,A
;INYERT
BYTES
MOY
A,M
DCX
H
LHLD
FLD+1
MOY
M,B
MOY
B,M
DCX
H
LHLD
FLD+2
MOY
M,G
MOY
C,M
LOAD
3EOH
,BYTE
,CHECK
MOY
M,A
;INYERT
BYTES
ADD
B
;CHECK
DIGIT
DCX
H
CMP
C
MOY
M,B
CNZ
DGTBAD
DCX
H
MOY
M,C
??0002:
LHLD
3EOH
MOY
A,M
LHLD
BYTE
MOY
B,M
LHLD
CHECK
MOY
C,M
ADD
B
;CHECK
DIGIT
CMP
C
CNZ
DGTBAD
Nested Macro Calls
5·14
Macro calls (including any combination
of
nested IRP, IRPC, and
REPT
constructs) can
be
nested within macro
definitions
up
to eight levels. The macro being called
need
not
be
defined when the enclosing macro
is
defined;
however, it must
be
defined before the enclosing macro
is
called.
A macro definition can also contain nested calls
to
itself (recursive macro calls)
up
to
eight levels,
as
long
as
the
recursive macro expansions can
be
terminated eventually. This operation can
be
controlled using the conditional
assembly directives described
in
Chapter 4 (IF, ELSE, ENDIF).
Example:
Have
a macro
call
itself
five
times after
it
is
called from elsewhere
in
the program.
PARAM1
RECALL
PARAM1
SET
MACRO
5
IF
PARAM1
NE
0
SET
PARAM
1-1
RECALL
ENDIF
ENDM
;RECURSIYE
CALL

Table of Contents

Related product manuals