clean up dac code a bit
[picodrive.git] / pico / sms.c
index cc75bff..7dc796e 100644 (file)
@@ -1,10 +1,16 @@
+/*
+ * SMS emulation
+ * (C) notaz, 2009-2010
+ *
+ * This work is licensed under the terms of MAME license.
+ * See COPYING file in the top-level directory.
+ */
 /*
  * TODO:
  * - start in a state as if BIOS ran
  * - remaining status flags (OVR/COL)
  * - RAM support in mapper
  * - region support
- * - Pause button (NMI)
  * - SN76496 DAC-like usage
  * - H counter
  */
@@ -249,14 +255,24 @@ void PicoFrameMS(void)
   int skip = PicoSkipFrame;
   int lines_vis = 192;
   int hint; // Hint counter
+  int nmi;
   int y;
 
+  PsndStartFrame();
+
+  nmi = (PicoPad[0] >> 7) & 1;
+  if (!Pico.ms.nmi_state && nmi)
+    z80_nmi();
+  Pico.ms.nmi_state = nmi;
+
   PicoFrameStartMode4();
   hint = pv->reg[0x0a];
 
   for (y = 0; y < lines; y++)
   {
     pv->v_counter = Pico.m.scanline = y;
+    if (y > 218)
+      pv->v_counter = y - 6;
 
     if (y < lines_vis && !skip)
       PicoLineMode4(y);