areaseek *areaSeek = (areaseek *) 0;\r
areaclose *areaClose = (areaclose *) 0;\r
\r
+void (*PicoLoadStateHook)(void) = NULL;\r
+\r
\r
// Scan one variable and callback\r
static int ScanVar(void *data,int len,char *name,void *PmovFile,int PmovAction)\r
if ((PicoMCD & 1) || carthw_chunks != NULL)\r
{\r
if (PmovAction&1) return PicoCdSaveState(PmovFile);\r
- if (PmovAction&2) return PicoCdLoadState(PmovFile);\r
+ if (PmovAction&2) {\r
+ int ret = PicoCdLoadState(PmovFile);\r
+ if (PicoLoadStateHook) PicoLoadStateHook();\r
+ return ret;\r
+ }\r
}\r
\r
memset(head,0,sizeof(head));\r
// Scan memory areas:\r
PicoAreaScan(PmovAction, *(unsigned int *)(head+0x8), PmovFile);\r
\r
+ if ((PmovAction&2) && PicoLoadStateHook) PicoLoadStateHook();\r
+\r
return 0;\r
}\r
\r
PicoDmaHook = NULL;\r
PicoResetHook = NULL;\r
PicoLineHook = NULL;\r
+ PicoLoadStateHook = NULL;\r
carthw_chunks = NULL;\r
\r
PicoMemReset();\r
\r
static int CheckIdle(void)\r
{\r
- int i, state[0x22];\r
+ int i, state[0x24];\r
\r
// See if the state is the same after 2 steps:\r
- SekState(state); SekStep(); SekStep(); SekState(state+0x11);\r
- for (i = 0x10; i >= 0; i--)\r
- if (state[i] != state[i+0x11]) return 0;\r
+ SekState(state); SekStep(); SekStep(); SekState(state+0x12);\r
+ for (i = 0x11; i >= 0; i--)\r
+ if (state[i] != state[i+0x12]) return 0;\r
\r
return 1;\r
}\r
lines_step = 14;\r
}\r
\r
+ // a hack for VR, to get it running in fast mode\r
+ if (PicoRead16Hook == PicoSVPRead16)\r
+ Pico.ram[0xd864^1] = 0x1a;\r
+\r
// we don't emulate DMA timing in this mode\r
if (Pico.m.dma_xfers) {\r
Pico.m.dma_xfers=0;\r
if (PicoLineHook) PicoLineHook(sects*lines_step);\r
}\r
\r
+ // another hack for VR (it needs hints to work)\r
+ if (PicoRead16Hook == PicoSVPRead16) {\r
+ Pico.ram[0xd864^1] = 1;\r
+ pv->pending_ints|=0x10;\r
+ if (pv->reg[0]&0x10) SekInterrupt(4);\r
+ SekRunM68k(160);\r
+ }\r
+\r
// render screen\r
if (!PicoSkipFrame)\r
{\r
if (!(PicoOpt&0x10))\r
+ {\r
// Draw the screen\r
#if CAN_HANDLE_240_LINES\r
if (pv->reg[1]&8) {\r
#else\r
for (y=0;y<224;y++) PicoLine(y);\r
#endif\r
+ }\r
else PicoFrameFull();\r
#ifdef DRAW_FINISH_FUNC\r
DRAW_FINISH_FUNC();\r
// common code for Pico.c and cd/Pico.c
-// (c) Copyright 2007, Grazvydas "notaz" Ignotas
+// (c) Copyright 2007,2008 Grazvydas "notaz" Ignotas
#define CYCLES_M68K_LINE 488 // suitable for both PAL/NTSC
#define CYCLES_M68K_VINT_LAG 68
int lines, y, lines_vis = 224, total_z80 = 0, z80CycleAim = 0, line_sample, skip;
int hint; // Hint counter
- if ((PicoOpt&0x10) && !PicoSkipFrame) {
+ if ((PicoOpt&0x10) && !PicoSkipFrame && (pv->reg[1]&0x40)) { // fast rend., display enabled
// draw a frame just after vblank in alternative render mode
// yes, this will cause 1 frame lag, but this is inaccurate mode anyway.
PicoFrameFull();
}
// decide if we draw this line
+ if (!skip)
+ {
+ if (PicoOpt&0x10) {
+ // find the right moment for fast renderer, when display is no longer blanked
+ if ((pv->reg[1]&0x40) || y > 100) {
+ PicoFrameFull();
+#ifdef DRAW_FINISH_FUNC
+ DRAW_FINISH_FUNC();
+#endif
+ skip = 1;
+ }
+ }
+ else
+ {
#if CAN_HANDLE_240_LINES
- if(!skip && ((!(pv->reg[1]&8) && y<224) || (pv->reg[1]&8)) )
+ if (((!(pv->reg[1]&8) && y < 224) || (pv->reg[1]&8)) )
#else
- if(!skip && y<224)
+ if (y < 224)
#endif
- PicoLine(y);
+ PicoLine(y);
+ }
+ }
- if(PicoOpt&1)
+ if (PicoOpt&1)
Psnd_timers_and_dac(y);
#ifndef PICO_CD
// get samples from sound chips
- if(y == 32 && PsndOut)
+ if (y == 32 && PsndOut)
emustatus &= ~1;
- else if((y == 224 || y == line_sample) && PsndOut)
+ else if ((y == 224 || y == line_sample) && PsndOut)
getSamples(y);
#endif
// Area.c\r
PICO_INTERNAL int PicoAreaPackCpu(unsigned char *cpu, int is_sub);\r
PICO_INTERNAL int PicoAreaUnpackCpu(unsigned char *cpu, int is_sub);\r
+extern void (*PicoLoadStateHook)(void);\r
\r
// cd/Area.c\r
PICO_INTERNAL int PicoCdSaveState(void *file);\r
{\r
#ifdef EMU_C68K\r
memcpy32(data,(int *)PicoCpuCM68k.d,0x44/4);\r
+ data[0x11] = PicoCpuCM68k.flags;\r
#elif defined(EMU_M68K)\r
memcpy32(data, (int *)PicoCpuMM68k.dar, 0x40/4);\r
data[0x10] = PicoCpuMM68k.pc;\r
+ data[0x11] = m68k_get_reg(&PicoCpuMM68k, M68K_REG_SR);\r
#elif defined(EMU_F68K)\r
memcpy32(data, (int *)PicoCpuFM68k.dreg, 0x40/4);\r
data[0x10] = PicoCpuFM68k.pc;\r
+ data[0x11] = PicoCpuFM68k.sr;\r
#endif\r
}\r
\r
else if(pints & 0x10) irq = 4;\r
SekInterrupt(irq); // update line\r
\r
- if (irq) SekEndRun(24); // make it delayed\r
+ if (irq && Pico.m.scanline!=-1) SekEndRun(24); // make it delayed\r
}\r
}\r
#endif\r
// -----------------------------------------------------
+static void ssp1601_state_load(void)
+{
+ ssp->drc.iram_dirty = 1;
+ ssp->drc.iram_context = 0;
+}
+
int ssp1601_dyn_startup(void)
{
memset(tcache, 0, TCACHE_SIZE);
tcache_ptr = tcache;
*tcache_ptr++ = 0xffffffff;
+ PicoLoadStateHook = ssp1601_state_load;
+
#ifdef ARM
// hle'd blocks
block_table[0x400] = (void *) ssp_hle_800;
{
if (ssp->emu_status & SSP_WAIT_MASK) return;
+#ifdef DUMP_BLOCK
+ ssp_translate_block(DUMP_BLOCK >> 1);
+#endif
+#ifdef ARM
ssp_drc_entry(cycles);
+#endif
}
{
if (cycles > 0xff) { printf("large cycle count: %i\n", cycles); cycles = 0xff; }
EOP_SUB_IMM(11,11,0,cycles); // sub r11, r11, #cycles
+#ifdef ARM
emit_call(ssp_drc_next);
+#endif
}
static void emit_pc_dump(int pc)
{\r
int emu_opt = currentConfig.EmuOpt;\r
\r
- if (PicoOpt&0x10) {\r
+ if (PicoOpt&0x10)\r
+ {\r
// 8bit fast renderer\r
if (Pico.m.dirtyPal) {\r
Pico.m.dirtyPal = 0;\r
// feed new palette to our device\r
gp2x_video_setpalette(localPal, 0x40);\r
}\r
+ // a hack for VR\r
+ if (PicoRead16Hook == PicoSVPRead16)\r
+ memset32((int *)(PicoDraw2FB+328*8+328*223), 0xe0e0e0e0, 328);\r
+ // do actual copy\r
vidCpyM2((unsigned char *)gp2x_screen+320*8, PicoDraw2FB+328*8);\r
- } else if (!(emu_opt&0x80)) {\r
+ }\r
+ else if (!(emu_opt&0x80))\r
+ {\r
// 8bit accurate renderer\r
if (Pico.m.dirtyPal) {\r
Pico.m.dirtyPal = 0;\r
mkdirs:
mkdir -p $(DIRS)
-Pico/carthw/svp/compiler.o : Pico/carthw/svp/ssp16.o ../../Pico/carthw/svp/gen_arm.c
+Pico/carthw/svp/compiler.o : ../../Pico/carthw/svp/gen_arm.c
+
+Pico/Pico.o : ../../Pico/PicoFrameHints.c
../../cpu/musashi/m68kops.c :
@make -C ../../cpu/musashi