|
|||||||||||||||||
|
Technical Support On-Line Manuals C166 User's Guide |
Memory TypesThe memory type of an object specifies into which memory area the object is stored. Some memory areas have fast access times but limited in the amount of space available while other memory areas are large but slow to access. High-performance applications benefit from locating frequently-used variables in fast memory areas (like on-chip RAM). Large buffers and tables are typically located in larger memory areas (like external RAM or ROM). Refer to the HOLD directive for information on how to automatically locate variables based on size. A number of memory types are available. Some memory types are selected by default for certain Memory Models. Other memory types are available for explicit variable declarations and are not tied to a specific memory model.
The following examples show how to use memory types in variable declarations: char idata var1; static unsigned long far array [100]; extern float near x, huge y; extern unsigned int huge vector[1000][10]; unsigned char sdata pec_buffer [100]; char bdata flags; sbit flag0 = flags^0; The following example shows how to use a memory type in a function definition:
/*************************************************/
/* function with 'NEAR' CALL and RET instruction */
/*************************************************/
void near func1 (char *p) {
*p = 1;
}
Note
| ||||||||||||||||
|
|||||||||||||||||