{"id":3235,"date":"2025-04-17T10:27:05","date_gmt":"2025-04-17T10:27:05","guid":{"rendered":"https:\/\/webprojects.cloud\/wordpress\/splatco\/?post_type=spl_knowledgebase&#038;p=3235"},"modified":"2025-06-10T07:42:26","modified_gmt":"2025-06-10T07:42:26","slug":"auto-allocation-semaphores","status":"publish","type":"spl_knowledgebase","link":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/splat-pc-programming-software\/splat-pc-ram-allocation-schemes\/splat-pc-automatic-ram-allocation\/auto-allocation-semaphores\/","title":{"rendered":"Auto-Allocation: Semaphores"},"content":{"rendered":"\n<p>The auto-allocation algorithm gives special treatment to semaphores. Semaphores get auto-allocated to\u00a0<a href=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/glossary-of-terms\/#o414\">RAM<\/a>\u00a0above address 32, one bit at a time. A new byte gets allocated each time the previous one has been filled. To address auto-allocated semaphores you use only the semaphore&#8217;s name (label)\u00a0<em>without a base address<\/em>. SPLat\/PC takes care of the base address automatically.<\/p>\n\n\n\n<h6 class=\"wp-block-heading\">Example (simple semaphores with auto-allocation):<\/h6>\n\n\n\n<pre class=\"wp-block-preformatted\">MySem0:       defSEM              ;First semaphore bit\n        ...\n              SetS        MySem0  ;Note: no base address\n        ...\n              GoIfST      MySem0,Sem0IsTrue<\/pre>\n\n\n\n<p>If you use an argument in a\u00a0<code>defSEM<\/code>\u00a0directive it will allocate that many contiguous\u00a0<em>bits<\/em>\u00a0to semaphores. This is consistent with\u00a0<a href=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-multitrack\/\">MultiTrack<\/a>\u00a0and jndexing.<\/p>\n\n\n\n<h6 class=\"wp-block-heading\">Example (indexed semaphores with manual allocation):<\/h6>\n\n\n\n<p>This example is how you would do it if you are using indexed addressing without MultiTrack. This technique is&nbsp;<em>not<\/em>&nbsp;recommended for new programs, because MultiTrack and jndexing, along with auto-allocation (previous example), provides a much more elegant way of doing it.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">MySemArray:   defByte     6       ;Set aside 6 bytes\nMySem0:       EQU         0       ;First semaphore bit\n        ...\nMySem7:       EQU         7       ;Last semaphore bit\n        ...\n              iSetS       MySem0,MySemArray<\/pre>\n\n\n\n<p>The above iSetS will set semaphore represented by bit 0 of the I&#8217;th byte in the array, where I is the index register. (The program would have to be written to be very sure I is in the range 0 to 5 or something bad might happen!)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The auto-allocation algorithm gives special treatment to semaphores. Semaphores get auto-allocated to\u00a0RAM\u00a0above address 32, one bit at a time. A new byte gets allocated each&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":3230,"menu_order":3,"template":"","class_list":["post-3235","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>Auto-Allocation: Semaphores - 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=\"Auto-Allocation: Semaphores - SPLat Controls\" \/>\n<meta property=\"og:description\" content=\"The auto-allocation algorithm gives special treatment to semaphores. Semaphores get auto-allocated to\u00a0RAM\u00a0above address 32, one bit at a time. A new byte gets allocated each...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/splat-pc-programming-software\/splat-pc-ram-allocation-schemes\/splat-pc-automatic-ram-allocation\/auto-allocation-semaphores\/\" \/>\n<meta property=\"og:site_name\" content=\"SPLat Controls\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-10T07:42:26+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\/splat-pc-programming-software\/splat-pc-ram-allocation-schemes\/splat-pc-automatic-ram-allocation\/auto-allocation-semaphores\/\",\"url\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/splat-pc-programming-software\/splat-pc-ram-allocation-schemes\/splat-pc-automatic-ram-allocation\/auto-allocation-semaphores\/\",\"name\":\"Auto-Allocation: Semaphores - SPLat Controls\",\"isPartOf\":{\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/#website\"},\"datePublished\":\"2025-04-17T10:27:05+00:00\",\"dateModified\":\"2025-06-10T07:42:26+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/splat-pc-programming-software\/splat-pc-ram-allocation-schemes\/splat-pc-automatic-ram-allocation\/auto-allocation-semaphores\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/splat-pc-programming-software\/splat-pc-ram-allocation-schemes\/splat-pc-automatic-ram-allocation\/auto-allocation-semaphores\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/splat-pc-programming-software\/splat-pc-ram-allocation-schemes\/splat-pc-automatic-ram-allocation\/auto-allocation-semaphores\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"SPLat\/PC programming software\",\"item\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/splat-pc-programming-software\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"SPLat\/PC: RAM allocation schemes\",\"item\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/splat-pc-programming-software\/splat-pc-ram-allocation-schemes\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"SPLat\/PC: Automatic RAM allocation\",\"item\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/splat-pc-programming-software\/splat-pc-ram-allocation-schemes\/splat-pc-automatic-ram-allocation\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"Auto-Allocation: Semaphores\"}]},{\"@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":"Auto-Allocation: Semaphores - 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":"Auto-Allocation: Semaphores - SPLat Controls","og_description":"The auto-allocation algorithm gives special treatment to semaphores. Semaphores get auto-allocated to\u00a0RAM\u00a0above address 32, one bit at a time. A new byte gets allocated each...","og_url":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/splat-pc-programming-software\/splat-pc-ram-allocation-schemes\/splat-pc-automatic-ram-allocation\/auto-allocation-semaphores\/","og_site_name":"SPLat Controls","article_modified_time":"2025-06-10T07:42:26+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\/splat-pc-programming-software\/splat-pc-ram-allocation-schemes\/splat-pc-automatic-ram-allocation\/auto-allocation-semaphores\/","url":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/splat-pc-programming-software\/splat-pc-ram-allocation-schemes\/splat-pc-automatic-ram-allocation\/auto-allocation-semaphores\/","name":"Auto-Allocation: Semaphores - SPLat Controls","isPartOf":{"@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/#website"},"datePublished":"2025-04-17T10:27:05+00:00","dateModified":"2025-06-10T07:42:26+00:00","breadcrumb":{"@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/splat-pc-programming-software\/splat-pc-ram-allocation-schemes\/splat-pc-automatic-ram-allocation\/auto-allocation-semaphores\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/splat-pc-programming-software\/splat-pc-ram-allocation-schemes\/splat-pc-automatic-ram-allocation\/auto-allocation-semaphores\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/splat-pc-programming-software\/splat-pc-ram-allocation-schemes\/splat-pc-automatic-ram-allocation\/auto-allocation-semaphores\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webprojects.cloud\/wordpress\/splatco\/"},{"@type":"ListItem","position":2,"name":"SPLat\/PC programming software","item":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/splat-pc-programming-software\/"},{"@type":"ListItem","position":3,"name":"SPLat\/PC: RAM allocation schemes","item":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/splat-pc-programming-software\/splat-pc-ram-allocation-schemes\/"},{"@type":"ListItem","position":4,"name":"SPLat\/PC: Automatic RAM allocation","item":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/splat-pc-programming-software\/splat-pc-ram-allocation-schemes\/splat-pc-automatic-ram-allocation\/"},{"@type":"ListItem","position":5,"name":"Auto-Allocation: Semaphores"}]},{"@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\/3235","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\/3230"}],"wp:attachment":[{"href":"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-json\/wp\/v2\/media?parent=3235"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}