// sn76496\r
extern int *sn76496_regs;\r
\r
-\r
struct PicoArea { void *data; int len; char *name; };\r
\r
// strange observation on Symbian OS 9.1, m600 organizer fw r3a06:\r
// Save or load the state from PmovFile:\r
static int PmovState(int is_write, void *PmovFile)\r
{\r
- int minimum=0;\r
unsigned char head[32];\r
\r
if ((PicoAHW & PAHW_MCD) || carthw_chunks != NULL)\r
\r
memset(head,0,sizeof(head));\r
\r
- // Find out minimal compatible version:\r
- minimum = 0x0021;\r
-\r
+ // not really used..\r
memcpy(head,"Pico",4);\r
- *(unsigned int *)(head+0x8)=PicoVer;\r
- *(unsigned int *)(head+0xc)=minimum;\r
+ *(unsigned int *)(head+0x8)=0x0133;\r
+ *(unsigned int *)(head+0xc)=0x0021;\r
\r
// Scan header:\r
if (is_write)\r
{
unsigned char buff[0x60];
void *ym2612_regs = YM2612GetRegs();
+ int ver = 0x0133; // not really used..
areaWrite("PicoSEXT", 1, 8, file);
- areaWrite(&PicoVer, 1, 4, file);
+ areaWrite(&ver, 1, 4, file);
memset(buff, 0, sizeof(buff));
PicoAreaPackCpu(buff, 0);
CHECKED_WRITE_BUFF(CHUNK_VSRAM, Pico.vsram);
CHECKED_WRITE_BUFF(CHUNK_MISC, Pico.m);
CHECKED_WRITE_BUFF(CHUNK_VIDEO, Pico.video);
- if (PicoOpt&7) {
- memset(buff, 0, sizeof(buff));
- z80_pack(buff);
- CHECKED_WRITE_BUFF(CHUNK_Z80, buff);
- }
- if (PicoOpt&3)
- CHECKED_WRITE(CHUNK_PSG, 28*4, sn76496_regs);
- if (PicoOpt&1) {
- ym2612_pack_state();
- CHECKED_WRITE(CHUNK_FM, 0x200+4, ym2612_regs);
- }
+
+ memset(buff, 0, sizeof(buff));
+ z80_pack(buff);
+ CHECKED_WRITE_BUFF(CHUNK_Z80, buff);
+ CHECKED_WRITE(CHUNK_PSG, 28*4, sn76496_regs);
+ ym2612_pack_state();
+ CHECKED_WRITE(CHUNK_FM, 0x200+4, ym2612_regs);
if (PicoAHW & PAHW_MCD)
{
#include "pico_int.h"\r
#include "sound/ym2612.h"\r
\r
-int PicoVer=0x0133;\r
struct Pico Pico;\r
-int PicoOpt = 0;\r
-int PicoSkipFrame = 0; // skip rendering frame?\r
-int emustatus = 0; // rapid_ym2612, multi_ym_updates\r
+int PicoOpt; \r
+int PicoSkipFrame; // skip rendering frame?\r
int PicoPad[2]; // Joypads, format is MXYZ SACB RLDU\r
int PicoPadInt[2]; // internal copy\r
-int PicoAHW = 0; // active addon hardware: scd_active, 32x_active, svp_active, pico_active\r
-int PicoRegionOverride = 0; // override the region detection 0: Auto, 1: Japan NTSC, 2: Japan PAL, 4: US, 8: Europe\r
-int PicoAutoRgnOrder = 0;\r
-struct PicoSRAM SRam = {0,};\r
+int PicoAHW; // active addon hardware: PAHW_*\r
+int PicoRegionOverride; // override the region detection 0: Auto, 1: Japan NTSC, 2: Japan PAL, 4: US, 8: Europe\r
+int PicoAutoRgnOrder;\r
+\r
+struct PicoSRAM SRam;\r
+int emustatus; // rapid_ym2612, multi_ym_updates\r
+int scanlines_total;\r
\r
void (*PicoWriteSound)(int len) = NULL; // called at the best time to send sound buffer (PsndOut) to hardware\r
void (*PicoResetHook)(void) = NULL;\r
return 0;\r
}\r
\r
+// flush cinfig changes before emu loop starts\r
+void PicoLoopPrepare(void)\r
+{\r
+ if (PicoRegionOverride)\r
+ // force setting possibly changed..\r
+ Pico.m.pal = (PicoRegionOverride == 2 || PicoRegionOverride == 8) ? 1 : 0;\r
+\r
+ // FIXME: PAL has 313 scanlines..\r
+ scanlines_total = Pico.m.pal ? 312 : 262;\r
+}\r
+\r
\r
// dma2vram settings are just hacks to unglitch Legend of Galahad (needs <= 104 to work)\r
// same for Outrunners (92-121, when active is set to 24)\r
#define POPT_DIS_SPRITE_LIM (1<<18)\r
#define POPT_DIS_IDLE_DET (1<<19)\r
#define POPT_DIS_32X (1<<20)\r
+#define POPT_DIS_PWM (1<<21)\r
extern int PicoOpt; // bitfield\r
\r
#define PAHW_MCD (1<<0)\r
#define PAHW_PICO (1<<3)\r
#define PAHW_SMS (1<<4)\r
extern int PicoAHW; // Pico active hw\r
-extern int PicoVer;\r
extern int PicoSkipFrame; // skip rendering frame, but still do sound (if enabled) and emulation stuff\r
extern int PicoRegionOverride; // override the region detection 0: auto, 1: Japan NTSC, 2: Japan PAL, 4: US, 8: Europe\r
extern int PicoAutoRgnOrder; // packed priority list of regions, for example 0x148 means this detection order: EUR, USA, JAP\r
void PicoExit(void);\r
void PicoPower(void);\r
int PicoReset(void);\r
+void PicoLoopPrepare(void);\r
void PicoFrame(void);\r
void PicoFrameDrawOnly(void);\r
extern int PicoPad[2]; // Joypads, format is MXYZ SACB RLDU\r
if (PicoLineHook) PicoLineHook();
#endif
- // PAL line count might actually be 313 according to Steve Snake, but that would complicate things.
- lines = Pico.m.pal ? 312 : 262;
- vcnt_wrap = Pico.m.pal ? 0x103 : 0xEB; // based on Gens
+ lines = scanlines_total;
+ vcnt_wrap = Pico.m.pal ? 0x103 : 0xEB; // based on Gens, TODO: verify
for (y++; y < lines; y++)
{
// 32X\r
#define P32XS_FM (1<<15)\r
#define P32XS2_ADEN (1<< 9)\r
-#define P32XS_FULL (1<< 7)\r
+#define P32XS_FULL (1<< 7) // DREQ FIFO full\r
#define P32XS_68S (1<< 2)\r
#define P32XS_RV (1<< 0)\r
\r
-#define P32XV_nPAL (1<<15)\r
+#define P32XV_nPAL (1<<15) // VDP\r
#define P32XV_PRI (1<< 7)\r
#define P32XV_Mx (3<< 0) // display mode mask\r
\r
unsigned char sh2_rom_m[0x800];\r
unsigned char sh2_rom_s[0x400];\r
unsigned short pal[0x100];\r
- unsigned short pal_native[0x100]; // converted to native (for renderer)\r
+ unsigned short pal_native[0x100]; // converted to native (for renderer)\r
unsigned int sh2_peri_regs[2][0x200/4]; // periphereal regs of SH2s\r
};\r
\r
extern struct PicoSRAM SRam;\r
extern int PicoPadInt[2];\r
extern int emustatus;\r
+extern int scanlines_total;\r
extern void (*PicoResetHook)(void);\r
extern void (*PicoLineHook)(void);\r
PICO_INTERNAL int CheckDMA(void);\r
// prepare CD buffer\r
if (PicoAHW & PAHW_MCD)\r
PicoCDBufferInit();\r
+ PicoLoopPrepare();\r
\r
pemu_loop_prep();\r
\r
\r
me_loop(e_menu_options, &sel, NULL);\r
\r
- if (PicoRegionOverride)\r
- // force setting possibly changed..\r
- Pico.m.pal = (PicoRegionOverride == 2 || PicoRegionOverride == 8) ? 1 : 0;\r
-\r
return 0;\r
}\r
\r