The size of the immediate operand is implied by the instruction context. In the third
example, the instruction implies a 16-bit immediate value, but only an 8-bit value is
supplied. In this case the assembler generates the 16-bit value $0067 because the CPU
expects a 16-bit value in the instruction stream.
10.3.4 Direct Addressing Mode (DIR)
This addressing mode is sometimes called zero-page addressing because it accesses
operands in the address range $0000 through $00FF. Since these addresses always begin
with $00, only the low byte of the address needs to be included in the instruction, which
saves program space and execution time. A system can be optimized by placing the most
commonly accessed data in this area of memory. The low byte of the operand address is
supplied with the instruction and the high byte of the address is assumed to be zero.
Examples:
LDA $55
The value $55 is taken to be the low byte of an address in the range $0000 through
$00FF. The high byte of the address is assumed to be zero. During execution, the CPU
combines the value $55 from the instruction with the assumed value of $00 to form the
address $0055, which is then used to access the data to be loaded into accumulator.
LDHX $20
In this example, the value $20 is combined with the assumed value of $00 to form the
address $0020. Since the LDHX instruction requires a 16-bit value, a 16-bit word of data
is read from addresses $0020 and $0021. After execution, the H:X index register has the
value from address $0020 in its high byte and the value from address $0021 in its low
byte. The same happens for CPHX and STHX.
BRSET 0,$80,foo
In this example, direct addressing is used to access the operand and relative addressing is
used to identify the destination address of a branch, in case the branch-taken conditions
are met. This is also the case for BRCLR.
10.3.5 Extended Addressing Mode (EXT)
In extended addressing, the full 16-bit address of the memory location to be operated on
is provided in the instruction. Extended addressing can access any location in the 64 KB
memory map.
Example:
Chapter 10 Central processor unit
MC9S08PA4 Reference Manual, Rev. 5, 08/2017
NXP Semiconductors
203
Содержание MC9S08PA4
Страница 1: ...MC9S08PA4 Reference Manual Supports MC9S08PA4 Document Number MC9S08PA4RM Rev 5 08 2017 ...
Страница 2: ...MC9S08PA4 Reference Manual Rev 5 08 2017 2 NXP Semiconductors ...
Страница 22: ...MC9S08PA4 Reference Manual Rev 5 08 2017 22 NXP Semiconductors ...
Страница 28: ...System clock distribution MC9S08PA4 Reference Manual Rev 5 08 2017 28 NXP Semiconductors ...
Страница 150: ...Port data registers MC9S08PA4 Reference Manual Rev 5 08 2017 150 NXP Semiconductors ...
Страница 196: ...Human machine interfaces HMI MC9S08PA4 Reference Manual Rev 5 08 2017 196 NXP Semiconductors ...
Страница 224: ...Instruction Set Summary MC9S08PA4 Reference Manual Rev 5 08 2017 224 NXP Semiconductors ...
Страница 232: ...Functional Description MC9S08PA4 Reference Manual Rev 5 08 2017 232 NXP Semiconductors ...
Страница 258: ...FTM Interrupts MC9S08PA4 Reference Manual Rev 5 08 2017 258 NXP Semiconductors ...
Страница 268: ...Initialization application information MC9S08PA4 Reference Manual Rev 5 08 2017 268 NXP Semiconductors ...
Страница 294: ...Functional description MC9S08PA4 Reference Manual Rev 5 08 2017 294 NXP Semiconductors ...
Страница 370: ...Memory map and register description MC9S08PA4 Reference Manual Rev 5 08 2017 370 NXP Semiconductors ...
Страница 398: ...Resets MC9S08PA4 Reference Manual Rev 5 08 2017 398 NXP Semiconductors ...
Страница 400: ...MC9S08PA4 Reference Manual Rev 5 08 2017 400 NXP Semiconductors ...