*** vdp2.c	Fri Jun 24 23:32:28 2011
--- vdp2.c	Sun Oct 24 15:38:54 2010
***************
*** 46,55 ****
  static u64 diffticks=0;
  static u32 framecount=0;
  static u64 onesecondticks=0;
  static int fps;
  static int fpsframecount=0;
  static u64 fpsticks;
  static int fpstoggle=0;
  
  //////////////////////////////////////////////////////////////////////////////
  int GetOSDToggle(void)
--- 46,63 ----
  static u64 diffticks=0;
  static u32 framecount=0;
  static u64 onesecondticks=0;
+ #ifndef GEKKO
  static int fps;
+ #else
+ int fps;
+ #endif
  static int fpsframecount=0;
  static u64 fpsticks;
+ #ifndef GEKKO
  static int fpstoggle=0;
+ #else
+ int fpstoggle=0;
+ #endif
  
  //////////////////////////////////////////////////////////////////////////////
  int GetOSDToggle(void)
***************
*** 400,406 ****
        diffticks = curticks-lastticks;
  
        if ((onesecondticks+diffticks) > ((yabsys.OneFrameTime * (u64)framecount) + (yabsys.OneFrameTime / 2)) &&
            framesskipped < 9)
        {
           // Skip the next frame
           skipnextframe = 1;
--- 408,418 ----
        diffticks = curticks-lastticks;
  
        if ((onesecondticks+diffticks) > ((yabsys.OneFrameTime * (u64)framecount) + (yabsys.OneFrameTime / 2)) &&
+ #ifndef GEKKO
            framesskipped < 9)
+ #else // more frameskip for speed ..
+           framesskipped < 14)
+ #endif
        {
           // Skip the next frame
           skipnextframe = 1;
***************
*** 469,474 ****
           return Vdp2Regs->HCNT;
        case 0x00A:
           return Vdp2Regs->VCNT;
        default:
        {
           LOG("Unhandled VDP2 word read: %08X\n", addr);
--- 481,490 ----
           return Vdp2Regs->HCNT;
        case 0x00A:
           return Vdp2Regs->VCNT;
+ #ifdef GEKKO
+       case 0x00E:
+          return Vdp2Regs->RAMCTL;
+ #endif
        default:
        {
           LOG("Unhandled VDP2 word read: %08X\n", addr);
***************
*** 482,489 ****
  //////////////////////////////////////////////////////////////////////////////
  
  u32 FASTCALL Vdp2ReadLong(u32 addr) {
     LOG("VDP2 register long read = %08X\n", addr);
     addr &= 0x1FF;
     return 0;
  }
  
--- 498,518 ----
  //////////////////////////////////////////////////////////////////////////////
  
  u32 FASTCALL Vdp2ReadLong(u32 addr) {
+ #ifndef GEKKO
     LOG("VDP2 register long read = %08X\n", addr);
+ #else
     addr &= 0x1FF;
+    switch (addr)
+    {
+       case 0x058:
+          return (Vdp2Regs->MPIJRA << 16 | Vdp2Regs->MPKLRA);
+       default:
+       {
+          LOG("VDP2 register long read = %08X\n", addr);
+          break;
+       }
+    }
+ #endif
     return 0;
  }
  
***************
*** 970,975 ****
           return;
        case 0x00C:
           Vdp2Regs->RAMCTL = val & 0xFFFF;
           return;
        case 0x010:
           Vdp2Regs->CYCA0L = val >> 16;
--- 999,1007 ----
           return;
        case 0x00C:
           Vdp2Regs->RAMCTL = val & 0xFFFF;
+ #ifdef GEKKO
+          Vdp2Internal.ColorMode = (Vdp2Regs->RAMCTL >> 12) & 0x3;
+ #endif
           return;
        case 0x010:
           Vdp2Regs->CYCA0L = val >> 16;
***************
*** 1103,1108 ****
           Vdp2Regs->SCXN3 = val >> 16;
           Vdp2Regs->SCYN3 = val & 0xFFFF;
           return;
        case 0x09C:
           Vdp2Regs->VCSTA.all = val;
           return;
--- 1135,1146 ----
           Vdp2Regs->SCXN3 = val >> 16;
           Vdp2Regs->SCYN3 = val & 0xFFFF;
           return;
+ #ifdef GEKKO
+       case 0x098:
+          Vdp2Regs->ZMCTL = val >> 16;
+          Vdp2Regs->SCRCTL = val & 0xFFFF;
+          return;
+ #endif
        case 0x09C:
           Vdp2Regs->VCSTA.all = val;
           return;
***************
*** 1112,1125 ****
        case 0x0A4:
           Vdp2Regs->LSTA1.all = val;
           return;
        case 0x0AC:
           Vdp2Regs->BKTAU = val >> 16;
           Vdp2Regs->BKTAL = val & 0xFFFF;
           return;
        case 0x0D0:
           Vdp2Regs->WCTLA = val >> 16;
           Vdp2Regs->WCTLB = val & 0xFFFF;
           return;
        case 0x0D8:
           Vdp2Regs->LWTA0.all = val;
           return;
--- 1150,1207 ----
        case 0x0A4:
           Vdp2Regs->LSTA1.all = val;
           return;
+ #ifdef GEKKO
+       case 0x0A8:
+          Vdp2Regs->LCTA.all = val;
+          return;
+ #endif
        case 0x0AC:
           Vdp2Regs->BKTAU = val >> 16;
           Vdp2Regs->BKTAL = val & 0xFFFF;
           return;
+ #ifdef GEKKO
+       case 0x0B0:
+          Vdp2Regs->RPMD = val >> 16;
+          Vdp2Regs->RPRCTL = val & 0xFFFF;
+          return;
+       case 0x0B4:
+          Vdp2Regs->KTCTL = val >> 16;
+          Vdp2Regs->KTAOF = val & 0xFFFF;
+          return;
+       case 0x0B8:
+          Vdp2Regs->OVPNRA = val >> 16;
+          Vdp2Regs->OVPNRB = val & 0xFFFF;
+          return;
+       case 0x0BC:
+          Vdp2Regs->RPTA.all = val;
+          return;
+       case 0x0C0:
+          Vdp2Regs->WPSX0 = val >> 16;
+          Vdp2Regs->WPSY0 = val & 0xFFFF;
+          return;
+       case 0x0C4:
+          Vdp2Regs->WPEX0 = val >> 16;
+          Vdp2Regs->WPEY0 = val & 0xFFFF;
+          return;
+       case 0x0C8:
+          Vdp2Regs->WPSX1 = val >> 16;
+          Vdp2Regs->WPSY1 = val & 0xFFFF;
+          return;
+       case 0x0CC:
+          Vdp2Regs->WPEX1 = val >> 16;
+          Vdp2Regs->WPEY1 = val & 0xFFFF;
+          return;
+ #endif
        case 0x0D0:
           Vdp2Regs->WCTLA = val >> 16;
           Vdp2Regs->WCTLB = val & 0xFFFF;
           return;
+ #ifdef GEKKO
+       case 0x0D4:
+          Vdp2Regs->WCTLC = val >> 16;
+          Vdp2Regs->WCTLD = val & 0xFFFF;
+          return;
+ #endif
        case 0x0D8:
           Vdp2Regs->LWTA0.all = val;
           return;
***************
*** 1158,1163 ****
           VIDCore->Vdp2SetPriorityNBG2(Vdp2Regs->PRINB & 0x7);
           VIDCore->Vdp2SetPriorityNBG3((Vdp2Regs->PRINB >> 8) & 0x7);
           return;
        case 0x100:
           Vdp2Regs->CCRSA = val >> 16;
           Vdp2Regs->CCRSB = val & 0xFFFF;
--- 1240,1251 ----
           VIDCore->Vdp2SetPriorityNBG2(Vdp2Regs->PRINB & 0x7);
           VIDCore->Vdp2SetPriorityNBG3((Vdp2Regs->PRINB >> 8) & 0x7);
           return;
+ #ifdef GEKKO
+       case 0x0FC:
+          Vdp2Regs->PRIR = val >> 16;
+          VIDCore->Vdp2SetPriorityRBG0(Vdp2Regs->PRIR & 0x7);
+          return;
+ #endif
        case 0x100:
           Vdp2Regs->CCRSA = val >> 16;
           Vdp2Regs->CCRSB = val & 0xFFFF;
