From adc772829183a8edd0b223ca6badbe35836e8a86 Mon Sep 17 00:00:00 2001 From: SarahW Date: Wed, 19 Apr 2017 17:46:35 +0100 Subject: [PATCH] Set mono/colour bit correctly in AT keyboard input port. Keyboard controller queue now has priority over key queue. Fixes 'display type not set' errors on several machines when using MDA/Hercules. --- src/keyboard_at.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/keyboard_at.c b/src/keyboard_at.c index edf2a00..135ebe6 100644 --- a/src/keyboard_at.c +++ b/src/keyboard_at.c @@ -93,7 +93,13 @@ void keyboard_at_poll() } } - if (!(keyboard_at.status & STAT_OFULL) && keyboard_at.out_new == -1 && /*!(keyboard_at.mem[0] & 0x20) &&*/ + if (keyboard_at.out_new == -1 && !(keyboard_at.status & STAT_OFULL) && + key_ctrl_queue_start != key_ctrl_queue_end) + { + keyboard_at.out_new = key_ctrl_queue[key_ctrl_queue_start]; + key_ctrl_queue_start = (key_ctrl_queue_start + 1) & 0xf; + } + else if (!(keyboard_at.status & STAT_OFULL) && keyboard_at.out_new == -1 && /*!(keyboard_at.mem[0] & 0x20) &&*/ mouse_queue_start != mouse_queue_end) { keyboard_at.out_new = mouse_queue[mouse_queue_start] | 0x100; @@ -105,12 +111,6 @@ void keyboard_at_poll() keyboard_at.out_new = key_queue[key_queue_start]; key_queue_start = (key_queue_start + 1) & 0xf; } - else if (keyboard_at.out_new == -1 && !(keyboard_at.status & STAT_OFULL) && - key_ctrl_queue_start != key_ctrl_queue_end) - { - keyboard_at.out_new = key_ctrl_queue[key_ctrl_queue_start]; - key_ctrl_queue_start = (key_ctrl_queue_start + 1) & 0xf; - } } void keyboard_at_adddata(uint8_t val) @@ -487,7 +487,7 @@ void keyboard_at_reset() keyboard_at.mem[0] = 0x11; keyboard_at.wantirq = 0; keyboard_at.output_port = 0xcf; - keyboard_at.input_port = 0xb0; + keyboard_at.input_port = (MDA) ? 0xf0 : 0xb0; keyboard_at.out_new = -1; keyboard_at.last_irq = 0;