{"id":59,"date":"2019-03-03T17:47:46","date_gmt":"2019-03-03T17:47:46","guid":{"rendered":"http:\/\/julien-nevo.com\/disark\/?page_id=59"},"modified":"2020-02-11T22:09:06","modified_gmt":"2020-02-11T22:09:06","slug":"label-semantics","status":"publish","type":"page","link":"https:\/\/julien-nevo.com\/disark\/index.php\/label-semantics\/","title":{"rendered":"Label semantics"},"content":{"rendered":"\n<p>Labels included to your original source will help Disark to know if a &#8220;region&#8221; or &#8220;area&#8221; contains code, bytes, words, or pointers.<\/p>\n\n\n\n<p>You can also specify more semantics, please check the examples below.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Label format<\/h2>\n\n\n\n<p>The labels are spotted by Disark via their inner tag. The tag <em>can <\/em>have a prefix, and <em>must <\/em>have a postfix:<\/p>\n\n\n\n<p><strong>Correct:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>MyCode_DisarkCodeRegionStart_Stuff\nDisarkCodeRegionStart1\nDisarkCodeRegionEnd1<\/code><\/pre>\n\n\n\n<p><strong>Incorrect:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>YeahDisarkCodeRegionStart        ;No postfix!<\/code><\/pre>\n\n\n\n<p>One opened region must also have an end. They can overlap!<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>    ld hl,0\nMyGame_DisarkByteRegionStart_1\n    db ...\nMyGame_DisarkByteRegionEnd_1       ;Closing the Byte region \"_1\".\n\nMyGame_DisarkWordRegionStart_1\n    dw ...\n\n;Error! MyGame_DisarkWordRegionStart_1 was not closed! <\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">References distance<\/h2>\n\n\n\n<p>Disark tries to link pointers to the best\/closest reference it knows. However, it only tries to match references that <strong>are +\/- 10 bytes in vicinity<\/strong>, as it appears to be what is the most practical. If this behavior does not suit you, you can use the &#8220;force reference&#8221; labels below.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"> Labels understood by Disark <\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Code region<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>...DisarkCodeRegionStart...\n...DisarkCodeRegionEnd...<\/code><\/pre>\n\n\n\n<p>These are default and you shouldn&#8217;t really have to use them.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Byte region<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>...DisarkByteRegionStart...\n...DisarkByteRegionEnd...<\/code><\/pre>\n\n\n<p>To be used for declaring bytes (DB 1, 2, 3, etc.).<\/p>\n<p><!--StartFragment--><\/p>\n\n\n<h3 class=\"wp-block-heading\">Word region<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>...DisarkWordRegionStart...\n...DisarkWordRegionEnd...<\/code><\/pre>\n\n\n<p><!--EndFragment-->Use this to declare words (DW 1, 2, 3, etc.). Reference will <strong>not<\/strong> be inferred for such regions. So they will not be modified in case of relocation.<\/p>\n\n\n<h3 class=\"wp-block-heading\">Pointer region<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>...DisarkPointerRegionStart...\n...DisarkPointerRegionEnd...<\/code><\/pre>\n\n\n<p><!--EndFragment-->Use these to declare an array of pointers. References <strong>will<\/strong> be found if possible.<\/p>\n\n\n<h3 class=\"wp-block-heading\">Force-reference area<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>...DisarkForceReferenceAreaStart...\n...DisarkForceReferenceAreaEnd...<\/code><\/pre>\n\n\n<p><!--EndFragment-->When used, this will force a reference to be used. For example, if you want a Word or a Pointer to use a reference, you can use such labels. Even if a label is far away, it <strong>will<\/strong> be used because you forced a reference!<\/p>\n\n\n<h3 class=\"wp-block-heading\">Force-non-reference area <\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>...DisarkForceNonReferenceAreaStart...\n...DisarkForceNonReferenceAreaEnd...<\/code><\/pre>\n\n\n<p><!--EndFragment-->On the opposite, this forces the non-use of a reference. For example, your code is addressing <strong>an input\/ouput port<\/strong> (out (#a0),a or ld bc,#7f00)). This must not be changed when the code is relocated! (for a simpler use, check the next labels).<\/p>\n<p><\/p>\n<p><!--StartFragment--><\/p>\n\n\n<h3 class=\"wp-block-heading\">Force-reference during&#8230;<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>...DisarkForceReferenceDuring&lt;X>...<\/code><\/pre>\n\n\n<p><!--EndFragment-->Forces the referencing for an area composed of X bytes. X must be between 1 and 9, inclusive. Simpler than declaring an area like above! An example:<\/p>\n\n\n<pre class=\"wp-block-code\"><code>LABEL equ #1000\nDisarkForceReferenceDuring3_Hello   ;ld hl,xxxx takes 3 bytes.\n      ld hl,LABEL + #3000<\/code><\/pre>\n\n\n<p>Normally, the LD instruction should not be referencing LABEL because too far from it. By forcing the reference, Disark will use the closed label, no matter how far it is.<br><!--StartFragment--><\/p>\n\n\n<h3 class=\"wp-block-heading\">Force-non-reference during&#8230; <\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>...DisarkForceNonReferenceDuring&lt;X>...<\/code><\/pre>\n\n\n<p><!--EndFragment-->On the opposite, this forces the non-use of a reference during X bytes (from 1 to 9 inclusive). Example:<!--EndFragment--><\/p>\n\n\n<pre class=\"wp-block-code\"><code>     org #7f00\nSTART\n     ld hl,#7f00     ;This is an IO port on CPC! We don't want it to be changed by relocation!\n     out (c),c\n\nSo...\n\nDisarkForceNonReferenceDuring3_1 ld hl,#7f00   ;Safe! Will not be using the START reference.\n     out (c),c<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Force reference for next word<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>...DisarkWordForceReference...<\/code><\/pre>\n\n\n<p>The following Word will be using a reference, no matter how far it is. No need to declare a Word Region, which can be bothersome! Example:<\/p>\n\n\n<pre class=\"wp-block-code\"><code>     org #1000\nLabel1 ld hl,0\n     ...\n     ret\nDisarkWordForceReference_HiMum dw Label1   ;This declares a Word Region, using a reference.<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Force-non-reference for next word<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>...DisarkWordForceNonReference...<\/code><\/pre>\n\n\n<p>The following Word will <strong>not<\/strong> be using a reference. No need to declare a Word Region. Example:<\/p>\n\n\n<pre class=\"wp-block-code\"><code>     org #1000\nLabel1 ld hl,0\n     ...\n     ret\nDisarkWordForceNonReference_HiDad dw #7f00 ;This declares a Word Region, and it will never reference any label.<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">External labels<\/h3>\n\n\n\n<p>Some assemblers (to my knowledge, only SDCC) will require some labels to be marked in a special way for C code to be able to reach Z80 labels. This is doable with Disark! Duplicate your external label and mark it with a special tag:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">MyLabel<strong>DisarkGenerateExternalLabel<\/strong>\nMyLabel\n    ld hl,0\n    ... <\/pre>\n\n\n\n<p>All that is <em>before<\/em> the <em>DisarkGenerateExternalLabel <\/em>tag will be used to generate an external  label.<\/p>\n\n\n\n<p>If the SDCC profile is <em>not<\/em> used, only MyLabel is generated. If the SDCC profile is used, two labels are generated:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">_MyLabel::\nMyLabel\n    ld hl,0\n    ...\n<\/pre>\n\n\n\n<p>For now, external labels are only used in the SDCC profile, and the prefix (&#8220;_&#8221;) and postfix (&#8220;::&#8221;) can not be modified. If this is needed, please contact me and I&#8217;ll generalize the concept.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Labels included to your original source will help Disark to know if a &#8220;region&#8221; or &#8220;area&#8221; contains code, bytes, words, or pointers. You can also specify more semantics, please check the examples below. Label format The labels are spotted by Disark via their inner tag. The tag can have a prefix, and must have a <span class=\"spf-read-more\"><a class=\"spf-link-more\" href=\"https:\/\/julien-nevo.com\/disark\/index.php\/label-semantics\/\" title=\"Read moreLabel semantics\">Read more<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-59","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Label semantics - Disark<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/julien-nevo.com\/disark\/index.php\/label-semantics\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Label semantics - Disark\" \/>\n<meta property=\"og:description\" content=\"Labels included to your original source will help Disark to know if a &#8220;region&#8221; or &#8220;area&#8221; contains code, bytes, words, or pointers. You can also specify more semantics, please check the examples below. Label format The labels are spotted by Disark via their inner tag. The tag can have a prefix, and must have a Read more\" \/>\n<meta property=\"og:url\" content=\"https:\/\/julien-nevo.com\/disark\/index.php\/label-semantics\/\" \/>\n<meta property=\"og:site_name\" content=\"Disark\" \/>\n<meta property=\"article:modified_time\" content=\"2020-02-11T22:09:06+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=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/julien-nevo.com\/disark\/index.php\/label-semantics\/\",\"url\":\"https:\/\/julien-nevo.com\/disark\/index.php\/label-semantics\/\",\"name\":\"Label semantics - Disark\",\"isPartOf\":{\"@id\":\"http:\/\/julien-nevo.com\/disark\/#website\"},\"datePublished\":\"2019-03-03T17:47:46+00:00\",\"dateModified\":\"2020-02-11T22:09:06+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/julien-nevo.com\/disark\/index.php\/label-semantics\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/julien-nevo.com\/disark\/index.php\/label-semantics\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/julien-nevo.com\/disark\/index.php\/label-semantics\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"http:\/\/julien-nevo.com\/disark\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Label semantics\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\/\/julien-nevo.com\/disark\/#website\",\"url\":\"http:\/\/julien-nevo.com\/disark\/\",\"name\":\"Disark\",\"description\":\"A powerful cross-platform Z80 disassembler \/ source converter\",\"publisher\":{\"@id\":\"http:\/\/julien-nevo.com\/disark\/#\/schema\/person\/1c076d62ea698382f18b9a2a7bfddb15\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/julien-nevo.com\/disark\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"http:\/\/julien-nevo.com\/disark\/#\/schema\/person\/1c076d62ea698382f18b9a2a7bfddb15\",\"name\":\"Targhan\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/julien-nevo.com\/disark\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/c4ecfa4cef2c920a1d2544b3025074e4ab0d1685c53b73ecdf3c803225808696?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/c4ecfa4cef2c920a1d2544b3025074e4ab0d1685c53b73ecdf3c803225808696?s=96&d=mm&r=g\",\"caption\":\"Targhan\"},\"logo\":{\"@id\":\"http:\/\/julien-nevo.com\/disark\/#\/schema\/person\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Label semantics - Disark","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/julien-nevo.com\/disark\/index.php\/label-semantics\/","og_locale":"en_US","og_type":"article","og_title":"Label semantics - Disark","og_description":"Labels included to your original source will help Disark to know if a &#8220;region&#8221; or &#8220;area&#8221; contains code, bytes, words, or pointers. You can also specify more semantics, please check the examples below. Label format The labels are spotted by Disark via their inner tag. The tag can have a prefix, and must have a Read more","og_url":"https:\/\/julien-nevo.com\/disark\/index.php\/label-semantics\/","og_site_name":"Disark","article_modified_time":"2020-02-11T22:09:06+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/julien-nevo.com\/disark\/index.php\/label-semantics\/","url":"https:\/\/julien-nevo.com\/disark\/index.php\/label-semantics\/","name":"Label semantics - Disark","isPartOf":{"@id":"http:\/\/julien-nevo.com\/disark\/#website"},"datePublished":"2019-03-03T17:47:46+00:00","dateModified":"2020-02-11T22:09:06+00:00","breadcrumb":{"@id":"https:\/\/julien-nevo.com\/disark\/index.php\/label-semantics\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/julien-nevo.com\/disark\/index.php\/label-semantics\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/julien-nevo.com\/disark\/index.php\/label-semantics\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"http:\/\/julien-nevo.com\/disark\/"},{"@type":"ListItem","position":2,"name":"Label semantics"}]},{"@type":"WebSite","@id":"http:\/\/julien-nevo.com\/disark\/#website","url":"http:\/\/julien-nevo.com\/disark\/","name":"Disark","description":"A powerful cross-platform Z80 disassembler \/ source converter","publisher":{"@id":"http:\/\/julien-nevo.com\/disark\/#\/schema\/person\/1c076d62ea698382f18b9a2a7bfddb15"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/julien-nevo.com\/disark\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"http:\/\/julien-nevo.com\/disark\/#\/schema\/person\/1c076d62ea698382f18b9a2a7bfddb15","name":"Targhan","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/julien-nevo.com\/disark\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/c4ecfa4cef2c920a1d2544b3025074e4ab0d1685c53b73ecdf3c803225808696?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c4ecfa4cef2c920a1d2544b3025074e4ab0d1685c53b73ecdf3c803225808696?s=96&d=mm&r=g","caption":"Targhan"},"logo":{"@id":"http:\/\/julien-nevo.com\/disark\/#\/schema\/person\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/julien-nevo.com\/disark\/index.php\/wp-json\/wp\/v2\/pages\/59","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/julien-nevo.com\/disark\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/julien-nevo.com\/disark\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/julien-nevo.com\/disark\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/julien-nevo.com\/disark\/index.php\/wp-json\/wp\/v2\/comments?post=59"}],"version-history":[{"count":17,"href":"https:\/\/julien-nevo.com\/disark\/index.php\/wp-json\/wp\/v2\/pages\/59\/revisions"}],"predecessor-version":[{"id":116,"href":"https:\/\/julien-nevo.com\/disark\/index.php\/wp-json\/wp\/v2\/pages\/59\/revisions\/116"}],"wp:attachment":[{"href":"https:\/\/julien-nevo.com\/disark\/index.php\/wp-json\/wp\/v2\/media?parent=59"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}