QBasic on Modern Computers
I want to try teaching QBasic to our 11 and 12-year-old students at Code Club.
Several of the older programmers I meet think that QBasic is “still the best way to start programming”.
I don’t know if it’s true – Python and Scratch are widely considered to be the best beginner languages today.
But I think it’s worth trying. I particularly like the idea of learning how to use GOTO and one-line statements before starting on blocks, loops, and functions (which students often find confusing.)
The first hurdle is getting Basic running on everyone’s computers. Here are the alternatives I looked at:
FreeBasic and FBIde
The old DOS program, available from various old websites. Won’t run on my Windows computer so that’s not an option.
This is a more modern remake of QBasic.
The Windows version is distributed in a 7Zip archive. This means you have to install and learn to use 7Zip before you can use QB64.
We can’t afford to spend code club time on that, but we could repackage it as a .zip file. Then it would be fine on Windows.
The new GL version is incomplete. The old SDL version is better - in particular, because it can go full-screen.
On OS X, you have to install Apple’s developer tools. (It uses the C++ compiler.)
Then you have to run setup.command to - I think - compile the project before you can use it. Then you run a different command to run it.
That’s too much setup time for a 1-hour class. Maybe we could package our own pre-compiled version, but that doesn’t sound fun.
I’m going to say QB64 is out for now.
DOSBox + QBasic 4.5
DOSBox is a cross-platform DOS emulator. It runs the old QB45 without any trouble, on every platform.
Configuring DOSBox to run something is too much work, but can we make a pre-configured package that automatically runs QB45?
Yes – it’s easy. I’ve made a .zip file that users can download. They must extract it then run a .bat file (on Windows) or .command file (on OS X) to start QBasic inside DOSBox.
This is by far the best option so far.
Two extra changes were needed:
- DOSBox locks the mouse pointer inside its window, which is super annoying. Fortunately, it can be pre-configured it to disable this feature.
- DOSBox puts a big notice in the command prompt, which reappears when you run your first QBasic program. It’s confusing. To work around this, I started all the example QBasic programs with a CLS command to clear the screen.
What about Chromebooks?
Some of our students use Chromebooks. You can’t install anything on a Chromebook, you need a web-based version. Let’s look around again…
The QB64 website says they provide a ‘Qloud’ cloud based QBasic compiler, but it’s currently down.
CompileOnline has a QBasic page, but it didn’t work with my example programs. Worse, the error messages were C errors, not QBasic errors, making it super confusing. Nope.
It has some problems:
- Console input is always converted to uppsercase. This breaks our examples.
- It doesn’t say “press any key to continue” when a program terminates
- Like CompileOnline, it gives long, unhelpful errors in a different language when there are any syntax errors in the code.
- It’s embedded into a blog post, so there’s lots of visual noise all around the QBasic terminal.
- It starts off with the code of Nibbles preloaded, which has to be deleted before you can start.
I wouldn’t use it with beginners in its current state. However, it’s open source and we could easily fix all the problems except the error messages. That would be Ok.
It looks like DOSBox is the best option again. It will give our Chromebook users the same experience as our Windows and Mac users.
I recommend using ‘qb45’ (Qbasic 4.5) running inside DOSBox.
I put pre-packaged versions for Windows and OS X on the Code Club Auckland website.
This is how to install QBasic, but we have not yet proved that you would want to install it!
- Do children want to use a low-res UI that doesn’t support familiar keyboard shortcuts?
- Is making a text-only game fun?
- Will teaching them GOTO ruin their brains forever?
Find out next week!