Changes

Jump to: navigation, search

UIDE Universal IDE adapter cards for Z-80 computers

12,610 bytes added, 16:43, 19 February 2017
/* About CP/M USER areas. */
* 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).
== Feature list ==
* 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.
 
== Testing the IDE device ==
In the driver distribution there is a program called XTEST.COM. XTEST is a program that tests and returns information about connected IDE
devices.
 
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.
 
=== 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 LoTech 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). I will be porting this driver to the 6128 in due course, but AMSDOS is not supported. I may need assistance with this!
The driver's capabilities are:
* Provides additional drives under Locoscript - I: J: K: L:.
* Each drive is 8MB in size, and supports 512 directory entries shared between the 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 for 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|framed|All Board BOM]].
 
== 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 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).
 
== Connecting a CF card to uIDE instead of a DOM ==
[[File:Cf adapter power mod.jpg|200px||left|]]
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:
 
{| class="wikitable"
|-
! 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.
== 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!
[https://www.youtube.com/playlist?list=UUdH2u50ocnjPxPmEOyNVLsg PCW uIDE prototype demonstration videos]
[[File:IDE SPEC.PDF|200px||left|]] - IDE Specification document
 == Copyright and disclaimer ==
'''All designs presented here are copyrighted works.'''
* Amstrad.ES Forum member "JonB"
== 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, where prior art is unproven.
* 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.
* These designs 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!
That said, I will of course support your use of these designs via the appropriate forum by offering help and advice as necessary.CPCWiki Forum Member "JonB" (Jon Bradbury) 19/02/2017
[[Category:DIY]]
410
edits