void techBlog() { //... }


My attemps to arrange 0 and 1 and make something vaguely useful


Install QBasic on a Raspberry Pi

A few days ago I stumble upon this blog entry.

Like the author I spent several months trying to find out the right environment to teach kids basic knowledge of programming.

In my opinion, all these options are nice but either the language is already too advanced (Python) or it is a visual programming IDE (Scratch), and I’m not fond of visual programming…​ I was looking for the direct and simple experience of coding. No clutter, no mouse, no a-thousand-icons-all-over-the-screen. I wanted the explanation to simply be about programming concepts.

So I ended up thinking that, indeed, QBasic and its environment had the right balance (and still I didn’t learn with QBasic, it was ZX81 Basic for me…​).

So, how do you install QBasic on a Pi ?

At first I thought it was a good idea to use QB64. I recompiled it to test it on the Pi, and it turns out that the result was way too slow…​barely usable…​ (maybe I did not use the right compilation flags ? I don’t know…​). If you want to try this out, you must add the directive #define QB64_NOT_X86 at the beginning of source file source/internal/c/os.sh, else it won’t compile for the Pi.

So, instead, I decided to go with something more lightweight : the orginal QBasic with DOSBox.

Install DOSBox and QBasic

First, if it is not already installed, install DOSBox

sudo apt-get install dosbox

Then download QBasic from the Microsoft FTP server. The server does not support active FTP, and not all browsers can do passive FTP. So it easier to use wget. Plus we are going to create a directory and use DOSBox to extract the archive in this directory.

mkdir -p ~/opt/olddos
cd !$
wget --no-passive-ftp ftp://ftp.microsoft.com/softlib/mslfiles/olddos.exe
dosbox olddos.exe

Now you can create an alias qbasic to launch QBasic (add this line to your ~/.bash_aliases file if you want to keep it after reboot)

alias qbasic='dosbox  ~/opt/olddos/QBASIC.EXE -fullscreen'

You should now be able to launch QBasic with this alias

Adjust fullscreen mode

You may have to adjust your DOSBox settings if you want to use a real fullscreen mode. First, you need the resolution of your screen, for instance mine is 1280x1024. You can find your resolution with the command xdpyinfo | grep 'dimensions:'

Then, modify the DOSBox configuration file at ~/.dosbox :

  • In section sdl

    • change the value of fullresolution to your resolution

    • change the value of output to overlay

  • In section render

    • change the value of aspect to true

The qbasic alias will activate the fullscreen mode, but you can leave it with ALT+Enter

Problem with CTRL+Break

If you want to quit a program that doesn’t stop, it turns out that CTRL+Break doesn’t work for QBasic in DOSBox. CTRL+ScrollLock is a known workaround for this problem, but for some reason it doesn’t always work for me. Worst case you can still use CTRL+F9 to quit DOSBox.

comments powered by Disqus