Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!uwm.edu!cs.utexas.edu!rice!uupsi!sunic!news.funet.fi!ousrvr.oulu.fi!stekt!jml From: jml@stekt.oulu.fi (Lepp{j{rvi Jouni) Newsgroups: comp.os.msdos.programmer Subject: formatting diskettes Message-ID: <1991Apr18.221850.26693@ousrvr.oulu.fi> Date: 18 Apr 91 22:18:50 GMT Sender: news@ousrvr.oulu.fi Organization: University of Oulu, Finland Lines: 39 I've been writing a kind of diskette copying utility, which should also format the target disk if so needed. The copying goes fine already, but the formatting seems to be the really hard part. I've tried to use the BIOS services via int 13h for this. First, I set format parameters with ah = 18h, ch = n of tracks - 1, cl = n of sectors, dl = drive, then the actual formatting should go track by track with ah = 05h, al = n of tracks, es:bx = address field table, ch = track, cl = sector (0, actually this seems to have no effect ?), dh = head, dl = disk. My address field table consists of one entry / sector each 4 bytes containing track,head,sector + 1,2 (=512 bytes / sector). Actually I copied this procedure from the DOS's format command by setting an interrupt handler to monitor its actions. (format.com itself does not make these calls, instead it appears to use DOS iocntl (int 21h,AH=44h) functions (0dh, 0fh ?)(BTW :-)). I can't get this work, however : When I try to format a track on a 1.2 M disk, only nine of the fifteen sectors appear on the disk. It seems that the bios somehow has the idea of the disk being 360 k, no matter that setting the right parameters for formatting via int 13h, ah = 18h seems to succeed (ah = 0 upon return). I've used Borlands turbo C to write these making use of the pseudo-variables to access registers etc. (I looked the compiler's .asm output file through and it seems to be doing just what intented, that is, the registers being set up do not get overwritten before the int instruction. The trap routine written for format.com also confirms this.) I could use the dos iocntl's too, but my documentation claims that these are valid from DOS v. 3.2 and later only. Despites it might be that these are not 'officially' defined by Microsoft and might therefore be modified. So, how do I do this right ? Please reply with email. I'll summarize here later (if I get any replies in the first place .. :-) Thanks (even) in advance ? -- - Jouni Lepp{j{rvi / jml@stekt.oulu.fi - - '.. but only maybe, life is a joy .. ' -