/*
* TODO:
* - start in a state as if BIOS ran
- * - remaining status flags (OVR/COL)
* - RAM support in mapper
* - region support
- * - SN76496 DAC-like usage
* - H counter
*/
#include "pico_int.h"
static unsigned char vdp_ctl_read(void)
{
- unsigned char d = Pico.video.pending_ints << 7;
- Pico.video.pending = 0;
- Pico.video.pending_ints = 0;
+ struct PicoVideo *pv = &Pico.video;
+ unsigned char d;
+
+ d = pv->status | (pv->pending_ints << 7);
+ pv->pending = pv->pending_ints = 0;
+ pv->status = 0;
elprintf(EL_SR, "VDP sr: %02x", d);
return d;
break;
case 0xc0: /* I/O port A and B */
- d = ~((PicoPad[0] & 0x3f) | (PicoPad[1] << 6));
+ d = ~((PicoIn.pad[0] & 0x3f) | (PicoIn.pad[1] << 6));
break;
case 0xc1: /* I/O port B and miscellaneous */
d = (Pico.ms.io_ctl & 0x80) | ((Pico.ms.io_ctl << 1) & 0x40) | 0x30;
- d |= ~(PicoPad[1] >> 2) & 0x0f;
+ d |= ~(PicoIn.pad[1] >> 2) & 0x0f;
break;
}
case 0x40:
case 0x41:
- if (PicoOpt & POPT_EN_PSG)
- SN76496Write(d);
+ if ((d & 0x90) == 0x90 && Pico.snd.psg_line < Pico.m.scanline)
+ PsndDoPSG(Pico.m.scanline);
+ SN76496Write(d);
break;
case 0x80:
int lines = is_pal ? 313 : 262;
int cycles_line = is_pal ? 58020 : 58293; /* (226.6 : 227.7) * 256 */
int cycles_done = 0, cycles_aim = 0;
- int skip = PicoSkipFrame;
+ int skip = PicoIn.skipFrame;
int lines_vis = 192;
int hint; // Hint counter
int nmi;
PsndStartFrame();
- nmi = (PicoPad[0] >> 7) & 1;
+ nmi = (PicoIn.pad[0] >> 7) & 1;
if (!Pico.ms.nmi_state && nmi)
z80_nmi();
Pico.ms.nmi_state = nmi;
}
}
+ // 224 because of how it's done for MD...
+ if (y == 224 && PicoIn.sndOut)
+ PsndGetSamplesMS();
+
cycles_aim += cycles_line;
cycles_done += z80_run((cycles_aim - cycles_done) >> 8) << 8;
}
- if (PsndOut)
- PsndGetSamplesMS();
+ if (PicoIn.sndOut && Pico.snd.psg_line < lines)
+ PsndDoPSG(lines - 1);
}
void PicoFrameDrawOnlyMS(void)
PicoLineMode4(y);
}
+// vim:ts=2:sw=2:expandtab