Reverted rev 339. Fixes Adlib Gold jukebox.
Disable PIT timer operation between write of control word and initial count. Lemmings High Performance PC mode now works without incorrect rev 339 commit.
This commit is contained in:
parent
b79be95623
commit
6602a32304
3 changed files with 17 additions and 3 deletions
|
|
@ -214,6 +214,7 @@ typedef struct PIT
|
|||
int using_timer[3];
|
||||
int initial[3];
|
||||
int latched[3];
|
||||
int disabled[3];
|
||||
} PIT;
|
||||
|
||||
PIT pit;
|
||||
|
|
|
|||
|
|
@ -111,13 +111,11 @@ void pic_write(uint16_t addr, uint8_t val, void *priv)
|
|||
if (pic.ins&(1<<c))
|
||||
{
|
||||
pic.ins&=~(1<<c);
|
||||
pic.pend &= ~(1 << c);
|
||||
pic_update_mask(&pic.mask2, pic.ins);
|
||||
|
||||
if (c == 2 && (pic2.pend&~pic2.mask)&~pic2.mask2)
|
||||
pic.pend |= (1 << 2);
|
||||
|
||||
// pic.pend&=~(1<<c);
|
||||
if (c==1 && keywaiting)
|
||||
{
|
||||
intclear&=~1;
|
||||
|
|
|
|||
17
src/pit.c
17
src/pit.c
|
|
@ -87,6 +87,7 @@ static void pit_load(int t)
|
|||
int l = pit.l[t] ? pit.l[t] : 0x10000;
|
||||
timer_process();
|
||||
pit.newcount[t] = 0;
|
||||
pit.disabled[t] = 0;
|
||||
// pclog("pit_load: t=%i l=%x\n", t, l);
|
||||
switch (pit.m[t])
|
||||
{
|
||||
|
|
@ -146,6 +147,10 @@ static void pit_load(int t)
|
|||
void pit_set_gate(int t, int gate)
|
||||
{
|
||||
int l = pit.l[t] ? pit.l[t] : 0x10000;
|
||||
|
||||
if (pit.disabled[t])
|
||||
return;
|
||||
|
||||
timer_process();
|
||||
switch (pit.m[t])
|
||||
{
|
||||
|
|
@ -194,7 +199,14 @@ void pit_set_gate(int t, int gate)
|
|||
static void pit_over(int t)
|
||||
{
|
||||
int l = pit.l[t] ? pit.l[t] : 0x10000;
|
||||
// if (!t) pclog("pit_over: t=%i l=%x c=%x %i\n", t, pit.l[t], pit.c[t], pit.c[t] >> TIMER_SHIFT);
|
||||
if (pit.disabled[t])
|
||||
{
|
||||
pit.count[t] += 0xffff;
|
||||
pit.c[t] += (int)((0xffff << TIMER_SHIFT) * PITCONST);
|
||||
return;
|
||||
}
|
||||
|
||||
// if (!t) pclog("pit_over: t=%i l=%x c=%x %i hit=%i\n", t, pit.l[t], pit.c[t], pit.c[t] >> TIMER_SHIFT, pit.thit[t]);
|
||||
switch (pit.m[t])
|
||||
{
|
||||
case 0: /*Interrupt on terminal count*/
|
||||
|
|
@ -354,6 +366,9 @@ void pit_write(uint16_t addr, uint8_t val, void *priv)
|
|||
pit.initial[t] = 1;
|
||||
if (!pit.m[val >> 6])
|
||||
pit_set_out(val >> 6, 0);
|
||||
else
|
||||
pit_set_out(val >> 6, 1);
|
||||
pit.disabled[val >> 6] = 1;
|
||||
// pclog("ppispeakon %i\n",ppispeakon);
|
||||
}
|
||||
pit.wp=0;
|
||||
|
|
|
|||
Loading…
Reference in a new issue