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 80 © 2005-2011 Microchip Technology Inc.
Example 4-17: Unsigned f and WREG Multiply (Legacy MULWF Instruction)
4.10.3.3 MOVING DATA WITH WREG
The MOV{.B} f {,WREG}instruction (described on page 279) and MOV{.B} WREG, f
instruction (described on page 280) allow for byte or word data to be moved between file register
memory and the WREG (working register W0). These instructions provide equivalent
functionality to the legacy Microchip PIC MCU MOVF and MOVWF instructions.
The MOV{.B} f {,WREG}and MOV{.B} WREG, finstructions are the only MOV instructions
which support moves of byte data to and from file register memory. Example 4-18 shows several
MOV instruction examples using the WREG.
Example 4-18: Moving Data with WREG
MUL.B 0x100 ; (0x100)*WREG (byte mode), store to W2
Before Instruction:
W0 (WREG) = 0x7705
W2 = 0x1235
W3 = 0x1000
Data Memory 0x0100 = 0x1255
After Instruction:
W0 (WREG) = 0x7705
W2 = 0x01A9
W3 = 0x1000
Data Memory 0x0100 = 0x1255
MUL 0x100 ; (0x100)*WREG (word mode), store to W3:W2
Before Instruction:
W0 (WREG) = 0x7705
W2 = 0x1235
W3 = 0x1000
Data Memory 0x0100 = 0x1255
After Instruction:
W0 (WREG) = 0x7705
W2 = 0xDEA9
W3 = 0x0885
Data Memory 0x0100 = 0x1255
Note: When moving word data between file register memory and the working register
array, the MOV Wns, f” and “MOV f, Wndinstructions allow any working register
(W0:W15) to be used as the source or destination register, not just WREG.
MOV.B 0x1001, WREG ; move the byte stored at location 0x1001 to W0
MOV 0x1000, WREG ; move the word stored at location 0x1000 to W0
MOV.B WREG, TBLPAG ; move the byte stored at W0 to the TBLPAG register
MOV WREG, 0x804 ; move the word stored at W0 to location 0x804

e-Highlighter

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

Un-highlight all Un-highlight selectionu Highlight selectionh