Command |
Used in a switch-block, specifies a test case and the id of a target list.
public void AppendCaseBranchList( int listID, uint cond )
Appends a CASE_BRANCH_LIST command to the list.
The calling list becomes idle and as a result triggers a ListIdle event. Furthermore, as execution control is surrendered by the calling list, it is no longer busy, but instead the target list becomes busy.
For every Execute(Int32) only one ListDone event will be sent along with the list ID of the final list that was executing.
Please note that this is a contrived example, illustrating very naive usage of the switch-block.
// Arbitrary values for demo only: uint lowSpeedMarkingBitmask = 0x5AA5; uint mediumSpeedMarkingBitmask = 0xA55A; // Arbitrary values for demo only: int lowSpeedMarkingListID = 333; int mediumSpeedMarkingListID = 444; int highSpeedMarkingListID = 555; CommandList listBranch = new CommandList(); listBranch.AppendJumpAbs( 0, 0 ); listBranch.AppendSwitch( IOPort.PortB, true ); listBranch.AppendCaseBranchList( lowSpeedMarkingListID, lowSpeedMarkingBitmask ); listBranch.AppendCaseBranchList( mediumSpeedMarkingListID, mediumSpeedMarkingBitmask ); listBranch.AppendDefaultBranchList( highSpeedMarkingListID ); Console.WriteLine( $"ListBranch commands:" ); int count = 0; foreach ( var cmd in listBranch ) Console.WriteLine( $" {count++}: {cmd.ToString()}" ); CommandList listCall = new CommandList(); listCall.AppendJumpAbs( 0, 0 ); listCall.AppendSwitch( IOPort.PortB, true ); listCall.AppendCaseCallList( lowSpeedMarkingListID, lowSpeedMarkingBitmask ); listCall.AppendCaseCallList( mediumSpeedMarkingListID, mediumSpeedMarkingBitmask ); listCall.AppendDefaultCallList( highSpeedMarkingListID ); Console.WriteLine( $"ListCall commands:" ); count = 0; foreach ( var cmd in listCall ) Console.WriteLine( $" {count++}: {cmd.ToString()}" ); // output should be: // ListBranch commands: // 0: { JA, P2D[ X=0 Y=0 ] } // 1: { SWI, I32[ 1 ], Bool[ True ], U32[ 4294967295 ] } // 2: { CASBL, I32[ 333 ], I32[ 23205 ] } // 3: { CASBL, I32[ 444 ], I32[ 42330 ] } // 4: { DEFBL, I32[ 555 ] } // ListCall commands: // 0: { JA, P2D[ X=0 Y=0 ] } // 1: { SWI, I32[ 1 ], Bool[ True ], U32[ 4294967295 ] } // 2: { CASCL, I32[ 333 ], I32[ 23205 ] } // 3: { CASCL, I32[ 444 ], I32[ 42330 ] } // 4: { DEFCL, I32[ 555 ] }