Click or drag to resize

CommandListAppendCaseBranchList(Int32, UInt32) Method

Used in a switch-block, specifies a test case and the id of a target list.


Namespace: RAYLASE.SPICE3.ClientLib
Assembly: RAYLASE.SPICE3.ClientLib (in RAYLASE.SPICE3.ClientLib.dll) Version: 3.4.1
Syntax
C#
public void AppendCaseBranchList(
	int listID,
	uint cond
)

Parameters

listID  Int32
The target list identifier.
cond  UInt32
The value against which the integer variable will be tested. Note that how this value is matched against the I/O port value depends on the compareCondAsMask flag set using the AppendSwitch(IOPort, Boolean, UInt32) command.
Remarks

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.

Example

Please note that this is a contrived example, illustrating very naive usage of the switch-block.

Switch by Port Value Example
// 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 ] }
See Also