💾 Archived View for gemini.spam.works › mirrors › textfiles › apple › aht.14.v1.0 captured on 2022-04-28 at 19:10:32.
⬅️ Previous capture (2020-10-31)
-=-=-=-=-=-=-
APPLE II HISTORY ===== == ======= Compiled and written by Steven Weyhrich (C) Copyright 1991, Zonker Software (PART 14 -- DOS) [v1.0 :: 12 Jan 92] APPLE DOS For a computer to be useful, it must have a means of easy storage and retrieval of data. That storage medium must be both convenient and affordable. In the early days of the AppleII computer, the best that they could achieve was "affordable". The built-in cassette port was the state of the art for personal computers back in 1977; the AppleI computer had a cassette interface available only as an add-on item. But, although a cassette storage system may be inexpensive, it is not very convenient. The simplistic cassette operating system on the AppleII (visual examination of the mechanical index counter on the cassette recorder to know the location of the next program) was downright frustrating to use for many early AppleII owners. Something better was desperately needed. As you may recall from Part 5 of the History, in December of 1977 Steve Wozniak began a crash effort to develop a floppy disk drive for the AppleII computer. To get it ready for the Consumer Electronics Show in January 1978, Wozniak and Randy Wigginton made a very simple disk operating system that would only load files from fixed locations off the disk in response to one-letter commands. But it was not a true disk operating system (DOS); their rudimentary control program would not be flexible enough for efficient and simple use of the disk drive. DISK SYSTEM BASICS To create an operating system that would be both simple to use and yet powerful enough for advanced file manipulations, Apple had much work to do, building on the device driver that Wozniak had written. Among other things, it had to interface well with the BASICs in ROM on the AppleII, and be no more complicated to use than the cassette system. Although Woz's driver routines were efficient in writing and reading data to and from the disk, they could only be used from 6502 assembly language. Designing a disk operating system from scratch is no trivial matter. On one side is the RAM memory in the AppleII, waiting patiently for a useful program to be loaded and executed. On the other side of an electronic bridge (interface card and connecting cable) is the floppy disk and disk drive hardware itself. The control program the Woz wrote could be compared to a narrow rope bridge crossing a chasm; it works, but you can't carry much with you, and it is easy to slip and fall (lose data). A complete DOS is more like a concrete and steel bridge, capable of carrying autos and trucks in both directions over the chasm. Woz's "rope bridge" was a foundation, but there was much work yet to do. A disk drive consists of a recording head that is mechanically moved across the surface of the floppy disk, tracing the radius of the disk from the center to the edge. The disk itself is spinning under the head. This is similar to the stylus on a turntable that plays 33 RPM records (remember those?), but the head on a disk drive can be given a command to move to a different "track" on the spinning disk. Also unlike the turntable, which is a "read-only" device, the head on the disk drive can either reads bits off or write bits onto the disk. To be able to find where data has been stored on a disk, it is "formatted" into a known configuration. A blank disk could be compared to empty land that will be filled with new houses, but currently has no streets, street signs, or house numbers. The initial formatting (called "hard" formatting) of a blank disk is, then, like building the streets and assigning lots for future building. The second part of disk formatting (called "soft" formatting), involves naming the streets, designating addresses, and building houses. In the case of Apple's Disk II, it was designed with 35 concentric circles ("streets") called tracks. Each track is subdivided into 16 segments ("houses") called sectors. Each sector can hold 256 bytes of information. In the hardware system that Wozniak designed, the timing hole near the center of the floppy disk was not used by the hardware to keep track of which sector was passing the head at any particular time. Because of that, it was necessary for the software to identify in a different way where one sector ended and the next sector began. A complicated method was used of specially encoding each of the 256 bytes so they have a standard, recognizable appearance to a program that is controlling the disk drive, plus some other specialized bytes that identify the start and end of a sector. Although it did decrease somewhat the storage capacity of the disk, the cost savings in less complicated hardware compensated for it. DOS 3.1 - STRUCTURE & FUNCTION WITH BASIC With this background, let's get back to tracing the gap between Woz's demo DOS and Apple's first official release, DOS3.1. Worth and Lechner in their book, "Beneath Apple DOS", divided DOS up into four parts according to function and location in memory. When a computer needs an operating system, it's because there is a need to insulate the user from the complexity of trying to control the hardware. Consider the four parts of DOS as layers; as you get closer to the bottom layer, you are closer to the hardware (the raw data on the disk and direct control of the disk drive), but you also increase greatly the difficulty of managing it. The farther up you go, the easier it is to manage things on the disk, but the less direct is the control of the disk data and hardware.<1>,<2> When Wozniak wrote his disk controller (driver) routines, he worked at the deepest layer, directly manipulating the disk hardware and raw data. This involved some complex timing and error checking for reading and writing data to the disk. This section is also where the program lies that erases the disk and creates the sectors and their addresses. In memory, this layer of DOS started at $B800 on a 48K AppleII.<2>,<3> Randy Wigginton wrote a "front end" for Wozniak's controller routines. His part could be considered a thin layer that is part of the lowest layer of disk routines. Together, the two layers made up what came to be known as "RWTS", or "Read/Write Track/Sector". It could do four things only: SEEK (to move the disk arm to the desired track), READ (load a sector from disk into memory), WRITE (save a sector to disk from memory), and FORMAT (discussed above). This layer of DOS, the Disk II driver, started at $B600.<2>,<3> Apple contracted with an outside consultant, Bob Shepardson, to write much of the rest of DOS (though modifications were made Apple programmers Dick Huston and Rick Auricchio).<4>,<5>,<6> Shepardson's group wrote the layers (parts) of DOS that later became known as the "File Manager" and the "Main DOS routines". The File Manager was the next layer in memory above RWTS. It started at $AAC9 in memory, and was responsible for twelve higher level functions that dealt with files and the disk in general. These functions were OPEN, CLOSE, READ, WRITE, DELETE, CATALOG, LOCK, UNLOCK, RENAME, POSITION, INIT (format a disk and create an empty catalog track), and VERIFY. This set of routines, along with RWTS, would be similar to the file PRODOS in the current 8-bit disk operating system. It handled the disk at the file level, but knew nothing about BASIC.<2>,<3> The next layer of code above the File Manager contained the Main DOS Routines. These routines started at $9D00 in memory, and were responsible for interfacing BASIC with the disk. This layer would be similar to the file called BASIC.SYSTEM used today in the ProDOS system. Since neither Integer BASIC nor Applesoft were specifically modified to handle disk commands, this part of DOS kept a constant look at any output PRINTed by BASIC. When a BASIC program was running, DOS looked to see if the character Ctrl-D (hex $04) was printed immediately after a Ctrl-M (carriage return). If that sequence was detected, DOS assumed that the next text printed was a command for it. If a BASIC program was not running, then DOS examined anything typed directly from the keyboard. If it decided that a DOS command had been entered, it would execute that command. If the user typed a command that DOS recognized (such as "RUN PROGRAM" or "SAVE PROGRAM") but which resulted in a disk error, DOS3.1 would generate an error message. On the other hand, if DOS did not recognize the command, it passed it on to the active BASIC for processing. The final, uppermost layer of DOS was not a program code area but a set of memory areas called "buffers". One buffer was used by DOS for each open file. These buffers ordinarily started at $9600 in memory. Here is an example of how the layers of DOS interacted: When a user typed the command "LOAD PROGRAM" at the keyboard, DOS intercepted the statement. The Main DOS Routines determined that it was a legal DOS command. The File Manager was called to 1)OPEN a file named "PROGRAM", 2)READ all the bytes associated with that file into memory starting at a specific location, and then 3)CLOSE the file. The File Manager's OPEN command in turn instructed RWTS where to move the disk read/write head, and in what order to read the correct tracks and sectors to find the contents of the entire file, wherever it happened to be on the disk. Complicated, perhaps, but the only thing the user had to know was how to type "LOAD PROGRAM". Finally, one piece of trivia: Why was the first DOS released for the AppleII called "DOS3.1" rather than "DOS 1.0"? According to Steve Wozniak, it was Bob Shepardson's group that decided on calling it "DOS3". It is unclear why Shepardson decided on "3"; possibly it referred to internal revisions done by Shepardson, or perhaps it was a modification of some DOS routines done for another computer that had used earlier version numbers.<2> (Note: DOS3 was never actually released to the public; that version apparently had a few bugs left to fix, so "DOS3.1" came with the first DiskII drives shipped by Apple to their dealers). DOS 3.1 - MANUAL When originally introduced with the new DiskII drive in 1978, DOS3.1 had very little documentation. Because the demand for the disk drive was so great, the engineers at Apple had worked feverishly to produce enough working drives to begin shipping. They went out, although there was not time to complete a real manual on how to use the disk operating system. They did include a leaflet about some of the commands, but there were still, obviously, complaints. One letter to Apple president Mike Markkula made these blunt comments: "You [expletive deleted]. I bought an Apple with floppy and nobody, I mean nobody, in L.A. or San Diego knows how to use the [thing] for random access files. I really feel 'ripped off.' Everybody talks about this great manual in the sky that is coming out soon??? ... [more expletives]! I need this computer now in my business not next year. [Expletive]. I hope your dog dies."<7> It was not until the release of DOS3.2 in February 1979 that a true reference manual was made available. It was given the unwieldy title, "Disk II Floppy Disk Subsystem Installation and Operating Manual", and subtitled "Apple Intelligent Subsystems (part #030-0011-00)". It was all of 38 pages long, with weak jokes and typos, but not much else of substance. Instruction on how to READ and WRITE text files was given in a mere ten lines, with no programming examples. The EXEC command was given a little more description, but was still unclear to many users. The manual also talked about " *3D0G ". What it didn't say was that this meant that the user was supposed to type "3D0G" from the Monitor prompt (to allow a return to the active BASIC with DOS connected).<8>,<9> DOS 3.1 - FEATURES A catalog of the DOS3.1 System Master disk would produce this output: I 007 HELLO *I 043 APPLESOFT I 016 ANIMALS I 009 COLOR DEMOS *I 004 MASTER.CREATE *B 039 RAWDOS *I 007 COPY *B 007 COPY.OBJ "HELLO" was the startup file executed when the disk was booted. It just displayed the following: DISK II MASTER DISKETTE VERSION 3.1 20-JUL-78 COPYRIGHT 1978 APPLE COMPUTER INC. >_ stopping at the Integer BASIC prompt. "ANIMALS" was an Integer program that gave an example of the use of disk files, and "COLOR DEMOS" was a disk version of a program that had earlier come on cassette. "MASTER CREATE" was a program that could be used to initialize a "master" disk. Using the binary file "RAWDOS", it executed the DOS "INIT" command, but put a version of DOS on the newly formatted disk that was relocatable.<10> When DOS from a "master" disk was booted on an AppleII, it first determined what was size of the memory, and then loaded itself into memory as high as possible. The INIT command properly formatted a new disk, but created what Apple called a "slave" disk; that is, the DOS loaded from a slave disk was fixed in memory to the same size as the computer on which DOS had been booted. In most cases this would not be a problem. However, the problem would surface if someone whose AppleII had only 16K of RAM shared a disk with a friend whose computer had, say, 32K of memory. Booting that borrowed disk would make the 32K computer appear to have only 16K of RAM (since it forced DOS to load at the highest location available to a 16K machine). A "master" disk was more versatile, being "intelligent" enough to adapt itself to differing memory sizes. The Integer BASIC file "APPLESOFT" was interesting. It was a 43 sector file that appeared in a catalog as an Integer BASIC program (with the "I" filetype code). If you loaded the file and listed lines 10 through 80, there were lines that would produce the following text: