[an error occurred while processing this directive]
|
PLACING DATA IN REGISTERS
The __regvar keyword is used for declaring that a global or static
variable should be placed permanently in the specified register or
registers. The registers R4 –R15 can be used for this purpose, provided that they have been locked with the --lock_regs compiler option; see
page 102 for additional information. Also see Register usage, page 43.
To declare a global register variable, use the following syntax:
__regvar __no_init type_name variable_name @location
This will create a variable called variable_name of type type_name ,
located in registers starting from R location , e.g.
__regvar __no_init int counter @14;
This will create the 16-bit integer variable counter, which will always be available in R15:R14 . At least two registers must be locked. And, as noted on page 103, if you lock any registers in your code, the library must be rebuilt with the same set of locked registers.
Note: It is not possible to point to an object that has been declared
__regvar . An object declared __regvar cannot have an initial value.
Inline assembler
The asm intrinsic function assembles and inserts the supplied assembler
statement in-line. The statement can include instruction mnemonics,
register mnemonics, constants, and/or a reference to a global variable. For example:
asm("LDI R16,0 \n LDI R17,0 \n RET");
E-mail: info@telesys.ru