PCDISK V0.91 Beta -- freely distributable by Eddy Carroll, January 1994 INTRODUCTION PCDisk makes an entire hard disk partition appear as a single AmigaDOS file to programs, allowing Janus to use that partition to create a disk file for the Bridgeboard hard disk image. Since all file i/o can go directly to the partition without having to go through the standard AmigaDOS filesystem, performance is improved (particulary for writes). If you are not comfortable with mountlists, partitions, etc. now is the time to stop reading and delete PCDisk. I accept no responsibility for any damage or loss of data it may cause. However, by way of reassurance, myself and my beta testers have been running it for over a year without any known problems. INSTALLATION This is a beta version, and so lacks a fancy Install utility with GUI. To install, follow these steps: 1. Use HDToolBox or equivalent to create a new partition for your bridgeboard partition. 2. After rebooting, run the included DiskInfo utility on that partition and write down the Unit, Surfaces, BlocksPerTrack, LowCyl and HighCyl values. (For example, type "DiskInfo DH2:".) 3. Edit the included Mountlist and insert the above values at the points indicated by ???, then append the whole thing to DEVS:Mountlist. (See below for information about the IBM: entry in the same mountlist.) 4. Copy PCDisk-Handler into your L: directory 5. MOUNT PCD: to activate the handler (you may like to add this to your startup-sequence.) 6. Edit the SYS:PC/SYSTEM/ABOOT.CTRL file, which points to the disk file Janus uses for the PC hard disk. Change it to read PCD:/AUTO/S32/H8. This will select a PC autoboot partition which will appear to have 32 sectors per track and 8 heads. 7. Startup the PC Bridgeboard and boot off an MS-DOS floppy. Run FDISK to partition the drive and create a single partition at the maximum size (several partitions might work; haven't tried it.) 8. After FDisk has done its stuff, format drive C: under MS-DOS using the /S option to copy the system across. Install MS-DOS itself. (If you're running DOS 5, it will handle all the formatting etc. for you.) 9. Now reboot and you should be in business. If you have files already on your old PC partition that you want to copy across, read on. ACCESSING THE PARTITION ON THE AMIGA If you have CrossDos, you can mount the Bridgeboard partition under AmigaDOS using the CrossDos filesystem, which will allow you to access all your IBM files using standard CLI commands. Some tricky calculations are needed to make this work, for now; eventually, it will be automated. Essentially, what's happening is this. PCDisk-Handler looks at the entire Amiga disk drive as an IBM drive which is laid out as N cylinders with 8 heads and 32 sectors per track (for a total of 256 * N blocks of storage). The drive as seen by the Amiga will have a geometry that more closely matches the drives physical layout (e.g. 1 head, 256 sectors per track, or 9 heads, 40 sectors per track.) Using the start and end cylinders on the Amiga disk, the number of COMPLETE IBM cylinders that can fit into the same disk space is what PCDisk-handler will make available to Janus. Now, to mount CrossDos, we need to work out by hand what this set of overlapping cylinders works out as. So, use the following formula: H = Number of Amiga Heads S = Number of Amiga sectors per track LC = Amiga Low Cylinder HC = Amiga High Cylinder (LC * S * H) + (32 * 8 - 1) PCLowCyl = --------------------------- 32 * 8 LC * S * H + 255 = ---------------- 256 ((HC + 1) * S * H) - 1 - (32 * 8 - 1) PCHighCyl = ------------------------------------- 32 * 8 (HC + 1) * S * H - 256 = ---------------------- 256 When the two final equations are evaluated, throw away any fractions. So now we have a value for LowCyl and HighCyl in the IBM: entry in the mountlist. Or do we? Not quite... Janus includes a partition table at the start of the PC partition (the same one used by FDISK under MS-DOS) but CrossDos just wants a plain PC partition with no such complications. Now, the partition table takes up exactly one track (not cylinder) on the PC disk, so we need to tell CrossDos to skip a single track. The only way to do this is to change the disk layout from having 32 sectors per track and 8 heads and N cylinders to one having 32 sectors per track and 1 head and 8*N cylinders; we we can then skip past the first cylinder (the one with the partition table) and give the rest to CrossDos. So, do the following calculations: NewPCLowCyl = PCLowCyl * 8 + 1 NewPCHighCyl = (PCHighCyl + 1) * 8 - 1 Now, go back to the IBM: mountlist entry and put the above two values into the LowCyl and HighCyl entries. Also ensure the Unit number is set correctly (as originally reported via DiskInfo way back above) and that the BlocksPerTrack and Surfaces are set to 32 and 1 respectively. Now, if all has gone according to plan, you should be able to MOUNT IBM: and then DIR IBM: from a CLI to show the PC directory. If DIR doesn't produce anything useful, then you have very likely made a mistake in the above calculations; go back and check them. If it still doesn't work, then maybe I've made a mistake, so let me know. Regardless, you can't do any damage just by mounting an incorrectly specified IBM:, so don't be too concerned. If everything appears to be working, then you can copy files to it from AmigaDOS using the Copy command. One word of caution: some versions of CrossDos seem to have a problem creating directories on a PC partition that are accessible from MS-DOS; you may be wise to create all directories from MS-DOS itself just to be on the safe side. Important: Since the Bridgeboard and Amiga have no way of knowing when the other has written to the IBM partition, you need to synchronise access carefully. Always do a DISKCHANGE IBM: on the Amiga if you've recently written to the drive on the Bridgeboard side. If you've just copied files over from the Amiga, do a CHKDSK C: on the Bridgeboard (or reboot) to bring its internal representation up to date. Now that this has been done, you are in a position to copy across files from your original Janus disk partition. To do this, go back into SYS:PC/SYSTEM/ABOOT.CTRL and change it to point back to the original Janus disk file you were using (something like DH0:PCDRIVE/DRIVEC), MOUNT IBM: and then start the BridgeBoard. Now, using AWRITE under MS-DOS, you should be able to copy files to the new IBM partition by using: AWRITE *.* IBM: /S /B The /S handles sub-directories. If you are not running Janus 2.1, you probably won't have wildcard facilities with WRITE, and in that case, you have a much tougher job; you can either build a batch file to do all the copying for you, or more simply, just back up your PC partition to floppy and restore it to the new partition. Either way, when you've finished transferring the data, change the SYS:PC/SYSTEM/ABOOT.CTRL file once more back to PCD:/AUTO/S32/H8 and you should be finished! SWITCH OPTIONS You've probably noticed that PCD: seems to accept a CON: style list of settings after the device name. Here's a full list of all the switches recognised: /AUTO Include a 512 byte autoboot header at start of file /AMIGA Read sector and head info from the Amiga partition /IBM Use IBM settings of 4 heads and 17 sectors (default) /NEW Only allow opening of "new" files (fail MODE_OLDFILE) /Sx Set PC partition to x sectors per track /Hx Set PC partition to x heads per cylinder The /AUTO switch is needed because Janus expects a 512 byte header at the start of the file. It doesn't cause the header to appear physically on the disk (which would confuse CrossDos and other disk utilities), instead it magically makes it appear at the start of the file when the disk is being accessed via PCD:. /NEW is needed if additional Janus psuedo-disks are being mounted, also using PCD:. When you try to initialise a pseudo-disk under Janus (using the Create option), it first checks to see if the file already exists and fails if it does; the /NEW option allows this to be worked around. After the disk has been initialised, the /NEW suffix is dropped for normal access. I wouldn't recommend using Janus psuedo-disks (via the CONFIG.SYS handler) at this time; it can be made to work correctly, but it is messy and there is room for error. The main problem is that when you tell Janus to create a 10 meg partition, it will actually create anywhere between 9 and 12 megs, depending on what mood it is in. If it's too small, that's not a serious problem, but if it's too large, PCDisk-Handler will refuse to access the uppermost sectors on the disk and Janus will report disk errors. Eventually, I'll write a program to handle disk creation on the Amiga side which will solve this problem. The /AMIGA option is handy if you already have a PC partition on your Amiga disk, perhaps from the IBeM emulator or something similar, which is laid out using Amiga head and sector values. As long as the number of heads is <= 16 and the number of sectors per track is <= 62, you should be able to use it unchanged (and even boot off it) by setting SYS:PC/SYSTEM/ABOOT.CTRL to PCD:/AUTO/AMIGA. BUGS AND PROBLEMS The main bugs at the moment are Workbench 2.0 related. Programs such as CShell V5.19 can access the device okay (e.g. htype PCD:/AUTO/S32/H8) but Workbench 2.0 fails. I'm not quite sure why this is; it has something to do with the MatchNext() AmigaDOS 2.0 call. I'd like to get it working for completeness, but it's not necessary if the handler is only being used with Janus. HISTORY July 92 Receive my new bridgeboard; appalled by speed of disk emulation. Create PCDisk as a quick hack to fix it. July 93 Foolishly mention it in comp.sys.amiga.emulations and lots of people ask for copies :-) Email them out privately. Jan 94 People start asking can it be uploaded to Aminet. I give up my dream of ever having enough time to do a fancy 1.0 version and decide to release it as is. I hope it proves useful! FREEWARE AD (hi Ralph :-) I didn't have "The Amiga Guru Book" by Ralph Babel when I originally wrote this; if I had, any mistakes I've made would probably have been avoided. If you do any Amiga system programming, you owe it to yourself to buy this book. I got my copy from Hirsch & Wolf in Germany, phone +49-2631-83990 or fax +49-2631-839931. CONTACT If you have questions or problems, you can contact me at: ecarroll@maths.tcd.ie This is valid as of 16 January 1994. At some stage in the future, I'd like to add nice GUI install program that will work out your existing setup, create mountlist entries for both PCD: and IBM:, and other nice things. For now, good luck!