Vault 7: Projects

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

© 2005-2011 Microchip Technology Inc. DS70157F-page 55
Section 4. Instruction Set Details
Instruction Set
Details
4
Table 4-2 shows that four Addressing modes modify the EA used in the instruction, and this
allows the following updates to be made to the working register: post-increment, post-decrement,
pre-increment and pre-decrement. Since all EAs must be given as byte addresses, support is
provided for Word mode instructions by scaling the EA update by 2. Namely, in Word mode,
pre/post-decrements subtract 2 from the EA stored in the working register, and
pre/post-increments add 2 to the EA. This feature ensures that after an EA modification is made,
the EA will point to the next adjacent word in memory.
Example 4-4 shows how indirect
addressing may be used to update the EA.
Table 4-2 also shows that the Register Offset mode addresses data which is offset from a base
EA stored in a working register. This mode uses the contents of a second working register to form
the EA by adding the two specified working registers. This mode does not scale for Word mode
instructions, but offers the complete offset range of 64 Kbytes. Note that neither of the working
registers used to form the EA are modified.
Example 4-5 shows how register offset indirect
addressing may be used to access data memory.
Example 4-4: Indirect Addressing with Effective Address Update
Note: The MOV with offset instructions (see pages 285 and 286) provides a literal
addressing offset ability to be used with indirect addressing. In these instructions,
the EA is formed by adding the contents of a working register to a signed 10-bit
literal.
Example 4-6 shows how these instructions may be used to move data to and
from the working register array.
MOV.B [W0++], [W13--] ; byte move [W0] to [W13]
; post-inc W0, post-dec W13
Before Instruction:
W0 = 0x2300
W13 = 0x2708
Data Memory 0x2300 = 0x7783
Data Memory 0x2708 = 0x904E
After Instruction:
W0 = 0x2301
W13 = 0x2707
Data Memory 0x2300 = 0x7783
Data Memory 0x2708 = 0x9083
ADD W1, [--W5], [++W8] ; pre-dec W5, pre-inc W8
; add W1 to [W5], store in [W8]
Before Instruction:
W1 = 0x0800
W5 = 0x2200
W8 = 0x2400
Data Memory 0x21FE = 0x7783
Data Memory 0x2402 = 0xAACC
After Instruction:
W1 = 0x0800
W5 = 0x21FE
W8 = 0x2402
Data Memory 0x21FE = 0x7783
Data Memory 0x2402 = 0x7F83

e-Highlighter

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

Un-highlight all Un-highlight selectionu Highlight selectionh