Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 02 Nov 1998 13:26:00 -0600
From:      "Alejandro Vázquez C." <alexv@sui.gda.itesm.mx>
To:        freebsd-hackers@FreeBSD.ORG
Subject:   VGA 90-columns text mode...
Message-ID:  <363E0747.FEA14658@sui.gda.itesm.mx>

next in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
Everyone:

     I don't know where to send this, but I'm sure you are
     interested. This weekend I found a utility to setup a
     90-column text mode. Using a "vga-register" grabber I took the
     CRT values and I was playing arround with them. After writing
     a small dos program to setup diferent cominations of
     Columns/Rows in text mode, I decided to extend the "sc0"
     driver in FreeBSD to support those modes.

     I've attached the corresponding "diffs" so you can test it
     out. They are for the 2.2.7-RELEASE and I don't know if they
     could work for any other version. The modified files are
     "/usr/src/sys/i386/isa/syscons.c",
     "/usr/src/sys/i386/include/console.h" (this file is the same
     at /usr/include/machine/console.h so you must update both
     files), and "/usr/src/usr.sbin/vidcontrol/vidcontrol.c". The
     new modes added are "VGA_90x25", "VGA_90x30", "VGA_90x43",
     "VGA_90x50", "VGA_90x60", and can be selected from vidcontrol.

     The extention setups the VGA to display a 720pixels wide
     screen with a 8pixels wide font (so 720/8=90). This is
     possible for each height the VGA supports (350, 400, 480
     lines). Those modes should work on most VGA cards (even those
     "plain VGA"). I've tested these modes (succesfully) with a
     Trident ProVidia 9685 (PCI) and a "plain VGA" Cirrus Logic
     GD5320 (ISA). The author of the program I found on the net
     stated that those modes where undocumented by IBM but worked
     in the original IBM VGA. However I haven't done any other kind
     of test to the code, so use it at your own risk.

     Some applications seems to be sticked to 80-columns so they do
     not use the extra columns ("ee" is the most significant case).
     "bash" seems to read a "COLUMNS" environment variable at
     startup. "lynx" looks great at 90x30 (the text is easier to
     read on some pages) without any extra effort. I haven't tested
     any other application.

     Mail me for comment....

             -alexv


[-- Attachment #2 --]
*** /sys/i386/isa/syscons.c.orig	Tue Jul  7 00:23:22 1998
--- /sys/i386/isa/syscons.c	Mon Nov  2 01:17:58 1998
***************
*** 294,299 ****
--- 294,300 ----
  #ifdef SC_SPLASH_SCREEN
  static void toggle_splash_screen(scr_stat *scp);
  #endif
+ static void setup_mode90(char *mp);  /* alexv */
  
  struct  isa_driver scdriver = {
      scprobe, scattach, "sc", 1
***************
*** 1500,1505 ****
--- 1501,1512 ----
      case SW_ENH_B80x43: case SW_ENH_C80x43:
      case SW_EGAMONO80x25:
  
+     case SW_VGA_C90x25: case SW_VGA_M90x25:     /* alexv */
+     case SW_VGA_C90x30: case SW_VGA_M90x30:
+     case SW_VGA_C90x43: case SW_VGA_M90x43:
+     case SW_VGA_C90x50: case SW_VGA_M90x50:
+     case SW_VGA_C90x60: case SW_VGA_M90x60:
+ 
  	if (!crtc_vga)
   	    return ENODEV;
   	mp = get_mode_param(scp, cmd & 0xff);
***************
*** 1520,1525 ****
--- 1527,1580 ----
  	else
  	    i = 0;
  	switch (cmd & 0xff) {
+ 
+         case M_VGA_C90x25: case M_VGA_M90x25:   /* alexv */
+             scp->status |= UNKNOWN_MODE;
+             scp->xsize = 90;
+             scp->ysize = 25;
+             scp->font_size = mp[2];
+             break;
+ 
+         case M_VGA_C90x30: case M_VGA_M90x30:   /* alexv */
+             scp->status |= UNKNOWN_MODE;  
+             scp->xsize = 90;
+             scp->ysize = 30;
+             scp->font_size = mp[2];
+             break;
+ 
+         case M_VGA_C90x43: case M_VGA_M90x43:   /* alexv */
+             if (!(fonts_loaded & FONT_8)) {
+                 splx(s);
+                 return EINVAL;
+             }
+             scp->status |= UNKNOWN_MODE;
+             scp->xsize = 90;
+             scp->ysize = 43;
+             scp->font_size = 8;
+             break;
+ 
+         case M_VGA_C90x50: case M_VGA_M90x50:   /* alexv */
+             if (!(fonts_loaded & FONT_8)) {
+                 splx(s);
+                 return EINVAL;
+             }
+             scp->status |= UNKNOWN_MODE;
+             scp->xsize = 90;
+             scp->ysize = 50;
+             scp->font_size = 8;
+             break;
+ 
+         case M_VGA_C90x60: case M_VGA_M90x60:   /* alexv */
+             if (!(fonts_loaded & FONT_8)) {
+                 splx(s);
+                 return EINVAL;
+             }
+             scp->status |= UNKNOWN_MODE;
+             scp->xsize = 90;
+             scp->ysize = 60;
+             scp->font_size = 8;
+             break;
+ 
  	case M_VGA_C80x60: case M_VGA_M80x60:
  	    if (!(fonts_loaded & FONT_8)) {
  		splx(s);
***************
*** 3371,3376 ****
--- 3426,3441 ----
          { M_VGA_C80x50, M_VGA_C80x25 },
          { M_VGA_M80x60, M_VGA_M80x25 },
          { M_VGA_C80x60, M_VGA_C80x25 },
+         { M_VGA_C90x25, M_VGA_C80x25 }, /* alexv { */
+         { M_VGA_M90x25, M_VGA_M80x25 },
+         { M_VGA_C90x30, M_VGA_C80x25 },
+         { M_VGA_M90x30, M_VGA_M80x25 },
+         { M_VGA_C90x43, M_ENH_C80x25 },
+         { M_VGA_M90x43, M_ENH_C80x25 },
+         { M_VGA_C90x50, M_VGA_C80x25 },
+         { M_VGA_M90x50, M_VGA_M80x25 },
+         { M_VGA_C90x60, M_VGA_C80x25 },
+         { M_VGA_M90x60, M_VGA_M80x25 }, /* } alexv */
          { M_VGA_MODEX,  M_VGA_CG320 },
      };
      int i;
***************
*** 4171,4176 ****
--- 4236,4252 ----
  }
  
  void
+ setup_mode90(char *modetable)  /* alexv */
+ {
+   modetable[5] |= 0x1;
+   modetable[9]  = (modetable[9] & 0xf3) | 0x4;
+   modetable[10] = 0x6a; modetable[11] = 0x59;
+   modetable[12] = 0x5a; modetable[13] = 0x8d;
+   modetable[14] = 0x63; modetable[15] = 0x88;
+   modetable[29] = 0x2d; modetable[54] = 0x0;
+ }
+ 
+ void
  set_mode(scr_stat *scp)
  {
      char special_modetable[MODE_PARAM_SIZE];
***************
*** 4193,4203 ****
--- 4269,4283 ----
  
      /* setup video hardware for the given mode */
      switch (scp->mode) {
+     case M_VGA_C90x60: case M_VGA_M90x60:       /* alexv */
+         setup_mode90(special_modetable);
      case M_VGA_C80x60: case M_VGA_M80x60:
  	special_modetable[2]  = 0x08;
  	special_modetable[19] = 0x47;
  	goto special_480l;
  
+     case M_VGA_C90x30: case M_VGA_M90x30:       /* alexv */
+         setup_mode90(special_modetable);
      case M_VGA_C80x30: case M_VGA_M80x30:
  	special_modetable[19] = 0x4f;
  special_480l:
***************
*** 4210,4225 ****
--- 4290,4311 ----
  	special_modetable[32] = 0x04;
  	goto setup_mode;
  
+     case M_VGA_C90x43: case M_VGA_M90x43:
+         setup_mode90(special_modetable);
      case M_ENH_C80x43: case M_ENH_B80x43:
  	special_modetable[28] = 87;
  	goto special_80x50;
  
+     case M_VGA_C90x50: case M_VGA_M90x50:       /* alexv */
+         setup_mode90(special_modetable);
      case M_VGA_C80x50: case M_VGA_M80x50:
  special_80x50:
  	special_modetable[2] = 8;
  	special_modetable[19] = 7;
  	goto setup_mode;
  
+     case M_VGA_C90x25: case M_VGA_M90x25:       /* alexv */
+         setup_mode90(special_modetable);
      case M_VGA_C40x25: case M_VGA_C80x25:
      case M_VGA_M80x25:
      case M_B40x25:     case M_C40x25:

[-- Attachment #3 --]
*** /sys/i386/include/console.h.orig	Fri Jan 30 04:47:24 1998
--- /sys/i386/include/console.h	Mon Nov  2 01:16:34 1998
***************
*** 351,356 ****
--- 351,367 ----
  #define M_VGA_CG640	36	/* vga 640x400 256 color */
  #define M_VGA_MODEX	37	/* vga 320x240 256 color */
  
+ #define M_VGA_M90x25    40      /* alexv check for conflicts { */
+ #define M_VGA_C90x25    41
+ #define M_VGA_M90x30    42
+ #define M_VGA_C90x30    43
+ #define M_VGA_M90x43    44
+ #define M_VGA_C90x43    45
+ #define M_VGA_M90x50    46
+ #define M_VGA_C90x50    47
+ #define M_VGA_M90x60    48
+ #define M_VGA_C90x60    49      /* } alexv */
+ 
  #define M_ENH_B80x43	0x70	/* ega black & white 80x43 */
  #define M_ENH_C80x43	0x71	/* ega color 80x43 */
  
***************
*** 393,398 ****
--- 404,421 ----
  #define SW_VGA_M80x30	_IO('S', M_VGA_M80x30)
  #define SW_VGA_M80x50	_IO('S', M_VGA_M80x50)
  #define SW_VGA_M80x60	_IO('S', M_VGA_M80x60)
+ 
+ #define SW_VGA_M90x25   _IO('S', M_VGA_M90x25) /* alexv { */
+ #define SW_VGA_C90x25   _IO('S', M_VGA_C90x25)
+ #define SW_VGA_M90x30   _IO('S', M_VGA_M90x30)
+ #define SW_VGA_C90x30   _IO('S', M_VGA_C90x30)
+ #define SW_VGA_M90x43   _IO('S', M_VGA_M90x43)
+ #define SW_VGA_C90x43   _IO('S', M_VGA_C90x43)
+ #define SW_VGA_M90x50   _IO('S', M_VGA_M90x50)
+ #define SW_VGA_C90x50   _IO('S', M_VGA_C90x50)
+ #define SW_VGA_M90x60   _IO('S', M_VGA_M90x60)
+ #define SW_VGA_C90x60   _IO('S', M_VGA_C90x60) /* } alexv */
+ 
  #define SW_VGA11	_IO('S', M_VGA11)
  #define SW_BG640x480	_IO('S', M_VGA11)
  #define SW_VGA12	_IO('S', M_VGA12)

[-- Attachment #4 --]
*** /usr/src/usr.sbin/vidcontrol/vidcontrol.c.orig	Sat Jul 18 06:37:54 1998
--- /usr/src/usr.sbin/vidcontrol/vidcontrol.c	Mon Nov  2 01:28:34 1998
***************
*** 277,282 ****
--- 277,292 ----
  			mode = SW_ENH_C80x25;
  		else if (!strcmp(argv[*index], "EGA_80x43"))
  			mode = SW_ENH_C80x43;
+                 else if (!strcmp(argv[*index], "VGA_90x25")) /* alex { */
+                         mode = SW_VGA_C90x25;
+                 else if (!strcmp(argv[*index], "VGA_90x30"))
+                         mode = SW_VGA_C90x30;
+                 else if (!strcmp(argv[*index], "VGA_90x43"))
+                         mode = SW_VGA_C90x43;
+                 else if (!strcmp(argv[*index], "VGA_90x50"))
+                         mode = SW_VGA_C90x50;
+                 else if (!strcmp(argv[*index], "VGA_90x60"))
+                         mode = SW_VGA_C90x60;                /* } alexv */
  		else
  			return;
  		if (ioctl(0, mode, NULL) < 0)

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?363E0747.FEA14658>