09
Apr
19

Modern BASIC: PCBasic and QB64

Last month I had intended to make the next Sparcstation desktop post, but unfortunately have been having trouble getting the software I had intended to cover to build. So that’s still in the works and today we’re going to look at something else interesting: modern implementations of old BASIC Languages. It seems I’m not the only one that feels nostalgia for the old BASIC interpreters that were common to almost every machine. The two I’m looking at today are particularly nostalgic for me as I learned to program on the original interpreters.

The first, PC-BASIC is made by Rob Hagemans and is an extremely well polished GWBasic emulator. It seems to be 100% compatible as I’ve been able to run all of my old basic programs including ones that use graphics and sound. Here are some images of programs running.

This slideshow requires JavaScript.

The graphics and sound are indeed very accurate compared to MS-DOS hardware and the original interpreter. There is good support for all the graphics modes including those from special machines such as the Tandy/PCjr and Olivetti machines that had special versions of the interpreter. The PC speaker is emulated quite well (better than under Dosbox) and support for Tandy 3-voice sound is included. I’m not sure if it was deliberate, but it seems that the processing speed on my laptop is similar to what I used to experience on our old 386sx back in the day.

The next program, QB64, is a new language designed to mimic QBasic and QuickBasic with extensions that provide access to modern graphics and sound libraries. It can build native executables for Linux, Windows and Mac OS, so it’s pretty impressive and capable of producing programs for modern systems. Here are some programs running.

This slideshow requires JavaScript.

I tried to compile some of my old programs, from both GWBasic and Qbasic, and found some worked without modification whilst others didn’t work or required modification. I had some issues with the programs that did build, the first and most obvious is that the programs started in what is initially a very small window. Resizing the window doesn’t stretch the display, but pressing alt+enter does give a nice full screen display. The second issue is more complex and arises from the fact the programs are compiled and not interpreted. Basically they run way too fast because they are running at native speeds on modern hardware. This issue however should be fixable by modifying your programs with better timing code. Thirdly I’ve found one or two features from the old languages aren’t implemented, meaning some old programs won’t work, the Gorilla game that came with Qbasic being one.

An IDE is provided which looks almost identical to QBasic, so it’s very familiar and relatively easy to use. Auto indentation seems to fix old programs as they are loaded and parsed, and there is some very nice syntax highlighting, making even old programs much more readable. Although one negative point is the built-in help only covers items specific to QB64 and has omitted a language reference for the base QBasic language.

Given that we can run the original interpreters in Dosbox, how do these modern interpretations compare?

PC-BASIC is quite good in the compatibility department, working with basically everything I threw at it. The only real disadvantage it has is speed compared to running GWBasic in Dosbox, and the ability to change the emulation speed. On the other hand it has some features that appeared in real hardware, but aren’t emulated in Dosbox. (such as screen borders on CRTs) It also gives access to features found on special versions of GWBasic, such as the special Tandy graphics and sound that would be otherwise inaccessible on the standard interpreter. You can get this interpreter from his github website, I recommend using the development version as it is more compatible and has fewer bugs.

QB64 doesn’t fair so well with every older program, those that work do so quite well however. Many programs will work with a little modification, whilst others will require major re-working. I suspect the main benefit of QB64 is less about running old programs and more about building new programs. It features some extensions to the QBasic/QuickBasic language that allow more modern features of the operating system to be used such as 3d graphic acceleration and digital sound. You can get QB64 from their website, I used the stable version and found it worked quite well.


3 Responses to “Modern BASIC: PCBasic and QB64”


  1. 1 evertonmarques
    April 11, 2019 at 8:30 am

    Very cool post. I often use the PC-BASIC emulator to test features I’m adding to my toy BASIC compiler (https://github.com/udhos/basgo). It is able to translate many non-graphics programs, but I am currently working on adding support for some graphics primitives as well. Hope it will provide another fun way to run old BASIC code. 🙂

    • April 11, 2019 at 1:06 pm

      Thanks for reading, I like these sorts of projects because they make the experience of older technology such as BASIC more accessible. In the case of GWBasic in particular it is sorely needed as there is little material on the internet in any form.

      I took a look at your compiler as well when I played around with these, but I had issues getting golang to work correctly. I was running it on my laptop using Debian 9, and the packaged golang didn’t like it, so I installed the current golang using your instructions and it was still unhappy. I’m not sure what exactly was wrong as I didn’t have much time when I was fiddling with it. I’ll have another look to get you some error messages when I get some time.

      – Sparcie


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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


Blogs I Follow

Enter your email address to follow this blog and receive notifications of new posts by email.


Mister G Kids

A daily comic about real stuff little kids say in school. By Matt Gajdoš

Random Battles: my life long level grind

completing every RPG, ever.

Gough's Tech Zone

Reversing the mindless enslavement of humans by technology.

Retrocosm's Vintage Computing, Tech & Scale RC Blog

Random mutterings on retro computing, old technology, some new, plus radio controlled scale modelling.

ancientelectronics

retro computing and gaming plus a little more

Retrocomputing with 90's SPARC

21st-Century computing, the hard way

lazygamereviews

MS-DOS game reviews, retro ramblings and more...

%d bloggers like this: