#define SCANP(x) ScanVar(&Pico.x,sizeof(Pico.x),#x,PmovFile,PmovAction);\r
\r
// Pack the cpu into a common format:\r
-PICO_INTERNAL int PicoAreaPackCpu(unsigned char *cpu, int is_sub)\r
+PICO_INTERNAL void PicoAreaPackCpu(unsigned char *cpu, int is_sub)\r
{\r
unsigned int pc=0;\r
\r
#endif\r
\r
*(unsigned int *)(cpu+0x40)=pc;\r
- return 0;\r
}\r
\r
-PICO_INTERNAL int PicoAreaUnpackCpu(unsigned char *cpu, int is_sub)\r
+PICO_INTERNAL void PicoAreaUnpackCpu(unsigned char *cpu, int is_sub)\r
{\r
#if defined(EMU_C68K)\r
struct Cyclone *context = is_sub ? &PicoCpuCS68k : &PicoCpuCM68k;\r
context->execinfo &= ~FM68K_HALTED;\r
if (cpu[0x4d]&1) context->execinfo |= FM68K_HALTED;\r
#endif\r
- return 0;\r
}\r
\r
// Scan the contents of the virtual machine's memory for saving or loading\r
return 0;\r
}\r
\r
-int PicoCartUnload(void)\r
+void PicoCartUnload(void)\r
{\r
if (Pico.rom != NULL) {\r
SekFinishIdleDet();\r
free(Pico.rom);\r
Pico.rom=NULL;\r
}\r
- return 0;\r
}\r
\r
static int rom_strcmp(int rom_offset, const char *s1)\r
}\r
\r
\r
-PICO_INTERNAL int PicoInitPc(u32 pc)\r
+PICO_INTERNAL void PicoInitPc(u32 pc)\r
{\r
PicoCheckPc(pc);\r
- return 0;\r
}\r
\r
#ifndef _ASM_MEMORY_C\r
\r
// -----------------------------------------------------------------\r
\r
-extern const unsigned short vcounts[];\r
-\r
static int get_scanline(int is_from_z80)\r
{\r
if (is_from_z80) {\r
return z80_scanline;\r
}\r
\r
- if (Pico.m.scanline != -1)\r
- return Pico.m.scanline;\r
-\r
- return vcounts[SekCyclesDone()>>8];\r
+ return Pico.m.scanline;\r
}\r
\r
/* probably not should be in this file, but it's near related code here */\r
u32 z80ReadBusReq(void)
{
u32 d=Pico.m.z80Run&1;
- if (!d && Pico.m.scanline != -1) {
+ if (!d) {
// needed by buggy Terminator (Sega CD)
int stop_before = SekCyclesDone() - z80stopCycle;
//elprintf(EL_BUSREQ, "get_zrun: stop before: %i", stop_before);
if (stop_before > 0 && stop_before < 20) // Gens uses 16 here
d = 1; // bus not yet available
}
- // |=0x80 for Shadow of the Beast & Super Offroad
+
elprintf(EL_BUSREQ, "get_zrun: %02x [%i] @%06x", d|0x80, SekCyclesDone(), SekPc);
return d|0x80;
}
0x0a,0x0b,0x0b,0x0b,0x0c,0x0c,0x0c,0x0d,\r
};\r
\r
-// vcounter values for PicoFrameSimple\r
-const unsigned short vcounts[] = {\r
- 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7,\r
- 8, 8, 9, 9, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16,\r
- 16, 17, 17, 18, 18, 19, 19, 20, 21, 21, 22, 22, 23, 23, 24, 24,\r
- 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 30, 31, 31, 32, 32, 33,\r
- 33, 34, 34, 35, 35, 36, 36, 37, 37, 38, 38, 39, 39, 40, 40, 41,\r
- 42, 42, 43, 43, 44, 44, 45, 45, 46, 46, 47, 47, 48, 48, 49, 49,\r
- 50, 50, 51, 52, 52, 53, 53, 54, 54, 55, 55, 56, 56, 57, 57, 58,\r
- 58, 59, 59, 60, 60, 61, 62, 62, 63, 63, 64, 64, 65, 65, 66, 66,\r
- 67, 67, 68, 68, 69, 69, 70, 70, 71, 71, 72, 73, 73, 74, 74, 75,\r
- 75, 76, 76, 77, 77, 78, 78, 79, 79, 80, 80, 81, 81, 82, 83, 83,\r
- 84, 84, 85, 85, 86, 86, 87, 87, 88, 88, 89, 89, 90, 90, 91, 91,\r
- 92, 93, 93, 94, 94, 95, 95, 96, 96, 97, 97, 98, 98, 99, 99,100,\r
-100,101,101,102,102,103,104,104,105,105,106,106,107,107,108,108,\r
-109,109,110,110,111,111,112,112,113,114,114,115,115,116,116,117,\r
-117,118,118,119,119,120,120,121,121,122,122,123,124,124,125,125,\r
-126,126,127,127,128,128,129,129,130,130,131,131,132,132,133,133,\r
-134,135,135,136,136,137,137,138,138,139,139,140,140,141,141,142,\r
-142,143,143,144,145,145,146,146,147,147,148,148,149,149,150,150,\r
-151,151,152,152,153,153,154,155,155,156,156,157,157,158,158,159,\r
-159,160,160,161,161,162,162,163,163,164,164,165,166,166,167,167,\r
-168,168,169,169,170,170,171,171,172,172,173,173,174,174,175,176,\r
-176,177,177,178,178,179,179,180,180,181,181,182,182,183,183,184,\r
-184,185,186,186,187,187,188,188,189,189,190,190,191,191,192,192,\r
-193,193,194,194,195,195,196,197,197,198,198,199,199,200,200,201,\r
-201,202,202,203,203,204,204,205,205,206,207,207,208,208,209,209,\r
-210,210,211,211,212,212,213,213,214,214,215,215,216,217,217,218,\r
-218,219,219,220,220,221,221,222,222,223,223,224,224,225,225,226,\r
-226,227,228,228,229,229,230,230,231,231,232,232,233,233,234,234,\r
-235,235,236,236,237,238,238,239,239,240,240,241,241,242,242,243,\r
-243,244,244,245,245,246,246,247,248,248,249,249,250,250,251,251,\r
-252,252,253,253,254,254,255,255,256,256,257,257,258,259,259,260,\r
-260,261,261,262,262,263,263,264,264,265,265,266,266,267,267,268,\r
-269,269,270,270,271,271,272,272,273,273,274,274,275,275,276,276,\r
-277,277,278,279,279,280,280,281,281,282,282,283,283,284,284,285,\r
-285,286,286,287,287,288,288,289,290,290,291,291,292,292,293,293,\r
-294,294,295,295,296,296,297,297,298,298,299,300,300,301,301,302,\r
-302,303,303,304,304,305,305,306,306,307,307,308,308,309,310,310,\r
-311,311,311,311,\r
-};\r
-\r
\r
// rarely used EEPROM SRAM code\r
// known games which use this:\r
void (*PicoLineHook)(int count) = NULL;\r
\r
// to be called once on emu init\r
-int PicoInit(void)\r
+void PicoInit(void)\r
{\r
// Blank space for state:\r
memset(&Pico,0,sizeof(Pico));\r
PicoSVPInit();\r
\r
SRam.data=0;\r
-\r
- return 0;\r
}\r
\r
// to be called once on emu exit\r
#endif\r
}\r
\r
-static __inline void SekStep(void)\r
-{\r
- // this is required for timing sensitive stuff to work\r
- int realaim=SekCycleAim; SekCycleAim=SekCycleCnt+1;\r
-#if defined(EMU_CORE_DEBUG)\r
- SekCycleCnt+=CM_compareRun(1, 0);\r
-#elif defined(EMU_C68K)\r
- PicoCpuCM68k.cycles=1;\r
- CycloneRun(&PicoCpuCM68k);\r
- SekCycleCnt+=1-PicoCpuCM68k.cycles;\r
-#elif defined(EMU_M68K)\r
- SekCycleCnt+=m68k_execute(1);\r
-#elif defined(EMU_F68K)\r
- SekCycleCnt+=fm68k_emulate(1, 0);\r
-#endif\r
- SekCycleAim=realaim;\r
-}\r
-\r
-static int CheckIdle(void)\r
-{\r
- int i, state[0x24];\r
-\r
- // See if the state is the same after 2 steps:\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
-\r
\r
// to be called on 224 or line_sample scanlines only\r
static __inline void getSamples(int y)\r
}\r
\r
\r
-// Simple frame without H-Ints\r
-static int PicoFrameSimple(void)\r
-{\r
- struct PicoVideo *pv=&Pico.video;\r
- int y=0,lines_step=0,sects,line_last;\r
- int cycles_68k_vblock,cycles_68k_block;\r
-\r
- // split to 16 run calls for active scan, for vblank split to 2 (ntsc), 3 (pal 240), 4 (pal 224)\r
- if (Pico.m.pal)\r
- {\r
- if(pv->reg[1]&8) { // 240 lines\r
- cycles_68k_block = 7308;\r
- cycles_68k_vblock = 11694;\r
- lines_step = 15;\r
- } else {\r
- cycles_68k_block = 6821;\r
- cycles_68k_vblock = 10719;\r
- lines_step = 14;\r
- }\r
- line_last = 312-1;\r
- } else {\r
- // M68k cycles/frame: 127840.71\r
- cycles_68k_block = 6841; // (488*224+148)/16.0, -4\r
- cycles_68k_vblock = 9164; // (38*488-148-68)/2.0, 0\r
- lines_step = 14;\r
- line_last = 262-1;\r
- }\r
-\r
- // a hack for VR, to get it running in fast mode\r
- if (PicoAHW & PAHW_SVP)\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
- Pico.video.status&=~2;\r
- }\r
-\r
- // VDP FIFO too\r
- pv->lwrite_cnt = 0;\r
- Pico.video.status|=0x200;\r
-\r
- Pico.m.scanline=-1;\r
- PsndDacLine = 0;\r
-\r
- SekCyclesReset();\r
- z80_resetCycles();\r
-\r
- // 6 button pad: let's just say it timed out now\r
- Pico.m.padTHPhase[0]=Pico.m.padTHPhase[1]=0;\r
-\r
- // ---- Active Scan ----\r
- pv->status&=~0x88; // clear V-Int, come out of vblank\r
-\r
- // Run in sections:\r
- for (sects=16; sects; sects--)\r
- {\r
- if (CheckIdle()) break;\r
-\r
- SekRunM68k(cycles_68k_block);\r
- if (PicoLineHook) PicoLineHook(lines_step);\r
- }\r
-\r
- // do remaining sections without 68k\r
- if (sects) {\r
- SekCycleCnt += sects * cycles_68k_block;\r
- SekCycleAim += sects * cycles_68k_block;\r
-\r
- if (PicoLineHook) PicoLineHook(sects*lines_step);\r
- }\r
-\r
- // another hack for VR (it needs hints to work)\r
- if (PicoAHW & PAHW_SVP) {\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&POPT_ALT_RENDERER))\r
- {\r
- // Draw the screen\r
-#if 0\r
-#if CAN_HANDLE_240_LINES\r
- if (pv->reg[1]&8) {\r
- for (y=0;y<240;y++) PicoLine(y);\r
- } else {\r
- for (y=0;y<224;y++) PicoLine(y);\r
- }\r
-#else\r
- for (y=0;y<224;y++) PicoLine(y);\r
-#endif\r
-#endif\r
- }\r
- else PicoFrameFull();\r
-#ifdef DRAW_FINISH_FUNC\r
- DRAW_FINISH_FUNC();\r
-#endif\r
- }\r
-\r
- // a gap between flags set and vint\r
- pv->pending_ints|=0x20;\r
- pv->status|=8; // go into vblank\r
- SekRunM68k(68+4);\r
-\r
- if (Pico.m.z80Run && (PicoOpt&POPT_EN_Z80))\r
- PicoSyncZ80(SekCycleCnt);\r
-\r
- // render sound\r
- if (PsndOut)\r
- {\r
- int len;\r
- if (ym2612.dacen && PsndDacLine <= lines_step*16)\r
- PsndDoDAC(lines_step*16);\r
- len = PsndRender(0, PsndLen);\r
- if (PicoWriteSound) PicoWriteSound(len);\r
- // clear sound buffer\r
- PsndClear();\r
- }\r
-\r
- // ---- V-Blanking period ----\r
- // fix line counts\r
- if(Pico.m.pal) {\r
- if(pv->reg[1]&8) { // 240 lines\r
- sects = 3;\r
- lines_step = 24;\r
- } else {\r
- sects = 4;\r
- lines_step = 22;\r
- }\r
- } else {\r
- sects = 2;\r
- lines_step = 19;\r
- }\r
-\r
- if (pv->reg[1]&0x20) SekInterrupt(6); // Set IRQ\r
- if (Pico.m.z80Run && (PicoOpt&POPT_EN_Z80))\r
- z80_int();\r
-\r
- while (1)\r
- {\r
- SekRunM68k(cycles_68k_vblock);\r
- if (PicoLineHook) PicoLineHook(lines_step);\r
-\r
- sects--;\r
- if (sects == 0) break;\r
- if (CheckIdle()) break;\r
- }\r
-\r
- if (sects) {\r
- SekCycleCnt += sects * cycles_68k_vblock;\r
- SekCycleAim += sects * cycles_68k_vblock;\r
- if (PicoLineHook) PicoLineHook(sects*lines_step);\r
- }\r
-\r
- // must sync z80 before return, and extend last DAC sample\r
- if (Pico.m.z80Run && (PicoOpt&POPT_EN_Z80))\r
- PicoSyncZ80(SekCycleCnt);\r
- if (PsndOut && ym2612.dacen && PsndDacLine <= line_last)\r
- PsndDoDAC(line_last);\r
-\r
- timers_cycle();\r
-\r
- return 0;\r
-}\r
-\r
int idle_hit_counter = 0;\r
\r
-int PicoFrame(void)\r
+void PicoFrame(void)\r
{\r
- int acc;\r
-\r
+#if 0\r
if ((Pico.m.frame_count&0x3f) == 0) {\r
elprintf(EL_STATUS, "ihits: %i", idle_hit_counter);\r
idle_hit_counter = 0;\r
}\r
+#endif\r
\r
Pico.m.frame_count++;\r
\r
if (PicoAHW & PAHW_MCD) {\r
PicoFrameMCD();\r
- return 0;\r
+ return;\r
}\r
\r
- // be accurate if we are asked for this\r
- if (PicoOpt&POPT_ACC_TIMING) acc=1;\r
- // don't be accurate in alternative render mode, as hint effects will not be rendered anyway\r
- else if (PicoOpt&POPT_ALT_RENDERER) acc = 0;\r
- else acc=Pico.video.reg[0]&0x10; // be accurate if hints are used\r
-\r
//if(Pico.video.reg[12]&0x2) Pico.video.status ^= 0x10; // change odd bit in interlace mode\r
\r
if (!(PicoOpt&POPT_ALT_RENDERER))\r
PicoFrameStart();\r
\r
- if (acc)\r
- PicoFrameHints();\r
- else PicoFrameSimple();\r
-\r
- return 0;\r
+ PicoFrameHints();\r
}\r
\r
void PicoFrameDrawOnly(void)\r
{\r
- int y;\r
PicoFrameStart();\r
- for (y=0;y<224;y++) PicoLine(y);\r
+ PicoDrawSync(223, 0);\r
}\r
\r
void PicoGetInternal(pint_t which, pint_ret_t *r)\r
#define POPT_EN_STEREO (1<< 3)\r
#define POPT_ALT_RENDERER (1<< 4) // 00 00x0\r
#define POPT_6BTN_PAD (1<< 5)\r
-#define POPT_ACC_TIMING (1<< 6)\r
+// unused (1<< 6)\r
#define POPT_ACC_SPRITES (1<< 7)\r
#define POPT_DIS_32C_BORDER (1<< 8) // 00 0x00\r
#define POPT_EXT_FM (1<< 9)\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
extern int PicoSVPCycles;\r
-int PicoInit(void);\r
+void PicoInit(void);\r
void PicoExit(void);\r
void PicoPower(void);\r
int PicoReset(void);\r
-int PicoFrame(void);\r
+void PicoFrame(void);\r
void PicoFrameDrawOnly(void);\r
extern int PicoPad[2]; // Joypads, format is MXYZ SACB RLDU\r
extern void (*PicoWriteSound)(int len); // called once per frame at the best time to send sound buffer (PsndOut) to hardware\r
extern void (*PicoStateProgressCB)(const char *str);\r
\r
// cd/Area.c\r
-int PicoCdLoadStateGfx(void *file);\r
+int PicoCdLoadStateGfx(void *file);\r
\r
// cd/buffering.c\r
void PicoCDBufferInit(void);\r
void PicoCDBufferFlush(void);\r
\r
// cd/cd_sys.c\r
-int Insert_CD(char *iso_name, int is_bin);\r
int Insert_CD(char *cdimg_name, int type);\r
void Stop_CD(void); // releases all resources taken when CD game was started.\r
\r
int PicoCartLoad(pm_file *f,unsigned char **prom,unsigned int *psize);\r
int PicoCartInsert(unsigned char *rom,unsigned int romsize);\r
void Byteswap(unsigned char *data,int len);\r
-int PicoCartUnload(void);\r
+void PicoCartUnload(void);\r
extern void (*PicoCartLoadProgressCB)(int percent);\r
extern void (*PicoCDLoadProgressCB)(int percent);\r
\r
PicoPicohw.xpcm_ptr = PicoPicohw.xpcm_buffer;
}
-PICO_INTERNAL int PicoInitPico(void)
+PICO_INTERNAL void PicoInitPico(void)
{
elprintf(EL_STATUS, "Pico detected");
PicoLineHook = PicoLinePico;
case 2: PicoPicohw.r1 = 0x40; break;
case 3: PicoPicohw.r1 = 0x20; break;
}
-
- return 0;
}
int lines, y, lines_vis = 224, line_sample, skip;
int hint; // Hint counter
- Pico.m.scanline=0;
+ Pico.m.scanline = 0;
if ((PicoOpt&POPT_ALT_RENDERER) && !PicoSkipFrame && (pv->reg[1]&0x40)) { // fast rend., display enabled
// draw a frame just after vblank in alternative render mode
for (y = 0; y < lines_vis; y++)
{
- Pico.m.scanline=(short)y;
+ Pico.m.scanline = y;
// VDP FIFO
pv->lwrite_cnt -= 12;
}
// V-int line (224 or 240)
- Pico.m.scanline=(short)y;
+ Pico.m.scanline = y;
// VDP FIFO
pv->lwrite_cnt=0;
for (y++; y < lines; y++)
{
- Pico.m.scanline=(short)y;
+ Pico.m.scanline = y;
PAD_DELAY
#ifdef PICO_CD
unsigned char rotate;\r
unsigned char z80Run;\r
unsigned char padTHPhase[2]; // 02 phase of gamepad TH switches\r
- short scanline; // 04 0 to 261||311; -1 in fast mode\r
+ unsigned short scanline; // 04 0 to 261||311\r
char dirtyPal; // 06 Is the palette dirty (1 - change @ this frame, 2 - some time before)\r
unsigned char hardware; // 07 Hardware value for country\r
unsigned char pal; // 08 1=PAL 0=NTSC\r
\r
\r
// 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
+PICO_INTERNAL void PicoAreaPackCpu(unsigned char *cpu, int is_sub);\r
+PICO_INTERNAL void PicoAreaUnpackCpu(unsigned char *cpu, int is_sub);\r
extern void (*PicoLoadStateHook)(void);\r
\r
// cd/Area.c\r
PICO_INTERNAL void PicoFrameFull();\r
\r
// Memory.c\r
-PICO_INTERNAL int PicoInitPc(unsigned int pc);\r
+PICO_INTERNAL void PicoInitPc(unsigned int pc);\r
PICO_INTERNAL unsigned int PicoCheckPc(unsigned int pc);\r
PICO_INTERNAL_ASM unsigned int PicoRead32(unsigned int a);\r
PICO_INTERNAL void PicoMemSetup(void);\r
PICO_INTERNAL void PicoSyncZ80(int m68k_cycles_done);\r
\r
// cd/Pico.c\r
-PICO_INTERNAL int PicoInitMCD(void);\r
+PICO_INTERNAL void PicoInitMCD(void);\r
PICO_INTERNAL void PicoExitMCD(void);\r
PICO_INTERNAL void PicoPowerMCD(void);\r
-PICO_INTERNAL int PicoResetMCD(void);\r
-PICO_INTERNAL int PicoFrameMCD(void);\r
+PICO_INTERNAL int PicoResetMCD(void);\r
+PICO_INTERNAL void PicoFrameMCD(void);\r
\r
// Pico/Pico.c\r
-PICO_INTERNAL int PicoInitPico(void);\r
+PICO_INTERNAL void PicoInitPico(void);\r
PICO_INTERNAL void PicoReratePico(void);\r
\r
// Pico/xpcm.c\r
PICO_INTERNAL void PicoPicoPCMRerate(int xpcm_rate);\r
\r
// Sek.c\r
-PICO_INTERNAL int SekInit(void);\r
-PICO_INTERNAL int SekReset(void);\r
+PICO_INTERNAL void SekInit(void);\r
+PICO_INTERNAL int SekReset(void);\r
PICO_INTERNAL void SekState(int *data);\r
PICO_INTERNAL void SekSetRealTAS(int use_real);\r
void SekInitIdleDet(void);\r
void SekFinishIdleDet(void);\r
\r
// cd/Sek.c\r
-PICO_INTERNAL int SekInitS68k(void);\r
-PICO_INTERNAL int SekResetS68k(void);\r
-PICO_INTERNAL int SekInterruptS68k(int irq);\r
+PICO_INTERNAL void SekInitS68k(void);\r
+PICO_INTERNAL int SekResetS68k(void);\r
+PICO_INTERNAL int SekInterruptS68k(int irq);\r
\r
// sound/sound.c\r
PICO_INTERNAL void cdda_start_play();\r
#endif\r
\r
\r
-PICO_INTERNAL int SekInit()\r
+PICO_INTERNAL void SekInit(void)\r
{\r
#ifdef EMU_C68K\r
CycloneInit();\r
g_m68kcontext = oldcontext;\r
}\r
#endif\r
-\r
- return 0;\r
}\r
\r
\r
// Reset the 68000:\r
-PICO_INTERNAL int SekReset()\r
+PICO_INTERNAL int SekReset(void)\r
{\r
if (Pico.rom==NULL) return 1;\r
\r
}\r
\r
\r
-// data must be word aligned\r
-PICO_INTERNAL void SekState(int *data)\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
PICO_INTERNAL void SekSetRealTAS(int use_real)\r
{\r
#ifdef EMU_C68K\r
\r
extern const unsigned char hcounts_32[];\r
extern const unsigned char hcounts_40[];\r
-extern const unsigned short vcounts[];\r
\r
#ifndef UTYPES_DEFINED\r
typedef unsigned char u8;\r
//default:elprintf(EL_ANOMALY, "VDP write %04x with bad type %i", d, Pico.video.type); break;\r
}\r
\r
- //dprintf("w[%i] @ %04x, inc=%i [%i|%i]", Pico.video.type, a, Pico.video.reg[0xf], Pico.m.scanline, SekCyclesDone());\r
AutoIncrement();\r
}\r
\r
Pico.video.type, source, a, len, inc, (Pico.video.status&8)||!(Pico.video.reg[1]&0x40),\r
SekCyclesDone(), SekPc);\r
\r
- if (Pico.m.scanline != -1) {\r
- Pico.m.dma_xfers += len;\r
- if ((PicoAHW & PAHW_MCD) && (PicoOpt & POPT_EN_MCD_PSYNC)) SekCyclesBurn(CheckDMA());\r
- else SekSetCyclesLeftNoMCD(SekCyclesLeftNoMCD - CheckDMA());\r
- } else {\r
- // be approximate in non-accurate mode\r
- SekSetCyclesLeft(SekCyclesLeft - (len*(((488<<8)/167))>>8));\r
- }\r
+ Pico.m.dma_xfers += len;\r
+ if ((PicoAHW & PAHW_MCD) && (PicoOpt & POPT_EN_MCD_PSYNC)) SekCyclesBurn(CheckDMA());\r
+ else SekSetCyclesLeftNoMCD(SekCyclesLeftNoMCD - CheckDMA());\r
\r
if ((source&0xe00000)==0xe00000) { // Ram\r
pd=(u16 *)(Pico.ram+(source&0xfffe));\r
elprintf(EL_VDPDMA, "DmaCopy len %i [%i]", len, SekCyclesDone());\r
\r
Pico.m.dma_xfers += len;\r
- if(Pico.m.scanline != -1)\r
- Pico.video.status|=2; // dma busy\r
+ Pico.video.status |= 2; // dma busy\r
\r
source =Pico.video.reg[0x15];\r
source|=Pico.video.reg[0x16]<<8;\r
vrs=vr+source;\r
\r
- if(source+len > 0x10000) len=0x10000-source; // clip??\r
+ if (source+len > 0x10000) len=0x10000-source; // clip??\r
\r
- for(;len;len--)\r
+ for (; len; len--)\r
{\r
vr[a] = *vrs++;\r
// AutoIncrement\r
elprintf(EL_VDPDMA, "DmaFill len %i inc %i [%i]", len, inc, SekCyclesDone());\r
\r
Pico.m.dma_xfers += len;\r
- if(Pico.m.scanline != -1)\r
- Pico.video.status|=2; // dma busy (in accurate mode)\r
+ Pico.video.status |= 2; // dma busy\r
\r
// from Charles MacDonald's genvdp.txt:\r
// Write lower byte to address specified\r
vr[a] = (unsigned char) data;\r
a=(u16)(a+inc);\r
\r
- if(!inc) len=1;\r
+ if (!inc) len=1;\r
\r
- for(;len;len--) {\r
+ for (; len; len--) {\r
// Write upper byte to adjacent address\r
// (here we are byteswapped, so address is already 'adjacent')\r
vr[a] = high;\r
{\r
if (Pico.m.scanline < 224 && !(PicoOpt & POPT_ALT_RENDERER) &&\r
!PicoSkipFrame && DrawScanline <= Pico.m.scanline) {\r
- elprintf(EL_ANOMALY, "sync");\r
+ //elprintf(EL_ANOMALY, "sync");\r
PicoDrawSync(Pico.m.scanline, blank_on);\r
}\r
}\r
{\r
struct PicoVideo *pvid=&Pico.video;\r
\r
- if (Pico.m.scanline < 224)\r
- elprintf(EL_STATUS, "PicoVideoWrite [%06x] %04x", a, d);\r
+ //if (Pico.m.scanline < 224)\r
+ // elprintf(EL_STATUS, "PicoVideoWrite [%06x] %04x", a, d);\r
a&=0x1c;\r
\r
if (a==0x00) // Data port 0 or 2\r
else\r
{\r
// preliminary FIFO emulation for Chaos Engine, The (E)\r
- if (!(pvid->status&8) && (pvid->reg[1]&0x40) && Pico.m.scanline!=-1 && !(PicoOpt&POPT_DIS_VDP_FIFO)) // active display, accurate mode?\r
+ if (!(pvid->status&8) && (pvid->reg[1]&0x40) && !(PicoOpt&POPT_DIS_VDP_FIFO)) // active display?\r
{\r
pvid->status&=~0x200; // FIFO no longer empty\r
pvid->lwrite_cnt++;\r
else if (pints & 0x10) irq = 4;\r
SekInterrupt(irq); // update line\r
\r
- if (irq && Pico.m.scanline!=-1) SekEndRun(24); // make it delayed\r
+ if (irq) SekEndRun(24); // make it delayed\r
}\r
#endif\r
}\r
if ((a&0x1c)==0x08)\r
{\r
unsigned int hc, d;\r
+ int lineCycles;\r
+ \r
+ lineCycles = (488-SekCyclesLeft)&0x1ff;\r
+ d = Pico.m.scanline; // V-Counter\r
\r
- if (Pico.m.scanline != -1)\r
- {\r
- int lineCycles=(488-SekCyclesLeft)&0x1ff;\r
- d=Pico.m.scanline; // V-Counter\r
-\r
- if(Pico.video.reg[12]&1)\r
- hc=hcounts_40[lineCycles];\r
- else hc=hcounts_32[lineCycles];\r
-\r
- //if(lineCycles > 488-12) d++; // Wheel of Fortune\r
- } else {\r
- // get approximate V-Counter\r
- d=vcounts[SekCyclesDone()>>8];\r
- hc = Pico.m.rotate&0xff;\r
- }\r
+ if (Pico.video.reg[12]&1)\r
+ hc=hcounts_40[lineCycles];\r
+ else hc=hcounts_32[lineCycles];\r
\r
- if(Pico.m.pal) {\r
+ if (Pico.m.pal) {\r
if (d >= 0x103) d-=56; // based on Gens\r
} else {\r
if (d >= 0xEB) d-=6;\r
}\r
\r
- if((Pico.video.reg[12]&6) == 6) {\r
+ if ((Pico.video.reg[12]&6) == 6) {\r
// interlace mode 2 (Combat Cars (UE) [!])\r
d <<= 1;\r
if (d&0xf00) d|= 1;\r
}
-PICO_INTERNAL int PicoInitMCD(void)
+PICO_INTERNAL void PicoInitMCD(void)
{
SekInitS68k();
Init_CD_Driver();
-
- return 0;
}
#include "../PicoFrameHints.c"
-PICO_INTERNAL int PicoFrameMCD(void)
+PICO_INTERNAL void PicoFrameMCD(void)
{
if (!(PicoOpt&POPT_ALT_RENDERER))
PicoFrameStart();
PicoFrameHints();
-
- return 0;
}
#endif
-PICO_INTERNAL int SekInitS68k()
+PICO_INTERNAL void SekInitS68k(void)
{
#ifdef EMU_C68K
// CycloneInit();
g_m68kcontext = oldcontext;
}
#endif
-
- return 0;
}
// Reset the 68000:
-PICO_INTERNAL int SekResetS68k()
+PICO_INTERNAL int SekResetS68k(void)
{
if (Pico.rom==NULL) return 1;
if(movie_data[0x14] == '6')\r
PicoOpt |= POPT_6BTN_PAD; // 6 button pad\r
else PicoOpt &= ~POPT_6BTN_PAD;\r
- PicoOpt |= POPT_DIS_VDP_FIFO|POPT_ACC_TIMING; // accurate timing, no VDP fifo timing\r
+ PicoOpt |= POPT_DIS_VDP_FIFO; // no VDP fifo timing\r
if(movie_data[0xF] >= 'A') {\r
if(movie_data[0x16] & 0x80) {\r
PicoRegionOverride = 8;\r
{ NULL, MB_NONE, MA_OPT_RENDERER, NULL, 0, 0, 0, 1 },\r
{ "Scanline mode (faster)", MB_ONOFF, MA_OPT_INTERLACED, ¤tConfig.EmuOpt, 0x4000, 0, 0, 1 },\r
{ "Scale low res mode", MB_ONOFF, MA_OPT_SCALING, ¤tConfig.scaling, 0x0001, 0, 3, 1 },\r
- { "Accurate timing (slower)", MB_ONOFF, MA_OPT_ACC_TIMING, ¤tConfig.PicoOpt, 0x0040, 0, 0, 1 },\r
{ "Accurate sprites (slower)", MB_ONOFF, MA_OPT_ACC_SPRITES, ¤tConfig.PicoOpt, 0x0080, 0, 0, 1 },\r
{ "Show FPS", MB_ONOFF, MA_OPT_SHOW_FPS, ¤tConfig.EmuOpt, 0x0002, 0, 0, 1 },\r
{ NULL, MB_RANGE, MA_OPT_FRAMESKIP, ¤tConfig.Frameskip, 0, -1, 16, 1 },\r
{\r
{ NULL, MB_NONE, MA_OPT_RENDERER, NULL, 0, 0, 0, 1, 1 },\r
{ NULL, MB_RANGE, MA_OPT_SCALING, ¤tConfig.scaling, 0, 0, 3, 1, 1 },\r
- { "Accurate timing (slower)", MB_ONOFF, MA_OPT_ACC_TIMING, &PicoOpt, 0x040, 0, 0, 1, 1 },\r
{ "Accurate sprites (slower)", MB_ONOFF, MA_OPT_ACC_SPRITES, &PicoOpt, 0x080, 0, 0, 1, 1 },\r
{ "Show FPS", MB_ONOFF, MA_OPT_SHOW_FPS, ¤tConfig.EmuOpt, 0x002, 0, 0, 1, 1 },\r
{ NULL, MB_RANGE, MA_OPT_FRAMESKIP, ¤tConfig.Frameskip, 0, -1, 16, 1, 1 },\r
menu_entry opt_entries[] =
{
{ NULL, MB_NONE, MA_OPT_RENDERER, NULL, 0, 0, 0, 1, 1 },
- { "Accurate timing (slower)", MB_ONOFF, MA_OPT_ACC_TIMING, &PicoOpt, 0x0040, 0, 0, 1, 1 },
{ "Accurate sprites (slower)", MB_ONOFF, MA_OPT_ACC_SPRITES, &PicoOpt, 0x0080, 0, 0, 1, 1 },
{ "Show FPS", MB_ONOFF, MA_OPT_SHOW_FPS, ¤tConfig.EmuOpt, 0x0002, 0, 0, 1, 1 },
{ NULL, MB_RANGE, MA_OPT_FRAMESKIP, ¤tConfig.Frameskip, 0, -1, 16, 1, 1 },