Addressing modes
Direct
Gets the content in the register directly. (the SP register is an alias of the a7)
Ex| d0, a0, sp
Dn
Data register
An
Address register
Indirect
Gets the value contained in memory with address being the content of the address register
specified. Specifiying an offset by writing a number before the (), the addressing mode
becomes indirect with displacement and the final address to read the memory will be
(address + offset).
Ex| (a0), 4(sp)
(An)
Indirect
Indirect Post/Pre increment
Gets the value contained in memory with address being the content of the address register
specified. If it's the post increment, the address register will be incremented after
reading the memory. If it's the pre increment, the address register will be incremented
before reading the memory. The amount of increment is specified by the size of the
instruction. In the documentation, wherever there is (An), this addressing mode is valid too
Ex| (a0)+, -(sp)
(An)
Post increment
(An)
Post increment
Immediate
Represents a numerical value, it can be a number or a label. When the program is
assembled, the labels will be converted to the address of the label. Immediate values can
be represented in many bases. (replace <num> with the actual number). Note, a string will
be represented as a list of bytes.
Ex| #1000, #$FF, #@14, #%10010, #'a', #'hey', #label
Im
Immediate
#<num>
Decimal
#$<num>
Hexadecimal
#@<num>
Octal
#%<num>
Binary
#'<char/string>
Text
Effective address
Represents the address of the memory where the data is stored. It can be a label or a
number. When the program is assembled, the labels will be converted to the address of the
label.
Ex| $1000, some_label, 140, %101010, @22, 'e'
ea
Effective address
<ea>
Effective address
Base displacement indirect
Gets the value contained in memory with address being the sum of (address + offset +
base), where the first register (address) will be the base address, the second register
(base) and offset being the number before the ().
In the documentation, wherever there is (An), this addressing mode is valid too
In the documentation, wherever there is (An), this addressing mode is valid too
Ex| 4(a0, d2), (sp, a0)
(An)
Base displacement indirect