svp compiler: working asm dispatcher
[picodrive.git] / Pico / PicoInt.h
index ed97081..f29c20b 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
@@ -168,7 +169,7 @@ extern int SekCycleAimS68k;
 // ----------------------- Z80 CPU -----------------------\r
 \r
 #if defined(_USE_MZ80)\r
-#include "../../cpu/mz80/mz80.h"\r
+#include "../cpu/mz80/mz80.h"\r
 \r
 #define z80_run(cycles)    mz80_run(cycles)\r
 #define z80_run_nr(cycles) mz80_run(cycles)\r
@@ -176,7 +177,7 @@ extern int SekCycleAimS68k;
 #define z80_resetCycles()  mz80GetElapsedTicks(1)\r
 \r
 #elif defined(_USE_DRZ80)\r
-#include "../../cpu/DrZ80/drz80.h"\r
+#include "../cpu/DrZ80/drz80.h"\r
 \r
 extern struct DrZ80 drZ80;\r
 \r
@@ -189,7 +190,7 @@ extern struct DrZ80 drZ80;
 #define z80_resetCycles()\r
 \r
 #elif defined(_USE_CZ80)\r
-#include "../../cpu/cz80/cz80.h"\r
+#include "../cpu/cz80/cz80.h"\r
 \r
 #define z80_run(cycles)    Cz80_Exec(&CZ80, cycles)\r
 #define z80_run_nr(cycles) Cz80_Exec(&CZ80, cycles)\r
@@ -334,10 +335,10 @@ typedef struct
        union {                                         // 0a0000: 256K\r
                struct {\r
                        unsigned char word_ram2M[0x40000];\r
-                       unsigned char unused[0x20000];\r
+                       unsigned char unused0[0x20000];\r
                };\r
                struct {\r
-                       unsigned char unused[0x20000];\r
+                       unsigned char unused1[0x20000];\r
                        unsigned char word_ram1M[2][0x20000];\r
                };\r
        };\r
@@ -366,8 +367,17 @@ PICO_INTERNAL int PicoAreaUnpackCpu(unsigned char *cpu, int is_sub);
 PICO_INTERNAL int PicoCdSaveState(void *file);\r
 PICO_INTERNAL int PicoCdLoadState(void *file);\r
 \r
+typedef struct {\r
+       int chunk;\r
+       int size;\r
+       void *ptr;\r
+} carthw_state_chunk;\r
+extern carthw_state_chunk *carthw_chunks;\r
+#define CHUNK_CARTHW 64\r
+\r
 // Cart.c\r
 PICO_INTERNAL void PicoCartDetect(void);\r
+extern void (*PicoCartUnloadHook)(void);\r
 \r
 // Debug.c\r
 int CM_compareRun(int cyc, int is_sub);\r
@@ -384,6 +394,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
@@ -393,6 +404,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
@@ -404,6 +418,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
@@ -430,6 +446,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
@@ -469,23 +486,24 @@ 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 */\r
-#define EL_CDPOLL  0x2000 /* MCD: log poll detection */\r
-\r
-#define EL_STATUS  0x4000 /* status messages */\r
-#define EL_ANOMALY 0x8000 /* some unexpected conditions (during emulation) */\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
@@ -494,9 +512,17 @@ extern void lprintf(const char *fmt, ...);
        if ((w) & EL_LOGMASK) \\r
                lprintf("%05i:%03i: " f "\n",Pico.m.frame_count,Pico.m.scanline,##__VA_ARGS__); \\r
 }\r
+#elif defined(_MSC_VER)\r
+#define elprintf\r
 #else\r
 #define elprintf(w,f,...)\r
 #endif\r
 \r
+#ifdef _MSC_VER\r
+#define cdprintf\r
+#else\r
+#define cdprintf(x...)\r
+#endif\r
+\r
 #endif // PICO_INTERNAL_INCLUDED\r
 \r