*BSD News Article 24151


Return to BSD News archive

Newsgroups: comp.os.386bsd.development
Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!agate!howland.reston.ans.net!usenet.ins.cwru.edu!news.csuohio.edu!stever
From: stever@csuohio.edu (Steve Ratliff)
Subject: Better HGA Support in Syscons with XF86 2.0
Message-ID: <1993Nov18.040346.6937@news.csuohio.edu>
Sender: news@news.csuohio.edu (USENET News System)
Organization: Cleveland State University
X-Newsreader: Tin 1.1 PL5
Date: Thu, 18 Nov 1993 04:03:46 GMT
Lines: 85

	I am one of those poor souls (masochists?) running XFree86 2.0
on a Monochrome HGA/MDA display adaptor with syscons on FreeBSD 1.0r.
I finally got sick of X leaving the adapter in the graphics mode thereby
screwing up all the vty's.  The other vty's would be blank because
syscons did not know how to reset the HGA to a known text mode.  You
had to reboot the system to get back into text mode.
	I fixed this today by hacking in better support for HGA displays
into syscons.  The "syscons -m 80x25" command now works on HGA's instead
of returning ENXIO.  You can now switch from Xwindows to another vty and
actually see text! :) hurray!
	The only bug I've found so far is that you sometimes have to hit
ctrl and alt keys together after switching vty's to prevent control
characters from appearing when you hit keys.  This bug also seems to be
present with VGA adapters as well from prior postings.
	I have not extensively tested these mod's.  I've only been using
them for a couple of hours myself.  Therefore use them at your own risk
and if your monitor explodes don't blame me.  They should be fine though
since I used an official Hercules Inc. -tm databook for the register
info.


*** syscons.c.save	Wed Nov 17 01:05:11 1993
--- syscons.c	Wed Nov 17 21:56:57 1993
***************
*** 510,516 ****
  		return 0;
  
  	case CONS_80x25TEXT:	/* set 80x25 text mode */
! 		if (!crtc_vga)
  			return ENXIO;
  		scp->mode = TEXT80x25;
  		scp->max_posy = 25;
--- 510,516 ----
  		return 0;
  
  	case CONS_80x25TEXT:	/* set 80x25 text mode */
! 		if (!crtc_vga && crtc_addr != MONO_BASE)
  			return ENXIO;
  		scp->mode = TEXT80x25;
  		scp->max_posy = 25;
***************
*** 2303,2310 ****
  		cursor_shape(scp->cursor_start, scp->cursor_end);
  
  	/* mode change only on VGA's */
! 	if (!crtc_vga) 
  		return;
  
  	/* setup video hardware for the given mode */
  	s = splhigh();
--- 2303,2336 ----
  		cursor_shape(scp->cursor_start, scp->cursor_end);
  
  	/* mode change only on VGA's */
! 	if (!crtc_vga) {
! 	/* attempt at mode change on HGA's */
! 	 	if(crtc_addr == MONO_BASE &&
! 		   scp->mode == TEXT80x25) {
! 			s = splhigh();
! 			/* text mode on, text blinker on, screen blank */
! 			outb(crtc_addr+4, 0x20);
! 
! 			/* set up 6845 registers for text mode */
! 			outb(crtc_addr, 0x00); outb(crtc_addr+1, 0x61);
! 			outb(crtc_addr, 0x01); outb(crtc_addr+1, 0x50);
! 			outb(crtc_addr, 0x02); outb(crtc_addr+1, 0x52);
! 			outb(crtc_addr, 0x03); outb(crtc_addr+1, 0x0F);
! 			outb(crtc_addr, 0x04); outb(crtc_addr+1, 0x19);
! 			outb(crtc_addr, 0x05); outb(crtc_addr+1, 0x06);
! 			outb(crtc_addr, 0x06); outb(crtc_addr+1, 0x19);
! 			outb(crtc_addr, 0x07); outb(crtc_addr+1, 0x19);
! 			outb(crtc_addr, 0x08); outb(crtc_addr+1, 0x02);
! 			outb(crtc_addr, 0x09); outb(crtc_addr+1, 0x0D);
! 			outb(crtc_addr, 0x0A); outb(crtc_addr+1, 0x0B);
! 			outb(crtc_addr, 0x0B); outb(crtc_addr+1, 0x0C);
! 
! 			/* text mode on, text blinker on, screen on */
! 			outb(crtc_addr+4, 0x28);
! 			splx(s);
! 		}
  		return;
+ 	}
  
  	/* setup video hardware for the given mode */
  	s = splhigh();