Dec 062017
 
Retrofits DOS to disk formatted w/o it.
File DISKPREP.ZIP from The Programmer’s Corner in
Category Utilities for DOS and Windows Machines
Retrofits DOS to disk formatted w/o it.
File Name File Size Zip Size Zip Type
DISKPREP.COM 1408 1023 deflated
DISKPREP.DOC 8965 3625 deflated
SYSTEM.BAT 461 263 deflated

Download File DISKPREP.ZIP Here

Contents of the DISKPREP.DOC file


From PC-Magazine Volume 5, Number 21, December 9, 1986
PROGRAMMING/UTILITIES, Jeff Prosise, pages 303-324

RETROFITTING A DOS SYSTEM

Every time you get out a new floppy disk, you face the choice of
whether to format it with or without the DOS system files. Having the
system on the disk is often handy, especially at boot time or when the
transient portion of COMMAND.COM gets overlayed. But space is
precious on a 360K disk, and the two hidden system files, together
with the command processor COMMAND.COM, eat up almost 40K of that
space in DOS 2.1, 68K in DOS 3.2.

Inevitably, you occasionally leave off the system files only to wish
later that you hadn't. The DOS SYS command doesn't help at this
point, since it can add a system only if the disk is blank or if
certain critical areas of the disk were initially reserved by using
the FORMAT/B option. Of course, if you'd had the foresight to reserve
the space, you'd have installed the system to begin with. (The /B
switch was included with DOS simply so that non-IBM software vendors,
who could not legally sell disks with copyrighted system files
included, could reserve room for users to add the system after
purchase.) Usually, your only recourse is to format a fresh disk with
FORMAT/S and copy everything from the old disk onto the new one.

DISKPREP.COM provides a better solution. DISKPREP rearranges the data
clusters, the file allocation table, and the directory of a nonsystem
disk so that the SYS command will successfully add the system even if
some of the disk files presently occupy territory needed by the
system files. It also lets you delete existing system files and
replace them with more current ones.

Transforming a nonsystem disk into a system disk is a three-step
process that begins by preparing the disk with DISKPREP. The syntax
for DISKPREP is simply

DISKPREP [d:]

where d: is an optional drive specifier for use if the target disk is
not in the default drive. Up to 44K of free disk space, depending on
the version of DOS you use, are required for SYS.COM to add the two
hidden system files. In addition, at least two entries in your disk's
root directory must be unused.

If DISKPREP finds that your disk has less than adequate space, it will
abort with a message indicating as much. If that happens, delete one
or more files to free up some room and try again. If the disk your're
prepping is already system formatted, the program will display the
message "System already installed - Delete old system (Y/N)?" and
await your keypress. If you respond with a Y, the old system will be
erased; if you answer N, execution will terminate harmlessly. In the
unlikely event that DISKPREP encounters an error condition such as a
lost cluster when traversing an allocation chain, it will abort with
an "Allocation chain error" message and leave you to your own devices.
Another possible but unlikely occurrence is that DISKPREP will find
one or more bad sectors in the area of the disk where the system is to
be installed. If that happens, the message "Bad sector in system
area" is issued and execution is aborted.

Once DISKPREP has finished, you use the SYS.COM program supplied with
DOS to install the system on the disk. This simply involves copying a
pair of hidden system files from one disk to another and ensuring that
they occupy certain areas in the directory and the data space.
Fortunately, SYS takes care of that task. SYS's syntax is almost
identical to that of DISKPREP and is detailed in your DOS manual.
Note that if you try to use the disk after DISKPREPing but before
SYStemizing, DOS will think that it's dealing with a newly formatted
disk and will respond to a DIR request with a "File not found"
message. Likewise, using CHKDSK to analyze a disk that has been
prepared but not yet SYStemized may produce some strange results.
Have faith: as soon as SYS.COM is run, your files will reappear intact
and the disk will be ready for use again.

The final step in transforming your disk into a complete system disk
is to copy the file COMMAND.COM from your DOS disk to the target disk.
This is necessary because, unlike FORMAT/S, SYS does not automatically
add COMMAND.COM for you. You simply use the DOS COPY command to
perform the transfer.

The three steps involved in the SYStemization process are natural
candidates for a batch file, and to facilitate just that use, DISKPREP
terminates with a return code that can be read by the conditional
parameter ERRORLEVEL. If the disk prepping process was successful,
ERRORLEVEL is set to zero. If the prepping process was not
successful for any reason, DISKPREP executes its normal abort routine
complete with a message revealing the nature of the error and sets the
ERRORLEVEL return code to 1. A suitable batch file (you might call it
SYSTEM.BAT) is listed below. It assumes that the program disk is in
the default drive and that the target disk is in drive B:

DISKPREP B:
IF ERRORLEVEL 1 GOTO END
SYS B:
COPY COMMAND.COM B:
:END

DISKPREP works on floppy disks of the 40-track variety with one or two
sides and eight or nine sectors per track. This covers all four 5 1/4
inch disk formats supported by versions of DOS prior to 3.0 but
excludes hard disks, high-capacity (1.2-meg) floppies like those used
by the AT, and the 3 1/2 inch disk cartridges used by a number of
laptop portables. Attempting to process one of the latter types of
disks isn't harmful: the program will quickly recognize the
unsupported format and abort with an "Illegal disk format" message.

Two cautions are in order. First, do not use DISKPREP on a disk that
contains subdirectories. While sometimes subdirectories will not
interfere with the reallocation process, at other times their presence
may cause an "Allocation chain error" message, prevent existing system
files from being deleted (resulting in the error message "Cannot
delete system files"), or result in a damaged file allocation table.
Fortunately, there's little use for tree-structured directories on a
floppy, anyway, so this limitation is not too serious. Second, it's
risky to try to prep a copy-protected disk, since many copy protection
schemes alter the disk format. DISKPREP should work with any current
release of DOS but may or may not be compatible with future versions.

If you run SYS.COM on a nonsystem disk that isn't empty without
first running DISKPREP, SYS will usually respond with a "No room for
system on destination disk" message. In some cases, however, SYS may
appear to add the files successfully, though you'll find that the disk
won't boot even though SYS apparently succeeded. So, check any disk
you SYStemize by booting your PC with it. If you have a disk with an
improperly installed system, DISKPREP can be used to correct it. The
program's ability to delete system files works just as well with a
faulty system as with one added properly. Even DISKPREP will
sometimes fail if you delete a system installed under DOS 3.1 and
resystemized with the DOS 2.1 version of SYS. If you encounter this
problem, don't dispair; DISKPREPing the disk a second time and running
DOS 3.1 SYS will restore it unharmed. There seems to be no problems
with replacing system files with a system of the same version of DOS
or later, which is the normal requirement.

DISKPREP begins by parsing the command line for a drive specifier.
If no drive is specified, DISKPREP uses DOS function call 19h to get
the default drive and thereafter uses the default as the target drive.
The drive identifier, whether input explicitly or by default, is
checked, and execution terminates if comething other than drive A: or
B: is specified. This provides one measure of assurance that DISKPREP
won't try to reallocate space on a hard disk.

Be aware that any program, no matter how extensive its testing and
use, may fall prey to hidden bugs or anomalies. [One user has
cautioned that ProKey should not be loaded in advance of using
DISKPREP, for example.] It's always prudent to keep backup copies of
important files and disks. But when you need to add a system to a
disk in use, DISKPREP's the easy way to go.


 December 6, 2017  Add comments

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)