16K disk
by Marshall D. Abrams
Introduction
There are several good programs for creating and maintaining a master composite directory of all one's disk files. So why did I write another one? The answer is time and convenience. In all the existing programs which I tried, I found that the effort required was trivial when the number of files was small and very time consuming when the number of files grew above a few hundred. I found that I didn't need a master file directory (MFD) when I had only a few disks, but when I got to over 40 sides, I started having trouble finding files. I had even more trouble keeping track (no pun intended) of multiple copies made for backup. When I modified the working copy of a file, I wanted to also change the backup if I could find it!
This article describes a program, MAKEDIR, which creates and updates such a master directory. MAKEDIR gets you off to a fast start in creating a MFD. It also lets you update the MFD when you change which files are on which disk. The MFD is compatible with the Data Management System (DMS) which appeared in COMPUTE! November 1981 and the improved ATARI Program Exchange (APX-20059) version. As, described below, DMS may be used to sort, edit, and print the MFD.
Design criteria
MAKEDIR was designed to interface with DMS. It creates and edits a file named MASTRDIR.DB which is completely compatible with DMS. MASTRDIR.DB is also designed for listing on the TV screen and 40-column printers. Accordingly, the total column count is restricted to 38. Fields are defined with an extra column so that they are separated and readable when directly copied to the screen or printer. If this feature is not important to you, but the limit of five columns to identify a file type is too confining, you may easily change the field widths.
Getting Started
Run DMS and create the database file MASTRDIR. The extension DB will be automatically added by DMS. The following fields should be created:
Name | Width | Editing |
1 FILE.EXT ........... | 13 | none |
2 Sec ................ | 4 | numeric |
3 Disk ............... | 7 | none |
4 Date ............... | 7 | numeric |
5 Type ............... | 5 | none |
Several people who have gone through these steps have had the same problem with DMS. DMS is inconsistent in its inputs. Sometimes it wants you to type RETURN; at other times it does not. If you type RETURN when DMS doesn't want it, it doesn't read it when you type it. It reads the RETURN for the next command! Horrors! You have gone through much work to set up MASTRDIR, but it gets thrown away because there was a RETURN laying around waiting to be read when you wanted to type Y. Be sure to type a capital Y; lower case won't work. This is an easy mistake to make if you have been entering titles in mixed case.
Running MAKEDIR
The program MAKEDIR will read the directories of your disks and create the file MASTRDIR.DB. First, you will be asked for the date in YYMMDD format. No doubt this format looks strange, but there is a good reason for it. This format will sort correctly when treated as a character string, which is the way that DMS's sort works. It would also work if the format were YY-MM-DD, which is more readable but takes more columns. To be more general, the format should be YYYYMMDD, but YY will correctly sort this century.
MAKEDIR will attempt to read the disk id (see below for disk id format); if it fails, it will ask you to type in "diskid". The program assumes that all files on each disk are of the same type, or purpose, and asks you for this information. If you have organized your disks this way, with games on one disk and utilities on another, MAKEDIR will save you lots of time. If a few files are of a different type, you can us DMS to change their types. Common types are GAME, GRAPH, WORDP, and UTIL. MAKEDIR will ask you to load new disks as necessary. When creating a new MASTRDIR, MAKEDIR fills up all of available memory before requesting that you load the disk onto which it will write MASTRDIR.DB. Generally you will be able to catalog all your disks before this.
Recataloging a disk
If you have made many additions or deletions to the files on a disk you may want to recatalog that disk using the Update command in MAKEDIR. After reading your disk, MAKEDIR will search MASTRDIR for all entries previously made for that disk and mark them as deleted. It will then append the new entries.
Adding non-directory files using DMS
Many boot disks do not have directories. Some way is needed to make MFD entries for such disks. In addition, you m ay wish to make an entry for an AUTORUN.SYS that identifies the content of the file (GAMENAME.ATO, for example). One way to do this is with the DMS update command. If you run DMS and select the update option, you will be prompted into creating as many entries as you like. The editing tests will even prevent you from entering alphas in numeric fields.
Editing MASTRDIR
Since MASTRDIR.DB is a text file, it can be edited with a text editor, such as the Program-Text Editor (APX-20075). Using an editor is often more convenient than DMS for a small change. Similarly, searching MASTRDIR.DB for a specific file may be done with the editor's search command. An alternative way to add records to MASTRDIR.DB is to use an editor. In general, an editor will let you see a screenful of records, so it will be easy to create new records by lining up the fields above and below. Further, an editor lets you insert the new record anywhere you want. For a few additions it is probably more convenient to insert that in the right place in a sorted list rather than have to resort after insertion.
Disk Name
MAKEDIR assumes that a file DISKNAME.TXT exists containing a single record in the format
(...title...diskid).
Diskid may be any string, preceded by at least one blank and followed by a greater-than character. If MAKEDIR discovers that DISKNAME.TXT does not exist, if offers to write it for you. So even if you hadn't previously numbered your disks, you can number them at the same time that you catalog them. Since MAKEDIR is written in BASIC, it may easily be changed to work with other disk identifiers.
Other Features
MASTRDIR.DB records occupy 38 columns, making it very convenient to list them to the screen or a 40-column printer. From DOS, type C (for copy). Then specify
MASTRDIR.DB,E:
to have the MFD scroll on the screen. Typing CTRL+I will stop and restart the scrolling at will. To print the MFD, type
MASTRDIR.DB,P:
To avoid multiple entries which would convey little information, MAKEDIR excludes files with extension SYS and MINIDOS. However, since each AUTORUN.SYS may have a different purpose, I manually enter progname.ATO (where progname is the name/purpose of the AUTORUN) in the directory.
Program description
Lines 10 to 90 set up the program variables and color the screen. I like to have a unique color identifying each program or program type. Lines 100 to 120 get the date. Lines 200 to 460 constitute the main menu. The disk type is input in lines 540 to 588, with all 5 characters padded with blanks as necessary. If you want to allow more characters for type identification, change the count here as well as the DIM on line 30. The disk name is read and padded in lines 600 to 720. If one doesn't exist, lines 800 to 860 allow you to identify the disk and to optionally write the DISKNAME.TXT file. Line 890 pads the diskid to 6 characters if necessary.
The disk directory is read in lines 900 to 1020 and written to the internal buffer, the record being terminated with an asterisk and an EOL. If the buffer is full, line 1060 sends us off to 1500 to empty it. If we are updating MASTRDIR by recataloging a disk,, lines 1040 and 1100 to 1420 mark the previous entries for this disk for deletion by changing the asterisk to a D. The entire buffer contents are appended to MASTRDIR.DB in lines 1520 to 1580. If you have two disk drives, this section could be easily changed to eliminate diskette changing.
Error checking is handled in lines 1560 to 1580, calling-on a subroutine at 2200 to 2280. The menu at 1600 to 1800 allows another copy of MASTRDIR to be written, another disk to be read, or program termination.