From a02b03cd47ed8c45b0ba027ce5e0ab440050f060 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Strohh=C3=A4cker?= Date: Thu, 11 Jan 2007 18:08:54 +0000 Subject: [PATCH] Add beta2 patch: remove zero-entries when scanning for available keys in CON Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@2754 --- src/dos/dev_con.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/dos/dev_con.h b/src/dos/dev_con.h index 040a054d..5ce1bdc6 100644 --- a/src/dos/dev_con.h +++ b/src/dos/dev_con.h @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: dev_con.h,v 1.27 2007-01-08 19:45:39 qbix79 Exp $ */ +/* $Id: dev_con.h,v 1.28 2007-01-11 18:08:54 c2woody Exp $ */ #include "dos_inc.h" #include "../ints/int10.h" @@ -369,8 +369,16 @@ Bit16u device_CON::GetInformation(void) { Bit16u head=mem_readw(BIOS_KEYBOARD_BUFFER_HEAD); Bit16u tail=mem_readw(BIOS_KEYBOARD_BUFFER_TAIL); - if ((head==tail) && !readcache) return 0x80D3; /* No Key Available */ - return 0x8093; /* Key Available */ + if ((head==tail) && !readcache) return 0x80D3; /* No Key Available */ + if (real_readw(0x40,head)) return 0x8093; /* Key Available */ + + /* remove the zero from keyboard buffer */ + Bit16u start=mem_readw(BIOS_KEYBOARD_BUFFER_START); + Bit16u end =mem_readw(BIOS_KEYBOARD_BUFFER_END); + head+=2; + if (head>=end) head=start; + mem_writew(BIOS_KEYBOARD_BUFFER_HEAD,head); + return 0x80D3; /* No Key Available */ }; device_CON::device_CON() {