{"id":5477,"date":"2023-11-20T15:17:43","date_gmt":"2023-11-20T14:17:43","guid":{"rendered":"https:\/\/msxitalia.org\/?p=5477"},"modified":"2023-11-20T15:17:43","modified_gmt":"2023-11-20T14:17:43","slug":"msx-basic-lezione-5","status":"publish","type":"post","link":"https:\/\/msxitalia.org\/en\/msx-basic-lezione-5\/","title":{"rendered":"MSX BASIC \u2013 lesson 5"},"content":{"rendered":"<div class=\"\" dir=\"auto\">\n<div id=\":r49d:\" class=\"x1iorvi4 x1pi30zi x1swvt13 xjkvuk6\" data-ad-comet-preview=\"message\" data-ad-preview=\"message\">\n<div class=\"x78zum5 xdt5ytf xz62fqu x16ldp7u\">\n<div class=\"xu06os2 x1ok221b\">\n<div class=\"xdj266r x11i5rnm xat24cr x1mh8g0r x1vvkbs x126k92a\">\n<h1 dir=\"auto\"><img decoding=\"async\" data-src=\"https:\/\/msxitalia.org\/wp-content\/uploads\/2023\/11\/Corso-Basic-MSX1-OC-300x225.jpg\" class=\"size-medium wp-image-5338 aligncenter lazyload\" src=\"data:image\/gif;base64,R0lGODlhAQABAIAAAAAAAP\/\/\/yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\" alt=\"\" width=\"300\" height=\"225\" \/><noscript><img decoding=\"async\" class=\"size-medium wp-image-5338 aligncenter\" src=\"https:\/\/msxitalia.org\/wp-content\/uploads\/2023\/11\/Corso-Basic-MSX1-OC-300x225.jpg\" alt=\"\" width=\"300\" height=\"225\"><\/noscript><\/h1>\n<h1 dir=\"auto\" style=\"text-align: center;\">\u201cMSX BASIC\u201d COLUMN by Orazio Cacciola (part 5)<\/h1>\n<h2 style=\"text-align: center;\">The TAB, LOCATE, POS and CRSLIN functions<\/h2>\n<\/div>\n<p class=\"xdj266r x11i5rnm xat24cr x1mh8g0r x1vvkbs x126k92a\">Today I will talk about the functions that are used to help us position our prints on the non-graphic screen and also know the cursor positions. Since they are not very complex, I will explain all four.<\/p>\n<p>TAB is a function that helps us position the cursor at a point on the screen line where it is located at that moment. It is always used together with PRINT, i.e. after:<br \/>\nPRINT TAB(10). The argument after the function must be a number or numeric variable and cannot be omitted. If the argument exceeds the length of the line, it will<br \/>\nprinted in the next one. This performs an increasing horizontal positioning, which means it cannot go back. To make it clearer I&#039;ll give an example<br \/>\nwith a small program:<\/p>\n<pre>10 PRINT &quot;NAME&quot;; TAB(20); &quot;CITY&#039;&quot;; TAB(30); &quot;AGE&quot; 20 E=50:PRINT &quot;FRANCO&quot;; TAB(20); &quot;MILAN&quot;; TAB(30); And the result will be: NAME CITY AGE FRANCO MILANO 50<\/pre>\n<p>Remember that numeric variables will be moved by one character. If we admit, I would have put TAB(30); \u201cMILANO\u201d and then TAB(20); And, since the latter could not be turned back, it would have been printed immediately after the word MILAN: MILANO 50<br \/>\nIt can also be used for printing on paper, nothing of what I said changes<br \/>\nbefore: LPRINT TAB(10)<\/p>\n<p>The LOCATE function compared to the previous one, prints anywhere on the screen without problems. LOCATE Horizontal coordinate, Vertical coordinate, cursor (on or<br \/>\nworn out). Where, horizontal coordinate (X) is the number of the row where you want to print, while vertical (Y) is the column number. If the cursor is set to 0 it will not be displayed<br \/>\nif it is greater than 0, yes. Our screen in text mode is made up of 40 horizontal characters (from 0 to 39, by default they are 37; from 0 to 36) and 24 vertical characters (0 to 23),<br \/>\nassuming that the function key display line is deactivated (I will explain this topic later). I open a parenthesis to say that I am only speaking<br \/>\nof the default screen i.e. SCREEN 0, this will also be explained later.<br \/>\nWe want to print our sentence on line 10 of column 5, since the MSX starts from scratch, we will write:<br \/>\nLOCATE 9.4: PRINT \u201cCIAO\u201d<br \/>\nThe MSX will not report an error if 1 of 2 or all 2 parameters of the LOCATE function exceed the screen&#039;s set values, but the results will be staggered. If the third is omitted<br \/>\nparameter, it will treat it as 0 (by default), so the cursor will be off.<\/p>\n<p>POS(1) and LPOS(1) return the horizontal(X) coordinate of the cursor, on screen or on paper, respectively. The function argument is dummy, so it doesn&#039;t matter<br \/>\nits value.<br \/>\nX=POS(0)<\/p>\n<p>CRSLIN returns the vertical (Y) coordinate of the cursor on the screen, it is not applicable on paper.<br \/>\nY=CRSLIN<\/p>\n<p>These last 2 functions are very useful in those text programs that use windows.<br \/>\nTo give an example, a program that has online help and is activated by pressing a function key or any other, it is very useful to know in which position the cursor should return<br \/>\nafter viewing the help.<br \/>\nAnd that&#039;s all, thanks and see you next time<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>RUBRICA &#8220;MSX BASIC&#8221; a cura di Orazio Cacciola (parte 5) Le Funzioni TAB, LOCATE, POS e CRSLIN Oggi parler\u00f2 delle funzioni che servono per aiutarci a posizionare le nostre stampe sullo schermo non grafico e sapere anche le posizioni del cursore. Visto che non sono molto complesse, le spiegher\u00f2 tutte e quattro. TAB \u00e8 la [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","footnotes":""},"categories":[14],"tags":[],"dipi_cpt_category":[],"class_list":["post-5477","post","type-post","status-publish","format-standard","hentry","category-msx-basic"],"_links":{"self":[{"href":"https:\/\/msxitalia.org\/en\/wp-json\/wp\/v2\/posts\/5477","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/msxitalia.org\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/msxitalia.org\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/msxitalia.org\/en\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/msxitalia.org\/en\/wp-json\/wp\/v2\/comments?post=5477"}],"version-history":[{"count":2,"href":"https:\/\/msxitalia.org\/en\/wp-json\/wp\/v2\/posts\/5477\/revisions"}],"predecessor-version":[{"id":5479,"href":"https:\/\/msxitalia.org\/en\/wp-json\/wp\/v2\/posts\/5477\/revisions\/5479"}],"wp:attachment":[{"href":"https:\/\/msxitalia.org\/en\/wp-json\/wp\/v2\/media?parent=5477"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/msxitalia.org\/en\/wp-json\/wp\/v2\/categories?post=5477"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/msxitalia.org\/en\/wp-json\/wp\/v2\/tags?post=5477"},{"taxonomy":"dipi_cpt_category","embeddable":true,"href":"https:\/\/msxitalia.org\/en\/wp-json\/wp\/v2\/dipi_cpt_category?post=5477"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}