*BSD News Article 9915


Return to BSD News archive

Received: by minnie.vk1xwt.ampr.org with NNTP
	id AA6799 ; Fri, 15 Jan 93 10:35:33 EST
Xref: sserve comp.unix.bsd:9972 alt.sources:4993
Path: sserve!manuel.anu.edu.au!munnari.oz.au!sgiblab!darwin.sura.net!paladin.american.edu!news.univie.ac.at!hp4at!mcsun!Germany.EU.net!hcshh!hm
From: hm@hcshh.hcs.de (Hellmuth Michaelis)
Newsgroups: comp.unix.bsd,alt.sources
Subject: [386BSD] pcvt 2.00 - VT220 console driver (part 11/11)
Summary: 386BSD 0.1 VT220 console device driver source code
Keywords: 386BSD console driver VT220
Message-ID: <1627@hcshh.hcs.de>
Date: 15 Jan 93 13:03:22 GMT
Followup-To: comp.unix.bsd
Organization: HCS GmbH, Hamburg, Europe
Lines: 1985

Submitted-by: hm@hcshh.hcs.de (Hellmuth Michaelis)
Archive-name: pcvt-2.00/part11

---- Cut Here and unpack ----
#!/bin/sh
# This is part 11 of pcvt-2.00
if touch 2>&1 | fgrep '[-amc]' > /dev/null
 then TOUCH=touch
 else TOUCH=true
fi
# ============= pcvt_sup.c ==============
if test X"$1" != X"-c" -a -f 'pcvt_sup.c'; then
	echo "File already exists: skipping 'pcvt_sup.c'"
else
echo "x - extracting pcvt_sup.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > pcvt_sup.c &&
X/*
X * Copyright (c) 1992, 1993 Hellmuth Michaelis, Brian Dunford-Shore,
X * Joerg Wunsch and Scott Turner.
X *
X * All rights reserved.
X *
X * This code is derived from software contributed to Berkeley by
X * William Jolitz and Don Ahn.
X *
X * This driver is contributed to the 386BSD operating system.
X *
X * Redistribution and use in source and binary forms, with or without
X * modification, are permitted provided that the following conditions
X * are met:
X * 1. Redistributions of source code must retain the above copyright
X *    notice, this list of conditions and the following disclaimer.
X * 2. Redistributions in binary form must reproduce the above copyright
X *    notice, this list of conditions and the following disclaimer in the
X *    documentation and/or other materials provided with the distribution.
X * 3. All advertising materials mentioning features or use of this software
X *    must display the following acknowledgement:
X *	This product includes software contributed to 386BSD and developed
X *      by Hellmuth Michaelis, Brian Dunford-Shore, Joerg Wunsch
X *         and Scott Turner.
X * 4. Neither the name of the developers nor the names "386BSD" and "pcvt"
X *    may be used to endorse or promote products derived from this software
X *    without specific prior written permission.
X *
X * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
X * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
X * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
X * IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
X * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
X * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
X * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
X * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
X * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
X * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
X */
X
X/*
X *	@(#)pcvt_sup.c		2.00		   (contributed to 386BSD)
X *				Last Edit-Date: [Thu Jan 14 12:43:50 1993]
X */
X
X/*---------------------------------------------------------------------------*
X *
X *	pcvt_sup.c	VT220 Driver Support Routines
X *	---------------------------------------------
X *
X *	written by Hellmuth Michaelis, hm@hcshh.hcs.de          and
X *		   Brian H. Dunford-Shore, brian@morpheus.wustl.edu
X *
X *	-hm	splitting pccons_out.c
X *	-hm	screeninfo ioctl
X *	-hm	ioctl cursorshape changed
X *	-hm	ansi function prototypes
X *	-hm	protecting character generator ram from sysload display
X *	-hm	masking minor driver number
X *	-hm	integration of scotty's window size changes
X *	-hm	color palette enhancements from joerg
X *	-hm	sending SIGWINCH on window size changes
X *	-hm	integrating joerg's screensaver
X *
X *---------------------------------------------------------------------------*/
X
X#include "pcvt_hdr.h"		/* global include */
X
Xstatic void vid_cursor ( struct cursorshape *data );
Xstatic void vgasetfontattr ( struct vgafontattr *data );
Xstatic void vgagetfontattr ( struct vgafontattr *data );
Xstatic void vgaloadchar ( struct vgaloadchar *data );
Xstatic void vid_getscreen ( struct screeninfo *data, dev_t dev );
Xstatic void vid_setscreen ( struct screeninfo *data, dev_t dev );
Xstatic void set_screen_size ( struct video_state *svsp, int size );
Xstatic void select_vga_charset ( int vga_charset );
Xstatic void setchargen ( void );
Xstatic void resetchargen ( void );
Xstatic void vgareadpel ( struct vgapel *data, dev_t dev );
Xstatic void vgawritepel ( struct vgapel *data, dev_t dev );
X
X#ifdef PCVT_SCREENSAVER
Xstatic void pcvt_set_scrnsv_tmo ( int timeout );
X
Xstatic u_short *savedscreen = (u_short *)0;	/* ptr to screen contents */
Xstatic size_t scrnsv_size = (size_t)-1;		/* size of saved image */
Xstatic unsigned scrnsv_timeout = 0;		/* initially off */
Xstatic int scrnsv_active = 0;			/* active flag */
X
X#ifdef HAS_PRETTY_SCREENSAVER
Xstatic u_short *scrnsv_current = (u_short *)0;	/* attention char ptr */
X#endif /* HAS_PRETTY_SCREENSAVER */
X
X#endif /* PCVT_SCREENSAVER */
X
X#ifdef PALETTE_FLICKER
Xstatic void vga_screen_off(void)
Xstatic void vga_screen_on(void)
X#endif PALETTE_FLICKER
X
X/*---------------------------------------------------------------------------*
X *	execute vga ioctls
X *---------------------------------------------------------------------------*/
Xint vgaioctl(dev_t dev, int cmd, caddr_t data, int flag)
X{
X	switch(cmd)
X	{
X		case VGACURSOR:
X			vid_cursor((struct cursorshape *)data);
X			break;
X
X		case VGALOADCHAR:
X			if((adaptor_type != VGA_ADAPTOR) &&
X			   (adaptor_type != EGA_ADAPTOR))
X				return -1;
X			vgaloadchar((struct vgaloadchar *)data);
X			break;
X
X		case VGASETFONTATTR:
X			if((adaptor_type != VGA_ADAPTOR) &&
X			   (adaptor_type != EGA_ADAPTOR))
X				return -1;
X#ifdef PCVT_SCREENSAVER
X			pcvt_scrnsv_reset();
X#endif
X			vgasetfontattr((struct vgafontattr *)data);
X			break;
X
X		case VGAGETFONTATTR:
X			if((adaptor_type != VGA_ADAPTOR) &&
X			   (adaptor_type != EGA_ADAPTOR))
X				return -1;
X			vgagetfontattr((struct vgafontattr *)data);
X			break;
X
X		case VGASETSCREEN:
X#ifdef PCVT_SCREENSAVER
X			pcvt_scrnsv_reset();
X#endif
X			vid_setscreen((struct screeninfo *)data, dev);
X			break;
X
X		case VGAGETSCREEN:
X			vid_getscreen((struct screeninfo *)data, dev);		
X			break;
X
X		case VGAREADPEL:
X			if(adaptor_type != VGA_ADAPTOR)
X				return -1;
X			vgareadpel((struct vgapel *)data, dev);
X			break;
X
X		case VGAWRITEPEL:
X			if(adaptor_type != VGA_ADAPTOR)
X				return -1;
X			vgawritepel((struct vgapel *)data, dev);
X			break;
X
X#ifdef PCVT_SCREENSAVER
X		case VGASCREENSAVER:
X			pcvt_set_scrnsv_tmo(*(int *)data);
X			pcvt_scrnsv_reset();
X			break;
X#endif
X			
X		default:
X			return -1;
X	}
X	return 0;
X}
X
X/*---------------------------------------------------------------------------*
X *	video ioctl - set cursor appearence
X *---------------------------------------------------------------------------*/
Xstatic void vid_cursor(struct cursorshape *data)
X{
X	int screen;
X	int start;
X	int end;
X	int line_height;
X	int character_set;
X
X	screen = data->screen_no; /* for which virtual screen, -1 for current */
X
X	if(screen == -1)	  /* current ? */
X		screen = current_video_screen;
X	else if(screen > totalscreens - 1)
X		screen = totalscreens - 1;
X	else if(screen < 0)
X		screen = 0;
X
X	character_set = vs[screen].vga_charset;		
X	character_set = (character_set < 0) ? 0 :
X		((character_set < totalfonts) ? character_set : totalfonts-1);
X
X	line_height = vgacs[character_set].char_scanlines & 0x0F;
X
X	start = (data->start < 0) ? 0 :
X		((data->start > line_height) ? line_height : data->start);
X
X	end = (data->end < 0) ? 0 :
X		((data->end > line_height) ? line_height : data->end);
X
X	vs[screen].cursor_start = start;
X	vs[screen].cursor_end = end;
X
X	if(screen == current_video_screen)
X	{
X		outb(addr_6845,M6845_CURSTART);	/* cursor start reg */
X		outb(addr_6845+1,start);	
X		outb(addr_6845,M6845_CUREND);	/* cursor end reg */
X		outb(addr_6845+1,end);
X	}
X}
X
X/*---------------------------------------------------------------------------*
X *	ega/vga ioctl - set font attributes
X *---------------------------------------------------------------------------*/
Xstatic void vgasetfontattr(struct vgafontattr *data)
X{
X	register int i;
X	int vga_character_set;
X	int lines_per_character;
X	int totscanlines;
X	int size;
X	
X	vga_character_set = data->character_set;
X	vga_character_set = (vga_character_set < 0) ? 0 :
X		((vga_character_set < totalfonts) ?
X		vga_character_set : totalfonts-1);
X
X	vgacs[vga_character_set].loaded = data->font_loaded;
X	
X	if(data->character_scanlines <= 7)
X	        vgacs[vga_character_set].char_scanlines = data->character_scanlines;
X	else
X	        vgacs[vga_character_set].char_scanlines = data->character_scanlines | 0x40;
X
X	if(adaptor_type == EGA_ADAPTOR)
X	{
X	        if(vgacs[vga_character_set].char_scanlines & 0x40)
X		{
X		        vgacs[vga_character_set].char_scanlines = 
X			     (vgacs[vga_character_set].char_scanlines > 0x4D) ?
X			     0x4D : vgacs[vga_character_set].char_scanlines;
X	        }
X		else
X		{
X		        vgacs[vga_character_set].char_scanlines = 
X			     (vgacs[vga_character_set].char_scanlines > 7) ?
X			     7 : vgacs[vga_character_set].char_scanlines;
X		}
X	        vgacs[vga_character_set].scr_scanlines = 
X			(data->screen_scanlines > 0x5D) ?
X			0x5D : data->screen_scanlines;
X	}
X	else
X	{
X		/* Limit Characters to 16 scanlines doubled */
X	        vgacs[vga_character_set].char_scanlines =
X			vgacs[vga_character_set].char_scanlines & 0x4F;
X	        vgacs[vga_character_set].scr_scanlines = 
X			(data->screen_scanlines > 0x8F) ?
X			0x8F : data->screen_scanlines;
X	    }
X
X	lines_per_character = (int)(0x0F & vgacs[vga_character_set].char_scanlines)+1;
X
X	totscanlines = 0x101 + (int)vgacs[vga_character_set].scr_scanlines;
X
X	size = data->screen_size;
X
X	if(adaptor_type == EGA_ADAPTOR)
X	{
X	        switch(size)
X		{
X			case SIZ_25x80: /* This case is always OK */
X		    		break;
X
X			case SIZ_35x80:
X				if(totscanlines/lines_per_character >= 35)
X		         		size = SIZ_35x80;
X		    		else
X		         		size = SIZ_25x80;
X		    		break;
X
X		  	case SIZ_43x80:
X			default:
X				if(totscanlines/lines_per_character >= 43)
X					size = SIZ_43x80;
X				else if(totscanlines/lines_per_character >= 35)
X					size = SIZ_35x80;
X				else
X					size = SIZ_25x80;
X				break;
X		}
X	}
X	else
X	{
X	        switch(size)
X		{
X			case SIZ_25x80: /* This case is always OK */
X		    		break;
X
X			case SIZ_28x80:
X		    		if(totscanlines/lines_per_character >= 28)
X		         		size = SIZ_28x80;
X		    		else
X		         		size = SIZ_25x80;
X				break;
X				
X			case SIZ_40x80:
X				if(totscanlines/lines_per_character >= 40)
X		         		size = SIZ_40x80;
X		    		else if(totscanlines/lines_per_character >= 28)
X		         		size = SIZ_28x80;
X		    		else
X		         		size = SIZ_25x80;
X		    		break;
X
X			case SIZ_50x80:
X			default:
X				if(totscanlines/lines_per_character >= 50)
X					size = SIZ_50x80;
X		    		else if(totscanlines/lines_per_character >= 40)
X		         		size = SIZ_40x80;
X		    		else if(totscanlines/lines_per_character >= 28)
X		         		size = SIZ_28x80;
X		    		else
X		         		size = SIZ_25x80;
X		    	break;
X		}
X	}
X	
X	vgacs[vga_character_set].screen_size = size;
X	
X	for (i = 0;i < NSCREENS;i++)
X	{
X		if(vga_character_set == vs[i].vga_charset)
X			set_charset(&(vs[i]),vga_character_set);
X	}
X	vgapage(current_video_screen);
X}
X
X/*---------------------------------------------------------------------------*
X *	ega/vga ioctl - get font attributes
X *---------------------------------------------------------------------------*/
Xstatic void vgagetfontattr(struct vgafontattr *data)
X{
X	int vga_character_set;
X	
X	vga_character_set = data->character_set;
X	vga_character_set = (vga_character_set < 0) ? 0 :
X		((vga_character_set < (int)totalfonts) ? vga_character_set : (int)(totalfonts-1));
X
X	data->character_set = (int)vga_character_set;
X
X	data->font_loaded = (int)vgacs[vga_character_set].loaded;
X
X	data->character_scanlines = (int)vgacs[vga_character_set].char_scanlines;
X
X	data->screen_scanlines = (int)vgacs[vga_character_set].scr_scanlines;
X
X	data->screen_size = (int)vgacs[vga_character_set].screen_size;
X}
X
X/*---------------------------------------------------------------------------*
X *	ega/vga ioctl - load a character shape into character set
X *---------------------------------------------------------------------------*/
Xstatic void vgaloadchar(data)
Xstruct vgaloadchar *data;
X{
X	int vga_character_set;
X	int character;
X	int lines_per_character;
X	
X	vga_character_set = data->character_set;
X	vga_character_set = (vga_character_set < 0) ? 0 :
X		((vga_character_set < (int)totalfonts) ? vga_character_set : (int)(totalfonts-1));
X
X	character = (data->character < 0) ? 0 :
X		((data->character > 255) ? 255 : data->character);
X
X	lines_per_character = (int)data->character_scanlines;
X	lines_per_character = (lines_per_character < 0) ? 0 :
X	        ((lines_per_character > 32) ? 32 : lines_per_character);
X
X	loadchar(vga_character_set,character,lines_per_character,data->char_table);
X}
X
X/*---------------------------------------------------------------------------*
X *	video ioctl - get screen information
X *---------------------------------------------------------------------------*/
Xstatic void vid_getscreen(struct screeninfo *data, dev_t dev)
X{
X	int device = (minor(dev) & MINORMASK);
X	data->adaptor_type = adaptor_type;	/* video adapter installed */
X	data->totalfonts = totalfonts;		/* no of downloadble fonts */
X	data->totalscreens = totalscreens;	/* no of virtual screens */
X	data->screen_no = device;		/* this screen number */
X	data->current_screen = current_video_screen; /* displayed screen no */
X	data->screen_size = vgacs[(vs[device].vga_charset)].screen_size; /* screen size */
X	data->pure_vt_mode = vs[device].vt_pure_mode; /* pure VT mode or HP/VT mode */
X}
X
X/*---------------------------------------------------------------------------*
X *	video ioctl - set screen information
X *---------------------------------------------------------------------------*/
Xstatic void vid_setscreen(struct screeninfo *data, dev_t dev)
X{
X	if(data->current_screen == -1)
X		vgapage(minor(dev) & MINORMASK);
X	else
X		vgapage(data->current_screen);
X
X	if(data->screen_size != -1)
X	{
X		if((data->screen_size == SIZ_25x80) ||
X		   (data->screen_size == SIZ_28x80) ||
X		   (data->screen_size == SIZ_35x80) ||
X		   (data->screen_size == SIZ_40x80) ||
X		   (data->screen_size == SIZ_43x80) ||
X		   (data->screen_size == SIZ_50x80))
X		{
X			if(data->screen_no == -1)			
X				set_screen_size(vsp, data->screen_size);
X			else
X				set_screen_size(&vs[(minor(dev) & MINORMASK)], data->screen_size);
X		}
X	}
X
X	if(data->pure_vt_mode != -1)
X	{
X		if((data->pure_vt_mode == M_HPVT) ||
X		   (data->pure_vt_mode == M_PUREVT))
X		{
X			if(data->screen_no == -1)			
X				set_emulation_mode(vsp, data->pure_vt_mode);
X			else
X				set_emulation_mode(&vs[(minor(dev) & MINORMASK)], data->pure_vt_mode);
X		}
X	}
X}
X    
X/*---------------------------------------------------------------------------*
X *	set screen size/resolution for a virtual screen
X *---------------------------------------------------------------------------*/
Xstatic void set_screen_size(struct video_state *svsp, int size)
X{
X	int i;
X
X	for(i = 0; i < totalfonts; i++)
X	{
X		if(vgacs[i].screen_size == size)
X		{
X			set_charset(svsp, i);
X
X			fillw(user_attr | ' ', svsp->Crtat, COL * SCR_MAXROW);
X			clr_parms(svsp);			/* escape parameter init */
X			svsp->state = STATE_INIT;		/* initial state */
X			svsp->col = 0;				/* init row */
X			svsp->row = 0;				/* init col */
X			svsp->crtat = svsp->Crtat;		/* cursor address init */
X			svsp->scr_beg = svsp->Crtat;		/* start of scrolling region */
X			svsp->row_beg = 0;			/* start of scrolling region */
X			svsp->sc_flag = 0;			/* invalidate saved cursor position */
X			svsp->transparent = 0;			/* disable control code processing */
X		
X			/* Update tty to reflect screen size */
X			svsp->vs_tty->t_winsize.ws_row = svsp->screen_rowsize;
X			svsp->vs_tty->t_winsize.ws_col = 80;
X			svsp->vs_tty->t_winsize.ws_xpixel = 640;
X			svsp->vs_tty->t_winsize.ws_ypixel = 480;
X
X			if(svsp->vt_pure_mode == M_HPVT)
X			{
X				svsp->vs_tty->t_winsize.ws_row = 
X				  svsp->screen_rows = svsp->screen_rowsize - 3;
X				svsp->maxrow = svsp->screen_rows - 1;
X		
X				if(svsp->labels_on)
X				{
X					if(svsp->which_fkl == SYS_FKL)
X						sw_sfkl(svsp);
X					else if(svsp->which_fkl == USR_FKL)
X						sw_ufkl(svsp);
X				}
X			}
X			else if(svsp->vt_pure_mode == M_PUREVT)
X			{
X				svsp->vs_tty->t_winsize.ws_row = 
X				  svsp->screen_rows = svsp->screen_rowsize;
X				svsp->maxrow = svsp->screen_rows - 1;
X			}		
X
X#ifdef SIGNAL_WINCH
X			pgsignal(svsp->vs_tty->t_pgrp, SIGWINCH, 1);
X#endif /* SIGNAL_WINCH */			
X
X			if(svsp == vsp)	/* update cursor position if on current screen */
X			{
X			 	outb(addr_6845, M6845_CURSORH);	/* select high register */
X				outb(addr_6845+1, (svsp->crtat - Crtat) >> 8);
X				outb(addr_6845, M6845_CURSORL);	/* select low register */
X				outb(addr_6845+1, (svsp->crtat - Crtat));
X			}
X			break;
X		}
X 	}
X}
X
X/*---------------------------------------------------------------------------*
X *	VGA ioctl - read DAC palette entry
X *---------------------------------------------------------------------------*/
Xstatic void vgareadpel(struct vgapel *data, dev_t dev)
X{
X	register unsigned vpage = minor(dev) & MINORMASK;
X	register unsigned idx = data->idx;
X
X	if(idx >= NVGAPEL)
X		return;		/* no such entry */
X
X	/* do not read VGA palette directly, use saved values */
X	data->r = vs[vpage].palette[idx].r;
X	data->g = vs[vpage].palette[idx].g;
X	data->b = vs[vpage].palette[idx].b;
X}
X
X/*---------------------------------------------------------------------------*
X *	VGA ioctl - write DAC palette entry
X *---------------------------------------------------------------------------*/
Xstatic void vgawritepel(struct vgapel *data, dev_t dev)
X{
X	register unsigned vpage = minor(dev) & MINORMASK;
X	register unsigned idx = data->idx;
X
X	if(idx >= NVGAPEL)
X		return;		/* no such entry */
X
X	/* first, update saved values for this video screen */
X	vs[vpage].palette[idx].r = data->r;
X	vs[vpage].palette[idx].g = data->g;
X	vs[vpage].palette[idx].b = data->b;
X
X	/* if this happens on active screen, update VGA DAC, too */
X	if(vpage == current_video_screen)
X		vgapaletteio(idx, &vs[vpage].palette[idx], 1);
X}
X
X/*---------------------------------------------------------------------------*
X *	VGA physical IO - read/write one palette entry
X *---------------------------------------------------------------------------*/
Xvoid vgapaletteio(unsigned idx, struct rgb *val, int writeit)
X{
X
X#ifdef PALETTE_FLICKER
X	vga_screen_off();
X#endif /* PALETTE_FLICKER */
X
X	if(writeit)
X	{
X		outb(VGA_DAC + 2, idx);
X#ifdef WAIT_RETRACE
X		wait_retrace();
X#endif
X		outb(VGA_DAC + 3, val->r & VGA_PMSK);
X#ifdef WAIT_RETRACE
X		wait_retrace();
X#endif
X		outb(VGA_DAC + 3, val->g & VGA_PMSK);
X#ifdef WAIT_RETRACE
X		wait_retrace();
X#endif
X		outb(VGA_DAC + 3, val->b & VGA_PMSK);
X	}
X	else	/* read it */
X	{
X		outb(VGA_DAC + 1, idx);
X#ifdef WAIT_RETRACE
X		wait_retrace();
X#endif
X		val->r = inb(VGA_DAC + 3) & VGA_PMSK;
X#ifdef WAIT_RETRACE
X		wait_retrace();
X#endif
X		val->g = inb(VGA_DAC + 3) & VGA_PMSK;
X#ifdef WAIT_RETRACE
X		wait_retrace();
X#endif
X		val->b = inb(VGA_DAC + 3) & VGA_PMSK;
X	}
X
X#ifdef PALETTE_FLICKER	
X	vga_screen_on();
X#endif /* PALETTE_FLICKER */
X
X}
X
X/*---------------------------------------------------------------------------*
X *	display load averages in last line (taken from tty.c)
X *---------------------------------------------------------------------------*/
Xvoid average(int a)
X{
X	register int tmp, i;
X	static volatile u_char buffer[] =
X		 "System Load: 1min: 0.00 5min: 0.00 15min: 0.00";
X
X#ifdef PCVT_SCREENSAVER
X	if((vs[0].vt_pure_mode == M_HPVT) && (vs[0].labels_on) &&
X	   (chargen_access == 0) && (scrnsv_active == 0))
X#else
X	if((vs[0].vt_pure_mode == M_HPVT) && (vs[0].labels_on) &&
X	   (chargen_access == 0))
X#endif
X	{
X		i = 18;
X		tmp = (averunnable[0] * 100 + FSCALE / 2) >> FSHIFT;
X		buffer[i++] = (((tmp/100)/10) == 0) ? ' ' : ((tmp/100)/10) + '0';
X		buffer[i++] = ((tmp/100)%10) + '0';
X		buffer[i++] = '.';
X		buffer[i++] = ((tmp%100)/10) + '0';
X		buffer[i++] = ((tmp%100)%10) + '0';
X		i += 6;
X		tmp = (averunnable[1] * 100 + FSCALE / 2) >> FSHIFT;
X		buffer[i++] = (((tmp/100)/10) == 0) ? ' ' : ((tmp/100)/10) + '0';
X		buffer[i++] = ((tmp/100)%10) + '0';
X		buffer[i++] = '.';
X		buffer[i++] = ((tmp%100)/10) + '0';
X		buffer[i++] = ((tmp%100)%10) + '0';
X		i += 7;
X		tmp = (averunnable[2] * 100 + FSCALE / 2) >> FSHIFT;
X		buffer[i++] = (((tmp/100)/10) == 0) ? ' ' : ((tmp/100)/10) + '0';
X		buffer[i++] = ((tmp/100)%10) + '0';
X		buffer[i++] = '.';
X		buffer[i++] = ((tmp%100)/10) + '0';
X		buffer[i++] = ((tmp%100)%10) + '0';
X		buffer[i] = '\0';
X	
X		for(i = 0; buffer[i]; i++)
X		{
X			*((Crtat+((vs[0].screen_rows+2)*COL))+i) =
X			 user_attr | buffer[i];
X		}
X	}
X	if(a == 0)
X		timeout(average, 0, hz/5);	
X}
X    
X/*---------------------------------------------------------------------------*
X *	set character set for virtual screen
X *---------------------------------------------------------------------------*/
Xvoid set_charset(struct video_state *svsp, int curvgacs)
X{
X	static int sizetab[] = { 25, 28, 35, 40, 43, 50 };
X	
X	if((curvgacs < 0) || (curvgacs > (NVGAFONTS-1)))
X		return;
X
X	svsp->vga_charset = curvgacs;
X  
X	select_vga_charset(curvgacs);
X
X	svsp->screen_rowsize = sizetab[(vgacs[curvgacs].screen_size)];
X
X	if( svsp->labels_on && svsp->vt_pure_mode != M_PUREVT)
X		svsp->screen_rows = svsp->screen_rowsize-3;
X	else
X		svsp->screen_rows = svsp->screen_rowsize;
X
X	/* Clip scrolling region */
X	if(svsp->maxrow > svsp->screen_rows-1)
X		svsp->maxrow = svsp->screen_rows-1;
X
X	/* Clip cursor pos */	
X	if((svsp->crtat - svsp->Crtat) > (svsp->maxrow * COL))
X		svsp->crtat = svsp->Crtat+(svsp->maxrow * COL);
X}
X
X/*---------------------------------------------------------------------------*
X *	select a vga character set
X *---------------------------------------------------------------------------*/
Xstatic void select_vga_charset(int vga_charset)
X{
X	int first, second;
X	int fflag = 0;
X	int sflag = 0;
X	u_char cmap = 0;
X
X	static u_char cmaptaba[] =
X		{0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13};
X
X	static u_char cmaptabb[] =
X		{0x00, 0x04, 0x08, 0x0c, 0x20, 0x24, 0x28, 0x2c};
X
X 	if((adaptor_type != EGA_ADAPTOR) && (adaptor_type != VGA_ADAPTOR))
X 		return;
X
X	if((vga_charset < 0) || (vga_charset >= totalfonts))
X		return;
X
X	if(!vgacs[vga_charset].loaded)
X		return;
X
X	/*--------------------------------------------------------------
X	   find the the first and second charset of a given resolution.
X	   the first is used for lower 256 and the second (if any) is
X	   used for the upper 256 entries of a complete 512 entry ega/
X	   vga charset.
X	--------------------------------------------------------------*/
X	
X	for(first = 0; first < totalfonts; first++)
X	{
X		if(!vgacs[first].loaded)
X			continue;
X		if(vgacs[first].screen_size != vgacs[vga_charset].screen_size)
X			continue;
X		if(vgacs[first].char_scanlines != vgacs[vga_charset].char_scanlines)
X			continue;
X		if(vgacs[first].scr_scanlines != vgacs[vga_charset].scr_scanlines)
X			continue;
X		fflag = 1;
X		break;
X	}
X
X	if(fflag != 1)
X		return;
X
X	for(second = first+1; second < totalfonts; second++)
X	{
X		if(!vgacs[second].loaded)
X			continue;
X		if(vgacs[second].screen_size != vgacs[vga_charset].screen_size)
X			continue;
X		if(vgacs[second].char_scanlines != vgacs[vga_charset].char_scanlines)
X			continue;
X		if(vgacs[second].scr_scanlines != vgacs[vga_charset].scr_scanlines)
X			continue;
X		sflag = 1;
X		break;
X	}
X
X	cmap = cmaptaba[first];
X	if(sflag)
X	{
X		cmap |= cmaptabb[second];
X		vgacs[first].secondloaded = second;
X	}
X	else		
X	{
X		vgacs[first].secondloaded = 0; /* cs 0 can never become a 2nd ! */
X	}
X		
X	outb(0x3c4, 0x03);	/* character map select register */
X	outb(0x3c5, cmap);
X
X	outb(0x3d4, 0x09);	/* max scan line reg */
X
X	outb(0x3d5, vgacs[first].char_scanlines); /* scanlines/char */
X
X	outb(0x3d4, 0x12);	/* vert display enable end */
X
X	outb(0x3d5, vgacs[first].scr_scanlines); /* low byte of scr scanlines */
X}
X
X/*---------------------------------------------------------------------------*
X *	switch vga-card to load a character set
X *---------------------------------------------------------------------------*/
Xstatic void setchargen()
X{
X	chargen_access = 1;	/* flag we are accessing the chargen ram */
X
X	/* program sequencer to access character generator */
X
X	outb(0x3c4, 0x00);
X	outb(0x3c5, 0x01);	/* synchronous reset */
X
X	outb(0x3c4, 0x02);
X	outb(0x3c5, 0x04);	/* write to map 2 */
X
X	outb(0x3c4, 0x04);
X	outb(0x3c5, 0x07);	/* sequential addressing */
X
X	outb(0x3c4, 0x00);
X	outb(0x3c5, 0x03);	/* clear synchronous reset */
X
X	/* program graphics controller to access character generator */
X
X	outb(0x3ce, 0x04);
X	outb(0x3cf, 0x02);	/* select map 2 for cpu reads */
X
X	outb(0x3ce, 0x05);
X	outb(0x3cf, 0x00);	/* disable odd-even addressing */
X
X	outb(0x3ce, 0x06);
X	outb(0x3cf, 0x00);	/* map starts at 0xA000 */
X}
X
X/*---------------------------------------------------------------------------*
X *	switch back vga-card to normal operation
X *---------------------------------------------------------------------------*/
Xstatic void resetchargen()
X{
X	/* program sequencer to access video ram */
X
X	outb(0x3c4, 0x00);
X	outb(0x3c5, 0x01);	/* synchronous reset */
X
X	outb(0x3c4, 0x02);
X	outb(0x3c5, 0x03);	/* write to map 0 & 1 */
X
X	outb(0x3c4, 0x04);
X	outb(0x3c5, 0x03);	/* odd-even addressing */
X
X	outb(0x3c4, 0x00);
X	outb(0x3c5, 0x03);	/* clear synchronous reset */
X
X	/* program graphics controller to access character generator */
X
X	outb(0x3ce, 0x04);
X	outb(0x3cf, 0x00);	/* select map 0 for cpu reads */
X
X	outb(0x3ce, 0x05);
X	outb(0x3cf, 0x10);	/* enable odd-even addressing */
X
X	outb(0x3ce, 0x06);
X	outb(0x3cf, 0x0e);	/* map starts at 0xb800 */
X
X	chargen_access = 0;	/* flag we are NOT accessing the chargen ram */
X}
X
X#ifdef WAIT_RETRACE
X/*---------------------------------------------------------------------------*
X *	wait for being in a retrace time window
X *	NOTE: this is __VERY__ bad programming practice in this environment !!
X *---------------------------------------------------------------------------*/
X
Xstatic void wait_retrace(void)
X{
X	if(color)
X	{
X		while(!(inb(0x3da) & 0x01))
X			;
X	}
X	else
X	{
X		while(!(inb(0x3ba) & 0x01))
X			;
X	}
X}
X
X#endif /* WAIT_RETRACE */
X
X#ifdef PALETTE_FLICKER
X
X/*---------------------------------------------------------------------------*
X *	switch screen off (VGA only)
X *---------------------------------------------------------------------------*/
Xstatic void vga_screen_off(void)
X{
X	unsigned char old;
X
X	outb(0x3c4, 0x00);		
X	outb(0x3c5, 0x01);		/* synchronous reset */
X
X	outb(0x3c4, 0x01);		/* clocking mode reg */
X	old = inb(0x3c5);		/* get current value */
X	
X	outb(0x3c4, 0x01);		/* clocking mode reg */
X	outb(0x3c5, (old | 0x20));	/* screen off bit on */
X
X	outb(0x3c4, 0x00);
X	outb(0x3c5, 0x03);		/* clear synchronous reset */
X}
X
X/*---------------------------------------------------------------------------*
X *	switch screen back on (VGA only)
X *---------------------------------------------------------------------------*/
Xstatic void vga_screen_on(void)
X{
X	unsigned char old;
X
X	outb(0x3c4, 0x00);		
X	outb(0x3c5, 0x01);		/* synchronous reset */
X
X	outb(0x3c4, 0x01);		/* clocking mode reg */
X	old = inb(0x3c5);		/* get current value */
X	
X	outb(0x3c4, 0x01);		/* clocking mode reg */
X	outb(0x3c5, (old & ~0x20));	/* screen off bit off */
X
X	outb(0x3c4, 0x00);
X	outb(0x3c5, 0x03);		/* clear synchronous reset */
X}
X
X#endif /* PALETTE_FLICKER */
X
X/*---------------------------------------------------------------------------*
X *	load a char into ega/vga character generator ram
X *---------------------------------------------------------------------------*/
Xvoid
Xloadchar(int fontset, int character, int char_scanlines, u_char *char_table)
X{
X	unsigned char *d = (unsigned char *)Crtat;
X	int j, k;
X
X	/* Character sets are at (+(0xA0000):
X	    0        1      2      3      4      5      6      7
X	   0x0000   0x4000 0x8000 0xC000 0x2000 0x6000 0xA000 0xE000
X	   
X	 */
X
X	static int charset_offset[8] = { 0x0000, 0x4000, 0x8000, 0xC000,
X					 0x2000, 0x6000, 0xA000, 0xE000 };
X
X	switch(adaptor_type)
X	{
X		case EGA_ADAPTOR:
X			fontset = (fontset > 3) ? 3 : fontset;
X			break;
X			
X		case VGA_ADAPTOR:
X			fontset = (fontset > 7) ? 7 : fontset;
X			break;
X			
X		default:
X			return;
X	}
X	
X	d -= (0xB8000 - 0xA0000);	/* Point to 0xA0000 */
X	d += charset_offset[fontset];	/* Load into Character set n */
X	d += (character * 32);		/* 32 bytes per character */
X
X	setchargen();			/* access chargen ram */
X
X	for(j = k = 0; j < char_scanlines; j++) /* x bit high characters */
X	{
X		*d = char_table[k];
X		d++;
X		k++;
X	}
X	for(; j < 32; j++)		/* Up to 32 bytes per character image */
X	{
X		*d = 0x00;
X		d++;
X	}
X
X	resetchargen();			/* access video ram */
X}
X
X/*---------------------------------------------------------------------------*
X *	switch to vga video page n (0 ... NSCREENS-1)
X *---------------------------------------------------------------------------*/
Xvoid vgapage(int n)
X{
X	u_short addr;
X
X        switch(adaptor_type)
X	{
X		case CGA_ADAPTOR:
X			addr = (n * 0x800);
X			break;
X
X		case EGA_ADAPTOR:
X		case VGA_ADAPTOR:
X			addr = (n * SCR_MAXROW * COL);
X			break;
X
X		case HGC_ADAPTOR:
X			addr = (n * 0x80)+0x0A;
X			break;
X
X		case MDA_ADAPTOR:
X		default:
X			return;
X			break;	/* ! NEVER REACHED ! */
X	}
X
X	if((n >= 0) && (n < totalscreens))
X	{
X		/* set new display start address */
X
X		switch(adaptor_type)
X		{
X			case CGA_ADAPTOR:
X			case EGA_ADAPTOR:
X			case VGA_ADAPTOR:
X				 /* start addr high */
X				outb(addr_6845,(unsigned char)0x0c);
X				outb(addr_6845+1,(unsigned char)(addr >> 8));
X		
X				 /* start addr low */
X				outb(addr_6845,(unsigned char)0x0d);
X				outb(addr_6845+1,(unsigned char)addr);
X				break;
X				
X			case HGC_ADAPTOR:
X				/* Supposed to work */			
X				outb(0x3B8,(unsigned char)addr);
X				break;
X
X			default:
X				return;
X		}
X
X		/* global pointers */
X
X 		current_video_screen = n;
X	
X		pcconsp = &pccons[n];
X	
X		vsp = &vs[n];
X
X	 	outb(addr_6845, M6845_CURSORH);	/* select high register */
X		outb(addr_6845+1, (vsp->crtat - Crtat) >> 8);
X		outb(addr_6845, M6845_CURSORL);	/* select low register */
X		outb(addr_6845+1, (vsp->crtat - Crtat));
X
X		select_vga_charset(vsp->vga_charset);
X
X		outb(addr_6845, M6845_CURSTART);	/* select high register */
X		outb(addr_6845+1, vsp->cursor_start);
X		outb(addr_6845, M6845_CUREND);		/* select low register */
X		outb(addr_6845+1, vsp->cursor_end);
X
X		if(adaptor_type == VGA_ADAPTOR) {
X			/* switch VGA DAC palette entries */
X			unsigned i;
X
X			for(i = 0; i < NVGAPEL; i++)
X				vgapaletteio(i, &vsp->palette[i], 1);
X		}
X
X		update_led();			/* update led's */
X	}
X}
X
X/*---------------------------------------------------------------------------*
X *	see if ega or vga
X *---------------------------------------------------------------------------*/
Xint egavga_test()
X{
X	unsigned char *d = (unsigned char *)Crtat;
X	unsigned char testzone[8];
X	static unsigned char teststring[] = "386BSD";
X	int i;
X	int returnvalue, samevalue;
X
X	d -= (0xB8000 - 0xA0000);     /* Point to 0xA0000 */
X	d += 0x4000;                  /* Scribble on character set 1 */
X
X	setchargen();	/* Set to read/write character sets */
X
X	for(i = 0; i < 6; ++i)
X		testzone[i] = d[i];
X
X	for(i = 0; i < 6; ++i)
X		d[i] = teststring[i];
X	
X	returnvalue = 1;
X
X	for(i = 0; i < 6; ++i)
X	{
X		if(d[i] != teststring[i])
X		{
X			returnvalue = 0;
X			break;
X		}
X	}
X	
X	if(returnvalue)
X	{
X		resetchargen();   /* Back to display memory */
X		samevalue = 1;
X
X		for(i = 0; i < 6; ++i)
X		{
X			if(d[i] != teststring[i])
X			{
X				samevalue = 0;
X				break;
X			}
X	    	}
X
X		setchargen();    /* Set to read/write character sets */
X		returnvalue = (samevalue) ? 0 : 1;
X	}
X
X	for(i = 0; i < 6; ++i)
X		d[i] = testzone[i];
X
X	resetchargen();
X	return returnvalue;
X}
X
X/*---------------------------------------------------------------------------*
X *	test if it is a vga
X *---------------------------------------------------------------------------*/
X
X#define CURSOR_ON_BIT 0x20		/* cursor on/off on vga */
X
Xint vga_test()
X{
X	u_char old, new, check;
X    
X	outb(addr_6845,M6845_CURSTART);	/* cursor start reg */
X	old = inb(addr_6845+1);		/* get current value */
X
X	new = old | CURSOR_ON_BIT;	/* set cursor on by setting bit 5 on */
X
X	DELAY(1);
X	
X	outb(addr_6845,M6845_CURSTART);	/* cursor start reg */
X	outb(addr_6845+1,new);		/* cursor should be on now */
X
X	DELAY(1);
X	
X	outb(addr_6845,M6845_CURSTART);	/* cursor start reg */
X	check = inb(addr_6845+1);	/* get current value */
X
X	if(check != new)
X	{
X		outb(addr_6845,M6845_CURSTART);	/* cursor start reg */
X		outb(addr_6845+1,old);		/* failsafe */
X		return(0);			/* must be ega */
X	}
X
X	new = old & ~CURSOR_ON_BIT;	/* set cursor off by setting bit 5 off */
X
X	outb(addr_6845,M6845_CURSTART);	/* cursor start reg */
X	outb(addr_6845+1,new);		/* cursor should be off now */
X
X	DELAY(1);
X	
X	outb(addr_6845,M6845_CURSTART);	/* cursor start reg */
X	check = inb(addr_6845+1);	/* get current value */
X
X	if(check != new)
X	{
X		outb(addr_6845,M6845_CURSTART);	/* cursor start reg */
X		outb(addr_6845+1,old);		/* failsafe */
X		return(0);			/* must be ega */
X	}
X
X	DELAY(1);
X	
X	outb(addr_6845,M6845_CURSTART);	/* cursor start reg */
X	outb(addr_6845+1,old);		/* failsafe */
X	
X        return(1);	/* vga */
X}
X
X/*---------------------------------------------------------------------------*
X *	convert upper/lower sixel font array to vga font array
X *---------------------------------------------------------------------------*/
Xvoid sixel_vga(struct sixels *sixelp, u_char *vgachar)
X{
X	register int i, j;
X	register int shift;
X	register u_char mask;
X	
X	for(j = 0; j < 16; j++)
X		vgachar[j] = 0;	
X
X	mask = 0x01;
X	for(j = 0; j < 6; j++)
X	{
X		for(i = 0, shift = 7; i < 8; i++, shift--)
X			vgachar[j] |= ((((sixelp->upper[i]) & mask) >> j) << shift);
X		mask <<= 1;
X	}
X
X	mask = 0x01;
X	for(j = 0; j < 4; j++)
X	{
X		for(i = 0, shift = 7; i < 8; i++, shift--)
X			vgachar[j+6] |= ((((sixelp->lower[i]) & mask) >>j) << shift);
X		mask <<= 1;
X	}
X}
X
X/*---------------------------------------------------------------------------*
X *	Expand 8x10 EGA/VGA characters to 8x16 EGA/VGA characters
X *---------------------------------------------------------------------------*/
Xvoid vga10_vga16(unsigned char *invga, unsigned char *outvga)
X{
X	register int i,j;
X
X	/*
X	 * Keep the top and bottom scanlines the same and double every scan
X	 * line in between.
X	 */
X	 
X	outvga[0] = invga[0];
X	outvga[1] = invga[1];
X	outvga[14] = invga[8];
X	outvga[15] = invga[9];
X
X	for(i = j = 2;i < 8 && j < 14;i++,j += 2)
X	{
X		outvga[j]   = invga[i];
X		outvga[j+1] = invga[i];
X	}
X}
X
X/*---------------------------------------------------------------------------*
X *	Expand 8x10 EGA/VGA characters to 8x14 EGA/VGA characters
X *---------------------------------------------------------------------------*/
Xvoid vga10_vga14(unsigned char *invga, unsigned char *outvga)
X{
X	register int i;
X
X	/*
X	 * Double the top two and bottom two scanlines and copy everything
X	 * in between.
X	 */
X	 
X	outvga[0] = invga[0];
X	outvga[1] = invga[0];
X	outvga[2] = invga[1];
X	outvga[3] = invga[1];
X	outvga[10] = invga[8];
X	outvga[11] = invga[8];
X	outvga[12] = invga[9];
X	outvga[13] = invga[9];
X
X	for(i = 2;i < 8;i++)
X		outvga[i+2]   = invga[i];
X}
X
X/*---------------------------------------------------------------------------*
X *	Expand 8x10 EGA/VGA characters to 8x10 EGA/VGA characters
X *---------------------------------------------------------------------------*/
Xvoid vga10_vga10(unsigned char *invga, unsigned char *outvga)
X{
X	register int i;
X
X	for(i = 0;i < 10;i++)
X		outvga[i]   = invga[i];
X}
X
X/*---------------------------------------------------------------------------*
X *	Contract 8x10 EGA/VGA characters to 8x8 EGA/VGA characters
X *---------------------------------------------------------------------------*/
Xvoid vga10_vga8(unsigned char *invga, unsigned char *outvga)
X{
X	/* Skip scanlines 3 and 7 */
X
X	outvga[0] = invga[0];
X	outvga[1] = invga[1];
X	outvga[2] = invga[2];
X	outvga[3] = invga[4];
X	outvga[4] = invga[5];
X	outvga[5] = invga[6];
X	outvga[6] = invga[8];
X	outvga[7] = invga[9];
X}
X
X/*---------------------------------------------------------------------------*
X *	force a vga card to behave like an ega for debugging
X *---------------------------------------------------------------------------*/
X#ifdef FORCE_EGA
Xforce_ega()
X{
X	unsigned char vgareg;
X
X	if(adaptor_type == VGA_ADAPTOR)
X	{
X		adaptor_type = EGA_ADAPTOR;
X		totalfonts = 4;
X		vgareg = inb(0x3CC);	/* Miscellaneous Output Register */
X		vgareg |= 128;		/* Set 350 scanline mode */
X		vgareg &= ~64;
X		outb(0x3C2,vgareg);
X	}
X}
X#endif /* FORCE_EGA */
X
X/*---------------------------------------------------------------------------*
X *	disconnect attribute bit 3 from generating intensity
X *	(and use it for a second character set !)
X *---------------------------------------------------------------------------*/
Xvoid set_2ndcharset()
X{
X	if(color)			/* prepare to access index register ! */
X		inb(0x3da);
X	else
X		inb(0x3ba);
X
X	outb(0x3c0, (0x12|0x20));	/* select color plane enable reg */
X					/* caution: set ATC access bit ! */
X	outb(0x3c0, 0x07);		/* disable plane 3 */
X}
X
X#ifdef PCVT_SCREENSAVER
X#ifdef HAS_PRETTY_SCREENSAVER
Xstatic u_short
Xgetrand(void)
X{
X	/* some kinda random number */
X	/* had a look into the system library... */
X	extern struct timeval time; /* time-of-day register */
X	static unsigned long seed = 1;
X	register u_short res = (u_short)seed;
X	seed = seed * 1103515245L + time.tv_sec;
X	return res;
X}
X
Xstatic void
Xscrnsv_blink(void)
X{
X	static struct rgb blink_rgb[8] =
X	{
X		{63, 63, 63},	/* white */
X		{0, 63, 42},	/* pale green */
X		{63, 63, 0},	/* yellow */
X		{63, 21, 63},	/* violet */
X		{42, 63, 0},	/* yellow-green */
X		{63, 42, 0},	/* amber */
X		{63, 42, 42},	/* rose */
X		{21, 42, 42}	/* cyan */
X	};
X	register u_short r = getrand();
X	unsigned pos = (r % (scrnsv_size / 2));
X
X	*scrnsv_current = /* (0 << 8) + */ ' ';
X	scrnsv_current = vsp->Crtat + pos;
X	*scrnsv_current = (7 /* LIGHTGRAY */ << 8) + '*';
X	if(adaptor_type == VGA_ADAPTOR)
X		vgapaletteio(7 /* LIGHTGRAY */, &blink_rgb[(r >> 4) & 7], 1);
X	timeout((caddr_t)scrnsv_blink, 0, hz);
X}
X
X#endif /* defined HAS_PRETTY_SCREENSAVER */
X	
X
Xstatic void
Xpcvt_set_scrnsv_tmo(int timeout)
X{
X	pcvt_scrnsv_reset();		/* sanity */
X	scrnsv_timeout = timeout;
X	if(timeout == 0 && savedscreen)
X	{
X		/* release buffer when screen saver turned off */
X		free(savedscreen, M_TEMP);
X		savedscreen = (u_short *)0;
X	}
X}
X
Xstatic void
Xscrnsv_timedout(void)
X{
X	/* this function is called by timeout() */
X
X	/*
X	 * due to some undefined problems with video adaptor RAM
X	 * access timing, the following has been splitted into
X	 * two pieces called subsequently with a time difference
X	 * of 100 millisec
X	 */
X
X	if(++scrnsv_active == 1)
X	{
X		register size_t s;
X		/*
X		 * first, allocate a buffer
X		 * do only if none allocated yet or another size required
X		 * this reduces malloc() overhead by avoiding successive
X		 * calls to malloc() and free() if they would have requested
X		 * the same buffer
X		 */
X		s = sizeof(u_short) * vsp->screen_rowsize *
X		    /* XXX vsp->screen_colsize; */ 80;
X		if(savedscreen == (u_short *)0 || s != scrnsv_size)
X		{
X			/* really need to allocate */
X			if(savedscreen)
X				free(savedscreen, M_TEMP);
X			scrnsv_size = s;
X			if((savedscreen =
X			    (u_short *)malloc(s, M_TEMP, M_NOWAIT))
X			   == (u_short *)0)
X			{
X				/*
X				 * didn't get the buffer memory,
X				 * turn off screen saver
X				 */
X				scrnsv_timeout = scrnsv_active = 0;
X				return;
X			}
X		}
X		/* save current screen */
X		bcopy(vsp->Crtat, savedscreen, scrnsv_size);
X
X		/* on VGA's, make sure palette is set to blank screen */
X		if(adaptor_type == VGA_ADAPTOR)
X		{
X			struct rgb black = {0, 0, 0};
X			vgapaletteio(0 /* BLACK */, &black, 1);
X		}
X		/* prepare for next time... */
X		timeout((caddr_t)scrnsv_timedout /* me! */, 0, hz / 10);
X	}
X	else
X	{
X		/* second call, now blank the screen */
X		/* fill screen with blanks */
X		fillw(/* (BLACK<<8) + */ ' ', vsp->Crtat, scrnsv_size / 2);
X#ifdef HAS_PRETTY_SCREENSAVER
X		scrnsv_current = vsp->Crtat;
X		timeout((caddr_t)scrnsv_blink, 0, hz);
X#endif
X	}
X}
X
X/* INTERFACE */
Xvoid
Xpcvt_scrnsv_reset(void)
X{
X	register int x;
X
X	/*
X	 * don't bother: untimeout will not complain if there's actually
X	 * no timeout set for this function
X	 */
X
X	untimeout((caddr_t)scrnsv_timedout, 0);
X
X#ifdef HAS_PRETTY_SCREENSAVER
X	untimeout((caddr_t)scrnsv_blink, 0);
X#endif
X
X	if(scrnsv_active)
X	{
X		x = splhigh();
X		bcopy(savedscreen, vsp->Crtat, scrnsv_size);
X		if(adaptor_type == VGA_ADAPTOR)
X		{
X			/* back up VGA palette info */
X			vgapaletteio(0 /* BLACK */, &vsp->palette[0], 1);
X
X#ifdef HAS_PRETTY_SCREENSAVER
X			vgapaletteio(7 /* LIGHTGRAY */, &vsp->palette[7], 1);
X#endif
X		}
X		scrnsv_active = 0;
X		splx(x);
X	}
X	if(scrnsv_timeout)
X	{
X		/* mark next timeout */
X		timeout((caddr_t)scrnsv_timedout, 0, scrnsv_timeout * hz);
X	}
X}
X	
X#endif /* defined PCVT_SCREENSAVER */
X
X
X/* ------------------------- E O F ------------------------------------------*/
SHAR_EOF
$TOUCH -am 0114130693 pcvt_sup.c &&
chmod 0660 pcvt_sup.c ||
echo "restore of pcvt_sup.c failed"
set `wc -c pcvt_sup.c`;Wc_c=$1
if test "$Wc_c" != "40075"; then
	echo original size 40075, current size $Wc_c
fi
fi
# ============= pcvt_tbl.h ==============
if test X"$1" != X"-c" -a -f 'pcvt_tbl.h'; then
	echo "File already exists: skipping 'pcvt_tbl.h'"
else
echo "x - extracting pcvt_tbl.h (Text)"
sed 's/^X//' << 'SHAR_EOF' > pcvt_tbl.h &&
X/*
X * Copyright (c) 1992, 1993 Hellmuth Michaelis
X *
X * All rights reserved.
X *
X * This driver is contributed to the 386BSD operating system.
X *
X * Redistribution and use in source and binary forms, with or without
X * modification, are permitted provided that the following conditions
X * are met:
X * 1. Redistributions of source code must retain the above copyright
X *    notice, this list of conditions and the following disclaimer.
X * 2. Redistributions in binary form must reproduce the above copyright
X *    notice, this list of conditions and the following disclaimer in the
X *    documentation and/or other materials provided with the distribution.
X * 3. All advertising materials mentioning features or use of this software
X *    must display the following acknowledgement:
X *	This product includes software contributed to 386BSD and developed
X *      by Hellmuth Michaelis
X * 4. Neither the name of the developers nor the names "386BSD" and "pcvt"
X *    may be used to endorse or promote products derived from this software
X *    without specific prior written permission.
X *
X * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
X * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
X * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
X * IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
X * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
X * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
X * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
X * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
X * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
X * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
X */
X
X/*
X *	@(#)pcvt_tbl.h		2.00		   (contributed to 386BSD)
X *				Last Edit-Date: [Sun Jan  3 15:04:28 1993]
X */
X
X/*---------------------------------------------------------------------------*
X *
X *	pcvt_tbl.h	VT220 Driver Character Set Conversion Tables
X *	------------------------------------------------------------
X *
X *	written by Hellmuth Michaelis, hm@hcshh.hcs.de
X *
X *	-hm	splitting off pccons_out.c
X *	-hm	default tables for pure mda/hcg/cga
X *
X *	in pcvt_out.c, hooks are provided for the following charactersets:
X *
X *		HAVECS_BRITISH
X *		HAVECS_ASCII
X *		HAVECS_FINNISH
X *		HAVECS_NORWEGIANDANISH
X *		HAVECS_SWEDISH
X *		HAVECS_GERMAN
X *		HAVECS_FRENCHCANADA
X *		HAVECS_FRENCH
X *		HAVECS_ITALIAN
X *		HAVECS_SPANISH
X *		HAVECS_SPECIAL
X *		HAVECS_ALTERNATEROM1
X *		HAVECS_ALTERNATEROM2
X *		HAVECS_ROMAN8
X *		HAVECS_DUTCH
X *		HAVECS_SUPPLEMENTAL
X *		HAVECS_SWISS
X *		HAVECS_TECHNICAL
X *		HAVECS_ISOLATIN
X *
X *	to add support for a new charcterset, you have to provide the
X *	table named "cs_<charset>",define the according "HAVECS_<CHARSET>"
X *	and recompile everything. ref: pcvt_out.c, vt_designate()
X *
X *---------------------------------------------------------------------------*/
X
X/*===========================================================================*
X *	DEFAULT TABLES FOR MDA/HCG/CGA
X *===========================================================================*/
X 
X/*---------------------------------------------------------------------------*
X *	ASCII Characterset
X *---------------------------------------------------------------------------*/
X#define HAVECSD_ASCII
Xu_short csd_ascii[CSSIZE] = {
X/* 20 */	0x20 | CSL, 0x21 | CSL, 0x22 | CSL, 0x23 | CSL,
X/* 24 */	0x24 | CSL, 0x25 | CSL, 0x26 | CSL, 0x27 | CSL,
X/* 28 */	0x28 | CSL, 0x29 | CSL, 0x2A | CSL, 0x2B | CSL,
X/* 2C */	0x2C | CSL, 0x2D | CSL, 0x2E | CSL, 0x2F | CSL,
X
X/* 30 */	0x30 | CSL, 0x31 | CSL, 0x32 | CSL, 0x33 | CSL,
X/* 34 */	0x34 | CSL, 0x35 | CSL, 0x36 | CSL, 0x37 | CSL,
X/* 38 */	0x38 | CSL, 0x39 | CSL, 0x3A | CSL, 0x3B | CSL,
X/* 3C */	0x3C | CSL, 0x3D | CSL, 0x3E | CSL, 0x3F | CSL,
X
X/* 40 */	0x40 | CSL, 0x41 | CSL, 0x42 | CSL, 0x43 | CSL,
X/* 44 */	0x44 | CSL, 0x45 | CSL, 0x46 | CSL, 0x47 | CSL,
X/* 48 */	0x48 | CSL, 0x49 | CSL, 0x4A | CSL, 0x4B | CSL,
X/* 4C */	0x4C | CSL, 0x4D | CSL, 0x4E | CSL, 0x4F | CSL,
X
X/* 50 */	0x50 | CSL, 0x51 | CSL, 0x52 | CSL, 0x53 | CSL,
X/* 54 */	0x54 | CSL, 0x55 | CSL, 0x56 | CSL, 0x57 | CSL,
X/* 58 */	0x58 | CSL, 0x59 | CSL, 0x5A | CSL, 0x5B | CSL,
X/* 5C */	0x5C | CSL, 0x5D | CSL, 0x5E | CSL, 0x5F | CSL,
X
X/* 60 */	0x60 | CSL, 0x61 | CSL, 0x62 | CSL, 0x63 | CSL,
X/* 64 */	0x64 | CSL, 0x65 | CSL, 0x66 | CSL, 0x67 | CSL,
X/* 68 */	0x68 | CSL, 0x69 | CSL, 0x6A | CSL, 0x6B | CSL,
X/* 6C */	0x6C | CSL, 0x6D | CSL, 0x6E | CSL, 0x6F | CSL,
X
X/* 70 */	0x70 | CSL, 0x71 | CSL, 0x72 | CSL, 0x73 | CSL,
X/* 74 */	0x74 | CSL, 0x75 | CSL, 0x76 | CSL, 0x77 | CSL,
X/* 78 */	0x78 | CSL, 0x79 | CSL, 0x7A | CSL, 0x7B | CSL,
X/* 7C */	0x7C | CSL, 0x7D | CSL, 0x7E | CSL, 0x7F | CSL,
X};
X
X/*---------------------------------------------------------------------------*
X *	DEC Supplemental Graphic Characterset
X *---------------------------------------------------------------------------*/
X#define HAVECSD_SUPPLEMENTAL
Xu_short csd_supplemental[CSSIZE] = {
X/* 20 */	0x20 | CSL, 0xAD | CSL, 0x9B | CSL, 0x9C | CSL,
X/* 24 */	0x20 | CSL, 0x9D | CSL, 0x20 | CSL, 0x20 | CSL,
X/* 28 */	0x20 | CSL, 0x20 | CSL, 0xA6 | CSL, 0xAE | CSL,
X/* 2C */	0x20 | CSL, 0x20 | CSL, 0x20 | CSL, 0x20 | CSL,
X
X/* 30 */	0xF8 | CSL, 0xF1 | CSL, 0xFD | CSL, 0x20 | CSL,
X/* 34 */	0x20 | CSL, 0xE6 | CSL, 0x20 | CSL, 0x20 | CSL,
X/* 38 */	0x20 | CSL, 0x20 | CSL, 0xA7 | CSL, 0xAF | CSL,
X/* 3C */	0xAC | CSL, 0xAB | CSL, 0x20 | CSL, 0xA8 | CSL,
X
X/* 40 */	0x20 | CSL, 0x20 | CSL, 0x20 | CSL, 0x20 | CSL,
X/* 44 */	0x8E | CSL, 0x8F | CSL, 0x92 | CSL, 0x80 | CSL,
X/* 48 */	0x20 | CSL, 0x90 | CSL, 0x20 | CSL, 0x20 | CSL,
X/* 4C */	0x8D | CSL, 0xA1 | CSL, 0x8C | CSL, 0x8B | CSL,
X
X/* 50 */	0x20 | CSL, 0xA5 | CSL, 0x20 | CSL, 0x20 | CSL,
X/* 54 */	0x20 | CSL, 0x20 | CSL, 0x99 | CSL, 0x20 | CSL,
X/* 58 */	0x20 | CSL, 0x20 | CSL, 0x20 | CSL, 0x20 | CSL,
X/* 5C */	0x9A | CSL, 0x20 | CSL, 0x20 | CSL, 0xE1 | CSL,
X
X/* 60 */	0x85 | CSL, 0xA0 | CSL, 0x83 | CSL, 0x20 | CSL,
X/* 64 */	0x84 | CSL, 0x86 | CSL, 0x91 | CSL, 0x87 | CSL,
X/* 68 */	0x8A | CSL, 0x82 | CSL, 0x88 | CSL, 0x89 | CSL,
X/* 6C */	0x8D | CSL, 0xA1 | CSL, 0x8C | CSL, 0x8B | CSL,
X
X/* 70 */	0x20 | CSL, 0xA4 | CSL, 0x95 | CSL, 0xA2 | CSL,
X/* 74 */	0x93 | CSL, 0x20 | CSL, 0x94 | CSL, 0x20 | CSL,
X/* 78 */	0x20 | CSL, 0x97 | CSL, 0xA3 | CSL, 0x96 | CSL,
X/* 7C */	0x81 | CSL, 0x98 | CSL, 0x20 | CSL, 0x20 | CSL
X};
X
X/*---------------------------------------------------------------------------*
X *	DEC Special Graphic Characterset
X *---------------------------------------------------------------------------*/
X#define HAVECSD_SPECIAL
Xu_short csd_special[CSSIZE] = {
X/* 20 */	0x20 | CSL, 0x21 | CSL, 0x22 | CSL, 0x23 | CSL,
X/* 24 */	0x24 | CSL, 0x25 | CSL, 0x26 | CSL, 0x27 | CSL,
X/* 28 */	0x28 | CSL, 0x29 | CSL, 0x2A | CSL, 0x2B | CSL,
X/* 2C */	0x2C | CSL, 0x2D | CSL, 0x2E | CSL, 0x2F | CSL,
X
X/* 30 */	0x30 | CSL, 0x31 | CSL, 0x32 | CSL, 0x33 | CSL,
X/* 34 */	0x34 | CSL, 0x35 | CSL, 0x36 | CSL, 0x37 | CSL,
X/* 38 */	0x38 | CSL, 0x39 | CSL, 0x3A | CSL, 0x3B | CSL,
X/* 3C */	0x3C | CSL, 0x3D | CSL, 0x3E | CSL, 0x3F | CSL,
X
X/* 40 */	0x40 | CSL, 0x41 | CSL, 0x42 | CSL, 0x43 | CSL,
X/* 44 */	0x44 | CSL, 0x45 | CSL, 0x46 | CSL, 0x47 | CSL,
X/* 48 */	0x48 | CSL, 0x49 | CSL, 0x4A | CSL, 0x4B | CSL,
X/* 4C */	0x4C | CSL, 0x4D | CSL, 0x4E | CSL, 0x4F | CSL,
X
X/* 50 */	0x50 | CSL, 0x51 | CSL, 0x52 | CSL, 0x53 | CSL,
X/* 54 */	0x54 | CSL, 0x55 | CSL, 0x56 | CSL, 0x57 | CSL,
X/* 58 */	0x58 | CSL, 0x59 | CSL, 0x5A | CSL, 0x5B | CSL,
X/* 5C */	0x5C | CSL, 0x5D | CSL, 0x5E | CSL, 0x20 | CSL,
X
X/* 60 */	0x20 | CSL, 0xB0 | CSL, 0x20 | CSL, 0x20 | CSL,
X/* 64 */	0x20 | CSL, 0x20 | CSL, 0xF8 | CSL, 0xF1 | CSL,
X/* 68 */	0x20 | CSL, 0x20 | CSL, 0xD9 | CSL, 0xBF | CSL,
X/* 6C */	0xDA | CSL, 0xC0 | CSL, 0xC5 | CSL, 0x20 | CSL,
X
X/* 70 */	0x20 | CSL, 0xC4 | CSL, 0x20 | CSL, 0x20 | CSL,
X/* 74 */	0xC3 | CSL, 0xB4 | CSL, 0xC1 | CSL, 0xC2 | CSL,
X/* 78 */	0xB3 | CSL, 0xF3 | CSL, 0xF2 | CSL, 0xE3 | CSL,
X/* 7C */	0x20 | CSL, 0x9C | CSL, 0x20 | CSL, 0x20 | CSL
X};
X
X/*---------------------------------------------------------------------------*
X *	DEC Technical Characterset
X *---------------------------------------------------------------------------*/
X#define HAVECSD_TECHNICAL
Xu_short csd_technical[CSSIZE] = {
X/* 20 */	0xFE | CSH, 0xFB | CSL, 0xDA | CSL, 0xC4 | CSL,
X/* 24 */	0xF4 | CSL, 0xF5 | CSL, 0xB3 | CSL, 0xDA | CSL,
X/* 28 */	0xC0 | CSL, 0xBF | CSL, 0xD9 | CSL, 0x20 | CSL,
X/* 2C */	0x20 | CSL, 0x20 | CSL, 0x20 | CSL, 0x20 | CSL,
X
X/* 30 */	0x20 | CSL, 0x20 | CSL, 0x20 | CSL, 0x20 | CSL,
X/* 34 */	0x20 | CSL, 0xAA | CSL, 0xA9 | CSL, 0x3E | CSL,
X/* 38 */	0x20 | CSL, 0x20 | CSL, 0x20 | CSL, 0x20 | CSL,
X/* 3C */	0xF3 | CSL, 0x20 | CSL, 0xF2 | CSL, 0x20 | CSL,
X
X/* 40 */	0x20 | CSL, 0x20 | CSL, 0xEC | CSL, 0xF6 | CSL,
X/* 44 */	0x20 | CSL, 0x20 | CSL, 0xE8 | CSL, 0xE2 | CSL,
X/* 48 */	0x20 | CSL, 0xF7 | CSL, 0xE9 | CSL, 0x78 | CSL,
X/* 4C */	0x20 | CSL, 0x20 | CSL, 0x20 | CSL, 0xF0 | CSL,
X
X/* 50 */	0x20 | CSL, 0x20 | CSL, 0x20 | CSL, 0xE4 | CSL,
X/* 54 */	0x20 | CSL, 0x20 | CSL, 0xFB | CSL, 0xEA | CSL,
X/* 58 */	0x20 | CSL, 0x20 | CSL, 0x20 | CSL, 0x20 | CSL,
X/* 5C */	0xEF | CSL, 0x20 | CSL, 0x20 | CSL, 0x20 | CSL,
X
X/* 60 */	0xAA | CSL, 0xE0 | CSL, 0xE1 | CSL, 0x20 | CSL,
X/* 64 */	0xEB | CSL, 0x20 | CSL, 0xED | CSL, 0x59 | CSL,
X/* 68 */	0x20 | CSL, 0x20 | CSL, 0xE9 | CSL, 0x20 | CSL,
X/* 6C */	0x20 | CSL, 0x20 | CSL, 0x20 | CSL, 0x20 | CSL,
X
X/* 70 */	0xE3 | CSL, 0x20 | CSL, 0x20 | CSL, 0xE5 | CSL,
X/* 74 */	0xE7 | CSL, 0x20 | CSL, 0x9F | CSL, 0x20 | CSL,
X/* 78 */	0x20 | CSL, 0x20 | CSL, 0x20 | CSL, 0x20 | CSL,
X/* 7C */	0x20 | CSL, 0x20 | CSL, 0x20 | CSL, 0x20 | CSL
X};
X
X/*---------------------------------------------------------------------------*
X *	ISO Latin-1 Characterset
X *---------------------------------------------------------------------------*/
X#define HAVECSD_ISOLATIN
Xu_short csd_isolatin[CSSIZE] = {
X/* 20 */	0x20 | CSL, 0xAD | CSL, 0x9B | CSL, 0x9C | CSL,
X/* 24 */	0x20 | CSL, 0x9D | CSL, 0x7C | CSL, 0x20 | CSL,
X/* 28 */	0x22 | CSL, 0x20 | CSL, 0xA6 | CSL, 0xAE | CSL,
X/* 2C */	0xAA | CSL, 0x2D | CSL, 0x20 | CSL, 0x2D | CSL,
X
X/* 30 */	0xF8 | CSL, 0xF1 | CSL, 0xFD | CSL, 0x20 | CSL,
X/* 34 */	0x27 | CSL, 0xE6 | CSL, 0x20 | CSL, 0x20 | CSL,
X/* 38 */	0x20 | CSL, 0x20 | CSL, 0xA7 | CSL, 0xAF | CSL,
X/* 3C */	0xAC | CSL, 0xAB | CSL, 0x20 | CSL, 0xA8 | CSL,
X
X/* 40 */	0x20 | CSL, 0x20 | CSL, 0x20 | CSL, 0x20 | CSL,
X/* 44 */	0x8E | CSL, 0x8F | CSL, 0x92 | CSL, 0x80 | CSL,
X/* 48 */	0x20 | CSL, 0x90 | CSL, 0x20 | CSL, 0x20 | CSL,
X/* 4C */	0x8D | CSL, 0xA1 | CSL, 0x8C | CSL, 0x8B | CSL,
X
X/* 50 */	0x20 | CSL, 0xA5 | CSL, 0x20 | CSL, 0x20 | CSL,
X/* 54 */	0x20 | CSL, 0x20 | CSL, 0x99 | CSL, 0x78 | CSL,
X/* 58 */	0x20 | CSL, 0x20 | CSL, 0x20 | CSL, 0x20 | CSL,
X/* 5C */	0x9A | CSL, 0x20 | CSL, 0x20 | CSL, 0xE1 | CSL,
X
X/* 60 */	0x85 | CSL, 0xA0 | CSL, 0x83 | CSL, 0x20 | CSL,
X/* 64 */	0x84 | CSL, 0x86 | CSL, 0x91 | CSL, 0x87 | CSL,
X/* 68 */	0x8A | CSL, 0x82 | CSL, 0x88 | CSL, 0x89 | CSL,
X/* 6C */	0x8D | CSL, 0xA1 | CSL, 0x8C | CSL, 0x8B | CSL,
X
X/* 70 */	0x20 | CSL, 0xA4 | CSL, 0x95 | CSL, 0xA2 | CSL,
X/* 74 */	0x93 | CSL, 0x20 | CSL, 0x94 | CSL, 0xF6 | CSL,
X/* 78 */	0x20 | CSL, 0x97 | CSL, 0xA3 | CSL, 0x96 | CSL,
X/* 7C */	0x81 | CSL, 0x20 | CSL, 0x20 | CSL, 0x98 | CSL
X};
X
X/*===========================================================================*
X *	EXTENDED TABLES FOR EGA/VGA
X *===========================================================================*/
X
X/*---------------------------------------------------------------------------*
X *	ASCII Characterset
X *---------------------------------------------------------------------------*/
X#define HAVECSE_ASCII
Xu_short cse_ascii[CSSIZE] = {
X/* 20 */	0x20 | CSL, 0x21 | CSL, 0x22 | CSL, 0x23 | CSL,
X/* 24 */	0x24 | CSL, 0x25 | CSL, 0x26 | CSL, 0x27 | CSL,
X/* 28 */	0x28 | CSL, 0x29 | CSL, 0x2A | CSL, 0x2B | CSL,
X/* 2C */	0x2C | CSL, 0x2D | CSL, 0x2E | CSL, 0x2F | CSL,
X
X/* 30 */	0x30 | CSL, 0x31 | CSL, 0x32 | CSL, 0x33 | CSL,
X/* 34 */	0x34 | CSL, 0x35 | CSL, 0x36 | CSL, 0x37 | CSL,
X/* 38 */	0x38 | CSL, 0x39 | CSL, 0x3A | CSL, 0x3B | CSL,
X/* 3C */	0x3C | CSL, 0x3D | CSL, 0x3E | CSL, 0x3F | CSL,
X
X/* 40 */	0x40 | CSL, 0x41 | CSL, 0x42 | CSL, 0x43 | CSL,
X/* 44 */	0x44 | CSL, 0x45 | CSL, 0x46 | CSL, 0x47 | CSL,
X/* 48 */	0x48 | CSL, 0x49 | CSL, 0x4A | CSL, 0x4B | CSL,
X/* 4C */	0x4C | CSL, 0x4D | CSL, 0x4E | CSL, 0x4F | CSL,
X
X/* 50 */	0x50 | CSL, 0x51 | CSL, 0x52 | CSL, 0x53 | CSL,
X/* 54 */	0x54 | CSL, 0x55 | CSL, 0x56 | CSL, 0x57 | CSL,
X/* 58 */	0x58 | CSL, 0x59 | CSL, 0x5A | CSL, 0x5B | CSL,
X/* 5C */	0x5C | CSL, 0x5D | CSL, 0x5E | CSL, 0x5F | CSL,
X
X/* 60 */	0x60 | CSL, 0x61 | CSL, 0x62 | CSL, 0x63 | CSL,
X/* 64 */	0x64 | CSL, 0x65 | CSL, 0x66 | CSL, 0x67 | CSL,
X/* 68 */	0x68 | CSL, 0x69 | CSL, 0x6A | CSL, 0x6B | CSL,
X/* 6C */	0x6C | CSL, 0x6D | CSL, 0x6E | CSL, 0x6F | CSL,
X
X/* 70 */	0x70 | CSL, 0x71 | CSL, 0x72 | CSL, 0x73 | CSL,
X/* 74 */	0x74 | CSL, 0x75 | CSL, 0x76 | CSL, 0x77 | CSL,
X/* 78 */	0x78 | CSL, 0x79 | CSL, 0x7A | CSL, 0x7B | CSL,
X/* 7C */	0x7C | CSL, 0x7D | CSL, 0x7E | CSL, 0xB0 | CSL,
X};
X
X/*---------------------------------------------------------------------------*
X *	DEC Supplemental Graphic Characterset
X *---------------------------------------------------------------------------*/
X#define HAVECSE_SUPPLEMENTAL
Xu_short cse_supplemental[CSSIZE] = {
X/* 20 */	0x20 | CSL, 0xAD | CSL, 0x9B | CSL, 0x9C | CSL,
X/* 24 */	0x9F | CSH, 0x67 | CSH, 0x9F | CSH, 0x15 | CSL,
X/* 28 */	0x9D | CSH, 0x9C | CSH, 0xA6 | CSL, 0xAE | CSL,
X/* 2C */	0x9F | CSH, 0x9F | CSH, 0x9F | CSH, 0x9F | CSH,
X
X/* 30 */	0xF8 | CSL, 0xF1 | CSL, 0xFD | CSL, 0x9B | CSH,
X/* 34 */	0x9F | CSH, 0xE6 | CSL, 0x14 | CSL, 0x99 | CSH,
X/* 38 */	0x9F | CSH, 0x98 | CSH, 0xA7 | CSL, 0xAF | CSL,
X/* 3C */	0xAC | CSL, 0xAB | CSL, 0x9F | CSH, 0xA8 | CSL,
X
X/* 40 */	0x97 | CSH, 0x96 | CSH, 0x95 | CSH, 0x94 | CSH,
X/* 44 */	0x8E | CSL, 0x8F | CSL, 0x92 | CSL, 0x80 | CSL,
X/* 48 */	0x93 | CSH, 0x90 | CSL, 0x92 | CSH, 0x91 | CSH,
X/* 4C */	0x90 | CSH, 0x8F | CSH, 0x8E | CSH, 0x8D | CSH,
X
X/* 50 */	0x9F | CSH, 0xA5 | CSL, 0x8C | CSH, 0x8B | CSH,
X/* 54 */	0x8A | CSH, 0x89 | CSH, 0x99 | CSL, 0x88 | CSH,
X/* 58 */	0x87 | CSH, 0x86 | CSH, 0x85 | CSH, 0x84 | CSH,
X/* 5C */	0x9A | CSL, 0x83 | CSH, 0x9F | CSH, 0xE1 | CSL,
X
X/* 60 */	0x85 | CSL, 0xA0 | CSL, 0x83 | CSL, 0x82 | CSH,
X/* 64 */	0x84 | CSL, 0x86 | CSL, 0x91 | CSL, 0x87 | CSL,
X/* 68 */	0x8A | CSL, 0x82 | CSL, 0x88 | CSL, 0x89 | CSL,
X/* 6C */	0x8D | CSL, 0xA1 | CSL, 0x8C | CSL, 0x8B | CSL,
X
X/* 70 */	0x9F | CSH, 0xA4 | CSL, 0x95 | CSL, 0xA2 | CSL,
X/* 74 */	0x93 | CSL, 0x81 | CSH, 0x94 | CSL, 0x80 | CSH,
X/* 78 */	0x7F | CSH, 0x97 | CSL, 0xA3 | CSL, 0x96 | CSL,
X/* 7C */	0x81 | CSL, 0x98 | CSL, 0x9F | CSH, 0x20 | CSL
X};
X
X/*---------------------------------------------------------------------------*
X *	DEC Special Graphic Characterset
X *---------------------------------------------------------------------------*/
X#define HAVECSE_SPECIAL
Xu_short cse_special[CSSIZE] = {
X/* 20 */	0x20 | CSL, 0x21 | CSL, 0x22 | CSL, 0x23 | CSL,
X/* 24 */	0x24 | CSL, 0x25 | CSL, 0x26 | CSL, 0x27 | CSL,
X/* 28 */	0x28 | CSL, 0x29 | CSL, 0x2A | CSL, 0x2B | CSL,
X/* 2C */	0x2C | CSL, 0x2D | CSL, 0x2E | CSL, 0x2F | CSL,
X
X/* 30 */	0x30 | CSL, 0x31 | CSL, 0x32 | CSL, 0x33 | CSL,
X/* 34 */	0x34 | CSL, 0x35 | CSL, 0x36 | CSL, 0x37 | CSL,
X/* 38 */	0x38 | CSL, 0x39 | CSL, 0x3A | CSL, 0x3B | CSL,
X/* 3C */	0x3C | CSL, 0x3D | CSL, 0x3E | CSL, 0x3F | CSL,
X
X/* 40 */	0x40 | CSL, 0x41 | CSL, 0x42 | CSL, 0x43 | CSL,
X/* 44 */	0x44 | CSL, 0x45 | CSL, 0x46 | CSL, 0x47 | CSL,
X/* 48 */	0x48 | CSL, 0x49 | CSL, 0x4A | CSL, 0x4B | CSL,
X/* 4C */	0x4C | CSL, 0x4D | CSL, 0x4E | CSL, 0x4F | CSL,
X
X/* 50 */	0x50 | CSL, 0x51 | CSL, 0x52 | CSL, 0x53 | CSL,
X/* 54 */	0x54 | CSL, 0x55 | CSL, 0x56 | CSL, 0x57 | CSL,
X/* 58 */	0x58 | CSL, 0x59 | CSL, 0x5A | CSL, 0x5B | CSL,
X/* 5C */	0x5C | CSL, 0x5D | CSL, 0x5E | CSL, 0x20 | CSL,
X
X/* 60 */	0x04 | CSL, 0xB0 | CSL, 0x09 | CSH, 0x0C | CSH,
X/* 64 */	0x0D | CSH, 0x0A | CSH, 0xF8 | CSL, 0xF1 | CSL,
X/* 68 */	0x00 | CSH, 0x0B | CSH, 0xD9 | CSL, 0xBF | CSL,
X/* 6C */	0xDA | CSL, 0xC0 | CSL, 0xC5 | CSL, 0x7D | CSH,
X
X/* 70 */	0x7C | CSH, 0x7B | CSH, 0x7A | CSH, 0x79 | CSH,
X/* 74 */	0xC3 | CSL, 0xB4 | CSL, 0xC1 | CSL, 0xC2 | CSL,
X/* 78 */	0xB3 | CSL, 0xF3 | CSL, 0xF2 | CSL, 0xE3 | CSL,
X/* 7C */	0x78 | CSH, 0x9C | CSL, 0x99 | CSH, 0x20 | CSL
X};
X
X/*---------------------------------------------------------------------------*
X *	DEC Technical Characterset
X *---------------------------------------------------------------------------*/
X#define HAVECSE_TECHNICAL
Xu_short cse_technical[CSSIZE] = {
X/* 20 */	0x20 | CSL, 0x65 | CSH, 0xDA | CSL, 0xC4 | CSL,
X/* 24 */	0xF4 | CSL, 0xF5 | CSL, 0xB3 | CSL, 0xDA | CSL,
X/* 28 */	0xC0 | CSL, 0xBF | CSL, 0xD9 | CSL, 0x61 | CSH,
X/* 2C */	0x62 | CSH, 0x63 | CSH, 0x64 | CSH, 0x5F | CSH,
X
X/* 30 */	0x60 | CSH, 0x5E | CSH, 0x5D | CSH, 0x5C | CSH,
X/* 34 */	0x5B | CSH, 0xAA | CSL, 0xA9 | CSL, 0x3E | CSL,
X/* 38 */	0x9F | CSH, 0x9F | CSH, 0x9F | CSH, 0x9F | CSH,
X/* 3C */	0xF3 | CSL, 0x78 | CSH, 0xF2 | CSL, 0x5A | CSH,
X
X/* 40 */	0x59 | CSH, 0x58 | CSH, 0xEC | CSL, 0xF6 | CSL,
X/* 44 */	0x57 | CSH, 0x56 | CSH, 0xE8 | CSL, 0xE2 | CSL,
X/* 48 */	0x77 | CSH, 0x55 | CSH, 0x54 | CSH, 0x6E | CSH,
X/* 4C */	0x53 | CSH, 0x52 | CSH, 0x51 | CSH, 0xF0 | CSL,
X
X/* 50 */	0x50 | CSH, 0x4F | CSH, 0x9F | CSH, 0xE4 | CSL,
X/* 54 */	0x9F | CSH, 0x9F | CSH, 0xFB | CSL, 0xEA | CSL,
X/* 58 */	0x4E | CSH, 0x4D | CSH, 0x4C | CSH, 0x4B | CSH,
X/* 5C */	0xEF | CSL, 0x4A | CSH, 0x49 | CSH, 0x48 | CSH,
X
X/* 60 */	0xAA | CSL, 0xE0 | CSL, 0xE1 | CSL, 0x47 | CSH,
X/* 64 */	0xEB | CSL, 0x46 | CSH, 0xED | CSL, 0x59 | CSL,
X/* 68 */	0x45 | CSH, 0x44 | CSH, 0xE9 | CSL, 0x9E | CSH,
X/* 6C */	0x43 | CSH, 0x9F | CSH, 0x76 | CSL, 0x42 | CSH,
X
X/* 70 */	0xE3 | CSL, 0x41 | CSH, 0x40 | CSH, 0xE5 | CSL,
X/* 74 */	0xE7 | CSL, 0x9F | CSH, 0x9F | CSL, 0x66 | CSH,
X/* 78 */	0x68 | CSH, 0x7E | CSH, 0x9A | CSH, 0x1B | CSL,
X/* 7C */	0x18 | CSL, 0x1A | CSL, 0x19 | CSL, 0x20 | CSL
X};
X
X/*---------------------------------------------------------------------------*
X *	ISO Latin-1 Characterset
X *---------------------------------------------------------------------------*/
X#define HAVECSE_ISOLATIN
Xu_short cse_isolatin[CSSIZE] = {
X/* 20 */	0x20 | CSL, 0xAD | CSL, 0x9B | CSL, 0x9C | CSL,
X/* 24 */	0x9D | CSH, 0x9D | CSL, 0x7C | CSL, 0x15 | CSL,
X/* 28 */	0x77 | CSH, 0x9C | CSH, 0xA6 | CSL, 0xAE | CSL,
X/* 2C */	0x76 | CSH, 0x75 | CSH, 0x74 | CSH, 0x73 | CSH,
X
X/* 30 */	0xF8 | CSL, 0xF1 | CSL, 0xFD | CSL, 0x9B | CSH,
X/* 34 */	0x72 | CSH, 0xE6 | CSL, 0x14 | CSL, 0x99 | CSH,
X/* 38 */	0x71 | CSH, 0x98 | CSH, 0xA7 | CSL, 0xAF | CSL,
X/* 3C */	0xAC | CSL, 0xAB | CSL, 0x70 | CSH, 0xA8 | CSL,
X
X/* 40 */	0x97 | CSH, 0x96 | CSH, 0x95 | CSH, 0x94 | CSH,
X/* 44 */	0x8E | CSL, 0x8F | CSL, 0x92 | CSL, 0x80 | CSL,
X/* 48 */	0x93 | CSH, 0x90 | CSL, 0x92 | CSH, 0x91 | CSH,
X/* 4C */	0x90 | CSH, 0x8F | CSH, 0x8E | CSH, 0x8D | CSH,
X
X/* 50 */	0x6F | CSH, 0xA5 | CSL, 0x8C | CSH, 0x8B | CSH,
X/* 54 */	0x8A | CSH, 0x89 | CSH, 0x99 | CSL, 0x6E | CSH,
X/* 58 */	0x87 | CSH, 0x86 | CSH, 0x85 | CSH, 0x84 | CSH,
X/* 5C */	0x9A | CSL, 0x6D | CSH, 0x6C | CSH, 0xE1 | CSL,
X
X/* 60 */	0x85 | CSL, 0xA0 | CSL, 0x83 | CSL, 0x82 | CSH,
X/* 64 */	0x84 | CSL, 0x86 | CSL, 0x91 | CSL, 0x87 | CSL,
X/* 68 */	0x8A | CSL, 0x82 | CSL, 0x88 | CSL, 0x89 | CSL,
X/* 6C */	0x8D | CSL, 0xA1 | CSL, 0x8C | CSL, 0x8B | CSL,
X
X/* 70 */	0x6B | CSH, 0xA4 | CSL, 0x95 | CSL, 0xA2 | CSL,
X/* 74 */	0x93 | CSL, 0x81 | CSH, 0x94 | CSL, 0xF6 | CSL,
X/* 78 */	0x7F | CSH, 0x97 | CSL, 0xA3 | CSL, 0x96 | CSL,
X/* 7C */	0x81 | CSL, 0x69 | CSL, 0x6A | CSH, 0x98 | CSL
X};
X
X/*---------------------------------------------------------------------------*
X *	Downloadable Characterset
X *---------------------------------------------------------------------------*/
X#define HAVECSE_DOWNLOADABLE
Xu_short cse_downloadable[CSSIZE] = {
X/* 20 */	0xA0 | CSH, 0xA1 | CSH, 0xA2 | CSH, 0xA3 | CSH,
X/* 24 */	0xA4 | CSH, 0xA5 | CSH, 0xA6 | CSH, 0xA7 | CSH,
X/* 28 */	0xA8 | CSH, 0xA9 | CSH, 0xAA | CSH, 0xAB | CSH,
X/* 2C */	0xAC | CSH, 0xAD | CSH, 0xAE | CSH, 0xAF | CSH,
X
X/* 30 */	0xB0 | CSH, 0xB1 | CSH, 0xB2 | CSH, 0xB3 | CSH,
X/* 34 */	0xB4 | CSH, 0xB5 | CSH, 0xB6 | CSH, 0xB7 | CSH,
X/* 38 */	0xB8 | CSH, 0xB9 | CSH, 0xBA | CSH, 0xBB | CSH,
X/* 3C */	0xBC | CSH, 0xBD | CSH, 0xBE | CSH, 0xBF | CSH,
X
X/* 40 */	0xC0 | CSH, 0xC1 | CSH, 0xC2 | CSH, 0xC3 | CSH,
X/* 44 */	0xC4 | CSH, 0xC5 | CSH, 0xC6 | CSH, 0xC7 | CSH,
X/* 48 */	0xC8 | CSH, 0xC9 | CSH, 0xCA | CSH, 0xCB | CSH,
X/* 4C */	0xCC | CSH, 0xCD | CSH, 0xCE | CSH, 0xCF | CSH,
X
X/* 50 */	0xD0 | CSH, 0xD1 | CSH, 0xD2 | CSH, 0xD3 | CSH,
X/* 54 */	0xD4 | CSH, 0xD5 | CSH, 0xD6 | CSH, 0xD7 | CSH,
X/* 58 */	0xD8 | CSH, 0xD9 | CSH, 0xDA | CSH, 0xDB | CSH,
X/* 5C */	0xDC | CSH, 0xDD | CSH, 0xDE | CSH, 0xDF | CSH,
X
X/* 60 */	0xE0 | CSH, 0xE1 | CSH, 0xE2 | CSH, 0xE3 | CSH,
X/* 64 */	0xE4 | CSH, 0xE5 | CSH, 0xE6 | CSH, 0xE7 | CSH,
X/* 68 */	0xE8 | CSH, 0xE9 | CSH, 0xEA | CSH, 0xEB | CSH,
X/* 6C */	0xEC | CSH, 0xED | CSH, 0xEE | CSH, 0xEF | CSH,
X
X/* 70 */	0xF0 | CSH, 0xF1 | CSH, 0xF2 | CSH, 0xF3 | CSH,
X/* 74 */	0xF4 | CSH, 0xF5 | CSH, 0xF6 | CSH, 0xF7 | CSH,
X/* 78 */	0xF8 | CSH, 0xF9 | CSH, 0xFA | CSH, 0xFB | CSH,
X/* 7C */	0xFC | CSH, 0xFD | CSH, 0xFE | CSH, 0xFF | CSH,
X};
X
X/* ------------------------- E O F ------------------------------------------*/
SHAR_EOF
$TOUCH -am 0114130693 pcvt_tbl.h &&
chmod 0660 pcvt_tbl.h ||
echo "restore of pcvt_tbl.h failed"
set `wc -c pcvt_tbl.h`;Wc_c=$1
if test "$Wc_c" != "21369"; then
	echo original size 21369, current size $Wc_c
fi
fi
exit 0
-- 
hellmuth michaelis    HCS Hanseatischer Computerservice GmbH   hamburg, europe
hm@hcshh.hcs.de              tel: +49/40/55903-170         fax: +49/40/5591486