Datasheet

ASM DECLARATION
The mikroC PRO for AVR allows embedding assembly in the source code by means
of the
asm declaration. The declarations _asm and __asm are also allowed in the
mikroC PRO for AVR and have the same meaning. Note that numerals cannnot be
used as absolute addresses for SFR or GPR variables in assembly instructions.
Symbolic names may be used instead (listing will display these names as well as
addresses).
Assembly instructions can be grouped by the asm keyword (or
_asm, or __asm):
asm {
block of assembly instructions
}
There are two ways to embeding single assembly instruction to C code:
asm assembly instruction ;
and
asm assembly instruction
Note: semicolon and LF are terminating asm scope for single assembly instructions.
This is the reason why the following syntax is not asm block:
asm
{
block of assembly instructions
}
This code will be interpreted as single empty asm line followed by C compound
statement.
The mikroC PRO for AVR comments (both single-line and multi-line) are allowed in
embedded assembly code.
Accessing individual bytes is different as well. For example, a global variable "g_var"
of type char (i.e. 1 byte) can be accessed like this:
STS _g_var+0, R10
If you want to know details about asm syntax supported by mikroC PRO for AVR it is
recomended to study asm and lst files generated by compiler. It is also recomended
to check "Include source lines in output files" checkbox in Output settings
Related topics: mikroC PRO for AVR specifcs
185
MIKROELEKTRONIKA - SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Language Reference
mikroC PRO for AVR
CHAPTER 5