EasyManua.ls Logo

Intel 8080 - B4_Page_20

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
5-22
Example
5:
Using
IRP
to Define the Jump Table
The T
JUMP
macro becomes even more useful when a second macro (GOTO)
is
used to define the jump table,
load the address of the table into the
Hand
L registers, and then call
TJ
UMP.
The GOTO macro
is
defined
as
follows:
GOTO
JTABLE:
MACRO
LOCAL
LOA
LXI
TJUMP
IRP
OW
ENDM
ENDM
INDEX,LlST
JT
ABLE
INDEX
H,jTABLE
FORMAL,<LlST>
;LOAD
ACCUM
WITH
INDEX
;LOAD
H&L
WITH
TABLE ADDRESS
;CALL
TJUMP MACRO
FORMAL
;SET
UP
TABLE
A typical
call
to the GOTO macro would
be
as
follows:
GOTO
CASE,<COUNT,TIMER,DATE,PTDRVR>
This call to the GOTO macro builds a table
of
OW
directives for the labels COUNT, TIMER, DATE, and
PTDR
VR.
It
then loads the base address
of
the table into the
Hand
L registers and calls the T
JUMP
macro.
If
the value of the variable CASE
is
2 when the GOTO macro
is
called, the GOTO and T
JUMP
macros
together cause a jump to the address of the
DATE
routine.
Notice that any number
of
addresses may
be
specified
in
the list for the GOTO routine
as
long
as
they
all
fit
on a single source line. Also, the GOTO macro may
be
called any number of times, but only one copy
of
the
coding for the TJUMP
is
generated since the TJUMP macro redefines itself to generate only a
JMP
TJCODE
instruction.

Table of Contents

Related product manuals