IT’s HERE! Half-Byte Tiny Basic 3!

randomdotsOne of the things I have really enjoyed since embarking on my Arduino journey and this blog, is seeing others take things I’ve worked on or created and expand upon it. This is especially true with Half-Byte Tiny Basic, something that started out as the work of Mike Field, who, himself used the work of another person. HB Tiny Basic is an iterative work, built on the work of others as well as myself.  For HB Tiny Basic 3, I have incorporated the work of others to make it better.  I would love to take credit for these changes, but, I cannot.  This release is strictly due to Hill Satoshi of the Hirosaki University Faculty of Education and someone named ‘Koyama’.  A Big thanks to them.

Please visit Hill Satoshi’s page. There are a lot of great ideas, basic electronics information and some code snippets…be careful, some features of the basic there were not incorporated in HB Tiny Basic, like the motor control and PLOT (which is the same as Set and Reset.)

Among the additions and changes are an auto load and auto run feature (requested by many of you) and a better eSave and eLoad feature.  In fact, I like much of what was done to the language and may incorporate more at a later date.

So, what’s new?

Two new statements have been added: NUMLED and BMP.  A new function, TREAD.  The aforementioned auto load and auto save feature.  Three new operators: %, & and |. % returns the remainder of a division, & is logical AND and | is a logical OR.

What’s changed?

The code to do a eSave or eLoad has changed and should be more reliable.  The startup code has changed a little, dynamically calculating the amount of ram that is available.  Ability to read in characters from the serial input as if it were the keyboard. This means you can connect to a serial terminal and enter and run Tiny Basic code without a PS/2 Keyboard attached. And a few minor tweaks here and there.

New Statements

The first new statement is NUMLED.  If you connect a seven segment LED directly to the device you are running HB Tiny Basic on, you can output directly to the LED.  The syntax is:

NUMLED x  where x is a digit from 0 to 9.


20 for I=0 to 9

30 numled I

40 delay 1000

50 next I

60 goto 20


BMP allows you to draw a bitmap on the screen.  It is very much like the DRAW statement in old Microsoft Basics. It feature its own mini design language for you to draw on the screen. A minimum of three parameters are required: x,y,string.  Where x and y are the start points and string is the definition.

Table of Commands for Mini Language:


(0 is black;
1 is white)


(0 is black;
1 is white)







10 cls 
20 bmp0,0,"ffffc00000007fff","ffffc00000001fff", "fffe0000000003ff","fffc0000000000ff", "fff80000000000ff","fff000000000007f", "ffe000000000003f","ff0000000000003f" 
30 bmp0,8,"ff0000000000001f","ff2f00000000000f", "ff1fc0000000000f","ff000c000000000f", "ff003f000000000f","ff0020400000000f", "fc0000fc1800000f","fc00000f7f3c000f" 
40 bmp0,16,"f80000037f7e000f","f8000000007e0003", "f01c00c0001cf7c3","f03e03c00000efcf", "f03e07c00e00000f","c03f1ff01f000003", "c03ffff03f800003","cf3ffff87fc380c3" 
50 bmp0,24,"ce3fffffffc3c0c3","c03fc03fffe7f1cf", "c03f003ffffff3c0","ff3fff3fff0fff88", "ff1ffffffc0fff1c","ff9ffffff043ff3c", "ff8fffc03ff3ff38","ff8fffc03ff3fe00" 
60 bmp0,32,"ffcfffff3ffffc01","ffc7fffffffffcff", "ffc3fffffffff8ff","fff3ff007ffff1ff", "fff1ff0c7fffc3ff","fff0ff0c7fffc7ff", "fffc7f0c7fff8fff","fffe3f807ffe1fff"
70 bmp0,40,"ffff3fc0fffe3fff","ffff07c3fff07fff", "fff023ffffe1ffff","ffe0203fff83ffff", "ff07e00000003fff","fc0fe3ffff8f0fff", "fc3fe3ffff8f0fff","f0ffe3ffff8fc1ff" 
80 shift 1,3:delay 99:goto 80


Aviary Photo_131159334768733501

The example code above produces this bitmap.

New Function:

TREAD is an alternate method for reading a temperature sensor. It does not require any additional libraries and reads the sensor directly. Usage is: Var=TREAD(pin)  where pin is A0 to A7.


100 a=TREAD(A3)

The example reads in a value between –30 and 50 degrees Celsius.

Auto Load and Auto Save

HB Tiny Basic will now load the saved program in EEPROM.  You have three seconds to press a key or the loaded program will auto run.  If you press a key in those three seconds, you will get the normal prompt as in the past.  This feature is useful if you want to use HB Tiny Basic for embedded use or simply to restart if the device loses power.  There are a lot of uses for this feature.

Other small changes have been made, but are not worth discussing as they are mostly cosmetic or code optimizations.

In reviewing my code, I see just how sloppy it has become. I am going to clean it up, but, until I do, please feel free to offer up any suggestions you may have for features or changes.  As always, the code is free and open.  I ask that you leave the regular header intact, at the top of the code. I want all involved to be recognized.

Thanks and let us know what you do with Half-Byte Tiny Basic.

Download Link: Half-Byte Tiny Basic 3

20 thoughts on “IT’s HERE! Half-Byte Tiny Basic 3!

  1. I am new to arduino I thought MPLAB was cryptic but compared to the arduino IDE it is perfect I have been unable to get Half byte basic going it will not compile I think it is because one of the components of a component in a sub folder in a none descript corner is missing! so much for C being structured it seems a lot of the includes get left out! You may have guessed I’m a bit irate mainly because despite following the IDE instructions importing the zip libraries and banging on for hours I’m no further on . It would have been fun mess with an old style computer as I remember them but I do not think I can invest any more time I think I’m better off with a micromite. I’m off now to beat the crap out of the arduino with a lump hammer!

    • I am sorry you had such a hard time. Arduino is truly fun to play with and can be very versatile in what you can do with it. Unfortunately…the bloody libraries can be a royal pain. I still struggle with them. If you like, you can send a screen shot or copy the error text and I will help you any way I can.

  2. Thanks for the work, but I have so many compilation problems. I installed the libraries, but always shows “deprecated conversion from string in constant ..”. You can not control the compatibility with new versions of the Arduino IDE? Thank you

  3. This is error..

    Arduino:1.6.11 (Windows 10), Scheda:”Arduino/Genuino Uno”

    C:\Users\Utente\Desktop\HalfByteTinyBasic\HalfByteTinyBasic.ino: In function ‘void loop()’:

    C:\Users\Utente\Desktop\HalfByteTinyBasic\HalfByteTinyBasic.ino:2327:23: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]



    • There is a major compatibility issue with 1.6.7 and up. I have not yet figured out what the problem is, but I am working on it. I have to use 1.6.6 to maintain and enhance the code. It looks like it might be TVOut or the PS/2 Keyboard stuff, but I am not sure.

  4. thank you. I try with old relase of ‘IDE, although it would be important to understand what is wrong. Thanks for the nice davevro project ..

    • I agree and am trying to figure it out. Once I do, I will repost with an updated sketch. FYI…my embedded basic compiles fine with the newer IDE’s, so it has to be something with TVOut or the keyboard code, both of which are missing in the embedded basic.

  5. nothing to do, even with the 1.6.12 version always many compilation errors, do not understand where I’m wrong
    Arduino:1.6.12 (Windows 10), Scheda:”Arduino/Genuino Uno”

    C:\Users\Utente\Desktop\HalfByteTinyBasic\HalfByteTinyBasic.ino: In function ‘void loop()’:

    C:\Users\Utente\Desktop\HalfByteTinyBasic\HalfByteTinyBasic.ino:2327:23: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]



    C:\Users\Utente\Documents\Arduino\libraries\PS2Keyboard\PS2Keyboard.cpp:265:53: warning: multi-character character constant [-Wmultichar]

    0 /*CapsLock*/, 0 /*Rshift*/, PS2_ENTER /*Enter*/, ‘¤’, 0, ‘#’, 0, 0,


    C:\Users\Utente\Documents\Arduino\libraries\PS2Keyboard\PS2Keyboard.cpp:271:1: warning: narrowing conversion of ‘-15708’ from ‘int’ to ‘uint8_t {aka unsigned char}’ inside { } [-Wnarrowing]



    C:\Users\Utente\Documents\Arduino\libraries\PS2Keyboard\PS2Keyboard.cpp:271:1: warning: large integer implicitly truncated to unsigned type [-Woverflow]

    C:\Users\Utente\AppData\Local\Temp\ccuwjjPS.s: Assembler messages:

    C:\Users\Utente\AppData\Local\Temp\ccuwjjPS.s:4859: Warning: ignoring changed section attributes for

    C:\Users\Utente\AppData\Local\Temp\cccLp57b.s: Assembler messages:

  6. I did various tests. Everything works up to version 1.6.1 Arduino IDE, while later cause many different problems depending on the used bookstores. Thanks for your attention, and again congratulations for the project.

  7. Thanks for your patience. one thing I do not understand. In this version you can not use the serial monitor dell ‘arduino ide and how can I use it instead of tvout? The serial monitor gives me trouble, because I wrote an initial message and then stops. It’s normal? Thanks again

  8. Hello,

    It has been quite a while since the post, but I found it recently, and I am having problems with the i2c library, which I can not find it anymore in the link of OneDrive. Can anyone put a link to it somewhere? I sent an e-mail to George Gray as well, but up to now I have not received any answer. Maybe here…

    • Well, I used the i2cmaster library that the Nunchuck library uses, and this goes well, but now the errors are related maybe to TVout compiling issues with newer versions of Arduino IDE??? The errors I get are “error opcode o1bs” and another errors like this one.

      • Hello,

        Thanks for the answer, it’s better late than never, we say in Spain. Anyway, I have been in touch with you via e-mail as well. Now, I have compiled with the i2cmaster library, and the HalfByteTinyBasic3 files with the latest version of arduino ide, 1.8.9, and the error I have got, is:

        exit status 1
        Error compiling for board Arduino/Genuino Uno.

        Which is interesting, because It is the atmega328p… Funny….

  9. Well, this is the problem maybe:

    “C:\\Users\\Oscar\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\5.4.0-atmel3.6.1-arduino2/bin/avr-gcc” -w -Os -g -flto -fuse-linker-plugin -Wl,–gc-sections -mmcu=atmega328p -o “C:\\Users\\Oscar\\Downloads\\Hex/HalfByteTinyBasic.ino.elf” “C:\\Users\\Oscar\\Downloads\\Hex\\sketch\\HalfByteTinyBasic.ino.cpp.o” “C:\\Users\\Oscar\\Downloads\\Hex\\libraries\\i2cmaster\\i2cmaster.cpp.o” “C:\\Users\\Oscar\\Downloads\\Hex\\libraries\\Nunchuck\\nunchuck.cpp.o” “C:\\Users\\Oscar\\Downloads\\Hex\\libraries\\TVoutfonts\\font4x6.cpp.o” “C:\\Users\\Oscar\\Downloads\\Hex\\libraries\\TVoutfonts\\font4x6g.cpp.o” “C:\\Users\\Oscar\\Downloads\\Hex\\libraries\\TVoutfonts\\font6x8.cpp.o” “C:\\Users\\Oscar\\Downloads\\Hex\\libraries\\TVoutfonts\\font8x8.cpp.o” “C:\\Users\\Oscar\\Downloads\\Hex\\libraries\\TVoutfonts\\font8x8ext.cpp.o” “C:\\Users\\Oscar\\Downloads\\Hex\\libraries\\TVout\\TVout.cpp.o” “C:\\Users\\Oscar\\Downloads\\Hex\\libraries\\TVout\\TVoutPrint.cpp.o” “C:\\Users\\Oscar\\Downloads\\Hex\\libraries\\TVout\\video_gen.cpp.o” “C:\\Users\\Oscar\\Downloads\\Hex\\libraries\\PS2Keyboard\\PS2Keyboard.cpp.o” “C:\\Users\\Oscar\\Downloads\\Hex\\libraries\\TinyDHT\\TinyDHT.cpp.o” “C:\\Users\\Oscar\\Downloads\\Hex/core\\core.a” “-LC:\\Users\\Oscar\\Downloads\\Hex” -lm
    C:\Users\Oscar\AppData\Local\Temp\cckr0bnt.s: Assembler messages:

    C:\Users\Oscar\AppData\Local\Temp\cckr0bnt.s:6797: Warning: ignoring changed section attributes for

    C:\Users\Oscar\AppData\Local\Temp\ccmL0Dxx.s: Assembler messages:

    C:\Users\Oscar\AppData\Local\Temp\ccmL0Dxx.s:1101: Error: unknown opcode `delay2′

    C:\Users\Oscar\AppData\Local\Temp\ccmL0Dxx.s:1157: Error: unknown opcode `delay1′

    C:\Users\Oscar\AppData\Local\Temp\ccmL0Dxx.s:1159: Error: unknown opcode `delay2′

    C:\Users\Oscar\AppData\Local\Temp\ccmL0Dxx.s:1162: Error: unknown opcode `delay2′

    C:\Users\Oscar\AppData\Local\Temp\ccmL0Dxx.s:1165: Error: unknown opcode `delay2′

    C:\Users\Oscar\AppData\Local\Temp\ccmL0Dxx.s:1168: Error: unknown opcode `delay2′

    C:\Users\Oscar\AppData\Local\Temp\ccmL0Dxx.s:1171: Error: unknown opcode `delay2′

    C:\Users\Oscar\AppData\Local\Temp\ccmL0Dxx.s:1174: Error: unknown opcode `delay1′

    C:\Users\Oscar\AppData\Local\Temp\ccmL0Dxx.s:1179: Error: unknown opcode `delay1′

    C:\Users\Oscar\AppData\Local\Temp\ccmL0Dxx.s:1182: Error: unknown opcode `delay3′

    C:\Users\Oscar\AppData\Local\Temp\ccmL0Dxx.s:1232: Error: unknown opcode `svprt’

    C:\Users\Oscar\AppData\Local\Temp\ccmL0Dxx.s:1236: Error: unknown opcode `o1bs’

    C:\Users\Oscar\AppData\Local\Temp\ccmL0Dxx.s:1240: Error: unknown opcode `o1bs’

    C:\Users\Oscar\AppData\Local\Temp\ccmL0Dxx.s:1241: Error: unknown opcode `delay2′

    C:\Users\Oscar\AppData\Local\Temp\ccmL0Dxx.s:1243: Error: unknown opcode `o1bs’

    C:\Users\Oscar\AppData\Local\Temp\ccmL0Dxx.s:1244: Error: unknown opcode `delay2′

    C:\Users\Oscar\AppData\Local\Temp\ccmL0Dxx.s:1246: Error: unknown opcode `o1bs’

    C:\Users\Oscar\AppData\Local\Temp\ccmL0Dxx.s:1247: Error: unknown opcode `delay2′

    C:\Users\Oscar\AppData\Local\Temp\ccmL0Dxx.s:1249: Error: unknown opcode `o1bs’

    C:\Users\Oscar\AppData\Local\Temp\ccmL0Dxx.s:1250: Error: unknown opcode `delay2′

    C:\Users\Oscar\AppData\Local\Temp\ccmL0Dxx.s:1252: Error: unknown opcode `o1bs’

    C:\Users\Oscar\AppData\Local\Temp\ccmL0Dxx.s:1253: Error: unknown opcode `delay2′

    C:\Users\Oscar\AppData\Local\Temp\ccmL0Dxx.s:1255: Error: unknown opcode `o1bs’

    C:\Users\Oscar\AppData\Local\Temp\ccmL0Dxx.s:1256: Error: unknown opcode `delay1′

    C:\Users\Oscar\AppData\Local\Temp\ccmL0Dxx.s:1259: Error: unknown opcode `o1bs’

    C:\Users\Oscar\AppData\Local\Temp\ccmL0Dxx.s:1261: Error: unknown opcode `delay1′

    C:\Users\Oscar\AppData\Local\Temp\ccmL0Dxx.s:1263: Error: unknown opcode `o1bs’

    C:\Users\Oscar\AppData\Local\Temp\ccmL0Dxx.s:1264: Error: unknown opcode `svprt’

    C:\Users\Oscar\AppData\Local\Temp\ccmL0Dxx.s:1266: Error: unknown opcode `o1bs’

    C:\Users\Oscar\AppData\Local\Temp\ccmL0Dxx.s:1315: Error: unknown opcode `svprt’

    C:\Users\Oscar\AppData\Local\Temp\ccmL0Dxx.s:1319: Error: unknown opcode `o1bs’

    C:\Users\Oscar\AppData\Local\Temp\ccmL0Dxx.s:1322: Error: unknown opcode `delay1′

    C:\Users\Oscar\AppData\Local\Temp\ccmL0Dxx.s:1324: Error: unknown opcode `o1bs’

    C:\Users\Oscar\AppData\Local\Temp\ccmL0Dxx.s:1325: Error: unknown opcode `delay3′

    C:\Users\Oscar\AppData\Local\Temp\ccmL0Dxx.s:1327: Error: unknown opcode `o1bs’

    C:\Users\Oscar\AppData\Local\Temp\ccmL0Dxx.s:1328: Error: unknown opcode `delay3′

    C:\Users\Oscar\AppData\Local\Temp\ccmL0Dxx.s:1330: Error: unknown opcode `o1bs’

    C:\Users\Oscar\AppData\Local\Temp\ccmL0Dxx.s:1331: Error: unknown opcode `delay3′

    C:\Users\Oscar\AppData\Local\Temp\ccmL0Dxx.s:1333: Error: unknown opcode `o1bs’

    C:\Users\Oscar\AppData\Local\Temp\ccmL0Dxx.s:1334: Error: unknown opcode `delay3′

    C:\Users\Oscar\AppData\Local\Temp\ccmL0Dxx.s:1336: Error: unknown opcode `o1bs’

    C:\Users\Oscar\AppData\Local\Temp\ccmL0Dxx.s:1337: Error: unknown opcode `delay3′

    C:\Users\Oscar\AppData\Local\Temp\ccmL0Dxx.s:1339: Error: unknown opcode `o1bs’

    C:\Users\Oscar\AppData\Local\Temp\ccmL0Dxx.s:1340: Error: unknown opcode `delay3′

    C:\Users\Oscar\AppData\Local\Temp\ccmL0Dxx.s:1342: Error: unknown opcode `o1bs’

    C:\Users\Oscar\AppData\Local\Temp\ccmL0Dxx.s:1345: Error: unknown opcode `delay2′

    C:\Users\Oscar\AppData\Local\Temp\ccmL0Dxx.s:1347: Error: unknown opcode `o1bs’

    C:\Users\Oscar\AppData\Local\Temp\ccmL0Dxx.s:1348: Error: unknown opcode `svprt’

    C:\Users\Oscar\AppData\Local\Temp\ccmL0Dxx.s:1350: Error: unknown opcode `o1bs’

    lto-wrapper.exe: fatal error: C:\Users\Oscar\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\5.4.0-atmel3.6.1-arduino2/bin/avr-gcc returned 1 exit status

    compilation terminated.

    c:/users/oscar/appdata/local/arduino15/packages/arduino/tools/avr-gcc/5.4.0-atmel3.6.1-arduino2/bin/../lib/gcc/avr/5.4.0/../../../../avr/bin/ld.exe: error: lto-wrapper failed

    collect2.exe: error: ld returned 1 exit status

    Using library EEPROM at version 2.0 in folder: C:\Users\Oscar\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.23\libraries\EEPROM
    Using library i2cmaster in folder: C:\Program Files (x86)\Arduino\libraries\i2cmaster (legacy)
    Using library Nunchuck in folder: C:\Program Files (x86)\Arduino\libraries\Nunchuck (legacy)
    Using library TVoutfonts in folder: C:\Program Files (x86)\Arduino\libraries\TVoutfonts (legacy)
    Using library TVout in folder: C:\Program Files (x86)\Arduino\libraries\TVout (legacy)
    Using library PS2Keyboard at version 2.4 in folder: C:\Program Files (x86)\Arduino\libraries\PS2Keyboard
    Using library TinyDHT in folder: C:\Program Files (x86)\Arduino\libraries\TinyDHT (legacy)
    exit status 1
    Error compiling for board Arduino/Genuino Uno.

Leave a Reply

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

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

Google photo

You are commenting using your Google 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 )

Connecting to %s