|
|
| version 1.1.1.1, 2003/10/16 17:57:53 | version 1.6, 2003/11/28 08:01:33 |
|---|---|
| Line 4 | Line 4 |
| #include "memory.h" | #include "memory.h" |
| #include "pccore.h" | #include "pccore.h" |
| #include "iocore.h" | #include "iocore.h" |
| #include "gdc_cmd.tbl" | |
| #include "palettes.h" | |
| #include "vram.h" | #include "vram.h" |
| #include "palettes.h" | |
| #include "gdc_cmd.tbl" | |
| #define SEARHC_SYNC | #define SEARHC_SYNC |
| #define TURE_SYNC | #define TURE_SYNC |
| extern BYTE screenupdate; | |
| static const BYTE defdegpal[4] = {0x04,0x15,0x26,0x37}; | static const BYTE defdegpal[4] = {0x04,0x15,0x26,0x37}; |
| static const BYTE defsync[8] = {0x10,0x4e,0x07,0x25,0x07,0x07,0x90,0x65}; | static const BYTE defsync[8] = {0x10,0x4e,0x07,0x25,0x07,0x07,0x90,0x65}; |
| Line 47 void gdc_setanalogpal(int color, int rgb | Line 45 void gdc_setanalogpal(int color, int rgb |
| PAL1EVENT *event; | PAL1EVENT *event; |
| ptr = ((BYTE *)(gdc.anapal + color)) + rgb; | ptr = ((BYTE *)(gdc.anapal + color)) + rgb; |
| if ((*ptr ^ value) & 0x0f) { | if (((*ptr) ^ value) & 0x0f) { |
| gdcs.palchange = GDCSCRN_REDRAW; | gdcs.palchange = GDCSCRN_REDRAW; |
| if ((palevent.events < PALEVENTMAX) && (!gdc.vsync)) { | if (palevent.events < PALEVENTMAX) { |
| event = palevent.event + palevent.events; | if (!gdc.vsync) { |
| event->clock = nevent.item[NEVENT_FLAMES].clock - | event = palevent.event + palevent.events; |
| (nevent.baseclock - nevent.remainclock); | event->clock = nevent.item[NEVENT_FLAMES].clock - |
| event->color = (color * sizeof(RGB32)) + rgb; | (I286_BASECLOCK - I286_REMCLOCK); |
| event->value = value; | event->color = (color * sizeof(RGB32)) + rgb; |
| palevent.events++; | event->value = value; |
| palevent.events++; | |
| } | |
| else { | |
| palevent.vsyncpal = 1; | |
| } | |
| } | } |
| } | } |
| *ptr = value; | *ptr = value; |
| Line 389 static BYTE IOINPCALL gdc_i60(UINT port) | Line 392 static BYTE IOINPCALL gdc_i60(UINT port) |
| gdc_work(GDCWORK_MASTER); | gdc_work(GDCWORK_MASTER); |
| } | } |
| #ifdef SEARHC_SYNC | #ifdef SEARHC_SYNC |
| if ((i286s.inport) && (nevent.remainclock >= 5)) { | if ((i286reg.inport) && (I286_REMCLOCK >= 5)) { |
| UINT16 jadr = 0xfa74; | UINT16 jadr = 0xfa74; |
| UINT16 memv; | UINT16 memv; |
| memv = i286_memoryread_w(i286s.inport); | memv = i286_memoryread_w(i286reg.inport); |
| while((memv == 0x00eb) || (memv == 0x5fe6)) { | while((memv == 0x00eb) || (memv == 0x5fe6)) { |
| jadr -= 0x200; | jadr -= 0x200; |
| i286s.inport += 2; | i286reg.inport += 2; |
| memv = i286_memoryread_w(i286s.inport); | memv = i286_memoryread_w(i286reg.inport); |
| } | } |
| if ((memv == 0x20a8) || (memv == 0x2024)) { | if ((memv == 0x20a8) || (memv == 0x2024)) { |
| memv = i286_memoryread_w(i286s.inport + 2); | memv = i286_memoryread_w(i286reg.inport + 2); |
| if (memv == jadr) { // je | if (memv == jadr) { // je |
| if (!gdc.vsync) { | if (!gdc.vsync) { |
| nevent.remainclock = -1; | I286_REMCLOCK = -1; |
| } | } |
| } | } |
| else if (memv == (jadr + 1)) { // jne | else if (memv == (jadr + 1)) { // jne |
| if (gdc.vsync) { | if (gdc.vsync) { |
| nevent.remainclock = -1; | I286_REMCLOCK = -1; |
| } | } |
| } | } |
| } | } |
| } | } |
| #endif | #endif |
| #ifdef TURE_SYNC // クロックイベントの誤差修正 | #ifdef TURE_SYNC // クロックイベントの誤差修正 |
| if (nevent.item[NEVENT_FLAMES].clock < | if (nevent.item[NEVENT_FLAMES].clock < (I286_BASECLOCK - I286_REMCLOCK)) { |
| (nevent.baseclock - nevent.remainclock)) { | |
| ret ^= 0x20; | ret ^= 0x20; |
| } | } |
| #endif | #endif |
| Line 451 static void IOOUTCALL gdc_oa0(UINT port, | Line 453 static void IOOUTCALL gdc_oa0(UINT port, |
| if (gdc.s.cnt < GDCCMD_MAX) { | if (gdc.s.cnt < GDCCMD_MAX) { |
| gdc.s.fifo[gdc.s.cnt++] = dat; | gdc.s.fifo[gdc.s.cnt++] = dat; |
| } | } |
| // TRACEOUT(("GDC-B %.2x", dat)); | |
| if (gdc.s.paracb) { // ver0.29 | if (gdc.s.paracb) { // ver0.29 |
| gdc_work(GDCWORK_SLAVE); | gdc_work(GDCWORK_SLAVE); |
| } | } |
| Line 462 static void IOOUTCALL gdc_oa2(UINT port, | Line 465 static void IOOUTCALL gdc_oa2(UINT port, |
| if (gdc.s.cnt < GDCCMD_MAX) { | if (gdc.s.cnt < GDCCMD_MAX) { |
| gdc.s.fifo[gdc.s.cnt++] = 0x100 | dat; | gdc.s.fifo[gdc.s.cnt++] = 0x100 | dat; |
| } | } |
| // TRACEOUT(("GDC-A %.2x", dat)); | |
| gdc_work(GDCWORK_SLAVE); | gdc_work(GDCWORK_SLAVE); |
| (void)port; | (void)port; |
| } | } |
| Line 555 static BYTE IOINPCALL gdc_ia0(UINT port) | Line 559 static BYTE IOINPCALL gdc_ia0(UINT port) |
| gdc_work(GDCWORK_SLAVE); | gdc_work(GDCWORK_SLAVE); |
| } | } |
| #ifdef SEARHC_SYNC | #ifdef SEARHC_SYNC |
| if ((i286s.inport) && (nevent.remainclock >= 5)) { | if ((i286reg.inport) && (I286_REMCLOCK >= 5)) { |
| UINT16 jadr = 0xfa74; | UINT16 jadr = 0xfa74; |
| UINT16 memv; | UINT16 memv; |
| memv = i286_memoryread_w(i286s.inport); | memv = i286_memoryread_w(i286reg.inport); |
| while((memv == 0x00eb) || (memv == 0x5fe6)) { | while((memv == 0x00eb) || (memv == 0x5fe6)) { |
| jadr -= 0x200; | jadr -= 0x200; |
| i286s.inport += 2; | i286reg.inport += 2; |
| memv = i286_memoryread_w(i286s.inport); | memv = i286_memoryread_w(i286reg.inport); |
| } | } |
| if ((memv == 0x20a8) || (memv == 0x2024)) { | if ((memv == 0x20a8) || (memv == 0x2024)) { |
| memv = i286_memoryread_w(i286s.inport + 2); | memv = i286_memoryread_w(i286reg.inport + 2); |
| if (memv == jadr) { // je | if (memv == jadr) { // je |
| if (!gdc.vsync) { | if (!gdc.vsync) { |
| nevent.remainclock = -1; | I286_REMCLOCK = -1; |
| } | } |
| } | } |
| else if (memv == (jadr + 1)) { // jne | else if (memv == (jadr + 1)) { // jne |
| if (gdc.vsync) { | if (gdc.vsync) { |
| nevent.remainclock = -1; | I286_REMCLOCK = -1; |
| } | } |
| } | } |
| } | } |
| } | } |
| #endif | #endif |
| #ifdef TURE_SYNC // クロックイベントの誤差修正 | #ifdef TURE_SYNC // クロックイベントの誤差修正 |
| if (nevent.item[NEVENT_FLAMES].clock < | if (nevent.item[NEVENT_FLAMES].clock < (I286_BASECLOCK - I286_REMCLOCK)) { |
| (nevent.baseclock - nevent.remainclock)) { | |
| ret ^= 0x20; | ret ^= 0x20; |
| } | } |
| #endif | #endif |