Friday, September 5, 2014

Flavors of PC Compatible BASIC and Why You Should Care

Cassette BASIC :

In 1981, when IBM released the IBM PC Model 5150, it included BASIC in ROM.  In the 5150, it was contained on four 8KB chips, in later machines, it was included within the 32KB chips that included the BIOS.  In every IBM PC model it occupies the space from F600:0000 to FDFF:0000.

Cassette BASIC, as its name implies, has commands for saving and loading only to a compact cassette.  In order to save to or load a program from a cassette, the user needed to connect a cassette drive to his IBM PC with a special cable.  On the back of the IBM PC Model 5150, there was a 5-pin DIN next to the keyboard DIN that this cable would plug into.  At the other end of the cable there would be a 3.2mm audio jack for the auxillary or microphone input (to save/record data from a PC), a 3.2mm audio jack for the earphone output (to load/playback data to the PC), and a 2.5mm jack to control the tape recorder remotely. The PC had a relay circuit on the motherboard that would start and stop the motor so that the user would not have to.

IBM did not offer a cable for the 5150, but Tandy/Radio Shack TRS-80 and Color Computer tape recorders came with the correct cable.  Most older tape recorders, including those Radio Shack sold for their non-PC compatibles, had four audio jacks, the EAR, REM, MIC and AUX.  Current recorders ditch the AUX input and only have a MIC input.  REM is the smaller jack that controls the cassette deck.  There was a jumper on the system board to set the appropriate signal strength for a MIC input or an AUX input.

Cassette BASIC comes in three versions, C1.0, C1.1 and C1.2.  C1.0 will only be found in the very first IBM PCs, typically those with a 16-64KB system board and a BIOS version dated 04/24/81 or 10/19/81. C1.1 generally should come with all IBM PC Model 5150s with a 64-256KB system board or those systems with a BIOS version dated 10/27/82 (the last).  However, the BIOS in the IBM PC is contained in one chip, U33, and can be updated in an 16-64KB system board without updating BASIC.

All later IBM PCs, the XT, Portable, AT, XT/286 and Convertible, contain Cassette BASIC C1.1.  The PCjr. (and probably the PC JX) uses Cassette BASIC C1.2 for reasons described below.  All PS/2s released during the 1980s and early 90s, and the early IBM PS/1s, also contain Cassette BASIC C1.1 for compatibility reasons.  No other PC Compatible system, unless an exact clone of one of these systems, included Cassette BASIC.

Disk BASIC, Advanced BASIC and GW-BASIC:

Disk BASIC and Advanced BASIC were included with PC-DOS v1.0 and every version thereafter, 1.1, 2.0, 2.1, 3.0, 3.1, 3.2, 3.3, 4.0 and 4.01.  They were replaced by QBASIC in PC-DOS 5.0.  The version number for Disk BASIC and Advanced BASIC correspond directly to the version of DOS they came with.  This you will see D1.1 for the version of Disk BASIC accompanying PC-DOS 1.1 and A3.3 for the version of Advanced BASIC that came with PC-DOS 3.3.  Disk BASIC is invoked by executing BASIC.COM in DOS, and Advanced BASIC by BASICA.COM in DOS.

The Disk BASIC-Advanced BASIC split was due to the low amounts of memory that came with early IBM PCs.  You could buy an IBM PC with only 16KB of RAM, but with that amount of RAM, you could only run Cassette BASIC.  Disk BASIC required 32KB of RAM, and Advanced BASIC 48KB of RAM.  Disk BASIC could do everything that Cassette BASIC could do and added support for saving and loading programs to floppy disks and serial port access, keeping track of the date and time and supporting two additional printers.  Advanced BASIC does all Disk BASIC does and more, such as support for more graphics and sound statements and event trapping.

PC BASIC does not support multiple memory segments, it runs everything within one 64KB segment.  Thus, after PCs began shipping with 128KB of RAM or more, there was no further need to use Disk BASIC.  In fact, as of DOS 3.3, BASIC.COM was just a small (1-2K) stub that called BASICA.COM and was only present for compatibility.  DOS 1.0-3.2 had a functional BASIC.COM.  PC BASIC would keep up with DOS features, like the added support for subdirectories in DOS 2.0 and the IOCTL calls in DOS 3.0.

With non-IBM machines, vendors and OEMs released system-specific versions of MS-DOS.  With these operating systems, GW-BASIC was included.  GW-BASIC did not require Cassette BASIC.  In these systems, sometimes there is a large BASIC.EXE and a small BASICA.COM.  BASICA.COM is the stub that executes BASIC.EXE.  Sometimes there is also a BASIC.COM stub.  In certain systems, the file was BASICA.EXE or GWBASIC.EXE.

Tandy's GW-BASIC for the Tandy 1000 series included the commands found in Cartridge BASIC to control its PCjr-derived advanced graphics and sound capabilities.  The AT&T 6300's GW-BASIC included commands for the advanced graphics capabilities of that system, and the Hercules Graphics Card came with a utilities disk with HBASIC, which allowed the use of the 720x348 graphics mode these cards support.  A generic GW-BASIC would not support these special features.  Microsoft began releasing generic, non-OEM specific versions of MS-DOS starting with MS-DOS 3.2.  A generic version of GW-BASIC can be found on them.

IBM also released Compiler BASIC which allowed users to compile their program into object code so it does not require a BASIC interpreter to run the program.  Most companies that released games found it simpler to run their code through an interpreter, because every computer with a disk drive and DOS should have had one during the 1980s.

Cartridge BASIC :

The PCjr. included Cassette BASIC C1.2 in its system ROM.  Due to the differences between the PC and PCjr., the BASIC code cannot be identical.  However, to maintain compatibility with applications written for Cassette BASIC, all the functionality of PC Cassette BASIC is included in PCjr. Cassette BASIC, and nothing more.  IBM released an official cassette cable that plugged into a unique male BERG-style port on the PCjr., but it requires a cassette recorder with an AUX input.

IBM released Cartridge BASIC with the PCjr., and the user had to buy it separately.  It is a 32KB cartridge that plugs into either cartridge slot of the PCjr.  Cartridge BASIC included commands to take advantage of the PCjr. video adapter and sound chip.  Cartridge BASIC has only one version, J1.0.  Disk BASIC and Advanced BASIC, when run on the PCjr., will show the version as J1.0, regardless of DOS version.  Disk BASIC and Advanced BASIC will not run unless Cartridge BASIC is present.

Using Cartridge BASIC in a PCjr. with more than 128KB of RAM imposes special problems.  Cartridge BASIC was not designed for more than 128KB, and programs run it may not run correctly or at all. However, the PCjr. will not recognize extra RAM unless a device driver is loaded in DOS.  If DOS is loaded, either from a disk or a hard drive without a device driver loaded, then Cartridge BASIC should run normally.  You will be limited to the first 128KB of RAM and the poor performance resulting by running BASIC code within it.  The popular device driver JRCONFIG 3.1 included an unsupported /q command line switch where it will lie about the amount of memory available to BASIC, but it will warn you that anything contained in a RAM Disk or Print Spooler created by JRCONFIG will be in danger.


In PC-DOS 5.0 and MS-DOS 5.0, Disk BASIC and Advanced BASIC were no longer included with the operating system.  Instead, QBASIC version 1.0 was included.  QBASIC was a cut down version of Microsoft QuickBASIC.  QBASIC does not require line number and supports a mouse cursor, split windows, drop down menus and multiple colors in its text-based user interface.  The MS-DOS EDIT.EXE program requires QBASIC.EXE, QBASIC.HLP and EDIT.HLP to work.  QBASIC tends to be a poor performer on 8088-based XT-class and low speed 286-based AT-class machines.

I read that the original version of QBASIC in PC-DOS 5.0 still required Cassette BASIC in ROM, but it only used checked to see that it was there before loading QBASIC.  This requirement was removed in the QBASIC that came with PC-DOS 5.02.  QBASIC version 1.1 was included in MS-DOS 6.0 through Windows ME and NT 4.0.

BASIC Games :

The first game ever written for the IBM PC was Donkey.  This simple game was included as the file DONKEY.BAS with several other demonstration programs included on the DOS disks.  In fact, half the files included in PC-DOS 1.0 and 1.1 were BASIC demonstration programs.  It is included with PC-DOS 1.0-3.2.  With DOS 3.3, virtually all the demo programs were eliminated.  

QBASIC in MS-DOS 5.0 and PC-DOS 5.0 came with two games, Gorillas and Nibbles.  Their files are called GORILLA.BAS and NIBBLES.BAS.  Nibbles is a text mode game that uses an 80x25 column mode, but appears as a 80x50 column mode by the use of a half-bar ASCII character (where the top half uses the foreground color and the bottom half uses the background color).  It works with any video adapter. Gorillas uses either the 320x200x4 CGA Mode 04 or the 640x350x16 EGA Mode 0F.  They are intended to be run on a low-end 386 or a high end 286.  Both games would be gone by MS-DOS 6.22 and PC-DOS 6.1

Games Requiring BASIC :

Several games, usually early games, used Cassette/Disk/Advanced BASIC.  Some were copy-protected DOS disks that directly accessed Cassette BASIC.  They must be run on an IBM system.  Nine games commercially released by IBM early in the life of its PC line require Cassette BASIC or Cartridge BASIC.  They are

Adventures in Math
Arithmetic Games Set 1*
Arithmetic Games Set 2*
Bumble Games*
Bumble Plot*
Casino Games
Juggles Butterfly*
Monster Math
Strategy Games

* - Copy Protected (The Learning Company games) or probably Copy Protected (Science Research Associates, Inc.)  IBM never seemed to copy protect the games it developed internally, but did with any game it released that was licensed from or developed by another company.  Any game that is not copy protected, or has been cracked to run on a generic disk should be able to be run with GW-BASIC.  Mobygames lists 75 games that require BASIC, and some are sophisticated commercial releases like Battle of the Bulge, some are old classics like Temple of Apshai and others are small single file games that just need a BASIC interpreter. There are many, many freeware games that run on QBASIC, and while Mobygames may not document every Cassette/Disk/Advanced BASIC game ever made, it does not really list any games that use QBASIC other than Gorillas an Nibbles.  A good place to start to find QBASIC games is here :

No comments: