home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / os / msdos / programm / 8857 < prev    next >
Encoding:
Internet Message Format  |  1992-08-29  |  1.2 KB

  1. Path: sparky!uunet!pmafire!news.dell.com!swrinde!mips!bridge2!slinky.NSD.3Com.COM!bobk
  2. From: bobk@ESD.3Com.COM (Bob Konigsberg)
  3. Newsgroups: comp.os.msdos.programmer
  4. Subject: Re: Is a floppy formatted ?
  5. Message-ID: <bobk.715020235@slinky.NSD.3Com.COM>
  6. Date: 28 Aug 92 16:43:55 GMT
  7. References: <1992Aug6.093943.196@mble.philips.be>
  8. Sender: news@bridge2.NSD.3Com.COM
  9. Lines: 25
  10. Nntp-Posting-Host: slinky.nsd.3com.com
  11.  
  12. stern@mble.philips.be writes:
  13.  
  14. >Could anybody explain me how to detect if a floppy is already formatted
  15. >or not? And also if it is simple to program a 'quick format' like in
  16. >DOS 5.0 format.
  17.  
  18. I'm posting this time, having answered this before.
  19.  
  20. In assembler
  21.  
  22. mov ah,2    ;Read Sector function
  23. mov dl,driv_num    ;0-3 allowed
  24. mov dh,0    ;head number
  25. mov cx,0001    ;track 0, sector 1
  26. les bx,buffer    ;es:bx points to read buffer of 512 bytes
  27. mov al,1    ;1 sector to read.  This will fail on HP-150s
  28. int 13        ;do the I/O thing
  29. jc error    ;Carry flag set on error.  This actually can cover
  30.         ;a number of things: not formatted, door open,
  31.         ;diskette in sideways
  32.  
  33. ;If you want to be really cute, you can pass a far address of a variable
  34. ;in C and use that to let a C/C++ program know the results.
  35.  
  36. BobK
  37.