{"id":2818,"date":"2025-04-16T12:19:05","date_gmt":"2025-04-16T12:19:05","guid":{"rendered":"https:\/\/webprojects.cloud\/wordpress\/splatco\/?post_type=spl_knowledgebase&#038;p=2818"},"modified":"2025-05-05T12:20:08","modified_gmt":"2025-05-05T12:20:08","slug":"branch","status":"publish","type":"spl_knowledgebase","link":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-reference\/instructions-arranged-by-function\/number-comparison-and-testing-instructions\/comparison-and-testing-for-byte-values\/branch\/","title":{"rendered":"Branch"},"content":{"rendered":"\n<p><code>PC = [PC+1+X]<\/code><\/p>\n\n\n\n<p>The&nbsp;<code>Branch<\/code>&nbsp;instruction allows an &#8220;n-way&#8221; branch on the contents of the&nbsp;<a href=\"https:\/\/www.splatco.com\/skb\/352.htm#o3808\">X<\/a>&nbsp;register. A&nbsp;<code>Branch<\/code>&nbsp;instruction must always be followed by a list of one or more program labels used as arguments in&nbsp;<code>Target<\/code>&nbsp;instructions. Example<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><br>   Branch<br>   Target      Again         ;target if X=0<br>   Target      More          ;target if X=1<br>   Target      Orless        ;target if X=2<br><\/pre>\n\n\n\n<p>In the example, the program will transfer to label&nbsp;<code>Again<\/code>&nbsp;if X=0, to&nbsp;<code>More<\/code>&nbsp;if X=1 and to&nbsp;<code>Orless<\/code>&nbsp;if X=2.<\/p>\n\n\n\n<p><em>For any other value of X the results are unpredictable in SPLat hardware<\/em>.<\/p>\n\n\n\n<p>On 8 bit controllers (green boards), there may be up to&nbsp;<strong>127<\/strong>&nbsp;Target instructions following it.&nbsp; On 32 bit controllers (black boards) there may be&nbsp;<strong>256<\/strong>&nbsp;Targets.<\/p>\n\n\n\n<p>See also\u00a0<code><a href=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-reference\/instructions-arranged-by-function\/goto-gosub-and-related-instructions\/target-llll\/\">Target<\/a> <a href=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-reference\/instructions-arranged-by-function\/memory-instructions\/branchm-mm\/\">BranchM<\/a> <a href=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-reference\/instructions-arranged-by-function\/number-comparison-and-testing-instructions\/comparison-and-testing-for-byte-values\/branchr\/\">BranchR<\/a> <a href=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-reference\/instructions-arranged-by-function\/goto-gosub-and-related-instructions\/branchj-d16\/\">BranchJ<\/a><\/code><\/p>\n\n\n\n<figure class=\"wp-block-table is-style-stripes\"><table class=\"has-fixed-layout\"><tbody><tr><td>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.&nbsp; Your controller will either crash or behave very strangely.<\/td><\/tr><\/tbody><\/table><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>PC = [PC+1+X] The&nbsp;Branch&nbsp;instruction allows an &#8220;n-way&#8221; branch on the contents of the&nbsp;X&nbsp;register. A&nbsp;Branch&nbsp;instruction must always be followed by a list of one or more&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":2817,"menu_order":0,"template":"","class_list":["post-2818","spl_knowledgebase","type-spl_knowledgebase","status-publish","hentry"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Branch - SPLat Controls<\/title>\n<meta name=\"robots\" content=\"noindex, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Branch - SPLat Controls\" \/>\n<meta property=\"og:description\" content=\"PC = [PC+1+X] The&nbsp;Branch&nbsp;instruction allows an &#8220;n-way&#8221; branch on the contents of the&nbsp;X&nbsp;register. A&nbsp;Branch&nbsp;instruction must always be followed by a list of one or more...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-reference\/instructions-arranged-by-function\/number-comparison-and-testing-instructions\/comparison-and-testing-for-byte-values\/branch\/\" \/>\n<meta property=\"og:site_name\" content=\"SPLat Controls\" \/>\n<meta property=\"article:modified_time\" content=\"2025-05-05T12:20:08+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-reference\/instructions-arranged-by-function\/number-comparison-and-testing-instructions\/comparison-and-testing-for-byte-values\/branch\/\",\"url\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-reference\/instructions-arranged-by-function\/number-comparison-and-testing-instructions\/comparison-and-testing-for-byte-values\/branch\/\",\"name\":\"Branch - SPLat Controls\",\"isPartOf\":{\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/#website\"},\"datePublished\":\"2025-04-16T12:19:05+00:00\",\"dateModified\":\"2025-05-05T12:20:08+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-reference\/instructions-arranged-by-function\/number-comparison-and-testing-instructions\/comparison-and-testing-for-byte-values\/branch\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-reference\/instructions-arranged-by-function\/number-comparison-and-testing-instructions\/comparison-and-testing-for-byte-values\/branch\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-reference\/instructions-arranged-by-function\/number-comparison-and-testing-instructions\/comparison-and-testing-for-byte-values\/branch\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Programming reference\",\"item\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-reference\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Instructions arranged by function\",\"item\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-reference\/instructions-arranged-by-function\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Number comparison and testing instructions\",\"item\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-reference\/instructions-arranged-by-function\/number-comparison-and-testing-instructions\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"Comparison and testing for byte values\",\"item\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-reference\/instructions-arranged-by-function\/number-comparison-and-testing-instructions\/comparison-and-testing-for-byte-values\/\"},{\"@type\":\"ListItem\",\"position\":6,\"name\":\"Branch\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/#website\",\"url\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/\",\"name\":\"SPLat Controls\",\"description\":\"OEM Embedded Machine Controllers\",\"publisher\":{\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/#organization\",\"name\":\"SPLat Controls\",\"url\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-content\/uploads\/2024\/10\/logo.svg\",\"contentUrl\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-content\/uploads\/2024\/10\/logo.svg\",\"caption\":\"SPLat Controls\"},\"image\":{\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Branch - SPLat Controls","robots":{"index":"noindex","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"og_locale":"en_US","og_type":"article","og_title":"Branch - SPLat Controls","og_description":"PC = [PC+1+X] The&nbsp;Branch&nbsp;instruction allows an &#8220;n-way&#8221; branch on the contents of the&nbsp;X&nbsp;register. A&nbsp;Branch&nbsp;instruction must always be followed by a list of one or more...","og_url":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-reference\/instructions-arranged-by-function\/number-comparison-and-testing-instructions\/comparison-and-testing-for-byte-values\/branch\/","og_site_name":"SPLat Controls","article_modified_time":"2025-05-05T12:20:08+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-reference\/instructions-arranged-by-function\/number-comparison-and-testing-instructions\/comparison-and-testing-for-byte-values\/branch\/","url":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-reference\/instructions-arranged-by-function\/number-comparison-and-testing-instructions\/comparison-and-testing-for-byte-values\/branch\/","name":"Branch - SPLat Controls","isPartOf":{"@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/#website"},"datePublished":"2025-04-16T12:19:05+00:00","dateModified":"2025-05-05T12:20:08+00:00","breadcrumb":{"@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-reference\/instructions-arranged-by-function\/number-comparison-and-testing-instructions\/comparison-and-testing-for-byte-values\/branch\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-reference\/instructions-arranged-by-function\/number-comparison-and-testing-instructions\/comparison-and-testing-for-byte-values\/branch\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-reference\/instructions-arranged-by-function\/number-comparison-and-testing-instructions\/comparison-and-testing-for-byte-values\/branch\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webprojects.cloud\/wordpress\/splatco\/"},{"@type":"ListItem","position":2,"name":"Programming reference","item":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-reference\/"},{"@type":"ListItem","position":3,"name":"Instructions arranged by function","item":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-reference\/instructions-arranged-by-function\/"},{"@type":"ListItem","position":4,"name":"Number comparison and testing instructions","item":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-reference\/instructions-arranged-by-function\/number-comparison-and-testing-instructions\/"},{"@type":"ListItem","position":5,"name":"Comparison and testing for byte values","item":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-reference\/instructions-arranged-by-function\/number-comparison-and-testing-instructions\/comparison-and-testing-for-byte-values\/"},{"@type":"ListItem","position":6,"name":"Branch"}]},{"@type":"WebSite","@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/#website","url":"https:\/\/webprojects.cloud\/wordpress\/splatco\/","name":"SPLat Controls","description":"OEM Embedded Machine Controllers","publisher":{"@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/webprojects.cloud\/wordpress\/splatco\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/#organization","name":"SPLat Controls","url":"https:\/\/webprojects.cloud\/wordpress\/splatco\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/#\/schema\/logo\/image\/","url":"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-content\/uploads\/2024\/10\/logo.svg","contentUrl":"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-content\/uploads\/2024\/10\/logo.svg","caption":"SPLat Controls"},"image":{"@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-json\/wp\/v2\/spl_knowledgebase\/2818","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-json\/wp\/v2\/spl_knowledgebase"}],"about":[{"href":"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-json\/wp\/v2\/types\/spl_knowledgebase"}],"author":[{"embeddable":true,"href":"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-json\/wp\/v2\/users\/1"}],"up":[{"embeddable":true,"href":"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-json\/wp\/v2\/spl_knowledgebase\/2817"}],"wp:attachment":[{"href":"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-json\/wp\/v2\/media?parent=2818"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}