Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!csn!hellgate.utah.edu!cc.usu.edu!sl87m From: sl87m@cc.usu.edu (The Barking Pumpkin Digital Gratification Ensemble) Newsgroups: comp.sys.amiga.programmer Subject: HD CMD_READ solved - solution and question Message-ID: <1991Jun26.133654.48232@cc.usu.edu> Date: 26 Jun 91 19:36:54 GMT References: <1991Jun24.125808.48207@cc.usu.edu> <1410@cbmger.UUCP> Organization: Utah State University Lines: 55 In article <1410@cbmger.UUCP>, peterk@cbmger.UUCP (Peter Kittel GERMANY) writes: > In article <1991Jun24.125808.48207@cc.usu.edu> sl87m@cc.usu.edu (The Barking Pumpkin Digital Gratification Ensemble) writes: >>Hi! >> >>I'm trying to access block directly on hard drives, but (obviously) I've got a >>problem: >> >>I OpenDevice(...) fine, but when I go to do a DoIO(...), my machine crashes. If >>I do an OpenDevice(TD_NAME....), and turn on the drive motor, then do the >>DoIO(), it works fine. What could I possibly be doing wrong? My assumption is >>that CMD_READ,CMD_WRITE are universal for all devices, trackdisk or whatever. > > Yes, the commands are universal, but *NOT* the device name. TD_NAME stands > for TrackDisk device. Any harddisk has its own driver. At first you must > find out the name of this driver, which you can spot in the device list, > see other thread in this newsgroup. Then take this name for your OpenDevice, > and all works ok. I guess that I didn't make myself clear on this point. I *was* using the hard drive device's name. I used TD_NAME as a test to see if there was any gross and obvious errors. Sorry. For those interested, here's what the problem was. (I finally figured it out at a bleary 1:00 am last night.) My hard drive is partitioned into DH0: and DH1:. The unit number required by OpenDevice() is not the number in DH?. (e.g. it's not 0 for DH0:.) This was my silly assumption after playing with trackdisk.device a lot. The unit number is the physical number of the drive that is defined by the drive's jumpers. My hard drive's unit number is 1. When, out of desperation, I tried opening "DH1" -- it worked! That tipped me off. After that I checked dn_Startup->fssm_Unit and my MountList -- they agreed. So I belive that I've got the right answer. (It works now, and it seems now like it should have been "obvious.") -=+=- Curiosity yes/no question: CMD_READ seems to be taking an absolute block number, ignoring any partitioning of the drive. Is this true? (I have to convert partition block numbers into absolute block numbers to access the correct block. e.g. DH0: goes from track 2 to track 445 with 26 sectors/track, 7 heads/cylinder -- I have to add 2*26*7 = 364 to DH0's block number to get at it.) James P.S. ************ THANK YOU ************ to _everybody_ that suggested a solution. I did help to eliminate possible causes. --- #include #include