X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=pico%2Fpico_int.h;h=89cccc79ee22f1e44e9f4033a1742eb68fcd6ab3;hb=e64886365da9e882b54e06ab683ee4db60171e32;hp=551dcbc72f3625933a5b596a8024daa3255601a7;hpb=4f2cdbf551ad1a7f487b65b4754cbf7983e80b8a;p=picodrive.git diff --git a/pico/pico_int.h b/pico/pico_int.h index 551dcbc..89cccc7 100644 --- a/pico/pico_int.h +++ b/pico/pico_int.h @@ -185,6 +185,7 @@ extern struct DrZ80 drZ80; #define z80_nmi() drZ80.Z80IF |= 8 #define z80_cyclesLeft drZ80.cycles +#define z80_subCLeft(c) drZ80.cycles -= c #define z80_pc() (drZ80.Z80PC - drZ80.Z80PC_BASE) #elif defined(_USE_CZ80) @@ -196,6 +197,7 @@ extern struct DrZ80 drZ80; #define z80_nmi() Cz80_Set_IRQ(&CZ80, IRQ_LINE_NMI, 0) #define z80_cyclesLeft (CZ80.ICount - CZ80.ExtraCycles) +#define z80_subCLeft(c) CZ80.ICount -= c #define z80_pc() Cz80_Get_Reg(&CZ80, CZ80_PC) #else @@ -209,20 +211,13 @@ extern struct DrZ80 drZ80; #define Z80_STATE_SIZE 0x60 -extern unsigned int last_z80_sync; -extern int z80_cycle_cnt; /* 'done' z80 cycles before z80_run() */ -extern int z80_cycle_aim; -extern int z80_scanline; -extern int z80_scanline_cycles; /* cycles done until z80_scanline */ - #define z80_resetCycles() \ - last_z80_sync = SekCyclesDone(); \ - z80_cycle_cnt = z80_cycle_aim = z80_scanline = z80_scanline_cycles = 0; + timing.z80c_cnt = timing.z80c_aim = timing.z80_scanline = 0 #define z80_cyclesDone() \ - (z80_cycle_aim - z80_cyclesLeft) + (timing.z80c_aim - z80_cyclesLeft) -#define cycles_68k_to_z80(x) ((x)*957 >> 11) +#define cycles_68k_to_z80(x) ((x) * 3823 >> 13) // ----------------------- SH2 CPU ----------------------- @@ -281,6 +276,7 @@ extern SH2 sh2s[2]; #define OSC_NTSC 53693100 #define OSC_PAL 53203424 +// PicoVideo.debug_p #define PVD_KILL_A (1 << 0) #define PVD_KILL_B (1 << 1) #define PVD_KILL_S_LO (1 << 2) @@ -290,6 +286,20 @@ extern SH2 sh2s[2]; #define PVD_FORCE_B (1 << 6) #define PVD_FORCE_S (1 << 7) +// PicoVideo.status, not part of real SR +#define SR_PAL (1 << 0) +#define SR_DMA (1 << 1) +#define SR_HB (1 << 2) +#define SR_VB (1 << 3) +#define SR_ODD (1 << 4) +#define SR_C (1 << 5) +#define SR_SOVR (1 << 6) +#define SR_F (1 << 7) +#define SR_FULL (1 << 8) +#define SR_EMPT (1 << 9) +// not part of real SR +#define PVS_ACTIVE (1 << 16) + struct PicoVideo { unsigned char reg[0x20]; @@ -297,14 +307,15 @@ struct PicoVideo unsigned char pending; // 1 if waiting for second half of 32-bit command unsigned char type; // Command type (v/c/vsram read/write) unsigned short addr; // Read/Write address - int status; // Status bits + unsigned int status; // Status bits (SR) and extra flags unsigned char pending_ints; // pending interrupts: ??VH???? signed char lwrite_cnt; // VDP write count during active display line unsigned short v_counter; // V-counter unsigned short debug; // raw debug register unsigned char debug_p; // ... parsed: PVD_* - unsigned char addr_u; - unsigned char pad[0x0c]; + unsigned char addr_u; // bit16 of .addr + unsigned char hint_cnt; + unsigned char pad[0x0b]; }; struct PicoMisc @@ -581,6 +592,15 @@ struct Pico32xMem unsigned short pwm_fifo[2][4]; // [0] - current raw, others - fifo entries }; +struct PicoTiming +{ + unsigned int m68c_frame_start; // m68k cycles + unsigned int z80c_cnt; // z80 cycles done (this frame) + unsigned int z80c_aim; + int z80_scanline; +}; +extern struct PicoTiming timing; + // area.c extern void (*PicoLoadStateHook)(void); @@ -682,7 +702,6 @@ extern struct Pico Pico; extern struct PicoSRAM SRam; extern int PicoPadInt[2]; extern int emustatus; -extern int scanlines_total; extern void (*PicoResetHook)(void); extern void (*PicoLineHook)(void); PICO_INTERNAL int CheckDMA(void); @@ -793,7 +812,12 @@ void ym2612_unpack_state(void); extern int line_base_cycles; PICO_INTERNAL_ASM void PicoVideoWrite(unsigned int a,unsigned short d); PICO_INTERNAL_ASM unsigned int PicoVideoRead(unsigned int a); -PICO_INTERNAL_ASM unsigned int PicoVideoRead8(unsigned int a); +unsigned char PicoVideoRead8DataH(void); +unsigned char PicoVideoRead8DataL(void); +unsigned char PicoVideoRead8CtlH(void); +unsigned char PicoVideoRead8CtlL(void); +unsigned char PicoVideoRead8HV_H(void); +unsigned char PicoVideoRead8HV_L(void); extern int (*PicoDmaHook)(unsigned int source, int len, unsigned short **base, unsigned int *mask); // misc.c @@ -822,10 +846,11 @@ PICO_INTERNAL_ASM void wram_1M_to_2M(unsigned char *m); PICO_INTERNAL void PsndReset(void); PICO_INTERNAL void PsndStartFrame(void); PICO_INTERNAL void PsndDoDAC(int line_to); +PICO_INTERNAL void PsndDoPSG(int line_to); PICO_INTERNAL void PsndClear(void); PICO_INTERNAL void PsndGetSamples(int y); PICO_INTERNAL void PsndGetSamplesMS(void); -extern int PsndDacLine; +extern int PsndDacLine, PsndPsgLine; // sms.c #ifndef NO_SMS @@ -1069,3 +1094,4 @@ void pevt_dump(void); #endif // PICO_INTERNAL_INCLUDED +// vim:shiftwidth=2:ts=2:expandtab