The ZX96 - Harddiscinterface

With the -shortly- HDIF it is possible to attach nearly any IDE-harddisc to the ZX96. The HDIF can be used with the genuine ZX81 as well, if the required control lines are provided by an additional POKE-board.

The IF is divided into two main parts: IO and memory. There are only some register circuits to convert the 8 bit of the ZX81 to the 16 bit bus for the IDE drive. The IO section uses the addresses B7h and BFh. For memory the HDIF supports an EPROM from 8-16k and two RAM banks from 48-64k.

For bankswitching there are three POKE8 commands reserved:
POKE 8,13 RAM bank 1 (Work-RAM, system variables etc.)
POKE 8,14 RAM bank 2 (File-RAM, as buffer for BASIC programs)
POKE 8,15 external RAM, e.g. the Megabyteboard
The EPROM is always present if one of the POKE8's is set. Other external memory will be disabled by /RAMCS und /ROMCS, these lines are also to disable the Giant extension board. With the lines MODHI and MODLO the megabyteboard will be disabled. By POKE 8,15 can directly be loaded from the harddisc to the megabyteboard.

For the HDIF a completely new operating system was designed: MeFisDOS. It handles subdirectories and allows attributes as well as it directly can access the floppy drive. Due to the limitations of the floppy DOS we also limited MeFisDOS to filenames with max. 8 chars length. MeFisDOS can handle capacities up to 130MB, but who really needs more than 40MB for a ZX81?? Nevertheless larger drives can be used, if smaller parameters -best a lower max. cylinder- were fixed.

Working with MeFisDOS gives a lot of options, so we made a small documentation for all commands and options, file attributes and more. As I want to know who is interested in MeFisDOS, I don't want to present it here. And the english version is not finished yet... If you want more information, please contact me.

Building up the HDIF and testing

You have to decide, if you want to make a PCB yourself or if you want to order one. Please ask for conditions first. The schematic is drawn with EAGLE - an easy to use layout program, and it's freeware with some limitations! Because the PCB was designed with an ancient program some years ago I've redesigned the schematic now with EAGLE, but I can't provide any PCB file, sorry...

I have to assume some experience with computers and handling such devices like harddiscs to give a short instruction here. The HDIF is definitly not suitable to make the first steps in electronics with! At first you should try to get the memory section working, there are no serious problems to expect. After that you have to test if your harddisc wants to work with the IF at all. I had some serious problems with different drives, that I can't explain. And due to the lack of some expensive equipment I have no chance to make further experiments this way. Good luck, hope your drive can be accessed at first try. To do so use HDDETECT, which reads the parameter string (geometry, manufacturer) from the drive. Does HDDETECT abort with an error 2/ better try another drive model. Who wants to go further with such drives can try a smaller modification on the HDIF. But as this also needs a modified MeFisDOS you have to contact me first.

Is HDDETECT reporting some impossible values (e.g. 65535 cylinders), there are some minor read errors. Try some other values for R1/C1/C3 and good luck again. If it is working so far, you can check out the remaining parameters with HDSCAN. HDSCAN determines cylinders and heads by trial-and-error and may report some other values than HDDETECT. As this is using the final IO-routines, the values of HDDETECT are valid! The amount of sectors per cylinder does HDSCAN compute from the prompted capacity of the drive. After that HDSCAN performs a complete surface scan, which takes approx. 20 min with a 40MB drive. At last HDSCAN prints the highest usable cluster and reports defective clusters. As we have no defect management implemented yet and such drives are less reliable, you should not use drives with defective clusters.

Now you should have noted the following values: cylinders, heads, sectors and the highest cluster. They must now inserted in the ROM image (there is NO setup, NO autodetect and NO f!cking plugandplay). To do so, two additional values must be determined:
clusters per cylinder integer part from sectors divided by /4
length of bitstring integer part from max. clusters divided by /8
There are always 4 sectors=2kB in one cluster. No clusters are splitted over two cylinders, this is what's making MeFisDOS so fast too. The bitstring is the FAT of MeFisDOS and always 8kB long. As 8KB are 65535 bits, each bit represents one cluster. If the bit is =0 then the corresponding cluster is free. An example would make it plastic:

We have a drive with 804 cylinders, 4 heads and 17 sectors per cylinder - any usual 30MB drive. HDSCAN should report these values too, a few cylinders less are not indicating any problem. After asking the capacity (30MB) HDSCAN should print 17,005 sectors. When finished the surface scan, HDSCAN should report 12864 as the highest cluster: integer of 17/4=4, we have 4 clusters*4 heads*804 cylinders=12864 clusters. The length of the bitstring is 12864/8=1608. This value is needed to fix the capacity! We can use now 12864*2=ca.25,7 MB, because there is one unused sector in each cylinder and head!

The values can now inserted at the following addresses:
offset above example value
0C09h 23h (35) cylinder-1 Lo_Byte
0C0Ah 03h cylinder-1 Hi_Byte
0C0Bh 04h clusters per cylinder
0C0Ch 04h heads
0C0Dh 48h (72) length of bitstring Lo_Byte
0C0Eh 06h length of bitstring Hi_Byte

Now the EPROM can be made and we only have to format the drive yet. The FORMAT program is some kind of quickformat and only writes an empty root directory to the drive. After that MeFisDOS is ready for use and can be called by POKE8,13 and RAND USR 8192. If now again some errors occur (Plattenfehler=drive error, Prüfsummenfehler=crc error, Platte voll=drive full - sorry guys, MeFisDOS is only available in German version yet!), there is a minor problem in the write section. Try some other values for C2, format again and at some time it may work... Who wants to have a tool to write and read defined clusters for testing, please contact me. It is a very special program, still in German and some kind of not-so-easy-to-use.

All tools are running under XTENDER as well and using TSCON (62k) you can make a WAV file of each, record it on tape and use it with the ZX81:
EPROM binary file 8k
schemtic for EAGLE 19k (zip) EAGLE program freeware (ca. 4MB)
The tools are in English except MEMFREE, which is explaining itselfes.

Want to have a look at the PCB? Here it is!

last Update: 1/00, Kai Fischer