Recent from talks
Nothing was collected or created yet.
IBM BASIC
View on WikipediaThis article needs additional citations for verification. (September 2012) |

The IBM Personal Computer BASIC, commonly shortened to IBM BASIC, is a programming language first released by IBM with the IBM Personal Computer, Model 5150 (IBM PC) in 1981. IBM released four different versions of the Microsoft BASIC interpreter, licensed from Microsoft for the PC and PCjr. They are known as Cassette BASIC, Disk BASIC, Advanced BASIC (BASICA), and Cartridge BASIC. Versions of Disk BASIC and Advanced BASIC were included with IBM PC DOS up to PC DOS 4. In addition to the features of an ANSI standard BASIC, the IBM versions offered support for the graphics and sound hardware of the IBM PC line. Source code could be entered with a full-screen editor, and limited facilities were provided for rudimentary program debugging. IBM also released a version of the Microsoft BASIC compiler for the PC concurrently with the release of PC DOS 1.10 in 1982.
Background
[edit]IBM licensed Microsoft BASIC for the IBM Personal Computer despite already having its own version of BASIC for the company's mainframes. Don Estridge said, "Microsoft BASIC had hundreds of thousands of users around the world. How are you going to argue with that?"[1]
IBM Cassette BASIC
[edit]| IBM Cassette BASIC | |
|---|---|
| Developer | Microsoft (for IBM) |
| First appeared | 1981 |
| Influenced | |
| IBM Disk BASIC, IBM BASICA, GW-BASIC | |
IBM Cassette BASIC came in 32 kilobytes (KB) of read-only memory (ROM), separate from the 8 KB BIOS ROM of the original IBM PC, and did not require an operating system to run. Cassette BASIC provided the default user interface invoked by the BIOS through INT 18h if there was no floppy disk drive installed or if the boot code did not find a bootable floppy disk at power up. The name Cassette BASIC came from its use of cassette tapes rather than floppy disks to store programs and data. Cassette BASIC was built into the ROMs of the original PC and XT and of early models in the PS/2 line. It supports loading and saving programs only to the IBM cassette tape interface, which is unavailable on models after the original Model 5150. The entry-level version of the 5150 came with just 16 KB of random-access memory (RAM), which was sufficient to run Cassette BASIC. However, Cassette BASIC was rarely used because few PCs were sold without a disk drive, and most were sold with PC DOS and sufficient RAM to at least run Disk BASIC—many could run Advanced BASIC as well. There are three versions of Cassette BASIC: C1.00 (found on the early IBM PCs with 16–64K motherboards), C1.10 (found on all later IBM PCs, XTs, ATs, and PS/2s), and C1.20 (found on the PCjr).
IBM Disk BASIC
[edit]| IBM Disk BASIC | |
|---|---|
| Developer | Microsoft (for IBM) |
| First appeared | 1981 |
| Influenced by | |
| IBM Cassette BASIC | |
| Influenced | |
| IBM BASICA, GW-BASIC | |
IBM Disk BASIC (BASIC.COM) was included in the original IBM PC DOS. Because it used the 32 KB Cassette BASIC ROM,[2] BASIC.COM did not run on even highly compatible PC clones, such as the Compaq Portable.[3] The name Disk BASIC came from its use of floppy disks as well as cassette tapes to store programs and data. Disk-based code corrected errata in the ROM-resident code and added floppy-disk and serial-port support.
Disk BASIC can be identified by its use of the letter D preceding the version number. It adds disk support and some features lacking in Cassette BASIC but does not include the extended sound or graphics functions of BASICA. The primary purpose of Disk BASIC was as a "light" version for IBM PCs with only 48 KB of memory: BASIC.COM would then have about 23 KB free for user code, whereas BASICA would have only about 17 KB. By 1986, all new PCs shipped with at least 256k, and DOS versions after 3.00 reduced Disk BASIC to only a small stub that called BASICA.COM for compatibility with batch files. Even with all this excess RAM, BASIC would still allocate and manage only about 61 KB for user programs, whether it was Cassette BASIC, BASIC.COM, or BASICA.
IBM Advanced BASIC
[edit]| IBM Advanced BASIC (BASICA) | |
|---|---|
| Developer | Microsoft (for IBM) |
| First appeared | 1981 |
| Platform | IBM Personal Computer |
| OS | IBM PC DOS |
| Influenced by | |
| IBM Cassette BASIC, IBM Disk BASIC | |
| Influenced | |
| GW-BASIC | |
IBM Advanced BASIC (BASICA.COM) was also included in the original IBM PC DOS, and requires the ROM-resident code of Cassette BASIC.[2] It added functions such as diskette file access, storing programs on disk, monophonic sound using the PC's built-in speaker, graphics functions to set and clear pixels, similar functions to draw lines and circles and to set colors, and event handling for communications and joystick presses. BASICA does not run on non-IBM computers (even so-called "100% compatible" machines) or later IBM models, because they lack the needed ROM BASIC.
BASICA versions are the same as those of their respective DOS, beginning with v1.00 and ending with v3.30. The early versions of BASICA do not support subdirectories, and some graphics commands function slightly differently. As an example, if the LINE statement is used to draw lines that trailed off-screen, BASIC merely intersects them with the nearest adjacent line, while in BASIC 2.x and up, the lines run off the screen and do not intersect. The PAINT command in BASIC 1.x begins filling at the coordinate specified and expands outward in alternating up and down directions, while in BASIC 2.x it fills everything below the starting coordinate and then, after finishing, everything above it. BASIC 1.x's PAINT command also makes use of the system stack for storage and when filling in complex areas it can produce an OVERFLOW error. To remedy this, the CLEAR statement can be used to expand BASIC's stack (128 bytes is the default size). BASIC 2.x does not use the stack when PAINTing and thus is free of this problem.
Compaq BASIC 1.13 was the first standalone (does not require Cassette BASIC) BASIC for the PC as well as the only version of BASIC besides IBM BASICA 1.00 and 1.10 to use FCBs[clarification needed] and include the original LINE statement with intersecting lines (the PAINT statement in Compaq BASIC 1.13 works like in all later versions of BASICA/GW-BASIC: it uses the new fill algorithm and no stack).
Early versions of PC DOS include several sample BASIC programs that demonstrated the capabilities of the PC, including the BASICA game DONKEY.BAS.
Microsoft GW-BASIC is identical to BASICA,[4] with the exception of including the Cassette BASIC code in the program, so runs on non-IBM computers and later IBM models that lack Cassette BASIC in ROM.
IBM PCjr Cartridge BASIC
[edit]A ROM cartridge version of BASIC was available only on the IBM PCjr, shipped in 1984, and supported the additional graphics modes and sound capabilities possible on that machine.[5] It is a superset of advanced BASIC.[6] Cartridge BASIC could operate only within the first 128 KB of memory on the PCjr and did not work with expansion RAM, i.e., the DEF SEG function cannot be used to point to memory segments above &H1FF0.
Cartridge BASIC was activated by typing BASICA at the DOS prompt. Conversely, IBM BASICA versions 2.1 and up refused to run if they detected a PCjr, but they could be patched to work around this limitation.
Operation
[edit]Cassette BASIC loaded when a PC or PCjr was booted without a bootable disk or cartridge. Disk BASIC and Advanced BASIC load when their command name (BASIC and BASICA respectively) is typed at a DOS command prompt (except on a PCjr, which activates Cartridge BASIC instead), with some optional parameters to control allocation of memory. When loaded, a sign-on identification message displays the program version number, and a full-screen text editor starts (see images, right). The function keys are assigned common commands, which display at the bottom of the screen. Commands may be typed in to load or save programs, and expressions can be typed in and executed in direct (immediate) mode. If a line of input starts with a number, the language system stores the following line of text as part of program source, allowing a programmer to enter an entire program line by line, with line numbers before each statement. When listed on screen, lines are displayed in order of increasing line number. Changes can be made to a displayed line of program source code by moving the cursor to the line with the cursor keys, and typing over the on-screen text. Program source is stored internally in a tokenized form in which reserved words are replaced with a single byte token to save space and execution time. Programs may be saved in compact tokenized form or optionally saved as DOS ASCII text files[7] that can be viewed and edited with other programs. Like most other DOS applications, IBM BASIC is a text-mode program and has no features for windows, icons, mouse support, or cut-and-paste editing.
Legacy
[edit]GW-BASIC, launched in 1983, is a disk-based Microsoft product that was distributed with non-IBM MS-DOS computers and supports all the graphics modes and features of BASICA on computers that do not have IBM Cassette BASIC.
The successor to BASICA for MS-DOS and PC DOS versions, now discontinued, is QBasic, launched in 1991. It is a stripped-down version of the Microsoft QuickBASIC compiler: QBasic is an interpreter and cannot compile source files, while QuickBASIC can compile and save the programs in the .EXE executable file format. QuickBASIC also includes some advanced language statements and functions (mostly involving OS interfacing and low-level machine-language programming), supports multi-module programs, and includes advanced debugging features, all of which are absent from QBASIC.
References
[edit]- ^ Curran, Lawrence J.; Shuford, Richard S. (November 1983). "IBM's Estridge". BYTE. pp. 88–97. Retrieved 19 March 2016.
- ^ a b Williams, Gregg (January 1982). "A Closer Look at the IBM Personal Computer". BYTE. p. 36. Retrieved 19 October 2013.
- ^ Dahmke, Mark (January 1983). "The Compaq Portable". BYTE. pp. 30–36. Retrieved 27 July 2013.
- ^ Rash, Wayne Jr. (December 1984). "The Zenith Z-150 PC". BYTE. pp. 252–259.
- ^ Readers' Feedback: IBM BASIC Versions, Compute! Magazine, No. 78, November 1986, p. 8, retrieved December 23, 2011
- ^ IBM. PCjr Cartridges Announcement Letter. 1983-11-01 ([1]).
- ^ DOS text files terminate each line with a CR (carriage return, ASCII 13) and LF (linefeed, ASCII 10) character pair, in that order.
External links
[edit]- A brief history of the development of BASIC www.phys.uu.nl/~bergmann/history.html (archived)
- PCE IBM PC Emulator — emulates IBM Cassette BASIC and IBM Cassette Interface with connected third party cassette drive
- POPBASIC & RUNBASIC which invokes & copies IBM Cassette BASIC
IBM BASIC
View on GrokipediaOverview and Historical Context
Introduction
IBM BASIC is a family of interpreters for the BASIC programming language, licensed from Microsoft and adapted by IBM specifically for its early personal computers. Developed as a dialect of Microsoft BASIC, it debuted with the IBM Personal Computer Model 5150 (IBM PC) in August 1981, providing an immediate programming environment upon system startup via ROM integration.[1][5] The interpreter was designed for compatibility across IBM's initial PC lineup, including the IBM PC (5150), the IBM Personal Computer XT (Model 5160) released in 1983, and the IBM PCjr, announced in late 1983. It integrated seamlessly with PC DOS versions from 1.0 through 5.0, enabling users to run programs on systems with varying storage options from cassette tapes to floppy disks.[1][6] Over time, IBM BASIC evolved from its foundational ROM-based Cassette BASIC form—suitable for low-memory configurations—to enhanced disk and advanced variants that supported expanded hardware capabilities, culminating in a cartridge-based version for the PCjr.[1] In the context of BASIC's history, which originated in 1964 as an accessible tool for beginners, IBM BASIC reinforced this legacy by positioning personal computing as approachable for non-programmers through its simple syntax and immediate interactivity on affordable hardware.[7]Development Background
In the late 1970s, IBM recognized the growing personal computer market dominated by microcomputers like the Altair 8800, which popularized interpreted BASIC as an accessible entry point for hobbyists and developers. Microsoft's Altair BASIC, released in 1975, became a foundational implementation that influenced subsequent microcomputer BASICs, establishing Microsoft as a leader in providing portable, ROM-based interpreters for emerging hardware. This widespread adoption of BASIC variants on systems such as the Apple II and TRS-80 underscored its role as the de facto standard for personal computing, prompting IBM to prioritize compatibility when entering the market. As IBM launched Project Chess in 1980 to develop the IBM PC under the leadership of Philip Don Estridge, the team emphasized a bundled, ROM-resident programming language to ensure immediate usability without requiring additional software purchases, aligning with the goal of broad accessibility for business and home users. Despite IBM's existing mainframe-oriented BASIC implementations, which were more advanced but lacked the microcomputer ecosystem's user base, the project rejected internal options due to their incompatibility with the popular dialects prevalent in the hobbyist market. Estridge noted that IBM's own BASIC had "infinitesimal" users compared to Microsoft's version, which boasted hundreds of thousands worldwide, making it impractical to impose a proprietary alternative.[8] IBM initiated negotiations with Microsoft in July 1980, following an unsuccessful outreach to Digital Research for CP/M, and formalized a contract on November 6, 1980, licensing Microsoft BASIC alongside an operating system. Developed by Microsoft under the leadership of Bill Gates and Greg Whitten, this agreement enabled rapid adaptation of Microsoft's 8086 BASIC for the PC's Intel 8088 processor, ensuring delivery within the tight one-year development timeline. The IBM PC, incorporating Cassette BASIC in ROM, was announced by Estridge on August 12, 1981, at the Waldorf Astoria Hotel in New York, marking IBM's strategic pivot to open-architecture personal computing.[9][10][1]Versions
IBM Cassette BASIC
IBM Cassette BASIC was released as version C1.00 alongside the original IBM Personal Computer (model 5150) in August 1981.[11] This minimal implementation, developed by Microsoft and licensed to IBM, served as the entry-level programming environment for systems lacking disk drives or DOS. Subsequent updates included version C1.10 in 1982, which addressed compatibility issues and minor enhancements for broader IBM PC compatibility, and version C1.20 in 1984 specifically for the IBM PCjr home computer.[12][13] The interpreter occupied 32 KB of read-only memory (ROM) on the system board, forming part of the total 40 KB ROM space that also included the BIOS.[12] It required a minimum of 16 KB of RAM to operate effectively, leaving approximately 12-16 KB available for programs and variables depending on system configuration.[11] Cassette input/output was handled via the Kansas City standard protocol, using frequency-shift keying with tones at around 1,200 Hz for zeros and 2,400 Hz for ones, transmitted at 300-600 baud through the dedicated cassette port on the rear of the system board; this enabled saving and loading programs in 256-byte blocks with cyclic redundancy check (CRC) for data integrity.[11] Notably, it lacked any support for disk operations, restricting all persistent storage to audio cassette tapes. A key feature was its auto-boot capability: upon power-up, if no bootable disk was detected, the system would automatically launch Cassette BASIC and prompt for cassette input, allowing immediate program entry without an operating system.[11] Programs were limited to a maximum size of about 16 KB, constrained by available RAM after allocating space for the interpreter and system overhead. Output was strictly text-based, displayed on a monochrome or compatible monitor using the system's 80-column text mode. Basic commands such as PRINT for output, INPUT for user data entry, and simple control structures like GOTO were supported, enabling straightforward scripting for calculations, loops, and conditional logic. Among its limitations, Cassette BASIC provided no graphics or sound capabilities, omitting commands for drawing, color manipulation, or audio generation that appeared in extended versions. File I/O was confined to tape operations via commands like CSAVE and CLOAD, with no access to printers, serial ports, or other peripherals beyond basic keyboard and screen interaction. Error handling included messages such as "Syntax error," "Out of memory," "File not found," and cassette-specific alerts like "CRC error" or "Device timeout," often accompanied by status codes returned via BIOS interrupts. These constraints made it suitable only for low-end, tape-based setups, with later versions like IBM Disk BASIC adding disk support and multimedia extensions for more capable hardware.[12][11]IBM Disk BASIC
IBM Disk BASIC, also known as BASIC.COM, was the disk-extended variant of the BASIC interpreter bundled with PC DOS, providing essential enhancements for file management and storage on floppy or hard disks. It was first included in PC DOS 1.0, released on August 12, 1981, under version D1.00.[14] Subsequent updates accompanied PC DOS 1.10 in May 1982 as version D1.10, and PC DOS 2.0 in March 1983 as version D2.00, aligning with improvements in DOS support for subdirectories and larger storage.[15] This version served as the standard programming environment for disk-equipped IBM PCs, enabling users to develop and run applications that interacted with secondary storage beyond the limitations of tape-based systems.[16] Technically, IBM Disk BASIC loaded from disk as the executable BASIC.COM, requiring a minimum of 32 KB RAM to operate alongside DOS, with the ROM-based Cassette BASIC providing core functionality.[14] It supported input/output operations on floppy and hard disks, as well as serial ports via RS-232 interfaces, facilitating data exchange with peripherals like modems or printers.[16] Program execution utilized available system RAM, with effective program size limited to the total minus approximately 20 KB overhead for DOS, the interpreter, and runtime structures, allowing substantial applications on typical 64 KB configurations.[16] Key features distinguished IBM Disk BASIC by its integration of file handling capabilities, including the OPEN statement for sequential or random access files, GET for reading records, and PUT for writing them, with record lengths up to 32,767 bytes and support for fixed-length fields via the FIELD statement.[16] It also enabled machine code subroutines through the CALL statement and USR functions, permitting performance-critical extensions loaded via BLOAD or BSAVE.[16] Fully backward compatible with IBM Cassette BASIC, it preserved all ROM-based commands while adding disk-specific operations like SAVE and LOAD for program persistence.[16] In practice, it became the go-to interpreter for business and utility programs on early IBM PCs with disk drives, emphasizing reliable data storage and retrieval in a DOS environment.[14]IBM Advanced BASIC
IBM Advanced BASIC, commonly referred to as BASICA in its executable form (BASICA.COM), served as the full-featured extension of the BASIC interpreter for the IBM PC, integrating disk operations with advanced multimedia capabilities. It was released as version A1.00 with PC DOS 1.0 in August 1981 (pre-release dated June 4, 1981), bundled with PC DOS 1.0, and evolved through multiple iterations to address compatibility and enhancements, culminating in version A3.30 on November 13, 1986, aligned with PC DOS 3.30; a final update, A3.40, appeared in 1988. Updates like A2.00 in 1983 added support for DOS 2.0 features including subdirectories. Documentation from IBM increasingly branded it as BASICA to distinguish it from simpler variants, positioning it as the premier programming environment for users seeking comprehensive functionality beyond basic tape or disk I/O.[15][1] Technically, BASICA relied on the presence of Cassette BASIC in the system's ROM for core functionality, while requiring PC DOS for file access and extended operations; without the ROM, it would not load. The interpreter recommended at least 64 KB of RAM to accommodate program storage, variables, and runtime overhead effectively, though the original IBM PC supported configurations starting from 16 KB. It also integrated support for the Intel 8087 math coprocessor, enabling hardware-accelerated floating-point arithmetic to improve performance in numerical computations.[17][15][18] BASICA introduced distinctive multimedia and programming enhancements tailored to the IBM PC's hardware. Graphics capabilities included commands like LINE for drawing straight lines and CIRCLE for ellipses and circles, optimized for the Color Graphics Adapter (CGA) to enable visual applications such as simple games and charts. Audio features were provided via the PLAY statement, which synthesized 3-voice music and tones using the PC's built-in speaker, allowing programmatic control over melody, harmony, and rhythm without additional hardware. Event handling was advanced with ON KEY, permitting interrupt-driven responses to keyboard input for interactive programs, while structured programming was bolstered by GOSUB/RETURN subroutines for modular code organization.[19][3] For efficiency, BASICA tokenized source code upon loading, converting text into compact binary tokens to accelerate interpretation and execution speeds compared to line-by-line parsing in earlier interpreters. Memory management was facilitated through COMMON blocks, which allowed selective sharing of variables across program modules or sessions, optimizing resource allocation in memory-constrained environments.[17]IBM PCjr Cartridge BASIC
IBM PCjr Cartridge BASIC was released in March 1984 alongside the IBM PCjr home computer, serving as the primary programming environment for the system.[20] This version, identified as J1.00, was provided on a dedicated 64 KB ROM cartridge consisting of two 32 KB ROM chips, allowing immediate access without requiring an operating system for initial booting.[15][21] Upon insertion into one of the PCjr's front-panel cartridge slots and powering on the system, the cartridge automatically initializes the BASIC interpreter via the BIOS interrupt vector at INT 18h, presenting a ready prompt for programming.[22] Technically, Cartridge BASIC supported the PCjr's maximum of 128 KB RAM, allocating approximately 48-112 KB for user programs after reserving space for the video buffer and system overhead, though expansions beyond 128 KB could disrupt the memory environment setup.[23] It operated independently of DOS at startup but remained compatible with IBM PC DOS 2.1, enabling disk operations when booted from floppy.[24] The interpreter leveraged the PCjr's hardware directly, including its Chiclet-style wireless keyboard with function keys for enhanced input and built-in joystick ports for game development, without needing additional peripherals.[23] Unique to the PCjr, this BASIC version extended the core language with commands for the system's advanced graphics and sound capabilities. Graphics support included specialized modes such as 160×200 with 16 colors, 320×200 with 4 colors, and 640×200 with monochrome or 4-color options, along with commands like PCOPY for page copying and PALETTE for color remapping to utilize the video gate array.[23][25] Sound integration featured the Texas Instruments SN76489 chip for three-channel tone and noise generation, accessible via BASIC routines for frequency and duration control.[23] Additionally, it provided light pen support through dedicated hardware interfacing, allowing coordinate input for interactive applications, and enabled auto-loading of programs from the cartridge itself.[24] Despite these enhancements, Cartridge BASIC was inherently tied to the PCjr's proprietary hardware, limiting portability to standard IBM PC systems without emulation. Program sizes were constrained to roughly 64 KB due to available RAM after BASIC's footprint and video reservations, and compatibility issues arose with conventional PC peripherals, such as the absence of a standard parallel port or full CGA emulation in all modes.[23][15][26]Features and Technical Specifications
Core Language Elements
IBM BASIC, as implemented in the IBM Personal Computer family, employs a line-numbered program structure where each statement begins with an integer line number ranging from 0 to 65529, facilitating sequential execution, editing, and control flow jumps.[27] Programs consist of statements such as LET for variable assignment (e.g.,LET X = 5), IF-THEN for conditional execution (e.g., IF X > 0 THEN PRINT X), and FOR-NEXT loops for iteration (e.g., FOR I = 1 TO 10: NEXT I).[27] These elements form the foundational syntax shared across Cassette BASIC, Disk BASIC, and Advanced BASIC versions, enabling straightforward procedural programming without requiring explicit declaration of most elements.[27]
Variables in IBM BASIC are dynamically typed and unnamed unless suffixed, supporting numeric and string data. Numeric variables default to single-precision floating-point (7-digit accuracy, 4 bytes storage, range approximately ±3.4 × 10^38), with integers (2 bytes, -32768 to 32767) specified via % suffix (e.g., A%), double-precision (16-digit accuracy, 8 bytes) via # suffix (e.g., A#), and explicit single-precision via ! (e.g., A!).[27] String variables, denoted by `), handle variable-length text up to 255 characters, with no user-defined types available.[27] Expressions combine operators like +, -, *, / for arithmetic and & for string concatenation, evaluated with standard precedence (parentheses overriding).[27]
Core control flow relies on GOTO for unconditional jumps to line numbers and GOSUB-RETURN for subroutine calls, allowing modular code organization.[27] Input/output operations use INPUT to prompt and read user data (e.g., INPUT "Enter value"; X) and PRINT for screen output, supporting formatting with semicolons or commas (e.g., PRINT X; " is the value").[27] Arrays are declared with DIM (e.g., DIM A(10) for a 0-based array of 11 elements), accommodating up to 255 dimensions for numerics or strings.[27][28] String manipulation includes functions like LEN to return length (e.g., LEN(A$)), MID(A and RIGHT$ for prefix/suffix extraction.[27]
Error handling provides basic runtime management via ON ERROR GOTO, which redirects execution to a specified line upon encountering an error, allowing custom recovery routines.[27] Common errors include Syntax Error for invalid statements, Out of Memory for insufficient RAM allocation, Overflow for numeric exceedance, Type Mismatch for incompatible data operations, and Illegal Function Call for improper arguments.[27] These mechanisms, while rudimentary, support debugging in the interpreter environment without advanced exception types.
A simple example program demonstrating core elements is an infinite "Hello World" loop:
10 PRINT "Hello, World!"
20 [GOTO](/page/Goto) 10
10 PRINT "Hello, World!"
20 [GOTO](/page/Goto) 10
