Integer BASIC

Integer BASIC, written by Steve Wozniak, was the BASICinterpreter 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.[1] Thousands of programs were written in Integer BASIC.

Wozniak would later describe his language as "intended primarily for games and educational uses".[3] His only experience with BASIC was the few days with the time-sharing system in high school, and without access to another Wozniak had to write the language—which he called "GAME BASIC"—on paper, hand assembling the language into 6502 machine code. He studied an HP BASIC manual he borrowed from work, not knowing that the syntax of HP's version of the language was very different from DEC BASIC, the language of BASIC Computer Games, and Altair BASIC. To save time, and because games and logic simulations emphasized integer math, Wozniak removed floating-point routines from GAME BASIC. Without any training on how to write a computer language, he used his HP experience to implement a stack machine to interpret expressions.[2][4]

Wozniak had previously developed Breakout for Atari in hardware. He hoped to implement the game in his BASIC, so while designing the Apple II computer Wozniak added support for color graphics, game paddles, and sound to it and to his language, now named Integer BASIC. As the language needed 4K RAM, he made that the minimum memory for the Apple II. While demonstrating the computer and Little Brick Out to Steve Jobs Wozniak quickly changed the colors his game used by altering the source code. Besides proving that software was much more flexible than hardware, they both realized that now anyone could create arcade games without having to design it in hardware.[2] Wozniak demonstrated the game at a meeting of the Homebrew Computer Club. He later described it as "the most satisfying day of my life ... It seemed like a huge step to me. After designing hardware arcade games, I knew that being able to program them in BASIC was going to change the world".[5]

Relationship to Applesoft BASIC

When the Apple II was introduced in 1977 Integer BASIC was included in the ROM.[3] The most frequently cited flaw of Integer BASIC was, as one might expect from the name, that its variables were all 16-bitintegers 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, named it Applesoft BASIC, and included the second version of it in the ROMs of the Apple II Plus and later models, 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 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.

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 integer calculations. The 6502 lacked a hardware floating point unit requiring all floating point operations be performed indirectly, in software. Applesoft BASIC uses floating point for all numerical operations, even in cases where integers 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, since fetching the variable's value is faster than converting a number from text — a difference which becomes significant, given perhaps hundreds of iterations. Such methods are superfluous in Integer BASIC.)

The Mini-Assembler and other auxiliary firmware

The Integer BASIC ROMs also included a machine code monitor, "mini-assembler", and disassembler that let programmers create and debug assembly language programs, and an interpreter for a 16-bit bytecode language called SWEET16. Wozniak hand assembled the monitor as the Apple II's first program, then used it to write Integer BASIC.[6][3] The monitor and assembler, SWEET16, some cassette tapeI/O routines, and a few seldom-used floating point math routines (which existed in the Integer BASIC ROMs but were not 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.)

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.

See also

References

^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)...CS1 maint: Extra text (Category:CS1 maint: Extra text)

^ abcWozniak, Steve (2014-05-01). "How Steve Wozniak Wrote BASIC for the Original Apple From Scratch". Gizmodo. Retrieved 2 May 2014.

^Weyhrich, Steven (2001-12-12). "The Apple II". pp. page 3. Retrieved 2007-09-16. The BASIC, which we shipped with the first Apple II's, was never assembled — ever. There was one handwritten copy, all handwritten, all hand-assembled.CS1 maint: Extra text (Category:CS1 maint: Extra text)

This article was sourced from Creative Commons Attribution-ShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and USA.gov, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for USA.gov and content contributors is made possible from the U.S. Congress, E-Government Act of 2002.

Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.

By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a non-profit organization.