WHAT IS A RAMDISK? BY DILWYN JONES I am often asked how to make a backup copy of a program when an user has only one disk drive. The simplest answer is to make a copy on a microdrive cartridge, then copy back to the disk drive, onto another floppy disk. But what happens when the files are too large to fit on a cartridge? The next approach is to use a ramdisk. I have, on several occasions, been rather surprised when I suggest a ramdisk as the answer to a particular problem and been greeted with the reply "what's a ramdisk?". So in this short article, I hope to explain what it is and how to use it. A ramdisk is a part of the QL's memory which has been set up to look to programs as though it was a floppy disk drive, albeit a very fast one. You can think of it as a floppy disk inside the computer's memory, with one very important difference - it is not permanent. Any information held in it will be lost as soon as the QL is switched off or reset. You can save programs to a ramdisk, load from it, copy to and from it, and generally do many things with it that you might do with with a floppy disk or microdrive cartridge. The SuperBASIC commands SAVE, LOAD, DELETE, OPEN, COPY and others all work with ramdisks. Even FORMAT works, but there is a different use for that command. The ramdisk has a name, in the same way that we save files to flp1_ for floppy disks, or to mdv1_ for microdrive cartridges, we use ram1_, ram2_ and so on for ramdisks. So when we save a program to floppy disk with SAVE flp1_name, we can also save to ramdisk with the command SAVE ram1_name. Now that we have established that (to programs) it looks and behaves like any other QL storage device, what use exactly is it? You can copy commonly used files into a ramdisk at the start of a session with the QL, so that you do not have to keep swapping disks to use them. The snag is that it takes up some of your valuable free memory, so putting lots of large files in the ramdisk tends to use a lot of memory, leaving less than usual for your other programs. You can save something temporarily to a ramdisk while you load another program for some reason (e.g. to check or compare something), then quickly load it back again. This is often much faster than temporarily saving something to disk or cartridge and saves the hassle of looking for a blank disk or cartridge, of course! Quill can be configured to use a ramdisk for some of its "system" files. You can make Quill look for its help files, printer_dat printer driver file and even to have its def_tmp file on ramdisk to make it work quicker if you are multitasking Quill and have prevented it grabbing all the computer memory (e.g. when using Taskmaster or the pointer environment system). Archive can manipulate a database file in a ramdisk. Before starting up the program, copy the database file to ramdisk then make Archive use the copy in ramdisk. Not only will this speed up Archive, it also means that if the computer crashes, it does not corrupt the database file on the disk or cartridge, only the copy in memory so you have not lost much work. You must of course remember to copy the file back to disk afterwards to bring the copy on disk up to date. Finally, copying files to and from ramdisk works very quickly indeed. If you only have one disk drive, or you want to make multiple copies (e.g. to make two or three backups of a very important file), it is worthwhile copying the file or files to ramdisk first, then copying back onto the backup disks. If you have Toolkit 2 in your system (most disk interfaces have at least part of Toolkit 2 built into them), the WCOPY command is an excellent and easy method of copying files in bulk. Use the command WCOPY flp1_ TO ram1_ to copy files to the ramdisk (press Y for yes or A for All when it asks you the question), then change disks and use the command WCOPY ram1_ TO flp1_ to copy the files back to the floppy disk (again press Y for yes, N for no, A for All files or Q to Quit). If you do not have Toolkit 2, here is a short listing for a program to copy all files from a disk to ramdisk, waits for you to change disks and then copies all files onto the new disk. It is designed for use on a single disk system. You should delete the files in the ramdisk afterwards (use the DELETE command, or WDEL ram1_ for bulk deleting if that command is present on your system). You can modify this program to do the deleting for you if you want to - add the command shown after the REMark statement in line 290. That is, type in line 290 but without the word REMark. 100 REMark ramdisk copier for single drive systems 110 CLS : OPEN_NEW #3,ram1_temp_file 120 DIR #3,flp1_ : CLOSE #3 130 OPEN_IN #3,ram1_temp_file : INPUT #3,t$ : INPUT #3,t$ 140 REPeat copy_files 150 IF EOF (#3) : EXIT copy_files 160 INPUT #3,filename$ 170 PRINT"Copying ";filename$ 180 COPY "flp1_"&filename$ TO "ram1_"&filename$ 190 END REPeat copy_files 200 CLOSE #3 : PRINT\"Swap disks and press a key." 210 PAUSE 220 OPEN_IN #3,ram1_temp_file : INPUT #3,t$ : INPUT #3,t$ 230 REPeat copy_files 240 IF EOF (#3) : EXIT copy_files 250 INPUT #3,filename$ 260 PRINT"Copying ";filename$ 270 COPY "ram1_"&filename$ TO "flp1_"&filename$ 280 REMark if only making one copy, add the following line 290 REMark DELETE "ram1_"&filename$ 300 END REPeat copy_files 310 CLOSE #3 : DELETE ram1_temp_file 320 PRINT'Copying complete, but wait until drive stops."