From: notaz <notasas@gmail.com>
Date: Wed, 28 May 2008 21:22:46 +0000 (+0000)
Subject: timer adjustment for Dai Makaimura
X-Git-Tag: v1.85~481
X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e0cfb2fd6507f9099c23a66e0d840f957e152e3d;p=picodrive.git

timer adjustment for Dai Makaimura

git-svn-id: file:///home/notaz/opt/svn/PicoDrive@469 be3aeb3a-fb24-0410-a615-afba39da0efa
---

diff --git a/Pico/Memory.c b/Pico/Memory.c
index a9f09274..fde2e4a8 100644
--- a/Pico/Memory.c
+++ b/Pico/Memory.c
@@ -799,7 +799,7 @@ int ym2612_write_local(u32 a, u32 d, int is_from_z80)
             //ym2612.OPN.ST.TAC = (1024-TAnew)*18;
             //ym2612.OPN.ST.TAT = 0;
             //
-            timer_a_step = timer_a_offset = 16495 * (1024 - TAnew);
+            timer_a_step = timer_a_offset = 16466 * (1024 - TAnew);
             if (ym2612.OPN.ST.mode & 1) {
               int cycles = is_from_z80 ? z80_cyclesDone() : cycles_68k_to_z80(SekCyclesDone());
               timer_a_next_oflow = (cycles << 8) + timer_a_step;
@@ -815,7 +815,7 @@ int ym2612_write_local(u32 a, u32 d, int is_from_z80)
             //ym2612.OPN.ST.TBC  = (256-d)<<4;
             //ym2612.OPN.ST.TBC *= 18;
             //ym2612.OPN.ST.TBT  = 0;
-            timer_b_step = timer_b_offset = 263912 * (256 - d);
+            timer_b_step = timer_b_offset = 262840 * (256 - d); // 262881
             if (ym2612.OPN.ST.mode & 2) {
               int cycles = is_from_z80 ? z80_cyclesDone() : cycles_68k_to_z80(SekCyclesDone());
               timer_b_next_oflow = (cycles << 8) + timer_b_step;
@@ -912,7 +912,7 @@ u32 ym2612_read_local_68k(void)
   return ym2612.OPN.ST.status;
 }
 
-// TODO: new ym2612 savestates
+// TODO: new ym2612 savestates, also save timers
 void ym2612_unpack_state(void)
 {
   int i;
diff --git a/Pico/PicoFrameHints.c b/Pico/PicoFrameHints.c
index 7995b9b8..fe2631cd 100644
--- a/Pico/PicoFrameHints.c
+++ b/Pico/PicoFrameHints.c
@@ -241,7 +241,7 @@ static int PicoFrameHints(void)
 
   // sync z80
   if (Pico.m.z80Run && (PicoOpt&POPT_EN_Z80))
-    PicoSyncZ80(SekCycleCnt);
+    PicoSyncZ80(Pico.m.pal ? 151809 : 127671); // cycles adjusted for convertor
   if (PsndOut && ym2612.dacen && PsndDacLine <= lines-1)
     PsndDoDAC(lines-1);
 
@@ -249,6 +249,5 @@ static int PicoFrameHints(void)
 }
 
 #undef PAD_DELAY
-#undef Z80_RUN
 #undef CPUS_RUN