Positron Compiler Documentation

Call

Source: Positron8 Compiler User Manual, PDF page 321

Syntax

Call Label

Overview

Execute the assembly language subroutine named Label.

Parameters

Label must be a valid label name.

Example

' Call an assembler routine
  Call Asm_Sub
  Asm
     Asm_Sub
     {mnemonics}
     Return
  EndAsm

Notes

The GoSub command is usually used to execute a BASIC subroutine. However, if your subroutine happens to be written in assembler, the Call command should be used. The main difference between GoSub and Call is that when Call is used, the label's existence is not checked until assembly time. Using Call, a label in an assembly language section can be accessed that would otherwise be inaccessible to GoSub. This also means that any errors produced will be assembler types.

The Call command adds Page and Bank switching instructions prior to actually calling the subroutine, however, if Call is used in an all assembler environment, the extra mnemonics preceding the command can interfere with carefully sculptured code such as bit tests etc. By wrapping the subroutine's name in parenthesis, the Bank and Page instructions are suppressed, and the Call command becomes the Call mnemonic.

 Call(Subroutine_Name)

Only use the mnemonic variation of Call, if you know that your destination is within the same Page as the section of code calling it. This is not an issue if using 18F devices, as they have a more linear memory organisation.

See also : GoSub, GoTo, Proc...EndProc, Sub...EndSub