Classic Computer Magazine Archive COMPUTE! ISSUE 60 / MAY 1985 / PAGE 96

Apple IIc RAM Disk Mover

Part 1

Christopher J. Flynn

In addition to demonstrating the RAM disk and subdirectory options with ProDOS and an Apple IIc, this article presents a utility for rapidly copying a number of programs from the floppy drive to the RAM drive. The actual program listing and complete instructions for use will appear next month in Part 2.

One of the conveniences of the Apple IIc is its built-in disk drive. An Apple disk holds about 143,360 characters, or 140K bytes, of information. (One K is equal to 1024 bytes.)

Typically, people use a disk to store both programs and data. If a disk contains programs that total about 40K, then only 100K remains for data. So a single-drive system can be a bit limiting in terms of storage capabilities.

One answer is to buy a second disk drive. But wait—there's another alternative you should consider first. Did you know that your Apple IIc has a second built-in disk drive that will hold about 60K of information? Of course, it's not a regular mechanical disk drive. Rather, it is an electronic drive known as a RAM disk. A RAM disk sounds like some futuristic propulsion mechanism, but it's really just a section of Random Access Memory that, with the proper software, works like a disk drive. If you could use the RAM disk for program storage, you could use the conventional disk drive entirely for data storage. This article will show you how.

The Apple IIc has 128K of RAM organized as two separate 64K sections or banks. Each bank is addressed from location 0 through location 65535. Most programs, including Applesoft BASIC, are designed to use only the first 64K bank. Thus, the second 64K bank is generally free for use as a RAM disk. Some programs, such as the new releases of Logo and Pascal, do, however, use the entire 128K.

The Apple II'c disk operating system, ProDOS, has the necessary software to use the second 64K bank as a RAM disk. ProDOS can make the second bank look like any other disk drive to the computer.

The big advantage of the RAM disk (besides the fact that it's free) is its speed. It is entirely electronic, so there are no moving parts to slow down data access.

However, this characteristic is also the RAM disk's biggest disadvantage. Because RAM chips require constant power to maintain their information, the RAM disk forgets everything the instant the power goes off. Therefore, you still must use the mechanical drive for permanent storage.

Accessing The RAM Disk

Here is a simple experiment you can do. It shows how RAM program files work.

  1. Insert the ProDOS Utilities disk in your IIc. Turn on the computer. Exit the Utilities program. You should be in Applesoft and ProDOS should be active.
  2. Check to see what, if anything, is stored in the RAM disk. Type: CAT /RAM There should be 120 blocks available. At 512 bytes per block, this gives 61,440 bytes of storage—about 43 percent of the capacity of a floppy disk. This should certainly hold a few programs.

  3. Try saving a program with the RAM disk. Enter the following one line program:
    Save the program by typing:
  4. Erase the program from memory with NEW. Now load the program by typing:

If you try this simple experiment, you'll notice a few things. First, loading and saving are incredibly fast. Sure, the demo program is on the small side, but try a larger program if you like. The speed will amaze you. Meanwhile, the internal mechanical drive stands by quietly the whole time.

Second, all the commands are preceded by /RAM/. In ProDOS terms, /RAM/ is the volume directory for the RAM disk. When you format a blank floppy disk with the Utilities program, you assign the disk a volume label, a name for the disk. The format program automatically places a volume directory on the disk, and the volume directory is given the same name as the disk's volume label. The RAM disk, on the other hand, is a permanent part of your computer. You can only have one RAM disk and you don't need to format it. So it makes sense for everybody to use the same volume directory for the RAM disk. Apple decided that the RAM disk would be called /RAM/.

Moving Programs To /RAM/

If you want to move programs from a floppy disk to the RAM disk, all you have to do is type a series of LOAD and SAVE commands. After doing this a few times, however, you will quickly realize that it is a tedious process.

There is a better way. You can use the computer to move the files for you. After all, computers are supposed to be labor-saving devices, aren't they? The solution is a special program which automatically copies your files from the floppy disk to the RAM disk.

Before going further, there are some sticky details that should be resolved.

  1. The /RAM/ volume directory holds a maximum of 12 entries. How can a larger number of files be handled?
  2. How will a copy program know which files to move to /RAM/?
  3. How will a copy program move a program? If it executes a LOAD, won't the copy program itself be destroyed?

Questions 1 and 2 can be answered together. All ProDOS volume directories have a limit on the number of entries they can hold. A floppy disk volume directory can hold up to 51 entries, while the /RAM/ volume directory is limited to 12. Fortunately, ProDOS provides a subdirectory feature to overcome these restrictions. One or more of the entries in a volume directory can be a directory itself or, in other words, a subdirectory. The subdirectory can have as many entries as you need.

Subdirectories have another important advantage. They are a great way to organize information. You can keep all programs in one subdirectory and data files in another. This is almost like having an invisible barrier on your disk; programs will be in one part and data in another part.

Naming The Subdirectories

The RAM disk subdirectory for programs will be called:


It would be very convenient if all the programs on floppy disk were also in a subdirectory because the copy program would always know where to find them. Let's establish a standard convention. All BASIC programs on disk will be stored in the subdirectory:


where XXX represents the volume directory of the disk.

Moving the programs (question 3) presents a real challenge. With the LOAD command, the incoming program would destroy the copy program. One way of solving this is to use another ProDOS feature—EXEC files.

The EXEC Approach

An EXEC file is a text file that contains a series of ProDOS or BASIC commands. The ProDOS and BASIC commands can even be mixed in the same EXEC file. You run the EXEC file by typing:

EXEC filename

The dash is a special command that tells ProDOS to run the program specified by the filename. Dash is general-purpose. It will run a BASIC or binary program, or execute the commands in an EXEC file.

The task of moving programs from floppy disk to RAM disk can be performed by an EXEC file with a series of LOAD and SAVE commands:


where XXX is the floppy disk volume directory.

These commands can be repeated as many times as it takes to copy all the programs.

Creating Subdirectories

You might be wondering how to set up the PROGRAMS subdirectory. You have two choices with floppy disks. When you format a disk with the Utilities program, it has provisions for establishing subdirectories. It is a good idea to establish a PROGRAMS and a DATA subdirectory on each disk you format.

You can also use the ProDOS command:


to create a subdirectory. (Again, XXX represents the disk volume directory.)

The second method also is used to set up subdirectories on the RAM disk. CREATE can be a direct command, or it can be executed from within a program.

Next month: the "RAM Disk Mover" program and guidelines for its use.