Path: utzoo!attcan!uunet!cs.utexas.edu!rutgers!mit-eddie!bloom-beacon!eru!hagbard!sunic!news.funet.fi!funic!fuug!tuura!jaria From: jaria@tuura.UUCP (Jari Artes) Newsgroups: comp.os.os2.programmer Subject: Re: (P)Dsk functions Message-ID: <792@tuura.UUCP> Date: 2 Oct 90 07:57:43 GMT References: <1990Oct1.212055.2402@ingres.Ingres.COM> Organization: Nokia Data Systems Oy Lines: 39 seg@ingres.com (scott e garfinkle) writes: > 1. How do I set things up so that I read/write a specific > sector, say the disk's boot sector? TRACKLAYOUT is set up as follows: Command db 0 ; in this case this could be 1 Head dw 0 ; zero based head number Cylinder dw 0 ; zero based cylinder number FirstSec dw 0 ; this is zero based INDEX to track table Sectors dw 1 ; number of sectors on which to perform the operation ; this is the track table ; first (and last) entry: SecNum dw 1 ; one based physical sector number SecSize dw 512 ; sector size > 2. What are the starting points for the numbering systems? > (I am guessing that Heads, Cylinder, and FirstSector start at > zero and SectorNumber starts at 1). Your assumptions are correct. > 3. Is it necessary to do a LOCK[PHYS]DRIVE before any > read/writes (it would seem so)? Not necessarily in case you just read partition tables, boot records or other data that is not subject to change during your program's lifetime. It is a good practice to lock the drive(s) you're operating on, but make sure your program doesn't crash before the lock is released. > 4. Is it necessary to fill in the TrackTable array for an > entire track's worth of sectors? How much of this array > *really* has to be filled in? There must be cSectors elements in the array. -- Jari Artes jaria@tuura.yj.data.nokia.fi