{"id":12971,"date":"2025-12-24T03:00:00","date_gmt":"2025-12-24T08:00:00","guid":{"rendered":"https:\/\/www.both.org\/?p=12971"},"modified":"2025-12-16T15:56:47","modified_gmt":"2025-12-16T20:56:47","slug":"old-school-programming-with-bw-basic","status":"publish","type":"post","link":"https:\/\/www.both.org\/?p=12971","title":{"rendered":"Old-school programming with BW BASIC"},"content":{"rendered":"<div class=\"pld-like-dislike-wrap pld-template-1\">\r\n    <div class=\"pld-like-wrap  pld-common-wrap\">\r\n    <a href=\"javascript:void(0)\" class=\"pld-like-trigger pld-like-dislike-trigger  \" title=\"\" data-post-id=\"12971\" data-trigger-type=\"like\" data-restriction=\"cookie\" data-already-liked=\"0\">\r\n                        <i class=\"fas fa-thumbs-up\"><\/i>\r\n                <\/a>\r\n    <span class=\"pld-like-count-wrap pld-count-wrap\">    <\/span>\r\n<\/div><\/div>\n<p>In the early days of personal computing\u2014from the late 1970s and through the 1980s\u2014many people got their start with BASIC programming. BASIC was a universal programming language that came built into most personal computers, from Apple to IBM PCs.<\/p>\n\n\n\n<p>When we started the FreeDOS Project in June 1994, it seemed natural that we should include an open source BASIC environment. I was excited to discover one already existed in Bywater BASIC.<\/p>\n\n\n\n<p>Bywater BASIC implements a large superset of the ANSI Standard for Minimal BASIC (X3.60-1978) and a significant subset of the ANSI Standard for Full BASIC (X3.113-1987). It&#8217;s also distributed under the GNU General Public License version 2, which means it&#8217;s open source software. We only want to include open source programs in FreeDOS, so Bywater BASIC was a great addition to FreeDOS in our early days.<\/p>\n\n\n\n<p>We&#8217;ve included Bywater BASIC since at least FreeDOS Alpha 5, in 1997. You can find Bywater BASIC in FreeDOS 1.4 in the &#8220;Development&#8221; package group on the Bonus CD:<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"730\" height=\"434\" src=\"http:\/\/www.both.org\/wp-content\/uploads\/2025\/12\/fdimples-bwbasic.png\" alt=\"FreeDOS package manager, showing the BWBASIC package\" class=\"wp-image-12970\"\/><\/figure>\n\n\n\n<p>FreeDOS installs the Bywater BASIC package in the <code>\\DEVEL\\BWBASIC<\/code> directory. Change to this directory with <strong>CD \\DEVEL\\BWBASIC<\/strong> and type <strong>BWBASIC<\/strong> to run the Bywater BASIC interpreter.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>C:\\DEVEL\\BWBASIC><strong>bwbasic<\/strong>\n########  ##    ## ##      ##    ###    ######## ######## ########\n##     ##  ##  ##  ##  ##  ##   ## ##      ##    ##       ##     ##\n##     ##   ####   ##  ##  ##  ##   ##     ##    ##       ##     ##\n########     ##    ##  ##  ## ##     ##    ##    ######   ########\n##     ##    ##    ##  ##  ## #########    ##    ##       ##   ##\n##     ##    ##    ##  ##  ## ##     ##    ##    ##       ##    ##\n########     ##     ###  ###  ##     ##    ##    ######## ##     ##\n\n\n                                    ########     ###     ######  ####  ######\n                                    ##     ##   ## ##   ##    ##  ##  ##    ##\n                                    ##     ##  ##   ##  ##        ##  ##\n                                    ########  ##     ##  ######   ##  ##\n                                    ##     ## #########       ##  ##  ##\n                                    ##     ## ##     ## ##    ##  ##  ##    ##\n                                    ########  ##     ##  ######  ####  ######\n\n\nBywater BASIC Interpreter, version 3.30\nCopyright (c) 1993, Ted A. Campbell\nCopyright (c) 1995-1997  , Jon B. Volkoff\nCopyright (c) 2014-2017  , Howard Wulf, AF5NE\nCopyright (c) 2019       , Ken Martin\n\n\nbwBASIC: <\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Writing a sample program<\/h2>\n\n\n\n<p>Let me demonstrate Bywater BASIC by writing a test program. We&#8217;ll keep this simple\u2014print five random numbers. This requires only a few constructs\u2014a loop to iterate over five values and a random number generator. BASIC uses the <code>RND(1)<\/code> statement to generate a random value between 0 and 1. We can use <code>PRINT<\/code> to display the random number.<\/p>\n\n\n\n<p>One feature I like in Bywater BASIC is the integrated &#8220;help&#8221; system. There&#8217;s nothing more frustrating than forgetting the syntax for a BASIC statement. For example, I always forget how to create BASIC loops. Do I use <code>FOR I IN 1 TO 10<\/code> or <code>FOR I = 1 TO 10<\/code>? Just type <strong>help FOR<\/strong> at the Bywater BASIC prompt and the interpreter displays the usage and a brief description.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>bwBASIC: <strong>10 randomize<\/strong>\nbwBASIC: <strong>help FOR<\/strong>\n------------------------------------------------------------\n     SYNTAX: FOR variable = start TO finish &#91;STEP\n             increment]\nDESCRIPTION: Top of a FOR - NEXT structure.  The loop will\n             continue a fixed number of times, which is\n             determined by the values of start, finish,\n             and increment.\nbwBASIC: <strong>20 for i = 1 to 5<\/strong>\nbwBASIC: <strong>30 print RND(1)<\/strong>\nbwBASIC: <strong>40 next<\/strong><\/code><\/pre>\n\n\n\n<p>Another neat feature in Bywater BASIC is how it reformats your BASIC instructions, so they are easier to read. After typing my brief program, I can type list to see the full source listing. Bywater BASIC automatically adds the CALL keyword to my RANDOMIZE statement on line 10 and indents the PRINT statement inside my loop. These small changes help me to see loops and other features in my program, which can aid in debugging.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>bwBASIC: <strong>list<\/strong>\n   10 CALL randomize\n   20 for i = 1 to 5\n   30   print RND(1)\n   40 next<\/code><\/pre>\n\n\n\n<p>If everything looks okay, then type <strong>RUN<\/strong> to execute the program. Because I used the <code>RANDOMIZE<\/code> statement at the start of my BASIC program, Bywater seeds the random number generator with a random starting point. This ensures that my numbers are actually random values and don&#8217;t repeat when I re-run my program.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>bwBASIC: <strong>run<\/strong>\n .939512\n .769341\n .120029\n .959471\n .315683\nbwBASIC: <strong>run<\/strong>\n .994964\n .85168\n .13538\n .397748\n .679128\nbwBASIC: <strong>run<\/strong>\n 5.04166E-2\n .934019\n .150731\n .836055\n 4.25428E-2<\/code><\/pre>\n\n\n\n<p>When you\u2019re done with Bywater BASIC, you can exit back to the operating system with the <strong>QUIT<\/strong> command.<\/p>\n\n\n\n<p>Install Bywater BASIC on your FreeDOS system and start experimenting with BASIC programming. BASIC can be a great first programming language, especially if you are interested in getting back to the &#8220;roots&#8221; of personal computing. You can find more information about Bywater BASIC in the manual, installed in the <code>\\DEVEL\\BWBASIC<\/code> directory as <code>BWBASIC.DOC<\/code>. You can also explore the online &#8220;help&#8221; system by typing <strong>HELP<\/strong> at the Bywater BASIC prompt.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Install Bywater BASIC on your FreeDOS system and start experimenting with BASIC programming.<\/p>\n","protected":false},"author":33,"featured_media":2803,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_lmt_disableupdate":"","_lmt_disable":"","footnotes":""},"categories":[340,69,150],"tags":[267,147,152],"class_list":["post-12971","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-freedos","category-fun","category-programming","tag-freedos","tag-fun","tag-programming"],"modified_by":"Jim Hall","_links":{"self":[{"href":"https:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/posts\/12971","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/users\/33"}],"replies":[{"embeddable":true,"href":"https:\/\/www.both.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=12971"}],"version-history":[{"count":1,"href":"https:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/posts\/12971\/revisions"}],"predecessor-version":[{"id":12972,"href":"https:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/posts\/12971\/revisions\/12972"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/media\/2803"}],"wp:attachment":[{"href":"https:\/\/www.both.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=12971"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.both.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=12971"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.both.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=12971"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}