Mikroelektronika MIKROE-742 데이터 시트

다운로드
페이지 532
asm Statement
mikroPascal PRO for AVR allows embedding assembly in the source code by
means of the asm statement. Note that you cannot use numerals as absolute
addresses for register variables in assembly instructions. You may use symbolic
names instead (listing will display these names as well as addresses).
You can group assembly instructions with the asm keyword:
asm
block of assembly instructions
end;
If you plan to use a certain Pascal variable in embedded assembly only, be sure to
at least initialize it (assign it initial value) in Pascal code; otherwise, the linker will
issue an error. This is not applied to predefined globals such as P0.
For example, the following code will not be compiled because the linker won’t be
able to recognize the variable 
myvar:
program test;
var myvar : word;
begin
asm
MOV
#10, W0
MOV
W0, _myvar
end;
end.
Adding the following line (or similar one ) above the asm block would let linker know
that variable is used:
myvar := 20;
175
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Language Reference
mikroPASCAL PRO for AVR
CHAPTER 5