||This article needs additional citations for verification. (September 2007)|
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.
Little Brick Out
Steve Wozniak, who had earlier been involved with Atari 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 4096 bytes of 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-bit 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 . 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 of 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.)
The Mini-Assembler and other auxiliary firmware
The Integer BASIC ROMs also included a "Mini-Assembler" that let programmers type assembly language programs, line by line, which were entered into memory. This was of course far easier than looking up the corresponding opcodes in machine language and typing those in. These ROMs also included an interpreter for a 16-bit bytecode language, called SWEET16. 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.
Switching between BASICs
When running 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.)
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.
- Weyhrich, Steven (2001-10-20). "The Apple II". pp. page 2. Retrieved 2007-09-16. "There were also several program cassettes available to purchase (assuming that you had the cassette interface). These included Wozniak's BASIC (which took about 30 seconds to load)..."
- Steil, Michael (2008-07-14). "1200 Baud Archeology: Reconstructing Apple I BASIC from a Cassette Tape". Retrieved 2011-12-07.
- Weyhrich, Steven (2001-12-12). "The Apple II". pp. page 3. Retrieved 2007-09-16. "The [[Integer]] BASIC, which we shipped with the first Apple II's, was never assembled — ever. There was one handwritten copy, all handwritten, all hand-assembled."
- INTEGER BASIC Reference – From Landsnail.com's "Apple II Programmer's Reference" website