From: crash@ckctpa.UUCP (Frank "Crash" Edwards)
Subject: Here's the source ("Re: Button Number 2?")
Date: Tue, 1 Sep 1992 01:29:45 GMT
Reply-To: crash%ckctpa@tct.com (Frank "Crash" Edwards)
Organization: Edwards & Edwards Consulting

chuff@agora.rain.com (Chris Hufnagel) writes:
>A while back I remember seeing a utility that allowed you to use
>some key combo that would simulate the middle (number 2) button.
>
>Could sombody either e-mail/post it or tell me an ftp site.
>(I don't remember seeing it on amiga.physik).

If someone would zoo or tar this together and put it up for anon ftp
I'd appreciate it.  Thanks.

>Thanks.
>Chris Hufnagel <chuff@agora.rain.com>| "Where-ever there are teeth, you'll find

My pleasure.

One note though:  these patches consist of three things.  (1) The
mouse button enhancement that allows both buttons pressed
simultaneously to act as a middle button, (2) the VT100 keypad
enhancement which allows the numeric keypad to generate escape
sequences which can be modified by modifying a keymap, and (3) is the
beginning of support for an A_UNDERSCORE attribute for the console
screens (I loath the idea that the only attribute available is reverse
video -- ugh!).  See the README for more details.

---- cut here ---- cut here ---- cut here ---- cut here ---- cut here ----
Submitted-by: crash%ckctpa@tct.com
Archive-name: AmixConsolePatches/part01

#!/bin/sh
# This is AmixConsolePatches, a shell archive (shar 3.21)
# made 09/01/1992 01:26 UTC by crash%ckctpa@tct.com
# Source directory /usr/sys/amiga/console
#
# existing files WILL be overwritten
#
# This shar contains:
# length  mode       name
# ------ ---------- ------------------------------------------
#   2435 -rw-r--r-- README
#   4053 -rw-r--r-- amiga.ti
#  14824 -rw-r--r-- patches
#   3988 -rw-r--r-- keymap
#
if touch 2>&1 | fgrep '[-amc]' > /dev/null
 then TOUCH=touch
 else TOUCH=true
fi
# ============= README ==============
echo "x - extracting README (Text)"
sed 's/^X//' << 'SHAR_EOF' > README &&
XThe middle mouse button hack is just that -- a hack.  I have found
Xthat on occasion the middle button will "stick".  Press and release
Xone of the other buttons to "un-stick" it (usually outside of the
Xwindow you're working in).  If anyone finds out why, I'd appreciate
Xgetting some email so I can keep the patches complete.
X
XThe numeric keypad mods were originally designed to allow the software
Xto fake out the machine so that it thinks the RightAlt key is down.
XThen use an AmigaDOS keymap editor to set up the keypad to generate
Xwhatever sequences you want.  Those sequences can be activated by
Xdoing the following in KSH:
X
X    export TERM=amiga_test	# or whatever terminfo name you use
X    sioc setkmap keymap		# Substitute your keymap filename for "keymap"
X    tput smkx			# "start mode keypad xmit"
X
XNormally I execute "sioc setdefkmap ..." in the /etc/sysinit shell
Xscript so that the keymap is modified at boot time.  One of these days
XI'll make it the system-default keymap, but I'm not in any hurry.
X
XNow press any of the keypad keys to generate the escape sequence.
XTurn off the keypad mode by using "tput rmkx".  You will, of course,
Xneed to install the terminfo file I've provided, "amiga.ti".  This is
Xthe same name as the Commodore-supplied terminfo file, but it contains
Xtheir entry + my other entries.  You may find the "dnet" entry useful
Xif you're currently running DNet under Amix.  The "amiga1" entry is
Xwhat I call my modified terminfo entry, ie. it was called "amiga_test"
Xin the example above.
X
XI've included the keymap I use, which is _not_ exactly the same as the
XVT100 (The VT100 uses <ESC>O for the introducer and I found vi has to
Xdo some funky stuff to detect an <ESC> when the special keys are multi-
Xkeystroke codes when the character following the <ESC> could be a vi
Xcommand.  So I use <CSI> (or "<ESC>[O") as the introducer.  Look at the
Xterminfo source file for the keys that are available (such as <HOME>,
X<END>, <PgUp>, <PgDn>, etc).
X
XThe underlining support is not yet complete (a little more debugging
Xto do) so I haven't enabled it in the terminfo file and hence you won't
Xsee any of it.  When I get it worked out, there'll be new patches to be
Xapplied against the original files, so KEEP YOUR ORIGINALS!
X--
XFrank "Crash" Edwards            King Marine Electronics, Inc.
XHome: 813/786-3675               Work: 813/530-3411
X
XEmail: crash%ckctpa@tct.com, or
X       crash%ckctpa@myrddin.sybus.com
SHAR_EOF
$TOUCH -am 0831211992 README &&
chmod 0644 README ||
echo "restore of README failed"
set `wc -c README`;Wc_c=$1
if test "$Wc_c" != "2435"; then
	echo original size 2435, current size $Wc_c
fi
# ============= amiga.ti ==============
echo "x - extracting amiga.ti (Text)"
sed 's/^X//' << 'SHAR_EOF' > amiga.ti &&
X# Generic DNET-compatible escape sequences for an AmigaDOS CON:
X# window.  Since neither "amiga" nor "vt100" worked for DNet
X# client FTERMs, I built up this one by running script before
X# a vi session and trimming out the escape sequence that the
X# CON: device doesn't handle.
Xdnet|AmigaDOS console screen under DNET V2.10,
X	km, am, xenl,
X
X	bel=^G, cr=\r, ind=\233S, ri=\233T, nel=\n, ht=\t,
X	cub=\233%p1%dD, cub1=\b,
X	cud=\233%p1%dB, cud1=\n,
X	cuf=\233%p1%dC, cuf1=\233C,
X	cuu=\233%p1%dA, cuu1=\233A,
X	cup=\233%i%p1%d;%p2%dH,
X	home=\233H, ed=\233J, el=\233K, clear=\233H\233J,
X
X	ich1=\233@, ich=\233%p1%d@,
X	dch1=\233P,
X	il1=\233L,
X	dl1=\233M,
X
X	smso=\2337m, rmso=\233m,
X	bold=\2331m,
X	rev=\2337m,
X	sgr=\233%?%p1%t7;%;%?%p2%t4;%;%?%p3%t7;%;%?%p4%t5;%;%?%p6%t1;%;m%?%p9%t^N%e^O%;,
X	sgr0=\2330m,
X
X	khlp=\233?~,
X	kbs=\b, kcub1=\233D, kcuf1=\233C, kcuu1=\233A, kcud1=\233B,
X	kf1=\2330~, kf2=\2331~, kf3=\2332~, kf4=\2333~, kf5=\2334~,
X	kf6=\2335~, kf7=\2336~, kf8=\2337~, kf9=\2338~, kf10=\2339~,
X	kf11=\23310~, kf12=\23311~, kf13=\23312~, kf14=\23313~, kf15=\23314~,
X	kf16=\23315~, kf17=\23316~, kf18=\23317~, kf19=\23318~, kf20=\23319~,
X
X# The original, un-perverted (at least, by me!) console handler description.
Xamiga|Amiga Unix console screen (pseudo-ansi),
X	km, am, xenl,
X
X	cols#80, lines#25,
X
X	bel=^G, cr=\r, ind=\2331;1M, ht=\t,
X	cub=\233%p1%dD, cub1=\b,
X	cud=\233%p1%dB, cud1=\n,
X	cuf=\233%p1%dC, cuf1=\233C,
X	cuu=\233%p1%dA, cuu1=\233A,
X	cup=\233%i%p1%d;%p2%dH,
X	home=\233H, ed=\233J, el=\233K, clear=\233H\233J,
X
X	ich1=\233@, ich=\233%p1%d@,
X	dch1=\233P,
X	il1=\233L, il=\233%p1%dL,
X	dl1=\233M, dl=\233%p1%dM,
X
X	smso=\2337m, rmso=\233m,
X	bold=\2331m,
X	rev=\2337m,
X	sgr=\233%?%p1%t7;%;%?%p2%t4;%;%?%p3%t7;%;%?%p4%t5;%;%?%p6%t1;%;m%?%p9%t^N%e^O%;,
X	sgr0=\2330m,
X	acsc=``aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,
X	rmacs=^O, smacs=^N,
X
X	khlp=\233?~,
X	kbs=\b, kcub1=\233D, kcuf1=\233C, kcuu1=\233A, kcud1=\233B,
X	kf1=\2330~, kf2=\2331~, kf3=\2332~, kf4=\2333~, kf5=\2334~,
X	kf6=\2335~, kf7=\2336~, kf8=\2337~, kf9=\2338~, kf10=\2339~,
X	kf11=\23310~, kf12=\23311~, kf13=\23312~, kf14=\23313~, kf15=\23314~,
X	kf16=\23315~, kf17=\23316~, kf18=\23317~, kf19=\23318~, kf20=\23319~,
X
X# Added back_tab keystroke, <Del> as kdch1
X#  Use either <Alt> or <Amiga> modifier key to obtain KEY_BTAB (kmap feature)
Xamiga1|Amiga Unix console screen (pseudo-ansi),
X	km, am, xenl,
X
X	cols#80, lines#25,
X
X	bel=^G, cr=\r, ind=\2331;1M, ht=\t,
X	cub=\233%p1%dD, cub1=\b,
X	cud=\233%p1%dB, cud1=\n,
X	cuf=\233%p1%dC, cuf1=\233C,
X	cuu=\233%p1%dA, cuu1=\233A,
X	cup=\233%i%p1%d;%p2%dH,
X	home=\233H, ed=\233J, el=\233K, clear=\233H\233J,
X	smcup=\E[<, rmcup=\E[>,
X
X	ich1=\233@, ich=\233%p1%d@,
X	dch1=\233P,
X	il1=\233L, il=\233%p1%dL,
X	dl1=\233M, dl=\233%p1%dM,
X
X	smso=\2337m, rmso=\233m,
X	bold=\2331m,
X	rev=\2337m,
X	sgr=\233%?%p1%t7;%;%?%p2%t4;%;%?%p3%t7;%;%?%p4%t5;%;%?%p6%t1;%;m%?%p9%t^N%e^O%;,
X	sgr0=\2330m,
X	acsc=``aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,
X	rmacs=^O, smacs=^N,
X
X# half-line down and half-line up (for [nt]roff)
X	hd=\2334b, hu=\2334a,
X# enable subscript, enable superscript
X	ssubm=\2334b, ssupm=\2334a,
X
X# mcud1, mcuu1, mcuf1, mcub1 for micro-movements
X	mcub1=\233d, mcuf1=\233c, mcuu1=\233a, mcud1=\233b,
X	mcub=\233%p1%dd, mcuf=\233%p1%dc, mcuu=\233%p1%da, mcud=\233%p1%db,
X
X# I'm going to add these too pretty soon!!
X# swidm == enable doublewide mode, rwidm == disable doublewide mode
X# smul == enable underline mode, rmul == disable underline mode
X
X# The keypad controls are smkx and rmkx
X	smkx=\233<, rmkx=\233>,
X
X	khlp=\233?0~, kHLP=\233?1~, kcbt=\211,
X	kbs=\b, kcub1=\233D, kcuf1=\233C, kcuu1=\233A, kcud1=\233B,
X	kf1=\2330~, kf2=\2331~, kf3=\2332~, kf4=\2333~, kf5=\2334~,
X	kf6=\2335~, kf7=\2336~, kf8=\2337~, kf9=\2338~, kf10=\2339~,
X	kf11=\23310~, kf12=\23311~, kf13=\23312~, kf14=\23313~, kf15=\23314~,
X	kf16=\23315~, kf17=\23316~, kf18=\23317~, kf19=\23318~, kf20=\23319~,
X	kb2=\233Ou, kpp=\233Oy, knp=\233Os, khome=\233Ow,
X	kend=\233Oq, kent=\233\n, kdch1=\233OM, kich1=\233Op,
X	knxt=\233Ol, kprv=\233On,
SHAR_EOF
$TOUCH -am 0831212592 amiga.ti &&
chmod 0644 amiga.ti ||
echo "restore of amiga.ti failed"
set `wc -c amiga.ti`;Wc_c=$1
if test "$Wc_c" != "4053"; then
	echo original size 4053, current size $Wc_c
fi
# ============= patches ==============
echo "x - extracting patches (Text)"
sed 's/^X//' << 'SHAR_EOF' > patches &&
X*** /mnt/usr/sys/amiga/console/c0.c	Thu Jan  1 00:00:00 1970
X--- c0.c	Tue Aug  4 00:38:02 1992
X***************
X*** 17,23 ****
X  #include "sys/inline.h"
X  #include "sys/systm.h"
X  #include "sys/cred.h"
X! #include "amigahr.h"
X  #include "memory.h"
X  #include "screen.h"
X  #include "console.h"
X--- 17,23 ----
X  #include "sys/inline.h"
X  #include "sys/systm.h"
X  #include "sys/cred.h"
X! /* #include "amigahr.h" /* */
X  #include "memory.h"
X  #include "screen.h"
X  #include "console.h"
X***************
X*** 229,236 ****
X      }
X  }
X  
X- 
X  int console_modes = 0;
X  /* Initialize a console unit, making it ready for display */
X  static int consinit(cp)
X  register struct console *cp;
X--- 229,236 ----
X      }
X  }
X  
X  int console_modes = 0;
X+ 
X  /* Initialize a console unit, making it ready for display */
X  static int consinit(cp)
X  register struct console *cp;
X***************
X*** 241,247 ****
X      if (!coinitflag)
X  	coinit();
X  
X!     if (!(sp = cp->screen) && !(sp = OpenScreen()))
X  	return ENOCSI;
X  
X      cp->screen = sp;
X--- 241,247 ----
X      if (!coinitflag)
X  	coinit();
X  
X!     if (!(sp = cp->screen) && !(sp = OpenScreen(cp)))
X  	return ENOCSI;
X  
X      cp->screen = sp;
X***************
X*** 371,377 ****
X      oldpri = splscr();
X      if (!(cp->flags & CF_OPEN))
X      {
X! 	if (!cp->screen && !(cp->screen = OpenScreen()))
X  	{
X  	    splx(oldpri);
X  	    return EAGAIN;
X--- 371,377 ----
X      oldpri = splscr();
X      if (!(cp->flags & CF_OPEN))
X      {
X! 	if (!cp->screen && !(cp->screen = OpenScreen(cp)))
X  	{
X  	    splx(oldpri);
X  	    return EAGAIN;
X*** /mnt/usr/sys/amiga/console/c1.c	Thu Jan  1 00:00:00 1970
X--- c1.c	Mon Aug 24 21:55:11 1992
X***************
X*** 36,45 ****
X--- 36,74 ----
X   *	CSI <N> c	move cursor right N pixels.
X   *	CSI <N> d	move cursor left N pixels.
X   *	CSI <R>;<C> h	move cursor to pixel (R,C)
X+  *
X+  *  Attempting to add these as well:
X+  *    From the vt100-am (w/advanced video):
X+  *	smkx=\E[<, rmkx=\E[>,	# enable/disable keypad xmit mode
X+  *
X+  *	This is how the keypad gets assigned.
X+  *	PF1 (     PF2 )     PF3 /     PF4 *	# these change w/Shift
X+  *	\EOP      \EOQ      \EOR      \EOS	# unshifted
X+  *	\Eop      \Eoq      \Eor      \Eos	# shifted
X+  *
X+  *	7  home   8  up     9  PgUp   -
X+  *	\EOw      \EOx      \EOy      \EOn
X+  *
X+  *	4  left   5         6  right  +
X+  *	\EOt      \EOu      \EOv      \EOl
X+  *
X+  *	1  end    2  down   3  PgDn  E----E
X+  *	\EOq      \EOr      \EOs     N \r N
X+  *				     T    T
X+  *	0................   .        E\E\rE
X+  *	\EOp                \EOM     R----R
X+  *
X+  *    Still to do.
X+  *    From the vt220 (8-bit terminal in 7-bit mode):
X+  *	flash=\E[?5h$<200>\E[?5l,	# Use reverse video to flash the screen
X+  *	mc4=\E[4i, mc5=\E[5i,		# enable/disable transparent print
X+  *	sc=\E7, rc=\E8,			# save/restore cursor location
X   */
X  #include "sys/types.h"
X  #include "sys/param.h"
X  #include "sys/inline.h"
X+ #include "sys/strlog.h"
X+ #include "syslog.h"
X  #include "bfinline.h"
X  #include "amigahr.h"
X  #include "screen.h"
X***************
X*** 87,93 ****
X  		copy_lines(),		/* copy pixel lines */
X  		moved();		/* move down */
X  
X- 
X  /*
X   * Draw places a character in the bitmap.
X   */
X--- 116,121 ----
X***************
X*** 98,106 ****
X--- 126,141 ----
X  {
X      register struct screen *sp = cp->screen;
X  
X+     if (cp->c_keypad)
X+ 	strlog(1, __LINE__, LOG_KERN|LOG_DEBUG, SL_TRACE,
X+ 	    "%c (0x%x)\n", cp->c_attr, cp->c_attr);
X      scrcon_putch(sp->bmap, sp->col, sp->row, fp, ch, cp->c_attr);
X  }
X  
X+ #define C_NORMAL	0
X+ #define C_ESCAPE	1
X+ #define C_CSI		2
X+ #define C_MODE_SET	3
X  
X  /*
X   * conput handles all terminal emulation.
X***************
X*** 126,132 ****
X  	    /*
X  	     * nothing happening
X  	     */
X! 	case 0:
X  	    cp->c_argc = cp->c_curarg = 0;
X  	    cp->c_args[0] = 0;
X  
X--- 161,167 ----
X  	    /*
X  	     * nothing happening
X  	     */
X! 	case C_NORMAL:
X  	    cp->c_argc = cp->c_curarg = 0;
X  	    cp->c_args[0] = 0;
X  
X***************
X*** 180,189 ****
X  		cp->c_attr &= ~(1<<ATTR_FONT1);
X  		break;
X  	    case 0x1b:			/* Escape ... */
X! 		cp->c_state = 1;
X  		break;
X  	    case 0x9b:			/* CSI ... */
X! 		cp->c_state = 2;
X  		break;
X  	    default:
X  		if (c & 0x60)
X--- 215,224 ----
X  		cp->c_attr &= ~(1<<ATTR_FONT1);
X  		break;
X  	    case 0x1b:			/* Escape ... */
X! 		cp->c_state = C_ESCAPE;
X  		break;
X  	    case 0x9b:			/* CSI ... */
X! 		cp->c_state = C_CSI;
X  		break;
X  	    default:
X  		if (c & 0x60)
X***************
X*** 218,231 ****
X  	    /*
X  	     * Escape seen.
X  	     */
X! 	case 1:
X  	    switch (c)
X  	    {
X  	    case '[':			/* Esc [ -> CSI */
X! 		cp->c_state = 2;
X  		break;
X  	    default:			/* Esc weird -> ignore */
X! 		cp->c_state = 0;
X  		break;
X  	    }
X  	    break;
X--- 253,266 ----
X  	    /*
X  	     * Escape seen.
X  	     */
X! 	case C_ESCAPE:
X  	    switch (c)
X  	    {
X  	    case '[':			/* Esc [ -> CSI */
X! 		cp->c_state = C_CSI;
X  		break;
X  	    default:			/* Esc weird -> ignore */
X! 		cp->c_state = C_NORMAL;	/* VT52 emulation would start here */
X  		break;
X  	    }
X  	    break;
X***************
X*** 232,238 ****
X  	    /*
X  	     * CSI seen
X  	     */
X! 	case 2:
X  	    if (c & 0x40)
X  	    {
X  		int N = (cp->c_argc > 0) ? cp->c_args[0] : 1;
X--- 267,273 ----
X  	    /*
X  	     * CSI seen
X  	     */
X! 	case C_CSI:
X  	    if (c & 0x40)
X  	    {
X  		int N = (cp->c_argc > 0) ? cp->c_args[0] : 1;
X***************
X*** 352,363 ****
X  		default:
X  		    break;
X  		}
X! 		cp->c_state = 0;
X  	    }
X  	    else
X  	    {
X  		switch (c)
X  		{
X  		case ';':
X  		    if (cp->c_curarg < MAXARGS-1)
X  			cp->c_args[++cp->c_curarg] = 0;
X--- 387,405 ----
X  		default:
X  		    break;
X  		}
X! 		cp->c_state = C_NORMAL;
X  	    }
X  	    else
X  	    {
X  		switch (c)
X  		{
X+ #ifdef FJE_KEYPAD
X+ 		case '<':	/* vt100 mode-setting sequence */
X+ 		case '>':
X+ 		    cp->c_keypad = (c == '<');	/* False for NumericMode */
X+ 		    cp->c_state = C_NORMAL;	/* True for Application */
X+ 		    break;
X+ #endif /* FJE_KEYPAD */
X  		case ';':
X  		    if (cp->c_curarg < MAXARGS-1)
X  			cp->c_args[++cp->c_curarg] = 0;
X***************
X*** 379,385 ****
X  		    cp->c_args[cp->c_curarg] += (c-'0');
X  		    break;
X  		case 42:
X! 		    cp->c_state = 0;
X  		    if ((cp->c_argc>0) && (cp->c_args[0] == '*'))
X  		    {
X  			int x=cp->flags;
X--- 421,427 ----
X  		    cp->c_args[cp->c_curarg] += (c-'0');
X  		    break;
X  		case 42:
X! 		    cp->c_state = C_NORMAL;
X  		    if ((cp->c_argc>0) && (cp->c_args[0] == '*'))
X  		    {
X  			int x=cp->flags;
X***************
X*** 743,752 ****
X  {
X      if (dstbit&7)
X      {
X! 	unsigned char mask = 0xff << 8-(dstbit&7);
X  	if (nbits+(dstbit&7) < 8)
X  	{
X! 	    mask |= 0xff >> (dstbit&7)+nbits;
X  	    line[dstbit/8] &= mask;
X  	    return;
X  	}
X--- 785,794 ----
X  {
X      if (dstbit&7)
X      {
X! 	unsigned char mask = 0xff << (8-(dstbit&7));
X  	if (nbits+(dstbit&7) < 8)
X  	{
X! 	    mask |= 0xff >> ((dstbit&7)+nbits);
X  	    line[dstbit/8] &= mask;
X  	    return;
X  	}
X*** /mnt/usr/sys/amiga/console/console.h	Thu Jan  1 00:00:00 1970
X--- console.h	Mon Aug 24 21:33:51 1992
X***************
X*** 11,16 ****
X--- 11,19 ----
X  struct console
X  {
X      unsigned short flags;
X+ #ifdef FJE_KEYPAD
X+ # define c_keypad   pad0	/* Keypad mode Numeric or Application? */
X+ #endif /* FJE_KEYPAD */
X      unsigned short pad0;
X      struct strtty *tty;			/* Streams tty structure */
X      struct screen *screen;		/* Screen structure */
X*** /mnt/usr/sys/amiga/console/scrdev.c	Thu Jan  1 00:00:00 1970
X--- scrdev.c	Tue Aug  4 00:38:17 1992
X***************
X*** 256,262 ****
X      {
X  	dp->ielist = (struct inputevent *)
X  	    AllocMem(NIEVENT * sizeof (struct inputevent), 0);
X! 	if (!dp || !(sp = OpenScreen()))
X  	    return ENOSPC;
X  	dp->screen = sp;
X  	sp->user = (void *)dp;
X--- 256,262 ----
X      {
X  	dp->ielist = (struct inputevent *)
X  	    AllocMem(NIEVENT * sizeof (struct inputevent), 0);
X! 	if (!dp || !(sp = OpenScreen(NULL)))
X  	    return ENOSPC;
X  	dp->screen = sp;
X  	sp->user = (void *)dp;
X***************
X*** 340,346 ****
X  struct uio *uiop;
X  struct cred *cr;
X  {
X-     register struct scrdev *dp = &scrdev[getminor(dev)];
X      return ENOSPC;
X  }
X  
X--- 340,345 ----
X*** /mnt/usr/sys/amiga/console/screen.c	Thu Jan  1 00:00:00 1970
X--- screen.c	Thu Aug  6 22:33:12 1992
X***************
X*** 8,13 ****
X--- 8,16 ----
X  #include "screen.h"
X  #include "copper.h"
X  
X+ #ifdef FJE_KEYPAD
X+ # include "console.h"
X+ #endif /* FJE_KEYPAD */
X  
X  static void fixstate(), repeat(), dokb();
X  
X***************
X*** 201,207 ****
X  
X      /* Mouse buttons */
X      {
X! 	register unsigned char cur_buttons=0, diff;
X  	register int i;
X  
X  	if (!(ACIAA->pra & 1<<6))
X--- 204,210 ----
X  
X      /* Mouse buttons */
X      {
X! 	register unsigned char cur_buttons=0, diff, btn_down;
X  	register int i;
X  
X  	if (!(ACIAA->pra & 1<<6))
X***************
X*** 213,223 ****
X  
X  	if (diff = (cur_buttons^mousebuttons))
X  	{
X! 	    keystates[15] = (keystates[15] & ~(7<<4)) | (cur_buttons<<4);
X! 	    for ( i=0 ; i<3 ; ++i )
X! 		if (diff & 1<<i)
X! 		    dokb((0x7c+i) | (cur_buttons & (1<<i) ? 0 : 0x80), 0);
X! 	    mousebuttons = cur_buttons;
X  	}
X      }
X  
X--- 216,240 ----
X  
X  	if (diff = (cur_buttons^mousebuttons))
X  	{
X! 	    static unsigned char count;
X! 
X! 	    if (count++ > 3) {
X! 		count = 0;
X! 
X! 		btn_down = cur_buttons;
X! 		if (cur_buttons==(MB_0|MB_2) || mousebuttons==(MB_0|MB_2)) {
X! 		    diff = MB_1;
X! 		    if (cur_buttons == (MB_0|MB_2))
X! 			btn_down = MB_1;
X! 		    else
X! 			btn_down = 0, cur_buttons = 0;
X! 		}
X! 		keystates[15] = (keystates[15] & ~(7<<4)) | (btn_down<<4);
X! 		for ( i=0 ; i<3 ; ++i )
X! 		    if (diff & 1<<i)
X! 			dokb((0x7c+i) | (btn_down & (1<<i) ? 0 : 0x80), 0);
X! 		mousebuttons = cur_buttons;
X! 	    }
X  	}
X      }
X  
X***************
X*** 326,332 ****
X  }
X  
X  
X! struct screen *OpenScreen()
X  {
X      register struct screen *sp;
X      int s=splscr();
X--- 343,349 ----
X  }
X  
X  
X! struct screen *OpenScreen(struct console *cp)
X  {
X      register struct screen *sp;
X      int s=splscr();
X***************
X*** 338,344 ****
X  	if (!(sp->flags & Sf_INUSE))
X  	{
X  	    bzero((char *)sp, sizeof (struct screen));
X! 	    sp->flags = Sf_INUSE|Sf_NEEDCOP;
X  	    SCREENCHANGE;
X  	    splx(s);
X  	    return sp;
X--- 355,364 ----
X  	if (!(sp->flags & Sf_INUSE))
X  	{
X  	    bzero((char *)sp, sizeof (struct screen));
X! #ifdef FJE_KEYPAD
X! 	    sp->console = cp;
X! #endif /* FJE_KEYPAD */
X! 	    sp->flags = Sf_INUSE | Sf_NEEDCOP;
X  	    SCREENCHANGE;
X  	    splx(s);
X  	    return sp;
X***************
X*** 742,748 ****
X  	}
X  }
X  
X- 
X  static int encode(kmap, keyent, sp, repeatflag)
X  struct keymap *kmap;
X  struct keyent keyent;
X--- 762,767 ----
X***************
X*** 829,834 ****
X--- 848,862 ----
X      }
X  }
X  
X+ static unsigned char KeyPadTable[] = {
X+     0,
X+     0x5A, 0x5B, 0x5C, 0x5D, /* Rawcodes for the numeric keypad */
X+     0x3D, 0x3E, 0x3F, 0x4A,
X+     0x2D, 0x2E, 0x2F, 0x5E,
X+     0x1D, 0x1E, 0x1F, 0x43,
X+     0x0F,       0x3C,
X+     0,
X+ };
X  
X  /*
X   * Dispatch a keyboard character.
X***************
X*** 837,842 ****
X--- 865,871 ----
X  unsigned char rawcode;			/* Raw command from kbd */
X  int repeatflag;				/* NZ iff this is a repeat */
X  {
X+     register unsigned char *kpt = KeyPadTable;
X      register struct keymap *kmap;
X      struct screen *sp;
X      unsigned char c = rawcode & 0x7f;
X***************
X*** 880,908 ****
X  	unsigned int mask;
X  
X  	for ( mask=1, i=0 ; i<16 ; ++i, mask<<=1 )
X! 	    for ( j=0 ; j<4 ; ++j )
X! 	    {
X  		k = kmap->km_shiftkeys[i][j];
X  		if (k>127)
X  		    break;
X! 		if (k == c)
X! 		{
X! 		    if (rawcode&0x80)
X! 		    {
X  			keyboardstate &= ~mask;
X! 			for ( j=0 ; j<4 ; ++j )
X! 			{
X  			    k = kmap->km_shiftkeys[i][j];
X  			    if (k>127)
X  				break;
X! 			    if (keystates[k>>3] & 1<<(k&7))
X! 			    {
X  				keyboardstate |= mask;
X  				break;
X  			    }
X  			}
X! 		    }
X! 		    else
X  			keyboardstate |= mask;
X  		    break;
X  		}
X--- 909,931 ----
X  	unsigned int mask;
X  
X  	for ( mask=1, i=0 ; i<16 ; ++i, mask<<=1 )
X! 	    for ( j=0 ; j<4 ; ++j ) {
X  		k = kmap->km_shiftkeys[i][j];
X  		if (k>127)
X  		    break;
X! 		if (k == c) {
X! 		    if (rawcode&0x80) {
X  			keyboardstate &= ~mask;
X! 			for ( j=0 ; j<4 ; ++j ) {
X  			    k = kmap->km_shiftkeys[i][j];
X  			    if (k>127)
X  				break;
X! 			    if (keystates[k>>3] & 1<<(k&7)) {
X  				keyboardstate |= mask;
X  				break;
X  			    }
X  			}
X! 		    } else
X  			keyboardstate |= mask;
X  		    break;
X  		}
X***************
X*** 909,914 ****
X--- 932,946 ----
X  	    }
X      }
X  
X+ #ifdef FJE_KEYPAD
X+     if (sp->console && sp->console->c_keypad && !(rawcode & 0x80)) {
X+ 	while (*++kpt)
X+ 	    if (*kpt == rawcode) {
X+ 		keyboardstate |= 0x0220; /* Pretend RightAlt key is down */
X+ 		break;
X+ 	    }
X+     }
X+ #endif /* FJE_KEYPAD */
X      switch (encode(kmap,
X  		   kmap->km_toptable[rawcode],
X  		   sp, repeatflag))
X***************
X*** 929,934 ****
X--- 961,970 ----
X  				repeatflag?REPTRATE:REPTDELAY);
X  	}
X      }
X+ #ifdef FJE_KEYPAD
X+     if (*kpt)
X+ 	fixstate(sp);
X+ #endif /* FJE_KEYPAD */
X  }
X  
X  
X*** /mnt/usr/sys/amiga/console/screen.h	Thu Jan  1 00:00:00 1970
X--- screen.h	Mon Aug 24 21:33:51 1992
X***************
X*** 87,92 ****
X--- 87,119 ----
X      /* unsigned char km_tablearea[0]; */	/* Lower tables begin here */
X  };
X  
X+ /***
X+  *  keymap.km_shiftkeys[][] is used to determine a bit position for
X+  *  each of the shift-able modifier keys, ie. Alt, Amiga, Control, etc.
X+  *
X+  *  There are 16 entries/bit positions in the mask, just as the first
X+  *  dimension on km_shiftkeys is 16.
X+  *
X+  *  Each bit can be enabled by various combinations; for instance, the
X+  *  LeftShift key is bit0, the RightShift key is bit1, and both of them
X+  *  at the same time would be bit0|bit1|bit8 since bit8 represents both
X+  *  at once.
X+  *
X+  *  Here are the bit positions as determined from usa0.kmap.s:
X+  *
X+  *	15 ----------------- 8   7 ------------------ 0
X+  *	x  x  x  x  x  x  x  x   x  x  x  x  x  x  x  x
X+  *      |  |  |  |  |  |  |  |   |  |  |  |  |  |  |  |
X+  *      |  |  |  |  |  |  | Shft |  |  |  |  |  |  |  LSh
X+  *      |  |  |  |  |  | Alt     |  |  |  |  |  |  RSh
X+  *      |  |  |  |  | Ami        |  |  |  |  |  CLk
X+  *      |  |  |  |Shft           |  |  |  |  Ctl
X+  *      |  |  |Meta              |  |  |  LAlt
X+  *      |  |  |                  |  |  RAlt
X+  *       \ | /                   |  LAmi
X+  *       Unused                  RAmi
X+  */
X+ 
X  /* keymap.km_magic */
X  #define KM_MAGIC 0x2a4b
X  
X***************
X*** 228,233 ****
X--- 255,263 ----
X      struct keymap *kmap;			/* Keyboard map */
X      struct font *font[4];			/* Pointers to current fonts */
X      char name[SCRNAMESIZE];			/* Descriptive name */
X+ #ifdef FJE_KEYPAD
X+     struct console *console;			/* If console, holds &parent */
X+ #endif /* FJE_KEYPAD */
X  };
X  
X  /* screen.flags */
SHAR_EOF
$TOUCH -am 0831203492 patches &&
chmod 0644 patches ||
echo "restore of patches failed"
set `wc -c patches`;Wc_c=$1
if test "$Wc_c" != "14824"; then
	echo original size 14824, current size $Wc_c
fi
# ============= keymap ==============
echo "x - extracting keymap (Binary)"
sed 's/^X//' << 'SHAR_EOF' | uudecode &&
Xbegin 600 keymap
XM*DL`````#Y1@____8?___V+___]C____9/___V7___]F____9____V!A__]D
XM9?__9F?__V!A8O]D96;_________________8``%`&``!21@``5(8``%;&``
XM!9!@``6T8``%V&``!?Q@``8@8``&1&``!FA@``:,8``&L&``!M1P````8``&
XM^&``!PA@``<L8``'4&``!W1@``>88``'O&``!^!@``@$8``(*&``"$Q@``AP
XM8``(E'````!@``BX8``(R&``"-A@``CH8``)#&``"3!@``E48``)>&``"9Q@
XM``G`8``)Y&``"@A@``HL8``*4'````!P````8``*=&``"H1@``J4<````&``
XM"J1@``K(8``*[&``"Q!@``LT8``+6&``"WQ@``N@8``+Q&``"^AP````8``,
XM#&``#!Q@``PL8``,/&``#$Q@``Q88``,8&``#&Q@``Q\8``,B&``#)1P````
XM<````'````!@``R@<````&``#+!@``S48``,^&``#1Q@``[,8``.X&``#O1@
XM``\(8``/'&``#S!@``]$8``/6&``#VQ@``^`8``.,&``#DQ@``YH8``.A&``
XM#J!@``ZP<````'````!P````<````'````!P````<````'````!P````<```
XM`'````!P````<````'````!P````<````'````!P````<````'````!P````
XM<````'````!P````<````'````!P````<````'````!P````<````'````!P
XM````<````'````!P````<````'````!P````<````'````!P````<````'``
XM``!P````<````'````!P````<````'````!P````<````'````!P````<```
XM`'````!P````<````'````!P````<````'````!P````<````'````!P````
XM<````'````!P````<````'````!P````<````'````!P````<````'````!P
XM````<````'````!P````<````'````!P````<````'````!P````<````'``
XM``!P````<````'````!P````<````'````!P````<````'````!P````<```
XM`'````!P````<````'````!P````<````'````!P````<````'````!P````
XM<````'````!P````<````'````!P````<````'````!P````<````'````!P
XM````<````'````!P````<````'````!P````<````'````!P````<````'``
XM``!P````<````'````!P````<````'````!P````<````'````!P````<```
XM`'````!P````<````'````!P````<````'````!P````<````'````!P````
XM<````'````!P````<`````````````$``````````@`````````#`````@``
XM``$```````````@````````!"`````@```$``````````@@````(```"````
XM``````,(```""````0@````(```#`````@````$`````````"``````````*
XM`````@````@`````````"`@````(```(``````````H(```""```"`@````(
XM```*`````@````@```````````````24````G@```(`````>`````````/X`
XM``#@````?@```&````24````@0```)$````!````$0```*$```"Q````(0``
XM`#$```24````@````)(`````````$@```,````"R````0````#(```24````
XM@P```),````#````$P```*,```"S````(P```#,```24````A````)0````$
XM````%````*0```"T````)````#0```24````A0```)4````%````%0```*4`
XM``"U````)0```#4```24````G@```)8````>````%@```-X```"V````7@``
XM`#8```24````A@```)<````&````%P```*8```"W````)@```#<```24````
XMB@```)@````*````&````*H```"X````*@```#@```24````B````)D````(
XM````&0```*@```"Y````*````#D```24````B0```)`````)````$````*D`
XM``"P````*0```#````24````GP```(T````?````#0```-\```"M````7P``
XM`"T```24````BP```)T````+````'0```*L```"]````*P```#T```24````
XMG````)P````<````'````/P```#<````?````%P```14$``'!````#`#FT]P
XM```$W````)$```"1````$0```!$```#1````\0```%$```!Q```$W````)<`
XM``"7````%P```!<```#7````]P```%<```!W```$W````(4```"%````!0``
XM``4```#%````Y0```$4```!E```$W````)(```"2````$@```!(```#2````
XM\@```%(```!R```$W````)0```"4````%````!0```#4````]````%0```!T
XM```$W````)D```"9````&0```!D```#9````^0```%D```!Y```$W````)4`
XM``"5````%0```!4```#5````]0```%4```!U```$W````(D```")````"0``
XM``D```#)````Z0```$D```!I```$W````(\```"/````#P````\```#/````
XM[P```$\```!O```$W````)````"0````$````!````#0````\````%````!P
XM```$E````)L```";````&P```!L```#[````VP```'L```!;```$E````)T`
XM``"=````'0```!T```#]````W0```'T```!=```$5!``",0````Q`YM/<0``
XM!%00``C4````,@.;3W(```14$``(Y````#,#FT]S```$W````($```"!````
XM`0````$```#!````X0```$$```!A```$W````),```"3````$P```!,```#3
XM````\P```%,```!S```$W````(0```"$````!`````0```#$````Y````$0`
XM``!D```$W````(8```"&````!@````8```#&````Y@```$8```!F```$W```
XM`(<```"'````!P````<```#'````YP```$<```!G```$W````(@```"(````
XM"`````@```#(````Z````$@```!H```$W````(H```"*````"@````H```#*
XM````Z@```$H```!J```$W````(L```"+````"P````L```#+````ZP```$L`
XM``!K```$W````(P```",````#`````P```#,````[````$P```!L```$E```
XM`)H```";````&@```!L```"Z````NP```#H````[```$E````((```"'````
XM`@````<```"B````IP```"(````G```$5!``"H`````T`YM/=```!%00``J0
XM````-0.;3W4```14$``*H````#8#FT]V```$W````)H```":````&@```!H`
XM``#:````^@```%H```!Z```$W````)@```"8````&````!@```#8````^```
XM`%@```!X```$W````(,```"#`````P````,```##````XP```$,```!C```$
XMW````)8```"6````%@```!8```#6````]@```%8```!V```$W````((```""
XM`````@````(```#"````X@```$(```!B```$W````(X```".````#@````X`
XM``#.````[@```$X```!N```$W````(T```"-````#0````T```#-````[0``
XM`$T```!M```$E````)P```",````'`````P```"\````K````#P````L```$
XME````)X```".````'@````X```"^````K@```#X````N```$E````)\```"/
XM````'P````\```"_````KP```#\````O```$5!``#!@````N`YM/30``!%00
XM``PH````-P.;3W<```14$``,.````#@#FT]X```$5!``#$@````Y`YM/>0``
XM!%0```"@````(```!$@````(```$3````(D````)```$5!``#'@````-`IL*
XM````!&P!```*`0``#0``!%0!``";`0``&P``!$P```#_````?P``!%00``RL
XM````+0.;3VX```1T$``,T!``#,P0``S($``,Q`*;00`"FU,``IM7``*;4P``
XM``1T$``,]!``#/`0``SL$``,Z`*;0@`"FU0``IM8``*;5`````1T$``-&!``
XM#100``T0$``-#`*;0P`"FU4``IM9``*;50````1T$``-/!``#3@0``TT$``-
XM,`*;1``"FU8``IM:``*;5@````1,$``-4!``#4P#FS!^!)LQ,'X```````1,
XM$``-:!``#60#FS%^!)LQ,7X```````1,$``-@!``#7P#FS)^!)LQ,GX`````
XM``1,$``-F!``#90#FS-^!)LQ,WX```````1,$``-L!``#:P#FS1^!)LQ-'X`
XM``````1,$``-R!``#<0#FS5^!)LQ-7X```````1,$``-X!``#=P#FS9^!)LQ
XM-GX```````1,$``-^!``#?0#FS=^!)LQ-WX```````1,$``.$!``#@P#FSA^
XM!)LQ.'X```````1,$``.*!``#B0#FSE^!)LQ.7X```````1<$``.2!``#D0`
XM```H````/0.;3U`#FV]P```$7!``#F00``Y@````*0```#T#FT]1`YMO<0``
XM!%P0``Z`$``.?````%P````O`YM/4@.;;W(```1<$``.G!``#I@````J````
XM*@.;3U,#FV]S```$5!``#JP````K`YM/;```!$P1``[$$0`.O`2;/S!^````
XM!)L_,7X```````14<````&``#4``````````````!%1P````8``-6```````
XM```````$5'````!@``UP``````````````14<````&``#8@`````````````
XM!%1P````8``-H``````````````$5'````!@``VX``````````````14<```
XM`&``#=``````````````!%1P````8``-Z``````````````$5'````!@``X`
X<``````````````14<````&``#A@`````````````
X`
Xend
SHAR_EOF
$TOUCH -am 0831210792 keymap &&
chmod 0644 keymap ||
echo "restore of keymap failed"
set `wc -c keymap`;Wc_c=$1
if test "$Wc_c" != "3988"; then
	echo original size 3988, current size $Wc_c
fi
exit 0
--
"Have a Nice Day."
--
Frank "Crash" Edwards            King Marine Electronics, Inc.
Home: 813/786-3675               Work: 813/530-3411
    Finish the sentence below in 25 words or less:
	    "Love is what you feel just before you give someone a good..."
    Mail your answer along with the top half of your supervisor to:
	    Love is...
	    P.O. Box 35
	    Baffled Greek, Michigan 69069
-- 
Frank "Crash" Edwards            King Marine Electronics, Inc.
Home: 813/786-3675               Work: 813/530-3411

    Finish the sentence below in 25 words or less:
	    "Love is what you feel just before you give someone a good..."
    Mail your answer along with the top half of your supervisor to:
	    Love is...
	    P.O. Box 35
	    Baffled Greek, Michigan 69069
Newsgroups: comp.unix.amiga