New uBasic/4tH function

8 views
Skip to first unread message

The Beez

unread,
Jan 24, 2026, 10:12:17 AM (12 days ago) Jan 24
to 4tH-compiler
Hi 4tH-ers!

You know - the best ideas are always the simplest. And although I've proven uBasic can write binary files, it still couldn't read it. I played with ideas like reading a buffer (like READ()) and then use a separate function to read from that buffer - but it was an ugly patch at best.

Until I thought of reading a single byte - and return that value. And yes, that was a solution. Better - I already implemented and tested it. The function is called BYTE() - and you can use it like this:

Do Until Set(b, Byte(a)) < 0           ' read a byte

Yes, you can use it with OPEN() opened files, no problem. The definition was simple enough as well:

: (byte)                               ( h -- c)
  cin >r get_exp use (bin) 1 2dup accept = if c@ else drop (error) then r> use
;

Here are the updated language files for KDE and GTK - and code in SVN, as usual.

Hans Bezemer
ubasic.lang
ubasic4th.xml
Reply all
Reply to author
Forward
0 new messages