1 #include "../../PicoInt.h"
4 int PicoSVPCycles = 800; // cycles/line
6 static void PicoSVPReset(void)
8 elprintf(EL_SVP, "SVP reset");
10 memcpy(svp->iram_rom + 0x800, Pico.rom + 0x800, 0x20000 - 0x800);
11 ssp1601_reset(&svp->ssp1601);
15 static void PicoSVPLine(int count)
18 // OSC_NTSC / 3.0 / 60.0 / 262.0 ~= 1139
19 // OSC_PAL / 3.0 / 50.0 / 312.0 ~= 1137
20 ssp1601_run(PicoSVPCycles * count);
23 //if (Pico.m.frame_count == 13) PicoPad[0] |= 0xff;
27 static int PicoSVPDma(unsigned int source, int len, unsigned short **srcp, unsigned short **limitp)
29 if (source < Pico.romsize) { // Rom
31 *srcp = (unsigned short *)(Pico.rom + (source&~1));
32 *limitp = (unsigned short *)(Pico.rom + Pico.romsize);
35 else if ((source & 0xfe0000) == 0x300000)
37 elprintf(EL_VDPDMA|EL_SVP, "SVP DmaSlow from %06x, len=%i", source, len);
40 *srcp = (unsigned short *)(svp->dram + source);
41 *limitp = (unsigned short *)(svp->dram + sizeof(svp->dram));
45 elprintf(EL_VDPDMA|EL_SVP|EL_ANOMALY, "SVP FIXME unhandled DmaSlow from %06x, len=%i", source, len);
51 void PicoSVPInit(void)
55 elprintf(EL_SVP, "SVP init");
57 tmp = realloc(Pico.rom, 0x200000 + sizeof(*svp));
60 elprintf(EL_STATUS|EL_SVP, "OOM for SVP data");
65 svp = (void *) ((char *)tmp + 0x200000);
66 memset(svp, 0, sizeof(*svp));
68 // init ok, setup hooks..
69 PicoRead16Hook = PicoSVPRead16;
70 PicoWrite8Hook = PicoSVPWrite8;
71 PicoWrite16Hook = PicoSVPWrite16;
72 PicoDmaHook = PicoSVPDma;
73 PicoResetHook = PicoSVPReset;
74 PicoLineHook = PicoSVPLine;