1
0
Fork 0

small keyboard fix. typerate handling (Moe)

Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@2022
This commit is contained in:
Peter Veenstra 2004-10-12 16:21:22 +00:00
parent b00484d130
commit bb2d24b081
2 changed files with 24 additions and 5 deletions

View file

@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: keyboard.cpp,v 1.28 2004-09-10 22:15:20 harekiet Exp $ */
/* $Id: keyboard.cpp,v 1.29 2004-10-12 16:21:22 qbix79 Exp $ */
#include <string.h>
#include <assert.h>
@ -136,7 +136,7 @@ static void write_p60(Bitu port,Bitu val,Bitu iolen) {
break;
case 0xf5: /* Reset keyboard and disable scanning */
LOG(LOG_KEYBOARD,LOG_NORMAL)("Reset, disable scanning");
keyb.scanning=false;
keyb.scanning=false;
KEYBOARD_AddBuffer(0xfa); /* Acknowledge */
break;
case 0xf6: /* Reset keyboard and enable scanning */
@ -153,7 +153,18 @@ static void write_p60(Bitu port,Bitu val,Bitu iolen) {
case CMD_SETOUTPORT:
MEM_A20_Enable((val & 2)>0);
break;
case CMD_SETTYPERATE:
case CMD_SETTYPERATE:
{
static const int delay[] = { 250, 500, 750, 1000 };
static const int repeat[] =
{ 33,37,42,46,50,54,58,63,67,75,83,92,100,
109,118,125,133,149,167,182,200,217,233,
250,270,303,333,370,400,435,476,500 };
keyb.repeat.pause = delay[(val>>5)&3];
keyb.repeat.rate = repeat[val&0x1f];
keyb.command=CMD_NONE;
}
/* Fallthrough! as setleds does what we want */
case CMD_SETLEDS:
keyb.command=CMD_NONE;
KEYBOARD_ClrBuffer();

View file

@ -400,11 +400,19 @@ static Bitu INT16_Handler(void) {
reg_al=mem_readb(BIOS_KEYBOARD_FLAGS1);
break;
case 0x03: /* SET TYPEMATIC RATE AND DELAY */
LOG(LOG_BIOS,LOG_ERROR)("INT16:Unhandled Typematic Rate Call %2X BX=%X",reg_al,reg_bx);
if (reg_al == 0x00) { // set default delay and rate
IO_Write(0x60,0xf3);
IO_Write(0x60,0x20); // 500 msec delay, 30 cps
} else if (reg_al == 0x05) { // set repeat rate and delay
IO_Write(0x60,0xf3);
IO_Write(0x60,(reg_bh&3)<<5|(reg_bl&0x1f));
} else {
LOG(LOG_BIOS,LOG_ERROR)("INT16:Unhandled Typematic Rate Call %2X BX=%X",reg_al,reg_bx);
}
break;
case 0x05: /* STORE KEYSTROKE IN KEYBOARD BUFFER */
//TODO make add_key bool :)
add_key(reg_ax);
add_key(reg_cx);
reg_al=0;
break;
case 0x12: /* GET EXTENDED SHIFT STATES */