77/317
4 - Architecture of the ST7 core
4.3.4.3 The addressing modes in detail
Immediate mode
When a register has to be loaded with a constant value that has been fixed in the program
source, that value is determined in the program source text and must be stored in the program
memory to make it fixed and permanent. In such a case, the most effective way to retrieve the
value is to use the immediate addressing mode. In this mode, it is not necessary to supply the
address of the data. The processor expects the data to immediately follow the opcode in the
program memory. This saves both time and memory size.
Example: the instruction
LD A, #10h
A is loaded with a constant value between 00h and FFh.
loads the accumulator with the value 10, not the value stored at address 10. The coding of the
instruction is (in hexadecimal):
A6 10
This instruction takes two bytes of memory.
Direct short mode
There are two direct addressing modes: short and long. They are identical, except for the
number of bytes of the address of the operand. Direct addressing means that the opcode is
followed by the address of the data in memory to be read or written. In the short version, the
address is situated between the addresses 0 and 255, and only one byte is used for it.
Example: the instruction
LD A, 10h
A is loaded with the value stored in an absolute memory address
in zero page.
loads the accumulator with the value stored in memory at address
10h
. The coding of the in-
struction is (in hexadecimal):
B6 10
This instruction takes two bytes of memory.
Direct long mode
This mode works like the direct short mode, except that the full 16-bit address is supplied. The
address then takes two bytes instead of one, lengthening the instruction by one byte. This is
why direct short addressing mode should be used as much as possible to speed up execution
and save memory space. This means that the most frequently accessed data must be placed
Содержание ST7 Series
Страница 1: ...ST7 8 BIT MCU FAMILY USER GUIDE JANUARY 1999 1 ...
Страница 238: ...238 317 8 C Language and the C Compiler 08 Burn bmp Then use the EPROMer programmer software as described in Chapter 7 ...
Страница 289: ...289 317 10 Second Application a Sailing Computer 10 befor Bs Rw Vw VMG AlphaR AlphaV Before the wind ...