UH2@PSUVM.BITNET (Lee Sailer) (10/06/88)
Will someone suggest a way to test for the absence of a floppy from a BAT file that doesn't generate the Abort, Retry, Ignore message. Basically, we want to be able to do something like chekfloppy A: if return_code == NO then ECHO Put a Floppy in drive A: endif We speak Pascal and C, if that helps. EMAIL responses preferred. Thanks. lee
brown@nicmad.UUCP (Mr. Video) (10/10/88)
In article <55969UH2@PSUVM> UH2@PSUVM.BITNET (Lee Sailer) writes:
<Will someone suggest a way to test for the absence of a floppy from
<a BAT file that doesn't generate the Abort, Retry, Ignore message.
With 360K diskette drives, it can't be done. I don't know how to do it
for the others (I haven't needed to try). So, if your .BAT file will
end up being used with 360K diskettes, you won't be able to create a
generic .BNAT file. Also, the .BAT file itself cannot check for the
diskette, another program would have to be run and an ERRORLEVEL message
returned to the .BAT file.
--
harvard-\ att--\
Mr. Video ucbvax!uwvax!astroatc!nicmad!brown
rutgers-/ decvax--/
INTERNET: astroatc.UUCP!nicmad!brown@spool.cs.wisc.edu
nelson@sun.soe.clarkson.edu (Russ Nelson) (10/10/88)
In article <55969UH2@PSUVM> UH2@PSUVM.BITNET (Lee Sailer) writes: <Will someone suggest a way to test for the absence of a floppy from <a BAT file that doesn't generate the Abort, Retry, Ignore message. In article <3278@nicmad.UUCP> brown@nicmad.UUCP (Mr. Video) writes: <With 360K diskette drives, it can't be done. Sorry, Mr. Video -- this is how you do it: dskready a: if errorlevel 12 goto unformatted if errorlevel 2 goto fool copy foo a: goto end :fool echo You didn't put a disk in there. goto end :unformatted echo You put an unformatted disk in there. goto end :end begin 644 dskready.com ;",!U$Z!<`/[(N0$`,=*[&P'-)7(",,"T3,TAJ `` end -- --russ (nelson@clutx [.bitnet | .clarkson.edu]) To surrender is to remain in the hands of barbarians for the rest of my life. To fight is to leave my bones exposed in the desert waste.
wcf@psuhcx.psu.edu (Bill Fenner) (10/10/88)
In article <3278@nicmad.UUCP> brown@nicmad.UUCP (Mr. Video) writes: |In article <55969UH2@PSUVM> UH2@PSUVM.BITNET (Lee Sailer) writes: |<Will someone suggest a way to test for the absence of a floppy from |<a BAT file that doesn't generate the Abort, Retry, Ignore message. | |With 360K diskette drives, it can't be done. I don't know how to do it Actually, it's rather simple. At least, it is on other machines, I'm not sure if the IBM floppy controller can do this (I would hope it would.) Anyway, you have to talk straight to the drive controller... select the drive, make it spin... then watch the index hole led line... if it's always high, you have no disk. If it's low and goes high 5 times every second, it's got a disk in it (360k). If it's low and goes high 6 times every second, it's got a high-density disk in it (the one that goes 360 rpm instead of 300.) If it's constantly low, you have a problem - either the led is burned out or the disk is wedged, or you have a piece of cardboard in the drive. Good luck Bill -- Bitnet: wcf@psuhcx.bitnet Bill Fenner | "Ain't got no cash, Internet: wcf@hcx.psu.edu | Ain't got no style UUCP: {gatech,rutgers}!psuvax1!psuhcx!wcf | Ain't got no girls Fido: Sysop at 263/42 (814/238 9633) \hogbbs!wcf| To make me smile"
brown@nicmad.UUCP (Mr. Video) (10/11/88)
In article <NELSON.88Oct10092627@sun.soe.clarkson.edu> nelson@clutx.clarkson.edu writes: <In article <55969UH2@PSUVM> UH2@PSUVM.BITNET (Lee Sailer) writes: <<Will someone suggest a way to test for the absence of a floppy from <<a BAT file that doesn't generate the Abort, Retry, Ignore message. < <In article <3278@nicmad.UUCP> brown@nicmad.UUCP (Mr. Video) writes: <<With 360K diskette drives, it can't be done. < <Sorry, Mr. Video -- this is how you do it: < <dskready a: <if errorlevel 12 goto unformatted <if errorlevel 2 goto fool <copy foo a: <goto end <:fool <echo You didn't put a disk in there. <goto end <:unformatted <echo You put an unformatted disk in there. <goto end <:end < < < <begin 644 dskready.com <;",!U$Z!<`/[(N0$`,=*[&P'-)7(",,"T3,TAJ <`` <end As the question stood, I was not in error. Normal MS/PC-DOS does not allow you to do it. The 360K drives don't have a signal that can be checked by the system. There is always a utility out there that someone will come up with that will do the trick. I suspect that this little utility exercises the drive so that it can capture the BIOS response and do an ERRORLEVEL. -- harvard-\ att--\ Mr. Video ucbvax!uwvax!astroatc!nicmad!brown rutgers-/ decvax--/ INTERNET: astroatc.UUCP!nicmad!brown@spool.cs.wisc.edu
jcmorris@mitre-bedford.ARPA (Joseph C. Morris) (10/13/88)
In article <55969UH2@PSUVM> UH2@PSUVM.BITNET (Lee Sailer) writes:
<Will someone suggest a way to test for the absence of a floppy from
<a BAT file that doesn't generate the Abort, Retry, Ignore message.
I've had good luck with all flavors of drives using a test program
built around the following code fragment:
;
mov al,pspf1dr ; get the disk number (1=a:, 2=b:, etc)
sub al,1 ; change to zero-base
mov cx,1 ; read one sector
sub dx,dx ; make it sector zero
mov bx,OFFSET buffer ; ds:bx -> input buffer
int 025h ; absolute disk read
jc readerr ; trouble
jmp ready ; it worked, so it's ready
readerr:
cmp al,002h ; drive not ready?
jne error
mov al,1 ; report 'drive not ready'
jmp cleanup
;
error:
mov al,2 ; report 'drive in trouble'
jmp cleanup
;
ready:
sub al,al ; report 'drive ready and able'
cleanup:
popf ; get last piece off the stack
;
It uses the absolute read DOS call to try to read a sector; DOS returns
an unambiguous OK, NOT-READY, or BROKEN response. If you use it, watch
out for the stack: the function POPs one fewer words than it PUSHes.
(This is documented by IBM.)
If anyone really needs them I've got both stand-alone and C-callable
versions of the test. The code works with both PC's and AT's.
Joe Morris
roth@mrsvr.UUCP (The Unknown Programmer) (10/15/88)
In article <955@psuhcx.psu.edu>, wcf@psuhcx.psu.edu (Bill Fenner) writes: > In article <3278@nicmad.UUCP> brown@nicmad.UUCP (Mr. Video) writes: > |In article <55969UH2@PSUVM> UH2@PSUVM.BITNET (Lee Sailer) writes: > |<Will someone suggest a way to test for the absence of a floppy from > |<a BAT file that doesn't generate the Abort, Retry, Ignore message. > | > |With 360K diskette drives, it can't be done. I don't know how to do it > > Actually, it's rather simple. At least, it is on other machines, I'm not > sure if the IBM floppy controller can do this (I would hope it would.) Mr. Video is right - the status of a diskette drive cannot be determined using BAT language. A special program that sets an exit code the BAT program interprets is required. What one needs is a function that traps DOS critical errors to avoid "abort, retry, ...". I have a version of access() for MS C (written using MASM 5.1) that performs the needed function (no pun intended 8-). You would need to write a very simple program that a BAT program would call. The program would use exit(0) if the drive is OK, else exit(1) (or anything other than zero). For a free copy of my access() function, mail a note to: {uwvax, rutgers} uwmcsd1!lakesys!deanr YOU MUST USE THE ADDRESS GIVEN ABOVE, not the address from which this message was sent. =================opinion by: Dean A. Roth====================== {rutgers, uwvax} uwmcsd1!lakesys!deanr -or- deanr@lakesys.UUCP P.O. Box 11095 Milwaukee, WI 53211 =================representing Dean A. Roth=====================