{"id":181,"date":"2026-04-18T16:18:26","date_gmt":"2026-04-18T16:18:26","guid":{"rendered":"https:\/\/permacomputer.solarpunk.au\/?p=181"},"modified":"2026-04-18T16:18:26","modified_gmt":"2026-04-18T16:18:26","slug":"a-simple-guide-to-porting-your-basic","status":"publish","type":"post","link":"https:\/\/permacomputer.solarpunk.au\/?p=181","title":{"rendered":"A Simple Guide to Porting Your BASIC"},"content":{"rendered":"\n<p>You may have considered porting some BASIC code from one dialect to another.<\/p>\n\n\n\n<p>Do not be dissuaded, the process can sometimes be rewarding.<\/p>\n\n\n\n<p>When porting on BASIC to another, I have found the following guides to be useful:<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Strip out all lines with references to POKE and PEEK.<\/h2>\n\n\n\n<p>This is my preferred strategy. Almost every system addresses memory differently, and has a different memory map.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Check the way arrays work on your target machine. Especially string arrays.<\/h2>\n\n\n\n<p>Many systems will allow simple string arrays, such as: <code>S$(100)<\/code><\/p>\n\n\n\n<p>But how long are these strings? How does the machine assign and evaluate each index? Some machines may even accept two-dimensional string arrays.<\/p>\n\n\n\n<p>Every application will make use of some subset, and not every single feature of it&#8217;s machine&#8217;s arrays, so don&#8217;t be daunted. Sometimes the job can be done with very little modification.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">INPUT statements may be an issue. Some parse input differently.<\/h2>\n\n\n\n<p>Does you machine have <code>LINE INPUT<\/code>, or just <code>INPUT<\/code>?<\/p>\n\n\n\n<p><code>INPUT<\/code> splits the input into multiple variables on commas in the input, whereas <code>LINE INPUT<\/code> puts the entire line into one variable.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">File operations like OPEN and CLOSE will accept different arguments.<\/h2>\n\n\n\n<p>This can be quite tricky.<\/p>\n\n\n\n<p>Since you have made it this far into the blog post, please consider the following table of conversions between my most used BASICS:<\/p>\n\n\n\n<figure class=\"wp-block-table alignfull\"><table class=\"has-fixed-layout\"><thead><tr><th><\/th><th>Dartmouth<\/th><th>APPLESOFT<\/th><th>ATARI 8-BIT<\/th><th>BBC BASIC<\/th><th>COMMODORE BASIC V2<\/th><\/tr><\/thead><tbody><tr><td>OPEN<\/td><td>FILE #<em>file<\/em>, &#8220;<em>filename<\/em>&#8220;<\/td><td>OPEN <em>filename<\/em><\/td><td>OPEN #<em>fileno<\/em>,<em>mode control code<\/em>,<em>filename<\/em><\/td><td><em>var<\/em> = OPENIN, <em>var<\/em> = OPENOUT<\/td><td>OPEN #exp, fileno, mode, &#8220;filename&#8221;<\/td><\/tr><tr><td>CLOSE<\/td><td><\/td><td>CLOSE &#8220;<em>filename<\/em>&#8220;<\/td><td>CLOSE #<em>fileno<\/em>, #<em>fileno<\/em><\/td><td>CLOSE #<em>fileno<\/em>; CLOSE #0 <em>(all files)<\/em><\/td><td>CLOSE #<em>fileno<\/em><\/td><\/tr><tr><td>LOAD<\/td><td><\/td><td>LOAD <em>filename<\/em><\/td><td>LOAD &#8220;<em>disk:filename<\/em>&#8220;<\/td><td>LOAD &#8220;<em>filename<\/em>&#8220;<\/td><td>LOAD &#8220;<em>filename<\/em>&#8220;,8,[disk]<\/td><\/tr><tr><td>PRINT<\/td><td>PRINT #<em>file<\/em>, record, &#8230;<\/td><td>PRINT exp, exp, &#8230;<\/td><td>PRINT #fileno, record, record, &#8230;<\/td><td>PRINT #filename, record, record, &#8230;<\/td><td>PRINT #fileno, record, record, &#8230;<\/td><\/tr><tr><td>INPUT<\/td><td>INPUT #<em>file<\/em>, record, &#8230;<\/td><td>INPUT [string,] var, var, &#8230;<\/td><td>INPUT #[file,disk] var<\/td><td>INPUT #filename, record, record, &#8230;<\/td><td>INPUT <em>&#8220;string&#8221;<\/em> var, var, &#8230;<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Is your BASIC indexed from one (1) or zero (0)?<\/h2>\n\n\n\n<p>Because this is an easy one. Convert every index accordingly:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>(e.g.) DIM A(255) -> DIM A(256)\n\n(e.g.) FOR I=0 TO 255 -> FOR I=1 TO 256<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>You may have considered porting some BASIC code from one dialect to another. Do not be dissuaded, the process can sometimes be rewarding. When porting on BASIC to another, I have found the following guides to be useful: Strip out all lines with references to POKE and PEEK. This is my preferred strategy. Almost every [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":182,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"A Simple Guide to Porting Your BASIC\n\nYou may have considered porting some BASIC code from one dialect to another. Do not be dissuaded, the process can sometimes be rewarding. When porting on BASIC to another, I have found the following guides to be useful:","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[28],"tags":[20,6,17],"class_list":["post-181","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-help","tag-basic","tag-general","tag-retrocomputing"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/permacomputer.solarpunk.au\/wp-content\/uploads\/2026\/04\/d1mg3fq-746e7864-9c6e-490b-bc1a-cb4723030642.png","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/permacomputer.solarpunk.au\/index.php?rest_route=\/wp\/v2\/posts\/181","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/permacomputer.solarpunk.au\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/permacomputer.solarpunk.au\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/permacomputer.solarpunk.au\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/permacomputer.solarpunk.au\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=181"}],"version-history":[{"count":2,"href":"https:\/\/permacomputer.solarpunk.au\/index.php?rest_route=\/wp\/v2\/posts\/181\/revisions"}],"predecessor-version":[{"id":184,"href":"https:\/\/permacomputer.solarpunk.au\/index.php?rest_route=\/wp\/v2\/posts\/181\/revisions\/184"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/permacomputer.solarpunk.au\/index.php?rest_route=\/wp\/v2\/media\/182"}],"wp:attachment":[{"href":"https:\/\/permacomputer.solarpunk.au\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=181"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/permacomputer.solarpunk.au\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=181"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/permacomputer.solarpunk.au\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=181"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}