DISKNUM Version 1.1 Gene Pizzetta December 26, 1987 DISKNUM is a utility to create null disk labels under CP/M for the most popular disk cataloging programs: MCAT, NCAT, and FATCAT. It has been optimized for CP/M Plus, but should also work on CP/M 2.2 systems. A Z80 CPU is required. USAGE: DISKNUM {d:} If the target drive is not given, the current default drive is assumed. DISKNUM creates consecutively numbered disk labels. The labels are null files with a three-digit number in the filetype, compat ible with most disk cataloging programs. After each disk label is created, the number is incremented and you are prompted for the next disk. You can quit at the prompt by pressing Escape. On exit, DISKNUM will save internally the next number to be used (if you don't tell it not to), so you don't have to keep track of the numbers yourself. You can also enter a new number at the prompt, and new labels will begin incrementing from the new number. That feature is handy if you already have a bunch of numbered disks and you want to start where you left off. When entering a number, only three digits will be accepted, followed by a carriage return. You can't edit the number, but any illegal key (a backspace, an al phabetic character, etc.) will abort the entry and give you ano ther chance. If the ATTRIB equate in the source code is set TRUE, then DISKNUM will set the disk label file attributes to RO (so you won't acci dentally erase it), SYS (so it won't appear in your ordinary directory), and ARC (so it won't be copied to another disk by a backup program). The distribution version works that way. For ease of operation a carriage return always means "yes" at any prompt. The target disk can be in any drive. You aren't stuck with labelling disks only in drive B or only in drive A. The target drive will be reset before writing each disk label for safety, but only that drive, NOT your whole disk system (unless you are using a CP/M 2.2 system). The program will run from any drive, but only from the current user area. It will find out what drive it's on automatically under CP/M Plus, so it can save the next number on exit, but it can't find itself if it was load ed from another user area. Under CP/M 2.2 DISKNUM comes config ured to run from drive A. It can be run from any drive, but it must be reconfigured to do so (see below). A single disk drive can be used easily. Once DISKNUM is running you can change disks freely. DISKNUM will ask for its program disk if it needs it to save the next disk label number, but it will look first before bothering you. CONFIGURATION: DISKNUM should run as is on most systems. Use DISKNUM2.COM for CP/M 2.2 and DISKNUM3.COM for CP/M 3.0 (CP/M Plus). The version you use must be renamed to DISKNUM.COM be cause DISKNUM must know what its name is. If you want to change the name of the program or create several versions, you must also change the name internally at the label PrgFil in the source code and re-assemble it. You can also change it with SID or EDFILE. Just look for "DISKNUM COM" in the first sector of the .COM file (at address 128h) and change it to whatever you want. The distributed version sets the disk volume label to filename "-DISK.nnn", where nnn is the disk number. That, too, can be changed in the source code at the label NumFil, or with SID or EDFILE at address 104h. If you're running CP/M Plus, no other patching is needed. For CP/M 2.2 one additional patch point is provided. CP/M 2.2 USERS: I don't know a way under 2.2 for a program to detect the drive it was loaded from (this is no problem under CP/M Plus). As a consequence, to run DISKNUM from a drive other than A, the drive specification must be patched into the .COM file or in the source code. To make the change in the source code, adjust the first byte after the label PrgFil, which is currently "1" for drive A. Make that byte the number of the drive DISKNUM will be loaded from: B=2, C=3, etc. You can also make the same change in the .COM file at address 127h. In addition, since CP/M 2.2 does not support BDOS Function 37 to reset selected drives, the entire disk system will be reset be fore each disk access. To re-assemble the CP/M 2.2 version, set the CPM3 equate in the source code to FALSE. (I don't have a CP/M 2.2 system, so that version is untested. Let me know if there are any problems.) HISTORY: I got the idea for DISKNUM from a similar program, VOLNUM, written for CP/M 2.2. Unfortunately, that program had some problems. The author, who will remain nameless, claimed the program would run from any drive if it was properly configured. I wouldn't. It ran only from drive A and then only if A was the default drive. Secondly, the target disk had to be on drive B. In addition VOLNUM unnecessarily cleared the screen and wrote a small book of text with every disk change, a bit of an irrita tion. Personally, I think simple utilities should do as little writing as possible because it's often handy to keep things like a disk directory displayed while you're using them. Apparently the author thought VOLNUM was some sort of masterpiece of the programming art. It wasn't, as DISKNUM shows. The source code wasn't available and, if you dump the .COM file to the screen, you're greeted by a nasty message. In addition, non- standard opcodes were used to foil disassembly. (Such, too often, is the hacker spirit these days.) So I decided to write a new one from scratch. It took me a couple of hours at the out side. The next label number is saved in a very simple way: The first sector of the .COM file is a data sector that is saved back to the program at each exit using the BDOS random write function. The CP/M Plus version detects the drive it was loaded from in zero page at 050h. If CP/M 2.2 puts it there or someplace else, please let me know. Version 1.0 (December 24, 1987) -- Completed first version for CP/M Plus only. Version 1.1 (December 26, 1987) -- After enjoying Christmas, I decided to add CP/M 2.2 support. DISKNUM was developed using SLRMAC. It can also be assembled with MAC, but Z80.LIB will be required. Formatting and labelling disks is a real chore. I hope this makes life a bit easier for somebody besides myself. Let me know if there are any problems. Gene Pizzetta 481 Revere Street Revere, MA 02151 Voice: (617) 284-0891 CompuServe: 72060,505 GEnie: E.Pizzetta Q-Link: GeneP