72/317
4 - Architecture of the ST7 core
That is the translation of the statement above, supposing the variable
Voltage
had been as-
signed to the memory address
124h
.
In the examples of source lines above, the text that follows the semicolon (;) is a comment. It
is ignored by the assembler, and its sole purpose is to inform the human reader of the source
text, when he later reads it.
The last category of words listed above is the macro name. A macro is a piece of text the pro-
grammer may define freely and which he can give a name. Inserting the macro name in the
source text will replace that word by the whole predefined text, saving the programmer typing
effort.
4.3.2 Addressing modes
The ST7 has many addressing modes. In addition to those inherited from the industry-
standard architecture, there are those involving the second index register,
Y
, that duplicate the
addressing modes available with the
X
index register, and all the indirect addressing modes.
Having a choice of addressing modes might seems surprising. Anyone might think that indi-
cating the address of the source or destination of a data move should be a straightforward
matter. Actually, there are several cases to handle:
If the address of the byte to be read or written is known at the time the program is written, the
direct addressing mode is used. This mode has two variants: short direct mode addresses
page zero; long direct mode addresses the whole range.
If the address of the byte is not known when the program is written, this means that the data
has the form of a record, a string, an array or any other structure that holds complex data.
Since the ST7 only processes bytes, it is necessary to process this kind of data byte-by-byte.
Then, the address of the byte to be read is computed when the program executes, and it is
this address that indicates which byte must be read. According to the structure of the data,
one addressing mode or another might prove more convenient, or fast, or efficient. The ST7
has a choice of addressing modes that take the address from an index register (indexed
addressing), or from the contents of a memory byte (indirect addressing), or a combination.
Instructions that load constants into a register use immediate addressing, which means that
the data is located just after the instruction code in program memory. This data is skipped to
reach the next instruction.
Jump instructions often branch to an address that is close to the address of the jump
instruction. If the distance of the jump is within the range -128 to +127 from the instruction
that follows the jump, relative addressing is efficient since the address of the destination of
the jump is obtained by adding the single byte that follows the jump instruction to the current
value of the Program Counter. This byte is called displacement. This instruction thus saves
one byte of program memory. All conditional jumps use this addressing mode.
Содержание 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 ...