2025-07-14 - OCC FreeBASIC, QBASIC.EXE, and WM Tweaks ===================================================== I can't believe i forgot to install curl! Fixed. * * * Alpine Linux does not include a GUI mixer applet with XFCE. I fussed around with various options and finally settled on launching alsamixer like so: * Right click panel * Click Panel> * Click Panel Preferences... * Click Items * Click +Add * Click Launcher * Click +Add * Click Close * Move Launcher below Power Manager Plugin * Click Wrench icon * Click + * Scroll to bottom * Select st * Click +Add * Click Close * In Launcher window, click Wrench icon * Replace values * Name: Mixer * Comment: alsamixer * Command: alsamixer * Click Icon * Select audio-volume-high * Click OK * Check box at Run in terminal * Click Save Now i have a speaker icon in my tray that i can click to open alsamixer. While i was at it, i set up XFCE key bindings to adjust the audio volume. I would have used multimedia buttons, but my keyboard doesn't have any. * Click Applications * Click Settings * Click Keyboard * Click Application Shortcuts * Click +Add * Command: amixer set Master toggle * Click OK * Press: Win 0 * Click +Add * Command: amixer set Master 5%- * Click OK * Press: Win - * Click +Add * Command: amixer set Master 5%+ * Click OK * Press: Win = That creates the following key bindings: * Win 0 Mute or unmute * Win - Volume down * Win = Volume up * * * audacious with the winamp / refugee theme looks exactly like xmms. Yet another refugee from blackbox and xmms. :) * * * I noticed that gnumeric on this old hardware is considerably snappier than libreoffice on my new hardware. I might want to consider switching to gnumeric on my main machine. * * * I decided to go on a nostalgia trip and type in some BASIC listings. I installed QBASIC.EXE and FreeBASIC in DOSBox-staging. I selected the following book to type listings from. Programming Tricks And Skills This book discusses various programming tips and tricks relevant to 8-bit computers when they all shipped with BASIC built-in. The book concludes with a BASIC listing for a simple CRUD application that will run on all the major 8-bit computers, including models with only 32KB RAM. It can save the database to file, floppy, or tape. Quite an accomplishment back in the day. CRUD Specific lines in the main listing are marked by platform. After the listing, each platform has a section of replacement lines. I selected the TRS-80 variant and ported the code to QBASIC.EXE, then FreeBASIC. Pages 33 and 34 discusses micro-optimizations in program layout that were relevant to the limitations of 8-bit computers. This helps explain the horrendous formatting of some old BASIC code. See the following excerpt for wisdom from a more innocent era. More about memory ================= Most home computers have between about 32K and 48K of RAM and this is [massive] for even quite long programs. Some of the RAM, though, is always used by the computer for housekeeping tasks, that is, for storing information it needs while it carries out the program. This can take up to 3K and reduces the space available for the program itself. Also, in high resolution graphics modes, most computers need much more RAM space for storing graphics information. In the highest resolution mode this can be up to 20K, which might only leave you about 10K for the program. The largest memory an eight-bit computer ... can have, is 64K ROM and RAM combined. This is because each location in the memory has to have a number as its address. Each address is represented by two bytes of computer code and the highest number that can be made with two bytes (16 bits) is 65536. This allows 65536 locations numbered 0 through 65536, which is 64K (65536 / 1024). It is possible, though, to use more memory on an eight-bit computer by switching in different blocks of memory at different times. You can buy memory expansion units to do this. Reference materials =================== More TRS-80 BASIC Personal Computer BASIC Reference Manual (TRS-80) FreeBASIC QBASIC.EXE (See help section) I discovered a corner case with QBASIC.EXE line number support. For example, the original code has: 1280 DIM C$(MX*CL) I translated this to: 1280 DIM C(MX*CL) AS STRING QBASIC.EXE throws the following error: > AS clause required on first declaration > > A variable that has not been delcared using an AS clause is > referred to with an AS clause. The same error happens if i use the REDIM statement. This took a little detective work to decipher. If i change the line to: 1280 CLS:PRINT UBOUND(C$):END Then it prints that a 10 item array already exists. But i never declared or used it before line 1280. My theory is that this is an internal compiler artifact. I think QBASIC.EXE implicitly declares C$ as a 10 item array here: 10 GOSUB 1260: REM INITIALIZATION I worked around it by copying lines 1270, 80, and 90 to lines 7, 8, and 9. Then i commented out the original lines. In other words, make sure DIM statements come *before* any GOSUB. After adapting the code to run in QBASIC.EXE, i didn't need to change much for FreeBASIC. I commented out line 6 CLEAR and added a third parameter ",0" to my LOCATE statements to hide the cursor. Then i can compile with `fbc -lang qb FLIP.BAS` FLIP.BAS tags: occ2025,retrocomputing Tags ==== occ2025 retrocomputing