{"id":14335,"date":"2017-09-30T11:04:18","date_gmt":"2017-09-30T15:04:18","guid":{"rendered":"http:\/\/scruss.com\/blog\/?p=14335"},"modified":"2025-12-15T12:45:24","modified_gmt":"2025-12-15T17:45:24","slug":"basic-on-the-6502-badge","status":"publish","type":"post","link":"https:\/\/scruss.com\/blog\/2017\/09\/30\/basic-on-the-6502-badge\/","title":{"rendered":"BASIC on the 6502 badge"},"content":{"rendered":"<p>As if it weren&#8217;t nerdy enough, the <a href=\"http:\/\/www.sunrise-ev.com\/6502.htm\">6502 40th Anniversary Computer Badge<\/a> runs Lee Davison&#8217;s <a href=\"http:\/\/www.sunrise-ev.com\/photos\/6502\/EhBASIC-manual.pdf\">EhBASIC<\/a>. There are <u>1024<\/u> whole bytes free for your programs, so it&#8217;s not exactly spacious. It&#8217;s got useful floating point support, though:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-14337\" src=\"http:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2017\/09\/ehbasic.png\" alt=\"\" width=\"440\" height=\"240\" srcset=\"https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2017\/09\/ehbasic.png 440w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2017\/09\/ehbasic-160x87.png 160w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2017\/09\/ehbasic-320x175.png 320w\" sizes=\"auto, (max-width: 440px) 100vw, 440px\" \/><\/p>\n<p>Yup, that&#8217;s the <em>second<\/em> most boring BASIC example program, after the quadratic root finder.<\/p>\n<pre>100 REM HERON ROOTS\n110 EP=0.0001\n120 INPUT \"X\";X\n130 N=1:RN=X\/2\n140 PRINT\"COUNT\",\"ROOT\",\"DELTA\":PRINT\"======\",\"======\",\"======\"\n150 DE=ABS(RN*RN-X)\n160 PRINT N,RN,DE\n170 RN=(RN+X\/RN)\/2\n180 N=N+1\n190 IF DE&gt;EP THEN GOTO 150<\/pre>\n<p><strong>Update<\/strong>: Josh got my badge working again (it wasn&#8217;t, for <em>$reasons<\/em> \u2026) and I re-ran this code. If you try the code for X=100000 and larger, it won&#8217;t converge. You might want to add:<\/p>\n<pre>185 IF N&gt;25 THEN PRINT \"EPSILON TOO LARGE, EXITING\":END<\/pre>\n<p>so that the loop will exit after 25 times. Alternatively, make the value of EP depend upon the size of X. Aren&#8217;t numerical analysis and floating point foibles fun?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As if it weren&#8217;t nerdy enough, the 6502 40th Anniversary Computer Badge runs Lee Davison&#8217;s EhBASIC. There are 1024 whole bytes free for your programs, so it&#8217;s not exactly spacious. It&#8217;s got useful floating point support, though: Yup, that&#8217;s the second most boring BASIC example program, after the quadratic root finder. 100 REM HERON ROOTS [&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":[2],"tags":[2375,2062],"class_list":["post-14335","post","type-post","status-publish","format-standard","hentry","category-goatee-stroking-musing-or-something","tag-2375","tag-basic"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pQNZZ-3Jd","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/posts\/14335","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=14335"}],"version-history":[{"count":5,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/posts\/14335\/revisions"}],"predecessor-version":[{"id":18021,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/posts\/14335\/revisions\/18021"}],"wp:attachment":[{"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/media?parent=14335"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/categories?post=14335"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/tags?post=14335"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}