Jumps and Function Calls – TML Programming Details60

The TML offers the possibility to make unconditional or conditional jumps and calls of functions.

The jumps are executed with TML command GOTO, followed by a jump address. The jump address may be specified with an immediate value, through a label or via 16-bit TML variable containing it. A label can be any user-defined string of up to 32 characters starting with an alphanumeric character or with underscore. A label starts from the first column of a text line and ends with a colon (:). It contains the TML program address of the next TML instruction. Using an assignment instruction of type: user_var = label; you can set a jump address in an integer TML variable.

In a conditional jump, a condition is tested. If the condition is true the jump is executed, else the next TML command is carried out. The condition is specified by a test variable and a test condition both added after the jump address. The test variable is always compared with zero. The possible test conditions are: < 0, <= 0, >0, >=0, =0, 0.

The calls are executed with TML command CALL, followed by a TML function address. A TML function is a set of TML commands which starts with a label and ends with the RET instruction. The label gives the TML function address and name. Like the jump address, the TML function address may be specified with an immediate value, through a label or via 16-bit TML variable containing it.

In a conditional call, a condition is tested. If the condition is true the TML function is executed, else the next TML command is carried out. The condition is specified by a test variable and a test condition added after the TML function address. The test variable is always compared with zero. The possible test conditions are: < 0, <= 0, >0, >=0, =0, 0.

Using TML command CALLS, you can do a cancelable call. Use this command if the exit from the called function depends on conditions that may not be reached. In this case, using TML command ABORT you can terminate the function execution and return to the next instruction after the call.

See also:

Jumps and Function Calls – Related TML Instructions and Data

TML Description