PIT now supports read-back of timer status - Sidewinder Windows 9x driver setup no longer hangs.

This commit is contained in:
SarahW 2016-06-21 21:55:06 +01:00
commit 9021d9f2c2
2 changed files with 29 additions and 1 deletions

View file

@ -227,6 +227,9 @@ typedef struct PIT
int initial[3]; int initial[3];
int latched[3]; int latched[3];
int disabled[3]; int disabled[3];
uint8_t read_status[3];
int do_read_status[3];
} PIT; } PIT;
PIT pit; PIT pit;

View file

@ -336,10 +336,28 @@ void pit_write(uint16_t addr, uint8_t val, void *priv)
if (val & 8) if (val & 8)
pit.rl[2] = pit.using_timer[2] ? ((int)(pit.c[2] / PITCONST) >> TIMER_SHIFT) : pit.count[2]; pit.rl[2] = pit.using_timer[2] ? ((int)(pit.c[2] / PITCONST) >> TIMER_SHIFT) : pit.count[2];
} }
if (!(val & 0x10))
{
if (val & 2)
{
pit.read_status[0] = (pit.ctrls[0] & 0x3f) | 0x40 | (pit.out[0] ? 0x80 : 0);
pit.do_read_status[0] = 1;
}
if (val & 4)
{
pit.read_status[1] = (pit.ctrls[1] & 0x3f) | 0x40 | (pit.out[1] ? 0x80 : 0);
pit.do_read_status[1] = 1;
}
if (val & 8)
{
pit.read_status[2] = (pit.ctrls[2] & 0x3f) | 0x40 | (pit.out[2] ? 0x80 : 0);
pit.do_read_status[2] = 1;
}
}
return; return;
} }
t = val >> 6; t = val >> 6;
pit.ctrls[val>>6]=pit.ctrl=val; pit.ctrl=val;
if ((val>>7)==3) if ((val>>7)==3)
{ {
printf("Bad PIT reg select\n"); printf("Bad PIT reg select\n");
@ -359,6 +377,7 @@ void pit_write(uint16_t addr, uint8_t val, void *priv)
} }
else else
{ {
pit.ctrls[val>>6] = val;
pit.rm[val>>6]=pit.wm[val>>6]=(pit.ctrl>>4)&3; pit.rm[val>>6]=pit.wm[val>>6]=(pit.ctrl>>4)&3;
pit.m[val>>6]=(val>>1)&7; pit.m[val>>6]=(val>>1)&7;
if (pit.m[val>>6]>5) if (pit.m[val>>6]>5)
@ -444,6 +463,12 @@ uint8_t pit_read(uint16_t addr, void *priv)
{ {
case 0: case 1: case 2: /*Timers*/ case 0: case 1: case 2: /*Timers*/
t = addr & 3; t = addr & 3;
if (pit.do_read_status[t])
{
pit.do_read_status[t] = 0;
temp = pit.read_status[t];
break;
}
if (pit.rereadlatch[addr & 3] && !pit.latched[addr & 3]) if (pit.rereadlatch[addr & 3] && !pit.latched[addr & 3])
{ {
pit.rereadlatch[addr & 3] = 0; pit.rereadlatch[addr & 3] = 0;