HDCPM
Contents
Introduction
HDCPM is an Amstrad CPC application that enables your computer to boot and run CP/M Plus from a mass storage device. A maximum of four 8MB partitions or virtual disks can be used to make the vast amount of 32MB of data available to CP/M Plus.
It comes in the form of:
- a standard background ROM that can be installed in any available ROM position.
- a standard binary file that can be loaded from floppy or hard drive.
HDCPM has been developed with modern DOSs, that support the FAT file system, in mind. This means that CP/M can use the same hard disk with other DOSs.
The following configurations are possible with one hard disk:
- One not partitioned, CP/M formatted hard disk. The whole hard disk is used by CP/M.
- One to four CP/M formatted partitions. Every partition is accessed as a separate hard disk by CP/M.
- One not partitioned FAT16 or FAT32 formatted hard disk. You can place one to four CP/M disk image files in the root directory. Every disk image file is accessed as a separate hard disk by CP/M.
- One FAT16 or FAT32 and one to three CP/M formatted partitions. You can place one to four CP/M disk image files in the root directory of the FAT file system. Every disk image file is accessed as a separate hard disk by CP/M. CP/M disk images have priority over CP/M partitions so if you have three CP/M image files and three CP/M partitions then HDCPM will mount the three CP/M images and only the first CP/M partition. If the first partition on your hard disk is formatted to FAT16 or FAT32 then HDCPM expects to find the file CPMDSK01.IMG in the root directory. Failed to do so the system won't boot.
- For interfaces that use SD card or USB flash drive as a mass storage device (M4 board, USIfAC II or Symbiface III) the only supported configuration is one to four CP/M disk image files in the root directory of the FAT file system.
Currently only the master IDE device can be accessed by HDCPM. The slave device is available to be used by your favourite DOS.
HDCPM can also utilize the RTC found in the Symbiface II in order to implement CP/M Plus BIOS function 26: TIME.
HDCPM is compatible with Dobbertin HD20 Harddisc and can be used together.
HDCPM has been developed with WinAPE* Z80 Assembler and was tested with WinAPE, CPCemu*, an Amstrad Plus 464 upgraded to 6128 and an Amstrad CPC 6128.
Although every effort has been made to ensure that HDCPM works properly, there is a chance of hard disk data corruption in case of a stray bug in the code. So make a backup of your hard disk before installing and trying out the ROM. I'll not be held responsible for any data loss or damage to your hard disk.
HDCPM distribution disk contains the following files:
- HDCPM.ROM the ROM itself
- HDCPM.BIN the executable binary file
- HDMGR.COM Hard Disk Manager utility
- RTC.COM RTC synchronization utility
- MAKEIMG.BAS CP/M image file creation utility
- MAKEIMG.BIN CP/M image file creation binary
- MAKEIMG.EXE CP/M image file creation utility for SYMBOS
- HDCPM.DOC the User guide
HDCPM is free software. It can be used and distributed with no restrictions.
Prerequisites
- Amstrad CPC/Plus computer capable of running CP/M Plus.
- ROM box or other ROM expansion hardware if using the ROM.
- Optionaly a FAT aware DOS like M4 ROM, USIfAC ROM, UniDOS*, CubeMDOS* etc if using the binary.
- One of the following mass storage interfaces:
- Symbiface II*
- X-Mass*
- uIDE-16* (base address = &FEF0)
- M4 board*
- USIfAC II*
- Symbiface III*
- and a compatible storage device with enough free space to accommodate the desirable CP/M hard disk configuration.
- Floppy disk drive for initialization of the file system.
- CP/M Plus system disks for making the system bootable.
- Optionally a Symbiface II compatible RTC.
Restrictions
- CP/M 2.2 or lower is not supported.
- In case of a patched or non AMSTRAD CP/M Plus the BIOS, BDOS, SCB base addresses must be equal to the ones used by the official distribution of the AMSTRAD CP/M Plus.
- Only the master IDE device is accessible by HDCPM.
- The maximum number of hard disk partition/images supported is four.
- Only primary partitions are supported.
- If you want to use CP/M disk images then they must be stored in a FAT16 or FAT32 formatted disk or partition.
- If the hard disk is partitioned then the CP/M disk images must be placed in the first partition of the disk.
- The CP/M disk images must be placed in the root directory of the FAT file system.
- The CP/M disk images must NOT be fragmented and must have the correct size.
- The CP/M partitions must be big enough to accommodate your CP/M file system. Otherwise the file system on the hard disk WILL get corrupted.
- Only storage devices with 512 bytes sector size are supported.
- Only storage devices with LBA addressing are supported.
- Date stamps of CP/M disk image files are not maintained.
- In case a Dobbertin Harddisc is also used you can't change its drive letters (D, E, F, G) as they are hard coded in the Dobbertin driver. Use the HDMGR utility to assign other available drive letters to your IDE drive, images or partitions. If you use the same numbers for your IDE media then the corresponding HD20 partitions will be unavailable under CP/M.
How it works
Using the ROM:
Upon computer power-up the HDCPM ROM will be initialized and will inform you of the presence of a compatible interface and RTC. Two bytes of RAM will be reserved for storing the interface type and M4 board ROM number (if found). The boot loader can be started by executing one of the following commands:
|HDCPM (no TIME function support) or |HDCPMT (TIME function support)
Alternatively it can be started by holding down the Tab key (no TIME function support) or Shift+Tab (TIME function support), during power-up.
Using the binary:
HDCPM can be started by running the HDCPM.BIN file from floppy drive or mass storage.
HDCPM will then execute the following functions:
- Search for a compatible mass storage interface.
- Move the boot loader and the CP/M patcher to RAM.
- Mount 1 to 4 CP/M image files and/or partitions and perform fragmentation and size test.
- Read the boot sector of the 1st hard disk and learn about the DPB, presence and size of the .EMS file, the startup drive, the drive letters and the CP/M console colour scheme.
- Read the .EMS file from the reserved track and store it in RAM just as the normal CP/M Plus boot loader does.
- Move the top of TPA and transfer the hard disk driver, RTC driver (in case of |HDCPMT) and initialize the XDPH, DPB, ALV of the mounted hard disks to the memory area just below the normal BDOS base address. The newly inserted code will be handled by CP/M as if it was a normal RSX.
- Patch the SCB in order to change the startup/default drive.
- Patch the drive table records to reassign drive letters for floppy drives 1 and 2, hard disks 1,2,3,4 (if any) and ram drive if Dk'tronics or Dobbertin RAM disk driver is present.
- Move the ALV of the Dk'tronics RAM disk if ZPM is detected.
- Patch the CP/M console with the desired colour scheme.
- Patch the system message.
- Do a normal CP/M cold start.
Any CP/M 3.0 compatible system that loads the BDOS, BIOS, SCB to the default AMSTRAD CP/M addresses should work. HDCPM will be able (hopefully) to patch it on the fly.
CP/M Plus disk image files
A CP/M Plus disk image file is a raw binary image of a CP/M hard disk or partition. Its name must be in the form CPMDSK0x.IMG where x=1, 2, 3 or 4 in order to be recognized by HDCPM. The size of the file depends on the Disk Parameter Block of the virtual hard disk it represents and for the initial release of HDCPM it is fixed and equal to 1 reserved track * 256 sectors per track * 512 bytes per sector + 8MB data = 8519680 bytes. If possible create your CPMDSK01.IMG file in a modern computer and copy it in the root directory of your FAT formatted medium. You can use the free online hex editor hexed.it or any hex editor capable of creating binary files filled with a specific pattern.
CP/M Plus disk/partitions
You can also create one or more partitions in order to format them to CP/M file system and use them exclusively for CP/M. In such case you must make sure that the size of the partition is big enough to accommodate your file system.
HDCPM examines the hard disk's MBR upon start and finds the partition information. Then it finds the LBA of the first sector of each partition and passes it to the CP/M hard disk driver. The CP/M hard disk driver doesn't know anything about partitions. It accesses the partition as if it was a real hard disk.
HDCPM can't be used to partition your hard disk. In order to create partitions you must connect the hard disk to a modern computer and use its partitioning utility.
Use the command |HDDEF to find the exact length of the file system/partition. When you have created the partition use the HDMGR.COM utility in order to format it.
This configuration is only to be used with Symbiface II or uIDE-16. USB flash disks and SD cards should not be partitioned as they will not be detected by their interface ROM.
Installation
Using the ROM:
- Install the HDCPM ROM in a free ROM slot of your ROM box.
- Plug in your Symbiface II compatible IDE interface, uIDE-16, M4 board or USIfAC II and attach the proper mass storage device.
- Power on your Amstrad. You should see the ROM initialization message: 'CP/M+ Hard Disk boot loader v1.04 (S2)'.
The type of interface found will be show inside the parentheses:
- (S2): Symbiface II compatible interface
- (uI): uIDE-16 interface
- (M4): M4 Board
- (US): USIfAC II
- (S3): Symbiface III
In case a RTC is detected you will also see the RTC initialization message and the current date and time: 'RTC found: 2021/01/01 12:01'
- Use your original CP/M Plus system disk set to Boot CP/M Plus.
- Use the provided HDMGR.COM utility in order to format the disk image or partition and transfer the .EMS file to the reserved track. Change the start-up drive letter to that of your first CP/M hard disk.
- Reset your AMSTRAD and boot CP/M from the hard disk with the command |HDCPM. The Boot loader will check your image file(s) against fragmentation and correct size and boot the system to the CP/M command prompt. If the first image file is fragmented or has the wrong length the system will not boot. All other image files will be ignored if found to be fragmented or have the wrong length.
- In case you don't use CP/M image files just boot the system with |HDCPM or |HDCPMT
- Copy the files from your CP/M system floppy disks to the first hard disk.
- Copy any other needed application etc. to your CP/M hard disk(s).
- You are ready to go.
Using the binary:
- Plug in your Symbiface II compatible IDE interface, uIDE-16, M4 board or USIfAC II and attach the proper mass storage device.
- Use your original CP/M Plus system disk set to Boot CP/M Plus.
- Use the provided HDMGR.COM utility in order to format the disk image or partition and transfer the .EMS file to the reserved track. Change the start-up drive letter to that of your first CP/M hard disk.
- Reset your AMSTRAD and insert the HDCPM floppy disk. If using a FAT aware DOS you can copy HDCPM.BIN to your mass storage device.
- You are ready to go.