The Beginner's Page
I started programming on microcomputers about eight years ago, when programs were most often saved on cassette tape. Cassettes were a reliable, easy, and inexpensive means of program storage for home computers, and disk drives were fragile and expensive. In fact, I still use cassettes for program storage on some of my computers. However, nearly all computers now are sold with at least one disk drive as standard hardware. This month I'm going to describe how beginners can use disk drives and what some of the basic disk commands are.
The most common use for disks is to save programs. Saving and retrieving programs by disk is much faster than using cassettes, so most all users and programmers eventually move to a disk system. Here's how to get started using disks.
There are two sizes of floppy disks for personal computers: 5¼-inch and 3½-inch. In general, a program saved to disk on a particular brand of computer cannot be loaded into a different brand of computer. For example, a program for the Apple II cannot be loaded and run on a Commodore 64.
A blank disk can be used for any brand of computer and disk drive, as long as the size of the disk and drive are compatible. To use a blank disk, you must first prepare it. This process is called formatting or initializing the disk. You might think of it as preparing the disk for a recording format acceptable to your computer. The formatting process usually checks for disk errors then sets up a directory so the disk can accept files (programs). I like to prepare several disks before I start programming so that they'll be ready to go when I need them.
On MS-DOS computers, the command to initialize a disk is FORMAT, and there are several options (consult your DOS manual). In a two-drive system, you may specify each drive, such as A: for the first disk drive or B: for the second disk drive. You may specify /S in the FORMAT command to copy the operating system files to the new disk (making it a "bootable" disk). You may specify /V to use a volume label, or a name for that particular disk. These commands are DOS commands and are used when you see the DOS prompt (A>). Some examples are FORMAT, FORMAT A:/S, FORMAT A:/S/V.
If you use the /V option, the disk will first be formatted; then you will be asked to supply a volume label. You type in a name for the disk, such as GAMES, and then press the Enter key.
To prepare a disk on mouse-based computers (Macintosh, Amiga, Atari ST), first click on the disk's icon with the mouse. Next, move the mouse pointer to the drop-down menu for disk operations and then select FORMAT or INITIALIZE.
To format a disk on the Atari eight-bit computers, type DOS to return to the DOS menu, then select the format disk option.
On the Commodore 64, you must open a command channel to send commands to the disk drive. Start by entering the command OPEN 15, 8, 15. This tells the computer to open channel 15 to use the disk drive, which is device number 8. The last 15 indicates you will send commands rather than data. Now type PRINT#15 to send commands to the disk. To format the disk, use the NEW command: PRINT#15, "NEW:name,id" where name is the name you wish to give the disk, and id is a two-character identification. For example, PRINT#15, "NEW:GAMES, 88". When the format is complete, close channel 15 by entering CLOSE 15.
The procedure for formatting a disk on the Apple depends on which DOS you are using. For DOS 3.3, load your favorite Hello program into memory, place a blank disk in the drive, and type "INIT HELLO". When using ProDOS, use the system utilities to format the disk. After formatting, copy the files PRODOS and BASIC.SYSTEM to it if you want the disk to be a boot disk.
Notice that when you use a formatting command, the disk drive light goes on and the disk is busy for a few moments. Keep in mind that when you format a disk, all previous data on the disk will be lost. You can format a used disk—if you are sure you no longer need any of the files on it. After formatting, it will be just like a new disk.
Saving And Loading
After you have formatted a disk, it is ready for you to store programs on it. When you've finished writing a program, you'll want to save it to disk. Most computers use the SAVE command with the title of the program (for example, SAVE TESTPROG or SAVE GAME1).
The eight-bit Atari computers require quotation marks and the drive number followed by the program name. For example, SAVE "D:TEST saves the program as TEST to drive 1 (D: is the same as D1:). SAVE "D2:TEST saves the program to drive 2.
The Commodore 64 and 128 require quotation marks around the title, followed by a comma and the device number (8 for drive 1, 9 for drive 2). SAVE "TEST", 8 saves the program to the first drive, while SAVE "TEST", 9 saves the program to the second drive.
The mouse-based computers with windows usually have a SAVE option listed in one of the drop-down menus. Select the SAVE option with the mouse pointer; then type in a program name (filename).
On the Amiga, DF0: and DF1: are used to refer to the internal and external disk drives. While in Amiga Basic, use SAVE "DF0: TEST" to save to the internal drive, and SAVE "DF1:TEST" to save to the external drive.
When you save a program, be sure it has a unique name. If there is already a program by that name on the disk, the new program will replace the old one. You may wish to save different versions of a program with numbered titles, such as TEST1, TEST2, TEST3, and so on.
After you have saved programs on your disk, you can later retrieve them, usually with a LOAD command followed by the title (for example, LOAD TEST1).
On the Commodore 64, you must use quotation marks and the device number, as in LOAD "TEST1", 8 and LOAD "TEST2", 9.
Eight-bit Atari computers require a beginning quotation mark (but the quote may or may not be closed) and the drive number, as in LOAD "D: TEST1 and LOAD "D2: TEST2.
In addition to the normal LOAD command, Apple users can load and run a BASIC program with the command RUN TEST1. Apple ProDOS users can load and run a program by preceding the program name with a hyphen, as in -TEST1.
On the mouse-based computers, go to the drop-down menus and select LOAD or OPEN. The available files will then be listed for you to select again, or you may type in the name of the program you want.
Again, DF0: and DF1: are used to refer to the internal and external drives on the Amiga. From Amiga Basic, LOAD "DF0:TEST1" loads from the internal drive and LOAD "DF1:TEST2" loads from the external drive.
Getting A Directory
As a disk user, you'll always want to be able to find out what files are contained on your disks. This can be done by typing a command to get a disk directory. On MS-DOS computers, if you are in DOS, use the command DIR for directory. If you are in BASIC, you can use the command FILES (your program will not be lost while you check the disk contents).
On the Commodore 64, type LOAD "$", 8. When the computer comes back with READY, type LIST. The directory is then listed. Note that any program you are working on will be lost, so use this command with care.
On the Amiga, use DIR DF0: to get a directory of the disk in the internal disk drive (use DF1: for the external drive).
On an eight-bit Atari, type DOS to return to the DOS menu, then select the show directory option.
On the Atari ST, from the COMMAND window of ST BASIC, type DIR, and the disk directory will be printed in the COMMAND window.
On Apple II computers, use the CATALOG command to get a list of the files on the disk.