Addressing Modes


There are a variety of ways to address data.


Register Direct

mov a,R3


There are 8 registers R0 - R7. Register direct will access the contents of the specified register. The contents of R3 are placed into the accumulator


Register Indirect

mov a,@R0


Only R0 and R1 may be used.


The register now contains an address.


The contents of that address are placed in the accumulator.


The address must point to RAM ie 0 - 7fh



Immediate constants

mov a,#34


The value of the constant can be found as part of the instruction.



Direct

mov a,34


The contents of address 34 are placed in the accumulator.


The address can be either RAM or SFR

Relative addressing

sjmp start


The instruction contains a signed 8 bit offset that is relative to the first byte of the following instruction,



Absolute addressing

ajmp start


The instruction contains an 11 bit destination address to anywhere in the 2KByte program space



Implied addressing


Certain instructions imply a particular address - such as the accumulator.




The Program Status Word PSW



The PSW contains status bits that reflect the current state of the CPU


7 6 5 4 3 2 1 0

CY AC F0 RS1 RS0 OV F1 P


The CY or carry flag is set by certain operations to indicate a carry out of bit 7.


The AC or auxiliary carry flag is set to indicate a carry out of bit 3.


F0 and F1 are general purpose user definable flags


RS1 and RS0 define the currently selected register bank


P or parity flag is the parity of the accumulator - even parity.


159.223 Assembler 5 - 1