QuickBASIC Lives On With QB64

When I got my first computer, a second hand 386 running MS-DOS 6.22, I didn’t have an Internet connection. But I did have QuickBASIC installed and a stack of programming magazines the local library was throwing out, so I had plenty to keep myself busy. At the time, I thought QuickBASIC was more or less indistinguishable from magic. I could write simple code and compile it into an .exe, put it on a floppy, and give it to somebody else to run on their own machine. It seemed too good to be true, how could this technology possibly be improved upon?

Of course, that was many years ago, and things are very different now. The programming languages du jour are worlds more capable than the plodding BASIC variants of the 80’s and 90’s. But still, when I found a floppy full of programs I wrote decades ago, I couldn’t help but wonder about getting them running again. With something like DOSBox I reasoned I should be able to install the QuickBASIC IDE and run them like I was back on my trusty 386.

Unfortunately, that was not to be. Maybe I’m just not well versed enough in DOSBox, but I couldn’t get the IDE to actually run any of the source code I pulled off the floppy. This was disappointing, but then it occured to me that modern BASIC interpreters are probably being developed in some corner of the Internet, and perhaps I could find a way to run my nearly 30 year old code without having to rely on 30 year old software to do it.

The QB64 Project

After searching around a bit, I found the QB64 project. This is an open source QuickBASIC development environment that is not only completely compatible with existing programs, but adds in functions and capabilities that were unthinkable back on my 386. Displaying a PNG, loading TTF fonts, or playing an MP3 in the background can be accomplished with just one or two commands.

Such things were possible with the original QuickBASIC, but existed more in the realm of tech demos than anything else. Oh the games I could have made back in the day with software like this! I had to be content with bleeps and bloops, and even that required you to figure out the timing for the tones yourself.

Even better, QB64 is cross-platform and supports compiling into native binaries for Linux, Windows, and Mac OS. That meant that not only could I run my old code within the IDE, but I could actually compile it into a binary for my Linux desktop. I don’t own a Windows computer anymore, but with WINE I was able to run the Windows version of QB64 and compile an .exe that I could give to my friends who are still living in the dark ages.

You can even use QB64 to compile QuickBasic code into an Android application, though there’s considerable hoops to jump through and it currently only works on Windows.

Conjuring Black Magic

This might be lost on those who never wrote BASIC code on a vintage machine, but the following code creates a 800×600 screen, puts a full screen PNG up, plays an MP3, and writes a message using a TrueType font.

' Init screen
SCREEN _NEWIMAGE(800, 600, 32)

' Load files
menubg& = _LOADIMAGE("splash.png")
menufont& = _LOADFONT("font.ttf", 30)
theme& = _SNDOPEN("theme.mp3", "SYNC,VOL")

' Set theme volume, start playing
_SNDVOL theme&, 0.3
_SNDPLAY theme&

' Load font
_FONT menufont&

' Show full screen image
_PUTIMAGE (0, 0), menubg&

' Say hello
PRINT "Hello Hackaday!"

As a comparison, this QuickBasic tool for simply displaying a JPEG image clocks in at 653 lines of code.

Revisiting a Project

In my edgy teenage days, I created a graphical version of the “Drugwars” style game. You moved a little stick man around a pixelated environment, buying and selling substances that I had heard about in movies but certainly had never seen in person. It was terrible. But it was part of my youth and I thought it would be fun to see if I could shoehorn in some modern flash using QB64.

As it turns out, transparent PNGs and the ability to display proper fonts makes things a lot easier. Being able to play music and ambient sound effects in the background makes even sloppily done games seem a lot better. The following screenshots are of the main menu of my little teenage crime fantasy, before and after the application of QB64. Note that the core source code itself is more or less the same, I’m just interleaving it with the ability to load and display external files.

Should You Be Using QuickBasic?

No, you definitely should not. I didn’t write this to try and convince anyone to jump on a programming language that peaked before many of our readers were even born. QuickBASIC is an antiquated language, stuck with outdated methods and limitations that are confounding to the modern programmer. But QB64 does do an excellent job of modernizing this classic language, if only to a relatively small degree in the grand scheme of things, for those of us who cut our teeth on it.

Being able to take a disk with BASIC code I wrote on a DOS 386 in the early 90’s and turn it into a Linux binary in 2018 is a pretty neat accomplishment, and I salute the QB64 development team for making it possible. I won’t be writing any new code in the language, and I don’t suggest you do either, but it was a lot of fun being able to revisit this period in my life and drag it kicking and screaming into the modern era.

188 thoughts on “QuickBASIC Lives On With QB64

  1. I’m still working on Quick Basic 7.1

    I have designed a restaurant bar billing software in QB and is the only source of my earnings since 1995. It is still running at near about 1000 counters with all facilities like LAN base, on Win 10 32 bit plat form, compatibility with all types of printers

    here’s youtube link of my application demo –

    https://www.youtube.com/watch?v=MGFytCwFlng&t=129s

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.