// For commercial use, separate licencing terms must be obtained.\r
\r
\r
-//#define __debug_io\r
+#define __debug_io\r
\r
#include "PicoInt.h"\r
\r
dprintf("r8 : %06x, %02x @%06x", a&0xffffff, (u8)d, SekPc);\r
#endif\r
#if defined(EMU_C68K) && defined(EMU_M68K)\r
- if(a>=Pico.romsize&&(ppop&0x3f)!=0x3a&&(ppop&0x3f)!=0x3b) {\r
+ if(a>=Pico.romsize/*&&(ppop&0x3f)!=0x3a&&(ppop&0x3f)!=0x3b*/) {\r
lastread_a = a;\r
lastread_d[lrp_cyc++&15] = (u8)d;\r
}\r
dprintf("r16: %06x, %04x @%06x", a&0xffffff, d, SekPc);\r
#endif\r
#if defined(EMU_C68K) && defined(EMU_M68K)\r
- if(a>=Pico.romsize&&(ppop&0x3f)!=0x3a&&(ppop&0x3f)!=0x3b) {\r
+ if(a>=Pico.romsize/*&&(ppop&0x3f)!=0x3a&&(ppop&0x3f)!=0x3b*/) {\r
lastread_a = a;\r
lastread_d[lrp_cyc++&15] = d;\r
}\r
dprintf("r32: %06x, %08x @%06x", a&0xffffff, d, SekPc);\r
#endif\r
#if defined(EMU_C68K) && defined(EMU_M68K)\r
- if(a>=Pico.romsize&&(ppop&0x3f)!=0x3a&&(ppop&0x3f)!=0x3b) {\r
+ if(a>=Pico.romsize/*&&(ppop&0x3f)!=0x3a&&(ppop&0x3f)!=0x3b*/) {\r
lastread_a = a;\r
lastread_d[lrp_cyc++&15] = d;\r
}\r
unsigned int m68k_read_pcrelative_CD32(unsigned int a);\r
\r
// these are allowed to access RAM\r
-unsigned int m68k_read_pcrelative_8 (unsigned int a) {\r
+static unsigned int m68k_read_8 (unsigned int a, int do_fake) {\r
a&=0xffffff;\r
if(PicoMCD&1) return m68k_read_pcrelative_CD8(a);\r
if(a<Pico.romsize) return *(u8 *)(Pico.rom+(a^1)); // Rom\r
+ if(do_fake&&((ppop&0x3f)==0x3a||(ppop&0x3f)==0x3b)) return lastread_d[lrp_mus++&15];\r
if((a&0xe00000)==0xe00000) return *(u8 *)(Pico.ram+((a^1)&0xffff)); // Ram\r
- return 0;//(u8) lastread_d;\r
+ return 0;\r
}\r
-unsigned int m68k_read_pcrelative_16(unsigned int a) {\r
+static unsigned int m68k_read_16(unsigned int a, int do_fake) {\r
a&=0xffffff;\r
if(PicoMCD&1) return m68k_read_pcrelative_CD16(a);\r
if(a<Pico.romsize) return *(u16 *)(Pico.rom+(a&~1)); // Rom\r
+ if(do_fake&&((ppop&0x3f)==0x3a||(ppop&0x3f)==0x3b)) return lastread_d[lrp_mus++&15];\r
if((a&0xe00000)==0xe00000) return *(u16 *)(Pico.ram+(a&0xfffe)); // Ram\r
- return 0;//(u16) lastread_d;\r
+ return 0;\r
}\r
-unsigned int m68k_read_pcrelative_32(unsigned int a) {\r
+static unsigned int m68k_read_32(unsigned int a, int do_fake) {\r
a&=0xffffff;\r
if(PicoMCD&1) return m68k_read_pcrelative_CD32(a);\r
if(a<Pico.romsize) { u16 *pm=(u16 *)(Pico.rom+(a&~1)); return (pm[0]<<16)|pm[1]; }\r
+ if(do_fake&&((ppop&0x3f)==0x3a||(ppop&0x3f)==0x3b)) return lastread_d[lrp_mus++&15];\r
if((a&0xe00000)==0xe00000) { u16 *pm=(u16 *)(Pico.ram+(a&0xfffe)); return (pm[0]<<16)|pm[1]; } // Ram\r
- return 0;//lastread_d;\r
+ return 0;\r
}\r
\r
-unsigned int m68k_read_immediate_16(unsigned int a) { return m68k_read_pcrelative_16(a); }\r
-unsigned int m68k_read_immediate_32(unsigned int a) { return m68k_read_pcrelative_32(a); }\r
-unsigned int m68k_read_disassembler_8 (unsigned int a) { return m68k_read_pcrelative_8 (a); }\r
-unsigned int m68k_read_disassembler_16(unsigned int a) { return m68k_read_pcrelative_16(a); }\r
-unsigned int m68k_read_disassembler_32(unsigned int a) { return m68k_read_pcrelative_32(a); }\r
+unsigned int m68k_read_pcrelative_8 (unsigned int a) { return m68k_read_8 (a, 1); }\r
+unsigned int m68k_read_pcrelative_16(unsigned int a) { return m68k_read_16(a, 1); }\r
+unsigned int m68k_read_pcrelative_32(unsigned int a) { return m68k_read_32(a, 1); }\r
+unsigned int m68k_read_immediate_16(unsigned int a) { return m68k_read_16(a, 0); }\r
+unsigned int m68k_read_immediate_32(unsigned int a) { return m68k_read_32(a, 0); }\r
+unsigned int m68k_read_disassembler_8 (unsigned int a) { return m68k_read_8 (a, 0); }\r
+unsigned int m68k_read_disassembler_16(unsigned int a) { return m68k_read_16(a, 0); }\r
+unsigned int m68k_read_disassembler_32(unsigned int a) { return m68k_read_32(a, 0); }\r
\r
#ifdef EMU_C68K\r
// ROM only\r
-unsigned int m68k_read_memory_8(unsigned int a) { if(a<Pico.romsize) return *(u8 *) (Pico.rom+(a^1)); return (u8) lastread_d[lrp_mus++&15]; }\r
-unsigned int m68k_read_memory_16(unsigned int a) { if(a<Pico.romsize) return *(u16 *)(Pico.rom+(a&~1));return (u16) lastread_d[lrp_mus++&15]; }\r
-unsigned int m68k_read_memory_32(unsigned int a) { if(a<Pico.romsize) {u16 *pm=(u16 *)(Pico.rom+(a&~1));return (pm[0]<<16)|pm[1];} return lastread_d[lrp_mus++&15]; }\r
+unsigned int m68k_read_memory_8(unsigned int a)\r
+{\r
+ u8 d;\r
+ if(a<Pico.romsize) d = *(u8 *) (Pico.rom+(a^1));\r
+ else d = (u8) lastread_d[lrp_mus++&15];\r
+#ifdef __debug_io\r
+ dprintf("r8_mu : %06x, %02x @%06x", a&0xffffff, d, SekPc);\r
+#endif\r
+ return d;\r
+}\r
+unsigned int m68k_read_memory_16(unsigned int a)\r
+{\r
+ u16 d;\r
+ if(a<Pico.romsize) d = *(u16 *)(Pico.rom+(a&~1));\r
+ else d = (u16) lastread_d[lrp_mus++&15];\r
+#ifdef __debug_io\r
+ dprintf("r16_mu: %06x, %04x @%06x", a&0xffffff, d, SekPc);\r
+#endif\r
+ return d;\r
+}\r
+unsigned int m68k_read_memory_32(unsigned int a)\r
+{\r
+ u32 d;\r
+ if(a<Pico.romsize) {u16 *pm=(u16 *)(Pico.rom+(a&~1));d=(pm[0]<<16)|pm[1];}\r
+ else d = lastread_d[lrp_mus++&15];\r
+#ifdef __debug_io\r
+ dprintf("r32_mu: %06x, %08x @%06x", a&0xffffff, d, SekPc);\r
+#endif\r
+ return d;\r
+}\r
\r
// ignore writes, Cyclone already done that\r
void m68k_write_memory_8(unsigned int address, unsigned int value) { lastwrite_mus_d[lwp_mus++&15] = value; }\r