--- np2/io/gdc.c 2003/10/17 11:10:02 1.3 +++ np2/io/gdc.c 2003/12/01 10:45:46 1.7 @@ -4,16 +4,14 @@ #include "memory.h" #include "pccore.h" #include "iocore.h" -#include "gdc_cmd.tbl" -#include "palettes.h" #include "vram.h" +#include "palettes.h" +#include "gdc_cmd.tbl" #define SEARHC_SYNC #define TURE_SYNC -extern BYTE screenupdate; - static const BYTE defdegpal[4] = {0x04,0x15,0x26,0x37}; static const BYTE defsync[8] = {0x10,0x4e,0x07,0x25,0x07,0x07,0x90,0x65}; @@ -53,7 +51,7 @@ void gdc_setanalogpal(int color, int rgb if (!gdc.vsync) { event = palevent.event + palevent.events; event->clock = nevent.item[NEVENT_FLAMES].clock - - (nevent.baseclock - nevent.remainclock); + (I286_BASECLOCK - I286_REMCLOCK); event->color = (color * sizeof(RGB32)) + rgb; event->value = value; palevent.events++; @@ -394,33 +392,32 @@ static BYTE IOINPCALL gdc_i60(UINT port) gdc_work(GDCWORK_MASTER); } #ifdef SEARHC_SYNC - if ((i286reg.inport) && (nevent.remainclock >= 5)) { + if ((i286core.s.inport) && (I286_REMCLOCK >= 5)) { UINT16 jadr = 0xfa74; UINT16 memv; - memv = i286_memoryread_w(i286reg.inport); + memv = i286_memoryread_w(i286core.s.inport); while((memv == 0x00eb) || (memv == 0x5fe6)) { jadr -= 0x200; - i286reg.inport += 2; - memv = i286_memoryread_w(i286reg.inport); + i286core.s.inport += 2; + memv = i286_memoryread_w(i286core.s.inport); } if ((memv == 0x20a8) || (memv == 0x2024)) { - memv = i286_memoryread_w(i286reg.inport + 2); + memv = i286_memoryread_w(i286core.s.inport + 2); if (memv == jadr) { // je if (!gdc.vsync) { - nevent.remainclock = -1; + I286_REMCLOCK = -1; } } else if (memv == (jadr + 1)) { // jne if (gdc.vsync) { - nevent.remainclock = -1; + I286_REMCLOCK = -1; } } } } #endif #ifdef TURE_SYNC // クロックイベントの誤差修正 - if (nevent.item[NEVENT_FLAMES].clock < - (nevent.baseclock - nevent.remainclock)) { + if (nevent.item[NEVENT_FLAMES].clock < (I286_BASECLOCK - I286_REMCLOCK)) { ret ^= 0x20; } #endif @@ -456,6 +453,7 @@ static void IOOUTCALL gdc_oa0(UINT port, if (gdc.s.cnt < GDCCMD_MAX) { gdc.s.fifo[gdc.s.cnt++] = dat; } +// TRACEOUT(("GDC-B %.2x", dat)); if (gdc.s.paracb) { // ver0.29 gdc_work(GDCWORK_SLAVE); } @@ -467,6 +465,7 @@ static void IOOUTCALL gdc_oa2(UINT port, if (gdc.s.cnt < GDCCMD_MAX) { gdc.s.fifo[gdc.s.cnt++] = 0x100 | dat; } +// TRACEOUT(("GDC-A %.2x", dat)); gdc_work(GDCWORK_SLAVE); (void)port; } @@ -560,33 +559,32 @@ static BYTE IOINPCALL gdc_ia0(UINT port) gdc_work(GDCWORK_SLAVE); } #ifdef SEARHC_SYNC - if ((i286reg.inport) && (nevent.remainclock >= 5)) { + if ((i286core.s.inport) && (I286_REMCLOCK >= 5)) { UINT16 jadr = 0xfa74; UINT16 memv; - memv = i286_memoryread_w(i286reg.inport); + memv = i286_memoryread_w(i286core.s.inport); while((memv == 0x00eb) || (memv == 0x5fe6)) { jadr -= 0x200; - i286reg.inport += 2; - memv = i286_memoryread_w(i286reg.inport); + i286core.s.inport += 2; + memv = i286_memoryread_w(i286core.s.inport); } if ((memv == 0x20a8) || (memv == 0x2024)) { - memv = i286_memoryread_w(i286reg.inport + 2); + memv = i286_memoryread_w(i286core.s.inport + 2); if (memv == jadr) { // je if (!gdc.vsync) { - nevent.remainclock = -1; + I286_REMCLOCK = -1; } } else if (memv == (jadr + 1)) { // jne if (gdc.vsync) { - nevent.remainclock = -1; + I286_REMCLOCK = -1; } } } } #endif #ifdef TURE_SYNC // クロックイベントの誤差修正 - if (nevent.item[NEVENT_FLAMES].clock < - (nevent.baseclock - nevent.remainclock)) { + if (nevent.item[NEVENT_FLAMES].clock < (I286_BASECLOCK - I286_REMCLOCK)) { ret ^= 0x20; } #endif