Intel MCS48 User Manual page 94

Family of single chip microcomputers
Hide thumbs Also See for MCS48:
Table of Contents

Advertisement

INSTRUCTION SET
Note:
The mapping
of
port
'p'
to
opcode
bits
0-1
is
as
follows:
1
Port
4
1
5
1
6
1
1
7
Example:
ANDP4:
ANLD
P4,A
CALL
address
Subroutine
Call
;'AND'
PORT
4
CONTENTS
;WITH
ACC
BITS
0-3
a
10 a 9
a
8
1
100
a
7
a 6 a
5
a 4
a 3 a
2
a-,
a
This
is
a 2-cycle
instruction.
The program
counter
and
PSW
bits
4-7 are
saved
in
the
stack.
The
stack pointer
(PSW
bits
0-2)
is
updated.
Program
control
is
then
passed
to
the location specified
by
'address'.
PC
bit
11
is
determined by
the
most
recent
SEL
MB
instruction.
A CALL
cannot
begin
in
locations
2046-2047
or
4094-4095.
Execution continues
at
the
instruction
following the
CALL
upon
return
from
the subroutine.
((SP))^-(PC),
(PSW
4
_
7
)
(SP)^-
(SP)
+
1
(PC
8
-10)^- (addr
8
.
10
)
(PC
-7)^- addrn-7
(PCnJ^-DBF
Example:
Add
three
groups
of
two numbers.
Put
subtotals
in
locations
50,
51
and
total
in
location
52.
MOV
R0,#50
BEGADD:
MOV
A,R1
ADD
A.R2
CALL
SUBTOT
ADD
A
R3
ADD
A,R4
CALL
SUBTOT
ADD
A,R5
ADD
A,R6
CALL
SUBTOT
SUBTOT:
MOV
@R0,A
INC R0
RET
MOVE
'50'
DEC
TO
ADDRESS
REG
MOVE CONTENTS
OF REG
1
TO
ACC
ADD
REG
2
TO ACC
CALL SUBROUTINE 'SUBTOT
ADD
REG
3
TO
ACC
ADD
REG
4
TO ACC
CALL SUBROUTINE 'SUBTOT
ADD
REG
5
TO
ACC
ADD REG
6
TO ACC
CALL
SUBROUTINE 'SUBTOT
MOVE CONTENTS
OF
ACC TO
LOCATION ADDRESSED
BY
REG
INCREMENT REG
RETURN TO
MAIN
PROGRAM
Mnemonics
copyright
Intel
Corporation
1976.
4-12

Advertisement

Table of Contents
loading

Table of Contents