*BSD News Article 22247


Return to BSD News archive

Path: sserve!newshost.anu.edu.au!munnari.oz.au!constellation!aardvark.ucs.uoknor.edu!ns1.nodak.edu!netnews.nwnet.net!news.clark.edu!spool.mu.edu!howland.reston.ans.net!math.ohio-state.edu!cs.utexas.edu!TAMUTS.TAMU.EDU!bloom-beacon.mit.edu!mcrcim.mcgill.edu!homer.cs.mcgill.ca!storm
Newsgroups: comp.os.386bsd.questions
Subject: Re: [NetBSD 0.9] Codrv and Syscons ports wanted
Message-ID: <29ccgq$9a8@homer.cs.mcgill.ca>
From: storm@cs.mcgill.ca (Marc WANDSCHNEIDER)
Date: 11 Oct 1993 19:34:50 GMT
References: <MARK_WEAVER.93Oct11125041@excelsior.cis.brown.edu>
Organization: SOCS, McGill University, Montreal, Canada
NNTP-Posting-Host: mnementh.cs.mcgill.ca
Lines: 839

In article <MARK_WEAVER.93Oct11125041@excelsior.cis.brown.edu>,
 <Mark_Weaver@brown.edu> wrote:
>Where can I find ports of these console drivers for NetBSD 0.9?

	While It does tend to be difficult to find things on it, check
	out the archies at minnie.

	In the meantime, this was posted a while back, I killed the
	header and shit though, so I don't know who did it.


								Marc 'em.













syscons 0.2 is an alternate console driver for 386BSD which provides
for multiple virtual terminals on a PC display.

This is a patch to syscons 0.2 to
	(a) get it to work on NetBSD 0.9,
	(b) make it more emacs-friendly 
		- add real control key
		- map BackSpace -> DEL
		- map Control-Space to NUL

[Send flames that I should use iscreen instead to /dev/null.]

I believe that the old "alt" behavior is unchanged but I haven't
really tested it.

Installation: install as per the syscons installation instructions;
*however*, you also need to change all occurrances of:

#include "pc.h"
#if NPC > 0
...
#else
...
#endif

into

#include "pc.h"
#include "sc.h" 
#if (NPC > 0) || (NSC > 0)
...
#else
...
#endif

In arch/i386/isa/conf.c, you need to change the "#if NPC > 0" stuff into:

#include "pc.h"
#include "sc.h"
 
#if (NPC > 0) || (NSC > 0)
int	pcopen(),pcclose(),pcread(),pcwrite(),pcioctl(),pcmmap();
#if (NSC > 0)
#define pc_tty pccons
#endif
extern	struct tty *pc_tty[];

#else
....

Anyhow, here are the diffs.  Yes, I know the attach output messages
are grungy.. tough..

					- Bill

===================================================================
RCS file: /usr/src/sys/arch/i386/isa/syscons.c,v
retrieving revision 1.1
diff -c -r1.1 syscons.c
*** 1.1	1993/09/10 02:38:06
--- syscons.c	1993/09/15 02:06:00
***************
*** 64,70 ****
--- 64,72 ----
  #include "machine/psl.h"
  #include "machine/frame.h"
  #include "sc.h"
+ #if 0
  #include "ddb.h"
+ #endif
  #include "iso8859.font"
  #include "kbdtables.h"
  /*#include "asm.h"*/
***************
*** 82,89 ****
  #define SWITCH_WAIT_ACQ	0x00080
  
  /* virtual video memory addresses */
- #define	MONO_BUF	0xFE0B0000
- #define	CGA_BUF		0xFE0B8000
  #define	VGA_BUF		0xFE0A0000
  #define VIDEOMEM	0x000A0000
  
--- 84,89 ----
***************
*** 99,105 ****
--- 99,107 ----
  
  /* defines related to hardware addresses */
  #define	MONO_BASE	0x3B4			/* crt controller base mono */
+ #if 0
  #define	COLOR_BASE	0x3D4			/* crt controller base color */
+ #endif
  #define ATC		0x3C0			/* attribute controller */
  #define TSIDX		0x3C4			/* timing sequencer idx */
  #define TSREG		0x3C5			/* timing sequencer data */
***************
*** 138,149 ****
  static	scr_stat	cons_scr_stat[NCONS];
  static	scr_stat	*cur_scr_stat = &cons_scr_stat[0];
  static	scr_stat 	*new_scp, *old_scp;
  static	int		switch_in_progress = 0;
  
! u_short			*Crtat = (u_short *)MONO_BUF;
  static 	u_short	 	*crtat = 0;
  static	u_int		crtc_addr = MONO_BASE;
! static 	u_char		shfts = 0, ctls = 0, alts = 0;
  static	char		palette[3*256];
  static 	const u_int 	n_fkey_tab = sizeof(fkey_tab) / sizeof(*fkey_tab);
  static	int 		cur_cursor_pos = -1;
--- 140,152 ----
  static	scr_stat	cons_scr_stat[NCONS];
  static	scr_stat	*cur_scr_stat = &cons_scr_stat[0];
  static	scr_stat 	*new_scp, *old_scp;
+ static  int new_scr = 0;
  static	int		switch_in_progress = 0;
  
! extern  u_short		*Crtat;
  static 	u_short	 	*crtat = 0;
  static	u_int		crtc_addr = MONO_BASE;
! static 	u_char		shfts = 0, ctls = 0, alts = 0, metas = 0;
  static	char		palette[3*256];
  static 	const u_int 	n_fkey_tab = sizeof(fkey_tab) / sizeof(*fkey_tab);
  static	int 		cur_cursor_pos = -1;
***************
*** 152,160 ****
  static	long		blank_time = 0;		/* screen saver timout value */
  static  scrmap_t	scr_map;
  
! struct	tty 		pccons[NCONS];
! struct	tty 		*cur_pccons = &pccons[0];
! struct  tty		*new_pccons;
  
  extern	int hz;
  extern	struct timeval time;
--- 155,162 ----
  static	long		blank_time = 0;		/* screen saver timout value */
  static  scrmap_t	scr_map;
  
! struct	tty 		*pccons[NCONS];
! int pccons_cur, pccons_new;
  
  extern	int hz;
  extern	struct timeval time;
***************
*** 199,208 ****
  static scr_stat *get_scr_stat(dev_t dev);
  static int get_scr_num(scr_stat *scp);
  static void cursor_shape(int start, int end);
! static void cursor_pos(void);
  static void clear_screen(scr_stat *scp);
  static switch_scr(u_int next_scr);
! static void exchange_scr(void);
  static void move_crsr(scr_stat *scp, u_int x, u_int y);
  static void move_up(u_short *s, u_short *d, u_int len);
  static void move_down(u_short *s, u_short *d, u_int len);
--- 201,210 ----
  static scr_stat *get_scr_stat(dev_t dev);
  static int get_scr_num(scr_stat *scp);
  static void cursor_shape(int start, int end);
! static void cursor_pos(caddr_t);
  static void clear_screen(scr_stat *scp);
  static switch_scr(u_int next_scr);
! static void exchange_scr(u_int next_scr);
  static void move_crsr(scr_stat *scp, u_int x, u_int y);
  static void move_up(u_short *s, u_short *d, u_int len);
  static void move_down(u_short *s, u_short *d, u_int len);
***************
*** 297,313 ****
  			fillw(scp->attr | ' ', scp->scr, COL * ROW);
  		}
  	}
! 	cursor_pos();
  }
  
  
  static struct tty *get_pccons(dev_t dev)
  {
  	int i = minor(dev);
! 
  	if (i >= NCONS)
  		return(NULL);
! 	return(&pccons[i]);
  }
  
  
--- 299,319 ----
  			fillw(scp->attr | ' ', scp->scr, COL * ROW);
  		}
  	}
! 	cursor_pos(0);
  }
  
  
  static struct tty *get_pccons(dev_t dev)
  {
  	int i = minor(dev);
! 	struct tty *tp;
  	if (i >= NCONS)
  		return(NULL);
! 	tp = pccons[i];
! 	if (tp == NULL) {
! 		tp = pccons[i] = ttymalloc();
! 	}
! 	return(tp);
  }
  
  
***************
*** 400,418 ****
  {
  	int c, len;
  	u_char *cp;
! 
  	scrn_saver(0);
  	c = sgetc(1);
  	if (c & 0x100)
  		return;
  	if (pcconsoftc.cs_flags & CSF_POLLING)
  		return;
  	if (c < 0x100)
! 		(*linesw[cur_pccons->t_line].l_rint)(c & 0xFF, cur_pccons);
! 	else if (cp = get_fstr((u_int)c, (u_int *)&len)) {
  		while (len-- >  0)
! 			(*linesw[cur_pccons->t_line].l_rint)
! 				(*cp++ & 0xFF, cur_pccons);
  	}
  }
  
--- 406,430 ----
  {
  	int c, len;
  	u_char *cp;
! 	struct tty *tp;
  	scrn_saver(0);
  	c = sgetc(1);
  	if (c & 0x100)
  		return;
  	if (pcconsoftc.cs_flags & CSF_POLLING)
  		return;
+ 	tp = get_pccons(pccons_cur);
  	if (c < 0x100)
! 		(*linesw[tp->t_line].l_rint)(c & 0xFF, tp);
! 	else if (c & FKEY) {
! 	     if (cp = get_fstr((u_int)c, (u_int *)&len)) {
  		while (len-- >  0)
! 			(*linesw[tp->t_line].l_rint)
! 				(*cp++ & 0xFF, tp);
! 	   }
! 	} else if (c & MKEY) {
! 		(*linesw[tp->t_line].l_rint)(27, tp); /* !!! ESC */
! 		(*linesw[tp->t_line].l_rint)(c & 0xFF, tp);
  	}
  }
  
***************
*** 517,523 ****
  		case VT_TRUE:	/* user has released screen, go on */
  			if (scp == old_scp && (scp->status & SWITCH_WAIT_REL)) {
  				scp->status &= ~SWITCH_WAIT_REL;
! 				exchange_scr();
  				if (new_scp->smode.mode == VT_PROCESS) {
  					new_scp->status |= SWITCH_WAIT_ACQ;
  					psignal(new_scp->proc, 
--- 529,535 ----
  		case VT_TRUE:	/* user has released screen, go on */
  			if (scp == old_scp && (scp->status & SWITCH_WAIT_REL)) {
  				scp->status &= ~SWITCH_WAIT_REL;
! 				exchange_scr(new_scr);
  				if (new_scp->smode.mode == VT_PROCESS) {
  					new_scp->status |= SWITCH_WAIT_ACQ;
  					psignal(new_scp->proc, 
***************
*** 557,568 ****
  		if (*data == 0) {
  			if (scp == cur_scr_stat)
  				return 0;
! 			while ((error=tsleep(&scp->smode, 
  					     PZERO|PCATCH, "waitvt", 0)) 
  					     == ERESTART) ;
  		}
  		else 
! 			while ((error=tsleep(&cons_scr_stat[*data].smode, 
  					     PZERO|PCATCH, "waitvt", 0)) 
  					     == ERESTART) ;
  		return error;
--- 569,580 ----
  		if (*data == 0) {
  			if (scp == cur_scr_stat)
  				return 0;
! 			while ((error=tsleep((caddr_t)&scp->smode, 
  					     PZERO|PCATCH, "waitvt", 0)) 
  					     == ERESTART) ;
  		}
  		else 
! 			while ((error=tsleep((caddr_t)&cons_scr_stat[*data].smode, 
  					     PZERO|PCATCH, "waitvt", 0)) 
  					     == ERESTART) ;
  		return error;
***************
*** 798,810 ****
  
  pcxint(dev_t dev)
  {
! 	pccons[minor(dev)].t_state &= ~TS_BUSY;
  	pcconsoftc.cs_timo = 0;
! 	if (pccons[minor(dev)].t_line)
! 		(*linesw[pccons[minor(dev)].t_line].l_start)
! 			(&pccons[minor(dev)]);
  	else
! 		pcstart(&pccons[minor(dev)]);
  }
  
  
--- 810,822 ----
  
  pcxint(dev_t dev)
  {
! 	struct tty *tp = get_pccons(dev);
! 	tp->t_state &= ~TS_BUSY;
  	pcconsoftc.cs_timo = 0;
! 	if (tp->t_line)
! 		(*linesw[tp->t_line].l_start) (tp);
  	else
! 		pcstart(tp);
  }
  
  
***************
*** 816,838 ****
  	s = spltty();
  	if (!(tp->t_state & (TS_TIMEOUT|TS_BUSY|TS_TTSTOP)))
  		for (;;) {
! 			if (RB_LEN(&tp->t_out) <= tp->t_lowat) {
  				if (tp->t_state & TS_ASLEEP) {
  					tp->t_state &= ~TS_ASLEEP;
! 					wakeup((caddr_t)&tp->t_out);
  				}
! 				if (tp->t_wsel) {
! 					selwakeup(tp->t_wsel, 
! 						  tp->t_state & TS_WCOLL);
! 					tp->t_wsel = 0;
! 					tp->t_state &= ~TS_WCOLL;
! 				}
  			}
! 			if (RB_LEN(&tp->t_out) == 0)
  				break;
  			if (scp->status & SLKED) 
  				break;
! 			c = getc(&tp->t_out);
  			splx(s);
  			ansi_put(scp, c);
  			s = spltty();
--- 828,845 ----
  	s = spltty();
  	if (!(tp->t_state & (TS_TIMEOUT|TS_BUSY|TS_TTSTOP)))
  		for (;;) {
! 			if (tp->t_outq.c_cc <= tp->t_lowat) {
  				if (tp->t_state & TS_ASLEEP) {
  					tp->t_state &= ~TS_ASLEEP;
! 					wakeup((caddr_t)&tp->t_outq);
  				}
! 				selwakeup(&tp->t_wsel);
  			}
! 			if (tp->t_outq.c_cc == 0)
  				break;
  			if (scp->status & SLKED) 
  				break;
! 			c = getc(&tp->t_outq);
  			splx(s);
  			ansi_put(scp, c);
  			s = spltty();
***************
*** 852,858 ****
  
  	/* initialize required fields */
  	cp->cn_dev = makedev(maj, 0);
- 	cp->cn_tp = &pccons[0];
  	cp->cn_pri = CN_INTERNAL;
  }
  
--- 859,864 ----
***************
*** 1005,1011 ****
  }
  
  
! static void cursor_pos(void)
  {
  	int pos = cur_scr_stat->crtat - cur_scr_stat->crt_base;
  
--- 1011,1017 ----
  }
  
  
! static void cursor_pos(caddr_t mbz)
  {
  	int pos = cur_scr_stat->crtat - cur_scr_stat->crt_base;
  
***************
*** 1044,1055 ****
  	switch_in_progress = 1;
  	old_scp = cur_scr_stat;
  	new_scp = &cons_scr_stat[next_scr];
! 	wakeup(&new_scp->smode);
  	if (new_scp == old_scp) {
  		switch_in_progress = 0;
  		return 0;
  	}
! 	new_pccons = &pccons[next_scr];
  	
  	/* has controlling process died? */
  	if (old_scp->proc && (old_scp->proc != pfind(old_scp->pid)))
--- 1050,1061 ----
  	switch_in_progress = 1;
  	old_scp = cur_scr_stat;
  	new_scp = &cons_scr_stat[next_scr];
! 	wakeup((caddr_t)&new_scp->smode);
  	if (new_scp == old_scp) {
  		switch_in_progress = 0;
  		return 0;
  	}
! 	new_scr = next_scr;
  	
  	/* has controlling process died? */
  	if (old_scp->proc && (old_scp->proc != pfind(old_scp->pid)))
***************
*** 1063,1069 ****
  		psignal(old_scp->proc, old_scp->smode.relsig);
  	}
  	else {
! 		exchange_scr();
  		if (new_scp->smode.mode == VT_PROCESS) {
  			new_scp->status |= SWITCH_WAIT_ACQ;
  			psignal(new_scp->proc, new_scp->smode.acqsig);
--- 1069,1075 ----
  		psignal(old_scp->proc, old_scp->smode.relsig);
  	}
  	else {
! 		exchange_scr(new_scr);
  		if (new_scp->smode.mode == VT_PROCESS) {
  			new_scp->status |= SWITCH_WAIT_ACQ;
  			psignal(new_scp->proc, new_scp->smode.acqsig);
***************
*** 1075,1087 ****
  }
  
  
! static void exchange_scr(void) 
  {
  	bcopy(Crtat, old_scp->scr, old_scp->max_posx * old_scp->max_posy * 2);
  	old_scp->crt_base = old_scp->scr;
  	move_crsr(old_scp, old_scp->posx, old_scp->posy);
  	cur_scr_stat = new_scp;
! 	cur_pccons = new_pccons;
  	if (old_scp->status & KBD_RAW_MODE || new_scp->status & KBD_RAW_MODE)
  		shfts = ctls = alts = 0;
  	update_leds(new_scp->status & LOCK_KEY_MASK);
--- 1081,1093 ----
  }
  
  
! static void exchange_scr(u_int new_scr) 
  {
  	bcopy(Crtat, old_scp->scr, old_scp->max_posx * old_scp->max_posy * 2);
  	old_scp->crt_base = old_scp->scr;
  	move_crsr(old_scp, old_scp->posx, old_scp->posy);
  	cur_scr_stat = new_scp;
! 	pccons_cur = new_scr;
  	if (old_scp->status & KBD_RAW_MODE || new_scp->status & KBD_RAW_MODE)
  		shfts = ctls = alts = 0;
  	update_leds(new_scp->status & LOCK_KEY_MASK);
***************
*** 1604,1610 ****
  }
  
  
! void consinit(void)
  {
  	u_short *cp = Crtat + (CGA_BUF-MONO_BUF)/sizeof(u_short), was;
  	scr_stat *scp;
--- 1610,1616 ----
  }
  
  
! void sysconsinit(void)
  {
  	u_short *cp = Crtat + (CGA_BUF-MONO_BUF)/sizeof(u_short), was;
  	scr_stat *scp;
***************
*** 1629,1635 ****
  		crtc_addr = MONO_BASE;
  	} else {
  		*cp = was;
! 		crtc_addr = COLOR_BASE;
  		Crtat = Crtat + (CGA_BUF-MONO_BUF)/sizeof(u_short);
  	}
  	/* Extract cursor location */
--- 1635,1641 ----
  		crtc_addr = MONO_BASE;
  	} else {
  		*cp = was;
! 		crtc_addr = CGA_BASE;
  		Crtat = Crtat + (CGA_BUF-MONO_BUF)/sizeof(u_short);
  	}
  	/* Extract cursor location */
***************
*** 1639,1663 ****
  	cursorat |= inb(crtc_addr+1);
  
  	crtat = Crtat+ cursorat;
! 
! 	cons_scr_stat[0].crtat = crtat;
! 	cons_scr_stat[0].crt_base = Crtat;
! 	cons_scr_stat[0].posx = cursorat % COL;
! 	cons_scr_stat[0].posy = cursorat / COL;
! 	cons_scr_stat[0].esc = 0;
! 	cons_scr_stat[0].std_attr = (FG_LIGHTGREY | BG_BLACK) << 8;
! 	cons_scr_stat[0].rev_attr = (FG_BLACK | BG_LIGHTGREY) << 8;
! 	cons_scr_stat[0].attr = (FG_LIGHTGREY | BG_BLACK) << 8;
! 	cons_scr_stat[0].border = BG_BLACK;;
! 	cons_scr_stat[0].max_posx = COL;
! 	cons_scr_stat[0].max_posy = ROW;
! 	cons_scr_stat[0].status = 0;
! 	cons_scr_stat[0].pid = 0;
! 	cons_scr_stat[0].proc = NULL;
! 	cons_scr_stat[0].smode.mode = VT_AUTO;
! 	cons_scr_stat[0].bell_pitch = 800;
! 	cons_scr_stat[0].bell_duration = 10;
! 	clear_screen(&cons_scr_stat[0]);
  }
  
  
--- 1645,1669 ----
  	cursorat |= inb(crtc_addr+1);
  
  	crtat = Crtat+ cursorat;
! 	scp = &cons_scr_stat[0];
! 	scp->crtat = crtat;
! 	scp->crt_base = Crtat;
! 	scp->posx = cursorat % COL;
! 	scp->posy = cursorat / COL;
! 	scp->esc = 0;
! 	scp->std_attr = (FG_LIGHTGREY | BG_BLACK) << 8;
! 	scp->rev_attr = (FG_BLACK | BG_LIGHTGREY) << 8;
! 	scp->attr = (FG_LIGHTGREY | BG_BLACK) << 8;
! 	scp->border = BG_BLACK;;
! 	scp->max_posx = COL;
! 	scp->max_posy = ROW;
! 	scp->status = 0;
! 	scp->pid = 0;
! 	scp->proc = NULL;
! 	scp->smode.mode = VT_AUTO;
! 	scp->bell_pitch = 800;
! 	scp->bell_duration = 10;
! 	clear_screen(scp);
  }
  
  
***************
*** 1667,1673 ****
  	scr_stat *scp = &cons_scr_stat[0];
  
  	if (crtat == 0)
! 		consinit();
  	i = scp->attr;
  	scp->attr = ca << 8;
  	ansi_put(scp, c);
--- 1673,1679 ----
  	scr_stat *scp = &cons_scr_stat[0];
  
  	if (crtat == 0)
! 		sysconsinit();
  	i = scp->attr;
  	scp->attr = ca << 8;
  	ansi_put(scp, c);
***************
*** 1738,1749 ****
  		return dt;
  
  	/* Check for cntl-alt-del */
! 	if ((dt == 83) && ctls && alts)
  		cpu_reset();
  
! #if NDDB > 0
  	/* Check for cntl-alt-esc */
! 	if ((dt == 1) && ctls && alts) {
  		/* if debugger called, try to switch to console 0 */
  		if (cur_scr_stat->smode.mode == VT_AUTO &&
  		    cons_scr_stat[0].smode.mode == VT_AUTO)
--- 1744,1755 ----
  		return dt;
  
  	/* Check for cntl-alt-del */
! 	if ((dt == 83) && ctls && (alts || metas))
  		cpu_reset();
  
! #ifdef DDB
  	/* Check for cntl-alt-esc */
! 	if ((dt == 1) && ctls && (alts || metas)) {
  		/* if debugger called, try to switch to console 0 */
  		if (cur_scr_stat->smode.mode == VT_AUTO &&
  		    cons_scr_stat[0].smode.mode == VT_AUTO)
***************
*** 1824,1830 ****
  		dt = (dt & 0x80) | 0x68;
  	esc_flag = 0;
  
! 	state = (shfts ? 1 : 0 ) | (2 * (ctls ? 1 : 0)) | (4 * (alts ? 1 : 0));
  	key = &key_map.key[dt & 0x7F];
  	if ( ((key->flgs & FLAG_LOCK_C) && (cur_scr_stat->status & CLKED))
  	     || ((key->flgs & FLAG_LOCK_N) && (cur_scr_stat->status & NLKED)) )
--- 1830,1836 ----
  		dt = (dt & 0x80) | 0x68;
  	esc_flag = 0;
  
! 	state = (shfts ? 1 : 0 ) | (2 * (ctls ? 1 : 0)) | (4 * ((alts || metas) ? 1 : 0));
  	key = &key_map.key[dt & 0x7F];
  	if ( ((key->flgs & FLAG_LOCK_C) && (cur_scr_stat->status & CLKED))
  	     || ((key->flgs & FLAG_LOCK_N) && (cur_scr_stat->status & NLKED)) )
***************
*** 1854,1859 ****
--- 1860,1871 ----
  			case RALT:
  				alts &= ~2;
  				break;
+ 			case LMETA:
+ 				metas &= ~1;
+ 				break; 
+ 			case RMETA:
+                                 metas &= ~2;
+ 				break;
  			}
  		}
  	} else {
***************
*** 1878,1884 ****
  			case SLK:
  				if (cur_scr_stat->status & SLKED) {
  					cur_scr_stat->status &= ~SLKED;
! 					pcstart(&pccons[get_scr_num(cur_scr_stat)]);
  				} 
  				else 
  					cur_scr_stat->status |= SLKED;
--- 1890,1896 ----
  			case SLK:
  				if (cur_scr_stat->status & SLKED) {
  					cur_scr_stat->status &= ~SLKED;
! 					pcstart(get_pccons(get_scr_num(cur_scr_stat)));
  				} 
  				else 
  					cur_scr_stat->status |= SLKED;
***************
*** 1904,1921 ****
  			case RALT:
  				alts |= 2;
  				break;
  			default:
  				if (action >= F_SCR && action <= L_SCR) {
  					switch_scr(action - F_SCR);
  					break;
  				}
  				if (action >= F_FN && action <= L_FN) {
  					return(action | FKEY);
  				}
  				return(action);
  			}
  		}
! 		else  return(action);
  	}
  	goto next_code;
  }
--- 1916,1946 ----
  			case RALT:
  				alts |= 2;
  				break;
+ 			case LMETA:
+ 				metas |= 1;
+ 				break;
+ 			case RMETA:
+ 				metas |= 2;
+ 				break;
  			default:
  				if (action >= F_SCR && action <= L_SCR) {
  					switch_scr(action - F_SCR);
  					break;
  				}
+ 				if (metas) {
+ 					action |= MKEY; 
+ 				}
  				if (action >= F_FN && action <= L_FN) {
  					return(action | FKEY);
  				}
  				return(action);
  			}
  		}
! 		else {
! 			if (metas)
! 				action |= MKEY;
! 			return(action);
! 		}
  	}
  	goto next_code;
  }
***************
*** 2010,2016 ****
  
  	/* (re)activate cursor */
  	untimeout(cursor_pos, 0);
! 	cursor_pos();
  }
  
  
--- 2035,2041 ----
  
  	/* (re)activate cursor */
  	untimeout(cursor_pos, 0);
! 	cursor_pos(0);
  }
  
  
===================================================================
RCS file: /usr/src/sys/sys/console.h,v
retrieving revision 1.1
diff -c -r1.1 console.h
*** 1.1	1993/09/10 02:38:52
--- console.h	1993/09/15 01:30:16
***************
*** 173,178 ****
--- 173,180 ----
  #define SLK		0x06
  #define LALT		0x07
  #define LCTR		0x09
+ #define LMETA           0x0a
+ #define RMETA           0x7a
  #define RCTR		0x7b
  #define RALT		0x7c
  
***************
*** 181,186 ****
--- 183,189 ----
  #define F_FN		27		/* first function key 		*/
  #define L_FN		122		/* last function key 		*/
  #define FKEY		0x200		/* funtion key marker 		*/
+ #define MKEY            0x400	        /* meta key marker */
  
  #define	KB_DATA		0x60		/* kbd data port 		*/
  #define	KB_STAT		0x64		/* kbd status port 		*/
===================================================================
RCS file: /usr/src/sys/arch/i386/isa/kbdtables.h,v
retrieving revision 1.1
diff -c -r1.1 kbdtables.h
*** 1.1	1993/09/10 02:38:06
--- kbdtables.h	1993/09/15 01:39:15
***************
*** 151,157 ****
  /* sc=0b */  '0',   ')',   NOP,   NOP,   '0',   ')',   NOP,   NOP,  0x33, 0x00,
  /* sc=0c */  '-',   '_',  0x1F,  0x1F,   '-',   '_',  0x1F,  0x1F,  0x00, 0x00,
  /* sc=0d */  '=',   '+',   NOP,   NOP,   '=',   '+',   NOP,   NOP,  0x33, 0x00,
! /* sc=0e */ 0x08,  0x08,  0x7F,  0x7F,  0x08,  0x08,  0x7F,  0x7F,  0x00, 0x00,
  /* sc=0f */ 0x09,  0x08,   NOP,   NOP,  0x09,  0x08,   NOP,   NOP,  0x33, 0x00,
  /* sc=10 */  'q',   'Q',  0x11,  0x11,   'q',   'Q',  0x11,  0x11,  0x00, 0x01,
  /* sc=11 */  'w',   'W',  0x17,  0x17,   'w',   'W',  0x17,  0x17,  0x00, 0x01,
--- 151,157 ----
  /* sc=0b */  '0',   ')',   NOP,   NOP,   '0',   ')',   NOP,   NOP,  0x33, 0x00,
  /* sc=0c */  '-',   '_',  0x1F,  0x1F,   '-',   '_',  0x1F,  0x1F,  0x00, 0x00,
  /* sc=0d */  '=',   '+',   NOP,   NOP,   '=',   '+',   NOP,   NOP,  0x33, 0x00,
! /* sc=0e */ 0x7f,  0x7f,  0x08,  0x08,  0x7f,   0x7f, 0x08,  0x08,  0x00, 0x00,
  /* sc=0f */ 0x09,  0x08,   NOP,   NOP,  0x09,  0x08,   NOP,   NOP,  0x33, 0x00,
  /* sc=10 */  'q',   'Q',  0x11,  0x11,   'q',   'Q',  0x11,  0x11,  0x00, 0x01,
  /* sc=11 */  'w',   'W',  0x17,  0x17,   'w',   'W',  0x17,  0x17,  0x00, 0x01,
***************
*** 193,200 ****
  /* sc=35 */  '/',   '?',   NOP,   NOP,   '/',   '?',   NOP,   NOP,  0x33, 0x00,
  /* sc=36 */  RSH,   RSH,   RSH,   RSH,   RSH,   RSH,   RSH,   RSH,  0xFF, 0x00,
  /* sc=37 */  '*',   '*',  0x0A,  0x0A,   '*',   '*',  0x0A,  0x0A,  0x33, 0x00,
! /* sc=38 */ LALT,  LALT,  LALT,  LALT,  LALT,  LALT,  LALT,  LALT,  0xFF, 0x00,
! /* sc=39 */  ' ',   ' ',   ' ',   ' ',   ' ',   ' ',   ' ',   ' ',  0x00, 0x00,
  /* sc=3a */  CLK,   CLK,   CLK,   CLK,   CLK,   CLK,   CLK,   CLK,  0xFF, 0x00,
  /* sc=3b */ F( 1), F(13), F(25), F(37), S( 1), S(11), S( 1), S(11), 0xFF, 0x00,
  /* sc=3c */ F( 2), F(14), F(26), F(38), S( 2), S(12), S( 2), S(12), 0xFF, 0x00,
--- 193,200 ----
  /* sc=35 */  '/',   '?',   NOP,   NOP,   '/',   '?',   NOP,   NOP,  0x33, 0x00,
  /* sc=36 */  RSH,   RSH,   RSH,   RSH,   RSH,   RSH,   RSH,   RSH,  0xFF, 0x00,
  /* sc=37 */  '*',   '*',  0x0A,  0x0A,   '*',   '*',  0x0A,  0x0A,  0x33, 0x00,
! /* sc=38 */ LMETA,  LMETA,  LMETA,  LMETA,  LMETA,  LMETA,  LMETA,  LMETA,  0xFF, 0x00,
! /* sc=39 */  ' ',   ' ',  0x00,  0x00,    ' ',   ' ', 0x00,  0x00,  0x00, 0x00,
  /* sc=3a */  CLK,   CLK,   CLK,   CLK,   CLK,   CLK,   CLK,   CLK,  0xFF, 0x00,
  /* sc=3b */ F( 1), F(13), F(25), F(37), S( 1), S(11), S( 1), S(11), 0xFF, 0x00,
  /* sc=3c */ F( 2), F(14), F(26), F(38), S( 2), S(12), S( 2), S(12), 0xFF, 0x00,
***************
*** 230,236 ****
  /* sc=5a */ RCTR,  RCTR,  RCTR,  RCTR,  RCTR,  RCTR,  RCTR,  RCTR,  0xFF, 0x00,
  /* sc=5b */  '/',   '/',   '/',   '/',   '/',   '/',   '/',   '/',  0x00, 0x00,
  /* sc=5c */  '*',   '*',   '*',   '*',   '*',   '*',   '*',   '*',  0x00, 0x00,
! /* sc=5d */ RALT,  RALT,  RALT,  RALT,  RALT,  RALT,  RALT,  RALT,  0xFF, 0x00,
  /* sc=5e */ F(49), F(49), F(49), F(49), F(49), F(49), F(49), F(49), 0xFF, 0x00,
  /* sc=5f */ F(50), F(50), F(50), F(50), F(50), F(50), F(50), F(50), 0xFF, 0x00,
  /* sc=60 */ F(51), F(51), F(51), F(51), F(51), F(51), F(51), F(51), 0xFF, 0x00,
--- 230,236 ----
  /* sc=5a */ RCTR,  RCTR,  RCTR,  RCTR,  RCTR,  RCTR,  RCTR,  RCTR,  0xFF, 0x00,
  /* sc=5b */  '/',   '/',   '/',   '/',   '/',   '/',   '/',   '/',  0x00, 0x00,
  /* sc=5c */  '*',   '*',   '*',   '*',   '*',   '*',   '*',   '*',  0x00, 0x00,
! /* sc=5d */ RMETA,  RMETA,  RMETA,  RMETA,  RMETA,  RMETA,  RMETA,  RMETA,  0xFF, 0x00,
  /* sc=5e */ F(49), F(49), F(49), F(49), F(49), F(49), F(49), F(49), 0xFF, 0x00,
  /* sc=5f */ F(50), F(50), F(50), F(50), F(50), F(50), F(50), F(50), 0xFF, 0x00,
  /* sc=60 */ F(51), F(51), F(51), F(51), F(51), F(51), F(51), F(51), 0xFF, 0x00,



-- 
----------------------------------------------------------------------------
Marc Wandschneider					    Seattle, WA
                  Free/Net BSD---Real UN*X, Really Free