💾 Archived View for gemi.dev › apple-ii-history › 16.gmi captured on 2024-08-18 at 22:26:56. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2023-01-29)
-=-=-=-=-=-=-
Nearly everyone reading this is already a programmer, on one level or another. Even if you don't know a "GOTO" from a "STA $C030", you already know how to program something. For the act of "programming" is nothing more than giving instructions to a non-human device to have it carry out what you want it to do. The device that most of you already know how to program is your automobile. The act of giving those instructions may not seem like programming to "you"; nevertheless in its strictest sense, programming it is. You want the car to go forward? Set the transmission to "D". Go in reverse? Use "R". Of course, the programming needed to operate an automobile is quite simple, and cannot be done in more than one step at a time. An example of a device that is more complicated to program but does let you store up several instructions in advance is a VCR. On the VCR you instruct it to record a television broadcast that starts at 7:00 pm and ends at 8:30 pm, on channel 6. The more sophisticated VCR's can have several programs set up in advance. If you can operate a VCR in this fashion (which is, admittedly, not always as easy as I have described), you are a programmer.
When it comes to the microcomputer, the process of programming (giving it instructions on how to carry out a task) is somewhat more complicated. This is primarily because the computer is far more flexible in its ability to accept instructions and carry them out than is an automobile or VCR. Devices attached to a computer can be manipulated by a program to do something useful (print a letter several times, or perhaps read the outside temperature and sound an alarm if it drops too low). This flexibility, plus the speed at which a computer can execute its instructions, makes it a powerful tool for doing things that have previously taken much more effort and time. And as a project becomes more sophisticated, so also must the programming acquire a similar level of sophistication. The rate at which computers, including the Apple II, have increased in capacity during the past fifteen years has made it possible to design programs that can do things that were not even dreamed possible back in the days of the 4K Integer BASIC machine.
An example of programming evolution on the Apple II was given during Kansasfest in July of 1991. To fully appreciate this narrative, you need to know a little about an old Integer BASIC program, APPLEVISION. This was found on the DOS 3.2.1 System Master disk, and was a fun little display that showed off the use of hi-res graphics. It began by creating a simple line drawing of a room, with a picture on the wall ("HOME SWEET HOME") and a television set. On the screen of the TV appeared a man who danced to the tune of "Turkey In The Straw", which sounded on the built-in speaker. It ran repeatedly, until the user interrupted the program. It was fascinating at the time, since there was nothing in the program text that showed off exactly "how" the hi-res effects were accomplished. But things have gotten a bit more complex as time has gone by:
Roger Wagner's keynote address featured a history of hypermedia which Roger set into action and left to run as he wandered offstage. The history began with Bob Bishop's classic APPLEVISION, done in black and white on the original Apple II. Progressive screens enhanced the APPLEVISION image using subsequent incarnations of Apple II graphics (single hi-resolution, double hi-resolution, and the IIGS's Super Hi-Resolution modes). Finally, thanks to a laserdisc player under HyperStudio's control and a video overlay card, Roger's image appeared within the television's screen and spoke to the audience, completing the introduction before turning the presentation back to Roger (returning from offstage). [1]
To follow the programming progress that has made such magic possible, we will begin with the first two built-in high-level languages for the Apple II, Integer BASIC and Applesoft, and move on to a briefer discussion of some of the other languages that have been available over the years. Next will be a summary of various 6502 and 65816 assemblers that Apple programmers have used over the years. Finally, I will present an introduction to "hyper-programming".
A programming language has the standards to translate "what I want" into commands that the computer understands. To do so, it must take some human language and convert it into the binary dialect of the computer on which it is executed.
Computer languages usually come in one of two different types: "interpreted" and "compiled". A language that functions as an interpreter takes the text of the program and translates it at the time of execution into commands the computer can understand. A compiled program, on the other hand, has already had the program text translated into executable code "before" it is run, usually including some extra code needed to carry out necessary functions of input, output, and calculations. As such, an interpreted program usually runs more slowly, but has the advantage of being easier to modify and re-run without the delay of first re-compiling. A compiled program will ordinarily run faster, but may use more memory than an equivalent interpreted program.
Languages are also given the designation of being "high-level" or "low-level", depending on how close they are to the base language of the computer on which they run. The lowest level of computer programming is at the level of the bytes understood as commands by the microprocessor. This "machine language" is typically not very understandable to humans. A low-level language more often used by programmers is "assembly language". This uses commands somewhat more understandable ("LDA $24" means "load the accumulator with the contents of memory location $24") and are then assembled (actually compiled) it into machine-readable code. Assembly language is very powerful, since it works on the byte level of the computer. However, as a low-level language it can be very complicated and requires an intimate understanding of the function of the computer.
As a language becomes more "high-level", it is easier for humans to read, but requires more effort from its interpreter or compiler to translate it into the native language of the computer.
This was the first language available for general use on the Apple II (aside from assembly, which will be dealt with later). Most of the details concerning its development have already been covered in Chapter 3 of this History. It was a quick, compact language, and its creation was an example of programming directly in machine language (since Steve Wozniak, the author, had no assembler available to use). Its disadvantage was the lack of easy access to floating point operations, and it lacked some string handling functions. Apple II users, especially those who wanted to produce programs that could be used in business applications, wanted something more powerful to use.
Despite its limitations, Integer BASIC was a language that had a fanatically loyal following. For those thousands who purchased Apple II's from June 1977 to June 1979, this was the only programming language available, and it took on a status similar to that of a beloved first-born child. Games, utilities, and even some simple business-use programs were written using Wozniak's hand-assembled masterpiece, and those who followed the pages of "Call-A.P.P.L.E." magazine learned much about the internals of the language. With the disassembler built into the Monitor, people tore Integer BASIC apart to learn how it worked, and to make it work better. Val Golding, the editor of "Call-A.P.P.L.E.", even wrote a series of columns in 1979 entitled "So Who Needs Applesoft?" These articles showed how to simulate some of the more advanced features of Applesoft in this older BASIC. A.P.P.L.E. even sold (under license agreement with Apple Computer) "Integer BASIC +", a relocatable RAM version of the original ROM BASIC. It had all the features of the original language, plus a "USER" command, the ability to easily do four direction scrolling on the text and lo-res screens, easy printing of ASCII characters, and improved error handling. [2]
Apple never released a comprehensive reference manual for Integer BASIC. The only manual available for it was primarily a tutorial (and a general introduction to using a computer). The "Apple II BASIC Programming Manual" didn't even call it "Integer BASIC", but referred to the language as "Apple BASIC". It gave most of its programming examples in the form of segments of a graphics and sound demo that created a lo-res ball bouncing off the sides of the screen. [3]
With the many programs available that were written in Integer BASIC, it was almost a necessity for Apple to offer a means for Apple II Plus users to be able to run the older software. The Integer Firmware card made this "backward compatibility" possible. This was especially important in the early days of the II Plus, when there was little new software available to use with Applesoft.
Back in 1975 and 1976, Microsoft was producing BASIC interpreters for nearly every microprocessor that was produced, in hopes of licensing or selling their BASIC to those who built a computer around that chip. In mid-1976, Microsoft's first employee, Marc McDonald, was given the job of creating a version of BASIC that would run on the then-new 6502 microprocessor, even though there not yet any computers that used that processor. They became aware of Steve Wozniak's efforts in designing his 6502 computer (the Apple-1), and one of Microsoft's programmers called Steve Jobs to see if he would be interested in a BASIC language for this computer. Jobs told him that they already had a BASIC (remember that Wozniak had been writing BASIC interpreters before he even had a computer on which to run them), and if they needed a better one, they could "do it themselves over the weekend".
Even without a potential customer for this product, McDonald worked on this BASIC, using a modified 6800 microprocessor simulator (the 6800 had an instruction set that was similar to the 6502). For several months Microsoft had their 6502 BASIC sitting on a shelf, unwanted and unused. But by October 1976 they finally had a contract to put this interpreter into the new Commodore PET computer that was being designed. This would ultimately become the first time that BASIC was included with a computer built into the ROM, rather than being loaded from a paper tape, disk, or cassette. However, the contract Microsoft had with Commodore was no good to them at that time, as far as income was concerned; it stipulated that they would not be paid until some time in 1977, when the computer was to be finished and ready to ship. With income and cash reserves running dangerously low, Microsoft was given a reprieve by none other than Apple Computer. [12]
Apple was receiving increasing numbers of requests by users of the Apple II for a floating point BASIC. Integer BASIC (which Wozniak had also at one time called "Game BASIC") worked well for many purposes, and a skilled programmer could even make use of the floating point routines that were included in the ROM of Integer BASIC. [15] However, the average Apple II user was not satisfied with Integer BASIC, especially as it made them unable to easily implement business software (where the number to the right of the decimal point is as important as the one to left). Wozniak tried to make modifications to his Integer BASIC to make use of the floating point routines, but at that time he was also hard at work on designing the Disk II interface card, and his efforts on creating a floating point BASIC fell further and further behind. Consequently, Apple's management decided to go back to Microsoft and license the 6502 floating point BASIC that had been offered to them in 1976.
In August 1977, Apple made a $10,500 payment to Microsoft for the first half of a flat-fee license that they were able to negotiate. Typically, Microsoft would license its BASIC on a royalty basis; they would be paid a set fee for every copy of BASIC that went out the door -- in this case, with every computer that was sold. The fact that Microsoft was willing to concede and let Apple license their 6502 BASIC on a flat-fee basis is a reflection of the financial straits that Microsoft was under. [13] The version Apple licensed was almost identical to the MITS extended BASIC that Microsoft had previously written for the Altair 8800. [4], [5] At Apple, Randy Wigginton was assigned the job of incorporating into Microsoft's BASIC the graphics commands that were unique to the Apple II.
This BASIC was named "Applesoft", and was released in November of 1977 on cassette. It was loaded as a 10K program that looked to the computer just like an Integer BASIC program, though only a small part of it really was. To make it easy to load and start from cassette, the Applesoft interpreter was attached to the end of a short Integer BASIC program. When the Integer program was run, it poked some values into memory and jumped to the start of the machine language section, which relocated the Applesoft interpreter to the lower part of memory (at $800), just after the memory that held the screen display.
Using this version of Applesoft (which later became known as Applesoft I) could be frustrating. It took several minutes to load from the cassette tape, and it was not dependable. If the wrong key was pressed while entering or running an Applesoft program, the program that was being run could be wiped out, and the Applesoft interpreter itself would have to be reloaded from cassette. However, few users knew how to make use of the floating point routines that Wozniak had written into the Integer ROM, so this unreliable Applesoft BASIC became the only practical means of doing floating point math on the Apple II.
Aside from the reliability issue, another difficulty with Applesoft involved hi-resolution graphics. Although the Apple II was capable of displaying it, the Applesoft interpreter extended up into the memory used by the hi-res screen, and so prevented its use. Furthermore, this early version had no built-in commands to manage hi-res graphics. [5]
Applesoft I came with a manual that was 8 1/2 inches by 11 inches in size, and sported a blue cover with square glued binding. [6] This came to be known as the "blue book" (recall that the reference book for the computer itself was affectionately known as the "red book"). When starting the interpreter after loading it from the cassette, a screen was display announcing that Applesoft was copyright 1977 by Apple and Microsoft. It then asked the user for the memory size of his computer, and gave options of allowing either LET and REM statements "or" the use of lo-res graphics. The names of the lo-res graphics commands were very different from those that existed in Integer BASIC (and in the later versions of Applesoft). The commands were:
PLTG = Go to lo-res graphics mode TEX = Go to text mode PLTC N = Set color to N (0-15) PLTP X,Y = Plot square at X,Y PLTH X1,X2,Y = Plot horizontal line from X1 to X2 at Y PLTV Y1,Y2,X = Plot vertical line from Y1 to Y2 at X
There was a note about these commands in the reference card included with Applesoft I that warned about using graphics coordinates only between 0 and 39, or a program could "self-destruct". Apparently it lacked the error checking that could prevent the plotting of lines from spilling over into the text of the Applesoft program itself. [6], [7]
The A.P.P.L.E. user group published a patch in 1978 that allowed programmers to avoid the question about using LET and REM statements versus lo-res graphics, and use the graphics only. The author of the patch pointed out that the LET statements were not necessary ("A = 3" worked just as well as "LET A = 3"). The REMark statements could be simulated by putting them at the end of a GOTO line (where they were ignored by the interpreter), and the GOTO could just jump to the following line:
530 GOTO 540: REM LINE 540 SETS VAR N. 540 N = 2 ]█
Additional patches were made available for some of the other bugs found in Applesoft I. [8]
In spring 1978, Randy Wigginton and some others at Apple made some needed revisions to Applesoft. Using a cross-assembler running on a North Star Horizon (Z-80) microcomputer, they fixed the known bugs and added other commands to control features unique to the Apple II. These commands included the ones needed to draw and manipulate hi-res graphics. Also, the lo-res graphics commands were renamed to be more consistent with the equivalent commands in Integer BASIC (GR, HLIN, VLIN, etc.) This version was called "Applesoft II", and eventually it was available in five forms: Cassette RAM and Diskette RAM (which loaded to the same memory locations that interfered with hi-res graphics as did Applesoft I), Firmware card ROM, Language card RAM, and finally main board ROM (in the Apple II Plus).
When Applesoft II was started up from cassette or diskette versions, the display screen now showed a copyright date of 1978 by Apple Computer, Inc., and 1976 by Microsoft (which may be either their copyright date for the original Microsoft BASIC, or possibly for Microsoft's first 6502 version). [6] This RAM version of Applesoft II used memory from $800-$2FFF, and the Applesoft BASIC program itself was loaded beginning at $3000. When the versions that came on ROM and for the Language Card RAM were released, the BASIC program could load at $800, and much more memory was available for it. Some of this extra space (in high memory) was reclaimed by DOS when the Disk II was released, however. [5]
Applesoft in the original IIe was unchanged from the II Plus version. When the IIc was introduced in 1984, however, Apple programmers had cautiously made a few useful changes to the language:
When the Apple IIe Enhanced ROMs were made available, Applesoft in those ROMs had undergone some similar modifications. All the above IIc changes were added, with the exception that double lo-res graphics capability was "not" added (lack of ROM space), and the cassette I/O commands were "not" removed (since the cassette input and output port was still present).
The version of Applesoft on the Apple IIGS closely resembled The Apple IIc variant, the only exception being a fix of the double lo-res PLOTting bug. However, a bug in the SCRN function that applied to double lo-res mode was" not" fixed. No changes to Applesoft from the IIc version appeared in the Apple IIc Plus. [9]
The manuals written for Applesoft II were far more comprehensive than either the older "Blue book" or the Integer BASIC manual. It gave not only programming examples for each of the commands, but included much more information about the various ways in which each Applesoft statement could be used. It also mentioned some of the differences between Applesoft and Integer (for those who wanted to convert their older programs), and gave a little information about the internals of Applesoft to aid in creating machine language additions to the language. Curiously, the manuals that have been reprinted even as late as 1990 by Addison-Wesley have included an odd cautionary note to programmers. In a section in the index about "reserved words" (words reserved as Applesoft commands), it advises against using "XPLOT" as a variable name, stating that "it is a reserved word that does not correspond to a current Applesoft statement." What is apparently meant by this comment is that at one time Apple intended to extend the language and add another command "XPLOT" to it, probably working with HPLOT in the same way that XDRAW complements DRAW in doing hi-res graphics. Examination of the command table within the Applesoft interpreter shows there is"no" entry labeled "XPLOT", and a disassembly of the interpreter shows "no" preliminary code to support the command. Somehow this precaution persisted to the present day and has never been removed, even though it is extremely unlikely that Applesoft will ever be upgraded. [10]
Particularly helpful for programmers was the foresight to include a simple extension called the "ampersand hook". If Applesoft came across the "&" symbol while interpreting a line, it jumped to a known location in memory and left it to the programmer to insert the correct code to add a machine language extension to the language. With the publication of important information about the internals of Applesoft in 1980, assembly language programmers could now add statements to do things that could not be done with the language as it was originally created. Music, extended graphics, IF-THEN-ELSE logic, and even the missing "XPLOT" command could be added to the language. The only limits were the author's imagination (and available memory).
A significant part of the story of Applesoft and Apple Computer occurred in March of 1985. At this time, Apple was still struggling to get the new Macintosh and Lisa computers to sell well enough to make it on their own. The company was still depending heavily on the continued strong sales of the Apple II line, specifically the Apple IIe and IIc computers. An ominous event was looming on the horizon, however, and it was one more way in which Apple and Microsoft were beginning to come into conflict with one another. The ten year license on Applesoft BASIC, which was actually Microsoft's old 6502 BASIC (modified by Randy Wigginton) was due to expire in 1987, and if Apple could not renew the license they could not continue to sell "any" version of the Apple II. By this time, an Apple II was "defined" by the existence of Applesoft "in ROM"; if Apple could not continue to use Applesoft in the popular Apple II line, there would be no more Apple II. It would be unthinkable to revert back to the product that Apple "did" own (Integer BASIC) at that late date. And without the Apple II to provide a steady income while Macintosh development continued, there just might be no more Apple Computer.
Back in 1977 when Apple was granted the ten-year license for Microsoft's 6502 BASIC, Microsoft was in a much tighter situation financially. In 1985, however, they could ask for and get from Apple quite a bit more. However, rather than making it a financial deal, Microsoft offered to swap a second ten-year license for Applesoft BASIC in exchange for something that Bill Gates had his eyes on: MacBASIC. This product had been in development at Apple for quite a while, and was slowly progressing. But Microsoft had built its original business on supplying BASIC for every computer, and to "not" be the supplier of a BASIC for the Macintosh was inacceptable to Bill Gates. Steve Jobs had no choice but to allow the code for MacBASIC to be given to Microsoft, and Applesoft survived. However, Apple probably got the better end of the deal, since BASIC on the Macintosh never really turned out to be important in the same way that BASIC was in the 1970's and early 1980's. Even Gates admitted that the deal for Applesoft's renewal was not the smartest decision he has ever made. Microsoft could have demanded a high price for Applesoft and Apple would have had no choice but to pay it to them. [14]
Overall, the importance of Applesoft as an influence to productivity on the Apple II cannot be overstated. Since the release of the Apple II Plus in 1979, every variety of Apple II contained Applesoft in virtually an unchanged form. This has made it possible for anybody to write programs that "all" other Apple II users will be able to use, since the language does not have to be purchased or added. If there were thousands of Integer BASIC programs from the two years when Integer Apple II's were produced exclusively, there are hundreds of thousands of Applesoft programs that appeared over that subsequent thirteen years. Even in its later years, it was not uncommon for an applications program to include a configuration module written in Applesoft using the disk commands available with BASIC.SYSTEM in ProDOS. It was often faster to write such a program in BASIC, and the author would know without a doubt that his customer will be able to run it.
In 1979 there were rumors at the West Coast Computer Faire about an enhancement to Applesoft II that was in the works at Apple. It would possibly be called Applesoft 3, and would be as much of an enhancement over Applesoft II as that version was to Applesoft I. Supposedly it was intended to merge DOS and BASIC, and would include such powerful functions as IF-THEN-ELSE, PRINT USING, WINDOW, and VIEW PORT. It was predicted to be a RAM version only, and would be about 24K in size. Knowing the events that actually followed, this rumored BASIC was probably the "Business Basic" released with the Apple III, rather than an enhancement for the Apple II. [11]
---