timers implemented for new z80 mode
[picodrive.git] / Pico / sound / sound.c
index 6c7c6d8..4bc9292 100644 (file)
@@ -35,8 +35,8 @@ int PsndDacLine=0;
 short *PsndOut=NULL; // PCM data buffer\r
 \r
 // timers\r
-int timer_a_next_oflow, timer_a_step; // in z80 cycles\r
-//int\r
+int timer_a_next_oflow, timer_a_step, timer_a_offset; // in z80 cycles\r
+int timer_b_next_oflow, timer_b_step, timer_b_offset;\r
 \r
 // sn76496\r
 extern int *sn76496_regs;\r
@@ -46,13 +46,15 @@ static void dac_recalculate(void)
 {\r
   int i, dac_cnt, pos, len, lines = Pico.m.pal ? 312 : 262, mid = Pico.m.pal ? 68 : 93;\r
 \r
-  if(PsndLen <= lines) {\r
+  if (PsndLen <= lines)\r
+  {\r
     // shrinking algo\r
     dac_cnt = -PsndLen;\r
     len=1; pos=0;\r
     dac_info[225] = 1;\r
 \r
-    for(i=226; i != 225; i++) {\r
+    for(i=226; i != 225; i++)\r
+    {\r
       if (i >= lines) i = 0;\r
       len = 0;\r
       if(dac_cnt < 0) {\r
@@ -63,11 +65,14 @@ static void dac_recalculate(void)
       dac_cnt -= PsndLen;\r
       dac_info[i] = (pos<<4)|len;\r
     }\r
-  } else {\r
+  }\r
+  else\r
+  {\r
     // stretching\r
     dac_cnt = PsndLen;\r
     pos=0;\r
-    for(i = 225; i != 224; i++) {\r
+    for(i = 225; i != 224; i++)\r
+    {\r
       if (i >= lines) i = 0;\r
       len=0;\r
       while(dac_cnt >= 0) {\r