Subject: Re: binary kernel
To: None <jonathan@dsg.stanford.edu, port-pmax@NetBSD.ORG>
From: Arne H. Juul <arnej@pvv.unit.no>
List: port-pmax
Date: 01/15/1996 14:59:43
 > I'm really not sure what the "colour problem" is.
 > It may be that the 3100 pm driver and the cfb driver
 > use incompatible ways of interpreting a colour.   But if this
 > is in glass-tty mode, I have no *idea*  what the problem is.

I had a fix for this in my private tree, but this one is
more right.  It fixes two bugs, but I'm not sure which one
actually causes the color problem (it's only when running X).

 - Arne H. J.

--- src/sys/arch/pmax/dev/bt478.c.orig	Mon Dec 11 21:37:26 1995
+++ src/sys/arch/pmax/dev/bt478.c	Mon Jan 15 14:51:47 1996
@@ -266,22 +266,25 @@
 	u_char *cmap;
 	int i;
 
-	if (index > 256 || index < 0 || index + count > 256)
+	if (index < 0 || count < 0 || index + count > 256)
 		return EINVAL;
 
 	cmap_bits = (u_char *)bits;
 	cmap = (u_char *)(fi -> fi_cmap_bits) + index * 3;
 
-	vdac->mapWA = index; MachEmptyWriteBuffer();
 	for (i = 0; i < count; i++) {
-		cmap [(i + index) * 3]
-			= vdac->map = cmap_bits [i * 3];
+		vdac->mapWA = i + index; MachEmptyWriteBuffer();
+
+		cmap [i * 3] = cmap_bits [i * 3];
+		vdac->map = cmap_bits [i * 3];
 		MachEmptyWriteBuffer();
-		cmap [(i + index) * 3 + 1]
-			= vdac->map = cmap_bits [i * 3 + 1];
+
+		cmap [i * 3 + 1] = cmap_bits [i * 3 + 1];
+		vdac->map = cmap_bits [i * 3 + 1];
 		MachEmptyWriteBuffer();
-		cmap [(i + index) * 3 + 2]
-			= vdac -> map = cmap_bits [i * 3 + 2];
+
+		cmap [i * 3 + 2] = cmap_bits [i * 3 + 2];
+		vdac -> map = cmap_bits [i * 3 + 2];
 		MachEmptyWriteBuffer();
 	}
 	return 0;