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.

EXAMPLE:

20 for I=0 to 9

30 numled I

40 delay 1000

50 next I

60 goto 20

BMP

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:

CMD

Pattern
(0 is black;
1 is white)

CMD

PATTERN
(0 is black;
1 is white)

0
1
2
3
4
5
6
7

0000
0001
0010
0011
0100
0101
0110
0111

8
9
A
B
C
D
E
F

1000
1001
1010
1011
1100
1101
1110
1111

 

EXAMPLE:

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.

EXAMPLE:

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

Advertisements

14 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]

    TV.print_centered(“”);

    ^

    • 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]

    TV.print_centered(“”);

    ^

    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 .progmem.data

    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

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