StartTask() - The Start Task Command
The StartTask() command starts one or more tasks on the same device.
A task cannot be started if it is already running. To restart a task you must first stop it or wait for it to complete.
This command will also continue a task where it left off that has been paused by the PauseTask() command.
This command is the opposite of the StopTask() command.
Syntax
Basic Use
StartTask(x)
Where "x" is the task you want to start.
Can be any value 1-254 or "ALL" to start all tasks at once.
Although you can StartTask(All), I do not see a practical purpose for this and it could create a large burden on the processor. |
Advanced Use
StartTask(x,y,z,…n)
This allows you to start multiple tasks with a single command. However, this technique will only work with tasks numbered 16 or less. To start a higher numbered task you must use the basic version.
Examples
Example 1
A basic use of the command to start a single task.
{
Start(0x1c,x,x,x,x,x,x) //Watches all incomming 1C messages.
copy @0,~0,7 //Copy the msg to ~0-6. ~1 is area, ~3 is preset.
LDA ~1 //Get Area byte
CMP #2 //Is it a message for Area 2?
BRZ Area2 //If it matches branch. If not continue.
CMP #3 //Is it a message for Area 3?
BRZ Area3 //
CMP #250 //Is it a message for Area 250?
BRZ Area250 //
Null //Stop. Do not pass go. Do not collect $200.
Area2:
StartTask(2) //Start task two.
Null
Area3:
StartTask(3) //Start task three.
Null
Area250:
StartTask(4) //Start task four.
Null
}