ASM statement

Language reference ›› Statements ››
Parent Previous Next

An assembler block may be inserted at any point, within or outside of a procedure or function or main program block.

A basic assembler block (LOW, see below) is not analyzed by PMP; its content is passed directly to the assembly file and syntax check is made by the assembler:



 ASM(LOW)
   MOVFF  MyProg.MyFunc.I, MyProg.MyFunc.J ; move variable
   CALL   MyProg.OtherProc
 END;


No assumption should be made on the current selected RAM bank at the ASM block beginning.

As well PMP assumes that the current selected RAM bank is unknown at the end of the block and that any file register content is unknown too (reset of the optimizer data).

Labels should not interfere with PMP ones (all PMP labels starts with two underscores).


An ASM block may also be used to declare things outside of a code block:



  ASM
MYCONST EQU   128 ; some constant
MYMACRO MACRO X, Y

       ENDM
 END;


The ASM block has been upgraded to resolve PMP symbols and translate them in fully qualified internal names.

Due to the possibility of portability conflicts, the syntax has been modified to accept a parameter:



  ASM
 MOVFF I,J; move variable
 CALL OtherUnitProc
 END;


will be translated to:



  ASM
   MOVFF  MyProg.MyFunc.I, MyProg.MyFunc.J ; move variable
   CALL   OtherUnit.OtherUnitProc
 END;



Special warning for interrupt procedures:


ASM blocks should be used with care within an interrupt procedure, or in a procedure or function called by an interrupt procedure, since PMP has no means to analyze the block to know what are the used registers and thus to know which one to save and restore.