Fixed keyboard in Windows NT.
This commit is contained in:
parent
18512b310f
commit
7dfce428f2
2 changed files with 13 additions and 8 deletions
|
|
@ -36,6 +36,8 @@ struct
|
||||||
|
|
||||||
uint8_t key_command;
|
uint8_t key_command;
|
||||||
int key_wantdata;
|
int key_wantdata;
|
||||||
|
|
||||||
|
int last_irq;
|
||||||
} keyboard_at;
|
} keyboard_at;
|
||||||
|
|
||||||
static uint8_t key_ctrl_queue[16];
|
static uint8_t key_ctrl_queue[16];
|
||||||
|
|
@ -50,22 +52,24 @@ int mouse_queue_start = 0, mouse_queue_end = 0;
|
||||||
void keyboard_at_poll()
|
void keyboard_at_poll()
|
||||||
{
|
{
|
||||||
keybsenddelay += (1000 * TIMER_USEC);
|
keybsenddelay += (1000 * TIMER_USEC);
|
||||||
if (keyboard_at.wantirq)
|
if (keyboard_at.out_new != -1)
|
||||||
{
|
{
|
||||||
keyboard_at.wantirq = 0;
|
keyboard_at.wantirq = 0;
|
||||||
picint(2);
|
if (keyboard_at.mem[0] & 0x01)
|
||||||
if (keyboard_at.out_new != -1)
|
picint(2);
|
||||||
keyboard_at.out = keyboard_at.out_new;
|
keyboard_at.out = keyboard_at.out_new;
|
||||||
keyboard_at.out_new = -1;
|
keyboard_at.out_new = -1;
|
||||||
keyboard_at.status |= STAT_OFULL;
|
keyboard_at.status |= STAT_OFULL;
|
||||||
keyboard_at.status &= ~STAT_IFULL;
|
keyboard_at.status &= ~STAT_IFULL;
|
||||||
// pclog("keyboard_at : take IRQ\n");
|
// pclog("keyboard_at : take IRQ\n");
|
||||||
|
keyboard_at.last_irq = 2;
|
||||||
}
|
}
|
||||||
else if (keyboard_at.wantirq12)
|
else if (keyboard_at.wantirq12)
|
||||||
{
|
{
|
||||||
keyboard_at.wantirq12 = 0;
|
keyboard_at.wantirq12 = 0;
|
||||||
picint(0x1000);
|
picint(0x1000);
|
||||||
// pclog("keyboard_at : take IRQ 12\n");
|
// pclog("keyboard_at : take IRQ 12\n");
|
||||||
|
keyboard_at.last_irq = 0x1000;
|
||||||
}
|
}
|
||||||
if (!(keyboard_at.status & STAT_OFULL) && !(keyboard_at.mem[0] & 0x10) &&
|
if (!(keyboard_at.status & STAT_OFULL) && !(keyboard_at.mem[0] & 0x10) &&
|
||||||
mouse_queue_start != mouse_queue_end)
|
mouse_queue_start != mouse_queue_end)
|
||||||
|
|
@ -84,8 +88,6 @@ void keyboard_at_poll()
|
||||||
keyboard_at.out_new = key_queue[key_queue_start];
|
keyboard_at.out_new = key_queue[key_queue_start];
|
||||||
// pclog("Reading %02X from the key queue at %i\n", keyboard_at.out, key_queue_start);
|
// pclog("Reading %02X from the key queue at %i\n", keyboard_at.out, key_queue_start);
|
||||||
key_queue_start = (key_queue_start + 1) & 0xf;
|
key_queue_start = (key_queue_start + 1) & 0xf;
|
||||||
if (keyboard_at.mem[0] & 0x01)
|
|
||||||
keyboard_at.wantirq = 1;
|
|
||||||
}
|
}
|
||||||
else if (keyboard_at.out_new == -1 && !(keyboard_at.status & STAT_OFULL) &&
|
else if (keyboard_at.out_new == -1 && !(keyboard_at.status & STAT_OFULL) &&
|
||||||
key_ctrl_queue_start != key_ctrl_queue_end)
|
key_ctrl_queue_start != key_ctrl_queue_end)
|
||||||
|
|
@ -93,8 +95,6 @@ void keyboard_at_poll()
|
||||||
keyboard_at.out_new = key_ctrl_queue[key_ctrl_queue_start];
|
keyboard_at.out_new = key_ctrl_queue[key_ctrl_queue_start];
|
||||||
// pclog("Reading %02X from the key ctrl_queue at %i\n", keyboard_at.out, key_ctrl_queue_start);
|
// pclog("Reading %02X from the key ctrl_queue at %i\n", keyboard_at.out, key_ctrl_queue_start);
|
||||||
key_ctrl_queue_start = (key_ctrl_queue_start + 1) & 0xf;
|
key_ctrl_queue_start = (key_ctrl_queue_start + 1) & 0xf;
|
||||||
if (keyboard_at.mem[0] & 0x01)
|
|
||||||
keyboard_at.wantirq = 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -411,6 +411,8 @@ uint8_t keyboard_at_read(uint16_t port, void *priv)
|
||||||
case 0x60:
|
case 0x60:
|
||||||
temp = keyboard_at.out;
|
temp = keyboard_at.out;
|
||||||
keyboard_at.status &= ~(STAT_OFULL | STAT_MFULL);
|
keyboard_at.status &= ~(STAT_OFULL | STAT_MFULL);
|
||||||
|
picintc(keyboard_at.last_irq);
|
||||||
|
keyboard_at.last_irq = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x61:
|
case 0x61:
|
||||||
|
|
@ -436,6 +438,7 @@ void keyboard_at_reset()
|
||||||
keyboard_at.output_port = 0;
|
keyboard_at.output_port = 0;
|
||||||
keyboard_at.input_port = 0xb0;
|
keyboard_at.input_port = 0xb0;
|
||||||
keyboard_at.out_new = -1;
|
keyboard_at.out_new = -1;
|
||||||
|
keyboard_at.last_irq = 0;
|
||||||
|
|
||||||
keyboard_at.key_wantdata = 0;
|
keyboard_at.key_wantdata = 0;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -289,6 +289,8 @@ void picintlevel(uint16_t num)
|
||||||
void picintc(uint16_t num)
|
void picintc(uint16_t num)
|
||||||
{
|
{
|
||||||
int c = 0;
|
int c = 0;
|
||||||
|
if (!num)
|
||||||
|
return;
|
||||||
while (!(num & (1 << c))) c++;
|
while (!(num & (1 << c))) c++;
|
||||||
if (AT && c == 2)
|
if (AT && c == 2)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue