\r
// compare PC\r
m68ki_cpu.pc&=~1;\r
- if ( SekPc != (m68ki_cpu.pc&0xffffff) ) {\r
- dprintf("PC: %06x vs %06x", SekPc, m68ki_cpu.pc&0xffffff);\r
+ if (SekPc != m68ki_cpu.pc) {\r
+ dprintf("PC: %06x vs %06x", SekPc, m68ki_cpu.pc);\r
err=1;\r
}\r
\r
Pico.m.pal=pal;\r
Pico.video.status = 0x3408 | pal; // always set bits | vblank | pal\r
\r
- sound_reset(); // pal must be known here\r
+ PsndReset(); // pal must be known here\r
\r
if (PicoMCD & 1) {\r
PicoResetMCD(hard);\r
\r
if(y == 224) {\r
if(emustatus & 2)\r
- curr_pos += sound_render(curr_pos, PsndLen-PsndLen/2);\r
- else curr_pos = sound_render(0, PsndLen);\r
+ curr_pos += PsndRender(curr_pos, PsndLen-PsndLen/2);\r
+ else curr_pos = PsndRender(0, PsndLen);\r
if (emustatus&1) emustatus|=2; else emustatus&=~2;\r
if (PicoWriteSound) PicoWriteSound(curr_pos);\r
// clear sound buffer\r
- sound_clear();\r
+ PsndClear();\r
}\r
else if(emustatus & 3) {\r
emustatus|= 2;\r
emustatus&=~1;\r
- curr_pos = sound_render(0, PsndLen/2);\r
+ curr_pos = PsndRender(0, PsndLen/2);\r
}\r
}\r
\r
if (PicoOpt&1) {\r
// we have ym2612 enabled, so we have to run Z80 in lines, so we could update DAC and timers\r
for (line = line_from; line < line_to; line++) {\r
- sound_timers_and_dac(line);\r
+ Psnd_timers_and_dac(line);\r
if ((line == 224 || line == line_sample) && PsndOut) getSamples(line);\r
if (line == 32 && PsndOut) emustatus &= ~1;\r
if (line >= line_from_r && line < line_to_r)\r
\r
// here we render sound if ym2612 is disabled\r
if (!(PicoOpt&1) && PsndOut) {\r
- int len = sound_render(0, PsndLen);\r
+ int len = PsndRender(0, PsndLen);\r
if (PicoWriteSound) PicoWriteSound(len);\r
// clear sound buffer\r
- sound_clear();\r
+ PsndClear();\r
}\r
\r
// a gap between flags set and vint\r
// sound.c\r
extern int PsndRate,PsndLen;\r
extern short *PsndOut;\r
-void sound_rerate(int preserve_state);\r
+void PsndRerate(int preserve_state);\r
\r
// Utils.c\r
extern int PicuAnd;\r
PicoLine(y);
if(PicoOpt&1)
- sound_timers_and_dac(y);
+ Psnd_timers_and_dac(y);
#ifndef PICO_CD
// get samples from sound chips
z80_int();
if (PicoOpt&1)
- sound_timers_and_dac(y);
+ Psnd_timers_and_dac(y);
// get samples from sound chips
#ifndef PICO_CD
#endif
if(PicoOpt&1)
- sound_timers_and_dac(y);
+ Psnd_timers_and_dac(y);
// Run scanline:
if (Pico.m.dma_xfers) SekCyclesBurn(CheckDMA());
PICO_INTERNAL void PicoCDBufferRead(void *dest, int lba);\r
\r
// sound/sound.c\r
-PICO_INTERNAL void sound_reset(void);\r
-PICO_INTERNAL void sound_timers_and_dac(int raster);\r
-PICO_INTERNAL int sound_render(int offset, int length);\r
-PICO_INTERNAL void sound_clear(void);\r
+PICO_INTERNAL void PsndReset(void);\r
+PICO_INTERNAL void Psnd_timers_and_dac(int raster);\r
+PICO_INTERNAL int PsndRender(int offset, int length);\r
+PICO_INTERNAL void PsndClear(void);\r
// z80 functionality wrappers\r
PICO_INTERNAL void z80_init(void);\r
PICO_INTERNAL void z80_resetCycles(void);\r
static __inline void getSamples(int y)
{
- int len = sound_render(0, PsndLen);
+ int len = PsndRender(0, PsndLen);
if (PicoWriteSound) PicoWriteSound(len);
// clear sound buffer
- sound_clear();
+ PsndClear();
}
}\r
\r
\r
-PICO_INTERNAL void sound_reset(void)\r
+PICO_INTERNAL void PsndReset(void)\r
{\r
void *ym2612_regs;\r
\r
memset(ym2612_regs, 0, 0x200+4);\r
z80startCycle = z80stopCycle = 0;\r
\r
- sound_rerate(0);\r
+ PsndRerate(0);\r
}\r
\r
\r
// to be called after changing sound rate or chips\r
-void sound_rerate(int preserve_state)\r
+void PsndRerate(int preserve_state)\r
{\r
void *state = NULL;\r
int target_fps = Pico.m.pal ? 50 : 60;\r
// clear all buffers\r
memset32(PsndBuffer, 0, sizeof(PsndBuffer)/4);\r
if (PsndOut)\r
- sound_clear();\r
+ PsndClear();\r
}\r
\r
\r
// This is called once per raster (aka line), but not necessarily for every line\r
-PICO_INTERNAL void sound_timers_and_dac(int raster)\r
+PICO_INTERNAL void Psnd_timers_and_dac(int raster)\r
{\r
int pos, len;\r
int do_dac = PsndOut && (PicoOpt&1) && *ym2612_dacen;\r
}\r
\r
\r
-PICO_INTERNAL void sound_clear(void)\r
+PICO_INTERNAL void PsndClear(void)\r
{\r
int len = PsndLen;\r
if (PsndLen_exc_add) len++;\r
}\r
\r
\r
-PICO_INTERNAL int sound_render(int offset, int length)\r
+PICO_INTERNAL int PsndRender(int offset, int length)\r
{\r
int buf32_updated = 0;\r
int *buf32 = PsndBuffer+offset;\r
return drZ80.Z80SP_BASE + a;\r
}\r
\r
-static unsigned char DrZ80_in(unsigned short p)\r
+static void DrZ80_irq_callback()\r
{\r
- elprintf(EL_ANOMALY, "Z80 port %04x read", p);\r
- return 0xff;\r
+ drZ80.Z80_IRQ = 0; // lower irq when accepted\r
}\r
+#endif\r
\r
-static void DrZ80_out(unsigned short p,unsigned char d)\r
+#if defined(_USE_DRZ80) || defined(_USE_CZ80)\r
+static unsigned char z80_in(unsigned short p)\r
{\r
- elprintf(EL_ANOMALY, "Z80 port %04x write %02x", p, d);\r
+ elprintf(EL_ANOMALY, "Z80 port %04x read", p);\r
+ return 0xff;\r
}\r
\r
-static void DrZ80_irq_callback()\r
+static void z80_out(unsigned short p,unsigned char d)\r
{\r
- drZ80.Z80_IRQ = 0; // lower irq when accepted\r
+ elprintf(EL_ANOMALY, "Z80 port %04x write %02x", p, d);\r
}\r
#endif\r
\r
+\r
// z80 functionality wrappers\r
PICO_INTERNAL void z80_init(void)\r
{\r
drZ80.z80_read16 =z80_read16;\r
drZ80.z80_write8 =z80_write;\r
drZ80.z80_write16 =z80_write16;\r
- drZ80.z80_in =DrZ80_in;\r
- drZ80.z80_out =DrZ80_out;\r
+ drZ80.z80_in =z80_in;\r
+ drZ80.z80_out =z80_out;\r
drZ80.z80_irq_callback=DrZ80_irq_callback;\r
\r
#elif defined(_USE_CZ80)\r
Cz80_Set_Fetch(&CZ80, 0x2000, 0x3fff, (UINT32)Pico.zram - 0x2000); // mirror\r
Cz80_Set_ReadB(&CZ80, (UINT8 (*)(UINT32 address))z80_read);\r
Cz80_Set_WriteB(&CZ80, z80_write);\r
+ Cz80_Set_INPort(&CZ80, z80_in);\r
+ Cz80_Set_OUTPort(&CZ80, z80_out);\r
#endif\r
}\r
\r
#define FAMEC_ADR_BITS 24\r
// #define FAMEC_FETCHBITS 8\r
#define FAMEC_DATABITS 8\r
+#define FAMEC_32BIT_PC\r
\r
#define USE_CYCLONE_TIMING\r
#define USE_CYCLONE_TIMING_DIV\r
#define GET_PC \\r
(u32)PC - BasePC;\r
\r
+\r
+#ifndef FAMEC_32BIT_PC\r
+\r
#define SET_PC(A) \\r
BasePC = g_m68kcontext->Fetch[((A) >> M68K_FETCHSFT) & M68K_FETCHMASK]; \\r
/* BasePC -= (A) & 0xFF000000; */ \\r
PC = (u16*)(((A) & M68K_ADR_MASK) + BasePC);\r
\r
-#define SET_PC_BASE(P,B,A) \\r
- (B) = g_m68kcontext->Fetch[((A) >> M68K_FETCHSFT) & M68K_FETCHMASK]; \\r
- /* (B) -= (A) & 0xFF000000; */ \\r
- (P) = (u16*)(((A) & M68K_ADR_MASK) + (B));\r
+#else\r
+\r
+#define SET_PC(A) \\r
+ BasePC = g_m68kcontext->Fetch[((A) >> M68K_FETCHSFT) & M68K_FETCHMASK]; \\r
+ BasePC -= (A) & 0xFF000000; \\r
+ PC = (u16*)((A) + BasePC);\r
+\r
+#endif\r
\r
\r
#define PRE_IO \\r
/* adjust SR */\r
flag_S = M68K_SR_S;\r
\r
- newPC&=M68K_ADR_MASK&~1; // don't crash on games with bad vector tables\r
+#ifndef FAMEC_32BIT_PC\r
+ newPC&=M68K_ADR_MASK\r
+#endif\r
+ newPC&=~1; // don't crash on games with bad vector tables\r
\r
SET_PC(newPC)\r
\r
res = dst - src;
AREG((Opcode >> 9) & 7) = res;
POST_IO
+#ifdef USE_CYCLONE_TIMING
+RET(12)
+#else
RET(10)
+#endif
}
// SUBA
res = dst - src;
AREG((Opcode >> 9) & 7) = res;
POST_IO
+#ifdef USE_CYCLONE_TIMING
+RET(12)
+#else
RET(10)
+#endif
}
// SUBA
res = dst - src;
AREG((Opcode >> 9) & 7) = res;
POST_IO
+#ifdef USE_CYCLONE_TIMING
+RET(14)
+#else
RET(12)
+#endif
}
// SUBA
res = dst - src;
AREG((Opcode >> 9) & 7) = res;
POST_IO
+#ifdef USE_CYCLONE_TIMING
+RET(16)
+#else
RET(14)
+#endif
}
// SUBA
res = dst - src;
AREG((Opcode >> 9) & 7) = res;
POST_IO
+#ifdef USE_CYCLONE_TIMING
+RET(18)
+#else
RET(16)
+#endif
}
// SUBA
res = dst - src;
AREG((Opcode >> 9) & 7) = res;
POST_IO
+#ifdef USE_CYCLONE_TIMING
+RET(16)
+#else
RET(14)
+#endif
}
// SUBA
res = dst - src;
AREG((Opcode >> 9) & 7) = res;
POST_IO
+#ifdef USE_CYCLONE_TIMING
+RET(20)
+#else
RET(18)
+#endif
}
// SUBA
res = dst - src;
AREG((Opcode >> 9) & 7) = res;
POST_IO
+#ifdef USE_CYCLONE_TIMING
+RET(16)
+#else
RET(14)
+#endif
}
// SUBA
res = dst - src;
AREG((Opcode >> 9) & 7) = res;
POST_IO
+#ifdef USE_CYCLONE_TIMING
+RET(18)
+#else
RET(16)
+#endif
}
// SUBA
res = dst - src;
AREG((Opcode >> 9) & 7) = res;
POST_IO
+#ifdef USE_CYCLONE_TIMING
+RET(12)
+#else
RET(10)
+#endif
}
// SUBA
res = dst - src;
AREG((Opcode >> 9) & 7) = res;
POST_IO
+#ifdef USE_CYCLONE_TIMING
+RET(14)
+#else
RET(12)
+#endif
}
// SUBA
{
int ret, snd_excess_add, stereo;
if (PsndRate != PsndRate_old || (PicoOpt&0x0b) != (PicoOpt_old&0x0b) || Pico.m.pal != pal_old) {
- sound_rerate(Pico.m.frame_count ? 1 : 0);
+ PsndRerate(Pico.m.frame_count ? 1 : 0);
}
stereo=(PicoOpt&8)>>3;
snd_excess_add = ((PsndRate - PsndLen*target_fps)<<16) / target_fps;
Reset940(1, 2);\r
Pause940(1);\r
}\r
- sound_rerate(Pico.m.frame_count ? 1 : 0);\r
+ PsndRerate(Pico.m.frame_count ? 1 : 0);\r
}\r
snd_excess_add = ((PsndRate - PsndLen*target_fps)<<16) / target_fps;\r
printf("starting audio: %i len: %i (ex: %04x) stereo: %i, pal: %i\n",\r
currentConfig.KeyBinds[13] = 1<<5;
currentConfig.KeyBinds[15] = 1<<6;
currentConfig.KeyBinds[ 3] = 1<<7;
+ currentConfig.KeyBinds[12] = 1<<26; // switch rnd
currentConfig.KeyBinds[ 8] = 1<<27; // save state
currentConfig.KeyBinds[ 9] = 1<<28; // load state
currentConfig.PicoCDBuffers = 0;
samples_made = samples_done = 0;
if (PsndRate != PsndRate_old || (PicoOpt&0x0b) != (PicoOpt_old&0x0b) || Pico.m.pal != pal_old) {
- sound_rerate(Pico.m.frame_count ? 1 : 0);
+ PsndRerate(Pico.m.frame_count ? 1 : 0);
}
stereo=(PicoOpt&8)>>3;