Pro_Partition v2.0.2 - 10/20/90 
<<Updated 12/18/11 with CFFA support notes>>

Copyright (c) 1988,1989,1990 by Steven N. Hirsch 

Introduction to Pro_Partition: 

The Pro_Partition utility allows you to create a PCPI compatible CP/M 
partition on any ProDOS hard disk.  It consists of a CP/M-based utility which 
places the partition on the disk, and a driver file that allows the CP/M 
system to recognize and use the area.

Theory of Operation: 

Pro_Partition 'steals' space at the end of a ProDOS hard disk volume.  At the 
minimum, 256k (512 blocks) of contiguous free area must exist past the highest 
block used by ProDOS.  During installation, you will be given the opportunity 
to decide the number of logical CP/M drives to be installed, the total amount 
of space dedicated to CP/M, and the number of allowable directory entries per 
logical disk. The option to remove an installed partition exists and will 
return the space to ProDOS under most circumstances.

Due to limitations in the Applicard's operating system, it is not possible to 
boot directly from the hard disk.  You will be creating bootable 5.25" floppy 
disks (in the usual manner) that will be used to kick-start the hard disk 
partition.  Although many Applicard users are not aware of this, there is no 
requirement forcing the drive which you physically boot (the first 5.25" 
disk..) to be drive "A:".  Thus, it is perfectly possible to define your hard 
drive as "A:", even though the system must boot from a floppy! 

Hardware Requirements: 

Apple IIe, or IIgs, with Applicard and ProDOS hard-disk installed. 
Pro_Partition has been tested with a large variety of drives and controllers, 
and ought to be compatible with anything.  Make sure that you are using 
PCPICPM (or STARCPM) version 2.0!  The version number is visible in the cold-
boot signon message on your system.

If you are using an enhanced //e (65C02 CPU) or a //gs, we have included some
modified driver files to make your life easier.  See Appendix C.

How to use: 

Boot CP/M as you normally would, making sure that your hard disk is connected 
and running.  If you are using the PCPI BUFFER.DVR for software print 
buffering, you MUST generate a working boot-disk without this driver present!  
The print buffer tries to reserve all free space in the host (Apple) memory 
for print spooling, and leaves none for us.  PRO/PART will abort with an error 
message if it cannot find enough buffer space.

Copy the files called PRO/PART.COM and PDOSHD.DVR to a work disk (NEVER use 
the distribution master for installation!)  Run PRO/PART.  The opening screen 
will request the slot number of your hard drive controller (this will usually 
be 7).  You also need to specify which drive is to receive the partition.  
ProDOS-8 supports two logical devices per slot (though your particular hard 
disk may not use both!) and the partition may be placed on either.  

     Note for RamFast Users:

     The CV Technologies RamFast SCSI controller re-maps any HD partitions 
     after the first two such that they appear to be in other slots.  This 
     trick is very neat, but applies ONLY to ProDOS.  The Pro_Partition 
     utility will NOT recognize any re-mapped partitions, ie. you must tell it 
     to use either Drive 1 or Drive 2 (if any) in the slot that actually 
     contains the card!

The next screen gives you the opportunity to quit the program if desired.  You 
will note two options for installation method.  Unless you are willing to 
accept some limitations on your ability to use disk utilities on the ProDOS 
host volume, I STRONGLY suggest the 'visible' partition method.  Please see 
the Appendix for more information.  Choosing option number one (Install 
Partition w/ Visible Method) will initiate a scan of the disk's current usage; 
this may take a few moments on a large drive.  A screen will then appear 
giving the slot, drive, and volume name of the selected drive.  The total 
storage size of the disk, highest block in use by ProDOS, and total space 
available for CP/M are displayed also.  A choice of 'Y' to the prompt advances 
you to the partition setup menu. 

The first field in partition setup permits you to select the total amount of 
data storage allocated to CP/M.  This defaults to all space available but, 
unless you have no interest in using ProDOS on this volume, it is probably 
unwise to accept this.  Clear the field with a Ctrl-Y, and enter the desired 
size.  All positions in the field must be filled, so precede a four-digit or 
three-digit entry with enough zeroes to meet this requirement.  Your entry 
will be forced to an even multiple of 8k bytes, regardless of what figure is 
entered. 
<<NOTE: If you create a ProDOS volume for the CFFA using CiderPress, do NOT make it 
65535 blocks or the partitioner will think there is no room left due to 
numeric underflow in the code.  Use 65534 as the maximum.>>

The next prompt allows you to pick the number of logical drives.  Due to the 
fact that each logical drive must be >= 256k, the legal drive count will vary 
with the total partition size selected; to a maximum of eight.  
<<NOTE: The maximum logical  drive size for standard CP/M is 8MB. Do not create a
logical drive larger than 8MB unless you know your system can support it.
ProPart will hang during creating of the partition if you attempt to create
a logical drive larger than 8MB.>>

You may then 
set the size and maximum number of directory entries for each.  Pro_Partition 
will default to an even division of the total CP/M area with 256 directory 
entries per drive - accept these numbers by entering a carriage-return or 
clear the fields with a Ctrl-Y and make your own entry.  When the last drive's 
data has been entered, the total remaining ProDOS size will be displayed at 
the top of the screen. 

The program does not allow backing up to an incorrect entry.  If you make a 
mistake, step through the defaults with a series of carriage-returns until the 
"Would you like to modify the partitioning?" prompt appears.  At this point a 
"Y" answer returns you to the first prompt for another try.

If you chose not to further modify the partitioning, the program will ask: 
"Install CP/M on disk?".  Entering "N" to this prompt returns you to the 
opening menu.  A "Y" choice writes out the partition data and creates the 
directories.  The program will report it's progress.  When it has finished, 
hit the spacebar to return to the opening menu.  The menu has changed, to 
reflect the fact that CP/M is installed on the disk. 

From this new opening menu, run option one, and verify that the partition data 
displayed agrees with the data you entered.  If all is well, run option two, 
which configures the device driver file for optimum usage of the Applicard's 
memory. 

NOTE: This configured driver must be used only with the partition you just 
installed!  If you choose to re-install the CP/M drive partition, the 
'configure' option must be run each time, the configured driver re-installed 
in DRIVERS and a new system written out! An error message will be given at 
boot time if a mismatch is detected. 

The partition is not yet accessible to CP/M.  Using INSTALL (provided with 
your Applicard's distribution diskette), generate a bootable work disk with 
the newly-configured PDOSHD.DVR file in DRIVERS.  As always, you MUST write 
out a system to the boot tracks after generating a new DRIVERS file.  We trust 
you are familiar with the system generation procedure as outlined in your 
Applicard manual!  The hard-disk driver will be pre-set for number of devices, 
but the choice of drive assignment is up to you.  It is strongly suggested 
that you NOT assign the hard disk to drive A: until proper system operation is 
confirmed (per next paragraph.) 

Boot the new disk.  If all has gone well, you will notice a brief flash of the 
hard-drive access light, immediately following the "LOADING DRIVERS" message.  
When the system prompt appears, try logging all logical disks on the hard-
drive.  Verify that files may be copied to/from the hard disk, and that 
directory programs report a correct size.  Now, try running an application 
from the hard disk to give things a bit of a workout. 

If no ugly messages appear, you have a working setup! This is now the time to 
install any files required to be on the boot volume (if you are using ZCPR3, 
NZCOM, or DateStamper..).  Next copy any working files to the hard drive 
(WordStar, dBase, or anything else that you would normally use).  If you wish 
the hard disk to start up as drive "A:", create a DRIVERS file that re-
positions the PDOSHD driver as device "0", and re-shuffle all else accordingly 
(DON'T fail to write out the system!!).  When the Applicard is re-started from 
the floppy with this new DRIVERS file, your hard disk will be drive "A:" (and 
whatever other logical drives are assigned to it..).

Remember:

1) NEVER perform any operation that re-writes the boot block and volume 
directory of the host ProDOS volume without having a complete CP/M backup 
available.  Under some circumstances you will be able to recover from this, 
but not always (see Appendix A.)

2) NEVER allow a disk utility (MR.FIXIT, ProSEL-16 volume repair, etc.) to 
free any blocks that it claims are not in use by files.  This is your CP/M 
partition, and ProDOS needs to think that it is unavailable!  Again, refer to 
Appendix A.

3) If you use the 'hidden' installation method, NEVER run an optimizer program 
such as BEACH.COMBER or ProSEL-16 Optimize on the host volume.  No immediate 
damage will result, but you will never be able to cleanly un-install the CP/M 
partition.  On some drives, not even a 'dirty' un-install (ie, erase and re-
format the partition) will prove possible!  BE WARNED...  WE RECOMMEND THE 
VISIBLE INSTALLATION METHOD.

The business stuff: 

Pro_Partition (PRO/PART.COM, PDOSHD.DVR, and this document) is Copyright (C) 
1988 and 1989 by Steven Hirsch.  Please do not distribute it to anyone else.  
The author would appreciate your feedback and/or suggestions for improvements 
to be made.  I will provide you (upon request) with any updates resulting from 
your (or anyone's) feedback.  Other interested parties may obtain a copy for 
$39.95 from me.

Although much effort has gone into the testing of this package, the author 
will not be responsible for any direct or consequential damages that may 
result from it's use.

I may be contacted by leaving mail on GEnie (STEVE.HIRSCH), or via US Snail.  
I am very bad at responding to postal-type mail, so please use GEnie if you 
expect a response.  Under some circumstances I may request that you call me 
via voice phone.  This is on your dime, and I will transmit my (unlisted) 
phone number to you in such cases. 

Appendix A

The original ('Hidden') method of installing CP/M on a hard drive involved 
setting the ProDOS volume size (in the volume directory) to an artificially 
low number; shortening the volume (so far as ProDOS was concerned) by the 
length of the CP/M partition.  The bitmap was also adjusted to reflect the 
"new" size, although this adjustment only occured in what ProDOS would regard 
as the "last" block of the "new" SHORTER bitmap.  The empasis here is 
deliberate.  Some potential problems were created by this method: 

Problems with the Hidden Method:

- Certain hard drives insist upon reporting their volume sizes (on a ProDOS 
STATUS call) based upon either internal partition information unrelated to 
information in the volume directory (OKS MultiKache and Apple SCSI <I 
think..>) or, worse yet, hardcoded data in the controller EPROM (older Sider 
10 & 20).  This could potentially be disastrous if a disk utility became 
confused.  It _is_ a loosely defined portion of the ProDOS device spec, so it 
is hard to tell who is wrong. 

- Volume repair programs such as MR.FIXIT will think that any blocks between 
the "new" bitmap end and the "old" bitmap end are erroneously marked as "in- 
use".  If you tell it to fix the directory, these will be freed for file 
storage.  If you write real information into the new blocks, then attempt to 
remove the CP/M partition, serious corruption of the volume bitmap will occur. 

- Along the same lines, a soft format of the partitioned volume would cause 
one of two problems:

     - If STATUS reports the modified drive size, the bitmap size  will be 
     incorrect upon re-format.  This is just the same as  running MR.FIXIT..

     - If STATUS reports the true volume size, then you will  totally lose the 
     CP/M partition.  The original PART program  had no ability to recover 
     from this type of damage.

- Optimizer utilities (BEACH.COMBER and/or ProSel-16 Optimizer) will similarly 
destroy the integrity of the upper bitmap.

- Archive programs such as Glen Bredon's BACKUP/RESTORE from ProSel-8 will not 
"see" the CP/M partition, and thus will not be able to back it up.  I think 
that the Sider tape backup program works the same way, as Glen wrote it. 

So what have I done about all this? Read on:

I had been un-happy with this compromise, thus the new PART program.  It will 
support the older "HIDDEN" CP/M partition and a new "VISIBLE" method as well.  
It additionally allows a prior installation to be converted to the new 
algorithm (and back again!).

The VISIBLE method leaves the volume size un-touched, and merely marks the 
areas of the bitmap corresponding the CP/M as in-use.  MR.FIXIT will report a 
large number of "unused" blocks marked as "in-use" and query you for 
permission to free them.  Do _not_ do this.  However, if you should happen to, 
all is not lost. 

Recovering from a "free unused blocks" utility:

Assuming that you have not written huge amounts of data to the disk, merely 
boot CP/M (yes, the driver will still be able to find the partition), then run 
PRO/PART.  First, convert the installation to HIDDEN, then immediately convert 
it back to VISIBLE and bingo! the bitmap is repaired.  This method may also be 
used immediately after a soft format.  I define "soft" as one that merely 
writes the ProDOS boot block, and re-initializes the directory and bitmap.  
Naturally a "hard" or low-level physical format of the disk will destroy 
everything on it..

The above technique will not currently do anything to restore a HIDDEN 
installation that has been re-formatted or MR.FIX'ed.  I am working on a 
method for doing this, but it will not be very simple and may involve some 
snooping with INFO.DESK or BLOCK.WARDEN.  Not for beginners.  For that reason, 
I am going to recommend the VISIBLE method for most users.

The new driver file automatically recognizes either partition method 
transparently to the user. 

Advantages of the Visible Method:

- ProSEL-8 BACKUP/RESTORE will now allow you to archive your CP/M partition 
along with the ProDOS files.  You may NOT use RECOVER to selectively restore 
the CP/M partition, as it does not represent a true ProDOS file.  A full 
restore would be necessary in the case of an accident. 

- You may use an optimize utility on your ProDOS files without fear of damage 
to the CP/M partition.

Appendix B

Advanced Users Only:

The latest version of PDOSHD.DVR will support multiple instances of the driver 
in your DRIVERS file.  In other words, you can support CP/M partitions on more 
than one ProDOS volume at a time.  Under normal circumstances, the driver 
searches downward from slot seven, checking Drive 1 and Drive 2 on each slot 
for the presence of either partition method on the ProDOS volume.  It stops at 
the first one encountered.

If you wish to have one CP/M partition on S7,D1 and another recognized on 
S4,D2 we now support that.  For this example, fire up your favorite debugger 
and load the PDOSHD.DVR file.  Near the start you will see a string "DR/SL:".  
The byte immediately following the colon is your patch point.  It defaults to 
zero, which means search as described above.  If you wish it to use a 
dedicated slot and drive, put the slot number in the low nibble, set the hi-
bit for drive two, or clear it for drive one. 

Example:

S4, D2 would require a byte of $84, while S7,D1 would be $07. 

Once the drivers are patched, I suggest that you edit the driver name string 
to reflect what they will now do, ie. "PDOS HD S4D1" or some such thing.  
Lastly, install the patched drivers at whatever logical drive positions you 
desire and generate a new boot disk.

Appendix C

Unfortunately, PCPI stopped all development and support of the Applicard 
slightly before ProDOS was released in 1984.  This also, of course, pre-dated 
the "Enhanced" //e and the //gs.  Some small incompatibilities have crept in 
over the years, and some modern devices were not supported.  As a bonus, I am 
including several files to make life easier.  I do not claim copyright to any 
of these things, nor do I support them.  Most are hacked from original PCPI 
code.

APLFLPY.DVR (ver 7)

The version of APLFLPY supplied with the Applicard does not recognize a Laser 
(Central Point) UDC controller with 5.25" diskette drive.  This driver should 
be used in it's place if you own one.

SFTVIDGS.DVR (ver 16)

The internal //gs printer and communications ports are identified by SOFTVIDEO 
as "super-serial" cards.  Unfortunately, their implementation does not support 
the SSC's "CMDBYTE" global at $5F8 + slot.  In plain English, this causes the 
driver to always output a setup string to the port before the first print job.  
It usually manifests itself by a "Z" appearing on the first line of the print 
output, or by bizarre printer behavior.  Use SFTVIDGS.DVR if you own a GS.

DISK35.DVR (ver 1)

This driver supports CP/M on a Unidisk 3.5, Appledisk 3.5 or Laser 3.5 on UDC 
controller.  Use COPYFRMT to initialize the disk.  Bootable support is only 
possible with the UDC or Unidisk 3.5 used with a buss interface card on //e.  
If this is of interest, please drop me a note on GEnie as the files are not 
included here.  Read/Write is supported for all Apple machines.

FAST2E80.DVR (ver 5)

With an enhanced //e or //gs, inverse lower case letters would appear as 
MouseText characters under CP/M.  This driver will solve that problem.

Is anyone interested?

During the initial development phase of the CardZ180 hi-speed CP/M card (9.2 
mhz. 64180), I developed a suite of programs that allowed you to boot the PCPI 
card from ProDOS, keeping ProDOS resident the entire time.  This allows:

1) Faster 5.25" floppy I/O via ProDOS's built-in driver (more efficient.)

2) Better support for ProDOS based block devices.

3) A means of transfering files directly between CP/M <--> ProDOS.  A menu 
driven utility was developed for this purpose.

4) Ability to start PCPI card from hard drive.

5) Ability to "QUIT" directly back to ProDOS in a blink of an eye, without a 
re-boot.

6) On a //gs, you can use Roger Wagner's SoftSwitch to hotkey back and forth 
between CP/M and ProDOS-8.

This code was viewed only as an interim step towards the CardZ180's o/s, and 
has languished in the depths of my archives for two years.  If there is any 
interest at all, I will unearth it and prepare it for distribution.  Price 
would probably be around $75.00, but I am open for suggestions.  Please drop 
me a note on GEnie if you would have an interest in purchasing this package.
