SPLat Logo

Branch

NOTICE: Our web site is being updated, but is currently experiencing extreme slowness due to host issues. Please contact us directly.
NOTICE: SPLat Controls has moved. We are now at 1/85 Brunel Rd, Seaford, 3198. map
SPLat will be shut down for the Christmas Holiday season from Friday 20 December 2024 through Tuesday 7 January 2025. We will check emails periodically and will continue to process orders but at a slower pace. Santa hat

Branch

PC = [PC+1+X]

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 Again ;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 Again 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.

On 8 bit controllers (green boards), there may be up to 127 Target instructions following it.  On 32 bit controllers (black boards) there may be 256 Targets.

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 guarantee of what will happen.  Your controller will either crash or behave very strangely.