add video mode register setting to private tty mode struct.
authorBrett Gordon <beretta42@gmail.com>
Fri, 9 Oct 2015 05:05:12 +0000 (01:05 -0400)
committerBrett Gordon <beretta42@gmail.com>
Tue, 13 Oct 2015 13:10:42 +0000 (09:10 -0400)
Kernel/platform-coco3/devtty.c
Kernel/platform-coco3/devtty.h

index 21f1a56..1d5fe96 100644 (file)
@@ -15,6 +15,9 @@
 #define VSECT __attribute__((section(".video")))
 #define VSECTD __attribute__((section(".videodata")))
 
+extern uint8_t hz;
+
+
 uint8_t vtattr_cap;
 
 
@@ -52,7 +55,8 @@ struct s_queue ttyinq[NUM_DEV_TTY + 1] = {
 
 
 struct mode_s{
-       uint8_t gime;
+       uint8_t vmod;
+       uint8_t vres;
        uint8_t width;
        uint8_t height;
        uint8_t right;
@@ -118,7 +122,7 @@ static struct display fmodes[] = {
                GFX_TEXT,        /* all the crap we support in this mode */
                0,               /* Memory size irrelevant */
                0,               /* supports no graphics commands */
-       }
+       },
        {
                4,               /* Mode  number */
                256, 192,        /* screen size */
@@ -126,18 +130,18 @@ static struct display fmodes[] = {
                0xFF, 0xFF,      /* no pan, scroll */
                FMT_MONO_BW,     /* for now just B&W */
                HW_UNACCEL,      /* no acceleration */
-               0,               /* no features
+               0,               /* no features */
                0,               /* Memory size irrelevant */
-               GRX_DRAW,        /* only the basics */
+               GFX_DRAW,        /* only the basics */
        }
 };
 
 static struct mode_s mode[5] = {
-       {   0x74, 80, 25, 79, 24, &(fmodes[0])  },
-       {   0x6c, 40, 25, 39, 24, &(fmodes[1])  },
-       {   0x70, 64, 25, 63, 24, &(fmodes[2])  },
-       {   0x68, 32, 25, 31, 24, &(fmodes[3])  },
-       {   0x08, 40, 21, 39, 20, &(fmodes[4])  },
+       {   0x04, 0x74, 80, 25, 79, 24, &(fmodes[0])  },
+       {   0x04, 0x6c, 40, 25, 39, 24, &(fmodes[1])  },
+       {   0x04, 0x70, 64, 25, 63, 24, &(fmodes[2])  },
+       {   0x04, 0x68, 32, 25, 31, 24, &(fmodes[3])  },
+       {   0x80, 0x08, 40, 21, 39, 20, &(fmodes[4])  },
 };
 
 
@@ -148,6 +152,7 @@ static struct pty ptytab[] VSECTD = {
                0, 
                {0, 0, 0, 0}, 
                0x10000 / 8,
+               0x04,
                0x74,              /* 80 column */
                80,
                25,
@@ -161,6 +166,7 @@ static struct pty ptytab[] VSECTD = {
                0, 
                {0, 0, 0, 0}, 
                0x11000 / 8,
+               0x04,
                0x6c,              /* 40 column */
                40,
                25,
@@ -181,7 +187,8 @@ int curminor = 1;
 /* Apply settings to GIME chip */
 void apply_gime( int minor ){
        *(volatile uint16_t *) 0xff9d = ptytab[minor-1].scrloc;
-       *(volatile uint8_t *) 0xff99 = ptytab[minor-1].gime;
+       *(volatile uint8_t *) 0xff98 = ( hz & 0x78 )| ptytab[minor-1].vmod;
+       *(volatile uint8_t *) 0xff99 = ptytab[minor-1].vres;
 }
 
 
@@ -459,7 +466,7 @@ int gfx_ioctl(uint8_t minor, uarg_t arg, char *ptr)
        if (arg == GFXIOC_SETMODE){
                uint8_t m=ugetc(ptr);
                if( m > 4 ) goto inval;
-               memcpy( &(ptytab[minor-1].gime), &(mode[m]), sizeof( struct mode_s ) );
+               memcpy( &(ptytab[minor-1].vmod), &(mode[m]), sizeof( struct mode_s ) );
                if( minor == curminor ) apply_gime( minor );
                return 0;
        }
@@ -482,7 +489,7 @@ void devtty_init()
 
                /* apply default/cmdline mode to terminal structs */
        for( i=0; i<2; i++){
-               memcpy( &(ptytab[i].gime), &(mode[defmode]), sizeof( struct mode_s ) );
+               memcpy( &(ptytab[i].vmod), &(mode[defmode]), sizeof( struct mode_s ) );
        }
        apply_gime( 1 );    /* apply initial tty1 to regs */
 }
index 3206711..b76cea4 100644 (file)
@@ -10,7 +10,8 @@ struct pty {
        unsigned char csave;    /* charactor that is under the cursor */
        struct vt_switch vt;    /* the vt.o module's state */
        unsigned int scrloc;    /* location to put into gimme */
-       unsigned char gime;      /* video register settings of this tty */   
+       unsigned char vmod;     /* video mode */
+       unsigned char vres;     /* video register settings of this tty */   
        unsigned char width;    /* text width of screen */
        unsigned char height;   /* text height */
        unsigned char right;    /* right most coord */