Difference between revisions of "UIDE Universal IDE adapter cards for Z-80 computers"

From CPCWiki - THE Amstrad CPC encyclopedia!
Jump to: navigation, search
(BASIC program to load the driver from a DOM)
(BASIC program to load the driver from a DOM)
Line 330: Line 330:
 
There may be other ways to achieve this (such as using a LocoLink cable) but it is out of scope of this WIKI page. If in doubt, ask on the forum.
 
There may be other ways to achieve this (such as using a LocoLink cable) but it is out of scope of this WIKI page. If in doubt, ask on the forum.
  
=== BASIC program to load the driver from a DOM ===
+
=== BASIC program to load the driver from a DOM or CF card ===
 
If you choose to buy one of my DOMs, I can load it with the xdriver FID file and the uIDE image I describe below. You can also download and copy the uIDE hard disk image onto your own IDE device as this has the driver file preloaded (see below for instructions).
 
If you choose to buy one of my DOMs, I can load it with the xdriver FID file and the uIDE image I describe below. You can also download and copy the uIDE hard disk image onto your own IDE device as this has the driver file preloaded (see below for instructions).
  

Revision as of 08:03, 10 March 2017

uIDE-8
uIDE-16

About the uIDE project

The uIDE concept is not terribly new (search for GIDE and you will see what I mean, although these adapters are not available any more).

The idea was to produce a low cost IDE adapter, suitable for connecting to Z-80 computers via a shim board that fits between a (socketed) Z-80 and its main board socket. From the shim, a 40 way IDC cable is connected to the uIDE adapter board, then a CF card or DOM plugs into the other end (if there is space inside your Z-80 computer, you may be able to connect the shim and uIDE cards directly together without a cable). uIDE cards are "universal" because their I/O base address is fully configurable via a row of 2 position jumpers on the board.

Once the hardware is installed, drivers need to be written (see below).

uIDE-16 can be configured for use on any Z-80 microcomputer such as the CPC range of computers. It is called "uIDE-16" because it decodes all 16 address bus lines to provide access to the IDE ATA registers as is required by the Amstrad CPC machines, yet it has an 8-bit addressing mode so that it can be used with other Z-80 machines that only use the lower 8 bits of the address bus for I/O addressing. In this mode, some components (U1 and its socket and smoothing capacitor) may be left off the board.

uIDE-8 is a similar design that just decodes the low 8 bits of the Z-80 adddress bus, and this can be used on the PCW and most other Z80 machines but not on the CPC machines. uIDE-16 has a user-configurable 8-bit mode that allows it to work with 8-bit addressed I/O as well. However, uIDE-8 is slightly smaller and cheaper than uIDE-16.

Project status

As of now (Early Feb 2017) uIDE-16 is in the design phase, but the boards have been laid out. Click the images around the page for a closer look. uIDE-8 was prototyped and tested successfully on the PCW 9512. A FID based driver has been written that supports Amstrad CP/M and Locoscript (but it cannot cold boot the machine).

Update 05/07/17: The first batch of 10 uIDE-8 boards has been ordered but I found that there was an error in the order that will make them unusable, so I added the following to my original order:

  • 10 uIDE-8s (corrected)
  • 10 Z80 LHS Shims
  • 10 Z80 RHS Shims
  • 10 PCW Expansion port adapter with composite video
  • 10 PCW Expansion port adapter "lite"

Update 13/02/17: All boards have been re-ordered with expedited shipping, including uIDE-16. Some layouts were altered slightly. I still need to build one uIDE-16 and CPC CP/M Plus drivers for testing. The order comprises of:

  • 10 uIDE-16
  • 10 6128 expansion port to Z80 bus adapters
  • 10 Z80 LHS Shims
  • 10 Z80 RHS Shims
  • 10 PCW Expansion port adapter with composite video
  • 20 uIDE-8
  • 20 PCW Expansion port adapter "lite"

Update 18/02/17: The first three uIDE prototype boards have arrived from OSH Park. They are very, very pretty. I built two of them and they both work. See the forum thread linked to below for details and pictures. Note: The boards I will provide will be red or blue (but mostly blue).

Update 26/02/17: I wrote a small BASIC program that allows you to retrieve the driver file from one of my DOMs. You can use this to get the driver onto your PCW if you have no other way to transfer files from a PC. See further down the page, and prepare to do a bit of typing!

Update 01/03/17 (1): There is a problem with the uIDE-8 boards which will require replacing Q1, R5 and R6 with a small single inverter IC. An additional two jump wires will be required to connect the other 2 legs of the IC. Pictures to follow.

Update 01/03/17: (2) There is a problem with the uIDE-16 boards which prevents the 8-bit addressing mode from working. The workaround is to cut two tracks on the underside of the board and fit two jumper wires. You only need to do this if you want to use the 8-bit addressing mode - if you are going to fit uIDE-16 to a CPC machine, there's no need to alter the board. Pictures of this alteration are on the CPC6128 uIDE-16 thread.

Update 01/03/17: (3) Both LHS and RHS shims passed testing. No issues.

Update 02/03/17 First successful test of uIDE-16 and 6128 expansion port adapter.

Update 04/03/17 I have added a section below that lists the limitations of the device and its driver.

Feature list

  • Compact design, only 4 ICs (uIDE-16) or 2 ICs (uIDE-8) and a smattering of discreet components. Board measures 79x60mm (uIDE-16).
  • Implemented using cheap, readily available parts (7400-series ICs only, plus some capacitors, resistors and LEDs).
  • Can be connected to the PCW expansion port (see below) or internally via a Z80 shim card (note, this requires a socketed Z80).
  • Driver supports Amstrad PCW CP/M Plus only at this time (it is implemented as a FID).
  • A separate driver exists for Lifeboat CP/M 2.2 on the TRS-80 Model II that can be ported on demand to other CP/M 2.2 variants.
  • The CP/M driver runs the IDE device in LBA / 8 bit mode, so DOMs or CF cards are recommended (at least 128MB is recommended).
  • Fully programmable I/O address decoding (via on-board jumpers). Initial I/O range (uIDE-16, for the as yet unwritten CPC driver) is FEF0-FEF7 and (uIDE-8, for the PCW driver) is C8-CF, but you can change this to suit your own hardware / driver.
  • Can be used on any other Z80 computer with a socketed processor.
  • Implements a standard bus connector that exactly matches the Z80 pinout. Further expansions are planned, including a Z80 bus board, serial port, parallel port (possibly a clone of the CPS8256), mouse port, dk'tronics sound clone (PCW), etc.

Limitations

  • The driver implements a CP/M format on the IDE device, so it is not directly readable on a PC using the Windows File Manager. However, you can use Win32DiskImager to get a copy of the entire disk, then cpmtools to extract files or put them back onto the disk image (see below).
  • uIDE may not be compatible with certain types of IDE device (CF cards, DOMs).
  • There is no driver support for IDE CD drives.
  • There is no driver support for uIDE-16 on the CPC6128 yet. I'm working on it.
  • Any IDE device connected to uIDE should support IDE-ATA 8-bit data transfer mode. If you connect a device which only supports 16-bit mode, you may find it is incompatible or has half the expected space available (this is because in ATA 16 bit transfer mode, the interface only uses 8 of the possible 16 transfer bits).
  • Expect this list to be expanded as more questions are asked!

Z80 Shims

Left handed Z80 Shim card
Right handed Z80 Shim card

These small cards are inserted between the Z80 and its socket, and present all 40 pins of the CPU via a 40 way header. This header is the "Z80 Bus" that the uIDE cards connect to.

Choose the one that fits best inside your machine. A CPC6128 needs the left hand shim, although space is very tight under the keyboard (the processor sits directly behind the expansion port) and it's not known yet whether it will fit properly. PCW machines also require the LHS shim, so the case can be fitted.

Important: Check your machine has a socketed Z80 before ordering a shim (you should open it up anyway to decide which shim gives the best mounting solution). If the Z80 does not have a socket and you are not willing to desolder the Z80 and fit a socket to the machine, then a shim is not the solution for you.

Machine-specific expansion port adapters

Use one of these cards if you prefer to connect your uIDE card to the machine's expansion port rather than via its Z80 socket.

PCW 8256/8512/9512

PCW Bus adapter with composite video output
PCW Bus adapter "lite" (no composite video)

These cards allow connection of a uIDE card to the 50 way expansion port on the back of the machine. They are designed to support the PCW edge connector type port, but the European Centronics type port might be accommodated if a suitable connector exists (50 way Centronics, 2.54 header pitch). In addition they provide access to the PCW's 5v and 12v power supply, as well as other signals from the card edge connector. One variant has a small composite video circuit so that you can connect an external monitor to the PCW.

CPC 6128

CPC 6128 Bus adapter

The CPC 6128 bus adapter is a card which plugs directly into the 6128's expansion port with the front face of the board facing away from the CPC. The image shows an early render from OSH Park. Per the other adapter cards, uIDE plugs into it via a 40 way IDC cable.

BOMs

For self assemblers, I drew up a parts list broken down by board with Farnell order numbers. I recommend you shop round for these parts, after seeing what they look like on Farnell. Also, you have options where there are alternatives shown. In particular, with the edge and IDC connectors, consider how you wish to mount and connect the boards and select the connector appropriately. The exapansion interfaces are designed to have an edge connector soldered to the back of the board, so that it sits over the slot with the components facing away from you (if you are sitting in front of the computer), but if you choose to use a 50 way IDC connector (with cable to expansion port) then you can mount it on the component side of the board.

File:All board BOM.csv

Connectivity options

Here is a table summarising your options for connecting a uIDE device to your computer.

500px

Choose one option from each column. Some guidance notes:

  • Expansion adapters connect to the rear edge connector of your PCW or 6128. Choose one if you don't want to fit the uIDE internally or your Z80 is not socketed.
  • Z80 shims are for general purpose use and will fit any Z80 machine with a socketed processor. Choose LHS or RHS dependant on the space and orientation of the CPU in your machine.
  • Direct connection (between the host adapter and uIDE device) means soldering the Z80 bus header pins on each board directly together. Note, some combinations may prevent this, or may require odd orientation of the two cards.
  • The IDE device can plug directly into the uIDE board. Angled IDC connectors are recommended when building the board.
  • A DOM is recommended as it is the only device I have tested the uIDE prototype with. Unfortunately, I can't guarantee that specific Compact Flash cards will be compatible but if you let me know what works and what doesn't we can build a compatibility list on this page.

Information for self builders

uIDE-16 fix for 8-bit mode

The current version of uIDE-16 (v0.3) has some errors that prevent the 8-bit addressing mode from working. If you want to use it in 8-bit addressing mode, some modifications are required as shown below.

UIDE-16 v0.3 8-bit fix.PNG

On the underside of the board:

  • Cut the tracks marked with a red disk.
  • Add the links marked with a green disk.

Please note, for the CPC6128 you use 16-bit addressing mode, and these modifications are unnecessary.

uIDE-8 74LS02 considerations

The timing of the Z80 /RD signal is very tight, so the choice of NOR gate IC that you put at U2 is critical. Choose a fast part such as a 74F02. At least one manufacturer, Misubishi, makes a fast enough 74LS02 and that is what I used in my prototype. It has a propagation delay of 6-15ns, and the typical delay is somewhere in between, say 9ns. This appears to be the lowest speed the design will allow, although I have only tested with a few '02 variants. If in doubt, check the manufacturer's datasheet and don't buy anything with an average propagation delay larger than say 9ns. I've listed the delay times for several different '02 logic chips below. It's quite surprising what the propagation time range is for parts that are supposedly "standard".

Note: In the table, "Likely" means "my best guess based on the published proapgation delay times". Avoid anything that is "Not comaptible".

74??02 Propagation times

Maker / type tPHL min tPLH min tPHL max tPLH max Datasheet Comment
Motorola SN74ALS02 14 14 22 22 http://pdf1.alldatasheet.com/datasheet-pdf/view/5703/MOTOROLA/SN74LS32.html Not compatible
TI SN74LS02 8 12 15 22 http://www.ti.com/lit/ds/symlink/sn74ls02.pdf Not compatible (tested)
Hitachi 74LS02 10 10 15 15 http://pdf1.alldatasheet.com/datasheet-pdf/view/63971/HITACHI/74LS02.html Not compatible
Mitsubishi 74LS02 6 6 15 15 http://www.datasheetspdf.com/datasheet/download.php?id=770368 Compatible (tested)
Philips/NXP ALS02 2 2 10 12 http://pdf1.alldatasheet.com/datasheet-pdf/view/15231/PHILIPS/74ALS02.html Likely not compatible
Fairchild LS02 - - 18 15 http://pdf1.alldatasheet.com/datasheet-pdf/view/51020/FAIRCHILD/74LS02.html Not compatible
TI 74S02 8 12 16 22 http://www.futurlec.com/74S/74S02.shtml Not compatible
Tesla 74ALS02 12 Likely not compatible
TI 74F02 1 1.7 5.3 6.5 http://www.ti.com/lit/ds/symlink/sn74f02.pdf Likely compatible
Fairchild 74F02 1.5 2.5 4.3 5.5 http://www.futurlec.com/74F/74F02.shtml Likely compatible
Philips 74HCT02 7 9 http://www.futurlec.com/74HCT/74HCT02.shtml Likely compatible
Philips 74F02 2 2.5 4.3 5.5 http://pdf.datasheetcatalog.com/datasheet/philips/74f02.pdf Likely compatible
Signetics 74F02 2 2.5 4.3 5.5 p.73 of http://bitsavers.informatik.uni-stuttgart.de/pdf/signetics/_dataBooks/1987_FAST_Data_Manual.pdf Likely compatible

If in doubt, ask on the forum or choose a 74F02 or known working type shown above. If you find working types that are not listed, or are shown as not compatible, please let me know so I can update the list.

As a result of this investigation, the BOM was updates to specify a 74F02 for U2.

Pictures of the built boards

I present here some photos of the finished boards for reference. Click on an image for a closer look.

uIDE-8 card built and configured for the PCW
uIDE-16 card built and configured for the CPC6128
(bottom to top) PCW video, PCW lite and CPC6128 expansion port Z80 bus adapters, front view.
(bottom to top) PCW video, PCW lite and CPC6128 expansion port Z80 bus adapters, underside view.
Z-80 Shim, left hand bus connector.
Z-80 Shim, right hand bus connector.

Notes

  • uIDE-8 is configured for the PCW driver's I/O address. Note the jumper settings.
  • uIDE-16 is configured for the proposed 6128 driver's I/O address, and is set for 16-bit mode, Again, note the jumper settings.
  • If you are building uIDE for a specific machine, you can solder links in place rather that fit header pins and jumper shunts. However, ensure the address configuration is correct, before soldering the links!
  • The expansion port pictures show (front to back, respectively) the PCW video adapter, PCW "lite" adapter, 6128 adapter.

Testing the IDE device

In the PCW driver distribution there is a program called XTEST.COM that tests and returns information about connected IDE devices.

There is also a version of XTEST.COM for CPC6128 CP/M Plus that you can use to check that your uIDE-16 is working correctly: File:XTEST-6128.zip

To use, issue the command XTEST, followed by any combination of the following options:

 -t[m|s]	perform IDE diagnostic on m (master) or s (slave)
 -s[m|s]	summary info on m (master) or s (slave)
 -i[m|s]	interrogate m (master) or s (slave), full report
 -q	quiet mode, only prints confirmation and error messages
 -h	prints the help message and exits without formatting

If you do not enter any options, XTEST prints the help message and exits.

  • Note: For the PCW and 6128, you should always use the "master" option.

Interpreting results

The diagnostic result shows the values of the Status and Error registers in hexadecimal, following an IDE Diagnostic command (90h). The Error register is only valid if bit zero of the Status register is set. Refer to the IDE spec, Section 9.7 ("Execute drive diagnostic") for details.

The Summary information returns the text fields from the IDE Identify Drive command (ECh). They are the Model Number ("CtrlModl"), Serial Number ("CtrlSer") and Firmware Revision ("CtrlRev") fields from Table 10 in the IDE spec (Identify Drive, Section 9.9).

If XTEST reports the drive is not found or times out, or you do not get a sensible looking result in the text fields, it is likely that your uIDE is connected incorrectly, there was an error in assembly or configuration, or you are using an IDE device that is not compatible. The IDE device should return meaningful values. For example, the 128Mb PQi DOMs return "PQI IDE DiskOnModule" in the CtrlModel field (space paddded).

The full report contains all the fields returned by the IDE Identify Drive command (ECh). Refer to Table 10 in the IDE spec (Identify Drive, Section 9.9). The fields are identified by a word offset, but XTEST uses a specific label for each. To locate the correct description for the XTEST label, refer to this table:

 XTEST label	Word	Comment
 --------------- ------- -----------------------------------------------------
 Config		0	General configuration bit field
 NumCyls	1	Number of cylinders
 res0		2	Reserved
 NumHeads	3	Number of heads
 BytesPerTrk	4	Number of unformatted bytes per track
 BytesPerSec	5	Number of unformatted bytes per sector
 SecsPerTrack	6	Number of sectors per track
 d1		7	Vendor specific
 d2		8	Vendor specific
 d3		9	Vendor specific
 SerNo		10-19	IDE device serial number
 BuffType	20	Buffer type
 BuffSize	21	Buffer size in 512 bye increments (so, 1 = 512 bytes)
 ECCBytes	22	Number of ECC bytes available on r/w long commands
 CtrlRev	23-26	IDE device firmware revision
 CtrlModl	27-46	IDE device model designation string
 SecsPerInt	47	Bits 0-7 gives sector tx max for r/w multiple cmds
 DblWordFlag	48	0001h = can perform double word i/o, else cannot
 Capabilities	49	Bit 9: LBA Supported / Bit 8: DMA supported
 res1		50	Reserved
 PIOtiming	51	Bits 8-15: PIO data transfer cycle timing mode
 DMAtiming	52	Bits 8-15: DMA data transfer cycle timing mode
 res2		53	Reserved
 CurCyls	54	Number of current cylinders
 CurHeads	55	Number of current heads
 CurSPT		56	Number of current sectors (per track)
 SecCapLo	57	Device sector capacity low byte
 SecCapHi	58	Device sector capacity high byte
 SecParams	59	Refer to IDE Spec
 LBASecCapLo	60	Total number of sectors in LBA mode (low byte)
 LBASecCapHi	61	Total number of sectors in LBA mode (high byte)
 swDMATxModes	62	Refer to IDE spec table 10
 mwDMATxModes	63	Refer to IDE spec table 10

SecCap and LBASecCap are 32 bit integers, and are printed in the correct order as hexadecimal in the report. To get the full value, concatenate them and feed the resulting value into a calculator with hex conversion. For example, a PQI 128Mb DOM has SecCapHi of 0003 and SecCapLo of E800h, which gives the value 0003E800. This is 256,000 sectors (in base 10), not quite 128MB.

Using the formatter XFORMAT.COM

XFORMAT is the program used to prepare a master or slave IDE device for use by formatting it.

To use, issue the command XFORMAT followed by any combination of the following options:

  • -m format the IDE Master device
  • -s format the IDE Slave device
  • -f force format (does not ask for confirmation)
  • -q quiet mode, only prints confirmation and error messages
  • -h prints the help message and exits without formatting

If you do not enter any options, XFORMAT prints the help message and exits.

XFORMAT does not assume a default for -m or -s, because formatting a drive removes all the drive's data, and we don't want this happening accidentally.

When you specify -m or -s, XFORMAT will format the specified devices and for each one, ask for confirmation (unless -f is specified). At this point you must enter y to proceeed (upper or lower case), or any other character to cancel. XFORMAT will then report on each partition (logical drive) as it is being formatted, by way of an ascending counter from 00 to 15.

When you specify -s, XFORMAT will print an error if no slave drive is attached to the uIDE interface.

Formatting assumes a minimum of 128MB available on the IDE device(s) being formatted. Since each partition has 8MB of space, a 128MB IDE device will yield 16 8MB partitions (but note that certain devices, such as the PQI DOM, have just short of 128MB because they round the number of 512 byte sectors down).

Using smaller IDE devices is possible though not recommended as no tests have been carried out.

You can use XFORMAT at any time. If the XDRIVER is loaded, XFORMAT issues a system disk reset (BDOS call 0Dh) to ensure that all disk allocation buffers are cleared down.

Drivers

At present there is a driver for the PCW which is a FID ("Field Installable Driver") file. To install it, simply copy it to your boot disk (USER 0). Not all CP/M Plus versions support FIDs though (notably the earlier ones - see below).

The driver's capabilities are:

  • Detection of the uIDE card, unloads if not found.
  • Provides up to 6 CP/M drives C: D: E: F: G: H:. This appears to be a limitation of the Amstrad CP/M Plus memory map and there may be a workaround (no promises, though!). Depending on what expansions you have connected to the PCW, you may have fewer than this (for example, if the Amstrad CPS8256 Serial/Parallel device is fitted, you lose H:).
  • Is compatible with the CP/M Plus M: drive.
  • Provides additional drives under Locoscript - H: I: J: K: L:.
  • Each drive is 8MB in size, and supports 512 directory entries shared between 16 user areas.
  • A formatter and some IDE test utilities are provided as part of the driver suite (see above). Use the formatter to prepare a CF card or DOM prior to use. Use the test utility to verify that your uIDE is connected properly and the DOM or CFD card is compatible.

The provisional PCW driver suite can be downloaded here: File:Xdriver PCW suite 0.1.zip.

Note: There are no drivers available for the CPC6128 at this time. (But I am working on it!)

Transferring software to the PCW

I have assumed that you already have a way to get downloaded files onto your PCW. If not, the options are:

  • Use a serial adapter such as the Amstrad CPS8256 and a copy of KERMIT to transfer over serial.
  • Install a 3.5" floppy drive and transfer via floppies. You will need a program such as CPCDiskXP to put PCW disk image files onto the floppy. This program can also copy a downloaded file to a disk image.
  • You can use cpmtools to access files on an image of your uIDE IDE device, and win32diskimager (under Windows) or dd (under linux) to copy the entire image to/from your Z80 machine's IDE device. Read the section below about the uIDE disk image.

There may be other ways to achieve this (such as using a LocoLink cable) but it is out of scope of this WIKI page. If in doubt, ask on the forum.

BASIC program to load the driver from a DOM or CF card

If you choose to buy one of my DOMs, I can load it with the xdriver FID file and the uIDE image I describe below. You can also download and copy the uIDE hard disk image onto your own IDE device as this has the driver file preloaded (see below for instructions).

Enter the following program into BASIC and run it. It will retrieve the driver from the IDE device and write it to the currently logged-in disk. The driver file is written to the first three sectors on the IDE device, so that even if you format it, you can still use the BASIC program to restore the FID (because track 0 is reserved by the driver for future use).

 10 REM uIDE bootstrap - load FID from uIDE track 0
 20 MEMORY &HCFF0
 30 :
 40 PRINT
 50 PRINT "uIDE-8 PCW driver retrieval program"
 60 PRINT "Copyright (c) Jon Bradbury 2017"
 70 PRINT
 80 fidStart%=&HD000: fidEnd%=&HD4FF: fidSec%=3
 90 cfBase%=&HC8
 100 cfData%=cfBase%
 110 cfFeatures%=cfBase%+1
 120 cfError%=cfBase%+1
 130 cfSecCount%=cfBase%+2
 140 cfLBA0%=cfBase%+3
 150 cfLBA1%=cfBase%+4
 160 cfLBA2%=cfBase%+5
 170 cfHead%=cfBase%+6
 180 cfStatus%=cfBase%+7
 190 cfCommand%=cfBase%+7
 200 cf8Bit%=1
 210 cfReadSec%=&H20
 220 cfMaster%=&HE0
 230 cfSetFeat%=&HEF
 240 tout%=0: addr%=fidStart%
 250 GOSUB 850
 260 :
 270 GOSUB 580: REM cfWait
 280 IF tout%=1 THEN GOTO 560: REM check for timeout
 290 :
 300 REM init IDE device
 310 CALL di%
 320 OUT cfFeatures%,cf8Bit%
 330 OUT cfCommand%, cfSetFeat%
 340 CALL ei%
 350 GOSUB 580: REM cfWait
 360 :
 370 REM retrieve FID
 380 PRINT "Retrieving driver: [                        ]";: REM 24 spaces
 390 FOR x=0 TO 24: PRINT CHR$(8);: NEXT x
 400 FOR secNo% = 1 TO fidSec%
 410 GOSUB 680: REM get current sector
 420 NEXT secNo%
 430 PRINT
 440 PRINT "Writing xdrv.fid:  [                    ]";: REM 20 spaces
 450 FOR x=0 TO 20: PRINT CHR$(8);: NEXT x
 460 OPEN "R",#1,"xdrv.fid",1
 470 FIELD #1,1 AS d0$
 480 FOR addr%=fidStart% TO fidEnd%
 490 LSET d0$=CHR$(PEEK(addr%))
 500 PUT #1
 510 IF addr% MOD &H40 = 0 THEN PRINT CHR$(128);
 520 NEXT addr%
 530 CLOSE #1
 540 PRINT: PRINT: PRINT "Done."
 550 PRINT "Copy xdrv.fid to your PCW CP/M boot disk and reboot."
 560 END
 570 :
 580 REM cfWait
 590 FOR try%= 0 TO 31
 600 CALL di%
 610 status% = INP(cfStatus%)
 620 CALL ei%
 630 IF (status% <> &HFF) AND (status% AND &H80 <> 0) THEN RETURN
 640 NEXT try%
 650 PRINT "IDE device timeout - check it is connected."
 660 tout%=1
 670 RETURN
 680 :
 690 REM get sector in secNo%, copy to buffer
 700 CALL di%
 710 OUT cfLBA0%,secNo%
 720 OUT cfLBA1%,0
 730 OUT cfLBA2%,0
 740 OUT cfHead%,cfMaster%
 750 OUT cfSecCount%,1
 760 OUT cfCommand%,cfReadSec%
 770 CALL ei%
 780 GOSUB 570
 790 FOR byte%=0 TO 511
 800 POKE addr%,INP(cfData%)
 810 addr%=addr%+1
 820 IF addr% MOD &H40 = 0 THEN PRINT CHR$(128);
 830 NEXT byte%
 840 RETURN
 850 :
 860 REM load up ei-di routines
 870 DATA &HF3,&HC9,&HFB,&HC9
 880 FOR x=&HCFF1 TO &HCFF4
 890 READ inst%
 900 POKE x,inst%
 910 NEXT x
 920 di%=&HCFF1
 930 ei%=&HCFF3
 940 RETURN

To use the program.

  • Turn the PCW off.
  • Connect the uIDE to the PCW.
  • Plug the DOM into the uIDE's IDE socket.
  • Power up the PCW. If the uIDE power and activity lights both come on, you have the cable or DOM back to front. Power down and check.
  • Now power-on.
  • Load BASIC and enter the program. It's easier if you type AUTO 10 first. Take care with the entering of variable names, most of them have a % at the end (integer).
  • Save the BASIC program down before running it. SAVE "get-xdrv.bas"
  • Return to CP/M. SYSTEM
  • Copy get-xdrv.bas onto your boot disk and run it from the boot disk. From CP/M: BASIC get-xdrv
  • You should see a progress bar as the FID is loaded from the DOM. The activity light on the uIDE should be flashing.
  • Now a second progress bar comes up as the FID is being written to the floppy drive.
  • When the program ends, return to CP/M with the SYSTEM command.
  • Use PIP to copy the xdrv.fid file to your boot disk if not already on there.
  • Reboot the PCW (use LEFT-SHIFT - EXTRA - EXIT key combination rather than the power switch, it's quicker).
  • You should see the sign-on message "PCW IDE Extended Driver Copyright (C) Jon Bradbury"
  • You should also see a list of available drives.
  • Congratulations, your new IDE device is working!
  • It is wise to make a backup of the xdrv.fid file and the BASIC retrieval program onto a separate floppy disk.

uIDE disk image

There is a disk image of CP/M software that you can download here: [TBD]

It is a copy of the N8VEM image, with the PCW uIDE driver loaded, as well as some PCW specific files (on drive C:, User 0) and additional games.

Image contents

The image contains the following (where the number is the USER number - see below).

 --------------------------------------------------------------------------
  C:              D:              E:                F:
 --------------------------------------------------------------------------
  0 PCW SPECIFIC  0 GAMES         0 OLD UTILS       0 NEWUTILS
  1 BDS_TINY_C    1 MUMATHSIMP    1 F80,M80,BASIC   1 FREE
  2 APL           2 CROSSTALK     2 AZTEC_C_106D    2 Z SYSTEM
  3 JANUS_ADA 1.5 3 QTERM43       3 TURBO PASCAL 3  3 MICROPRO
  4 MS_COBOL      4 CLINK         4 DX-FORTH 4.01   4 MULTIPLAN
  5 PILOT         5 SUPERSOFT UTL 5 PL/I 1.4        5 DBASE II
  6 SYSLIB        6 RCP/M         6 ALGOL/M         6 FREE
  7 BBC BASIC     7 DDTZ SOURCES  7 SUPERCALC       7 FREE
  8 NEMESIS       8 ADVENTURE-80  8 ASM GAMES       8 MICROSHEL
  9 GAMES         9 ZCHESS        9 MORE GAMES      9 INFOCOM ADVENTURES
                 10 ZORK         10 NEMESIS        10 BASIC GAMES 1
                                 11 YET MORE GAMES 11 BASIC GAMES 2

Note: The original N8VEM downloads are here (including manuals for many of the included programs): http://obsolescence.wixsite.com/obsolescence/n8vemimage

Some tips for using the programs on the image

  • Download the manuals from the N8VEM website!
  • Be aware that these programs and applications were written for CP/M 2.2 and some of them might not work on CP/M Plus.
  • Many of the games are a bit poo. Remember, it's all text based.
  • In C0 there are versions of some programs that are specific for your machine. Always use these in preference to any version found elsewhere on the image. For example, ZSID.COM and KERMIT.COM on the PCW image are PCW specific.
  • Where a program or application needs you to tell it what type of terminal you are using, choose "Zenith" or "Heath". These are closest to what the PCW emulates.
  • WordStar and other Micropro applications are located in F3.
  • Use an Internet search to find out about the programs you do not recognise. Obvious I know, but you'd be surprised...
  • Most of the BASIC programs are written for Microsoft BASIC-80, which is located in E1. Remember to use SYSTEM in MBASIC to return to CP/M.
  • You might find multiple copies of some of the programs on the image.
  • Any user areas you don't want or need can be deleted.
  • Drive G: is empty.

Copying the disk image to an IDE device

I use a special cable setup to connect a DOM to my PC via USB for image transfers.

uIDE image transfer cable

The various parts are labelled:

  1. IDE-USB adapter. Get this from any online auction site.
  2. Power connection (if your IDE-USB adapter doesn't supply power to IDE pin 20). Pin 20 is the red wire, +5v. Pin 19 is GND. I use a 2 pin PCB header to connect to the female IDC connector.
  3. IDE device, in this case a 128Mb DOM
  4. 5v power supply. This is only used to power the IDE device, and if you are using a CF card adapter, you may find it has a power socket you can use instead.
  5. Cable. This is a simple 40 way IDC ribbon cable with two cable mounted male IDC box headers and two cable mounted female IDC plugs (you only need one, for connecting power to the IDE device). The parts to make this up are freely available, and the cable can be used to connect a slave drive to uIDE.

There are other ways to connect your IDE device to a PC:

  • If your PC has a spare IDE connector, you can plug the DOM or CF card adapter device directly into it.
  • If you are using a CF card, you can connect it to your PC with a standard USB-CF card adapter.

To transfer the uIDE image under Linux

Use the Linux dd command to do this, but take care that the of= parameter is pointing to your IDE card. Use GParted to verify this.

The command is:

 sudo dd if=uide-image-file of=the-device-of-your-IDE-card

Example:

 sudo dd if=uIDE_download.img of=/dev/sdc

If in doubt, read the dd manual by entering the command

 man dd

..and be aware that dd is also known as "disk destroyer" because if you get it wrong your hard disk may be wiped.

To transfer the uIDE image under Windows

  • Connect the transfer rig to your PC
  • Insert the IDE device and power it up.
  • If Windows Explorer does not show the drive it is unformatted or uninitialised. Initialise it first via "Computer Management" (On the Start menu, under All Programs -> Windows Administrative Tools, or Run -> compmgmt.msc). Click the Storage / Disk Management item in the left hand side of the screen and you should see the IDE device in the main pane. Right-click on the button labelled "Disk n Unknown" (n depends on how many drives you have) and select "Initialise Disk". Select MBR and click OK. Now click on the "Unallocated" block for the disk and select "New Simple Volume", then (in the New Simple Volume Wizard, click Next, Next, Next, Next, Finish). If you get a popup sayng the disk needs to be formatted, cancel it, because the Disk manager is already doing it. Now, go back to Windows Explorer and you should see a disk called "New Volume". Note the drive letter.
  • Launch Win32Imager. Select the drive letter of your CF card or DOM on the right of the window and choose the image file on the left, then click the "Write" button. Check that the confirmation dialog box shows the correct drive letter, then click "OK". You should now see a progress bar as the image is written to the IDE device. When complete, a small widow will pop up saying "Write successful." Click the OK button and close win32imager.
  • You should now have a prepared uIDE hard drive. Disconnect the imaging cable and power down the IDE device. Plug it into the uIDE adapter.

To retrieve the uIDE driver from the IDE device

  • Follow the instructions above (the BASIC program) to retrieve the xdriver FID file from the IDE device. After rebooting your computer, you should able to explore the disk image.

Short disclaimer

The uIDE disk image is supplied "as-is" and the copyrights of the respective authors are acknowledged. Please do not PM me if you encounter problems with any of the applications - ask on the CPCWiki PCW forum (or better still, the VCF CP/M forum). There is no guarantee that all applications will work on your machine; they are CP/M 2.2 programs provided with the intention of helping to get you started with your uIDE device.

CP/M Plus version requirements

To use the PCW uIDE xdriver, you must have a version of CP/M Plus that supports FID ("field installable driver") files.

  • On the PCW8256 and 8512 the lowest FID supporting version is 1.14. That's "one dot fourteen" so if (like me) you have v1.4, yours is too old.
  • On the PCW9512 you should be OK. I have v2.15.

Refer to http://www.seasip.info/cpm/amsfid.html for more details.

If you find your CP/M Plus version is too old, it should be sufficient to replace the EMS file on your boot disk with a later one. The file containing CP/M is named like "JnnCPM3.EMS" or "JnnCPM3.EMT". The nn indicates the version number so for example "J14CPM3.EMS" is version 1.4. If your boot disk's CPM file has a ".EMS" extension and you want to use a file with ".EMT", just rename it (and visa-versa).

PCW8000 series CP/M versions

You can download a ZIP file with the later CP/M EMS/EMT files here: http://www.cpcwiki.eu/forum/nc100-nc200-pcw-pda600/cpm-plus-1-11-1-5-download/?action=dlattach;attach=21897

For the 8256 / 8512 machines, I recommend the v1.15 EMT file.

Connecting a CF card to uIDE instead of a DOM

Cf adapter power mod.jpg

Not recommended due to compatibility problems with some types of CF card, but if you really must, you need a cheapo IDE to CF card adapter and you should either connect its 5v input to the uIDE CF_PWR header (being VERY careful about the polarity) or modify the adapter so that IDE Pin 20 is connected to the 5v power socket, as shown on the left. The thin copper wire that goes from the IDE plug to the small component next to the power socket is the mod. You should check with a meter that these are correct for your adapter. Some adapters already have this connection, so try yours before modding it. You should see its power light come on if it is properly connected.




CF Card compatibility list

My intention is to maintain a list here of which CF cards work with uIDE, and which do not. So:

Card make / type Comments
Verbatim 64MB CF card works
Dane-Elec 512MB CF card (C1 512 D-SA) works (this card identifies as a Samsung)
Kingston CF 16GB 266X not compatible, will not identify
STEC 128MB CF SLCF128MM1U not compatible, will not identify

About CP/M USER areas.

This section was written for xdriver v1.9 under CP/M 2.2 and may or may not apply to CP/M Plus.

A CP/M "user area" is a bit like a directory under MS-dos, except it is named by a number and there are only 16 of them on each drive.

To use the different user areas, use the command USER n where n is the user area you want to switch to (0 to 15). It is tricky copying files between user areas. First you need to get PIP.COM to the user area you want to copy to.

The DRI PIP manual says:

 To copy files into another user area, PIP.COM must be located in that user
 area. Use the following procedure to make a copy of PIP.COM in another
 user area (in this example, USER 3). 
 
 USER 0			Log in user 0.
 DDT PIP.COM		(note PIP size s) Load PIP to memory.
 G0			Return to CCP.
 USER 3			Log in user 3.
 SAVE s PIP.COM	
 	
 In this procedure, s is the integral number of memory pages, 256- byte
 segments, occupied by PIP. The number s can be determined when PIP.COM
 is loaded under DDT, by referring to the value under the NEXT display.
 
 If, for example, the next available address is 1D00, then PIP.COM requires
 1C hexadecimal pages, or 1 times 16 + 12 = 28 pages, and the value of s is
 28 in the subsequent save.
 
 Once PIP is copied in this manner, it can be
 copied to another disk belonging to the same user number through normal
 PIP transfers.

You can now change user or drive as many times as you like, and drop a copy of PIP.COM using the same save command, as long as you do not run any transient commands in the meanwhile (this means, "execute a .COM file").

Copying files between user areas.

To copy files to a particular user area, first switch to it with 'USER n' command. Then, use the PIP you SAVEd to the user area to copy files in:

 PIP dr:<filespec>[Gn]

where

  • dr: is the source drive ID (A: - P: ), and
  • n is the source USER area.

Example: To copy KERMIT.COM from Drive A USER 5 to Drive N User 15 (assumes PIP.COM is already present in the target drive / user area):

 A:>N:
 N:>user 15
 N:>pip n:=a:kermit.com[g5]

More fun with CP/M Plus

One of the first things you should do after setting your uIDE up is to copy all the CP/M program files to one of the IDE drives so that they load quicker.

To do this (and assuming you want to put these all on the C: drive):-

  • Insert CP/M boot disk into the floppy drive A:
  • Issue the command PIP C:=A:*.*[v]
  • The [v] option will verify each file after it is copied. Since this is likely to be the first thing you do with the uIDE, it's a good idea to use [v] just to double check it's working OK.
  • Now create a file called PROFILE.SUB on the boot disk in A:
  • Add the line C:SETDEF M:,C:,* [ORDER = (SUB,COM)] and save the file
  • What this does is make the CCP (command line processor) look for SUB and COM files on the IDE drive C: before the currently logged disk. So if you are on A: and you issue the command BASIC (to load BASIC), it will be loaded from the IDE drive rapidly, even if there is a copy on A:. In fact, it looks on M: first, and a submit file like BASIC.SUB takes precedence over the real executable BASIC.COM.

Another useful trick is to make the CP/M COM files in user area 0 into SYSTEM files. This means that they won't be visible when you do a DIR, and they will be executable from all user areas on the same disk. So:-

  • Go to the drive where you copied all the COM files to. In this example, it is C:
  • Switch to USER 0 (type "USER 0" at the CP/M prompt).
  • Enter the command SET *.* [SYS]
  • Now, when you switch to another user on the same drive, you can access the CP/M command set without copying them to the user area first.
  • If you do this, there's no need to copy PIP to all the user areas (this was required for CP/M 2.2).
  • If you want to turn them back into normal files, enter the command SET *.*[DIR]
  • If you want to list them, enter the command DIR[SYS] (note, needs the program DIR.COM installed)

Prices

This is a summary of the prices I have posted to the forum so far. I am sorry that the assembled prices are what they are, but it is a time consuming and dreary job, not to mention the effort and cost to acquire the parts. I encourage self build!

Item Price
uIDE-8 bare board £7.50
uIDE-8 assembled £42.50
uIDE-16 bare board £9.00
uIDE-16 assembled £47
Z80 Shim bare board (LHS or RHS) £2.50
Z80 Shim assembled (LHS or RHS) £17.50
PCW expansion port adapter with composite video output £4.00
PCW expansion port adapter with composite video output (assembled) £29.00
PCW expansion port adapter "lite" (without composite video output) £3.00
PCW expansion port adapter "lite" (without composite video output, assembled) £18.00
CPC 6128 expansion port adapter £3.00
CPC 6128 expansion port adapter (assembled) £18.00
128MB DOM suitable for use with uIDE-8 and uIDE-16 £4.00
Z80 bus cable (40 way IDC-IDC ribbon) £5

Payment via PayPal, please, in Sterling (GBP). All prices are plus shipping and PayPal fees (3.5%).

Please note, if you do not have space to connect the adapter board directly to the uIDE device, you will also need a Z80 bus cable. This is a standard 40 way IDC female to female ribbon commonly found in PCs to connect the motherboard to an IDE HDD, so if you have one lying around you don't need my offering. But if you decide to order one, please contact me to discuss the length of the cable. I guess it depends on the machine and where you want to position the uIDE card.

More information

uIDE 16 discussion thread

PCW uIDE discussion thread

PCW uIDE prototype demonstration videos

File:IDE SPEC.PDF - IDE Specification document


Copyright

All designs presented here are copyrighted works.

Copyright (C) Jon Bradbury 2017.

Disclaimer

As I am a hobbyist, not a big business, I need to make a few things clear.

You are free use these designs for personal or commercial purposes, on the following conditions:

  • You do not attempt to take credit for the work I have put into designing and / or building any device offered here.
  • You acknowledge my right to assert copyright and ownership of these designs.
  • You agree to indemnify me and the CPCWiki web site against damage to your computer or other connected hardware or data contained on any attached media.
  • All work is undertaken at your own risk. I am not liable for any hardware damage or data loss, loss of your homework, your dog getting sick, etc.
  • All devices and/or PCBs I offer are supplied as-is and there is no warranty that they are fit for any particular purpose.
  • Your agreement to these conditions is implicit on ordering any of these devices or PCBs from me.

Support

I will support your use of these designs via the appropriate forum by offering help and advice as necessary. Please review the content of this Wiki page before asking for help, though, and contact me via the channels described below.

How to contact me.

I am member "JonB" of the VCF and CPC Wiki Forums. If you need support or have any comments, please start a new thread on the uIDE thread in the VCF CP/M forum here:

http://www.vcfed.org/forum/showthread.php?56162

Or on the relevant CPCWiki forum liked to above. You could also PM me.. :)

Note: Forum registration is required.

Acknowledgements

I would like to thank some collaborators for their work and kind assistance.

  • Grant Searle, who wrote the original formatting program and read / write driver code as well as the DPB for his 9 chip CP/M computer. XDRIVER is a derivative of this work. http://searle.hostei.com/grant/index.html
  • John Elliot, who helped me to understand how the FID file format works, and provided his FID CHECKSUM program which is a required part of the FID development toolchain. http://www.seasip.info
  • CPCWiki member Bryce, who provided a good deal of advice and encouragement.
  • The open source community team responsible for KiCad, which, in its later incarnations, is worth every penny you do not have to spend on it. http://kicad-pcb.org/

Salutation

Cheers!

CPCWiki Forum Member "JonB" (Jon Bradbury) 19/02/2017