User`s manual

mikroBASIC
- Basic Compiler for Microchip PIC microcontrollers
MikroElektronika:
Development
tools
-
Books
-
Compilers
mikroBASIC
making it simple...
97
page
Sometimes it can be useful to write part of the program in assembly. ASM state-
ment allows you to embed PIC assembly instructions into Basic code.
Note that you cannot use numerals as absolute addresses for SFR or GPR vari-
ables in assembly instructions. You may use symbolic names instead (listing will
display these names as well as addresses). Also, you cannot use Labels in assem-
bly; instead, you can use relative jumps such as goto $-1.
Declaration of asm statement is:
asm
statementList
end asm
where statementList is a sequence of assembly instructions.
Be careful when embedding assembly code - mikroBasic will not check if assem-
bly instruction changed memory locations already used by Basic variables.
Also, you cannot write comments in assembly.
asm
movlw 67
movwf TMR0
end asm
asm
' second instruction is incorrect, see above
MOVLW 0
MOVWF $5
MOVWF PORTA
end asm
' note that you cannot write comments in assembly
ASM Statement
Example