Article View: comp.sys.atari.st
Article #2408Re: Wanted: How to tell if drive B is REALLY attached?
From: John Stanley
Date: Mon, 17 Jul 1989 00:15
Date: Mon, 17 Jul 1989 00:15
45 lines
1997 bytes
1997 bytes
Newsgroups: comp.sys.atari.st
[jeff@quark.WV.TEK.COM (Jeff Beadles) writes...]
>
> The title pretty well tells it all. I need to know if drive B is attached.
> The functions that I've seen thus far always report two drives, and want the
> user to swap.
>
> I would prefer a "legal" way to do this so my application will work under any
> of the various TOS's.
The following (in C since Jeff didn't specify otherwise) should work
with any existing TOS. I've carefully written this so it "should" also
work under any version of C that runs on the ST. The only limitation is
that you must have the osbind.h header file available for the version of
C you use (or some other way to access the Super() function...)...:
#include <osbind.h>
nflop() /* Returns actual number of floppy drives connected. */
/* (Returns: 0 = -none-, 1 = A:, and 2 = A: + B: ) */
{
register char *ssp;
register int cnt;
ssp = (char*)Super(0L); /* enter super mode */
cnt = *(unsigned char*)0x04a7; /* get value from system variable */
(void)Super(ssp); /* return to user mode */
return(cnt);
}
Note: The system variable is actualy a two byte word based at $4a6,
but I addressed it as an unsigned char to make the code portable across
all the various 16bit and 32bit integer versions of C that are available
on the ST. This doesn't work for most variable bu does here because
there are only 3 possible legal values in this system variable.
... John STanley
---
John Stanley <dynasoft!john@stag.UUCP>
Software Consultant / Dynasoft Systems
Technical Details
Message-ID:
<1989Jul17.001544.19108@stag.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!cs.utexas.edu!csd4.milw.wisc.edu!srcsip!tcnet!pwcs!stag!rootShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!cs.utexas.edu!csd4.milw.wisc.edu!srcsip!tcnet!pwcs!stag!root From: dynasoft!john@stag.UUCP (John Stanley) Newsgroups: comp.sys.atari.st Subject: Re: Wanted: How to tell if drive B is REALLY attached? Message-ID: <1989Jul17.001544.19108@stag.UUCP> Date: 17 Jul 89 00:15:44 GMT Sender: root@stag.UUCP (Computer Abuser) Organization: Mindtools ST Access Group Lines: 45