Mitsubishi Motors DS5000TK User Manual

Page 46

Advertising
background image

USER’S GUIDE

050396 45/173

46

INSTRUCTION SET

Introduction

The Secure Microcontroller executes an instruction set
which is object code compatible with the industry stan-
dard 8051 microcontroller. As a result, software tools
written for the 8051 are compatible with the Secure
Microcontroller, including cross–assemblers, compil-
ers, and debugging tools.

There are a total of 42 instruction types recognized by
the Secure Microcontroller. When the instruction uses
both source and destination operands, they are speci-
fied in the order of “destination, source”.

Addressing Modes

There are eight addressing modes. Five of these are
used to address operands. The other three are used in
instructions which transfer execution of the program to
another address (e.g., Branch, Jump, Call).

The modes which address source operands, include
Register Addressing, Direct Addressing, Register–Indi-
rect Addressing, Immediate Addressing and Register-
Indirect with Displacement. The first three of these can
also be used to address a destination operand. Most
instructions use operands that are located in the Internal
Data Registers.

The addressing modes used for the Control Transfer
instructions include Relative Addressing, Page Addres-
sing, and Extended Addressing.

The operation of these addressing modes is summa-
rized below, followed by an example.

Register Addressing
Register Addressing is used on operands contained in
one of the eight registers (R7–R0) of the currently se-
lected Working Register Bank. A register bank is se-
lected via a 2–bit field in the PSW Special Function reg-
ister. All of the Working registers may also be accessed
through either Direct Addressing or Register-Indirect
Addressing as well. This is due to the fact that the Work-
ing registers are mapped into the lower 32 bytes of Inter-
nal Data RAM as discussed above.

ADD

A, R4

; Add Accumulator to Working
; register R4

Direct Addressing
Direct Addressing is the only mode available for use on
operands within the Special Function registers. Ad-
dressing of bytes may also be used to access the 128
Internal Data registers.

MOV 072H, 074H

; Load direct register (addr. 072H)
; with direct register (074H)

Direct addressing of bits is available on 128 bits located
in the Internal Data registers in byte addresses of 20H –
2FH inclusive. Direct bit addressing is also available in
Special Function registers located at addresses on
8–byte boundaries starting at 80H (i.e., 80H, 88H, 90H,
98H, ...0F0H, 0F8H).

SETB

00H

; Set addressable bit 00H (D0 in
; Internal Data Reg. 20H)

Register Indirect Addressing
Some instructions use Register–Indirect Addressing for
accessing operands in other Internal Data registers.
This is done by using the contents of Working register
R1 or R0 as a pointer to other Internal Data registers.

ANL

A, @R0

; Logical AND of Accumulator with
; Internal Data register; pointed to
; by contents of R0

In addition, this addressing is used via the Stack Pointer
register (SP) for manipulation of the stack. The stack
area is contained in the Internal Data Register area. The
PUSH and POP instructions are the only ones which
use SP for this addressing mode.

PUSH P0

; Save the contents of the Port 0
; SFR latch on the stack

The R0, R1, and the DPTR registers are used with Reg-
ister–Indirect Addressing for accessing Data Memory.
R1 or R0 in the selected Working Register bank may be
used for accessing location within a 256–byte block
pointed to by the current contents of the P2 SFR latch
(address high byte).

MOVX A, @R1

; Load the Accumulator with the
; contents of Data Memory
; addressed by the 8–bit contents
; of R1

Advertising
This manual is related to the following products: