[comp.sys.atari.st] Wanted: How to tell if drive B is REALLY attached?

jeff@quark.WV.TEK.COM (Jeff Beadles) (07/15/89)

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.

Please reply via email, and I'll summarize to the net.

Thanks
	-Jeff
-- 
Jeff Beadles		jeff@quark.WV.TEK.COM or uunet!tektronix!quark.wv!jeff

uace0@uhnix2.uh.edu (Michael B. Vederman) (07/16/89)

In article <3904@orca.WV.TEK.COM> 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.
>
>Please reply via email, and I'll summarize to the net.
>
>Thanks
>	-Jeff
>-- 
>Jeff Beadles		jeff@quark.WV.TEK.COM or uunet!tektronix!quark.wv!jeff

line eater
line eater
line eater
line eaters unite!

There really is no need to send to you so you can summarize, there is one way
that is WELL documented (and one not so well documented way).

WELL documented:

variable $4a6 - _nflops - number of floppy disks actually attached to the
                system (0, 1, or 2)

Not well documented: After appl_init one of the outint locations has the
                drive map (I can't remember off hand).

- mike

-- 
for (;;)                              : Use ATARINET, send an interactive
        do_it(c_programmers);         : message such as:
                                      : Tell UH-INFO at UHUPVM1 ATARINET HELP
University Atari Computer Enthusiasts : University of Houston UACE

john@stag.UUCP (John Stanley) (07/17/89)

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