{\r
     int cycles = is_from_z80 ? z80_cyclesDone() : z80_cycles_from_68k();\r
     //elprintf(EL_STATUS, "%03i dac w %08x z80 %i", cycles, d, is_from_z80);\r
-    ym2612.dacout = ((int)d - 0x80) << 6;\r
     if (ym2612.dacen)\r
       PsndDoDAC(cycles);\r
+    ym2612.dacout = ((int)d - 0x80) << 6;\r
     return 0;\r
   }\r
 \r
         case 0x27: { /* mode, timer control */\r
           int old_mode = ym2612.OPN.ST.mode;\r
           int cycles = is_from_z80 ? z80_cyclesDone() : z80_cycles_from_68k();\r
+\r
+          if (ym2612.OPN.ST.mode != d)\r
+            PsndDoFM(cycles);\r
           ym2612.OPN.ST.mode = d;\r
 \r
           elprintf(EL_YMTIMER, "st mode %02x", d);\r
 \r
 \r
 #define ym2612_read_local() \\r
+  PsndDoFM(xcycles>>8); \\r
   if (xcycles >= Pico.t.timer_a_next_oflow) \\r
     ym2612.OPN.ST.status |= (ym2612.OPN.ST.mode >> 2) & 1; \\r
   if (xcycles >= Pico.t.timer_b_next_oflow) \\r
 
   // Q16, number of samples since last call\r
   len = (cyc_to * Pico.snd.clkl_mult) - Pico.snd.fm_pos;\r
 \r
-  // don't do this too often (about every 4th scanline)\r
-  if (len >> 20 <= PicoIn.sndRate >> 12)\r
+  // don't do this too often (about once every canline)\r
+  if (len >> 16 <= PicoIn.sndRate >> 10)\r
     return;\r
 \r
   // update position and calculate buffer offset and length\r