else PicoMemSetup();\r
PicoMemReset();\r
\r
- return PicoReset(1);\r
+ PicoPower();\r
+ return 0;\r
}\r
\r
int PicoCartUnload(void)\r
sram_size = 0x004000;\r
}\r
\r
+ // this game actually doesn't have SRAM, but some weird protection\r
+ if (rom_strcmp(0x120, "PUGGSY") == 0)\r
+ {\r
+ SRam.start = SRam.end = sram_size = 0;\r
+ }\r
+\r
if (sram_size)\r
{\r
SRam.data = (unsigned char *) calloc(sram_size, 1);\r
PicoExitMCD();\r
z80_exit();\r
\r
- if(SRam.data) free(SRam.data); SRam.data=0;\r
+ if (SRam.data) free(SRam.data); SRam.data=0;\r
}\r
\r
-int PicoReset(int hard)\r
+void PicoPower(void)\r
+{\r
+ // clear all memory of the emulated machine\r
+ memset(&Pico.ram,0,(unsigned int)&Pico.rom-(unsigned int)&Pico.ram);\r
+\r
+ memset(&Pico.video,0,sizeof(Pico.video));\r
+ memset(&Pico.m,0,sizeof(Pico.m));\r
+\r
+ Pico.video.pending_ints=0;\r
+ z80_reset();\r
+\r
+ // default VDP register values (based on Fusion)\r
+ Pico.video.reg[0] = Pico.video.reg[1] = 0x04;\r
+ Pico.video.reg[0xc] = 0x81;\r
+ Pico.video.reg[0xf] = 0x02;\r
+\r
+ if (PicoMCD & 1)\r
+ PicoPowerMCD();\r
+\r
+ PicoReset();\r
+}\r
+\r
+int PicoReset(void)\r
{\r
unsigned int region=0;\r
int support=0,hw=0,i=0;\r
// s68k doesn't have the TAS quirk, so we just globally set normal TAS handler in MCD mode (used by Batman games).\r
SekSetRealTAS(PicoMCD & 1);\r
SekCycleCntT=0;\r
- z80_reset();\r
\r
- // reset VDP state, VRAM and PicoMisc\r
- //memset(&Pico.video,0,sizeof(Pico.video));\r
- //memset(&Pico.vram,0,sizeof(Pico.vram));\r
- memset(Pico.ioports,0,sizeof(Pico.ioports)); // needed for MCD to reset properly\r
- memset(&Pico.m,0,sizeof(Pico.m));\r
- Pico.video.pending_ints=0;\r
+ if (PicoMCD & 1)\r
+ // needed for MCD to reset properly, probably some bug hides behind this..\r
+ memset(Pico.ioports,0,sizeof(Pico.ioports));\r
emustatus = 0;\r
\r
- if (hard) {\r
- // clear all memory of the emulated machine\r
- memset(&Pico.ram,0,(unsigned int)&Pico.rom-(unsigned int)&Pico.ram);\r
- }\r
-\r
- // default VDP register values (based on Fusion)\r
- Pico.video.reg[0] = Pico.video.reg[1] = 0x04;\r
- Pico.video.reg[0xc] = 0x81;\r
- Pico.video.reg[0xf] = 0x02;\r
Pico.m.dirtyPal = 1;\r
\r
if(PicoRegionOverride)\r
\r
Pico.m.hardware=(unsigned char)(hw|0x20); // No disk attached\r
Pico.m.pal=pal;\r
- Pico.video.status = 0x3408 | pal; // always set bits | vblank | pal\r
+ Pico.video.status = 0x3408 | pal; // 'always set' bits | vblank | pal\r
\r
PsndReset(); // pal must be known here\r
\r
+ // create an empty "dma" to cause 68k exec start at random frame location\r
+ if (Pico.m.dma_xfers == 0 && !(PicoOpt&0x10000))\r
+ Pico.m.dma_xfers = rand() & 0x1fff;\r
+\r
if (PicoMCD & 1) {\r
- PicoResetMCD(hard);\r
+ PicoResetMCD();\r
return 0;\r
}\r
\r
extern int PicoSVPCycles;\r
int PicoInit(void);\r
void PicoExit(void);\r
-int PicoReset(int hard);\r
+void PicoPower(void);\r
+int PicoReset(void);\r
int PicoFrame(void);\r
void PicoFrameDrawOnly(void);\r
extern int PicoPad[2]; // Joypads, format is MXYZ SACB RLDU\r
// cd/Pico.c\r
PICO_INTERNAL int PicoInitMCD(void);\r
PICO_INTERNAL void PicoExitMCD(void);\r
-PICO_INTERNAL int PicoResetMCD(int hard);\r
+PICO_INTERNAL void PicoPowerMCD(void);\r
+PICO_INTERNAL int PicoResetMCD(void);\r
PICO_INTERNAL int PicoFrameMCD(void);\r
\r
// Sek.c\r
//dump_ram(Pico.ram, "ram.bin");
}
-PICO_INTERNAL int PicoResetMCD(int hard)
+PICO_INTERNAL void PicoPowerMCD(void)
+{
+ int fmt_size = sizeof(formatted_bram);
+ memset(Pico_mcd->prg_ram, 0, sizeof(Pico_mcd->prg_ram));
+ memset(Pico_mcd->word_ram2M, 0, sizeof(Pico_mcd->word_ram2M));
+ memset(Pico_mcd->pcm_ram, 0, sizeof(Pico_mcd->pcm_ram));
+ memset(Pico_mcd->bram, 0, sizeof(Pico_mcd->bram));
+ memcpy(Pico_mcd->bram + sizeof(Pico_mcd->bram) - fmt_size, formatted_bram, fmt_size);
+}
+
+PICO_INTERNAL int PicoResetMCD(void)
{
- if (hard) {
- int fmt_size = sizeof(formatted_bram);
- memset(Pico_mcd->prg_ram, 0, sizeof(Pico_mcd->prg_ram));
- memset(Pico_mcd->word_ram2M, 0, sizeof(Pico_mcd->word_ram2M));
- memset(Pico_mcd->pcm_ram, 0, sizeof(Pico_mcd->pcm_ram));
- memset(Pico_mcd->bram, 0, sizeof(Pico_mcd->bram));
- memcpy(Pico_mcd->bram + sizeof(Pico_mcd->bram) - fmt_size, formatted_bram, fmt_size);
- }
memset(Pico_mcd->s68k_regs, 0, sizeof(Pico_mcd->s68k_regs));
memset(&Pico_mcd->pcm, 0, sizeof(Pico_mcd->pcm));
memset(&Pico_mcd->m, 0, sizeof(Pico_mcd->m));
} else {\r
PicoRegionOverride = 4;\r
}\r
- PicoReset(0);\r
+ PicoReset();\r
// TODO: bits 6 & 5\r
}\r
movie_data[0x18+30] = 0;\r
void emu_ResetGame(void)
{
- PicoReset(0);
+ PicoReset();
reset_timing = 1;
}
\r
void emu_ResetGame(void)\r
{\r
- PicoReset(0);\r
+ PicoReset();\r
reset_timing = 1;\r
}\r
\r
void emu_ResetGame(void)
{
- PicoReset(0);
+ PicoReset();
reset_timing = 1;
}
\r
case PicoMsgReset: \r
if(rom_data) {\r
- PicoReset(0);\r
+ PicoReset();\r
pico_was_reset = 1;\r
gamestate = PGS_Running;\r
}\r
\r
case PicoMsgReset: \r
if(rom_data) {\r
- PicoReset(0);\r
+ PicoReset();\r
pico_was_reset = 1;\r
return ChangeRunState(PGS_Running);\r
}\r
\r
static int sblobked = 0;\r
if (!sblobked && GetAsyncKeyState(VK_TAB)) {\r
- PicoReset(0);\r
+ PicoReset();\r
sblobked = 1;\r
}\r
else if (!sblobked && GetAsyncKeyState(VK_ESCAPE))\r