
------------------------------------------------------------------------------
  PSEUDOCD.TXT
  This file is part of the

  PseudoCD package (version 02)
  Copyright (C) C.Kulms, 1997

  This is free software; you can redistribute it and/or modify it
  under the terms of the GNU General Public License as published by
  the Free Software Foundation; version 2 of the License.

  This software is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this software; if not, write to the Free Software
  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
------------------------------------------------------------------------------

CONTENTS

0. Files you should have received
1. What is PseudoCD?
   1.1 Terminology
2. Why using PseudoCD?
3. How does pseudocd work?
   3.1 Accessing the image
   3.2 Device driver versus BIOS approach
4. How to use PseudoCD
   4.1 Create an image file
   4.2 Determine the driver parameters of an image
   4.3 Setting up config.sys
   4.4 Setting up autoexec.bat
   4.5 Loading high MSCDEX
   4.6 What to do if an image was physically moved
   4.7 The new driver variant
5. Error messages
6. Some serious warnings
7. Contact the author


0. FILES YOU SHOULD HAVE RECEIVED

Coming with the PseudoCD package you should have received the following files:

  GNU.GPL             GNU General Public Licencse version 2

  PSCDBIOS.SYS        variant of PseudoCD driver using the BIOS for hdd-access
  PSCDDDRV.SYS        variant of PseudoCD driver using the disk device driver
  PSCDDRIV.SYS        variant of PseudoCD driver
  CD2FILE.EXE         utility to create image files
  FILE4DRV.EXE        utility to determine PseudoCD driver parameters

  PSEUDOCD.TXT        this file
  TECHNOTE.TXT        additional technical notes
  FAQ.TXT             answers to frequently asked questions
  HISTORY.TXT         release notes

  MAKEFILE            makefile to rebuild .SYS and .EXE files

  ASRC\PSEUDOCD.ASM   source of the driver (both variants)
  ASRC\PSCDDRIV.ASM   source of the 'DRIV' variant
  ASRC\DRVDRIV.ASM    low-level routines for use of a disk's device driver
  ASRC\BIOSDRIV.ASM   low-level routines for use of BIOS disk functions
  ASRC\CDROMFA.ASM    CDROM routines (MSCDEX interface)
  ASRC\FINDFIRS.ASM   interface to old DOS service 'find first'
  ASRC\DRIVER.INC     device driver related stuff
  ASRC\IMAGHEAD.INC   header of an image
  ASRC\CDROM.INC      strucs/equs for CDROM access
  ASRC\DPB.INC        DOS' Disk Parameter Block structure

  CSRC\CD2FILE.C      main source of CD2FILE.EXE
  CSRC\FILE4DRV.C     main source of FILE4DRV.EXE
  CSRC\CDROMF.C       CDROM routines
  CSRC\BIOSDRIV.H     BIOS supported disk related stuff
  CSRC\CDROM.H        CDROM related stuff
  CSRC\DRIVER.H       device driver stuff
  CSRC\DRVDRIV.H      disk device driver related stuff
  CSRC\IMAGHEAD.H     header of an image

All files except GNU.GPL are copyright of C.Kulms, 1997.
The sources are coded for Borland TASM 2.0 and Borland TC 1.0.


1. WHAT IS PSEUDOCD?

PseudoCD is a software package to fool DOS applications making them think to
work with real CDROM drives while taking the data from an image residing on a
hard disk. It includes

 CD2FILE.EXE    program to create a CDROM image as an ordinary DOS-file
 PSCDBIOS.SYS,
 PSCDDDRV.SYS,
 PSCDDRIV.SYS,  device-drivers to access an image
 FILE4DRV.EXE   utility to determine parameters for PSCD*.SYS

1.1 TERMINOLOGY

In this documentation the term 'PseudoCD' is used in different ways. Sometimes 
it refers to the whole software package. Depending on the context it might 
refer to a working driver/image configuration. The term 'PseudoCD driver' 
means one of the files PSCDxxxx.SYS or an installed instance of them. 


2. WHY USING PSEUDOCD?

Compared to hard disks, CDROM drives have long seek times and poor transfer
rates. Today nearly everyone owns one or more large hard disks with capacities
of 800 MBytes or more, which enables you to copy an entire CDROM. Using an
image will significantly reduce the access time of CDROM based software.

It is also possible, provided you have enough disk space, to install several
PseudoCDs (that means multiple instances of the driver, each time associated
with a different image). That way you can use two or more 'discs' without
swapping, even if you have only one real CDROM drive.

In addition some older notebooks are not equipped with built-in CDROM drives.
Rather than attaching an external one, it might be possible to create a CDROM
image on a stationary PC, copy it to the notebook and access it with PseudoCD.

NOTE THAT DATA ON CD IS SUBJECT TO COPYRIGHT LAW. The appropriate permissions
should be sought before you create an image of a CD.


3. HOW DOES PSEUDOCD WORK?

PseudoCD is a combination of a CDROM image with a special device driver. The
driver is installed and acts like any other CDROM device driver; except for
AUDIO support it provides the same functionality (see TECHNOTE.TXT 1.).

Some functions (like SEEK, OPEN_DOOR) are simulated, which means they do
nothing but pretending to service these requests. All read requests made to
the device are performed by reading the corresponding sectors from the image:
An one-to-one sector copy of the CDROM preceeded by a small header. Other
calls to CDROM devices demand information not present in the sector copy (like
GET_VOLUME_SIZE, AUDIO_DISK_INFO). This data is stored in the header of the
image (see TECHNOTE.TXT 3.2).

Because of this behaviour MSCDEX (or any other program) is unable to
distinguish PseudoCDs from real CDROM devices. It does not 'see' the
underlying technique of accessing an image instead of a physically present
compact disk.

3.1 ACCESSING THE IMAGE

MS-DOS is not reentrant, that means you cannot call MS-DOS functions from
within MS-DOS. Unfortunately you are 'indos' at the time the CDROM driver is
called: The driver is called by MSCDEX which was called by MS-DOS which itself
was called by an application (see TECHNOTE.TXT 3.4). Anyway, the consequence
for the PseudoCD driver in order to work properly is, that it must not use DOS
calls (e.g. int 21h). Instead it has to use low-level routines, i.e. using the
disk's device driver or the BIOS.

3.2 DEVICE DRIVER VERSUS BIOS APPROACH

On developing PseudoCD I first tried to use the disk's device driver for
reading the image because it seemed to be the most general way: any type of
disk is accessible by its device driver. But then the idea to use the BIOS
arose. This avoids some 'MS-DOS incompatible' actions (see TECHNOTE.TXT 3.3)
and at first glance was not harder to implement.

The first pitfall in relying on the BIOS was the non-existing support for my
SCSI drive (I only have a dumb controller without own BIOS). The second was
one of complexity: the BIOS variant of the PseudoCD driver needs the number of
the first sector of the image in a notation hard to deduce from a given file
name. You have to deal with MS-DOS' organization of files, drive letters and
their correlation to partitions (see TECHNOTE.TXT 3.6).

So I resumed the development of the driver variant and forgot about the BIOS.
At last I decided to realize both approaches for performance reasons (the 
bios variant may be significant faster than the driver variant under DOS - 
under Win95 the driver variant should be faster).


4. HOW TO USE PSEUDOCD

The usage of PseudoCD involves four major steps

  (1) create an image of a CDROM
  (2) determine the driver parameters of an image
  (3) setup config.sys
  (4) setup autoexec.bat

Most of the times the first two steps are combined, i.e. after the image
creation the driver parameters are being reported to you automatically.
However, if you accidentally (or as an advanced user on purpose) copied an
image to a different place, you have to go through steps (2) and (3) to take
care of the new location.

Note: This package (version 02) contains a third driver variant you can use 
without step (2); see 4.7.

4.1 CREATE AN IMAGE FILE

An image file has to be stored in consecutive clusters; therefore you should
run DEFRAG.EXE !before! creating the image to ensure that the space allocated
for the file is a single, continuous one.

The utility CD2FILE creates CDROM images as they are needed by the PseudoCD
drivers. Insert the CDROM you wish to copy in (one of) your CDROM drive(s).

Then type

  CD2FILE CDROM-DRIVE

to just view the list of tracks on the CDROM without creating an image.

NOTE THAT DATA ON CD IS SUBJECT TO COPYRIGHT LAW.
It is shown whether the data on a particular CD has been flagged as 'digital
copy prohibited', by displaying a 'YES' or 'NO' under the banner 'copy'. The
appropriate permissions should be sought before you create an image of a CD
that contains one or more tracks flagged 'NO'.

Type

  CD2FILE CDROM-DRIVE [DRIVE:][PATH]FILENAME [COMMENT]

to start the process of image-creation
where

  CDROM-DRIVE  CDROM drive to read from
  FILENAME     name of the image file
  COMMENT      comment which will be displayed by the PseudoCD driver at
               installation time (optional)

CD2FILE will display some information about the CDROM found in the specified
drive. If there is enough free space for an 1:1 copy of the CD and the header,
the image file is created.

WARNING: Whenever you COPY an image file, move it to another disk, run DEFRAG
or use any other utility that changes the physical location of files on disk
the parameters for the PseudoCD driver change (see 4.6)! Therefore it is a
good idea to give an image file the 'system' attribute. These files are not
moved by DEFRAG and deleting them accidentally is somewhat more unlikely.

When CD2FILE has written the image it executes FILE4DRV.EXE which determines
the parameters for the PseudoCD driver.

4.2 DETERMINE THE DRIVER PARAMETERS OF AN IMAGE

Once the image file has been created you have to determine the required 
command-line parameters for the PseudoCD driver. (Except you use the new 
driver varaint; see 4.7) 

Use

  FILE4DRV [DRIVE:][PATH]FILENAME

where

  FILENAME    name of the image file

As discussed in 3.2 there are two variants of the device driver. For drives
supported by your BIOS (all IDE drives, any SCSI drives connected to a
controller with enabled BIOS extensions) you have to use the BIOS variant
(PSCDBIOS.SYS). For disks that are not accessible by the BIOS (e.g. SCSI
drives connected to a 'BIOS-less' controller) you have to use the driver
variant (PSCDDDRV.SYS).

FILE4DRV prints a line like:

 use: PSCDnnnn.SYS /devicename /x /y

where

  nnnn   is 'BIOS' or 'DDRV' depending on the type of the drive
     x   is a hexdecimal number, resp. a drive letter
     y   is a hexadecimal number

Read section 4.3 for an example (see TECHNOTE.TXT 3.1 for details).

Note: You may MOVE the file on the !same! drive because MOVE.EXE does not
change the location of the file.

4.3 SETTING UP CONFIG.SYS

Now edit your CONFIG.SYS and add the line

  DEVICE[HIGH]=PSCDnnnn /devicename /x /y

where nnnn, x, and y are the parameters displayed by FILE4DRV. For
'devicename' use a legal 8-character file name. This is the name for the
CDROM device which MSCDEX uses to take control of the device driver.

E.g. assume that FILE4DRV reports

  use: PSCDBIOS.SYS /devicename /801011 /6B34

then add to your CONFIG.SYS

  DEVICE=C:\DOS\PSEUDOCD\PSCDBIOS.SYS /PSEUDCD0 /801011 /6B34

if the PseudoCD package resides in C:\DOS\PSEUDOCD and you like the device
name 'PSEUDCD0'.

You may have to adjust (or insert) the LASTDRIVE directive in your CONFIG.SYS
to reflect that your configuration now includes an additional drive.

4.4 SETTING UP AUTOEXEC.BAT

If you add a new PseudoCD device to your system you have to modify the MSCDEX
line in your AUTOEXEC.BAT.

E.g. assume you named your PseudoCD device 'PSEUDCD0' and the current MSCDEX
entry is

  LH C:\DOS\MSCDEX.EXE /D:ASPICD0

then change it to

  LH C:\DOS\MSCDEX.EXE /D:ASPICD0 /D:PSEUCD0

That's all! Reboot to allow the changes to take place.

4.5 LOADING HIGH MSCDEX

If MSCDEX is loaded into high memory it may not be able to allocate enough
memory for the number of sector buffers demanded by the '/M' switch or even
the (default) minimum of 4 buffers per CDROM device. The number of buffers is
reduced automatically: No warning or error message alerts you!

This behaviour may result in the situation that DOS cannot find any files of
CDROMs. To avoid this use the '/E' switch or load MSCDEX into a large enough
memory region (in worst case the conventional memory).

4.6 WHAT TO DO IF AN IMAGE WAS PHYSICALLY MOVED

In this case run DEFRAG.EXE to ensure the image file is not fragmented.
One may check if a file is continuous with

  SCANDISK /FRAGMENT FILENAME

Then use FILE4DRV and modfiy your CONFIG.SYS as described under 4.2 and 4.3.

Note: If the image file is moved to another disk even the driver variant (BIOS
or DDRV) to use may change.

4.7 THE NEW DRIVER VARIANT

This package includes a third driver variant which is in fact a more comfort 
version of PSCDDRV.SYS. This variant (PSCDDRIV.SYS) expects a filename (with 
full path) as command-line parameter instead of the cryptic parameters shown 
by FILE4DRV. 

The usage in the CONFIG.SYS is

  DEVICE[HIGH]=PSCDDRIV /devicename /drive:\path\filename

where

  devicename       name to use (legal 8 character filename)
  drive            MS-DOS drive the image-file resides on (C,D,...)
  path\filename    path and name of the image file

All the other stuff (4.1, 4.4-6) remain the same.

I recommend the use of PSCDBIOS.SYS whenever possible since it is safe (refer 
to TECHNOTE.TXT 3.3) and faster. (Under Win95 the driver variant may be faster 
than the bios variant because of 'virtualisation overhead'.) 

Note: In the documentation of version 01 I wrote that you can not use 
PSCDDRV.SYS with disks managed by DOS' internal drivers. It turned out that 
you can. (It was a well hidden bug in an early version and I forgot to test 
the published version for this.)


5. ERROR MESSAGES

The error messages of the utilities should be self-explaining. If they are not
for you - at least note that you have done something wrong. Read the
documentation once more and try again.

The PseudoCD driver may display an error message at installation time. Please
refer to the following table:

message                    cause

invalid parameter          A parameter in the command-line in the CONFIG.SYS
                           is invalid or entirely omitted.

invalid image              The image-header does not contain the right
                           signature. (In most cases this error occurs if the
                           image has been moved. See 4.6)

general failure            Read of the image-header failed or in case of
                           PSCDDDRV.SYS (PSCDDRIV.SYS) the MS-DOS function 
                           'get DPB' failed (see TECHNOTE.TXT 3.3).

MSCDEX may report an error, too: Something like

  CDROM is no High-Sierra- or ISO-9660-format

In this case the image may be fragmented: If so, run DEFRAG.EXE and follow
steps 4.2, 4.3. Otherwise the image is corrupted.


6. SOME SERIOUS WARNINGS

All programs (executables and device drivers) are tested under MS-DOS 6.22
with MSCDEX 2.23 and may not work with other versions of DOS. The may not even
work with any other hardware / software configuration than the one being used
by the author.

You need a 386 compatible processor or higher.

PLEASE NOTE THAT USE OF THIS SOFTWARE MAY RESULT IN THE LOSS OF DATA OR OTHER
HARMFUL EVENTS. I MAKE NO WARRANTIES REGARDING THIS SOFTWARE WHATSOEVER.


7. CONTACT THE AUTHOR

Please e-mail your suggestions or bug reports to:

 caku@stud.uni-hannover.de

You may also refer to

 http://www.stud.uni-hannover.de/~caku/pseudocd/

These addresses may become void in 1998.

Note that I need information about your hardware / software configuration as
complete as possible. At least the processor, number and type of drives, DOS
version and a copy of your CONFIG.SYS and AUTOEXEC.BAT.


I would like to thank E.Walsdorff for his great assistance when writing this
documentation and his unflagging testing.

ck, 9/Dec/1997

