{"id":8370,"date":"2013-03-08T21:09:15","date_gmt":"2013-03-09T02:09:15","guid":{"rendered":"http:\/\/scruss.com\/blog\/?p=8370"},"modified":"2013-03-11T22:15:49","modified_gmt":"2013-03-12T02:15:49","slug":"running-x11-basic-sorta-kinda-on-raspberry-pi","status":"publish","type":"post","link":"https:\/\/scruss.com\/blog\/2013\/03\/08\/running-x11-basic-sorta-kinda-on-raspberry-pi\/","title":{"rendered":"Running X11-Basic (almost perfectly) on Raspberry Pi"},"content":{"rendered":"<p><strong>Update<\/strong>: Markus Hoffmann uploaded a new version of X11Basic-1.20.tar.gz to SourceForge that addresses most of these problems. I&#8217;ve edited the article to remove the obsolete bits.<\/p>\n<hr \/>\n<p>More than 20 years ago, I really liked <a href=\"http:\/\/userpages.bright.net\/~gfabasic\/\">GFA-Basic<\/a>. It ran blindingly fast on the Atari ST, and when it <em>didn&#8217;t<\/em> crash on the Amiga, it ran blindingly fast there too. I even <a href=\"http:\/\/www.cucug.org\/amiga\/amiinfo\/reviews\/GFABasic.txt\">wrote a review of it for comp.sys.amiga.programmer<\/a>, which you can read to this day in all its textual glory. One of the e-mail addresses in that article still works, too.<\/p>\n<p>I still sometimes think in BASIC, and there is much wringing of hands (not by me, really) that there isn&#8217;t a good interpreter for Raspbian on the Raspberry Pi. So when I found <a href=\"http:\/\/x11-basic.sourceforge.net\/index.html\">X11-Basic<\/a> \u00e2\u20ac\u201d a cross-platform GFA-Basic-like system \u00e2\u20ac\u201d I had to take a look.<\/p>\n<p>While I have managed to get X11-Basic demos to run, I have to say it&#8217;s not running super well. I&#8217;ll show you how to install X11-Basic 1.20 and get it (mostly) running, but it&#8217;s a bit rough on the ARM. Incidentally, these instructions also work on Ubuntu 12.<em>mumble<\/em> LTS on x86.<\/p>\n<p>First, you need to install some (okay, a <em>lot<\/em> of) packages:<\/p>\n<pre>sudo apt-get install libreadline-dev tcsh libncurses5-dev xutils-dev libc6-dev libsdl1.2-dev libtool<\/pre>\n<p>Now <a href=\"http:\/\/sourceforge.net\/projects\/x11-basic\/files\/latest\/download?source=navbar\">download<\/a> and extract the package:<\/p>\n<pre>tar xvzf X11Basic-1.20.tar.gz\r\ncd X11Basic-1.20<\/pre>\n<p>For X11Basic-1.20, you have to issue an extra command before the standard &#8216;<code>.\/configure ; make ; make install<\/code>&#8216; sequence:<\/p>\n<pre>sudo mkdir -p \/usr\/local\/share\/man\/man1\r\n.\/configure\r\nmake\r\nsudo make install<\/pre>\n<p>This is enough to make a working <code>xbasic<\/code> interpreter. I made some screenshots of some of the graphics demos \u00e2\u20ac\u201d<\/p>\n<p><a href=\"http:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2013\/03\/Screen-Shot-2013-03-08-at-16.34.51-.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-8373\" alt=\"Screen Shot 2013-03-08 at 16.34.51\" src=\"http:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2013\/03\/Screen-Shot-2013-03-08-at-16.34.51--307x320.png\" width=\"307\" height=\"320\" srcset=\"https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2013\/03\/Screen-Shot-2013-03-08-at-16.34.51--307x320.png 307w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2013\/03\/Screen-Shot-2013-03-08-at-16.34.51--153x160.png 153w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2013\/03\/Screen-Shot-2013-03-08-at-16.34.51--288x300.png 288w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2013\/03\/Screen-Shot-2013-03-08-at-16.34.51-.png 544w\" sizes=\"auto, (max-width: 307px) 100vw, 307px\" \/><\/a> <a href=\"http:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2013\/03\/Screen-Shot-2013-03-08-at-14.59.37-.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-8375\" alt=\"Screen Shot 2013-03-08 at 14.59.37\" src=\"http:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2013\/03\/Screen-Shot-2013-03-08-at-14.59.37--320x216.png\" width=\"320\" height=\"216\" srcset=\"https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2013\/03\/Screen-Shot-2013-03-08-at-14.59.37--320x216.png 320w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2013\/03\/Screen-Shot-2013-03-08-at-14.59.37--160x108.png 160w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2013\/03\/Screen-Shot-2013-03-08-at-14.59.37--444x300.png 444w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2013\/03\/Screen-Shot-2013-03-08-at-14.59.37-.png 672w\" sizes=\"auto, (max-width: 320px) 100vw, 320px\" \/><\/a> <a href=\"http:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2013\/03\/Screen-Shot-2013-03-08-at-14.57.21-.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-8376\" alt=\"Screen Shot 2013-03-08 at 14.57.21\" src=\"http:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2013\/03\/Screen-Shot-2013-03-08-at-14.57.21--320x230.png\" width=\"320\" height=\"230\" srcset=\"https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2013\/03\/Screen-Shot-2013-03-08-at-14.57.21--320x230.png 320w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2013\/03\/Screen-Shot-2013-03-08-at-14.57.21--160x115.png 160w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2013\/03\/Screen-Shot-2013-03-08-at-14.57.21-.png 352w\" sizes=\"auto, (max-width: 320px) 100vw, 320px\" \/><\/a> <a href=\"http:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2013\/03\/Screen-Shot-2013-03-08-at-14.54.08-.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-8377\" alt=\"Screen Shot 2013-03-08 at 14.54.08\" src=\"http:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2013\/03\/Screen-Shot-2013-03-08-at-14.54.08--320x267.png\" width=\"320\" height=\"267\" srcset=\"https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2013\/03\/Screen-Shot-2013-03-08-at-14.54.08--320x267.png 320w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2013\/03\/Screen-Shot-2013-03-08-at-14.54.08--160x133.png 160w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2013\/03\/Screen-Shot-2013-03-08-at-14.54.08-.png 352w\" sizes=\"auto, (max-width: 320px) 100vw, 320px\" \/><\/a> <a href=\"http:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2013\/03\/Screen-Shot-2013-03-08-at-14.49.48-.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-8378\" alt=\"Screen Shot 2013-03-08 at 14.49.48\" src=\"http:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2013\/03\/Screen-Shot-2013-03-08-at-14.49.48--320x216.png\" width=\"320\" height=\"216\" srcset=\"https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2013\/03\/Screen-Shot-2013-03-08-at-14.49.48--320x216.png 320w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2013\/03\/Screen-Shot-2013-03-08-at-14.49.48--160x108.png 160w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2013\/03\/Screen-Shot-2013-03-08-at-14.49.48--444x300.png 444w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2013\/03\/Screen-Shot-2013-03-08-at-14.49.48-.png 672w\" sizes=\"auto, (max-width: 320px) 100vw, 320px\" \/><\/a>As you can see, there&#8217;s some screen corruption, but most demos just worked. Incidentally, the Mandelbrot one took almost 1\u00c2\u00bc hours to run. Took me right back, that did (or it would have, if I hadn&#8217;t been outside bombing about in the slush on my <a href=\"http:\/\/instagram.com\/p\/V4YbLJRUNT\/\">bicycle<\/a> while it churned away).<\/p>\n<p>In order to see just how fast the interpreter is, I ran the formerly fearsome <a href=\"http:\/\/www.geocities.ws\/peterochocki\/computers\/pcwbm.html\">Personal Computer World Benchmark<\/a> #8 under X11-Basic. PCW#8 used to bring 8-bit home computers to their knees, typically taking more than a minute to run. Here&#8217;s the code, indented a bit and with a timing wrapper added:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n\tLET start=TIMER\r\n\tLET K=0\r\nL30:\r\n\tLET K=K+1\r\n\tLET A=K^2\r\n\tLET B=LN(K)\r\n\tLET C=SIN(K)\r\n\tIF K&lt;1000\r\n\t\tGOTO L30\r\n\tENDIF\r\n\tPRINT TIMER-start\r\n\tQUIT\r\n<\/pre>\n<p>(yeah, GFA-style BASIC isn&#8217;t too pretty &#8230;)<\/p>\n<p>It takes about \u00c2\u00bcs to run. The old BBC B was supposed to take about 50s. By comparison, X11-Basic on a manky old dual-core Atom took 0.04s.<\/p>\n<p>The native compiler xbc seems to work. To make a standalone binary of the above code, you do:<\/p>\n<pre>xbc -o PCWBenchmark PCWBenchmark.xbas<\/pre>\n<p>The compiled binary runs roughly twice as fast as the interpreted code. Not blazing fast, but a useful increase.<\/p>\n<p>Unfortunately, the bytecode compiler <code>xbbc<\/code> doesn&#8217;t actually do anything on the Raspberry Pi yet. So here I leave it up to you to play with X11-Basic, and see what it can and can&#8217;t do.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Update: Markus Hoffmann uploaded a new version of X11Basic-1.20.tar.gz to SourceForge that addresses most of these problems. I&#8217;ve edited the article to remove the obsolete bits. More than 20 years ago, I really liked GFA-Basic. It ran blindingly fast on the Atari ST, and when it didn&#8217;t crash on the Amiga, it ran blindingly fast [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","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":[7],"tags":[2062,2643,2510,2536,305,2644],"class_list":["post-8370","post","type-post","status-publish","format-standard","hentry","category-computers-suck","tag-basic","tag-gfabasic","tag-raspberrypi","tag-raspbian","tag-ubuntu","tag-x11basic"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pQNZZ-2b0","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/posts\/8370","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/comments?post=8370"}],"version-history":[{"count":16,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/posts\/8370\/revisions"}],"predecessor-version":[{"id":8388,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/posts\/8370\/revisions\/8388"}],"wp:attachment":[{"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/media?parent=8370"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/categories?post=8370"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/tags?post=8370"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}