QBASIC

In this post, I’m going to discuss QBASIC, an old BASIC for DOS computers and how to get it running on modern 64-bit versions of Windows.

I know you’re going to think I’m going seriously off-topic. In fact, I can almost hear the QL Forum admins groaning and almost trembling with fear as to where I’m going with this. But there is a serious reason for this.

QBASIC as a language is not that far removed from SuperBASIC – it has a lot of structures such as multi-line IF/END IF, CASE (a bit like SELect on QL), and multi-line function and procedure definitions. And being old, there are a lot of QBASIC programs lurking around on the internet, some of which could with little effort be ported to SuperBASIC, to allow us to tap into a large library of software. I realised this recently when I ported the “Dunric’s 8K Adventure” game from QBASIC to QL SuperBASIC. And I realised there’s so much software out there which could become QL software.

Screen dump from "Dunric's 8K Adventure"

QBASIC programs are generally easier to port than more modern more complex versions of BASIC such as Visual Basic. QBASIC can even save its programs as ASCII text files as an alternative to tokenised QBASIC programs. The ASCII versions are of course easier to move to the QL for editing, or (as I do) load into a Windows text editor to do some tidying up and initial conversion for QL SuperBASIC before transferring to QPC2. If you come across a tokenised QBASIC program which looks full of garbage when you try to view it by loading into an editor, for example, you can simply load it into QBASIC and save it as an untokenised ASCII listing.

I dabbled a little with QBASIC on a PC back in the days of Windows 95, but didn’t do very much with it. I’d also given up on any hope of taking it up again when I’d realised it wouldn’t run on modern 64-bit versions of Windows. Recently, when I was considering porting that adventure game from QBASIC to QL SuperBASIC, I decided it might be a good idea to try to get QBASIC up and running on my PC just so that I could check that my QL port of the game worked as similarly as possible to the PC version. I’ll tell you now it was a bit of a weird sensation having QBASIC and SBASIC (QPC2) running side by side on the same computer running different versions of the same program.

The first issue I was always going to run into was the fact that QBASIC no longer works on modern PCs. More specifically, it doesn’t run on modern 64-bit versions of Windows.

Enter our very own XorA, one of the QL Forum admins. While exchanging emails on another subject, he casually mentioned dosBOX as a way of running older software like QBASIC. DOSBox is a DOS-emulator, allowing older applications to be run on more modern systems, including older display systems used by DOS, Soundblaster-style sound systems and so on. Above all, it’s totally free of charge. It’s SDL-library based, so there are versions for Linux and Mac too. To learn more about it, simply point your browser at https://www.dosbox.com

So I read up a bit about it and thought I’d give it a try, thinking that my only loss would be the time involved in getting acquainted with it. If I couldn’t get it to work, then at least I’d tried.

Since QBASIC was my primary reason for looking at DOSBox, the next step was to look into where I could get hold of a copy of QBASIC. This turned out to be easy – https://www.qbasic.net/ (site available in English and German).

Screen dump from the QBASIC.NET website.

And this turned out to be far more helpful than I thought, as this site hosts a few different versions of QBASIC – version 1.1 interpreter, as well as QuickBASIC 4.5, QBX 7.1 and Visual Basic for DOS compilers. The site even has versions which are preconfigured for use with the DOSBox emulation system.

BASIC 2 DOSBox

Screen dump from the BASIC 2 DOSBox software.

They even provide a simple to use software called “BASIC 2 DOSbox”. This handy tool copies the selected versions of BASIC (QBasic 1.1, QuickBASIC 4.5, QuickBASIC Extended 7.1 and/or Visual Basic for DOS) with just a few clicks to your hard drive and creates configuration files and shortcuts. They say that BASIC 2 DOSBox should run on all modern Windows OS’s (both x86 and x64 64-bit), such as: Windows XP, Vista, 7, 8, 8.1 and Windows 10. You simply select the components you wish to install and it installs everything semi-automatically, with minimal user intervention from you. The site has some excellent tutorials. It all ended up installed and working at first attempt, which for me with software like this is a bit of a record. All I had to do was change from the supplied US keyboard layout to UK layout (so that the “@”, “quote” and “£” keys worked correctly on my keyboard).

You end up with a folder called oldDOS on your PC hard drive which contains sub-folders for the various versions of QBASIC, configuration files, a folder called _source (for QBASIC programs) and a small folder containing shortcuts to start in DOSBox whatever versions of QBASIC you’ve opted to install.

So far, I’ve only used QBASIC 1.1. It has an editor for writing programs, syntax checking, and a pretty good help system to describe the keywords and use of QBASIC and its development environment. Once you start QBASIC, it seems like you’re locked into the program – you can’t just move the pointer out of the QBASIC/DOSBox window. But you can ALT TAB normally from the DOS-like environment to another window. Or do something like press the Windows key on your keyboard.

Screen dump showing editing a program in QBASIC.

The qbasic.net site contains a multitude of articles and help files to help you get going. Including getting started with QBASIC, and keyword guides.

Converting To QL SuperBASIC

On the BASIC section of my website, there is a document intended to help with converting programs and keywords from other computer systems to QL SuperBASIC, as well as a few routines to provide equivalents for keywords in other languages which don’t exist in QL SuperBASIC, such as LEFT$, MID$ and RIGHT$ for string slicing. Well worth having to hand when working on the listings. Get the Convert package from https://dilwyn.qlforum.co.uk/basic/index.html

So, in summary I’m sure I’ll be spending time looking for QBASIC programs I can convert to QL SuperBASIC programs now.

Leave a comment