Maxim Integrated Secure Microcontroller User Manual

Page 49

Advertising
background image

Secure Microcontroller User’s Guide

49 of 187

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 that 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 register-indirect addressing for accessing data memory.
R1 or R0 in the selected working register bank can 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


The 16-bit DPTR register can be used to access any data memory location within the 64kB space.

MOVX @DPTR,A ; Load the Data Memory location pointed to by the

; contents of the DPTR with the Accumulator contents.


Immediate Addressing
Immediate addressing is used to access constants for use as operands that are contained in the current
instruction in program memory.

ORL

A, #040H ; Logical OR of the Accumulator with the constant 040H


Register-Indirect with Displacement
Register-indirect with displacement addressing is used to access data in look-up tables in program
memory space. The location accessed is pointed to by the contents of either the DPTR or the PC registers,
which are used as a base register added together with the contents of the accumulator (A), which is used
as an index register.

MOVC A, @DPTR+A

; Load Accumulator with the contents of the

; Program Memory location pointed to by DPTR

; plus the value contained in the Accumulator


Relative Addressing
Relative addressing is used in the determination of a destination address for the conditional branch
instructions. Each of these instructions includes an 8-bit byte that contains a 2’s complement address
offset (-127 to +128), which is added to the PC to determine which destination address it is branched to
when the tested condition is found to be true. The PC points to the program memory location immediately
after the branch instruction when the offset is added. If the condition is found to be not true, then program
execution continues from the address of the following instruction.

JZ

-20

; Branch to the location (PC+2) -20 if the

; contents of the Accumulator = 0


Page Addressing
Page addressing is used by the control transfer instructions to specify a destination address within the 2kB
block in which the next contiguous instruction resides. The full 16-bit address is calculated by taking the

Advertising