Jump to content

IBM BASIC

From Alfawiki
IBM Personal Computer BASIC
Company typeSoftware
IndustryProgramming language
Founded1981
FounderIBM, Microsoft (licensed)
ProductsCassette BASIC, Disk BASIC, Advanced BASIC (BASICA), Cartridge BASIC
ParentIBM

IBM Personal Computer BASIC, commonly referred to as IBM BASIC, is a programming language introduced by IBM alongside the IBM PC, Model 5150 in 1981. IBM distributed four distinct versions of the Microsoft BASIC interpreter—licensed from Microsoft—for use on the PC and PCjr platforms: Cassette BASIC, Disk BASIC, Advanced BASIC (BASICA), and Cartridge BASIC. Disk BASIC and Advanced BASIC were bundled with IBM PC DOS up through version 4. In addition to the standard ANSI BASIC capabilities, IBM’s implementations included support for the IBM PC’s graphics and audio hardware. Users entered source code through a full-screen editor that incorporated basic debugging functions. Alongside PC DOS 1.10 in 1982, IBM also introduced a Microsoft BASIC compiler for the PC.

Background

Although IBM had its own mainframe BASIC, it chose to license Microsoft BASIC for its PC. Don Estridge highlighted Microsoft’s extensive user base as a significant factor: "Microsoft BASIC had hundreds of thousands of users worldwide."

IBM Cassette BASIC

IBM Cassette BASIC occupied 32 kilobytes (KB) of read-only memory (ROM), separate from the original IBM PC’s 8 KB BIOS ROM. It functioned independently of any operating system, triggered by BIOS interrupt INT 18h when no bootable floppy disk or drive was detected during startup. Its name derives from its reliance on cassette tape storage instead of floppy disks. Cassette BASIC was embedded within the ROMs of the original PC, XT, and early PS/2 models but supported program loading and saving exclusively through the IBM cassette tape interface, which was omitted in later models after the Model 5150.

The entry-level Model 5150 came with only 16 KB of RAM—sufficient to operate Cassette BASIC—but this version saw minimal use since most PCs were equipped with floppy drives and enough RAM to run Disk or Advanced BASIC versions alongside PC DOS. Three versions of Cassette BASIC exist: C1.00 (for early PCs with 16–64 KB motherboards), C1.10 (for later PCs, XTs, ATs, PS/2s), and C1.20 (for the PCjr).

IBM Disk BASIC

IBM Disk BASIC (BASIC.COM) was part of the initial IBM PC DOS release. Because it depended on the 32 KB Cassette BASIC ROM, BASIC.COM was incompatible with many highly compatible PC clones, such as the Compaq Portable. The term "Disk BASIC" reflects its ability to handle both floppy disks and cassette tapes for storing programs and data. It fixed errors present in the ROM code and introduced support for floppy disks and serial port connections.

Disk BASIC versions are denoted by a "D" prefix before their version number. While it added disk functionality and some features absent in Cassette BASIC, it did not include BASICA’s enhanced sound and graphics capabilities. Designed primarily as a lightweight option for IBM PCs with 48 KB of memory, it offered approximately 23 KB of free space for user programs compared to BASICA’s 17 KB. By 1986, as PCs commonly shipped with at least 256 KB RAM, newer DOS releases reduced Disk BASIC to a minimal stub that invoked BASICA.COM for batch file compatibility. Despite available memory increases, all three variants—Cassette BASIC, Disk BASIC, and BASICA—allocated roughly 61 KB for user programming space.

IBM Advanced BASIC

IBM Advanced BASIC (BASICA.COM) was part of the initial IBM PC DOS package and depended on the ROM-based Cassette BASIC for operation. It introduced enhanced features such as disk file management, saving programs to disk, monophonic audio output through the PC speaker, and graphics commands that enabled pixel-level control, drawing of lines and circles, color adjustments, and event-driven handling for communication ports and joystick input. BASICA cannot function on non-IBM compatible machines or newer IBM PCs that lack Cassette BASIC stored in ROM.

Versions of BASICA corresponded closely with their DOS releases, ranging from 1.00 through 3.30. Earlier iterations did not support subdirectories and exhibited minor variations in graphics commands; for instance, the LINE command in version 1.x caused lines extending off-screen to intersect, whereas subsequent versions permitted lines to extend beyond the screen boundaries without intersection. The PAINT command in version 1.x relied on system stack memory, which could trigger OVERFLOW errors during complex fill operations; this issue was rectified in version 2.x by adopting a fill method that avoided using the stack.

Compaq BASIC 1.13 was the earliest standalone PC BASIC interpreter that did not require Cassette BASIC and uniquely preserved File Control Blocks (FCBs) along with the original intersecting behavior of the LINE command; its PAINT functionality aligned with later BASICA and GW-BASIC implementations.

Initial PC DOS distributions included sample BASIC programs showcasing PC features, such as the game DONKEY.BAS.

Microsoft’s GW-BASIC is essentially equivalent to BASICA but incorporates Cassette BASIC code internally, allowing it to operate on non-IBM PCs as well as later IBM models lacking ROM-based Cassette BASIC.

IBM PCjr Cartridge BASIC

A ROM cartridge edition of BASIC was exclusively available for the IBM PCjr, launched in 1984, enabling utilization of the system’s enhanced graphics and audio capabilities. This Cartridge BASIC extended advanced BASIC features. It ran solely within the first 128 KB of PCjr RAM and did not support expanded memory, restricting certain operations such as DEF SEG to addresses below &H1FF0.

To start Cartridge BASIC, users typed BASICA at the DOS prompt. IBM BASICA versions 2.1 onward were designed not to run on a PCjr but could be modified with patches to circumvent this limitation.

Operation

When a PC or PCjr booted without a disk or cartridge inserted, Cassette BASIC loaded automatically. Disk BASIC and Advanced BASIC were initiated by entering BASIC or BASICA at the DOS prompt (except on PCjr systems where Cartridge BASIC was used), with optional parameters available for specifying memory usage. Upon launch, a version identification message displayed followed by a full-screen text editor featuring function keys mapped to frequently used commands.

Users could input commands to load or save programs or execute expressions directly in immediate mode. Lines beginning with numeric values were stored as program source code with line numbers, facilitating incremental program development. Source lines appeared sorted numerically and could be edited directly on screen. Internally, programs were stored in tokenized form, substituting reserved keywords with single-byte tokens to conserve memory and enhance execution efficiency. Programs could be saved either as compact tokenized files or as plain ASCII text files compatible with other editors. IBM BASIC operated entirely in text mode without graphical user interface elements such as windows, icons, mouse interaction, or clipboard editing functions.

Legacy

Released in 1983, GW-BASIC is a Microsoft disk-based interpreter provided with non-IBM MS-DOS systems. It supports all graphics capabilities and functionalities found in BASICA on machines that lack IBM Cassette BASIC.

The discontinued follow-up to BASICA for MS-DOS and PC DOS is QBasic, which debuted in 1991. QBasic serves as a streamlined interpreter derived from the Microsoft QuickBASIC compiler: unlike QuickBASIC, it does not have the ability to compile source code into executable .EXE files. QuickBASIC distinguishes itself by including more sophisticated language constructs, operating system integration, low-level machine-language coding, multi-module programming support, and advanced debugging tools that are not present in QBasic.

External links