The Branch instruction allows an "n-way" branch on the contents of the X register. A Branch instruction must always be followed by a list of one or more program labels used as arguments in Target instructions. Example
Branch
Target Agin ;target if X=0
Target More ;target if X=1
Target Orless ;target if X=2
In the example, the program will transfer to label Agin if X=0, to More if X=1 and to Orless if X=2.
For any other value of X the results are unpredictable in SPLat hardware.
The Branch instruction may have up to 127 Targets following it. The SPLat/PC development environment will report an error if a Branch is executed with an X value too large for the number of Target labels provided. (The condition can only be detected by running or stepping the program within SPLat/PC, and not during translation).
Branch is designed to allow efficient coding of Finite State Machines where the value of X is the state number and easily controlled by the programmer.
See also Target BranchM BranchR BranchJ
When using Branch and Target take extra care. If the offset in X points to a line past the end of the Target list, there is no guaranty of what will happen during standalone operation in a SPLat board. This could lead to mysterious problems at runtime. The simulated stepping and running within SPLat/PC will pick up such problems providing every state and branch of the program is exercised.