Minor fixes to keyboard_xt.c.

This commit is contained in:
OBattler
2021-03-29 23:51:20 +02:00
parent 592de50f17
commit 1c5b8099ae

View File

@@ -400,11 +400,11 @@ kbd_poll(void *priv)
kbd->blocked = 1; kbd->blocked = 1;
picint(2); picint(2);
#ifdef ENABLE_KEYBOARD_XT_LOG #ifdef ENABLE_KEYBOARD_XT_LOG
kbd_log("keyboard_xt : take IRQ\n"); kbd_log("kbd_poll(): keyboard_xt : take IRQ\n");
#endif #endif
} }
if (key_queue_start != key_queue_end && !kbd->blocked) { if ((key_queue_start != key_queue_end) && !kbd->blocked) {
kbd->key_waiting = key_queue[key_queue_start]; kbd->key_waiting = key_queue[key_queue_start];
kbd_log("XTkbd: reading %02X from the key queue at %i\n", kbd_log("XTkbd: reading %02X from the key queue at %i\n",
kbd->key_waiting, key_queue_start); kbd->key_waiting, key_queue_start);
@@ -513,6 +513,8 @@ kbd_write(uint16_t port, uint8_t val, void *priv)
kbd->pb = val; kbd->pb = val;
ppi.pb = val; ppi.pb = val;
timer_process();
speaker_update(); speaker_update();
if ((kbd->type <= 1) && !(kbd->pb & 0x08)) if ((kbd->type <= 1) && !(kbd->pb & 0x08))
speaker_gated = speaker_enable = 1; speaker_gated = speaker_enable = 1;
@@ -554,32 +556,33 @@ kbd_read(uint16_t port, void *priv)
switch (port) { switch (port) {
case 0x60: case 0x60:
if ((kbd->type <= 1) && (kbd->pb & 0x80)) if ((kbd->pb & 0x80) && ((kbd->type <= 3) || (kbd->type == 9))) {
ret = (kbd->pd & ~0x02) | (hasfpu ? 0x02 : 0x00); if (kbd->type <= 1)
else if (((kbd->type == 2) || (kbd->type == 3)) && (kbd->pb & 0x80)) ret = (kbd->pd & ~0x02) | (hasfpu ? 0x02 : 0x00);
ret = 0xff; /* According to Ruud on the PCem forum, this is supposed to return 0xFF on the XT. */ else if ((kbd->type == 2) || (kbd->type == 3))
else if ((kbd->type == 9) && (kbd->pb & 0x80)) { ret = 0xff; /* According to Ruud on the PCem forum, this is supposed to return 0xFF on the XT. */
/* Zenith Data Systems Z-151 else if (kbd->type == 9) {
* SW1 switch settings: /* Zenith Data Systems Z-151
* bits 6-7: floppy drive number * SW1 switch settings:
* bits 4-5: video mode * bits 6-7: floppy drive number
* bit 2-3: base memory size * bits 4-5: video mode
* bit 1: fpu enable * bit 2-3: base memory size
* bit 0: fdc enable * bit 1: fpu enable
*/ * bit 0: fdc enable
ret = get_fdd_switch_settings(); */
ret = get_fdd_switch_settings();
ret |= get_videomode_switch_settings(); ret |= get_videomode_switch_settings();
/* base memory size should always be 64k */
ret |= 0x0c;
if (hasfpu) /* Base memory size should always be 64k */
ret |= 0x02; ret |= 0x0c;
} else if (hasfpu)
ret = kbd->pa; ret |= 0x02;
break; }
} else
ret = kbd->pa;
break;
case 0x61: case 0x61:
ret = kbd->pb; ret = kbd->pb;