X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=Pico%2Fcd%2FMemory.c;h=b1faacdfa25b5a69468a85fa8af60ef07fe7d60e;hb=dca310c413517d278898b967cfe610574310acd8;hp=b919ee8801bd648c4f07bfc994513d6b36fc06b8;hpb=ca61ee42d9298aeb5a5c97d9addaa1832af41d67;p=picodrive.git diff --git a/Pico/cd/Memory.c b/Pico/cd/Memory.c index b919ee8..b1faacd 100644 --- a/Pico/cd/Memory.c +++ b/Pico/cd/Memory.c @@ -18,10 +18,15 @@ typedef unsigned int u32; #define UTYPES_DEFINED #endif +#ifdef _MSC_VER +#define rdprintf +#define wrdprintf +#else //#define rdprintf dprintf #define rdprintf(...) //#define wrdprintf dprintf #define wrdprintf(...) +#endif #ifdef EMU_CORE_DEBUG extern u32 lastread_a, lastread_d[16], lastwrite_cyc_d[16]; @@ -141,7 +146,7 @@ void m68k_reg_write8(u32 a, u32 d) #ifdef USE_POLL_DETECT if ((s68k_poll_adclk&0xfe) == 2 && s68k_poll_cnt > POLL_LIMIT) { SekSetStopS68k(0); s68k_poll_adclk = 0; - elprintf(EL_CDPOLL, "s68k poll release, a=%02x\n", a); + elprintf(EL_CDPOLL, "s68k poll release, a=%02x", a); } #endif return; @@ -161,7 +166,7 @@ void m68k_reg_write8(u32 a, u32 d) #ifdef USE_POLL_DETECT if ((s68k_poll_adclk&0xfe) == 0xe && s68k_poll_cnt > POLL_LIMIT) { SekSetStopS68k(0); s68k_poll_adclk = 0; - elprintf(EL_CDPOLL, "s68k poll release, a=%02x\n", a); + elprintf(EL_CDPOLL, "s68k poll release, a=%02x", a); } #endif return; @@ -172,7 +177,7 @@ void m68k_reg_write8(u32 a, u32 d) #ifdef USE_POLL_DETECT if ((a&0xfe) == (s68k_poll_adclk&0xfe) && s68k_poll_cnt > POLL_LIMIT) { SekSetStopS68k(0); s68k_poll_adclk = 0; - elprintf(EL_CDPOLL, "s68k poll release, a=%02x\n", a); + elprintf(EL_CDPOLL, "s68k poll release, a=%02x", a); } #endif return; @@ -197,7 +202,7 @@ u32 s68k_poll_detect(u32 a, u32 d) //printf("-- diff: %u, cnt = %i\n", clkdiff, s68k_poll_cnt); if (s68k_poll_cnt > POLL_LIMIT) { SekSetStopS68k(1); - elprintf(EL_CDPOLL, "s68k poll detected @ %06x, a=%02x\n", SekPcS68k, a); + elprintf(EL_CDPOLL, "s68k poll detected @ %06x, a=%02x", SekPcS68k, a); } s68k_poll_adclk = (SekCyclesDoneS68k() << 8) | a; return d; @@ -376,11 +381,11 @@ void s68k_reg_write8(u32 a, u32 d) } -#ifndef _ASM_CD_MEMORY_C static u32 OtherRead16End(u32 a, int realsize) { u32 d=0; +#ifndef _ASM_CD_MEMORY_C if ((a&0xffffc0)==0xa12000) { d=m68k_reg_read16(a); goto end; @@ -403,16 +408,20 @@ static u32 OtherRead16End(u32 a, int realsize) d=Pico_mcd->m.bcram_reg; goto end; } +#endif elprintf(EL_UIO, "m68k FIXME: unusual r%i: %06x @%06x", realsize&~1, (a&0xfffffe)+(realsize&1), SekPc); +#ifndef _ASM_CD_MEMORY_C end: +#endif return d; } static void OtherWrite8End(u32 a, u32 d, int realsize) { +#ifndef _ASM_CD_MEMORY_C if ((a&0xffffc0)==0xa12000) { m68k_reg_write8(a, d); return; } if ((a&0xfe0000)==0x600000) { @@ -427,15 +436,17 @@ static void OtherWrite8End(u32 a, u32 d, int realsize) Pico_mcd->m.bcram_reg=d; return; } +#endif elprintf(EL_UIO, "m68k FIXME: strange w%i: [%06x], %08x @%06x", realsize, a&0xffffff, d, SekPc); } +#ifndef _ASM_CD_MEMORY_C #define _CD_MEMORY_C #undef _ASM_MEMORY_C #include "../MemoryCmn.c" #include "cell_map.c" -#endif // !def _ASM_CD_MEMORY_C +#endif // ----------------------------------------------------------------- @@ -808,7 +819,7 @@ static void PicoWriteM68k16(u32 a,u16 d) #ifdef USE_POLL_DETECT if ((s68k_poll_adclk&0xfe) == 0xe && s68k_poll_cnt > POLL_LIMIT) { SekSetStopS68k(0); s68k_poll_adclk = 0; - elprintf(EL_CDPOLL, "s68k poll release, a=%02x\n", a); + elprintf(EL_CDPOLL, "s68k poll release, a=%02x", a); } #endif return; @@ -1152,11 +1163,12 @@ static u32 PicoReadS68k32(u32 a) // word RAM (1M area) if ((a&0xfe0000)==0x0c0000 && (Pico_mcd->s68k_regs[3]&4)) { // 0c0000-0dffff int bank; + u16 *pm; wrdprintf("s68k_wram1M r32: [%06x] @%06x", a, SekPcS68k); // if (!(Pico_mcd->s68k_regs[3]&4)) // dprintf("s68k_wram1M FIXME: wrong mode"); bank = (Pico_mcd->s68k_regs[3]&1)^1; - u16 *pm=(u16 *)(Pico_mcd->word_ram1M[bank]+(a&0x1fffe)); d = (pm[0]<<16)|pm[1]; + pm=(u16 *)(Pico_mcd->word_ram1M[bank]+(a&0x1fffe)); d = (pm[0]<<16)|pm[1]; wrdprintf("ret = %08x", d); goto end; } @@ -1626,6 +1638,10 @@ void PicoMemResetCD(int r3) PICO_INTERNAL void PicoMemSetupCD(void) { + // additional handlers for common code + PicoRead16Hook = OtherRead16End; + PicoWrite8Hook = OtherWrite8End; + #ifdef EMU_C68K // Setup m68k memory callbacks: PicoCpuCM68k.checkpc=PicoCheckPcM68k;