--- np2/nevent.c 2003/12/01 17:13:36 1.5 +++ np2/nevent.c 2004/02/18 21:58:41 1.8 @@ -1,12 +1,12 @@ #include "compiler.h" -#include "i286.h" +#include "cpucore.h" #include "pccore.h" _NEVENT nevent; -void nevent_init(void) { +void nevent_allreset(void) { // すべてをリセット ZeroMemory(&nevent, sizeof(nevent)); @@ -16,15 +16,15 @@ void nevent_get1stevent(void) { // 最短のイベントのクロック数をセット if (nevent.readyevents) { - I286_BASECLOCK = nevent.item[nevent.level[0]].clock; + CPU_BASECLOCK = nevent.item[nevent.level[0]].clock; } else { // イベントがない場合のクロック数をセット - I286_BASECLOCK = NEVENT_MAXCLOCK; + CPU_BASECLOCK = NEVENT_MAXCLOCK; } // カウンタへセット - I286_REMCLOCK = I286_BASECLOCK; + CPU_REMCLOCK = CPU_BASECLOCK; } static void nevent_execute(void) { @@ -64,13 +64,13 @@ void nevent_progress(void) { UINT curid; NEVENTITEM item; - I286_CLOCK += I286_BASECLOCK; + CPU_CLOCK += CPU_BASECLOCK; eventnum = 0; nextbase = NEVENT_MAXCLOCK; for (i=0; iclock -= I286_BASECLOCK; + item->clock -= CPU_BASECLOCK; if (item->clock > 0) { // イベント待ち中 nevent.level[eventnum++] = curid; @@ -89,10 +89,10 @@ void nevent_progress(void) { } } nevent.readyevents = eventnum; - I286_BASECLOCK = nextbase; - I286_REMCLOCK += nextbase; + CPU_BASECLOCK = nextbase; + CPU_REMCLOCK += nextbase; nevent_execute(); -// TRACEOUT(("nextbase = %d (%d)", nextbase, I286_REMCLOCK)); +// TRACEOUT(("nextbase = %d (%d)", nextbase, CPU_REMCLOCK)); } @@ -145,7 +145,7 @@ void nevent_set(UINT id, SINT32 eventclo // TRACEOUT(("event %d - %xclocks", id, eventclock)); - clock = I286_BASECLOCK - I286_REMCLOCK; + clock = CPU_BASECLOCK - CPU_REMCLOCK; item = &nevent.item[id]; item->proc = proc; item->flag = 0; @@ -179,16 +179,16 @@ void nevent_set(UINT id, SINT32 eventclo // もし最短イベントだったら... if (eventid == 0) { - clock = I286_BASECLOCK - item->clock; - I286_BASECLOCK -= clock; - I286_REMCLOCK -= clock; -// TRACEOUT(("reset nextbase -%d (%d)", clock, I286_REMCLOCK)); + clock = CPU_BASECLOCK - item->clock; + CPU_BASECLOCK -= clock; + CPU_REMCLOCK -= clock; +// TRACEOUT(("reset nextbase -%d (%d)", clock, CPU_REMCLOCK)); } } void nevent_setbyms(UINT id, SINT32 ms, NEVENTCB proc, BOOL absolute) { - nevent_set(id, (pc.realclock / 1000) * ms, proc, absolute); + nevent_set(id, (pccore.realclock / 1000) * ms, proc, absolute); } BOOL nevent_iswork(UINT id) { @@ -211,7 +211,7 @@ SINT32 nevent_getremain(UINT id) { // 現在進行してるイベントを検索 for (i=0; i 0) { - I286_BASECLOCK -= I286_REMCLOCK; - I286_REMCLOCK = 0; + if (CPU_REMCLOCK > 0) { + CPU_BASECLOCK -= CPU_REMCLOCK; + CPU_REMCLOCK = 0; } }