My First "Hello, World!"

June 7, 2018  |  Less than 1 minute to read


The other day, I ran across Windows 95 In Your Browser, which uses Emscripten and DOSBox to run a full-fledged operating system in a browser. What a time to be alive.

This got me thinking… if Windows 95 could run on this Frankenstein-ed stack, what other nostalgic tech could I resurrect from my childhood?

My mind immediately jumped to something that consumed hours and hours of my childhood. It wasn’t a game, it wasn’t a chat app, it was QBasic.

The QBasic start screen
If you grew up on QBasic, this screenshot will induce an immediate wave of nostalgia.

QBasic was a fantastic first language. Getting started was a breeze - a first-time QBasic user could fire up the all-in-one IDE/runtime environment, write something like this:

PRINT "Hello, world!"

… hit Shift+F5, and immediately see the greeting written to the screen!

The QBasic runtime showing a 'Hello, world!' program being executed.

It also came with a great integrated help system that included lots of code snippets that I endless copy-and-pasted:

The QBasic help screen.

Recreating a QBasic environment in the browser was easier than expected, thanks to a project called js-dos. After about an hour of work, I had a working QBasic editor running in all its glowing blue glory!

After digging around on my backup drives, I found my old QBasic .BAS files and took a trip down memory lane as I ran each of my ancient programs one-by-one. Most of them required a bit of tweaking before they would behave correctly - my 13-year-old self had a bad habit of saving files to directories without checking if they existed first, and he really liked controlling program timing with empty loops:

FOR i = 0 TO 100000
NEXT i

… which unfortunately is entirely dependent on the speed of the host’s CPU. I had to cut most of these loops by a factor of 100 since the browser runs the programs so much slower than the original hardware.

So, without further ado, here are the most interesting programs, delivered to you through time using the magic JavaScript. Click on any of the screenshots below to launch the program in a new tab:

SPIRO.BAS

A precursor to my more modern project Inspirograph, this program creates Spirograph designs based on a few simple configurations.

Hint: Here’s an example configuration to get you started:

  • Inner wheel size: 52
  • Outer wheel size: 100
  • Hole number: 25
  • Color: 12

ADVNTUR1.BAS

An adventure game with ASCII graphics. You control a small blue square with the numpad (4, 6, 8, and 2), journeying around the landscape visiting small towns (green squares) and battling rouge enemies (red squares).

I gave it a few tries, and man, it is hard.

ALNATTCK.BAS

A super short animation of a little man being sucked up by alien invaders.

CELOHLP2.BAS

A flash-card game for cello students that quizzes their knowledge of bass clef, tenor clef, and treble clef, complete with a high-scores list.

COOL.BAS

Another drawing program that creates intricate designs with customizable color palettes. I used to draw these shapes with color pencils as a child which inspired this QBasic version.

GIGA.BAS

QBasic had a fun pitch generation API which I used to recreate piano and cello pieces I was learning at the time. Here’s Bach’s Giga from the Partita in B Flat:

GORILLA.BAS

Okay, you got me - this one isn’t mine. It’s one of the example programs that shipped with QBasic. My siblings and I had loads of fun lobbing explosive bananas at each other.

NEWTETRS.BAS

A Tetris clone.

PATIENCE.BAS

Test your patience! How long can you hold down Q?

STRESS.BAS

Feeling stressed? This little game lets you punch a square with your enemy’s name on it until they spontaneously combust!

And many, many more…

There’s lots more where the above came from. Here’s a little GUI that can launch and run any of the programs I wrote as a child:

Source

If you’re interested in how this little project works, check it out on GitHub here.


Other posts you may enjoy:

Live Reloading An Angular 2+ App Behind NGINX

May 14, 2018  |  5 minutes to read

Fantastic Fast Fonts with system-ui

April 27, 2018  |  1 minute to read

Smart Date Searching with Solr

June 26, 2017  |  6 minutes to read

Inspirograph

January 26, 2015  |  6 minutes to read

Auto-Ejecting Event Handlers

March 6, 2013  |  1 minute to read