Documentation for SAPP v 1.3 Sort And Pack directory for cp/m Plus 11/15/86 --------------------------------------------------------------------- This program works with CP/M 3.x and may also work for MP/M, although it has not been tested on the latter. It will NOT work for CP/M 1.4 or 2.x. This version for CP/M Plus is a collage of the routines from SAP44.ASM which was for CP/M 1.4 and 2.x and from CPM22E.ASM, a CP/M 2.2 Bios emulator RSX for CP/M 3.x. Many thanks to those people who worked on the code for those programs. Quite a few changes have been made, deletion of unused code, some changes to routines, a fair amount of z80 code is utilized, etc, making the program faster and compact. This utility reads the disk directory tracks, sorts the entries alphabetically and then rewrites them them back to the disk. All unused or erased areas on the directory tracks are reformatted with continuous 'E5' characters. This completely removes previous file names from the directory which have been deactivated. Files of zero length, with the exception of files beginning with "-", may be also be deleted. This is an assembly-time option, supporting disk labeling for the catalog program MCAT. Normally, zero length files are not deleted. Sorting the directory in this manner offers many advantages. Some of them are: 1) Allows standard 'DIR' to show an alphabetized listing. 2) Eliminates potential problems with "UNERASE" programs, (eg, U3-102 for CP/M Plus), by removing programs with a similar name that have been previously deactivated. 3) Speeds up access via 'SD' and other special programs. 4) Assists on working directly on the disk with 'DU', etc. 5) Removes files from the disk directory that somebody else could recover. (The data is still out there somewhere, but its old location is no longer in the directory). --------------------------------------------------------------------- USAGE: A>SAPP B: B: in this case indicate the desired disk to be sorted and repacked. If a disk is not specified, then the logged on drive will be sorted. If your system utilizes a search path for files, then with SAPP set as a system file, you could also use the following format to sort and pack the the B drive. B>SAPP to sort the B drive if your system uses a search path. --------------------------------------------------------------------- ASSEMBLY TIME OPTIONS AND NOTES: Very few user selectable options are available. Set them appropriately for your system. DELZRO Set FALSE to NOT delete solely on the basic of file size. TRUE to delete all zero-length files NOT beginning with "-" as in SAP40. CLRSCR Set to TRUE to clear your terminal screen on program startup. Five bytes are allowed here for your own code. If you use less than five bytes, then set the unused following bytes to 00H. If FALSE, the value of the five bytes is irrelevent. HDRIVE Set to TRUE if you have a hard disk drive, else set to FALSE. HARDDK Your hard disk drive letter designation letter should be placed within the apostrophes. Do not change the -41H as the drives are numbered from zero, e.g., A=0, B=1, etc. If the HDRIVE equate is FALSE, then this is irrelevent. FAKDRM **** IMPORTANT: Read the comments at NOTES, below. **** If HDRIVE is TRUE then you quite possibly will have to set this equate to TRUE in order to "fake" a smaller MAXIMUM number of directory entries. If HDRIVE is FALSE, tnen you then you may be able to set this to FALSE. DRMSIZ **** IMPORTANT: Read the comments at NOTES, below. **** If HDRIVE and FAKDRM are both TRUE, then you may set this to a value of your choice, compatible with your tpa memory that you have available. For use on my Morrow, I have chosen the value of 04H. This is the value which is stored at location DRM+1. If FAKDRM is FALSE, then this value is irrelevent. ZERORC FALSE for almost all systems. Set to TRUE if you are using a Morrow hard disk system, or some other system, which sets the RC field of an unused directory entry on its hard disk (...and only on the hard disk) to 00H. VALURC This value should be 00H. It is only used if ZERORC is TRUE. SEKSIZ Set this to your LARGEST sector size used on your system. On the Morrow hard disk systems, this value should be 1024. --------------------------------------------------------------------- NOTES The DRM word value is the MAXIMUM number of directory entries allowed less 1. On a Morrow MD-11 this word value is 07FFH, which means that the MAXIMUM number of directory entries is 2048 (07FF hex = 2047 decimal). The tpa memory buffer space required for this many directory entries would be 2048 * 32 bytes per directory entry, totalling 65,536 bytes. Normally, I usually have 400-500 directory entries, so I've arbitrarily chosen the byte value of 04H to stuff into DRM+1 when sorting the hard disk drive. With this value, I have the capability of sorting 1024 entries which would require 32k (1024 * 32 = 32,768) bytes of tpa space for the buffer. Check the value of the DRM on your system to ensure that you will have enough tpa space available for the buffer. If you neglect to do this the program could bomb-out and leave your directory quite probably in a mess. If someone felt energetic and capable of writing the required code, a way to eliminate this memory problem would be for the program to write to and read from a user-selectable 2nd drive instead of using the tpa memory for the buffer. This program should be usable on other CP/M Plus systems, but you will have to do the final testing. I suggest testing on floppy drive. (In my original version I trashed my hard disk directory twoice before I used the floppy for further tests.) Also, when you test it on your hard disk, I recommend firstly backing up its files to floppy, tape, or whatever you use for your normal backup copies. This z80 version, v1.3, has been tested on my Morrow MD-11 or do I now call it a MD-20 (the original drive bit the dust and was replaced). Assemble the source code with ZASM or another z80 assembler. If improvements are made to this program, then please bump the VERsion number, month, day and year. If possible, then dump a copy of the new version (source and doc) back onto CompuServe and place back into the public domain. This is a public domain program and may be used freely by any and all. It may not be sold in whole or part, and may not be included with other software which is sold in whole or part. This is free public domain program. George F. Reding CompuServe EasyPlex [72436,45] or P.O. Box 86386 North Vancouver, B.C. Canada V7L 4K6