{"id":2470,"date":"2016-09-04T22:32:35","date_gmt":"2016-09-05T02:32:35","guid":{"rendered":"http:\/\/www.leucht.com\/blog\/?p=2470"},"modified":"2017-07-10T11:27:17","modified_gmt":"2017-07-10T15:27:17","slug":"my-apple-iie-a-simple-text-based-arcade-game-in-applesoft-basic","status":"publish","type":"post","link":"http:\/\/www.leucht.com\/blog\/2016\/09\/my-apple-iie-a-simple-text-based-arcade-game-in-applesoft-basic\/","title":{"rendered":"My Apple IIe: A simple text based arcade game in Applesoft Basic"},"content":{"rendered":"<p style=\"text-align: center;\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-medium wp-image-2488\" src=\"http:\/\/www.leucht.com\/blog\/wp-content\/uploads\/2016\/09\/apple-second-logo-rainbow-bitten-400x270.png\" alt=\"apple-second-logo-rainbow-bitten\" width=\"400\" height=\"270\" srcset=\"http:\/\/www.leucht.com\/blog\/wp-content\/uploads\/2016\/09\/apple-second-logo-rainbow-bitten-400x270.png 400w, http:\/\/www.leucht.com\/blog\/wp-content\/uploads\/2016\/09\/apple-second-logo-rainbow-bitten-768x518.png 768w, http:\/\/www.leucht.com\/blog\/wp-content\/uploads\/2016\/09\/apple-second-logo-rainbow-bitten.png 800w\" sizes=\"(max-width: 400px) 100vw, 400px\" \/><\/p>\n<p>If we\u00a0type this simple 8 line Applesoft Basic program into my working Apple IIe computer, we will end up with a cool little text based arcade game! \u00a0Watch the video below to see the game in action!<\/p>\n<p><iframe loading=\"lazy\" width=\"474\" height=\"267\" src=\"https:\/\/www.youtube.com\/embed\/1NNzLPW30V0?feature=oembed\" frameborder=\"0\" allowfullscreen><\/iframe><\/p>\n<p>This small Applesoft Basic\u00a0program was published in one of my Beagle Bros Apple Software Catalogs from 1987 (volume 0, number 10). \u00a0This little program was credited as being submitted by Beagle Bros customer Tim Boehme, who received a box of Beagle Bros magnetic write protect tabs\u00a0for his efforts!<\/p>\n<p>Wow! \u00a0Write protect tabs! \u00a0Amazing! \u00a0\ud83d\ude42<\/p>\n<h1>Applesoft Basic<\/h1>\n<p>Applesoft Basic is the programming language of all the early Apple computers and was provided in ROM (memory) to make it available to the user without the need for a startup disk or the need to load it\u00a0into memory from a cassette tape.<\/p>\n<p>Applesoft Basic was actually created by Microsoft for Apple. \u00a0Hence the name. \u00a0It is interpreted and not compiled, so it is not very fast. \u00a0And it can throw syntax errors at runtime if it&#8217;s unable to interpret a line of code.<\/p>\n<p>One sort of funny feature of Applesoft Basic is that variable names are only significant to 2 letters, although it allows more. \u00a0So if you initialize a variable named &#8220;KURT&#8221; to a value of 10, you can PRINT the variable &#8220;KU&#8221; and also the variable &#8220;KURT&#8221; and also the variable &#8220;KUPP&#8221; and they will all three show a value of 10. \u00a0They are all three pointing to the exact same memory location.<\/p>\n<p style=\"text-align: center;\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-medium wp-image-2490\" src=\"http:\/\/www.leucht.com\/blog\/wp-content\/uploads\/2016\/09\/applesoft-iia-400x259.jpg\" alt=\"applesoft-iia\" width=\"400\" height=\"259\" srcset=\"http:\/\/www.leucht.com\/blog\/wp-content\/uploads\/2016\/09\/applesoft-iia-400x259.jpg 400w, http:\/\/www.leucht.com\/blog\/wp-content\/uploads\/2016\/09\/applesoft-iia.jpg 600w\" sizes=\"(max-width: 400px) 100vw, 400px\" \/><\/p>\n<h1>Code<\/h1>\n<p>Here&#8217;s the source code:<\/p>\n<pre>10 REM \"MUNCH THE SNAILS!\"\r\n20 TEXT: HOME: H = 20: PRINT CHR$ (21): POKE 35,22\r\n30 K = PEEK (49152): ON K &lt; 128 GOTO 40: H = H + (K = 149) - (K = 136)\r\n40 POKE 49168,0: IF RND (1) * 10 &lt; 1 THEN VTAB 20: HTAB RND (1) * 20 + 10: PRINT \"@\": GOTO 70\r\n50 VTAB 22: HTAB RND (1) * 39 + 1: PRINT CHR$ (46)\r\n60 IF PEEK (1535 + H) = 192 THEN S = S + 1: VTAB 5: HTAB H: PRINT \"#\"; CHR$ (7): VTAB 23: PRINT \"MUNCHED: \";S: GOTO 80\r\n70 VTAB 5: HTAB H: PRINT \"V\"\r\n80 T = T + 1: IF S &lt; 10 THEN 30\r\n90 TEXT: VTAB 23: PRINT S;\" SNAILS MUNCHED IN \";T;\" SNAIL SECONDS.\": END<\/pre>\n<h1>Emulators<\/h1>\n<p>If you don&#8217;t have a working Apple IIe of your own to try your Applesoft\u00a0code on, you can first\u00a0<a href=\"http:\/\/www.calormen.com\/jsbasic\/\" target=\"_blank\">try it in a JavaScript implementation of Applesoft Basic<\/a>. \u00a0There are some things that this emulator\u00a0cannot do, though. \u00a0It&#8217;s just not terribly robust.<\/p>\n<p>A very robust option is the\u00a0standalone <a href=\"https:\/\/github.com\/AppleWin\/AppleWin\/\" target=\"_blank\">Apple II emulator program that you can install onto your Windows computer. \u00a0It&#8217;s called AppleWin.<\/a> \u00a0Just scroll down to the bottom of the Github page and download the latest release. \u00a0It&#8217;s in a zip file, so just unzip it and run the executable.<\/p>\n<p>Once it starts, just click on the floppy disk 1\u00a0icon and choose the master disk file that comes installed with the emulator. \u00a0Then reboot with the Apple button and it will boot to Applesoft Basic. \u00a0Or, you can download ROMs for various Apple games and programs from the Internet and boot those instead. \u00a0It emulates the speed of the processor, so it&#8217;s a very realistic emulation of the Apple IIe. \u00a0Including several monitor types to choose from.<\/p>\n<h1>Thanks<\/h1>\n<p>I hope you found this post informative and\/or entertaining! \u00a0Thanks for your interest! \u00a0And feel free to leave comments or questions below!<\/p>\n<p>Thanks,<br \/>Kurt<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If we\u00a0type this simple 8 line Applesoft Basic program into my working Apple IIe computer, we will end up with a cool little text based arcade game! \u00a0Watch the video below to see the game in action! This small Applesoft Basic\u00a0program was published in one of my Beagle Bros Apple Software Catalogs from 1987 (volume [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[109],"tags":[430,571,572,151,432,269,149,74,431],"_links":{"self":[{"href":"http:\/\/www.leucht.com\/blog\/wp-json\/wp\/v2\/posts\/2470"}],"collection":[{"href":"http:\/\/www.leucht.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.leucht.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.leucht.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.leucht.com\/blog\/wp-json\/wp\/v2\/comments?post=2470"}],"version-history":[{"count":23,"href":"http:\/\/www.leucht.com\/blog\/wp-json\/wp\/v2\/posts\/2470\/revisions"}],"predecessor-version":[{"id":2495,"href":"http:\/\/www.leucht.com\/blog\/wp-json\/wp\/v2\/posts\/2470\/revisions\/2495"}],"wp:attachment":[{"href":"http:\/\/www.leucht.com\/blog\/wp-json\/wp\/v2\/media?parent=2470"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.leucht.com\/blog\/wp-json\/wp\/v2\/categories?post=2470"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.leucht.com\/blog\/wp-json\/wp\/v2\/tags?post=2470"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}