{"id":3807,"date":"2025-04-21T11:24:51","date_gmt":"2025-04-21T11:24:51","guid":{"rendered":"https:\/\/webprojects.cloud\/wordpress\/splatco\/?post_type=spl_knowledgebase&#038;p=3807"},"modified":"2025-06-10T06:04:51","modified_gmt":"2025-06-10T06:04:51","slug":"nvem-string-formatting-function-nzptritem-2","status":"publish","type":"spl_knowledgebase","link":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/deprecated\/hmi-android-windows\/formatting-functions\/nvem-string-formatting-function-nzptritem-2\/","title":{"rendered":"NVEM string formatting function nz({Ptr}{,Item})"},"content":{"rendered":"\n<p>Used to look up and print zero terminated strings stored in NVEM. Useful for multiple language support and other places where it&#8217;s useful to have table based control of what&#8217;s printed.<br><br>The function can have 0, 1 or 2 arguments, and supports direct and indirect (table of addresses of strings) addressing<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Direct addressing: The NVPtr and NVRecNum point to the string.<\/li>\n\n\n\n<li>Indirect addressing: NVPtr\/NVRecNum point to a table of 16-bit pointers, which in turn point to the desired string. This is provides a mechanism for multiple language support &#8211; the language is selected simply by changing NVPtr.<\/li>\n<\/ul>\n\n\n\n<p>The function does not alter NVPage.<\/p>\n\n\n\n<p>In all cases the string to be printed must be stored in zero terminated form, for example:-<\/p>\n\n\n\n<p><code>strHello NV0Byte \"Hello World!\",0<\/code><\/p>\n\n\n\n<p>The zero at&nbsp; the end terminates the string.<\/p>\n\n\n\n<p>The three forms of this formatting function are:<\/p>\n\n\n\n<h6 class=\"wp-block-heading\">No arguments &#8211;&nbsp; nz()<\/h6>\n\n\n\n<p>If you don&#8217;t supply any arguments the existing settings of NVPage, NVPtr, NVRecLen and NVRecNum determine the string to be printed. It is entirely your responsibility to get them right.<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">           NVSetPage   0<br>           NVSetRecNum 0<br>           NVSetPtr    strHello<br>           #HMI Print(nz())<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">strHello: NVByte \"Hello World\",0 <\/pre>\n\n\n\n<h6 class=\"wp-block-heading\">One argument &#8211; nz(Ptr)<\/h6>\n\n\n\n<p>The argument&nbsp;<code>Ptr<\/code>&nbsp;determines where the string will be found. The functions loads the NVPtr with a value specified by&nbsp;<code>Ptr<\/code>, and sets NVRecNum to zero. That means you must specify a single value that points directly at the required string.&nbsp;<code>Ptr<\/code>&nbsp;specifiers are described in the table below.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">            #HMI Print(nz(strHello))<br><br>strHello    NVByte   \"Hello World\",0<\/pre>\n\n\n\n<h6 class=\"wp-block-heading\">Two arguments &#8211; nz(Ptr, Item)<\/h6>\n\n\n\n<p>This is the most complicated, and the most powerful form. It uses&nbsp;<em>indirect addressing<\/em>. The pointer does not point to the string itself, it points to a separate table of NVEM pointers. The&nbsp;<code>Item<\/code>&nbsp;argument selects a pointer out of that pointer table table. That pointer in turn points at the desired string. Once you get your head around that, you will see that it can be used for cool things like easily switching between languages.<\/p>\n\n\n\n<p>Example, a basic language management system.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">  ;Define constants that define the order of the message<br>  ;pointers in NVEM<br>  kmsgHello     EQU        0<br>  kmsgGoodBye   EQU        1<br>  <br>        ...<br>  <br>  ;Say hello in the current language. <br>  ;The language pointer is in fLangPntr<br>                fRecallW    fLangPntr ;Now points to the pointer table<br>                LoadX       kmsgHello<br>  #HMI Print(nz(=w, =x))<br>  <br><br>  ;English strings<br>  enHello       NV0Byte     \"Hello World\",0<br>  enGoodBye     NV0Byte     \"Good bye\",0<br>  <br>  ;French strings<br>  frHello       NV0Byte     \"Bon jour, tout le mond\",0<br>  frGoodBye     NV0Byte     \"Au revoir\",0<br>  <br>  ;Pointer tables for the languages. These must be in the<br>  ;same order as defined in the constants kmsgHello etc above<br>  ;Language pointer table, English<br>  enPntrs       NV0Ptr      enHello<br>                NV0Ptr      enGoodBye<br>  <br>  ;Language pointer table, French<br>  frPntrs       NV0Ptr      frHello<br>                NV0Ptr      frGoodBye <\/pre>\n\n\n\n<h6 class=\"wp-block-heading\">The Ptr argument<\/h6>\n\n\n\n<p>The Ptr argument has several possibilities<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>Ptr<\/td><td>Resulting pointer value<\/td><\/tr><tr><td>=w<\/td><td>The number in W, interpreted as an (integer) NVEM base address<\/td><\/tr><tr><td>=q<\/td><td>&nbsp;The number in Q, interpreted as an (integer) NVEM base address<\/td><\/tr><tr><td>=p<\/td><td>&nbsp;The existing contents of NVPtr<\/td><\/tr><tr><td>&nbsp;cc<\/td><td>&nbsp; A symbolic (named) NVEM address<\/td><\/tr><tr><td>&nbsp;*ww<\/td><td>&nbsp;A 16-bit integer in RAM, interpreted as an NVEM base address.&nbsp; IasJ + and NoJ &#8211; modifiers are supported e.g. *+ww<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h6 class=\"wp-block-heading\">&nbsp;The Item argument<\/h6>\n\n\n\n<p>In&nbsp; the form of nz() that uses two arguments, the second argument, Item, can be any of the following<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>Form<\/td><td>Meaning<\/td><td>Example<\/td><\/tr><tr><td><code>=x<\/code><\/td><td>Contents of the&nbsp;<a href=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/glossary-of-terms\/#o3808\">X<\/a>&nbsp;register<\/td><td><code>#<a href=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/glossary-of-terms\/#o5243\">HMI<\/a> Print(nz(=p, =x))<\/code><\/td><\/tr><tr><td><code>=y<\/code><\/td><td>Contents of the Y register<\/td><td><code>#HMI Print(nz(=p, =y))<\/code><\/td><\/tr><tr><td><code>=h<\/code><\/td><td>Contents of the H register<\/td><td><code>#HMI Print(nz(=p, =h))<\/code><\/td><\/tr><tr><td><code>=m<\/code><\/td><td>Contents of the M register<\/td><td><code>#HMI Print(nz(=p, =m))<\/code><\/td><\/tr><tr><td><code>=s<\/code><\/td><td>Contents of the S register<\/td><td><code>#HMI Print(nz(=p, =s))<\/code><\/td><\/tr><tr><td><code>=i<\/code><\/td><td>Contents of the I register<\/td><td><code>#HMI Print(nz(=p, =i))<\/code><\/td><\/tr><tr><td><code>Constant<\/code><\/td><td>Contents of an EQUated constant<\/td><td><code>Foo EQU 56<\/code><code>...<\/code><code>#HMI Print(b(nz(=p, Foo))<\/code><\/td><\/tr><tr><td>A number 0 &#8211; 255<\/td><td>An immediate numeric value<\/td><td><code>#HMI Print(nz(=p, 165))<\/code><\/td><\/tr><tr><td><code>*Label<\/code><\/td><td>Contents of a&nbsp;<a href=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/glossary-of-terms\/#o414\">RAM<\/a>&nbsp;byte (variable)<\/td><td><code>Temperature defBYTE<\/code><code>...<\/code><code>#HMI Print(nz(=p, *Temperature))<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">&nbsp;<\/h2>\n","protected":false},"excerpt":{"rendered":"<p>Used to look up and print zero terminated strings stored in NVEM. Useful for multiple language support and other places where it&#8217;s useful to have&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":3802,"menu_order":4,"template":"","class_list":["post-3807","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>NVEM string formatting function nz({Ptr}{,Item}) - 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=\"NVEM string formatting function nz({Ptr}{,Item}) - SPLat Controls\" \/>\n<meta property=\"og:description\" content=\"Used to look up and print zero terminated strings stored in NVEM. Useful for multiple language support and other places where it&#8217;s useful to have...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/deprecated\/hmi-android-windows\/formatting-functions\/nvem-string-formatting-function-nzptritem-2\/\" \/>\n<meta property=\"og:site_name\" content=\"SPLat Controls\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-10T06:04:51+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=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/deprecated\/hmi-android-windows\/formatting-functions\/nvem-string-formatting-function-nzptritem-2\/\",\"url\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/deprecated\/hmi-android-windows\/formatting-functions\/nvem-string-formatting-function-nzptritem-2\/\",\"name\":\"NVEM string formatting function nz({Ptr}{,Item}) - SPLat Controls\",\"isPartOf\":{\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/#website\"},\"datePublished\":\"2025-04-21T11:24:51+00:00\",\"dateModified\":\"2025-06-10T06:04:51+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/deprecated\/hmi-android-windows\/formatting-functions\/nvem-string-formatting-function-nzptritem-2\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/deprecated\/hmi-android-windows\/formatting-functions\/nvem-string-formatting-function-nzptritem-2\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/deprecated\/hmi-android-windows\/formatting-functions\/nvem-string-formatting-function-nzptritem-2\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Deprecated\",\"item\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/deprecated\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"# HMI Android &#038; Windows\",\"item\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/deprecated\/hmi-android-windows\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Formatting functions\",\"item\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/deprecated\/hmi-android-windows\/formatting-functions\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"NVEM string formatting function nz({Ptr}{,Item})\"}]},{\"@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":"NVEM string formatting function nz({Ptr}{,Item}) - 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":"NVEM string formatting function nz({Ptr}{,Item}) - SPLat Controls","og_description":"Used to look up and print zero terminated strings stored in NVEM. Useful for multiple language support and other places where it&#8217;s useful to have...","og_url":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/deprecated\/hmi-android-windows\/formatting-functions\/nvem-string-formatting-function-nzptritem-2\/","og_site_name":"SPLat Controls","article_modified_time":"2025-06-10T06:04:51+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/deprecated\/hmi-android-windows\/formatting-functions\/nvem-string-formatting-function-nzptritem-2\/","url":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/deprecated\/hmi-android-windows\/formatting-functions\/nvem-string-formatting-function-nzptritem-2\/","name":"NVEM string formatting function nz({Ptr}{,Item}) - SPLat Controls","isPartOf":{"@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/#website"},"datePublished":"2025-04-21T11:24:51+00:00","dateModified":"2025-06-10T06:04:51+00:00","breadcrumb":{"@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/deprecated\/hmi-android-windows\/formatting-functions\/nvem-string-formatting-function-nzptritem-2\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/deprecated\/hmi-android-windows\/formatting-functions\/nvem-string-formatting-function-nzptritem-2\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/deprecated\/hmi-android-windows\/formatting-functions\/nvem-string-formatting-function-nzptritem-2\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webprojects.cloud\/wordpress\/splatco\/"},{"@type":"ListItem","position":2,"name":"Deprecated","item":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/deprecated\/"},{"@type":"ListItem","position":3,"name":"# HMI Android &#038; Windows","item":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/deprecated\/hmi-android-windows\/"},{"@type":"ListItem","position":4,"name":"Formatting functions","item":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/deprecated\/hmi-android-windows\/formatting-functions\/"},{"@type":"ListItem","position":5,"name":"NVEM string formatting function nz({Ptr}{,Item})"}]},{"@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\/3807","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\/3802"}],"wp:attachment":[{"href":"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-json\/wp\/v2\/media?parent=3807"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}