11.4.2 Direct Addressing
Direct Addressing specifies all or part of the source and/or destination address of the operation within the opcode itself. The options are specified by the arguments accompanying the instruction.
In the core PIC18 instruction set, bit-oriented and byte-oriented instructions use some version of Direct Addressing by default. All of these instructions include some 8-bit literal address as their Least Significant Byte. This address specifies either a register address in one of the banks of data RAM (see General Purpose Register File) or a location in the Access Bank (see Access Bank) as the data source for the instruction.
The Access RAM bit ‘a’ determines how the address is interpreted.
When ‘a’ is ‘1
’, the contents of the BSR (see Bank Select Register) are used with the address to determine the complete 12-bit address of
the register. When ‘a’ is ‘0
’, the address is interpreted as being a
register in the Access Bank. Addressing that uses the Access RAM is sometimes also known as
Direct Forced Addressing mode.
A few instructions, such as MOVFF
, include the
entire 12-bit address (either source or destination) in their opcodes. In these cases, the
BSR is ignored entirely.
The destination of the operation’s results is determined by the
destination bit ‘d’. When ‘d’ is ‘1
’, the results are stored back in the
source register, overwriting its original contents. When ‘d’ is ‘0
’, the
results are stored in the W register. Instructions without the ‘d’ argument have a
destination that is implicit in the instruction; their destination is either the target
register being operated on or the W register.