[comp.binaries.ibm.pc] 256 key type-ahead buffer for PC's

sic@ritcsh.UUCP (Eric A. Neulight) (08/28/88)

[
Yet another type-ahead buffer expansion program.  This is a shar
archive that yields the assembly language source and a uuencoded
executable.  Received via path uunet!ccicpg!cci632!ritcsh!sic.
-- R.D.
]

"256keys" is a little program I whipped up when I got tired of the PC beeping
 at me just because I type faster than it thinks.  It creates a 256 key
 type-ahead buffer.  I have found it to work on just about every generic PC.

I do not think I need to profess the utility of a nice keyboard type-ahead
 buffer.  If you examine the assembler source which I have included, you
 will see that there is nothing esoteric or mystical here.  BIOS keeps
 keyboard FIFO pointers in its data segment (0040h).  All that the program
 does is take memory for a larger FIFO buffer, and if it is allocated within
 segment 0040h (addressable by BIOS key routines), it initializes new BIOS
 key buffer pointers, and "terminates and stays resident".

256keys.com is uuencoded.  Just uudecode it, and run it.  It will attempt
 to install itself.  As it says in the program comments, your best bet
 for having it install successfully at seg 40h is to run it as the first
 program upon booting the machine.  If it cannot install at seg 40h, it will
 tell you.  If it is already installed, it will tell you.

If for some reason you wish to compile your own (maybe the uuencoded file
 got munched, or god forbid you don't have uudecode), do the following:

	 masm 256keys;
	 link 256keys;
	 exe2bin 256keys;
	 del 256keys.exe
	 rename 256keys.bin 256keys.com

Happy Hacking!
(what else can you do with an (ack) Intel Processor)
(and don't mind the copyright notice, that's just hype.)

==============================================================================
CLAIMER:  Well -- I wrote it!                      Eric Alan Neulight
"INSANITY is just a state of mine."              Electrical Engineering
"Nothing is Impossible -- Just Impractical."     Computer Science House
                                            Rochester Institute of Technology
    BITNET: EAN4762@RITVAX       UUCP: ...!rutgers!rochester!ritcv!ritcsh!sic
==============================================================================

#--------------------------------CUT HERE-------------------------------------
#! /bin/sh
#
# This is a shell archive.  Save this into a file, edit it
# and delete all lines above this comment.  Then give this
# file to sh by executing the command "sh file".  The files
# will be extracted into the current directory owned by
# you with default permissions.
#
# The files contained herein are:
#
# -rw-------   1 root     root        4578 Aug 15 18:44 256keys.asm
# -rw-------   1 root     root        1064 Aug 15 18:44 256keys.uu
#
echo 'x - 256keys.asm'
if test -f 256keys.asm; then echo 'shar: not overwriting 256keys.asm'; else
sed 's/^X//' << '________This_Is_The_END________' > 256keys.asm
X;=============================================================================;
X;+---------------------------------------------------------------------------+;
X;|									     |;
X;|  256keys.asm  --  256 key typeahead buffer for IBM compatible BIOS.	     |;
X;|									     |;
X;|  Created by:     Eric A. Neulight			  3417 Birch Circle  |;
X;|  Creation Date:  July 8, 1987			  Allentown, PA      |;
X;|									     |;
X;|		      (c) 1987	All Rights Reserved			     |;
X;+---------------------------------------------------------------------------+;
X;|			      Revision History				     |;
X;|									     |;
X;|			       Revisions End				     |;
X;+---------------------------------------------------------------------------+;
X;| Notes:								     |;
X;|     1.  This module was created to be run as a .com file.		     |;
X;|	    Be sure to run exe2bin after compiling and linking. 	     |;
X;+---------------------------------------------------------------------------+;
X;=============================================================================;
X		name	keys256
X
X;=============================================================================;
XKEYS256_CODE	segment word public 'CODE'
X		assume	cs:KEYS256_CODE
X
X;=============================================================================;
X;-----------------------------------------------------------------------------;
X;  This module installs a large typeahead buffer into BIOS, replacing	      ;
X;   BIOS' measly 16 key typeahead.  The only limitation of this is caused     ;
X;   by BIOS itself, in that the newly allocated buffer must reside within     ;
X;   the BIOS data area, i.e. segment 40h.				      ;
X;									      ;
X;  The install module will ensure that the buffer lives within segment 40h.   ;
X;   Most BIOS will allow this.	For the greatest chance of successful	      ;
X;   installation, and protection against corruption, run this as the first    ;
X;   "terminate and stay resident" program upon booting.                       ;
X;-----------------------------------------------------------------------------;
X
X;-----------------------------------------------------------------------------;
X; .com module must have runnable code at 100h in code segment.		      ;
X;-----------------------------------------------------------------------------;
X		org	100h
Xxinstall:	jmp	install
X
X;-----------------------------------------------------------------------------;
X;  declaration for memory to hold 256 key typeahead fifo.		      ;
X;-----------------------------------------------------------------------------;
X		even
Xkey_buf 	dw	256 dup (0)
X
Xprotect:
X
X
X;-----------------------------------------------------------------------------;
X;  various messages used during installation.				      ;
X;-----------------------------------------------------------------------------;
Xresid$		db	0Dh,0Ah,'256 Key Buffer Is Now Installed',0Dh,0Ah,'$'
Xnores$		db	0Dh,0Ah,'256 Key Buffer Is Already Installed',0Dh,0Ah,'$'
Xnomem$		db	0Dh,0Ah,'Cannot Locate 256 Key Buffer At Segment 40h',0Dh,0Ah,'$'
X
X
X;-----------------------------------------------------------------------------;
X;  installation routine.
X;-----------------------------------------------------------------------------;
Xinstall:
X		mov	ax,40h
X		mov	ds,ax			;address bios data area.
X		cmp	word ptr ds:[80h],1eh	;already installed?
X		jnz	exit			;jump if installed.
X
X		mov	ax,cs			;check addressability.
X		sub	ax,40h			;must be able to locate
X		cmp	ax,0FE0h		; within segment 0040h.
X		ja	exit1			;jump if cannot locate.
X		mov	cl,4
X		shl	ax,cl
X		add	ax,offset key_buf
X		jc	exit1			;jump if cannot locate.
X		cmp	ax,0FE00h		;enough room for buffer?
X		ja	exit1			;jump if cannot locate.
X
X		cli				;able to locate.
X		mov	ds:[1Ah],ax		;install new fifo head ptr.
X		mov	ds:[1Ch],ax		;install new fifo tail ptr.
X		mov	ds:[80h],ax		;install new buf bottom ptr.
X		add	ax,256*2		;calculate buffer top.
X		mov	ds:[82h],ax		;install new buf top ptr.
X		sti
X
X		mov	ah,9
X		mov	dx,cs
X		mov	ds,dx
X		mov	dx,offset resid$
X		int	21h			;display success message.
X
X		mov	dx,offset protect	;terminate and stay resident
X		int	27h
X
Xexit:		mov	ah,9
X		mov	dx,cs
X		mov	ds,dx
X		mov	dx,offset nores$
X		int	21h			;display already installed.
X		jmp	short termin
X
Xexit1:		mov	ah,9
X		mov	dx,cs
X		mov	ds,dx
X		mov	dx,offset nomem$
X		int	21h			;display cannot locate.
X
Xtermin: 	mov	ax,4C00h
X		int	21h			;terminate normally
X
X;=============================================================================;
XKEYS256_code	ends
X
X;=============================================================================;
X		end	xinstall
________This_Is_The_END________
if test `wc -l < 256keys.asm` -ne 119; then
	echo 'shar: 256keys.asm was damaged during transit (should have been 119 bytes)'
fi
fi		; : end of overwriting check
echo 'x - 256keys.uu'
if test -f 256keys.uu; then echo 'shar: not overwriting 256keys.uu'; else
sed 's/^X//' << '________This_Is_The_END________' > 256keys.uu
Xbegin 644 256keys.com
XMZ7T"D```````````````````````````````````````````````````````K
XM`````````````````````````````````````````````````````````````
XM`````````````````````````````````````````````````````````````
XM`````````````````````````````````````````````````````````````
XM`````````````````````````````````````````````````````````````
XM`````````````````````````````````````````````````````````````
XM`````````````````````````````````````````````````````````````
XM`````````````````````````````````````````````````````````````
XM`````````````````````````````````````````````````````````````
XM`````````````````````````````````````````````````````````````
XM`````````````````````````````````````````````````````````````
XM````````````````````````````#0HR-38@2V5Y($)U9F9E<B!)<R!.;W<@5
XM26YS=&%L;&5D#0HD#0HR-38@2V5Y($)U9F9E<B!)<R!!;')E861Y($EN<W1A'
XM;&QE9`T*)`T*0V%N;F]T($QO8V%T92`R-38@2V5Y($)U9F9E<B!!="!396=MQ
XM96YT(#0P:`T*)+A``([8@SZ``!YU.8S(+4``/>`/=SRQ!-/@!00!<C,]`/YW@
XM+OJC&@"C'`"C@``%``*C@@#[M`F,RH[:N@0#S2&Z!`/-)[0)C,J.VKHH`\TAE
X2ZPNT"8S*CMJZ4`/-(;@`3,TA^
X``
Xend
________This_Is_The_END________
if test `wc -l < 256keys.uu` -ne 20; then
	echo 'shar: 256keys.uu was damaged during transit (should have been 20 bytes)'
fi
fi		; : end of overwriting check
exit 0