PIT timers can now be restarted using GATE input - CPU speed detection on SiS496/497 now works.
Added missing port 0x61 to Olivetti M24 - PC speaker now works on that machine. Some code tidying.
This commit is contained in:
parent
a592bd12ee
commit
36cdd540b2
9 changed files with 57 additions and 26 deletions
|
|
@ -1418,10 +1418,11 @@ opcodestart:
|
|||
keyboard_at_poll();
|
||||
}*/
|
||||
|
||||
pit.c[0]-=cycdiff;
|
||||
pit.c[1]-=cycdiff;
|
||||
if (ppi.pb&1) pit.c[2]-=cycdiff;
|
||||
if ((pit.c[0]<1)||(pit.c[1]<1)||(pit.c[2]<1)) pit_poll();
|
||||
pit.c[0] -= cycdiff;
|
||||
pit.c[1] -= cycdiff;
|
||||
if (pit.gate[2]) pit.c[2] -= cycdiff;
|
||||
if ((pit.c[0] < 1) || (pit.c[1] < 1) || (pit.c[2] < 1)) pit_poll();
|
||||
|
||||
timer_clock(cycdiff);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -819,7 +819,7 @@ void clockhardware()
|
|||
current_diff += diff;
|
||||
pit.c[0] -= diff;
|
||||
pit.c[1] -= diff;
|
||||
if (ppi.pb & 1) pit.c[2] -= diff;
|
||||
if (pit.gate[2]) pit.c[2] -= diff;
|
||||
if ((pit.c[0] < 1) || (pit.c[1] < 1) || (pit.c[2] < 1)) pit_poll();
|
||||
|
||||
timer_clock(diff);
|
||||
|
|
|
|||
|
|
@ -198,6 +198,7 @@ typedef struct PIT
|
|||
int thit[3];
|
||||
int delay[3];
|
||||
int rereadlatch[3];
|
||||
int gate[3];
|
||||
} PIT;
|
||||
|
||||
PIT pit;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
#include "io.h"
|
||||
#include "mem.h"
|
||||
#include "pic.h"
|
||||
#include "pit.h"
|
||||
#include "sound.h"
|
||||
#include "timer.h"
|
||||
|
||||
|
|
@ -59,10 +60,7 @@ void keyboard_amstrad_adddata(uint8_t val)
|
|||
void keyboard_amstrad_write(uint16_t port, uint8_t val, void *priv)
|
||||
{
|
||||
pclog("keyboard_amstrad : write %04X %02X %02X\n", port, val, keyboard_amstrad.pb);
|
||||
/* if (ram[8] == 0xc3)
|
||||
{
|
||||
output = 3;
|
||||
}*/
|
||||
|
||||
switch (port)
|
||||
{
|
||||
case 0x61:
|
||||
|
|
@ -75,16 +73,13 @@ void keyboard_amstrad_write(uint16_t port, uint8_t val, void *priv)
|
|||
keyboard_amstrad.pb = val;
|
||||
ppi.pb = val;
|
||||
|
||||
/* if (AMSTRADIO)
|
||||
keyboard_amstrad.s2 = val & 4;
|
||||
else
|
||||
keyboard_amstrad.s2 = val & 8;*/
|
||||
gated = ((val & 3) == 3);
|
||||
if (gated)
|
||||
wasgated = 1;
|
||||
|
||||
wasgated = 1;
|
||||
pit_set_gate(2, val & 1);
|
||||
|
||||
if (val & 0x80)
|
||||
keyboard_amstrad.pa = 0;
|
||||
keyboard_amstrad.pa = 0;
|
||||
break;
|
||||
|
||||
case 0x63:
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
#include "io.h"
|
||||
#include "mem.h"
|
||||
#include "pic.h"
|
||||
#include "pit.h"
|
||||
#include "sound.h"
|
||||
#include "timer.h"
|
||||
|
||||
|
|
@ -268,9 +269,11 @@ void keyboard_at_write(uint16_t port, uint8_t val, void *priv)
|
|||
break;
|
||||
|
||||
case 0x61:
|
||||
ppi.pb=val;
|
||||
gated=((val&3)==3);
|
||||
if (gated) wasgated=1;
|
||||
ppi.pb = val;
|
||||
gated = ((val & 3) == 3);
|
||||
if (gated)
|
||||
wasgated = 1;
|
||||
pit_set_gate(2, val & 1);
|
||||
break;
|
||||
|
||||
case 0x64:
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
#include "mem.h"
|
||||
#include "mouse.h"
|
||||
#include "pic.h"
|
||||
#include "sound.h"
|
||||
#include "timer.h"
|
||||
|
||||
#include "keyboard.h"
|
||||
|
|
@ -137,7 +138,16 @@ void keyboard_olim24_write(uint16_t port, uint8_t val, void *priv)
|
|||
}
|
||||
}
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
case 0x61:
|
||||
ppi.pb = val;
|
||||
|
||||
gated = ((val & 3) == 3);
|
||||
if (gated)
|
||||
wasgated = 1;
|
||||
pit_set_gate(2, val & 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -164,6 +174,9 @@ uint8_t keyboard_olim24_read(uint16_t port, void *priv)
|
|||
}
|
||||
break;
|
||||
|
||||
case 0x61:
|
||||
return ppi.pb;
|
||||
|
||||
case 0x64:
|
||||
temp = keyboard_olim24.status;
|
||||
keyboard_olim24.status &= ~(STAT_RTIMEOUT | STAT_TTIMEOUT);
|
||||
|
|
@ -279,7 +292,7 @@ void mouse_olim24_poll(int x, int y, int b)
|
|||
void keyboard_olim24_init()
|
||||
{
|
||||
//return;
|
||||
io_sethandler(0x0060, 0x0001, keyboard_olim24_read, NULL, NULL, keyboard_olim24_write, NULL, NULL, NULL);
|
||||
io_sethandler(0x0060, 0x0002, keyboard_olim24_read, NULL, NULL, keyboard_olim24_write, NULL, NULL, NULL);
|
||||
io_sethandler(0x0064, 0x0001, keyboard_olim24_read, NULL, NULL, keyboard_olim24_write, NULL, NULL, NULL);
|
||||
keyboard_olim24_reset();
|
||||
keyboard_send = keyboard_olim24_adddata;
|
||||
|
|
|
|||
|
|
@ -72,13 +72,11 @@ void keyboard_xt_write(uint16_t port, uint8_t val, void *priv)
|
|||
}
|
||||
keyboard_xt.pb = val;
|
||||
ppi.pb = val;
|
||||
/* if (AMSTRADIO)
|
||||
keyboard_xt.s2 = val & 4;
|
||||
else
|
||||
keyboard_xt.s2 = val & 8;*/
|
||||
|
||||
gated = ((val & 3) == 3);
|
||||
if (gated)
|
||||
wasgated = 1;
|
||||
wasgated = 1;
|
||||
pit_set_gate(2, val & 1);
|
||||
|
||||
if (val & 0x80)
|
||||
{
|
||||
|
|
|
|||
19
src/pit.c
19
src/pit.c
|
|
@ -302,7 +302,26 @@ void pit_poll()
|
|||
}
|
||||
}
|
||||
|
||||
void pit_set_gate(int channel, int gate)
|
||||
{
|
||||
if (gate && !pit.gate[channel])
|
||||
{
|
||||
switch (pit.m[channel])
|
||||
{
|
||||
case 1: /*Hardware retriggerable one-shot*/
|
||||
case 2: /*Rate generator*/
|
||||
case 3: /*Square wave mode*/
|
||||
case 5: /*Hardware triggered strobe (retriggerable)*/
|
||||
pit.c[channel] = pit.l[2] * PITCONST;
|
||||
break;
|
||||
}
|
||||
}
|
||||
pit.gate[channel] = gate;
|
||||
}
|
||||
|
||||
void pit_init()
|
||||
{
|
||||
io_sethandler(0x0040, 0x0004, pit_read, NULL, NULL, pit_write, NULL, NULL, NULL);
|
||||
pit.gate[0] = pit.gate[1] = 1;
|
||||
pit.gate[2] = 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
extern double PITCONST;
|
||||
void pit_init();
|
||||
void pit_reset();
|
||||
void pit_set_gate(int channel, int gate);
|
||||
|
|
|
|||
Loading…
Reference in a new issue