summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2008-04-02 08:33:39 +0000
committer Aaron Giles <aaron@aarongiles.com>2008-04-02 08:33:39 +0000
commitf8c51f9a23d04b2cc01619af95f3363c183b61ae (patch)
tree347ceec6c871c6b897266630c108e2b4ad4caa2b
parentbddaca5de292d9c2177bbbacdfa85224f2763b01 (diff)
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.
-rw-r--r--src/mame/machine/pcshare.c34
1 files changed, 27 insertions, 7 deletions
diff --git a/src/mame/machine/pcshare.c b/src/mame/machine/pcshare.c
index a4bda348771..114d00ab790 100644
--- a/src/mame/machine/pcshare.c
+++ b/src/mame/machine/pcshare.c
@@ -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;
+ }
+ }
}
}
}