3.1.1 File Register Addressing

File Register Addressing is used by instructions that use a predetermined data address as an operand for the instruction. The majority of instructions that support File Register Addressing provide access up to 64 KB (if a WREG operand is required). However, the MOV instruction provides access to all 1 MB of memory using File Register Addressing. This allows the loading of the data from any location in data memory to any Working register and storing the contents of any Working register to any location in data memory. It should be noted that File Register Addressing supports byte, extended byte, word and long word data sizes. Refer to File Register Addressing of File Register Addressing modes.

Most instructions which support File Register Addressing perform an operation on the specified file register and the default Working register, WREG. If only one operand is supplied in the instruction, WREG is an implied operand and the operation results are stored back to the file register. In these cases, the instruction is effectively a Read-Modify-Write instruction. However, when both the file register and the WREG register are specified in the instruction, the operation results are stored in the WREG register and the contents of the file register are unchanged. Sample instructions that show the interaction between the file register and the WREG register are shown in File Register Addressing and WREG.

Note: Instructions which support File Register Addressing use ‘f’ as an operand in the instruction summary tables of Instruction Set Overview

File Register Addressing

DEC		0x5000       ; decrement data stored at 0x5000

Before Instruction:

Data Memory 0x5000 = 0x55555555

After Instruction:

Data Memory 0x5000 = 0x55555554
MOV.l	0x000027FE, W0	 ; move data stored at 0x000027FE to W0

Before Instruction:

W0 = 0x55555555
Data Memory 0x000027FE = 0x12345678

After Instruction:

W0 = 0x12345678
Data Memory 0x000027FE = 0x12345678

File Register Addressing and WREG

AND	0x00001000       ; AND 0x00001000 with WREG, store to 0x00001000

Before Instruction:

W0 (WREG) = 0x0000332C
Data Memory 0x00001000 = 0x55555555

After Instruction:

W0 (WREG) = 0x0000332C
Data Memory 0x00001000 = 0x00001104
AND	0x00001000, WREG    ; AND 0x00001000 with WREG, store to WREG

Before Instruction:

W0 (WREG) = 0x0000332C
Data Memory 0x00001000 = 0x55555555

After Instruction:

W0 (WREG) = 0x00001104
Data Memory 0x00001000 = 0x55555555