X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=Pico%2Fcarthw%2Fsvp%2Fsvp.c;h=79ea68d5e611bdf535e629800cf919eafc5e9586;hb=f8ef8ff7100baa0ac0ecfcacb47aea3a9e24bc38;hp=a5de987ab366e09c5f929a34d9d1e0eeb0556510;hpb=f53f286a8b48d19c65e83f90d00aa47e8e87c889;p=picodrive.git diff --git a/Pico/carthw/svp/svp.c b/Pico/carthw/svp/svp.c index a5de987..79ea68d 100644 --- a/Pico/carthw/svp/svp.c +++ b/Pico/carthw/svp/svp.c @@ -1,7 +1,51 @@ #include "../../PicoInt.h" +svp_t *svp = NULL; + void PicoSVPInit(void) { - elprintf(0xffff, "SVP"); + void *tmp; + + elprintf(0xffff, "SVP init"); + + tmp = realloc(Pico.rom, 0x200000 + sizeof(*svp)); + if (tmp == NULL) + { + elprintf(EL_STATUS, "OOM for SVP data"); + return; + } + + Pico.rom = tmp; + svp = (void *) ((char *)tmp + 0x200000); + memset(svp, 0, sizeof(*svp)); + + // init ok, setup hooks.. + PicoRead16Hook = PicoSVPRead16; + PicoWrite8Hook = PicoSVPWrite8; + PicoWrite16Hook = PicoSVPWrite16; + PicoDmaHook = PicoSVPDma; +} + + +void PicoSVPReset(void) +{ + elprintf(0xffff, "SVP reset"); + + ssp1601_reset(&svp->ssp1601); +} + + +int PicoSVPDma(unsigned int source, unsigned short **srcp, unsigned short **limitp) +{ + if ((source & 0xfe0000) == 0x300000) + { + elprintf(EL_VDPDMA|0xffff, "SVP DmaSlow from %06x", source); + source &= 0x1fffe; + *srcp = (unsigned short *)(svp->ram + source); + *limitp = (unsigned short *)(svp->ram + sizeof(svp->ram)); + return 1; + } + + return 0; }