Pi Shack BASIC - Now Available!

Written by ChipMaster on 2024-08-02 16:19:00 updated 2024-08-02 16:19:00

Pi Shack BASIC

NOTE: screen colors are my choice. The default is your terminal's.

Pi Shack BASIC has ARRIVED!!

Check out the tips blog!

Version 1.0 has just been released. It is the easiest and most interactive way to learn and experiment with hardware on and attached to SBCs. Type a command and watch your hardware do something. Type another to read its state. Manually fire off subroutines while developing and testing hardware. It also has many UNIX related features like reading from some other program or writing to one. It can open SPI, I2C and UART devices, optionally passing additional hardware parameters, like clock rates. It even includes features for handling text data files (CSV, TSV, ...) as is commonly exported from various software packages and found in the the /proc, /sys and /etc directories. I routinely use it for data-mining Apache logs. And it comes with a full on-line reference manual!

Pi Shack BASIC (psBASIC) is a classic dialect of the language reminiscent of the interpreters that came built in to the earliest PCs from the '70s and '80s. It also has some newer ANSI standard features like:

  • It doesn't require line numbers.
  • Pre, post and infinite loops with the DO [WHILE|UNTIL] ... LOOP [WHILE|UNTIL] syntax.
  • Multi-line IF ... THEN ... ELSE statements.
  • Matrix (array) operations, not just for math.
  • SELECT CASE decision trees.
  • FUNCTION and SUB style subroutine blocks, with LOCAL variables.

The dialect has been enhanced with many features to make it interact well with a Linux environment:

  • Opening uni-directional pipes to other programs.
  • "~" expansion in file names to make it easy to write home.
  • A "Binary" file mode to provide pretty much unrestricted access to globs of data wherever in a data stream, while allowing both reading and writing.
  • The "Binary" file mode also supports passing hardware parameters for UARTs (ttys), I2C and SPI ports.
  • Querying as well as setting the current working directory.
  • Access to command line arguments.
  • Access to environment variables as well as the ability to set / export them.
  • Classic I/O port style operations for accessing GPIO pins (INP/OUT).
  • The ability to return exit codes to calling programs.
  • Operates cleanly in a filter role.
  • You can call external programs and capture their exit codes.
  • Access to stderr.
  • Ability to open a print spooler (lpr), formatter (enscript) program or a device for printed output.

psBASIC comes in two editions: The *FREE* and "professional" editions. The free edition is fully functional, with some limits and is free for anyone to use. The free limits are:

  • Limited to 3 open files at a time (simultogetherously open).
  • Limited to 3 GPIO pins at a time (for a program run).
  • Limited to 300 line programs.
  • Limited to 250K program and data RAM.
  • The DELIMIT command is unavailable.

For only $50 you can buy the professional version and use all available system resources. Plus the professional version comes with a utility program to perform complex renumbering tasks (if needed) and the full reference in a single printable HTML file.

The free edition is getting released first. The professional version will follow shortly. We're adding the licensing software to our web store. If you're impatient for a professional release feel free to email ChipMaster.

Getting Started

Download the installation package most appropriate for your specific architecture and OS. Start a terminal. Install it. (See the notes under the installation package section you downloaded from.) Agree to the license. Launch psb. And enter help "intro" at the psBASIC> prompt.

NOTE: In psBASIC line numbers are optional so unlike BASIC versions in the early PCs, line number based editors do not work. Instead of providing an editor, psBASIC, in UNIX fashion, uses which ever editor you prefer. Simply put your editor command in the $EDITOR environment variable and psBASIC will launch it with the appropriate file name when you use the EDIT command. If your environment variable is not set when you start psBASIC you can use the psBASIC ENVIRON command to set it, like: ENVIRON "EDITOR=...". Replace the "..." with the name of your editor. When running under X it can even be a GUI editor (Geany, leafpad, mousepad, kate, ...). Upon termination of your editor psBASIC will load the code that the editor saved. Remember to use the psBASIC SAVE command to save the program permanently to disk.

GUI editing

*FREE* Downloads

Which software download should I use?

If you have a Linux distro based on Debian (Devuan, Ubuntu, Raspbian, Armbian, ...) as most SBC distributions are, then you should download the "Debian" package for your CPU architecture, since it works with the built-in software management. Us Linux users, using either Debian or RPM based distros, are the only OS users with real software management. I encourage you to take advantage of it.

Debian packages (.deb files: Debian, Devuan, Ubuntu, Raspbian, ...)

To install: Download the file and run sudo dpkg -i {file}. Replace {file} with the path name of the file you downloaded. Accept the license to complete the install. After it's installed launch it by typing psb [ENTER] in a terminal and type help [ENTER] to start learning what it can do. See the note about editors in "Getting Started" section above.

If you have troubles installing or using psBASIC please use our support form.

WARNING: GUI package installers will not likely work. Use a terminal and the instructions above.

Binary Installers (all other Linuxes)

To install: Download the file. Give it the execute permission (chmod +x {file}). Then execute it from a terminal as root (using sudo, su, ...). Replace {file} with the path name of the file you downloaded. Accept the license to complete the install. psBASIC does not require any dependencies. After it's installed launch it by typing psb [ENTER] in a terminal and type help [ENTER] to start learning what it can do. See the note about editors in "Getting Started" section above.

NOTE: After the installer has been run it will drop a list of all installed files in a file named psbasic-install.log in the current directory. You can use this list to remove it if you wish to uninstall it. Or its informative if you want to see what is in the package.

If you have troubles installing or using psBASIC please use our support form.

Check out the tips blog!