X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=Pico%2Fcarthw%2Fsvp%2FMemory.c;h=84d942c29b2991f9892978d1efabcb00d04c84f4;hb=f8ef8ff7100baa0ac0ecfcacb47aea3a9e24bc38;hp=0462d7fc9d825cc7d36fb7e2d3ee5f18f7e91fd6;hpb=f53f286a8b48d19c65e83f90d00aa47e8e87c889;p=picodrive.git diff --git a/Pico/carthw/svp/Memory.c b/Pico/carthw/svp/Memory.c index 0462d7f..84d942c 100644 --- a/Pico/carthw/svp/Memory.c +++ b/Pico/carthw/svp/Memory.c @@ -1,16 +1,53 @@ #include "../../PicoInt.h" +#ifndef UTYPES_DEFINED +typedef unsigned char u8; +typedef unsigned short u16; +typedef unsigned int u32; +#define UTYPES_DEFINED +#endif + +#define CLEAR_DETECT(pc_start,pc_end,text) \ + if (d == 0 && SekPc >= pc_start && SekPc < pc_end) \ + { \ + if (!clearing_ram) \ + elprintf(EL_UIO, text); \ + clearing_ram = 1; \ + return; \ + } + unsigned int PicoSVPRead16(unsigned int a, int realsize) { unsigned int d = 0; + if ((a & 0xfe0000) == 0x300000) + *(u16 *)(svp->ram + (a&0x1fffe)) = d; + elprintf(EL_UIO, "SVP r%i: [%06x] %04x @%06x", realsize, a&0xffffff, d, SekPc); + // if (a == 0x30fe02) d = 1; + return d; } void PicoSVPWrite8(unsigned int a, unsigned int d, int realsize) { - elprintf(EL_UIO, "SVP w%i: %06x, %08x @%06x", realsize, a&0xffffff, d, SekPc); + elprintf(EL_UIO, "!!! SVP w%i: [%06x], %08x @%06x", realsize, a&0xffffff, d, SekPc); +} + +void PicoSVPWrite16(unsigned int a, unsigned int d, int realsize) +{ + static int clearing_ram = 0; + + if ((a & 0xfe0000) == 0x300000) + *(u16 *)(svp->ram + (a&0x1fffe)) = d; + + // debug: detect RAM clears.. + CLEAR_DETECT(0x0221dc, 0x0221f0, "SVP RAM CLEAR (1)"); + CLEAR_DETECT(0x02204c, 0x022068, "SVP RAM CLEAR (2)"); + CLEAR_DETECT(0x021900, 0x021ff0, "SVP RAM CLEAR 300000-305fff"); + clearing_ram = 0; + + elprintf(EL_UIO, "SVP w%i: [%06x], %04x @%06x", realsize, a&0xffffff, d, SekPc); }