BASICally Speaking

Suzanne Rich
From a casual exploration of the new-upload libraries of online services, and seeing recent freeware and shareware offerings, there is no question that plenty of programmers are still hacking away in their dens and basements. Furthermore, the creators of these utilities are more imaginative than those nearly two decades ago when Sky & Telescope's Astronomical Computing department was first founded (later called Computers in Astronomy before it was retired in 2004). Much of the present work hinges on the user interface, so today's astronomy programs have a Windows or Macintosh look and feel, or produce an impressive multimedia experience. In the early 1980s, text output was the main expectation; drawing a picture was remarkable.

Throughout this evolution, the Astronomical Computing department featured relatively short programs that introduce readers to some of the mathematics behind astronomical phenomena. Virtually all of the programs were written in the three-decade-old computer language called BASIC, which stands for Beginner's All-purpose Symbolic Instruction Code. Using BASIC was an obvious choice since all personal computers had the capability to run such programs. Because BASIC was omnipresent and easy to learn, many people toyed with it — sometimes for the lack of anything better to do with the machines. My family's first computer, purchased in 1979, was the Apple II+. It had a complete BASIC interpreter burned into its read-only memory chips.

Since the commercial software of the early 1980s wasn't particularly enthralling (especially the games), my brother and I took to creating our own. He worked on making his own text-adventure game and understanding how to draw on the screen. I goofed around with programs offered in computer magazines and wrote a few of my own.

In the summer of 1980 I took a course in BASIC at a community college. (As a high school student, I was the youngest person in the class.) We even used punched cards. Alas, afterward I wrote very few programs primarily because I couldn't think of anything I wanted to do.

Then in college I learned FORTRAN while doing data analysis at NASA/Goddard Space Flight Center. But I never went any further than that by exploring other languages. I'd rather use software than write it. Thankfully, others filled the void (and the ambitious ones got rich).

Programming languages improved. New versions of BASIC (such as QuickBASIC and Visual Basic) had greater capabilities, and other languages with names like Pascal, C, C+, and C++ became popular for serious efforts. S&T readers have asked us during this evolution why we are still using BASIC in the magazine. Specifically, why are the programs written in the comparatively crude style of old GW-BASIC, with its mandatory line numbers and reputation for encouraging "spaghetti code"? This topic caused a flurry of discussion on CompuServe's Astronomy Forum.

John M. A. Danby probably made the best case for BASIC in his book Fundamentals of Celestial Mechanics (2nd edition, Willmann-Bell, 1988): "My choice of BASIC as the language for program listing will also be controversial. I am looking for maximum understanding: any programmer can follow BASIC, even if he or she will not admit to using it."

he desire for greatest usefulness is this department's primary rationale too. The programs we feature are intended to give readers the most direct means to answer astronomical questions. The underlying equations, of course, are independent of the language the program is written in. But many readers can't manipulate equations on paper as readily as they can enter and run a BASIC program. They can also explore these tidbits of software on their own, or adapt them to some other language if they wish. What's important is that these programs work. Researchers like Donald Olson and Bradley Schaefer have a knack for turning esoteric concepts into something you can play with on your computer.

Recent incarnations of BASIC do not require line numbers, and their listings can be more clearly structured. Unfortunately, however, a program written in one new flavor of BASIC won't necessarily run in another, while nearly all the fancier BASICs will still accept old-fashioned line-numbered listings. And the inherent slowness of GW-BASIC has been offset by the speed of today's processors.

BASIC is like giving directions. If you use simple instructions that rely only on freeways instead of local roads, the course may take the traveler a bit out of the way. However, with plentiful traffic signs, the destination can be reached.

If you don't like line numbers, leave out all but the few that actually control flow. Feel free to tweak and enhance the program to your liking. Many people write to us explaining how they have used the S&T program listings as inspiration to explore mathematical astronomy further — and that's the whole point.

But a larger concern looms. Running a BASIC program is becoming nontrivial. Microsoft no longer sells QuickBasic, the full implementation of BASIC that allows listings to be compiled into stand-alone executable programs. Thankfully, Microsoft's BASIC interpreter QBasic hasn't completely disappeared. It's still buried on the installation CD-ROMs for Windows 95 and 98 (find the directory called OTHEROLDMSDOS). If you don't have either of these, you can download an "OLDDOS" file that includes QBasic from Microsoft's Web site. (Over the years, the location of this file has changed, or sometimes disappeared entirely, as Microsoft occasionally rearranges its servers.)

Download it, unpack it into an empty folder, and you’ll have QBasic and its help file. You're supposed to have a valid licensed copy of MS-DOS or Windows 95/98 to have the right to install QBasic, per Microsoft's Use of Software statement.

If the day comes when Microsoft once again hides QBasic on its Web site, there will likely still be salvation in other BASIC products. You can find other BASIC interpreters and compilers online. To explore the options, see and

Nevertheless, there may come a day when computers will not run any of the Sky & Telescope BASIC listings without a separately purchased program.

So, Sky & Telescope will continue to offer simple BASIC listings for interesting applications. The fact is that many of our programs, despite their primitive operation, answer the astronomical questions they address more accurately and reliably than some fancy commercial packages do. The treasury of the Astronomical Computing department's programs is an extension of the magazine's mission. Not only do the programs make those articles interactive — they may prove inspirational.