Currently I’m adding a lot of functionality to the console version of SmallBASIC to build nice TUIs in a terminal. New features are:
AT and LOCATE to set cursor position
XMAX and YMAX to get size of the terminal window
XPOS and YPOS to get position of the text mode cursor
INKEY support for non-blocking input
PEN support for mouse interaction
COLOR support to set foreground and background color
CLS suport to clear the screen
LINE and RECT support
So far it works quite fine in Linux (Manjaro: Konsole and gnome-terminal). In windows non-blocking keyboard input is still quite buggy. If you want to test it in Linux, clone my SmallBASIC repository: GitHub - Joe7M/SmallBASIC at console_io · GitHub. Switch to the branch console_io and build the console version. You can find examples in samples/distro-examples/examples/console_*.bas. I would be happy about feedback especially testing with other distros.
I’ve been testing the new console_io enhanced version on an ARM64 (aarch64) Chromebook using the Linux (Crostini) environment.
I’ve noticed a background color rendering issue when using the default ChromeOS terminal. Interestingly, a quick test using gnome-terminal within the same environment seemed to work perfectly. The Chromebook terminal colors are adjustable so with a color tweak to standard ANSI colors this color difference would go away.
Testing Environment:
Hardware: ARM64 Chromebook
OS: Linux VM (Crostini / Debian Bookworm)
ChromeOS Terminal uses hterm as the terminal emulator and runs within the Crostini environment using Sommelier.
ChatGTP says modern terminal emulators (especially hterm) don’t strictly follow classic ANSI color expectations.
Here is the code I used for this color test.
FOR i = 0 TO 15
COLOR i
PRINT “Color " + i + " on background 0”
NEXT i
Chromebooks have color schemes, this one is called Light
Thank you BarrySWTP. Chris and me had also some issues with color representation in different terminals. I made a change, that as long as no COLOR command is used, the default foreground and background color of the terminal will be used. Chris suggested to use a RGB color table for the first 16 colors. In this way the SmallBASIC colors 0 to 15 are independent of the terminal color-profile.
Currently when using COLOR foreground and background color are set, even when only one parameter is given. This will change the default terminal background color which most probably leads to the bug you described.
@BarrySWTP: I fixed the bug you described. Additionally the first 16 colors are now the SmallBASIC standard colors and they shouldn’t be depending on the terminal color settings anymore.