Apple Integer Basic

from Wikipedia, the free encyclopedia

The Apple Integer BASIC is the BASIC - interpreter of the Apple I - invited there by the cassette - and the original Apple II model modeling - there in the ROM permanently installed and supplied with the computer at the factory. The syntax and semantics of the Integer-BASIC language are based on HP-BASIC, the BASIC dialect developed by the Hewlett-Packard company in the 1970s; the Integer-BASIC-Interpreter itself is, however, a completely new creation.

History of origin

When Apple co-founder and developer Steve Wozniak designed the Apple I , small computers had neither a monitor nor a user interface; Competing devices such as the Altair 8800 brought with them at best rudimentary input and output routines; they were usually programmed byte for byte in machine language using toggle switches . Wozniak found out about the BASIC interpreter that Bill Gates had written for the Altair at the Homebrew Computer Club ; but this was not usable for the Apple I because the Altair BASIC only ran on an 8080 processor and not on the 6502 processor of the Apple I. Woz wanted to do the same to Gates and be the first to develop a BASIC for the 6502 processor, although he was actually more at home in the Fortran programming language . As a further impetus he gives the book "101 BASIC Computer Games" by David H. Ahl.

Since Wozniak was actually a hardware developer and had little knowledge of software development, he approached the project intuitively: he analyzed manuals for HP-BASIC and derived a syntax for his BASIC interpreter. He decided to keep the language simple: Integer BASIC could only deal with 16-bit integers, he omitted floating point arithmetic . He needed about four months of development and first coded the interpreter in a notebook and then entered it byte by byte. A small monitor program for machine language was also part of the code. As part of the Integer BASIC, Wozniak also implemented a small but versatile virtual machine called "Sweet 16", which emulated a fictitious 16-bit processor with 16 registers in a few hundred bytes of machine code. Many of the interpreter's operations can be formulated much more compactly in this 16-bit pseudocode than in native 6502 code, so that the overall memory requirement was significantly reduced.

Wozniak later described the development of the Integer BASIC as the greatest technical challenge of his entire professional life. The entire code fit together with the ROM routines for screen display, keyboard control etc. in 8 kB memory.

Integer BASIC was not compatible with the BASIC dialect from Microsoft, which was based on BASIC from the computer manufacturer DEC . According to his own statements, Wozniak only discovered this when he tried to transfer the programs from "101 BASIC Computer Games" to the Apple and failed. His first program was to adapt the Star Trek game to his computer.

Further development

For the Apple II, which appeared in 1977, Wozniak expanded the Integer-BASIC with some graphics commands for controlling the new LoRes graphics mode and the paddles ; in doing so, he again proceeded more practically, he implemented exactly the commands that he needed to be able to write a usable breakout clone in BASIC. At that time, Apple was still of the opinion that the high-resolution HiRes graphics mode would be better left to the machine language programmers, since an interpreted BASIC on a 1 MHz computer is in principle too slow to write appealing HiRes programs with it. Only gradually did the realization gain acceptance that many users were more interested in simple than fast graphics programming.

As a supplement to Integer BASIC for the Apple II, Apple soon offered an extension called "Programmer's Aid # 1", which consisted of another ROM chip. This provided support for sound and music, for high-resolution graphics including a simple vector graphic , and a number of tools e.g. B. to test the memory chips of the computer, to merge two programs, to renumber program lines and so on. However, all of these options were implemented using machine language subroutines, so they could only be called using cryptic CALL commands and were therefore not very well integrated into the existing BASIC. More chips of this type, with other focuses such as B. Business or Science, were considered, but no longer appeared.

As early as the end of 1977, Apple offered a BASIC interpreter purchased from Microsoft in addition to the built-in Integer-BASIC because its own attempts at further development had not been fruitful: Wozniak was the only one who really understood the Integer-BASIC code, but he was at the Development of the new floppy disk drive for which Apple is even more urgently needed. Applesoft BASIC , derived from Microsoft BASIC and supplemented by some Apple-specific commands, was significantly slower and less economical in memory consumption, but it offered the sorely missed floating point arithmetic and commands for displaying the high-resolution "HiRes" graphics mode of the Apple II with 280 x 192 pixels - Integer-BASIC was only able to control the "LoRes" graphic mode with 40 x 48 pixels without detours via machine language.

Initially, Applesoft BASIC was available as a program cassette, soon afterwards also on floppy disk and as a ROM plug-in card, so that precious RAM memory was no longer required. Many users soon switched to taking the ROM chips out of this plug-in card and inserting them directly into the motherboard instead of the integer BASIC chips. The greater popularity of the Applesoft BASIC was finally recognized by Apple: With Applesoft BASIC on the motherboard (and larger memory), Apple sold the computer as the Apple II + from 1979 onwards . With this and all later models of the Apple II series, however, Integer BASIC, including "Programming Aid No. 1", can still be reloaded from floppy disk if required.