Blast From the Past: GW-BASIC

A few weeks ago, I decided to clean up my bookshelves and finally toss a bunch of antiquated software development books.  Technologies like HTML 3.2, Visual Basic 6, and Visual J++ didn't survive this latest purge.  But there's one book that I just can't seem to toss, no matter how much relevance it's lost.  It's the GW-BASIC User's Guide and Technical Reference, which was included with my very first computer, a CompuAdd 8086.

GW-BASIC was a port of the BASIC (Beginner's All-Purpose Symbolic Instruction Code) language, and was one of the many BASIC products borne from the assembly line of early Microsoft.  It was packaged with earlier versions of MS-DOS, the operating system of choice for IBM-compatible PCs.

To give some insight into what intrigued me last, my copy of this book still has Post-Its on the keywords Get, Paint, and Window-- all three dealing exclusively with primitive GUI elements on the screen.  I never got anywhere with those, I'm sure of it.  But what I find funny is that the first half of the book, the user's guide, is completely devoid of marks of any kind; I doubt I ever actually read about how to actually use the development tool.  I learned by doing and didn't let myself get caught up on fundamentals like relational, logical, or functional, or string operators.  In fact, not until today did I even know that GW-BASIC even allowed low-level assembly calls!

GW-BASIC existing during a time in my life where I just didn't understand why things worked the way they did; I simply copied from a plethora of magazine articles and even a book or two (David Ahl's Basic Code Adventures and Creating Adventure Games on Your Computer by Tim Hartnell).  It was all trial and error, and it was great.

Line-numbering is obligatory.  Without line numbers, you're indicating to the IDE that you want your expression to be evaluated immediately.  Common practice was to number lines in increments of 10, with the idea that if you needed to insert another line between 10 and 20, you could choose line 12 or maybe 15 to squeeze in that additional piece of code.  A simple RENUM command will renumber the lines, including lines referenced by GOTOs.

Type-checking is kept to a minimum and is quite forgiving.  Variable types, although not required, were denoted by the following postfixes:
$ String
% Integer
! Single-precision
# Double-precision

GW-BASIC had limited support for subroutines.  Subroutines (via the GOSUB statement) were perceived as GOTOs that included a RETURN statement to bring the code execution back to where the calling GOSUB left off.

GW-BASIC's successor, QBASIC, introduced more elegant sub and function calls as well as the concept of line labels, eliminating the need to identify each line with an incremented number.  Plus it allowed mouse input, something that's easily taken for granted today.  QBASIC would set the stage for Visual Basic, which finally brought BASIC into the new graphics-rich Windows operating system.

Additional links:

Leave a Reply

Your email address will not be published. Required fields are marked *