^16 - The Task Start Source Port

This port is a read only value of the last way a Start() command was triggered.

Syntax

LDA ^16,0

^16 Source port responses

Response

Source Description

0x00

Internal/DyNet Mute

0x02

Comm Port 1 (Spur)

0x05

Comm Port 2 (Trunk)

Port ^22,x will tell you what triggered a task. If the response is #0x08 then it was a Start() command and this port can tell you where the message came from.

Example

Using the port to communicate where it triggered from.

Task1()
{
Start(A=100,P=1)    //Start on P1 for A100
LDA ^22,255         //Load what started the task
BRZ DontKnow
CMP #0x01           //Local trigger from StartTask command?
BRZ OtherTask
CMP #0x03           //External trigger using 0x5c opcode 0x10?
BRZ PhysicalMSG
CMP #0x05           //Started by button press?
BRZ ButtonPress
CMP #0x08           //Logical trigger using Start() command?
BRZ StartCommand
Null
StartCommand:
    LDA ^16,0       //Load where the message came from
    BRZ DyNetMute   //If 0 it was an internal message from TX command
    CMP #0x02       //Was it from the spur?
    BRZ SpurMsg
    CMP #0x05       //Was it from the trunk?
    BRZ TrunkMsg
    Null
    ...
}