--- np2/sound/fmtimer.c 2003/11/14 10:04:56 1.4 +++ np2/sound/fmtimer.c 2004/02/03 08:24:40 1.8 @@ -1,12 +1,12 @@ #include "compiler.h" -#include "i286.h" +#include "cpucore.h" #include "pccore.h" #include "iocore.h" #include "sound.h" #include "fmboard.h" -static const BYTE irqtable[4] = {0x03, 0x0d, 0x0a, 0x0c}; +static const UINT8 irqtable[4] = {0x03, 0x0d, 0x0a, 0x0c}; void fmport_a(NEVENTITEM item) { @@ -66,11 +66,11 @@ static void set_fmtimeraevent(BOOL absol SINT32 l; l = 18 * (1024 - fmtimer.timera); - if (pc.cpumode & CPUMODE_8MHz) { // 4MHz - l = (l * 1248 / 625) * pc.multiple; + if (pccore.cpumode & CPUMODE_8MHz) { // 4MHz + l = (l * 1248 / 625) * pccore.multiple; } - else { // 5MHz - l = (l * 1536 / 625) * pc.multiple; + else { // 5MHz + l = (l * 1536 / 625) * pccore.multiple; } nevent_set(NEVENT_FMTIMERA, l, fmport_a, absolute); } @@ -80,33 +80,27 @@ static void set_fmtimerbevent(BOOL absol SINT32 l; l = 288 * (256 - fmtimer.timerb); - if (pc.cpumode & CPUMODE_8MHz) { // 4MHz - l = (l * 1248 / 625) * pc.multiple; + if (pccore.cpumode & CPUMODE_8MHz) { // 4MHz + l = (l * 1248 / 625) * pccore.multiple; } - else { // 5MHz - l = (l * 1536 / 625) * pc.multiple; + else { // 5MHz + l = (l * 1536 / 625) * pccore.multiple; } nevent_set(NEVENT_FMTIMERB, l, fmport_b, absolute); } -void fmtimer_reset(BYTE irq) { +void fmtimer_reset(UINT irq) { ZeroMemory(&fmtimer, sizeof(fmtimer)); - -#if 0 // move - fmtimer.reg = 0x3f; - set_fmtimeraevent(NEVENT_ABSOLUTE); - set_fmtimerbevent(NEVENT_ABSOLUTE); -#endif fmtimer.intr = irq & 0xc0; fmtimer.intdisabel = irq & 0x10; fmtimer.irq = irqtable[irq >> 6]; - pic_registext(fmtimer.irq); +// pic_registext(fmtimer.irq); } -void fmtimer_setreg(BYTE reg, BYTE value) { +void fmtimer_setreg(REG8 reg, REG8 value) { -// TRACEOUT(("fm %x %x [%.4x:%.4x]", reg, value, I286_CS, I286_IP)); +// TRACEOUT(("fm %x %x [%.4x:%.4x]", reg, value, CPU_CS, CPU_IP)); switch(reg) { case 0x24: @@ -122,7 +116,6 @@ void fmtimer_setreg(BYTE reg, BYTE value break; case 0x27: -#if 1 fmtimer.reg = value; fmtimer.status &= ~((value & 0x30) >> 4); if (value & 0x01) { @@ -144,16 +137,6 @@ void fmtimer_setreg(BYTE reg, BYTE value if (!(value & 0x03)) { pic_resetirq(fmtimer.irq); } -#else - fmtimer.reg = value; - fmtimer.status &= ~((value & 0x30) >> 4); - if ((value & 0x10) && (!nevent_iswork(NEVENT_FMTIMERA))) { - set_fmtimeraevent(NEVENT_ABSOLUTE); - } - if ((value & 0x20) && (!nevent_iswork(NEVENT_FMTIMERB))) { - set_fmtimerbevent(NEVENT_ABSOLUTE); - } -#endif break; } }