Intel mcs-48 Microscope & Magnifier User Manual


 
APPLICATION EXAMPLES
5.2 Software Examples
The following routines are written
as
subroutines.
RO
and
R1
are
used
as
data pointers,
R2
is
used
as
an
extension of the accumulator
and
R3
is
used
as
a loop counter.
RXO
=
RO
AEX =
R2
DOUBLE ADD
DADO:
DEC
RXO
;GET
LOW
BYTE
AND ADD
TO
A
ADD
A,@RXO
INC
RXO
;GET HI BYTE
AND
ADD
TO
AEX
XCH
A,AEX
ADDC
A,@RXO
XCH A,AEX
RET ;RETURN
DOUBLE SUBTRACT
DMIN:
DEC
RXO
;GET LOW BYTE AND SUB FROM A
CPL A
ADD
A,@RXO
CPL A
INC
RXO
;GET
HI
BYTEANDSUB
FROM AEX
XCH A,AEX
CPL A
AD DC
A,@RXO
CPL
A
XCH A,AEX
RET ;RETURN
DOUBLE LOAD
OLD: DEC
RXO
;GET LOW BYTE AND PLACE IN A
MOV
A,@RXO
INC
RXO
;GET
HI
BYTE AND PLACE IN AEX
XCH A,AEX
MOV A,@RXO
XCH A,AEX
RET ;RETURN
DOUBLE STORE
DST: DEC
RXO
;MOVE A
INTO
LOW
BYTE
MOV
@RXO,A
INC
RXO
;MOVE AEX
INTO
HIGH
BYTE
XCH A,AEX
MOV
@RXO,A
XCH A,AEX
RET ;RETURN
5-22