EasyManua.ls Logo

Intel 8080 - B4_Page_24

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
6-4
For example, the subroutine ADSUB expects the
address
of
a three-byte parameter list in the
Hand
L registers.
It
adds
the first
and
second
bytes
of
the list,
and
stores
the result
in
the third byte
of
the list:
Label Code
LXI
CALL
RET1
:
PLlST:
DB
DB
DS
LXI
CALL
RET2:
L1ST2:
DB
DB
DS
ADSUB:
MOY
INX
MOY
ADD
INX
MOY
RET
Operand
H,PLlST
ADSUB
6
8
H,L1ST2
ADSUB
10
3S
A,M
H
B,M
B
H
M,A
Comment
;LOAD
HAND
L WITH
;ADDRESSES OF THE PARAM-
;ETER LIST
;CALL THE SUBROUTINE
;FIRST
NUMBER TO
BE
ADDED
;SECOND NUMBER TO
BE
;ADDED
;RESULT
WILL
BE
STORED HERE
;LOAD
HAND
L REGISTERS
;FOR ANOTHER
CALL
TO ADSUB
;GET
FIRST PARAMETER
;INCREMENT MEMORY
;ADDRESS
;GET
SECOND PARAMETER
;ADD
FIRST TO SECOND
;INCREMENT MEMORY
;ADDRESS
;STORE RESULT AT
THIRD
;PARAMETER STORE
;RETURN
UNCONDITIONALLY
The first time ADSUB
is
called,
it
loads the A
and
B registers from PLiST
and
PLlST+l respectively,
adds
them,
and
stores the result
in
PLiST +2. Return
is
then
made
to the instruction at
RETl.

Table of Contents

Related product manuals