Integer BASIC
Encyclopedia
Integer BASIC, written by Steve Wozniak
, was the BASIC
interpreter
of the Apple I
and original Apple II
computers. Originally available on cassette, then included in ROM
on the original Apple II computer at release in 1977, it was the first version of BASIC used by many early home computer
owners. Thousands of programs were written in Integer BASIC.
in the development of the original version of Breakout, set as an internal goal in the design of the Apple II computer to be able to faithfully reproduce that game, using only BASIC instructions. This is seen in the design of the "low-res" graphic modes and making the Apple II one of the first microcomputers to use color graphics. This design goal was realized with the program "Little Brick Out" when it was demonstrated at a meeting of the Homebrew Computer Club
in 1976. It should also be noted that Wozniak did not have any software development tools for the 6502
processor other than an assembly language
reference manual, and instead wrote out the software with pen and paper and then hand assembled the instructions into raw machine code for the 6502.
integers
and it was very difficult to write a program that could do calculations using floating point
numbers, or even integers outside of the range -32768 to +32767. It was therefore very difficult to write financial or math programs.
Apple Computer
licensed a more full-featured (but also much slower) BASIC from Microsoft
soon after the Apple II was released in 1977, introduced some tweaks, named it Applesoft BASIC
, and included the second version of it in the ROMs of the Apple II Plus, which was released in [1979]. Integer BASIC was relegated to a file on the system floppy disk
that Apple II Plus users could load into a RAM card for backward compatibility
, if needed. Applesoft BASIC was included in the ROMs all Apple II models from the Apple II
Plus forward, and eventually became the platform for far more programs than Integer BASIC. However, loading the Integer BASIC language from floppy disk is possible even on the latest models of the Apple II line, should the need or desire arise.
Integer BASIC's speed advantage was partly because floating-point calculations are more complex and thus inherently slower on the Apple's 6502
CPU than binary calculations. That CPU doesn't have a hardware floating point unit, so all floating point has to be performed indirectly, in software. Applesoft BASIC uses floating point for all numerical operations, even in cases where integer would suffice. The speed advantage was also partly due to some syntax checking being performed by Integer BASIC at entry-time, as well as numbers being converted to binary
form at that time, rather than these things being done at run-time. (A popular speed optimizing technique in most interpreted BASICs — including Applesoft — is to put all frequently used constants into variables
, because fetching the variable's value is faster than converting a number from text — a difference which becomes significant, given perhaps hundreds of iterations. This method is superfluous in Integer BASIC.)
programs, line by line, which were entered into memory. This was of course far easier than looking up the corresponding opcode
s in machine language and typing those in. These ROMs also included an interpreter for a 16-bit bytecode
language, called SWEET16
, which was very simple, compact, and worthy of study. These two features, some cassette tape
I/O
routines, and a few seldom-used floating point math routines (which existed in the Integer BASIC ROMs but weren't integrated into the BASIC language) were removed in the transition from the Integer BASIC ROMs to the Apple II Plus ROMs, in order to accommodate the larger size of the Applesoft BASIC interpreter.
, it was possible (at the expense of clearing the current BASIC program from memory) to switch between Applesoft BASIC and Integer BASIC by typing either INT (to enter Integer BASIC) or FP (to enter Applesoft BASIC)—provided, of course, that the requested language was either in ROM or loaded into RAM.
There was also a plug in board available that could be installed into slot 0 that allowed the user to switch between the on board or external ROMS.
The command-line prompt for Integer BASIC was a right-facing arrowhead (greater-than symbol) (>). (Applesoft's prompt was a right square bracket (]), giving the user a clear indication which BASIC they were using.)
In all systems, pressing the right arrow key, while not in escape mode, would pick up the character under the cursor, allowing on-screen text to be effectively retyped into the input buffer.
There were third party programs — for example PLE, GPLE from Synergistic Software
and later Beagle Bros
, and GALE — which offered more powerful and programmer-friendly editing facilities.
Steve Wozniak
Stephen Gary "Woz" Wozniak is an American computer engineer and programmer who founded Apple Computer, Co. with Steve Jobs and Ronald Wayne...
, was the BASIC
BASIC
BASIC is a family of general-purpose, high-level programming languages whose design philosophy emphasizes ease of use - the name is an acronym from Beginner's All-purpose Symbolic Instruction Code....
interpreter
Interpreter (computing)
In computer science, an interpreter normally means a computer program that executes, i.e. performs, instructions written in a programming language...
of the Apple I
Apple I
The original Apple Computer, also known retroactively as the Apple I, or Apple-1, is a personal computer released by the Apple Computer Company in 1976. They were designed and hand-built by Steve Wozniak. Wozniak's friend Steve Jobs had the idea of selling the computer...
and original Apple II
Apple II
The Apple II is an 8-bit home computer, one of the first highly successful mass-produced microcomputer products, designed primarily by Steve Wozniak, manufactured by Apple Computer and introduced in 1977...
computers. Originally available on cassette, then included in ROM
Read-only memory
Read-only memory is a class of storage medium used in computers and other electronic devices. Data stored in ROM cannot be modified, or can be modified only slowly or with difficulty, so it is mainly used to distribute firmware .In its strictest sense, ROM refers only...
on the original Apple II computer at release in 1977, it was the first version of BASIC used by many early home computer
Home computer
Home computers were a class of microcomputers entering the market in 1977, and becoming increasingly common during the 1980s. They were marketed to consumers as affordable and accessible computers that, for the first time, were intended for the use of a single nontechnical user...
owners. Thousands of programs were written in Integer BASIC.
Little Brick Out
Steve Wozniak, who had earlier been involved with AtariAtari
Atari is a corporate and brand name owned by several entities since its inception in 1972. It is currently owned by Atari Interactive, a wholly owned subsidiary of the French publisher Atari, SA . The original Atari, Inc. was founded in 1972 by Nolan Bushnell and Ted Dabney. It was a pioneer in...
in the development of the original version of Breakout, set as an internal goal in the design of the Apple II computer to be able to faithfully reproduce that game, using only BASIC instructions. This is seen in the design of the "low-res" graphic modes and making the Apple II one of the first microcomputers to use color graphics. This design goal was realized with the program "Little Brick Out" when it was demonstrated at a meeting of the Homebrew Computer Club
Homebrew Computer Club
The Homebrew Computer Club was an early computer hobbyist users' group in Silicon Valley, which met from March 5, 1975 to December 1986...
in 1976. It should also be noted that Wozniak did not have any software development tools for the 6502
MOS Technology 6502
The MOS Technology 6502 is an 8-bit microprocessor that was designed by Chuck Peddle and Bill Mensch for MOS Technology in 1975. When it was introduced, it was the least expensive full-featured microprocessor on the market by a considerable margin, costing less than one-sixth the price of...
processor other than an assembly language
Assembly language
An assembly language is a low-level programming language for computers, microprocessors, microcontrollers, and other programmable devices. It implements a symbolic representation of the machine codes and other constants needed to program a given CPU architecture...
reference manual, and instead wrote out the software with pen and paper and then hand assembled the instructions into raw machine code for the 6502.
Relationship to Applesoft BASIC
The most frequently cited flaw of Integer BASIC was, as one might expect from the name, that its variables were all 16-bit16-bit
-16-bit architecture:The HP BPC, introduced in 1975, was the world's first 16-bit microprocessor. Prominent 16-bit processors include the PDP-11, Intel 8086, Intel 80286 and the WDC 65C816. The Intel 8088 was program-compatible with the Intel 8086, and was 16-bit in that its registers were 16...
integers
Integer (computer science)
In computer science, an integer is a datum of integral data type, a data type which represents some finite subset of the mathematical integers. Integral data types may be of different sizes and may or may not be allowed to contain negative values....
and it was very difficult to write a program that could do calculations using floating point
Floating point
In computing, floating point describes a method of representing real numbers in a way that can support a wide range of values. Numbers are, in general, represented approximately to a fixed number of significant digits and scaled using an exponent. The base for the scaling is normally 2, 10 or 16...
numbers, or even integers outside of the range -32768 to +32767. It was therefore very difficult to write financial or math programs.
Apple Computer
Apple Computer
Apple Inc. is an American multinational corporation that designs and markets consumer electronics, computer software, and personal computers. The company's best-known hardware products include the Macintosh line of computers, the iPod, the iPhone and the iPad...
licensed a more full-featured (but also much slower) BASIC from Microsoft
Microsoft
Microsoft Corporation is an American public multinational corporation headquartered in Redmond, Washington, USA that develops, manufactures, licenses, and supports a wide range of products and services predominantly related to computing through its various product divisions...
soon after the Apple II was released in 1977, introduced some tweaks, named it Applesoft BASIC
Applesoft BASIC
Applesoft BASIC was a dialect of Microsoft BASIC supplied with the Apple II series of computers. It superseded Integer BASIC and was the BASIC in ROM in all Apple II series computers after the original Apple II model. It was also referred to as FP because of the command used to invoke it instead...
, and included the second version of it in the ROMs of the Apple II Plus, which was released in [1979]. Integer BASIC was relegated to a file on the system floppy disk
Floppy disk
A floppy disk is a disk storage medium composed of a disk of thin and flexible magnetic storage medium, sealed in a rectangular plastic carrier lined with fabric that removes dust particles...
that Apple II Plus users could load into a RAM card for backward compatibility
Backward compatibility
In the context of telecommunications and computing, a device or technology is said to be backward or downward compatible if it can work with input generated by an older device...
, if needed. Applesoft BASIC was included in the ROMs all Apple II models from the Apple II
Apple II
The Apple II is an 8-bit home computer, one of the first highly successful mass-produced microcomputer products, designed primarily by Steve Wozniak, manufactured by Apple Computer and introduced in 1977...
Plus forward, and eventually became the platform for far more programs than Integer BASIC. However, loading the Integer BASIC language from floppy disk is possible even on the latest models of the Apple II line, should the need or desire arise.
Integer BASIC's speed advantage was partly because floating-point calculations are more complex and thus inherently slower on the Apple's 6502
MOS Technology 6502
The MOS Technology 6502 is an 8-bit microprocessor that was designed by Chuck Peddle and Bill Mensch for MOS Technology in 1975. When it was introduced, it was the least expensive full-featured microprocessor on the market by a considerable margin, costing less than one-sixth the price of...
CPU than binary calculations. That CPU doesn't have a hardware floating point unit, so all floating point has to be performed indirectly, in software. Applesoft BASIC uses floating point for all numerical operations, even in cases where integer would suffice. The speed advantage was also partly due to some syntax checking being performed by Integer BASIC at entry-time, as well as numbers being converted to binary
Binary file
A binary file is a computer file which may contain any type of data, encoded in binary form for computer storage and processing purposes; for example, computer document files containing formatted text...
form at that time, rather than these things being done at run-time. (A popular speed optimizing technique in most interpreted BASICs — including Applesoft — is to put all frequently used constants into variables
Variable (programming)
In computer programming, a variable is a symbolic name given to some known or unknown quantity or information, for the purpose of allowing the name to be used independently of the information it represents...
, because fetching the variable's value is faster than converting a number from text — a difference which becomes significant, given perhaps hundreds of iterations. This method is superfluous in Integer BASIC.)
The Mini-Assembler and other auxiliary firmware
The Integer BASIC ROMs also included a "Mini-Assembler" that let programmers type assembly languageAssembly language
An assembly language is a low-level programming language for computers, microprocessors, microcontrollers, and other programmable devices. It implements a symbolic representation of the machine codes and other constants needed to program a given CPU architecture...
programs, line by line, which were entered into memory. This was of course far easier than looking up the corresponding opcode
Opcode
In computer science engineering, an opcode is the portion of a machine language instruction that specifies the operation to be performed. Their specification and format are laid out in the instruction set architecture of the processor in question...
s in machine language and typing those in. These ROMs also included an interpreter for a 16-bit bytecode
Bytecode
Bytecode, also known as p-code , is a term which has been used to denote various forms of instruction sets designed for efficient execution by a software interpreter as well as being suitable for further compilation into machine code...
language, called SWEET16
SWEET16
SWEET16 is an interpreted "byte-code" language invented by Steve Wozniak and implemented as part of the Integer BASIC ROM in the Apple II series of computers...
, which was very simple, compact, and worthy of study. These two features, some cassette tape
Compact Cassette
The Compact Cassette, often referred to as audio cassette, cassette tape, cassette, or simply tape, is a magnetic tape sound recording format. It was designed originally for dictation, but improvements in fidelity led the Compact Cassette to supplant the Stereo 8-track cartridge and reel-to-reel...
I/O
Input/output
In computing, input/output, or I/O, refers to the communication between an information processing system , and the outside world, possibly a human, or another information processing system. Inputs are the signals or data received by the system, and outputs are the signals or data sent from it...
routines, and a few seldom-used floating point math routines (which existed in the Integer BASIC ROMs but weren't integrated into the BASIC language) were removed in the transition from the Integer BASIC ROMs to the Apple II Plus ROMs, in order to accommodate the larger size of the Applesoft BASIC interpreter.
Switching between BASICs
When running Apple DOSApple DOS
Apple DOS refers to operating systems for the Apple II series of microcomputers from late 1978 through early 1983. Apple DOS had three major releases: DOS 3.1, DOS 3.2, and DOS 3.3; each one of these three releases was followed by a second, minor "bug-fix" release, but only in the case of Apple DOS...
, it was possible (at the expense of clearing the current BASIC program from memory) to switch between Applesoft BASIC and Integer BASIC by typing either INT (to enter Integer BASIC) or FP (to enter Applesoft BASIC)—provided, of course, that the requested language was either in ROM or loaded into RAM.
There was also a plug in board available that could be installed into slot 0 that allowed the user to switch between the on board or external ROMS.
The command-line prompt for Integer BASIC was a right-facing arrowhead (greater-than symbol) (>). (Applesoft's prompt was a right square bracket (]), giving the user a clear indication which BASIC they were using.)
Editing
The editing method for Integer BASIC (actually part of the system monitor's line-input subroutine) was a slightly more primitive version of the method available in the Apple II Plus firmware. Pressing Escape followed by A, B, C, or D would move the cursor right, left, down, or up, respectively. It was necessary to press Escape each time — unlike with the later Escape K, J, M, and I (Apple II Plus and later) and Escape right, left, down, up (Apple IIe and later). Each successive version supports all previous methods; for example, even on the Apple IIe, one could press Escape then A and move just one space. If Integer BASIC is loaded from a DOS 3.3 disk into an Apple II Plus or newer model, it uses newer monitor ROM code (either the one from the Apple II Plus or the native version built into the computer, depending on the DOS version). Thus the newer Escape codes are available in this configuration.In all systems, pressing the right arrow key, while not in escape mode, would pick up the character under the cursor, allowing on-screen text to be effectively retyped into the input buffer.
There were third party programs — for example PLE, GPLE from Synergistic Software
Synergistic Software
Northwest Synergistic Software is a contract software developer and a former video game developer. Founded in 1978 under the name Synergistic Software, the company published some of the earliest available games and applications for the Apple II family of computers...
and later Beagle Bros
Beagle Bros
Beagle Bros was a software company that specialized in creating personal computing products that were both useful and whimsical. Their primary focus was on the Apple II family of computers.-History:...
, and GALE — which offered more powerful and programmer-friendly editing facilities.
External links
- INTEGER BASIC Reference – From Landsnail.com's "Apple II Programmer's Reference" website