mirror of
https://github.com/holub/mame
synced 2025-04-21 16:01:56 +03:00
From: Wilbert Pol [mailto:wilbert@jdg.info]
Subject: pcshare.c The attached patch fixes the self-test responses generated by IBM 5150 and XT keyboards for MESS.
This commit is contained in:
parent
bddaca5de2
commit
f8c51f9a23
@ -506,6 +506,7 @@ void init_pc_common(UINT32 flags)
|
||||
static struct {
|
||||
UINT8 data;
|
||||
int on;
|
||||
int self_test;
|
||||
} pc_keyb= { 0 };
|
||||
|
||||
UINT8 pc_keyb_read(void)
|
||||
@ -517,8 +518,14 @@ UINT8 pc_keyb_read(void)
|
||||
|
||||
static TIMER_CALLBACK( pc_keyb_timer )
|
||||
{
|
||||
at_keyboard_reset();
|
||||
pc_keyboard();
|
||||
if ( pc_keyb.on ) {
|
||||
pc_keyb.self_test = ( pc_keyb.self_test == 1 ) ? 2 : 0;
|
||||
pc_keyboard();
|
||||
} else {
|
||||
/* Clock has been low for more than 5 msec, start diagnostic test */
|
||||
at_keyboard_reset();
|
||||
pc_keyb.self_test = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -529,10 +536,18 @@ void pc_keyb_set_clock(int on)
|
||||
|
||||
if (pc_keyb.on != on)
|
||||
{
|
||||
if (on)
|
||||
if (!on)
|
||||
timer_adjust_oneshot(pc_keyboard_timer, ATTOTIME_IN_MSEC(5), 0);
|
||||
else
|
||||
timer_reset(pc_keyboard_timer, attotime_never);
|
||||
else {
|
||||
if ( pc_keyb.self_test == 1 ) {
|
||||
/* The self test of the keyboard takes some time. 2 msec seems to work. */
|
||||
/* This still needs to verified against a real keyboard. */
|
||||
timer_adjust_oneshot(pc_keyboard_timer, ATTOTIME_IN_MSEC( 2 ), 0);
|
||||
} else {
|
||||
timer_reset(pc_keyboard_timer, attotime_never);
|
||||
pc_keyb.self_test = 0;
|
||||
}
|
||||
}
|
||||
|
||||
pc_keyb.on = on;
|
||||
}
|
||||
@ -541,6 +556,7 @@ void pc_keyb_set_clock(int on)
|
||||
void pc_keyb_clear(void)
|
||||
{
|
||||
pc_keyb.data = 0;
|
||||
pic8259_set_irq_line(0, 1, 0);
|
||||
}
|
||||
|
||||
void pc_keyboard(void)
|
||||
@ -554,8 +570,12 @@ void pc_keyboard(void)
|
||||
if ( (data=at_keyboard_read())!=-1) {
|
||||
pc_keyb.data = data;
|
||||
DBG_LOG(1,"KB_scancode",("$%02x\n", pc_keyb.data));
|
||||
pic8259_set_irq_line(0, 1, 1);
|
||||
pic8259_set_irq_line(0, 1, 0);
|
||||
if ( ! ( data & 0x80 ) || pc_keyb.self_test == 2 ) {
|
||||
pic8259_set_irq_line(0, 1, 1);
|
||||
if ( pc_keyb.self_test == 2 ) {
|
||||
pc_keyb.self_test = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user