********************************************************************* This article is being presented through the *StarBoard* Journal of the FlagShip/StarShip, SIGS (Special Interest Groups) on the Delphi and GEnie telecommunications networks. Permission is hereby granted to non-profit organizations only to reprint this article or pass it along electronically as long as proper credit is given to both the author and the *StarBoard* Journal. ********************************************************************* CP/M Mini-Primer *** Easy Handling of DIRectories By: Mike Mantino GEnie Mail Address: MIKEM ------------------------------------------------------------------- You've finally booted up CP/M Plus on your C-128. There's that cryptic A> prompt staring you in the face, waiting for you to do something. You say to yourself, 'Now how the heck do I see what is on this disk?'. Ah, glad you asked! Let's assume you have two 1571 disk drives and a 1750 RAM expansion module. In CP/M, the 1571 with device #8 is now referred to as drive A and the 1571 with device #9 is now referred to as drive B. The 17xx RAM expansion should be thought of as another disk drive, but lots quicker. It is assigned the drive designation M. When CP/M is first booted up, the default drive is A, hence the prompt A>. You can change the default drive at any time by typing the letter of the drive followed by a colon and . The prompt should then display the current default drive designation, such as B>. If you still have your CP/M system disk in drive A, typing DIR followed by will show you a listing of files that are on that disk. It may or may not be a total list, depending on whether files have been saved to other portions of the disk which are called USER areas. A CP/M disk has 16 different sections which are partitioned off from each other (labeled 0 thru 15). That cryptic A> prompt should actually read A0>, since the default USER area upon boot-up is 0. One way to check to see if files are in these other nooks and crannies, is to change USER areas and type DIR again. Let's see if there are any files in USER area 1 on that disk. First, change USER areas by typing A1 and hitting . Your prompt should now be A1>. Next, check the directory by typing DIR and hitting again. You can do this for all 16 different USER areas on that disk. You can also change to drive B or M and check all USER areas one at a time in much the same fashion. Not much fun, is it? Well, it *can* be easier, as you will see. The DIR command has two versions. The one that you have just used is the 'built-in' version. The wildcards * and ? can be used, and it's simple and to the point, but not very versatile. It is built into the CP/M operating system and does not require loading in any utility program in order to use it, but you *do* have more power at your disposal through the 'transient' version of DIR. This transient utility is included on your CP/M disk and has the filename DIR.COM. If you type DIR, followed by a set of parameters enclosed in brackets, CP/M will automatically search the disk for the transient DIR.COM and act upon those parameters, giving you enormous versatility when dealing with multi-USER areas and multi-drives. Let's explore these parameters and find out what DIR.COM has to offer. If you wanted to get a directory listing of all USER areas and all drives with one command, you would type: DIR [DRIVE=ALL USER=ALL] The right bracket need not be typed, and you must hit after typing the command. You will then be shown a sorted directory of all files in all USER areas on all drives. If the listing takes up more than one screen, CP/M will halt the listing to allow you to view one screen at a time. To continue the display, just hit the spacebar. To abort the display, hit CNTRL-C. You will notice that a summary at the end of the listings will show the number of files and the total number of bytes used by the files. Also, the listings are placed in alphabetical order across each line. This can be helpful when trying to find a specific file, but also can be a hindrance since long directories are noticeably longer to sort. You can turn off the sorting by adding the NOSORT option inside the brackets. Here is another example: DIR [DRIVE=B USER=ALL NOSORT] -OR- DIR B: [USER=ALL NOSORT] These two commands will return the same unsorted directory of files in all USER areas of drive B. What follows is a listing of parameters available for DIR.COM, a description of each, and an example of each. Note that references are made to Time-Stamping and other attributes which are beyond the scope of this primer. These parameters must be enclosed in brackets, and may be used in conjunction with other parameters. DRIVE=ALL - Displays files on all online drives. DRIVE=(A,B,C,.....P) - Displays files on the drives specified. ATT - Displays the user-definable attributes DIR - Displays only files that have the DIR attribute DATE - Displays date and time stamps of files. EXCLUDE - Displays files that Do Not Match the files specified in the command line. Example: DIR [EXCLUDE] *.COM This command will list all files on the default drive that do NOT have a filetype of .COM FULL - Displays the name, size, number of 128-byte records, and attributes of the files. FF - Sends an initial form-feed to the printer device, if the printer has been activated using CNTRL-P. (To print the DIR listing) LENGTH=n - Displays n lines of printer output before inserting a table heading. n is a number between 5 and 65536. MESSAGE - Displays the names of drives and USER numbers the command is searching. NOPAGE - Continuously scrolls the listing on the screen. (Used for printouts of listings, basically) NOSORT - Displays files in the order it finds them on disk. RO - Displays only those files having the Read/Only attribute. RW - Displays only those files having the Read/Write attribute. SIZE - Displays the filename and size in kilobytes (1024 bytes). SYS - Displays only those files having the SYS attribute. USER=ALL - Displays all files in all USER areas of the default or selected drive. USER=n - Displays all files in the USER area specified by n. USER=(0,1,2,.....15) - Displays all files in the USER areas specified. Although this article only scratches the surface of just one of CP/M's combination transient/built-in commands, it should wing you on your way to a better overall understanding of the environment. If you would like to see more of these primers or have questions about this one, leave mail to MIKEM on GEnie, MEYEK on People/Link, or 72767,2533 on Compuserve. -Mike Mantino 7/24/86