page 250,150 ;Comment-------------------------------------------------------- ; ; Project name: PoFoIDE ; --------------------- ; ; Device driver for IDE-Harddisks on an Atari Portfolio. ; version: v0.86 ; date : 13-11-1998 ; ; Description: ; ------------ ; ; This is the source code a device/interface driver. It is part ; of a hardware/software contraption that can be used to connect ; an IDE harddisk to a PortFolio parallel interface. The ; hardware/software combination allows a PortFolio to access the ; IDE harddisk as a number of extra disk drives. ; ; Copyright notice: ; ----------------- ; ; (C) 16.05.1998 by Klaus Peichl, ™stliche Ringstr. 7, 85113 B”hmfeld ; (C) 11-09-1998 by P.R. Faasse, Hakfort 337, 1102 LA Amsterdam ; ; This program is free software; you can redistribute it and/or modify ; it under the terms of the GNU General Public License as published by ; the Free Software Foundation; either version 2 of the License, or ; (at your option) any later version. ; ; This program is distributed in the hope that it will be useful, ; but WITHOUT ANY WARRANTY; without even the implied warranty of ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; GNU General Public License for more details. ; ; You should have received a copy of the GNU General Public License ; along with this program; if not, write to the Free Software ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ; ; Warranty: ; --------- ; As nearly all computer programs this code comes without any ; warranty. When using this code I am not responsible if anything ; goes wrong with your hardware/software, data, married life or ; otherwise. ; ; I've tried my very best to make this program work; I've seen it ; work on at least two PortFolio's with different version numbers ; of the PoFo's ROM and with two different harddisks. The current ; version 0.83 is however an 'alfa-test' version. I have run it on ; my own computers, and not yet on anyone else's. ; ; Bugs/error reporting: ; --------------------- ; Any reports of errors are welcome. I can again guarantee ; nothing, but as long as I'm interested in PortFolio's there is ; a very good chance that I'll do my best to kill any remaining ; bugs. I prefer error reports in e-mail form to: ; ; faasse@nlr.nl ; ; If e-mail is not available to you you could also send a written ; report to: ; ; P.R. Faasse ; Hakfort 337 ; 1102 LA Amsterdam ; Netherlands ; ; Known problems: ; --------------- ; This being alfa-test software I do not expect it to work fully ; without errors. At this moment most of the driver seems to ; work. The following bugs are known: ; ; I did encounter problems when using unreliable disks. This ; driver has no 'bad-block' management, it blindly assumes that ; all disk blocks are read/writable. At this point I do not ; intend to implement any 'bad-block' management. The time to ; scan a disk for bad blocks with this slow interface is ; prohibitive. Newer disks 'hide' bad blocks themselves. ; ; The chkdsk program of the PoFo works unreliably with the ; PoFoIDE driver. It sometimes works -more-or-less-, somtimes ; simply hangs the system. The chkdsk response changes with the ; disk's history: with a 'clean' disk (no files there) it seems ; to work, after a few copy-s, deletes it seems to hang. It ; always reports wrong info for the used space (no-files works ; ok..). It seems not go get the hang of the more-than-one- ; sector-per-cluster idea. I do not know what to do about it. ; ; I got one disk for testing from Stefan Kaechele. This disk does ; not work with the PoFoIDE system at all. It gives a 'Command ; Aborted' error on all reads and writes. I'm in doubt if this is ; a software or hardware error, I'm working on it.. (NB: The disk ; is a Caviar (tm) Lite 170) ; ; History: ; -------- ; ; 20.05.98 0.01 First version, missing I/O routines ; ; 25-05-1998: ; converted Klaus's code to masm format. Masm cannot ; eat some of the TASM directives and insists upon ; some pretty cryptic descriptions at the beginning ; and end of the file. ; Assembly and linking/sys file making now works with: ; ; MASM driver,,,,, ; LINK driver,,,, ; EXE2BIN driver.exe driver.sys ; ; 26-06-1998 to 05-06-1998: ; ; Integrated the driver code with my IDE interface code. ; The thing works now. No error handling is there yet. ; Bumped the version number to 0.02. ; ; 06-06-1998: ; ; Bus passify at the end of I/O operation(s) added. ; This is needed because the PoFo sometimes re-inits the ; parallel port on (soft-) power-up/power-down. ; ; 07-06-1998: ; ; Routine SetAdr changed. I no longer support the /CS1 ; addressing. I never did use the high registers, now ; SetAdr does the same. Some debug code removed. ; ; Error handling put in place. Tested with both the 512 ; KBytes PoFo and the 128KBytes one. All seems to work ok. ; DIP versions: 1.072 (512 KB PoFo) and 1.052 (128 KB PoFo) ; ; 17-06-1998: ; ; Started on a special version. use a standard file-system. ; I solved some puzzle of the 12-bit FAT file-system. It is ; less well-documented than it seems. I had to dump some ; floppy boot-blocks to find most of the boot-block ; parameters. ; ; 18-06-1998: ; ; Started reading the BPB from the disk itself. That makes ; the driver independent of the actual file-system used on ; the disk. Results in an immediate crash of the PoFo. Even ; the normal reset will not solve that. Still, this has to ; work. I want to make a more flexible disk partitioning ; system. Otherwise I'll be stuck with this 3x30 MB ; partitioning mechanism. It's not so bad in itself, but ; not all disks are 100 MB in size. I wonder if this is ; coming from some error in my code, or perhaps I'm ; provoking some stack overflow. This driver does not (yet) ; have it's own stack..... ; ; 14-07-1998: ; ; Some debug info put back, I had occasional crashes with ; my old 40MB disk. Looks like the disk itself has finally ; given up itself. It had been screeking along for some time ; already, this was no big surprise. I also made a final ; check upon block read/write ready. DRQ should be '0', ; error flag should be '0' too. I'm thinking of a ; soft-reset at the end of any timeout. Now the disk simply ; stays 'locked' with no hope of recovery. The disk SHOULD ; NEVER get into this state, but if it does, I'd better ; reset it and hope for the best.... ; ; 14-07-1998: ; ; Continued making the multi-fs version. I've got the ; reason for the crash now. At the moment I did the ; ReadBPB the disk's geometry was not (yet) known. That ; gave a divide-by-zero (SPT and SPC where both 0, I divide ; by them...). ReadBPB has been moved to AFTER the geometry ; read. Now I have to verify that the data I get is ; usable... ; ; 19-07-1998: ; ; I finally got the ReadBPB/SetPart span to work as I want. ; The driver now supports multiple partitions, with all the ; information about them stored in the one-and-only place ; that I think is sensible: the disk itself. The entire ; driver works nicely on my 512KB PoFo, with the QUANTUM ; ELSA127 disk. There is only one thing really missing ; here, a utility to switch the active partition from the ; command line. I tried with both 30MB and 2MB file-systems ; even with a mix of them. The MDEXTERN and ATMD ; combination also seems to work. If no unexpected things ; happen this could be the alfa-test version. I have run ; out of bugs, let's see how the rest of the world thinks ; about that. I've bumped the version number to 0.8 to give ; a measure of the confidence I have in the thing. NB: ; there should be no traces left of the previous ; two-versions sitiuation I had: One version that works ; with 2 MB file-systems, one version that works with 30MB ; file-systems. Remains some comment-translations. Klaus's ; skeletton driver was very nicely commented, but a mix of ; German and English comment would, I think, be too much to ; ask of the rest of the world. ; ; 07-08-1998: ; ; Changing the ds:si assignment in writesectors. This has ; been poisoning my code for too long. the assignment of ; ds:si up in the front of the writesectors has made me ; write cs: overrides all over the code. The idea on itself ; (stosw for data storage) is not bad, it just has to be ; done a lot later on in the code. This may even have led ; to some of the remaining bugs. I now change from es:di to ; ds:si in the writeblock part (at the tail of the code). ; NB: I do net (yet) test if the partition selection goes ; beyond the disk size. ; ; 10-08-1998: ; ; Changed SetAdr and the address bytes to include the ; appropriate CS bit. This re-enables access to the ; soft-reset and simplifies the SetAdr routine some more. ; Also added a soft-reset at the end of a timeout. This ; should prevent the disk from a 'lockup' when some error ; happens. Also moved quite a lot of code/data around. I ; want a 'clean' separation between data, code and between ; device/interface driver and transient/resident code. I've ; joinded some subroutines and moved the transient routines ; to the back of the code to achieve that. I've also been ; hunting for German comment again. I have nothing against ; German comment perse, but a mixture of German and English ; will make this program unreadable for most of the world's ; population. If that was my intention I would have ; commented my own code in Dutch. ; ; Added most of the relevant information of the driver's ; static storage to the return information of the IoCtlRead ; call. This should allow easy on-line disgnostics of the ; driver and/or drive. ; ; Got a few minor bugs. The multi-sector read/write was not ; ok. It was never used that way, so I do not expect anyone ; has stumbled over this, but anyway... ; ; 11-08-1998: ; ; /C option made for the command line. This will make the ; driver read the disk's geometry from the command line in ; the form of ; ; /C . ; ; The separation between the numbers can be a ' ' or a '/'. ; The cyl must range from 1 to 1024, the head from 1 to 16, ; the sec from 1 to 256. This means that I'v added a ; decimal number parser routine to the driver. The same ; routine is now used to read the partition number from the ; command line. NB: If a disk geometry is specified the ; Disk Ident command is skipped. NBII: If debug modus is ; selected the disk's geomery is balked to the console at ; start. ; ; The complete command-line option set is: ; ; /D sets debug modus ; ; /C sets disk geometry ; = [1 .. 1024] ; = [1 .. 16] ; = [1 .. 256] ; ; /O