{"id":605,"date":"2021-09-18T18:59:20","date_gmt":"2021-09-18T16:59:20","guid":{"rendered":"https:\/\/automatico.freevar.com\/?page_id=605"},"modified":"2021-10-05T18:15:58","modified_gmt":"2021-10-05T16:15:58","slug":"bbc-basic","status":"publish","type":"page","link":"https:\/\/automatico.freevar.com\/index.php\/cp-m-80-2\/bbc-basic\/","title":{"rendered":"BBCBasic"},"content":{"rendered":"<p><span style=\"font-size: 14pt;\">It is probably the most popular BASIC version for the 8 bits you can find, there are also versions for Mac and Windows.\u00a0A search on the net will satisfy much more than four lines written by me.\u00a0Why am I presenting it?\u00a0<span class=\"\">Because I found the assembler sources in<\/span> <a href=\"https:\/\/github.com\/jblang\/bbcbasic-z80\">https:\/\/github.com\/jblang\/bbcbasic-z80<\/a> and I couldn&#8217;t resist modifying them to have a BBCBasic version with customized graphic (and audio) instructions for Fabgl&#8217;s VT100 video and ESP32 graphic terminal .<\/span><\/p>\n<p><span style=\"font-size: 14pt;\">The manual is online at <a href=\"https:\/\/www.bbcbasic.co.uk\/bbcbasic\/mancpm\/index.html\">https:\/\/www.bbcbasic.co.uk\/bbcbasic\/mancpm\/index.html<\/a> or you can find it here in pdf format \u00a0<a href=\"https:\/\/automatico.freevar.com\/dump\/BBCBASICZ80-Manual.pdf\">BBCBASIC(Z80) Manual<\/a> .<\/span><\/p>\n<p><span style=\"font-size: 14pt;\">The BBCBasic version I downloaded is generic for CP \/ M and the graphic and sound instructions have been disabled.\u00a0BASIC is an imperative programming language and certainly does not allow program structuring but\u00a0<span class=\"\">BBCBasic is a dialect that\u00a0<\/span>\u00a0supports named procedures, local variables, recursion and other structured programming features.\u00a0Unlike Microsoft BASIC, you can write structured programs without having to refer to any line numbers.\u00a0For example, let&#8217;s see the classic calculation of the factorial:<\/span><\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\n10 PRINT FNfattoriale(5)\r\n20 END\r\n30 :\r\n40 DEF FNfattoriale(N)\r\n50 IF N=0 OR N=1 THEN =1\r\n60 =FNfattoriale(N-1)*N\r\n\r\n<\/pre>\n<p><span style=\"font-size: 14pt;\"><span class=\"\">Note that line numbers are present to sort the instruction list but are not needed to control the flow of instruction execution.<\/span><\/span><\/p>\n<p><span style=\"font-size: 14pt;\">The changes I have made currently are:<\/span><\/p>\n<p><span style=\"font-size: 14pt;\">MODE 0 | 1: text screen |\u00a0graphic screen.\u00a0The text screen is 80 columns by 24 lines and color characters.\u00a0The graphic extension is rigid and is fixed at 640 horizontal points by 480 vertical points.<\/span><\/p>\n<p><span style=\"font-size: 14pt;\">CLG: Screen cleaning in graphics mode.<\/span><\/p>\n<p><span style=\"font-size: 14pt;\">GCOL R, G, B: color setting of the dot or line indicating the intensity of red, green and blue.<\/span><\/p>\n<p><span style=\"font-size: 14pt;\">PLOT X, Y: lights up a colored dot in the graphic screen (see GLC).<\/span><\/p>\n<p><span style=\"font-size: 14pt;\">DRAW X1, Y1, X2, Y2: draws a colored line between the coordinate pairs.<\/span><\/p>\n<p><span style=\"font-size: 14pt;\">MOVE X, Y: scrolls x columns and y rows on a graphic page.<\/span><\/p>\n<p><span style=\"font-size: 14pt;\">SOUND TYPE, FREQUENCY, DURATION,\u00a0VOLUME:\u00a0emits a sound of type 0-sine 1-square 2-triangle 3-sawtooth 4-noise 5-vic noise, of frequency in Hertz, duration in milliseconds and volume between 0 and 127<\/span><\/p>\n<p><span style=\"font-size: 14pt;\">The BBCBasic program can be found here <\/span><a href=\"https:\/\/automatico.freevar.com\/dump\/bbcbasic.com\"><span style=\"font-size: 14pt;\">https:\/\/automatico.freevar.com\/dump\/bbcbasic.com<\/span><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_605\" class=\"pvc_stats all  \" data-element-id=\"605\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> <img loading=\"lazy\" decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/automatico.freevar.com\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"excerpt":{"rendered":"<p>It is probably the most popular BASIC version for the 8 bits you can find, there are also versions for Mac and Windows.\u00a0A search on the net will satisfy much more than four lines written by me.\u00a0Why am I presenting it?\u00a0Because I found the assembler sources in https:\/\/github.com\/jblang\/bbcbasic-z80 and I couldn&#8217;t resist modifying them to [&hellip;]<\/p>\n<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_605\" class=\"pvc_stats all  \" data-element-id=\"605\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> <img loading=\"lazy\" decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/automatico.freevar.com\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"author":1,"featured_media":0,"parent":70,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-605","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/automatico.freevar.com\/index.php\/wp-json\/wp\/v2\/pages\/605"}],"collection":[{"href":"https:\/\/automatico.freevar.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/automatico.freevar.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/automatico.freevar.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/automatico.freevar.com\/index.php\/wp-json\/wp\/v2\/comments?post=605"}],"version-history":[{"count":23,"href":"https:\/\/automatico.freevar.com\/index.php\/wp-json\/wp\/v2\/pages\/605\/revisions"}],"predecessor-version":[{"id":801,"href":"https:\/\/automatico.freevar.com\/index.php\/wp-json\/wp\/v2\/pages\/605\/revisions\/801"}],"up":[{"embeddable":true,"href":"https:\/\/automatico.freevar.com\/index.php\/wp-json\/wp\/v2\/pages\/70"}],"wp:attachment":[{"href":"https:\/\/automatico.freevar.com\/index.php\/wp-json\/wp\/v2\/media?parent=605"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}