Xref: news2.mv.net comp.os.msdos.djgpp:7678 From: Elliott Oti Newsgroups: comp.os.msdos.djgpp Subject: Re: off topic: need DOS internals info Date: Tue, 20 Aug 1996 11:07:48 -0700 Organization: Academic Computer Centre Utrecht, (ACCU) Lines: 89 Message-ID: <3219FEF4.2BFC@stud.warande.ruu.nl> References: <199608190110 DOT VAA00292 AT fcshome DOT stoneham DOT ma DOT us> NNTP-Posting-Host: warande1078.warande.ruu.nl Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: fredex AT fcshome DOT stoneham DOT ma DOT us DJ-Gateway: from newsgroup comp.os.msdos.djgpp fredex AT fcshome DOT stoneham DOT ma DOT us wrote: > > I'm working with a program which needs to modify the Drive Parameter > Block (which it can locate via the List of Lists) to fool DOS into > thinking it knows the attributes of a floppy diskette. The real diskette > may not contain a DOS filesystem, but will be formatted in a track/ > sector layout like a real DOS formatted diskette. > > Problem I'm having is that even though the DPB gets set to the right > values (of this I'm sure!) DOS does not seem to use those values for > the next access of the drive, but rather the values of the last diskette > it actually looked at (which may have been of a different capacity). > > TIA > > Fred > -- It's not really my field either, but here's some info: The IOCTL functions( subfunctions of int 44h) refer to the following data, which you must set up to recieve/transfer info via IOCTL function 0dh (generic IO control) subfunction 60h ( returns information about block device) table 1 -------- IOCTL Parameter block: offset Length meaning ------------------------------------ 00h 1 byte special functions 01h 1 device type 02h 2 device attributes 04h 2 total cylinders 06h 1 media type 07h 1fh bytes Device BPB 26h varies track layout The first place you have to watch out for when fiddling with parameters is HERE: table 2 -------- special functions (offset 00h see table 1) ----------------- bit settings 7 6 5 4 3 2 1 0 meaning 1 use existing DPB <----- ! 0 define new default DPB <----- ! 1 use track layout field only 0 use all fields in DPB 1 sectors in track all same size 0 sectors different sizes x x x x x reserved Make sure you know what you want: use the existing DPB (which you hacked) or define your own. Set the bit 0 to 0 if you use your own DPB otherwise DOS will merrily use the default. Also a possibly tricky bit: table 3 ------- Device attributes field of DPB ------------------------------ bit settings meaning f e d c b a 9 8 7 6 5 4 3 2 1 0 1 media not removable 0 media removable 1 change line supported 0 change line not supported x x x x x x x x x x x x x x reserved Bit 1 ( change line) indicates whether the device can tell you if the media has been changed ( disk door open , not neccessary for non-removable media) If the device supports such a feature, the bit is set. Otherwise DOS continues to assume that the old characteristics hold. In removable media the media type field = 0. Then of course there's the BIOS Parameter Block ( which you presumably changed) if you did change it (as you emphatically stated) then there's little that can go wrong here. But it does help to make sure the BPB says exactly what you mean it to say :) The tables are typed in from Allen Wyatt's excellent Advanced Assembly Language, Que Corporation 1992. Hope this has been of some help. Elliott.