Hackaday BASIC Interpreter

A project log for Badge for Hackaday Conference 2018 in Belgrade

In the 1980's, you had to know programming to use computers. They were used for... guess what? Computing! Want to see how it looked?

Mike SzczysMike Szczys 05/14/2018 at 21:559 Comments

The Hackaday BASIC interpreter is based on the uBASIC project by Adam Dunkels. This provided a tokenizer and the most rudimentary words needed for the language to operate. From there, Jaromir Sukuba greatly expanded the word set to take advantage of the best the badge hardware has to offer.

The reference for all of the words is listed below. You may also see examples of these words in use by viewing the example code project log.

Of Note:

BASIC Word List:

Standard Words:

Badge Custom Words

BASIC CLI commands


In order to save you some typing, we defined some aliases for functions


Dejan Ristanovic wrote 06/07/2018 at 03:26 point

The only real problem is - no strings!

  Are you sure? yes | no

jurc192 wrote 05/28/2018 at 18:10 point

I can't get the `kin` command working :(

Could somebody provide a simple example of using kin? In my case, `println kin 1` doesn't block. It returns 1 and continues I missing something, or is it a bug?

I am using the hackaday basic interpreter and typing the code to the badge directly...

  Are you sure? yes | no

jaromir.sukuba wrote 05/28/2018 at 18:27 point

Something like

10 println kin 0
20 wait 500
30 goto 10

writes 0 to console every 500ms, except of when you press key, ASCII value of key in decimal format will be printed. For blocking variant, try

10 println kin 1
20 goto 10

This should wait for keypress and print out value only when key is pressed. Note that kin command exists in firmware version 1.02 and higher - I made this enhancement during the conference since people asked for it.

  Are you sure? yes | no

Morning.Star wrote 05/19/2018 at 06:00 point

Indeed, a string, or an array or chars - only needs indexing to be an array so its easy to implement.

Ahhh, logical_name$(i,n) how I miss you. Python is clunky... ;-)

Tentacles crossed it goes off royally, wish I could drop in on these things. :-)

  Are you sure? yes | no

Mike Szczys wrote 05/18/2018 at 18:34 point

REM and INPUT have now be implemented. What does DIM do?

I had just been using a lot of IF statements to get around the lack of ELSE. Maybe you can implement DIM and ELSE as your badge hack ;-)

  Are you sure? yes | no

Morning.Star wrote 05/18/2018 at 21:13 point

DIM declares an array.

dim a$(10) creates an array of 10 character strings

  Are you sure? yes | no

Mike Szczys wrote 05/18/2018 at 22:12 point

(Oops, meant to reply to @ðeshipu before)

DIM is actually what I was looking for a couple of days ago. Was trying to figure out how you do Game of Life in basic and only have access to 26 variables (single letters only).

At this point we've frozen features because we need to make sure we have a fully tested image when badges are programmed next week. Maybe a future firmware (or a hack at the con) will have this.

  Are you sure? yes | no

deʃhipu wrote 05/18/2018 at 22:14 point

I guess you could do game of life on strings.

  Are you sure? yes | no

deʃhipu wrote 05/14/2018 at 22:28 point

No DIM? What about ELSE? Or REM? No INPUT?

  Are you sure? yes | no