--- np2/io/pit.c 2003/12/11 21:57:38 1.11 +++ np2/io/pit.c 2004/01/13 05:30:58 1.14 @@ -3,6 +3,7 @@ // #include "compiler.h" +#include "cpucore.h" #include "pccore.h" #include "iocore.h" #include "sound.h" @@ -18,7 +19,8 @@ // ver0.31 常に回す… static void setsystimerevent_noint(BOOL absolute) { - nevent_set(NEVENT_ITIMER, pc.multiple << 16, systimer_noint, absolute); + nevent_set(NEVENT_ITIMER, pccore.multiple << 16, + systimer_noint, absolute); } void systimer_noint(NEVENTITEM item) { @@ -34,10 +36,10 @@ static void setsystimerevent(BOOL absolu cnt = pit.value[0]; if (cnt > 8) { // 根拠なし - cnt *= pc.multiple; + cnt *= pccore.multiple; } else { - cnt = pc.multiple << 16; + cnt = pccore.multiple << 16; } nevent_set(NEVENT_ITIMER, cnt, systimer, absolute); } @@ -53,10 +55,9 @@ void systimer(NEVENTITEM item) { // レートジェネレータ pit.intr[0] = 1; setsystimerevent(NEVENT_RELATIVE); - TRACEOUT(("intr-next")); } else { - nevent_set(NEVENT_ITIMER, pc.multiple << 16, + nevent_set(NEVENT_ITIMER, pccore.multiple << 16, systimer, NEVENT_RELATIVE); } } @@ -72,10 +73,10 @@ static void setbeepeventex(BOOL absolute cnt = pit.value[1]; if (cnt > 2) { - cnt *= pc.multiple; + cnt *= pccore.multiple; } else { - cnt = pc.multiple << 16; + cnt = pccore.multiple << 16; } while(cnt < 0x100000) { cnt <<= 1; @@ -90,10 +91,10 @@ static void setbeepevent(BOOL absolute) cnt = pit.value[1]; if (cnt > 2) { - cnt *= pc.multiple; + cnt *= pccore.multiple; } else { - cnt = pc.multiple << 16; + cnt = pccore.multiple << 16; } nevent_set(NEVENT_BEEP, cnt, beeponeshot, absolute); } @@ -104,7 +105,7 @@ void beeponeshot(NEVENTITEM item) { if (!(pit.mode[1] & 0x0c)) { // ver0.30 beep_lheventset(0); } -#ifdef uPD71054 +#if defined(uPD71054) if ((pit.mode[1] & 0x06) == 0x02) #else if (pit.mode[1] & 0x02) @@ -127,10 +128,10 @@ static void setrs232cevent(BOOL absolute SINT32 cnt; if (pit.value[2] > 1) { - cnt = pc.multiple * pit.value[2] * rs232c.mul; + cnt = pccore.multiple * pit.value[2] * rs232c.mul; } else { - cnt = (pc.multiple << 16) * rs232c.mul; + cnt = (pccore.multiple << 16) * rs232c.mul; } nevent_set(NEVENT_RS232C, cnt, rs232ctimer, absolute); } @@ -155,7 +156,9 @@ static UINT pit_latch(int ch) { if (ch == 1) { switch(pit.mode[1] & 0x06) { +#ifdef uPD71054 // ? case 0x00: +#endif case 0x04: return(pit.value[1]); #ifdef uPD71054 @@ -168,19 +171,19 @@ static UINT pit_latch(int ch) { if (clock < 0) { return(0); } - clock /= pc.multiple; + clock /= pccore.multiple; if (pit.value[1] > 2) { clock %= pit.value[1]; } else { - clock >>= 16; + clock = LOW16(clock); } return(clock); #endif } clock = nevent_getremain(NEVENT_ITIMER + ch); if (clock >= 0) { - return(clock / pc.multiple); + return(clock / pccore.multiple); } return(0); } @@ -334,7 +337,7 @@ static const IOINP piti71[4] = { void itimer_reset(void) { ZeroMemory(&pit, sizeof(pit)); - if (pc.cpumode & CPUMODE_8MHz) { + if (pccore.cpumode & CPUMODE_8MHz) { pit.value[1] = 998; // 4MHz } else {