MS-DOS type-ahead buffer limit?

From: Fred Cisin <cisin_at_xenosoft.com>
Date: Wed Oct 21 12:28:40 1998

On Tue, 20 Oct 1998, Sam Ismail wrote:
> Does anyone know why MS decided to limit the type-ahead buffer in MS-DOS
> to 16 characters? Also, why they never increased this over time?

Actually it was set in the BIOS, not in MS-DOS, but you've probably
already gotten a few responses about that. It consists of 32 bytes (each
"entry" has scan code, AND ASCII code, with "special" keys having 0 for
their ASCII), configured as a circular buffer, with a pair of pointers
("head", "tail") chasing each other round and round. In addition to the
two pointers (NEAR pointers, and therefore 16 bits each), there are also
two 16 bit values for the start and end offset locations of the buffer.

The BIOS code is based on an assumption of it being in segment 40h. If
you want a big buffer anywhere else, then you'll need to redo the code.
But IF you can grab a chunk of memory that is addressable as being in
segment 40h, then all that you need to do is to adjust the four pointers
(head, tail, start, end) to point to YOUR buffer. You won't be able to
have a 64K buffer, but you might be able to make it bigger than you would
want.

TIP: since memory fills with STUFF as you boot, to be able to get some
of segment 40h before it is all gone, CHEAT! Write your routine to load
as if it were a device driver (NOT a command line program) - then you can
grab that memory before anybody else does. There are three types of
device drivers: block (disk like devices), character (stream), and BOGUS
(used for mice drivers, keyboard buffer enhancers, etc.). Yours would
merely need to have it's initialization code grab some RAM, confirm that
it was addressable as segment 40h, and set the four pointers.

The BAD news is that some programs don't have a clue what they are doing,
and when they want to do something trivial like clear the keyboard buffer,
will set the head and tail pointers back to "normal" values.


> Basically on-topic. I really want to know because I've always cursed it.

Hmmm. about the only time that _I_ curse the keyboard buffer is in LOTUS,
where they created their own that is too BIG -- I'm trying to scroll a
long ways, overshoot, try to scroll back, overshoot, etc.

And, yes, the problem has existed more than 10 years.

--
Fred Cisin                      cisin_at_xenosoft.com
XenoSoft                        http://www.xenosoft.com
2210 Sixth St.                  (510) 644-9366
Berkeley, CA 94710-2219
Received on Wed Oct 21 1998 - 12:28:40 BST

This archive was generated by hypermail 2.3.0 : Fri Oct 10 2014 - 23:31:27 BST