@@ 0,0 1,162 @@
+#include "u.h"
+#include "../port/lib.h"
+#include "mem.h"
+#include "dat.h"
+#include "fns.h"
+#include "io.h"
+#include "../port/error.h"
+
+#include "devtab.h"
+
+/*
+ * Driver for various VGA cards
+ */
+
+char monitor[NAMELEN]; /* monitor name and type */
+char vgacard[NAMELEN]; /* vga card type */
+struct screeninfo {
+ int maxx, maxy; /* current bits per screen */
+ int packed; /* 0=planar, 1=packed */
+ int interlaced; /* != 0 if interlaced */
+} screeninfo;
+
+enum {
+ Qdir= 0,
+ Qvgamonitor= 1,
+ Qvgasize= 2,
+ Qvgatype= 3,
+ Qvgaportio= 4,
+ Nvga= 4,
+};
+
+Dirtab vgadir[]={
+ "vgamonitor", {Qvgamonitor}, 0, 0666,
+ "vgatype", {Qvgatype}, 0, 0666,
+ "vgasize", {Qvgasize}, 0, 0666,
+ "vgaportio", {Qvgaportio}, 0, 0666,
+};
+
+/* a routine from ../port/devcons.c */
+extern int readstr(ulong, char *, ulong, char *);
+
+void
+vgasetup(void) {
+}
+
+void
+vgareset(void) {
+ strcpy(monitor, "generic");
+ strcpy(vgacard, "generic");
+ screeninfo.maxx = 640;
+ screeninfo.maxy = 480;
+ screeninfo.packed = 0;
+ screeninfo.interlaced = 0;
+}
+
+void
+vgainit(void)
+{
+}
+
+Chan*
+vgaattach(char *upec)
+{
+ return devattach('v', upec);
+}
+
+Chan*
+vgaclone(Chan *c, Chan *nc)
+{
+ return devclone(c, nc);
+}
+
+int
+vgawalk(Chan *c, char *name)
+{
+ return devwalk(c, name, vgadir, Nvga, devgen);
+}
+
+void
+vgastat(Chan *c, char *dp)
+{
+ switch(c->qid.path){
+ default:
+ devstat(c, dp, vgadir, Nvga, devgen);
+ break;
+ }
+}
+
+Chan*
+vgaopen(Chan *c, int omode)
+{
+ switch(c->qid.path){
+ case Qvgamonitor:
+ case Qvgatype:
+ case Qvgasize:
+ case Qvgaportio:
+ break;
+ }
+
+ return devopen(c, omode, vgadir, Nvga, devgen);
+}
+
+void
+vgacreate(Chan *c, char *name, int omode, ulong perm)
+{
+ error(Eperm);
+}
+
+void
+vgaclose(Chan *c)
+{
+}
+
+long
+vgaread(Chan *c, void *buf, long n, ulong offset)
+{
+ char obuf[60];
+ switch(c->qid.path&~CHDIR){
+ case Qdir:
+ return devdirread(c, buf, n, vgadir, Nvga, devgen);
+ case Qvgamonitor:
+ return readstr(offset, buf, n, monitor);
+ case Qvgatype:
+ return readstr(offset, buf, n, vgacard);
+ case Qvgasize:
+ sprint(obuf, "%dx%d%x%d %s",
+ screeninfo.maxx, screeninfo.maxy,
+ screeninfo.packed ? 16 : 256,
+ screeninfo.interlaced ? "interlaced" : "non-interlaced");
+ return readstr(offset, buf, n, obuf);
+ case Qvgaportio:
+ return 0;
+ }
+}
+
+long
+vgawrite(Chan *c, void *va, long n, ulong offset)
+{
+ if(offset != 0)
+ error(Ebadarg);
+ switch(c->qid.path&~CHDIR){
+ case Qdir:
+ error(Eperm);
+ case Qvgamonitor:
+ case Qvgatype:
+ case Qvgasize:
+ case Qvgaportio:
+ return 0;
+ }
+}
+
+void
+vgaremove(Chan *c)
+{
+ error(Eperm);
+}
+
+void
+vgawstat(Chan *c, char *dp)
+{
+ error(Eperm);
+}
@@ 23,12 23,12 @@ struct{
* screen dimensions
*/
-/*
#define MAXX 640
#define MAXY 480
-*/
+/*
#define MAXX 800
#define MAXY 600
+*/
#define SCREENMEM (0xA0000 | KZERO)
@@ 95,18 95,18 @@ VGAmode mode12 =
};
/*
- * VESA standard (?) 800x600 display, 16 bit color.
+ * cardinal (tseng labs) 800x600 display, 16 bit color.
*/
-VGAmode mode6a =
+VGAmode mode25 =
{
/* general */
- 0x67, 0x00, /* 0x70, 0x04, these are read-only */
+ 0xe3, 0x00, /* 0x70, 0x04, these are read-only */
/* sequence */
0x03, 0x01, 0x0f, 0x00, 0x06,
/* crt */
- 0x7a, 0x63, 0x65, 0x9d, 0x68, 0x99, 0x38, 0x1f,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x2c, 0x8e, 0x2b, 0x32, 0x0f, 0x32, 0x34, 0xe7,
+ 0x5f, 0x4f, 0x50, 0x02, 0x54, 0x80, 0x0b, 0x3e,
+ 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0,
+ 0xea, 0x8c, 0xdf, 0x28, 0x00, 0xe7, 0x04, 0xe3,
0xff,
/* graphics */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x0f,
@@ 115,24 115,6 @@ VGAmode mode6a =
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x3f,
0x01, 0x10, 0x0f, 0x00, 0x00,
-#ifdef almost
- /* general */
- 0xe7, 0x00, /* 0x70, 0x04, these are read-only */
- /* sequence */
- 0x03, 0x01, 0x0f, 0x00, 0x06,
- /* crt */
- 0x7a, 0x63, 0x65, 0x9d, 0x67, 0x92, 0x39, 0x1f,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x33, 0x82, 0x2b, 0x32, 0x0f, 0x33, 0x36, 0xe7,
- 0xff,
- /* graphics */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x0f,
- 0xff,
- /* attribute */
- 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
- 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x3f,
- 0x01, 0x10, 0x0f, 0x00, 0x00,
-#endif
};
void
@@ 161,9 143,6 @@ grout(int reg, int val)
void
arout(int reg, int val)
{
- /*
- * if this print is missing, we are left with a blank white screen.
- */
inb(0x3DA);
if (reg <= 0xf) {
outb(ARW, reg | 0x0);
@@ 321,8 300,7 @@ screeninit(void)
ulong *l;
VGAmode testmode;
- setmode(&mode6a);
- getmode(&testmode);
+ setmode(&mode12);
/*
* swizzle the font longs.
@@ 338,11 316,6 @@ screeninit(void)
out.pos.x = MINX;
out.pos.y = 0;
out.bwid = defont0.info[' '].width;
-delay(50000);
- setmode(&mode12);
- printmode(&testmode);
- getmode(&testmode);
- printmode(&testmode);
}
void