LMS 2012
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Program Structure

Program example with commonly used items

                                                  // Constants are declared in between objects (vmthread and subcall)
define    MY_GLOBAL_CONSTANT            100       // MY_GLOBAL_CONSTANT equals 100

                                                  // Global variables are declared in between objects
DATAF     MyGlobalFloat                           // MyGlobalFloat is of the type float


vmthread  MAIN                                    // All programs must start with the "main" thread object (more vmthread's are allowed)
{
                                                  // Local variables are declared inside objects and are only valid here
  DATA8   MyLocalByte                             // MyLocalByte is of the type signed byte

Loop:                                             // Labels are local and only recognised inside the object (Symbolic names can be reused in other objects)

  CALL(MySubcall,MyLocalByte)                     // Call MySubcall with one parameter

  MOVE8_F(MyLocalByte,MyGlobalFloat)              // Assign the return parameter value from MySubcall to MyGlobalFloat

  JR(Loop)                                        // Jump unconditional to label "Loop"
}


subcall   MySubcall                               // Sub calls are all global objects
{
  IO_8    MyParameter                             // Declare sub call parameters

  DATA8   MyLocalVariable                         // Declare sub call local variables

  MOVE8_8(MY_GLOBAL_CONSTANT,MyLocalVariable)     // Initialise MyLocalVariable

  MOVE8_8(MyLocalVariable,MyParameter)            // Return the value of MyLocalVariable in parameter MyParameter
}