--- np2/io/pit.c 2003/11/12 20:02:54 1.5 +++ np2/io/pit.c 2003/11/21 06:51:11 1.6 @@ -44,16 +44,18 @@ static void setsystimerevent(BOOL absolu void systimer(NEVENTITEM item) { + if (pit.intr[0]) { + pit.intr[0] = 0; + pic_setirq(0); +// TRACEOUT(("int-08 [%.2x]", pit.mode[0])); + } if (item->flag & NEVENT_SETEVENT) { if ((pit.mode[0] & 0x0c) == 0x04) { // レートジェネレータ - setsystimerevent(NEVENT_RELATIVE); - } - else { - setsystimerevent_noint(NEVENT_RELATIVE); + pit.intr[0] = 1; } + setsystimerevent(NEVENT_RELATIVE); } - pic_setirq(0); } @@ -215,11 +217,12 @@ BYTE itimer_getcount(int ch) { // system timer static void IOOUTCALL pit_o71(UINT port, BYTE dat) { -// TRACEOUT(("pic71: %d", dat)); +// TRACEOUT(("pic o71: %x [%.4x %.4x]", dat, I286_CS, I286_IP)); if (itimer_setcount(0, dat)) { return; } pic.pi[0].irr &= (~1); + pit.intr[0] = 1; setsystimerevent(NEVENT_ABSOLUTE); (void)port; } @@ -256,15 +259,16 @@ static void IOOUTCALL pit_o77(UINT port, int ch; -// TRACEOUT(("pic77: %x", dat)); +// TRACEOUT(("pic o77: %x", dat)); ch = (dat >> 6) & 3; if (ch != 3) { itimer_setflag(ch, dat); if (ch == 0) { // 書込みで itimerのirrがリセットされる… pic.pi[0].irr &= (~1); - if (dat & 0x30) { // 一応ラッチ時は割り込みをセットしない - setsystimerevent(NEVENT_ABSOLUTE); - } +// if (dat & 0x30) { // 一応ラッチ時は割り込みをセットしない + pit.intr[0] = 1; +// setsystimerevent(NEVENT_ABSOLUTE); +// } } if (ch == 1) { beep_modeset(); @@ -275,6 +279,12 @@ static void IOOUTCALL pit_o77(UINT port, static BYTE IOINPCALL pit_i71(UINT port) { + if (port == 0x71) { + BYTE x; + x = itimer_getcount((port >> 1) & 3); +// TRACEOUT(("pic i71 %x [%.4x %.4x]", x, I286_CS, I286_IP)); + return(x); + } return(itimer_getcount((port >> 1) & 3)); }