|
|
| version 1.8, 2003/11/28 08:01:33 | version 1.9, 2003/12/01 17:13:36 |
|---|---|
| Line 10 | Line 10 |
| #include "beep.h" | #include "beep.h" |
| // #define uPD71054 // NP2はuPD8253Cベース | // #define uPD71054 // NP2はuPD8253Cベース |
| #define BEEPCOUNTEREX // BEEPアイドル時のカウンタをα倍に | |
| // --- Interval timer | // --- Interval timer |
| Line 48 void systimer(NEVENTITEM item) { | Line 49 void systimer(NEVENTITEM item) { |
| if (pit.intr[0]) { | if (pit.intr[0]) { |
| pit.intr[0] = 0; | pit.intr[0] = 0; |
| pic_setirq(0); | pic_setirq(0); |
| // TRACEOUT(("int-08 [%.2x]", pit.mode[0])); | |
| } | } |
| if ((pit.mode[0] & 0x0c) == 0x04) { | if ((pit.mode[0] & 0x0c) == 0x04) { |
| // レートジェネレータ | // レートジェネレータ |
| Line 65 void systimer(NEVENTITEM item) { | Line 65 void systimer(NEVENTITEM item) { |
| // --- Beep | // --- Beep |
| #if defined(BEEPCOUNTEREX) | |
| static void setbeepeventex(BOOL absolute) { | |
| UINT32 cnt; | |
| cnt = pit.value[1]; | |
| if (cnt > 2) { | |
| cnt *= pc.multiple; | |
| } | |
| else { | |
| cnt = pc.multiple << 16; | |
| } | |
| while(cnt < 0x100000) { | |
| cnt <<= 1; | |
| } | |
| nevent_set(NEVENT_BEEP, (SINT32)cnt, beeponeshot, absolute); | |
| } | |
| #endif | |
| static void setbeepevent(BOOL absolute) { | static void setbeepevent(BOOL absolute) { |
| SINT32 cnt; | SINT32 cnt; |
| Line 91 void beeponeshot(NEVENTITEM item) { | Line 110 void beeponeshot(NEVENTITEM item) { |
| if (pit.mode[1] & 0x02) | if (pit.mode[1] & 0x02) |
| #endif | #endif |
| { | { |
| #if defined(BEEPCOUNTEREX) | |
| setbeepeventex(NEVENT_RELATIVE); | |
| #else | |
| setbeepevent(NEVENT_RELATIVE); | setbeepevent(NEVENT_RELATIVE); |
| #endif | |
| } | } |
| } | } |
| } | } |
| Line 140 static UINT16 itimer_latch(int ch) { | Line 163 static UINT16 itimer_latch(int ch) { |
| return(pit.value[1] & 0xfffe); | return(pit.value[1] & 0xfffe); |
| #endif | #endif |
| } | } |
| #if defined(BEEPCOUNTEREX) | |
| clock = nevent_getremain(NEVENT_ITIMER + ch); | |
| if (clock < 0) { | |
| return(0); | |
| } | |
| clock /= pc.multiple; | |
| if (pit.value[1] > 2) { | |
| clock %= pit.value[1]; | |
| } | |
| else { | |
| clock >>= 16; | |
| } | |
| return((UINT16)clock); | |
| #endif | |
| } | } |
| clock = nevent_getremain(NEVENT_ITIMER + ch); | clock = nevent_getremain(NEVENT_ITIMER + ch); |
| if (clock >= 0) { | if (clock >= 0) { |