Enhanced uBasic

45 views
Skip to first unread message

The Beez

unread,
Oct 27, 2015, 10:32:33 AM10/27/15
to 4tH-compiler
Hi 4tH-ers!

Yes, I do that every now and then. Just because I know people are actually using it - and every now and then I come up with useful enhancements. I had reserved quite a few delimiters because before the day of functions we only had operators.

I've always been able to emulate binary operators by clever use of * (AND), + (OR), - (XOR) and % (BIT) but in some cases it became almost too awkward for comfort. But then I realized I could easily do so by using functions. So, here we welcome the addition of AND(), OR(), XOR(), NOT() and SHL() function. With the exception of NOT() they all take two operands. SHL() works like SHIFT - a positive second parameter shifts left, a negative one right.

Furthermore, I added an ORD() function, which allows a one character string and returns the ASCII value. Its counterpart CHR() is ONLY available in a PRINT statement, like TAB() or USING(). Note this allows you to do things like:

LET a = ORD("A")
LET b = a+32

PRINT "Lowercase ";CHR(a);": ";CHR(b)

Finally, I've cleaned up the error messages a bit, making error reports a bit clearer. I've also added a memory leak check. That one was also available for PP4tH and works just fine. I decided to add it to uBasic as well, placing it in the realm of continuous bug chasing ;-)

Code in SVN.

Hans Bezemer
Reply all
Reply to author
Forward
0 new messages