Do not modify PC/XT keyboard clock when keyboard is disabled, fixes keyboard input in WordVision, fixes #2701.

This commit is contained in:
OBattler
2022-10-26 18:28:38 +02:00
parent 3102afed76
commit c95d8b2031

View File

@@ -72,7 +72,7 @@ typedef struct {
int blocked; int blocked;
int tandy; int tandy;
uint8_t pa, pb, pd; uint8_t pa, pb, pd, clock;
uint8_t key_waiting; uint8_t key_waiting;
uint8_t type, pravetz_flags; uint8_t type, pravetz_flags;
@@ -514,17 +514,22 @@ static void
kbd_write(uint16_t port, uint8_t val, void *priv) kbd_write(uint16_t port, uint8_t val, void *priv)
{ {
xtkbd_t *kbd = (xtkbd_t *) priv; xtkbd_t *kbd = (xtkbd_t *) priv;
uint8_t bit, set; uint8_t bit, set, new_clock;
switch (port) { switch (port) {
case 0x61: /* Keyboard Control Register (aka Port B) */ case 0x61: /* Keyboard Control Register (aka Port B) */
if (!(kbd->pb & 0x40) && (val & 0x40)) { if (!(val & 0x80)) {
key_queue_start = key_queue_end = 0; new_clock = !!(val & 0x40);
kbd->want_irq = 0; if (!kbd->clock && new_clock) {
kbd->blocked = 0; key_queue_start = key_queue_end = 0;
kbd_adddata(0xaa); kbd->want_irq = 0;
kbd->blocked = 0;
kbd_adddata(0xaa);
}
} }
kbd->pb = val; kbd->pb = val;
if (!(kbd->pb & 0x80))
kbd->clock = !!(kbd->pb & 0x40);
ppi.pb = val; ppi.pb = val;
timer_process(); timer_process();