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 64 © 2005-2011 Microchip Technology Inc.
4.4 BYTE OPERATIONS
Since the data memory is byte addressable, most of the base instructions may operate in either
Byte mode or Word mode. When these instructions operate in Byte mode, the following rules
apply:
• All direct working register references use the Least Significant Byte of the 16-bit working
register and leave the Most Significant Byte (MSB) unchanged
• All indirect working register references use the data byte specified by the 16-bit address
stored in the working register
• All file register references use the data byte specified by the byte address
• The STATUS Register is updated to reflect the result of the byte operation
It should be noted that data addresses are always represented as byte addresses. Additionally,
the native data format is little-endian, which means that words are stored with the Least
Significant Byte at the lower address, and the Most Significant Byte at the adjacent, higher
address (as shown in
Figure 4-3). Example 4-8 shows sample byte move operations and
Example 4-9 shows sample byte math operations.
Example 4-8: Sample Byte Move Operations
Note: Instructions that operate in Byte mode must use the “.b” or “.B” instruction
extension to specify a byte instruction. For example, the following two instructions
are valid forms of a byte clear operation:
• CLR.b W0
• CLR.B W0
MOV.B #0x30, W0 ; move the literal byte 0x30 to W0
Before Instruction:
W0 = 0x5555
After Instruction:
W0 = 0x5530
MOV.B 0x1000, W0 ; move the byte at 0x1000 to W0
Before Instruction:
W0 = 0x5555
Data Memory 0x1000 = 0x1234
After Instruction:
W0 = 0x5534
Data Memory 0x1000 = 0x1234
MOV.B W0, 0x1001 ; byte move W0 to address 0x1001
Before Instruction:
W0 = 0x1234
Data Memory 0x1000 = 0x5555
After Instruction:
W0 = 0x1234
Data Memory 0x1000 = 0x3455
MOV.B W0, [W1++] ; byte move W0 to [W1], then post-inc W1
Before Instruction:
W0 = 0x1234
W1 = 0x1001
Data Memory 0x1000 = 0x5555
After Instruction:
W0 = 0x1234
W1 = 0x1002
Data Memory 0x1000 = 0x3455
Protego_Release_01_05-Related-OEM-Documentation-PIC24FJ64GA004-Programmers_Reference_Manual.pdf