Bounce in QB64

Published in programming on May 12th 2017

Continuing on from my introduction to the QB64 programming language I decided to try it out with the very first BASIC program I remember typing into a computer, Bounce.

Bounce in QB64

Bounce can be found published on page 25 of a big yellow faced book titled Basic Computer Games for Microcomputers. Prior to that this program was printed in a publication by the Digital Equipment Corporation titled 101 BASIC Computer Games. Both versions of the code are attributed to originally being written by Val Skalabrin while he was at DEC; with only minor differences between publications.

Initially I installed QB64 onto my Linux laptop running Debian. The process of installing took a couple of minutes after which I was able to load to iconic blue screen and familiar interface of the Quick Basic IDE.

The source code for Bounce is available on the internet in various repositories on GitHub and internet archives and as simple as it would have been to copy and paste from one of those sources. I wanted to copy out the source by hand from the version found in Basic Computer Games for Microcomputers. This process took a while even though it is just 53 lines because the printed characters (often faded) made it difficult to determine if you where reading a "l" or a "1", or a "o" or a "0".

Bounce in QB64 Source

While typing out the source into QB64 I noticed that – on Linux at least – there is an issue of no de-bounce1 on keyboard input. This was most noticeable when using the arrow keys to scroll around with the cursor continuing to move long after the arrow key had been depressed. This is most likely a bug with the linux version because it does not occur when I tested on Windows 10.

Once I had typed out the source it was a simple case of hitting F5 to compile and run before seeing the very first program I remember typing into a computer at least two decades ago running natively on a modern laptop.

Bounce in QB64 Result

After playing with the compiled result I found some "bugs":

  • When entering a time increment of .5, over 30 seconds with a coefficient of .1 results in a broken graph
  • When entering a time increment of 1, over 30 seconds with a coefficient of .1 the program returns an error on line 23 of subscript out of range
  • When running the program by double clicking the .exe in windows, maximising the window doesn't work and you can't see the whole graph, nor scroll up within the window

Bounce in QB64 Bugs

One of these bugs, specifically not being able to see the whole graph is fixed in QB64 thanks to its Console Window support. Prefixing the following to the source code tells QB64 that the console is the destination:

$SCREENHIDE
$CONSOLE
_DEST _CONSOLE

In the future I plan on digging out my original version of Quick Basic and running this in that within DOSBox or perhaps on my original Toshiba T3100e. For the time being bugs aside this was a fun exercise and a nice trip down memory lane.

QB64 has support for Windows, Linux and OSX. If you would like to give QB64 a go, head over to the official unofficial website here and download the latest build. While there are many copies already available I have made my version available on github here, that repository will also be home to various other BASIC projects I work on in the future.


  1. No pun intended, but re-reading this line did make me smile ↩︎