[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

select



Ah, I'm an idiot. Or I've been up too many days straight. Must be an idiot to
have done that, too... Anyway, here's checkbttys in bios.c again, this time
it doesn't kill itself by walking off the end of the array. (Wouldn't you
know, I had defined and set the maximum counter value before, but never
referenced it. sheesh...)
--- 1.2	1994/03/02 08:06:50
+++ bios.c	1994/03/03 06:01:10
@@ -21,8 +21,9 @@
 /* BIOS device definitions */
 #define CONSDEV 2
 #define AUXDEV 1
 #define PRNDEV 0
+#define	SERDEV 6	/* First serial port */
 
 /* BIOS devices 0..MAX_BHANDLE-1 can be redirected to GEMDOS files */
 #define MAX_BHANDLE	4
 
@@ -31,8 +32,10 @@
 const short boutput[MAX_BHANDLE] = { -3, -2, -1, -5 };
 
 /* tty structures for the BIOS devices -- see biosfs.c */
 extern struct tty con_tty, aux_tty, midi_tty;
+extern struct bios_tty bttys[];
+extern short btty_max;
 
 extern int tosvers;	/* from main.c */
 
 char *kbshft;		/* set in main.c */
@@ -94,8 +97,31 @@
 	DEBUG(("failed call to Getmpb"));
 	return -1;
 }
 
+void
+checkbttys(void)
+{
+	struct bios_tty *b;
+	long *l;
+
+	for (b=bttys;b<bttys+btty_max;b++) {
+		if (b->irec->head != b->irec->tail) {
+			wake(IO_Q, (long)b);
+			l = b->rsel;
+			if (*l)
+				wakeselect(*l);
+		}
+		l = b->wsel;
+		if (*l) {
+			short i = b->orec->tail - b->orec->head;
+			if (i < 0)
+				i += b->orec->buflen;
+			if (i < b->orec->hi_water)
+				wakeselect(*l);
+		}
+	}
+}
 
 /*
  * Note that BIOS handles 0 - MAX_BHANDLE now reference file handles;
  * to get the physical devices, go through u:\dev\
@@ -179,12 +205,21 @@
 		k->head = h;
 		return r;
 	}
 	else {
-		if (dev == AUXDEV && has_bconmap)
-			dev = curproc->bconmap;
-
-		if (dev > 0) {
+		if (dev == AUXDEV) {
+			if (has_bconmap) {
+				dev = curproc->bconmap;
+				h = dev-SERDEV;
+			} else
+				h = 0;
+		} else
+			h = dev-SERDEV;
+
+		if (h >= 0 && h < btty_max) {
+			if (!BCONSTAT(dev))
+				sleep(IO_Q, (long)&bttys[h]);
+		} else if (dev > 0) {
 			unsigned long tick;
 
 			tick = *((unsigned long *)0x4baL);
 			while (!BCONSTAT(dev)) {

There's only one thing I don't like about it at the moment; if you try to
just use "aux:" without first Bconmap'ing it to somewhere else you get stuck
with a non-selectable non-tty... I figure it ought to give you modem1, and
act like a tty, by default. [This doesn't seem to be a problem on systems
that don't support bconmap...]

Say, is anyone else out there using the Atari debugger? Is version 4 the
latest? I have a version 4 binary, and a bunch of files for the version 3
release. I only have a v4 db though, not the rdb. The version 3 rdb doesn't
like running under MultiTOS. (dunno why not, all it has to do is watch the
MIDI ports. sheesh.)