229/317
8 - C Language and the C Compiler
float Coefficient ;{ two non-volatile parameters }
#pragma DATA_SEG DEFAULT
int Value[10] ;{ an array of ten integers, volatile }
8.3.1.3 Page Zero variables
Direct addressing, as mentioned in the chapter that discusses addressing modes, is much
more efficient than extended addressing, both in terms of code size and speed. Thus, as much
data as possible should be allocated to page zero; and to optimize speed, it should be the
most frequently used data.
To allocate a variable to page zero, two options are possible:
Create a new segment with the SHORT attribute:
#pragma DATA_SEG SHORT FAST_DATA
int FastVariable ;
Use the predefined _ZEROPAGE segment. This segment is always defined for temporary
data generated by the compiler, and may be enlarged with the user's variables:
#pragma DATA_SEG _ZEROPAGE
int FastVariable ;
Of course, the effect of these pragmas must be reversed as appropriate using
#pragma DATA_SEG DEFAULT
8.3.1.4 Far and near pointers
Two kinds of addressing mode, short and extended, are to be found in direct addressing as
well as in indexed and indirect addressing. This leads to two types of pointers: near and far
pointers.
The
near
and
far
modifiers are not standard; they are an extension to the C language that,
actually, is found on many compilers for many other processors. They are used as follows:
int * far pI ;
/* a far pointer to an integer */
char * near pC ;
/* a near pointer to a character */
char * far * far pFFC ;/* a far pointer to a far pointer to a character */
char * far * near pFNC ;/* a near pointer to a far pointer to a character */
A near pointer consists of a single byte and thus can only reach addresses below 100h.
Содержание 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 ...