RPL - Replace Copy Version 1.0 Holmes Compleat Computing Richard A. Holmes 4845 San Sebastian Avenue Las Vegas, NV 89121 February 12, 1987 This program is in the public domain. Permission is hereby granted for the non-commercial use of this program. No guarantee of suitability is made. Introduction ------------ RPL is a Z80 CP/M 2.2 program used to copy disk files. It can perform the basic function of PIP. There are however several differences. In addition to not accepting PIP's switches, these major differences exist: a. If the destination file already exists, it is overwritten in place. The file is not first copied and then renamed. If the new version of the file is longer than the old one, more space is allocated and the whole file is copied. If the new version of the file is shorter than the old one, the extra disk sectors are not deallocated. They exist as unused sectors on the end of the file. b. Before RPL allocates new space on the disk, it first creates a temporary file of (nominally) 4K. This space presumably is next to the directory. Then the new space is allocated for the file copy and the temporary file is deleted. Thus, if the space next to the directory is not allocated before the copy was performed, it remains unallocated after the copy. c. RPL can handle user numbers of the form du: where "d" is an optional disk name and "u" is the user number. For example, any of the following are acceptable as part of either the source or the destination file specification. A0: 3B: E14: 5: C: Why Use It? ----------- There are several cases where RPL is preferable over PIP. The first is when the destination disk does not have space for an extra copy of the file. Normally you would have to delete the file from the disk before copying it with PIP. RPL will simply overwrite the file so there is no need to delete it first. The second case is where you want to use user numbers on the source and the destination file specifications. RPL can copy to or from any user number. The main reason I wrote it follows. It has to do with running off of floppies and keeping space open at the beginning of the Drive A disk for SUBMIT's $$$.SUB file. Let me explain. I run on IMSAI's with Z80 cpus, floppies and ramdisk. Whenever possible, I load up ramdisk (drive E:) and make it the default drive. I still warm boot from the floppy. I also write the SUBMIT working file to drive A. I try to carefully lay out the system floppy disk in A: to optimize file access. That is, I keep some space free next to the directory (for $$$.SUB) and then come the system utilities, with the most frequently used nearest the directory. Whenever I want to update a file on this system disk, I do not want the space next to the directory to be allocated. The files on this disk are usually invariant in size. They are usually replaced by a different configuration of the same program. Usually such files will fit exactly over the old version. When the new version of the file is larger, I don't want the extra space to be allocated next to the directory. Therefore RPL creates a temporary file which "covers" this space on disk. It then copies the new sectors to the disk (farther away from the directory) and appends them to the old file. Then the temporary file is deleted, making the space next to the directory available again. Usage ------ RPL is executed with a command that looks like a simple PIP command. A> RPL out=in where "out" is the destination file specificaton and "in" is the source file specification. The file specifications may include a drive, user number,filename and extension. For example, A> RPL XYZ.ABC=A7:FOO will copy FOO from user 7 on drive A to XYZ.ABC in the current user area on the default drive. If the filename and extension are omitted from the destination filespec, then the filename and extension from the source filespec are used. For example, A> RPL E:=B:FOO.BAZ copies FOO.BAZ from drive B: to E:. Wildcard characters (* and ?) are allowed in the source filename and/or extension with the expected results. For example, A> RPL B:=E:*.COM copies the .COM files from E: to B:. Following the file specs may be a specification of how much space to reserve before allocating space to the copied file. The form is A> RPL out=in $nnk where "nn" is a one or two digit decimal number in the range 0 to 32. For example, A> RPL FOO=BAZ $8K specifies reserving 8K of disk space before allocating new sec tors to FOO. By default, 4K is reserved. Installation Procedures ----------------------- This program is distributed in RPL.LBR. The files included are: RPL.BLK F80 Common block declarations RPL.DCL F80 declarations for RPL.BLK RPL.DOC This documentation in printable form RPL.FOR F80 subroutines RPL.OBJ RPL.COM RPL.REL Microsoft REL file for RPL.FOR RPL.SUB SUBMIT file for working with RPL.FOR RPL.WS This documentation in WordStar format RS.SUB SUBMIT file for working with RPLSUBS.MAC RPLSUBS.MAC M80 subroutines and main program RPLSUBS.REL Microsoft REL file for RPLSUBS.MAC If you recompile/assemble, be careful of the load order. See the .SUB files for the proper sequence. Note that the program is 8K long, but expects there to be contiguous memory up to about 30K. It does not check for this, just uses it. There are some LDIR instructions and relative jumps in RPLSUBS.MAC. This means you must be running a Z80 machine or change the source code. If you find the program useful, feel free to send $5.00 to Richard A. Holmes 4845 San Sebastian Avenue Las Vegas, NV 89121