--- zhcon/bsdfactory.cpp.orig	Sun Sep  9 13:19:32 2001
+++ zhcon/bsdfactory.cpp	Sun Sep  9 13:54:13 2001
@@ -102,11 +102,24 @@
     }
 
     printf ("len %d\n", buflen);
+#if (__FreeBSD__ <= 3)
     if ((vga = open("/dev/vga", O_RDWR | O_NDELAY)) < 0) {
+#else
+    if ((vga = open("/dev/mem", O_RDWR | O_NDELAY)) < 0) {
+#endif
 	throw(runtime_error("Can not open vga device.\n"));
     }
 
-    buf = static_cast<char *>(mmap(0, buflen, PROT_READ | PROT_WRITE, MAP_SHARED, vga, 0));
+    if ((buf = static_cast<char *>(valloc(buflen))) == NULL) {
+        throw(runtime_error("Can not open vga device.\n"));
+    }
+
+#if (__FreeBSD__ <= 3)
+#define GRAPH_BASE 0x0
+#else
+#define GRAPH_BASE 0xA0000
+#endif
+    buf = static_cast<char *>(mmap(buf, buflen, PROT_READ | PROT_WRITE, MAP_FILE|MAP_SHARED|MAP_FIXED, vga, GRAPH_BASE));
     close(vga);
 
     if (buf == MAP_FAILED)
