svp minor adjustments, copyright
[picodrive.git] / Pico / PicoInt.h
index 0cd0644..e2ce1ad 100644 (file)
@@ -13,6 +13,7 @@
 #include <stdlib.h>\r
 #include <string.h>\r
 #include "Pico.h"\r
+#include "carthw/carthw.h"\r
 \r
 //\r
 #define USE_POLL_DETECT\r
@@ -48,6 +49,7 @@ extern struct Cyclone PicoCpuCM68k, PicoCpuCS68k;
 #define SekPcS68k (PicoCpuCS68k.pc-PicoCpuCS68k.membase)\r
 #define SekSetStop(x) { PicoCpuCM68k.state_flags&=~1; if (x) { PicoCpuCM68k.state_flags|=1; PicoCpuCM68k.cycles=0; } }\r
 #define SekSetStopS68k(x) { PicoCpuCS68k.state_flags&=~1; if (x) { PicoCpuCS68k.state_flags|=1; PicoCpuCS68k.cycles=0; } }\r
+#define SekIsStoppedS68k() (PicoCpuCS68k.state_flags&1)\r
 #define SekShouldInterrupt (PicoCpuCM68k.irq > (PicoCpuCM68k.srh&7))\r
 \r
 #define SekInterrupt(i) PicoCpuCM68k.irq=i\r
@@ -79,6 +81,7 @@ extern M68K_CONTEXT PicoCpuFM68k, PicoCpuFS68k;
        PicoCpuFS68k.execinfo &= ~FM68K_HALTED; \\r
        if (x) { PicoCpuFS68k.execinfo |= FM68K_HALTED; PicoCpuFS68k.io_cycle_counter = 0; } \\r
 }\r
+#define SekIsStoppedS68k() (PicoCpuFS68k.execinfo&FM68K_HALTED)\r
 #define SekShouldInterrupt fm68k_would_interrupt()\r
 \r
 #define SekInterrupt(irq) PicoCpuFM68k.interrupts[0]=irq\r
@@ -111,9 +114,10 @@ extern m68ki_cpu_core PicoCpuMM68k, PicoCpuMS68k;
        if(x) { SET_CYCLES(0); PicoCpuMS68k.stopped=STOP_LEVEL_STOP; } \\r
        else PicoCpuMS68k.stopped=0; \\r
 }\r
+#define SekIsStoppedS68k() (PicoCpuMS68k.stopped==STOP_LEVEL_STOP)\r
 #define SekShouldInterrupt (CPU_INT_LEVEL > FLAG_INT_MASK)\r
 \r
-#define SekInterrupt(irq) {\r
+#define SekInterrupt(irq) { \\r
        void *oldcontext = m68ki_cpu_p; \\r
        m68k_set_context(&PicoCpuMM68k); \\r
        m68k_set_irq(irq); \\r
@@ -381,6 +385,7 @@ PICO_INTERNAL int PicoInitPc(unsigned int pc);
 PICO_INTERNAL_ASM unsigned int PicoRead32(unsigned int a);\r
 PICO_INTERNAL void PicoMemSetup(void);\r
 PICO_INTERNAL_ASM void PicoMemReset(void);\r
+PICO_INTERNAL void PicoMemResetHooks(void);\r
 PICO_INTERNAL int PadRead(int i);\r
 PICO_INTERNAL unsigned char z80_read(unsigned short a);\r
 #ifndef _USE_CZ80\r
@@ -390,6 +395,9 @@ PICO_INTERNAL unsigned short z80_read16(unsigned short a);
 #else\r
 PICO_INTERNAL_ASM void z80_write(unsigned int a, unsigned char data);\r
 #endif\r
+extern unsigned int (*PicoRead16Hook)(unsigned int a, int realsize);\r
+extern void (*PicoWrite8Hook) (unsigned int a,unsigned int d,int realsize);\r
+extern void (*PicoWrite16Hook)(unsigned int a,unsigned int d,int realsize);\r
 \r
 // cd/Memory.c\r
 PICO_INTERNAL void PicoMemSetupCD(void);\r
@@ -401,6 +409,8 @@ extern struct Pico Pico;
 extern struct PicoSRAM SRam;\r
 extern int emustatus;\r
 extern int z80startCycle, z80stopCycle; // in 68k cycles\r
+extern void (*PicoResetHook)(void);\r
+extern void (*PicoLineHook)(int count);\r
 PICO_INTERNAL int CheckDMA(void);\r
 \r
 // cd/Pico.c\r
@@ -427,6 +437,7 @@ extern int PsndLen_exc_add;
 // VideoPort.c\r
 PICO_INTERNAL_ASM void PicoVideoWrite(unsigned int a,unsigned short d);\r
 PICO_INTERNAL_ASM unsigned int PicoVideoRead(unsigned int a);\r
+extern int (*PicoDmaHook)(unsigned int source, int len, unsigned short **srcp, unsigned short **limitp);\r
 \r
 // Misc.c\r
 PICO_INTERNAL void SRAMWriteEEPROM(unsigned int d);\r
@@ -466,28 +477,31 @@ PICO_INTERNAL void z80_exit(void);
 #define EL_LOGMASK 0\r
 #endif\r
 \r
-#define EL_HVCNT   0x0001 /* hv counter reads */\r
-#define EL_SR      0x0002 /* SR reads */\r
-#define EL_INTS    0x0004 /* ints and acks */\r
-#define EL_YM2612R 0x0008 /* 68k ym2612 reads */\r
-#define EL_INTSW   0x0010 /* log irq switching on/off */\r
-#define EL_ASVDP   0x0020 /* VDP accesses during active scan */\r
-#define EL_VDPDMA  0x0040 /* VDP DMA transfers and their timing */\r
-#define EL_BUSREQ  0x0080 /* z80 busreq r/w or reset w */\r
-#define EL_Z80BNK  0x0100 /* z80 i/o through bank area */\r
-#define EL_SRAMIO  0x0200 /* sram i/o */\r
-#define EL_EEPROM  0x0400 /* eeprom debug */\r
-#define EL_UIO     0x0800 /* unmapped i/o */\r
-#define EL_IO      0x1000 /* all i/o (TODO) */\r
-\r
-#define EL_STATUS  0x4000 /* status messages */\r
-#define EL_ANOMALY 0x8000 /* some unexpected conditions */\r
+#define EL_HVCNT   0x00000001 /* hv counter reads */\r
+#define EL_SR      0x00000002 /* SR reads */\r
+#define EL_INTS    0x00000004 /* ints and acks */\r
+#define EL_YM2612R 0x00000008 /* 68k ym2612 reads */\r
+#define EL_INTSW   0x00000010 /* log irq switching on/off */\r
+#define EL_ASVDP   0x00000020 /* VDP accesses during active scan */\r
+#define EL_VDPDMA  0x00000040 /* VDP DMA transfers and their timing */\r
+#define EL_BUSREQ  0x00000080 /* z80 busreq r/w or reset w */\r
+#define EL_Z80BNK  0x00000100 /* z80 i/o through bank area */\r
+#define EL_SRAMIO  0x00000200 /* sram i/o */\r
+#define EL_EEPROM  0x00000400 /* eeprom debug */\r
+#define EL_UIO     0x00000800 /* unmapped i/o */\r
+#define EL_IO      0x00001000 /* all i/o */\r
+#define EL_CDPOLL  0x00002000 /* MCD: log poll detection */\r
+#define EL_SVP     0x00004000 /* SVP stuff */\r
+\r
+#define EL_STATUS  0x40000000 /* status messages */\r
+#define EL_ANOMALY 0x80000000 /* some unexpected conditions (during emulation) */\r
 \r
 #if EL_LOGMASK\r
+extern void lprintf(const char *fmt, ...);\r
 #define elprintf(w,f,...) \\r
 { \\r
        if ((w) & EL_LOGMASK) \\r
-               printf("%05i:%03i: " f "\n",Pico.m.frame_count,Pico.m.scanline,##__VA_ARGS__); \\r
+               lprintf("%05i:%03i: " f "\n",Pico.m.frame_count,Pico.m.scanline,##__VA_ARGS__); \\r
 }\r
 #else\r
 #define elprintf(w,f,...)\r