summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
authorjlemon <jlemon@FreeBSD.org>1998-01-21 21:37:02 +0000
committerjlemon <jlemon@FreeBSD.org>1998-01-21 21:37:02 +0000
commit0753479b42c8155c9ad7579a994d17ca5ff74f27 (patch)
tree38f3184125acb0b0dcc19bae38a07c736868f071 /usr.bin
parentd7243159f20f119d7979facd87717fafce02ae55 (diff)
downloadFreeBSD-src-0753479b42c8155c9ad7579a994d17ca5ff74f27.zip
FreeBSD-src-0753479b42c8155c9ad7579a994d17ca5ff74f27.tar.gz
Fix DOS keyboard handling to use standard pointer addresses instead of
an index into a private array. Submitted by: Randall Hopper <rhh@ct.picker.com>
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/doscmd/tty.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/usr.bin/doscmd/tty.c b/usr.bin/doscmd/tty.c
index f5ef92e..566aa06 100644
--- a/usr.bin/doscmd/tty.c
+++ b/usr.bin/doscmd/tty.c
@@ -29,7 +29,7 @@
*
* BSDI tty.c,v 2.4 1996/04/08 22:03:27 prb Exp
*
- * $Id: tty.c,v 1.1 1997/08/09 01:43:03 dyson Exp $
+ * $Id: tty.c,v 1.2 1997/08/16 00:16:48 jlemon Exp $
*/
#ifndef NO_X
@@ -167,6 +167,7 @@ u_short read_raw_kbd(int fd, u_short *code);
#define K_BUFENDP *(u_short *)0x482
#define K_BUFSTART ((u_short *)(0x400 + *(u_short *)0x480))
#define K_BUFEND ((u_short *)(0x400 + *(u_short *)0x482))
+#define K_BUF(i) *((u_short *)((u_char *)0x400 + (i)))
#define K1_STATUS BIOSDATA[0x17]
#define K1_RSHIFT 0x01
@@ -1579,7 +1580,7 @@ tty_report(int *r, int *c)
void
tty_flush()
{
- K_NEXT = K_FREE = 0;
+ K_NEXT = K_FREE = K_BUFSTARTP;
}
void
@@ -1911,37 +1912,44 @@ KbdEmpty()
void
KbdWrite(u_short code)
{
- int klen = K_BUFEND - K_BUFSTART;
- int kf = (K_FREE + 1) % klen;
+ int kf;
+
+ kf = K_FREE + 2;
+ if (kf == K_BUFENDP)
+ kf = K_BUFSTARTP;
+
if (kf == K_NEXT) {
#ifndef NO_X
XBell(dpy, 0);
#endif
return;
}
- K_BUFSTART[K_FREE] = code;
+ K_BUF(K_FREE) = code;
K_FREE = kf;
}
void
KbdRepl(u_short code)
{
- K_BUFSTART[K_NEXT] = code;
+ K_BUF(K_NEXT) = code;
}
u_short
KbdRead()
{
- int klen = K_BUFEND - K_BUFSTART;
int kf = K_NEXT;
- K_NEXT = (K_NEXT + 1) % klen;
- return(K_BUFSTART[kf]);
+
+ K_NEXT = K_NEXT + 2;
+ if (K_NEXT == K_BUFENDP)
+ K_NEXT = K_BUFSTARTP;
+
+ return(K_BUF(kf));
}
u_short
KbdPeek()
{
- return(K_BUFSTART[K_NEXT]);
+ return(K_BUF(K_NEXT));
}
void int10(REGISTERS);
@@ -1984,7 +1992,7 @@ video_init()
K_BUFSTARTP = 0x1e; /* Start of keyboard buffer */
K_BUFENDP = 0x3e; /* End of keyboard buffer */
- K_NEXT = K_FREE = 0x00;
+ K_NEXT = K_FREE = K_BUFSTARTP;
vec = insert_hardint_trampoline();
ivec[0x09] = vec;
OpenPOWER on IntegriCloud