Half-Byte Tiny Basic is now available!

101_3346Half-Byte Tiny Basic is now complete. It supports 80×48 graphic resolution, 20 by 8 lines of text using a 4 x 6 bit character set. Audio generation via 16384 tones from a single channel. Graphical support in the form of Line, Box, Set, Reset, Circle and Shift statements and the Get function. 16 bit integer math is supported. Direct hardware access via the DWrite, AWrite statements and ARead and DRead functions. Serial port access via the SPrint and Echo statements as well as the IN function. You have access to all of the I/O pins of the 328p controller chip, the heart of the Arduino UNO and the Half-Byte Console.  The Wii Nunchuck and Classic Controller are supported via the PAD function.  LImited string handling can be accomplished (but there is no native string support.)

WP_20140701_018 (2)Functions include ABS, CHR, RND and INKEY.

Half-Byte Tiny Basic harkens back to the early days of home computing when memory was low and very expensive. Video capability was primitive (as it is, admittedly, here) and mass storage was non-existent. You only have one thousand bytes memory available for your Basic program. Half-Byte Tiny Basic is based on a version of 68000 Tiny Basic written by Mike Field. This version is optimized and specifically developed for on board development using a PS/2 keyboard and the TVOut Arduino library. And it is ideal for teaching the basics of computer programming. It is easy to learn and easy to use.WP_20140701_007

Since the Half-Byte Console is a very simple device, many shortcuts (as in the early days) had to be taken. For instance, memory is at a premium and that is why the resolution is low and the font is cramped. There is no fancy integrated development environment, heck, there isn’t a real editor: you make a mistake on a line, you type it in again. The LIST WP_20140701_027 (2)command is very primitive: LIST will type out the whole program, LIST <line number> begins typing out the program starting at <line number> while LIST <line number>- will type out JUST that line.  You can only SAVE one program as there is currently no mass storage (but, I am working on a better solution, stay tuned!)

Half-Byte Tiny Basic is not perfect, but is works well and is a great tool for teaching. Best of all, you can download it for free.  A short document explaining the commands,statements and functions is included. You get the source code and the documentation all for free.  A nicer book/manual will soon be available for a small cost. The book written so that someone with no experience can pick it up, read and follow it to gain a basic understanding of how to write a program and get it to work. This book will also be part of the Programmer’s kit for the Half-Byte Console.

SAMPLE CODE

Here are a few pieces of sample code:

Kaliedoscope 3

100 CLS
110 X=RND(79)
120 Y=RND(47)
130 P=RND(79)
140 Q=RND(47)
150 SET X,Y
160 SET 79-X,Y
170 SET 79-X,47-Y
180 SET X,47-Y
190 RESET P,Q
200 RESET 79-P,Q
210 RESET 79-P,47-Q
220 RESET P,47-Q
230 Z=RND(100)
240 R=RND(20)
250 IF Z>92 CIRCLE 40,24,R,1
260 IF Z>92 FOR I=1 TO R
270 IF Z>92 CIRCLE 40,24,I,0
280 IF Z>92 NEXT I
290 GOTO 110

Half-Byte Demo

100 CLS
110 FOR K=0 TO 4
120 CURSOR K,3
130 PRINT ” Half-“
140 CURSOR 14-K,3
150 PRINT “Byte “
152 DELAY 1000
160 NEXT K
170 FOR R=1 TO 20
180 CIRCLE 38,21,R,1
184 DELAY 50
186 CIRCLE 38,21,R-1,0
190 NEXT R
195 CIRCLE 38,21,R-1,0
197 DELAY 1000
199 X=7
200 A=67:GOSUB 900
210 A=79:GOSUB 900
220 A=78:GOSUB 900
230 A=83:GOSUB 900
240 A=79:GOSUB 900
250 A=76:GOSUB 900
260 A=69:GOSUB 900
400 GOTO 100
900 FOR Y=0 TO 6
910 CURSOR X,Y
920 PRINT CHR(A);
930 DELAY 250
940 CURSOR X,Y
950 PRINT ” “;
960 NEXT Y
970 CURSOR X,7
980 PRINT CHR(A);
985 X=X+1
990 RETURN

You can download a PDF of the Half-Byte Tiny Basic Guide here.

You can download a ZIP file with the Half-Byte Tiny Basic source, Guide and some example code from here.

You can download the Half-Byte serial terminal for Arduino here.

The serial terminal runs on another Half-Byte Console or Arduino that has the Video and Audio output modifications and runs TVOut. Connect the two devices using TX,RX and GND pins. This allows you to use the serial terminal as an output device, providing a second screen to your console. The terminal provides 128×96 graphics and 22×16 lines of text. The terminal software interprets special code for clear screen, set pixel, reset pixel and box.

PLEASE NOTE:

Half-Byte Tiny Basic Copyright (c) 2014 George Gray

Arduino Tiny Basic Copyright © 2011 Mike Field

TVOut Library Copyright© 2010 Myles Metzer

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be  included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Advertisements

13 thoughts on “Half-Byte Tiny Basic is now available!

  1. That is amazing! The one item I don’t agree with is the list function.
    I think list should list one line.
    list – should list that line number to the end of the program.
    Otherwise it looks great! Can’t wait to build my own!!!!

      • Sorry, but the greater then and less then signs didn’t come out.
        I meant LIST XX should only list one line.
        LIST XX – should list from that line to the end.
        That way it reads XX – END.

      • Yes, you are right. I also want to add a range of lines. I have a few things in mind to change, so version two is in the works. I am not happy with save and load, but the 328 limits what I can do with out having it tethered to a computer.

  2. I would like to compile Half-Byte Tiny Basic. I found it difficult to find the right versions of the libraries it depends on. There are several libraries for some of the h-files. Could you put up the libraries you used to compile your program.
    #include // Many releases exist.
    #include
    #include
    #include
    #include
    #include // Only EEPROM is built-in in my version of Arduino 1:1.0.5+dfsg2-2 for Ubuntu 14.04 LTS.

    • Download the Half-Byte Tiny Basic Version 2. It has everything that the interpreter needs (that is not included as part of the standard Arduino IDE Install.) Try that. In the mean time, I’ll put together a list of the versions that I use. They should all be in V2, I am not sure about V1, I know I had left out the customized TVOut, but I posted a link to that version.

      • I got Half-Byte Tiny Basic 1 to compile, but I had to remove nunchuk-support, since I couldn’t find a modern library, but I don’t have a nunchuk. I also added that you could type in the serial console. I use “sudo minicom -o -b 9600 -D /dev/ttyACM0” to connect in Ubuntu 14.04 LTS, but one can use e.g. PuTTY in Windows. I also added support for Swedish keyboard. You have to edit a line in the source code order to change keyboard, but in the future one might add a command to change keyboard. I also fixed many compiler warnings and I think some of the where actual bugs. You could test to switch on warnings in Arduino to see the compiler warnings.

        One bug for me is that Ctrl+C doesn’t work on the PS/2-keyboard or in the terminal emulator.

        Thanks for a great application of the libraries! I am a collector of YouTube-videos about cheap new computers. I have Raspberry Pi A & B2 and Duinomite Mini, see http://youtu.be/0joenLpU-Js?list=PLUx1NFKWh2OGwlSZj_L87OjlB794b9rfH

        I will try out Half-Byte Tiny Basic v. 2 later, but I think I will miss libraries. Which version of Arduino do you use?

      • Thanks for the update. I don’t get compiler warnings. Can you let me know what they are? CTRL-C, was replaced with PG UP, I think. I have it documented. The reason was that PS/2 keyboard code didn’t pass the CTRL code correctly and I was too lazy to fix it. Try PG UP or PG DWN. The Nunchuck library should work as is from CONTROLLERS. I am still in the process of getting these together, and writing up a post about them. I should have done prior to releasing the whole thing. Like I said, everything you need SHOULD be in release two. Release two has a few more features.
        Anyway, thanks again for letting us know your progress. If you share what issues you had, maybe I can fix them for all.

        Thanks.

      • Here are the errors and warnings I get when I compile HalfByteTinyBasic.ino 05 July 2014 using Arduino 1:1.0.5 in Ubuntu 14.04 LTS (after removing Nunchuk-support):
        In file included from /home/mikael/Documents/arduino/libraries/TVoutfonts/font4x6.h:3:0,
        from HalfByteTinyBasic.ino:29:
        HalfByteTinyBasic.ino:70:33: error: variable ‘keywords’ must be const in order to be put into read-only section by means of ‘__attribute__((progmem))’
        HalfByteTinyBasic.ino:169:33: error: variable ‘func_tab’ must be const in order to be put into read-only section by means of ‘__attribute__((progmem))’
        HalfByteTinyBasic.ino:202:31: error: variable ‘to_tab’ must be const in order to be put into read-only section by means of ‘__attribute__((progmem))’
        HalfByteTinyBasic.ino:207:33: error: variable ‘step_tab’ must be const in order to be put into read-only section by means of ‘__attribute__((progmem))’
        HalfByteTinyBasic.ino:212:34: error: variable ‘relop_tab’ must be const in order to be put into read-only section by means of ‘__attribute__((progmem))’
        HalfByteTinyBasic.ino:230:36: error: variable ‘highlow_tab’ must be const in order to be put into read-only section by means of ‘__attribute__((progmem))’
        HalfByteTinyBasic.ino: In function ‘short int expr4()’:
        HalfByteTinyBasic.ino:600:32: warning: statement is a reference, not call, to function ‘ignore_blanks’ [-Waddress]
        HalfByteTinyBasic.ino:600:32: warning: statement has no effect [-Wunused-value]
        HalfByteTinyBasic.ino:607:36: warning: statement is a reference, not call, to function ‘ignore_blanks’ [-Waddress]
        HalfByteTinyBasic.ino:607:36: warning: statement has no effect [-Wunused-value]
        HalfByteTinyBasic.ino: In function ‘void loop()’:
        HalfByteTinyBasic.ino:1232:13: warning: unused variable ‘value’ [-Wunused-variable]
        HalfByteTinyBasic.ino:1493:13: warning: unused variable ‘value’ [-Wunused-variable]
        HalfByteTinyBasic.ino:1524:13: warning: unused variable ‘value’ [-Wunused-variable]
        HalfByteTinyBasic.ino:1552:13: warning: unused variable ‘value’ [-Wunused-variable]
        HalfByteTinyBasic.ino:1554:30: warning: unused variable ‘y’ [-Wunused-variable]
        HalfByteTinyBasic.ino:1574:13: warning: unused variable ‘value’ [-Wunused-variable]
        HalfByteTinyBasic.ino:1601:13: warning: unused variable ‘value’ [-Wunused-variable]
        HalfByteTinyBasic.ino:1632:13: warning: unused variable ‘value’ [-Wunused-variable]
        HalfByteTinyBasic.ino:1663:13: warning: unused variable ‘value’ [-Wunused-variable]
        HalfByteTinyBasic.ino:1743:13: warning: unused variable ‘value’ [-Wunused-variable]
        HalfByteTinyBasic.ino:1824:13: warning: unused variable ‘value’ [-Wunused-variable]
        HalfByteTinyBasic.ino:993:1: warning: label ‘unimplemented’ defined but not used [-Wunused-label]
        HalfByteTinyBasic.ino: In function ‘int checkForComma()’:
        HalfByteTinyBasic.ino:2036:1: warning: no return statement in function returning non-void [-Wreturn-type]
        In file included from /home/mikael/Documents/arduino/libraries/TVout/TVout.h:40:0,
        from HalfByteTinyBasic.ino:30:
        /home/mikael/Documents/arduino/libraries/TVout/video_gen.h: At global scope:
        /home/mikael/Documents/arduino/libraries/TVout/video_gen.h:63:20: warning: ‘void wait_until(uint8_t)’ declared ‘static’ but never defined [-Wunused-function]
        static void inline wait_until(uint8_t time);
        ^
        In file included from HalfByteTinyBasic.ino:30:0:
        /home/mikael/Documents/arduino/libraries/TVout/TVout.h:176:20: warning: ‘void sp(unsigned char, unsigned char, char)’ declared ‘static’ but never defined [-Wunused-function]
        static void inline sp(unsigned char x, unsigned char y, char c);
        ^
        HalfByteTinyBasic.ino:230:22: warning: ‘highlow_tab’ defined but not used [-Wunused-variable]
        HalfByteTinyBasic.ino:250:23: warning: ‘stack’ defined but not used [-Wunused-variable]

        I fixed the errors in my version by adding const and fixed all warnings except those in TVout.

        I don’t have CONTROLLERS in my version of Arduino. What version of Arduino do you use?

        I connected a speaker and could hear sound using TONE, but it never stops no matter the second parameter. The only way to stop the sound is to reset the Arduino UNO.

      • TONE 0,0 will stop the sound. The second parameter is the duration, the higher that number, the longer it plays. I will be posting the list of libraries in the next day or so. I also turned on the verbose option and compiled it…yep, got a few warnings. I will be fixing them for Version 2. Thanks for the heads up. I am surprised that it compiles and runs with a couple of the ‘warnings’, which seem like they should be full blown errors.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s