The Secrets of ProDOS

By Gareth Powel
Australian Apple Review June 1987

Those of us who were in at the beginning of the Apple II revolution found that the main focus of our attention from day one was on a mystery animal called DOS. This animal came in different flavours and, later, different numbers. But we happy pioneers knew, right from the start, that if we were ever to fully control this wondrous new machine we would have to work out what a Dos was, what it did and, how we could make it do it better. Them were the days.

DOS, of course, stands for disk operating system and, like all phrases in computing, is more than somewhat misleading. For DOS does not just control the disk drive and the way the information is written to and obtained from disks. It also controls most of the functions of the computer itself. I always like to think of DOS as a large, friendly and intelligent traffic policeman – I believe we have an oxymoron there – telling computer information to come here, go there, do this, stop doing that.

As the Apple II matured and improved so did the DOS. (Worth remembering that the original disk drive and its operating system were, according to legend, written and designed by Woz – the sainted Steve Wozniak, over a long Christmas weekend so that they would be ready for a computer show. And, for once, legend is not a lying jade. As the Apple progressed forward so did the operating system until we arrived at ProDOS which is, in effect, a two level operating system. At its highest level it is a sophisticated tool which programmers can and do access to make the Apple run better/faster/smarter. At another level it is an operating system which offers a series of commands to the normal user which helps improve the interface between user and computer or, slightly less pompously, lets you get the best out of your Apple. Let us look at the Applesoft commands that even the absolute beginner should try and get a handle on if approaching using the Apple with any seriousness of intent. (If you care nothing for improving your use and understanding of the machine then it is very probable you have bought the wrong computer – you should have bought a Macintosh instead, which, in the area of operating systems, is an idiot’s delight.)

When you first format a disk using the ProDOS FILER routine that comes on your operating disk, you give the newly formatted disk (dealt and regarded within ProDOS as an entity called a volume) a name, which can be as simple as One or Two or First or Second. This newly formatted disk ends up with a single volume directory which can eventually contain information about files numbering up to 51. These files can be applications (programs that you work with), data files (programs that contain the information on which you have been working) or sub-directories (files that define other directories in which can be held more application files, more data files or, yes indeed, more sub-directories). Bigger fleas with little fleas upon their backs to bite them.

This possible construction of a tree of interlocking and ascending and descending files is not, of course, of great import on a single floppy, although even there it can have relevance down to a first layer. Where it comes into its own is with hard disks which can be so set up and organised that the finding and retrieval of information by the computer and therefore by you, the user – is almost totally automatic. When searching for a file the computer needs two pieces of information. The first is the name of the directory, the second the name of the file. ProDOS gets this information in a form called A path name which lists in succession the names of the directories that must be traversed to reach the file in question. Certain standard forms apply.

The first name in the path name always starts with a slash thus / and is always that of the volume directory. Other names that follow are also separated by a slash. (If any readers who have been used to the IBM PC DOS operating system are getting a feeling of deja vu, they should not be unduly alarmed. Exactly the same routines are used for both systems except for the angle of the slash mark.) Simple example coming up.

The disk I am writing on was called ONE when I formatted it, so this became its volume name. Within its directory is a sub-directory called COPY and this article is a file called PRODAAR. The path name for this article, the trail down which the computer can easily trace its way, is /ONE/COPY/PRODAAR. Do not believe that you have to give the full ornate instruction every time you need to get to a file. There is, of course, a neat shortcut which we will get to under PREFIX. These names, these signposts if you will, could, of course have been a little more ornate, a little more informative. A name must be less thanl6 characters long and must start with a letter of the alphabet. Once you have got the first letter down, the rest of the name can be almost any combination of letters, numbers or periods. But unlike the DOS 3.3 that ProDOS supersedes, you cannot have spaces, special symbols or control characters. There is a good and proper reason for this.

As the Apple has become more sophisticated it has become attachable to more and more sophisticated peripherals. Some of them can react to odd combinations of spaces and control characters in an unexpected manner. For example, if your filename contains a Control D and you are sending information to the Apple LaserWriter then you will be in some minor strife because, under certain circumstances, the LaserWriter regards Control D as a signal to ignore all following information and to stop work. On the other hand, Applesoft itself considers Control D, if it comes from a PRINT statement, as a warning signal for a coming disk command which can add to the confusion.

The rule is inflexible – a character of the alphabet first, followed by up to 14 characters which can only be alphanumeric or full stops. Spaces, special characters and control characters being strictly verboten. Typically, you use a name containing a type of file description simply because it makes it easier to understand what a file is about when you forget the reason for cryptically calling it SPLODGE.

When you are using ProDOS, the disk commands in Applesoft come from a file called BASIC.SYSTEM which normally runs automatically when you boot a disk. Pedants will point out that the first file in the volume directory that ends with .SYSTEM is the one that runs, but almost all disks containing Applesoft programs have BASIC.SYSTEM as the first file so the point is somewhat academic. BASIC.SYSTEM installs a group of 32 disk commands accessible to any Applesoft program which are an extension of the Applesoft command set. Let us look at a few of the more useful ones.

CAT will display a catalog of all the names of the files in a directory specified with a path name or those in the currently active directory. CAT displays the type, the style of each file with a three letter suffix which gives you, at the very least, an indication of content. These suffixes include .BAS for BASIC files, .SYS for a SYSTEM file, .TXT for a TEXT file, .BIN for a BINARY file and so on. It also shows the number of disk blocks the file occupies with each block being 512 bytes in size and, finally the date on which the file was last modified. CATALOG is a further extension of the CAT file. Besides all the information you get from CAT, you also get the date and time of the creation of the file and its size in bytes. At the ending of a listing created by either CAT or CATALOG you will be shown the number of blocks free and the blocks used on the disk. All good, handy stuff.

With the PREFIX command you define the chain of directory names to which any specified filename will automatically be added to create the full path name that ProDOS, under normal circumstances, requires. This is the shortcut we were talking about earlier. Setting the prefix to a particular directory allows you to get files just by their names instead of using the full path name. Go back to our original example.

The volume directory name of this disk is ONE and it contains a sub-directory file called COPY and this article is PRODAAR. If you want to set to any file in the COPY sub-directory all you need to do is initially enter the command PREFIX/ONE/COPY. This ex ample can be extended down into sub- directories nested within sub-directories. What you are doing is giving the computer a temporary but very clear signpost as to where you will be working. If at any time you wonder where you are working – and this happens to me all the time – simply enter the work PREFIX and the path name you have selected will appear on the screen. Note carefully that if you switch disks you need to switch your PREFIX otherwise the computer will be searching for a non-existent path and will let you know with the displayed phrase PATH NOT FOUND.

CREATE is the command you use for creating sub-directories. For example, if within my sub-directory COPY I wanted to open another one called SMH in which I would keep all copy I write for the Sydney Morning Herald, I would type CREATE SMH and there, by Jiminy Crikey, would be my subdirectory. (Keen programmers will have noted that I keep all my titles as short as possible. This is because I have a good memory but I am, by nature and inclination, a lazy typist. Other forms may suit other people). I shall nip smartly past the commands LOAD, SAVE and RUN which are obvious and the first commands you learn in Applesoft. BLOAD is a little different. It lets you transfer data from a file to an area of memory which you have defined. In most cases this would involve a binary file. If you do not define where in memory you want it loaded – as in BLOAD NEW.FILE,A <.> where <.> is the beginning of the block to which you want the file transferred – then the file will be loaded at the point you originally save it to disk. BRUN is the same as BLOAD except that after you have loaded the file it runs automatically. This command can only be used with binary files. BSAVE saves the contents of range of memory to a file where you have indicated the starting and the finishing address of the range.

LOCK and UNLOCK are two fairly standard commands. Once you have locked a file you cannot fold, spindle or mutilate it unless you specifically and deliberately UNLOCK it. It goes without saying that the more of your files you can leave in the LOCKed state, the less chance there is of losing valuable data from your disk. Which brings us to DELETE which removes a filename from a disk and then says, in effect, the area where this file resided is now for rent and any new information being loaded in can occupy it. But DELETE does not, repeat NOT, delete the file or the file information itself.

On the one hand, this is a good thing if you accidentally delete a file name. On the other hand, you should understand clearly that deleting a file name still leaves the information available to any naughty or overly inquisitive person. These are basically the commands you will be using with ProDOS until you get involved in programming.

The next point about ProDOS is that t is inherently logical with no funny little quirks or twists to annoy you. Once you have the basic structure firmly in your mind it is difficult to go wrong. And ProDOS is a much faster and more flexible disk operating system than DOS 3.3 ever was. Altogether a good thing.

Please follow and like us:
error

About the Author