Vault 7: Projects

This publication series is about specific projects related to the Vault 7 main publication.

16-bit MCU and DSC Programmer’s Reference Manual
DS70157F-page 54 © 2005-2011 Microchip Technology Inc.
Example 4-3: Register Direct Addressing
4.1.3 Register Indirect Addressing
Register indirect addressing is used to access any location in data memory by treating the
contents of a working register as an Effective Address (EA) to data memory. Essentially, the
contents of the working register become a pointer to the location in data memory which is to be
accessed by the instruction.
This Addressing mode is powerful, because it also allows one to modify the contents of the
working register, either before or after the data access is made, by incrementing or decrementing
the EA. By modifying the EA in the same cycle that an operation is being performed, register
indirect addressing allows for the efficient processing of data that is stored sequentially in
memory. The modes of indirect addressing supported by the 16-bit MCU and DSC devices are
shown in
Table 4-2.
Table 4-2: Indirect Addressing Modes
EXCH W2, W3 ; Exchange W2 and W3
Before Instruction:
W2 = 0x3499
W3 = 0x003D
After Instruction:
W2 = 0x003D
W3 = 0x3499
IOR #0x44, W0 ; Inclusive-OR 0x44 and W0
Before Instruction:
W0 = 0x9C2E
After Instruction:
W0 = 0x9C6E
SL W6, W7, W8 ; Shift left W6 by W7, and store to W8
Before Instruction:
W6 = 0x000C
W7 = 0x0008
W8 = 0x1234
After Instruction:
W6 = 0x000C
W7 = 0x0008
W8 = 0x0C00
Indirect Mode Syntax
Function
(Byte Instruction)
Function
(Word Instruction)
Description
No Modification [Wn] EA = [Wn] EA = [Wn] The contents of Wn forms the EA.
Pre-Increment [++Wn] EA = [Wn + = 1] EA = [Wn + = 2] Wn is pre-incremented to form the EA.
Pre-Decrement [--Wn] EA = [Wn – = 1] EA = [Wn – = 2] Wn is pre-decremented to form the EA.
Post-Increment [Wn++] EA = [Wn]+ = 1 EA = [Wn]+ = 2 The contents of Wn forms the EA, then
Wn is post-incremented.
Post-Decrement [Wn--] EA = [Wn] – = 1 EA = [Wn] – = 2 The contents of Wn forms the EA, then
Wn is post-decremented.
Register Offset [Wn+Wb] EA = [Wn + Wb] EA = [Wn + Wb] The sum of Wn and Wb forms the EA.
Wn and Wb are not modified.

e-Highlighter

Click to send permalink to address bar, or right-click to copy permalink.

Un-highlight all Un-highlight selectionu Highlight selectionh