EasyManua.ls Logo

Intel 8080 - B4_Page_23

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
6.
Programming
Techniques
Label
Code Operand
START:
LXI
H,BTBL
;REGISTERS
HAND
L
WILL
;POINT
TO
BRANCH TABLE
GTBIT:
RAR
IC
GETAD
INX
H
;(H,L)=(H,L)+2
TO
INX
H ;POINT TO NEXT ADDRESS
;IN
BRANCH
TABLE
JMP
GTBIT
GETAD:
MOV
E,M
;BIT
FOUND
INX
H ;LOAD I
UMP
ADDRESS
;INTO 0
AND
E REGISTERS
MOV
D,M
XCHG
;EXCHANGE 0
AND
E
;WITH
HAND
L
PCHL
;1
UMP
TO ROUTINE
;ADDRESS
BTBL:
OW
ROUTl ;BRANCH TABLE.
EACH
OW
ROUT2 ;ENTRY
IS
A TWO-BYTE
OW
ROUn
;ADDRESS
OW
ROUT4
;HELD LEAST SIGNIFICANT
OW
ROUTS
;BYTE
FIRST
OW
ROUT6
OW
ROUn
OW
ROUT8
The control routine at START uses the
Hand
L registers
as
a pointer into the branch table (BTBL) corresponding
to the bit of the accumulator that
is
set. The routine at GET
AO
then transfers the address held
in
the corres-
ponding branch table entry to the
Hand
L registers
via
the 0 and E registers, and then uses a
PCHL
instruction,
thus transferring control to the selected routine.
TRANSFERRING
DATA
TO
SUBROUTINES
A subroutine typically requires data to perform its operations.
In
the simplest case, this data may
be
transferred
in
one or more registers.
Sometimes it
is
more convenient and economical to let the subroutine load its own registers. One way to do this
is
to place a list
of
the required data (called a parameter list)
in
some data area of memory, and pass the address
of this
list to the subroutine
in
the
Hand
L registers.
6-3

Table of Contents

Related product manuals