X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=Pico%2FPicoInt.h;h=cd4d00e88dfa4c535b12e3b6a27765f8efae3519;hb=1cb1584b86a5679b8d32ccfc190f6e76c920810f;hp=0cd0644b75c7917fa84f1388842750e9213b3178;hpb=b542be4686241c9e0722ff8e452980f9ac2b4d7c;p=picodrive.git diff --git a/Pico/PicoInt.h b/Pico/PicoInt.h index 0cd0644..cd4d00e 100644 --- a/Pico/PicoInt.h +++ b/Pico/PicoInt.h @@ -13,6 +13,7 @@ #include #include #include "Pico.h" +#include "carthw/carthw.h" // #define USE_POLL_DETECT @@ -48,6 +49,7 @@ extern struct Cyclone PicoCpuCM68k, PicoCpuCS68k; #define SekPcS68k (PicoCpuCS68k.pc-PicoCpuCS68k.membase) #define SekSetStop(x) { PicoCpuCM68k.state_flags&=~1; if (x) { PicoCpuCM68k.state_flags|=1; PicoCpuCM68k.cycles=0; } } #define SekSetStopS68k(x) { PicoCpuCS68k.state_flags&=~1; if (x) { PicoCpuCS68k.state_flags|=1; PicoCpuCS68k.cycles=0; } } +#define SekIsStoppedS68k() (PicoCpuCS68k.state_flags&1) #define SekShouldInterrupt (PicoCpuCM68k.irq > (PicoCpuCM68k.srh&7)) #define SekInterrupt(i) PicoCpuCM68k.irq=i @@ -79,6 +81,7 @@ extern M68K_CONTEXT PicoCpuFM68k, PicoCpuFS68k; PicoCpuFS68k.execinfo &= ~FM68K_HALTED; \ if (x) { PicoCpuFS68k.execinfo |= FM68K_HALTED; PicoCpuFS68k.io_cycle_counter = 0; } \ } +#define SekIsStoppedS68k() (PicoCpuFS68k.execinfo&FM68K_HALTED) #define SekShouldInterrupt fm68k_would_interrupt() #define SekInterrupt(irq) PicoCpuFM68k.interrupts[0]=irq @@ -111,9 +114,10 @@ extern m68ki_cpu_core PicoCpuMM68k, PicoCpuMS68k; if(x) { SET_CYCLES(0); PicoCpuMS68k.stopped=STOP_LEVEL_STOP; } \ else PicoCpuMS68k.stopped=0; \ } +#define SekIsStoppedS68k() (PicoCpuMS68k.stopped==STOP_LEVEL_STOP) #define SekShouldInterrupt (CPU_INT_LEVEL > FLAG_INT_MASK) -#define SekInterrupt(irq) { +#define SekInterrupt(irq) { \ void *oldcontext = m68ki_cpu_p; \ m68k_set_context(&PicoCpuMM68k); \ m68k_set_irq(irq); \ @@ -165,7 +169,7 @@ extern int SekCycleAimS68k; // ----------------------- Z80 CPU ----------------------- #if defined(_USE_MZ80) -#include "../../cpu/mz80/mz80.h" +#include "../cpu/mz80/mz80.h" #define z80_run(cycles) mz80_run(cycles) #define z80_run_nr(cycles) mz80_run(cycles) @@ -173,7 +177,7 @@ extern int SekCycleAimS68k; #define z80_resetCycles() mz80GetElapsedTicks(1) #elif defined(_USE_DRZ80) -#include "../../cpu/DrZ80/drz80.h" +#include "../cpu/DrZ80/drz80.h" extern struct DrZ80 drZ80; @@ -186,7 +190,7 @@ extern struct DrZ80 drZ80; #define z80_resetCycles() #elif defined(_USE_CZ80) -#include "../../cpu/cz80/cz80.h" +#include "../cpu/cz80/cz80.h" #define z80_run(cycles) Cz80_Exec(&CZ80, cycles) #define z80_run_nr(cycles) Cz80_Exec(&CZ80, cycles) @@ -331,10 +335,10 @@ typedef struct union { // 0a0000: 256K struct { unsigned char word_ram2M[0x40000]; - unsigned char unused[0x20000]; + unsigned char unused0[0x20000]; }; struct { - unsigned char unused[0x20000]; + unsigned char unused1[0x20000]; unsigned char word_ram1M[2][0x20000]; }; }; @@ -358,13 +362,22 @@ typedef struct // Area.c PICO_INTERNAL int PicoAreaPackCpu(unsigned char *cpu, int is_sub); PICO_INTERNAL int PicoAreaUnpackCpu(unsigned char *cpu, int is_sub); +extern void (*PicoLoadStateHook)(void); // cd/Area.c PICO_INTERNAL int PicoCdSaveState(void *file); PICO_INTERNAL int PicoCdLoadState(void *file); +typedef struct { + int chunk; + int size; + void *ptr; +} carthw_state_chunk; +extern carthw_state_chunk *carthw_chunks; +#define CHUNK_CARTHW 64 + // Cart.c -PICO_INTERNAL void PicoCartDetect(void); +extern void (*PicoCartUnloadHook)(void); // Debug.c int CM_compareRun(int cyc, int is_sub); @@ -381,6 +394,7 @@ PICO_INTERNAL int PicoInitPc(unsigned int pc); PICO_INTERNAL_ASM unsigned int PicoRead32(unsigned int a); PICO_INTERNAL void PicoMemSetup(void); PICO_INTERNAL_ASM void PicoMemReset(void); +PICO_INTERNAL void PicoMemResetHooks(void); PICO_INTERNAL int PadRead(int i); PICO_INTERNAL unsigned char z80_read(unsigned short a); #ifndef _USE_CZ80 @@ -390,6 +404,9 @@ PICO_INTERNAL unsigned short z80_read16(unsigned short a); #else PICO_INTERNAL_ASM void z80_write(unsigned int a, unsigned char data); #endif +extern unsigned int (*PicoRead16Hook)(unsigned int a, int realsize); +extern void (*PicoWrite8Hook) (unsigned int a,unsigned int d,int realsize); +extern void (*PicoWrite16Hook)(unsigned int a,unsigned int d,int realsize); // cd/Memory.c PICO_INTERNAL void PicoMemSetupCD(void); @@ -401,12 +418,15 @@ extern struct Pico Pico; extern struct PicoSRAM SRam; extern int emustatus; extern int z80startCycle, z80stopCycle; // in 68k cycles +extern void (*PicoResetHook)(void); +extern void (*PicoLineHook)(int count); PICO_INTERNAL int CheckDMA(void); // cd/Pico.c PICO_INTERNAL int PicoInitMCD(void); PICO_INTERNAL void PicoExitMCD(void); -PICO_INTERNAL int PicoResetMCD(int hard); +PICO_INTERNAL void PicoPowerMCD(void); +PICO_INTERNAL int PicoResetMCD(void); PICO_INTERNAL int PicoFrameMCD(void); // Sek.c @@ -427,6 +447,7 @@ extern int PsndLen_exc_add; // VideoPort.c PICO_INTERNAL_ASM void PicoVideoWrite(unsigned int a,unsigned short d); PICO_INTERNAL_ASM unsigned int PicoVideoRead(unsigned int a); +extern int (*PicoDmaHook)(unsigned int source, int len, unsigned short **srcp, unsigned short **limitp); // Misc.c PICO_INTERNAL void SRAMWriteEEPROM(unsigned int d); @@ -466,32 +487,43 @@ PICO_INTERNAL void z80_exit(void); #define EL_LOGMASK 0 #endif -#define EL_HVCNT 0x0001 /* hv counter reads */ -#define EL_SR 0x0002 /* SR reads */ -#define EL_INTS 0x0004 /* ints and acks */ -#define EL_YM2612R 0x0008 /* 68k ym2612 reads */ -#define EL_INTSW 0x0010 /* log irq switching on/off */ -#define EL_ASVDP 0x0020 /* VDP accesses during active scan */ -#define EL_VDPDMA 0x0040 /* VDP DMA transfers and their timing */ -#define EL_BUSREQ 0x0080 /* z80 busreq r/w or reset w */ -#define EL_Z80BNK 0x0100 /* z80 i/o through bank area */ -#define EL_SRAMIO 0x0200 /* sram i/o */ -#define EL_EEPROM 0x0400 /* eeprom debug */ -#define EL_UIO 0x0800 /* unmapped i/o */ -#define EL_IO 0x1000 /* all i/o (TODO) */ - -#define EL_STATUS 0x4000 /* status messages */ -#define EL_ANOMALY 0x8000 /* some unexpected conditions */ +#define EL_HVCNT 0x00000001 /* hv counter reads */ +#define EL_SR 0x00000002 /* SR reads */ +#define EL_INTS 0x00000004 /* ints and acks */ +#define EL_YM2612R 0x00000008 /* 68k ym2612 reads */ +#define EL_INTSW 0x00000010 /* log irq switching on/off */ +#define EL_ASVDP 0x00000020 /* VDP accesses during active scan */ +#define EL_VDPDMA 0x00000040 /* VDP DMA transfers and their timing */ +#define EL_BUSREQ 0x00000080 /* z80 busreq r/w or reset w */ +#define EL_Z80BNK 0x00000100 /* z80 i/o through bank area */ +#define EL_SRAMIO 0x00000200 /* sram i/o */ +#define EL_EEPROM 0x00000400 /* eeprom debug */ +#define EL_UIO 0x00000800 /* unmapped i/o */ +#define EL_IO 0x00001000 /* all i/o */ +#define EL_CDPOLL 0x00002000 /* MCD: log poll detection */ +#define EL_SVP 0x00004000 /* SVP stuff */ + +#define EL_STATUS 0x40000000 /* status messages */ +#define EL_ANOMALY 0x80000000 /* some unexpected conditions (during emulation) */ #if EL_LOGMASK +extern void lprintf(const char *fmt, ...); #define elprintf(w,f,...) \ { \ if ((w) & EL_LOGMASK) \ - printf("%05i:%03i: " f "\n",Pico.m.frame_count,Pico.m.scanline,##__VA_ARGS__); \ + lprintf("%05i:%03i: " f "\n",Pico.m.frame_count,Pico.m.scanline,##__VA_ARGS__); \ } +#elif defined(_MSC_VER) +#define elprintf #else #define elprintf(w,f,...) #endif +#ifdef _MSC_VER +#define cdprintf +#else +#define cdprintf(x...) +#endif + #endif // PICO_INTERNAL_INCLUDED