mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 07:17:45 -04:00
more idle detection, minor stuff
git-svn-id: file:///home/notaz/opt/svn/PicoDrive@524 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
parent
4aed476f24
commit
b06778874d
5 changed files with 31 additions and 25 deletions
|
@ -23,7 +23,7 @@ struct PicoSRAM SRam = {0,};
|
|||
|
||||
void (*PicoWriteSound)(int len) = NULL; // called at the best time to send sound buffer (PsndOut) to hardware
|
||||
void (*PicoResetHook)(void) = NULL;
|
||||
void (*PicoLineHook)(int count) = NULL;
|
||||
void (*PicoLineHook)(void) = NULL;
|
||||
|
||||
// to be called once on emu init
|
||||
void PicoInit(void)
|
||||
|
@ -308,7 +308,7 @@ PICO_INTERNAL void PicoSyncZ80(int m68k_cycles_done)
|
|||
}
|
||||
|
||||
|
||||
// TODO: rm from asm too
|
||||
// TODO: rm from Sek.c+asm too
|
||||
int idle_hit_counter = 0;
|
||||
|
||||
void PicoFrame(void)
|
||||
|
@ -379,7 +379,7 @@ char *debugString(void)
|
|||
dstrp+=strlen(dstrp);
|
||||
sprintf(dstrp, "display_disable: %i, M3: %i, palette: %i, ?, hints: %i\n", bit(r,0), bit(r,1), bit(r,2), bit(r,4));
|
||||
dstrp+=strlen(dstrp);
|
||||
sprintf(dstrp, "mode set 2: %02x\n", (r=reg[1])); dstrp+=strlen(dstrp);
|
||||
sprintf(dstrp, "mode set 2: %02x hcnt: %i\n", (r=reg[1]), pv->reg[10]); dstrp+=strlen(dstrp);
|
||||
sprintf(dstrp, "SMS/gen: %i, pal: %i, dma: %i, vints: %i, disp: %i, TMS: %i\n", bit(r,2), bit(r,3), bit(r,4),
|
||||
bit(r,5), bit(r,6), bit(r,7)); dstrp+=strlen(dstrp);
|
||||
sprintf(dstrp, "mode set 3: %02x\n", (r=reg[0xB])); dstrp+=strlen(dstrp);
|
||||
|
|
|
@ -21,9 +21,9 @@ PICO_INTERNAL void PicoReratePico(void)
|
|||
PicoPicoPCMRerate(rate);
|
||||
}
|
||||
|
||||
static void PicoLinePico(int count)
|
||||
static void PicoLinePico(void)
|
||||
{
|
||||
PicoPicohw.line_counter += count;
|
||||
PicoPicohw.line_counter++;
|
||||
|
||||
#if 1
|
||||
if ((PicoPicohw.r12 & 0x4003) && PicoPicohw.line_counter - prev_line_cnt_irq3 > 200) {
|
||||
|
@ -37,7 +37,7 @@ static void PicoLinePico(int count)
|
|||
|
||||
if (PicoPicohw.fifo_bytes > 0)
|
||||
{
|
||||
PicoPicohw.fifo_line_bytes += fifo_bytes_line * count;
|
||||
PicoPicohw.fifo_line_bytes += fifo_bytes_line;
|
||||
if (PicoPicohw.fifo_line_bytes >= (1<<16)) {
|
||||
PicoPicohw.fifo_bytes -= PicoPicohw.fifo_line_bytes >> 16;
|
||||
PicoPicohw.fifo_line_bytes &= 0xffff;
|
||||
|
|
|
@ -139,7 +139,7 @@ static int PicoFrameHints(void)
|
|||
#ifdef PICO_CD
|
||||
update_chips();
|
||||
#else
|
||||
if (PicoLineHook) PicoLineHook(1);
|
||||
if (PicoLineHook) PicoLineHook();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -213,7 +213,7 @@ static int PicoFrameHints(void)
|
|||
#ifdef PICO_CD
|
||||
update_chips();
|
||||
#else
|
||||
if (PicoLineHook) PicoLineHook(1);
|
||||
if (PicoLineHook) PicoLineHook();
|
||||
#endif
|
||||
|
||||
// PAL line count might actually be 313 according to Steve Snake, but that would complicate things.
|
||||
|
@ -241,7 +241,7 @@ static int PicoFrameHints(void)
|
|||
#ifdef PICO_CD
|
||||
update_chips();
|
||||
#else
|
||||
if (PicoLineHook) PicoLineHook(1);
|
||||
if (PicoLineHook) PicoLineHook();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -437,7 +437,7 @@ extern struct Pico Pico;
|
|||
extern struct PicoSRAM SRam;
|
||||
extern int emustatus;
|
||||
extern void (*PicoResetHook)(void);
|
||||
extern void (*PicoLineHook)(int count);
|
||||
extern void (*PicoLineHook)(void);
|
||||
PICO_INTERNAL int CheckDMA(void);
|
||||
PICO_INTERNAL void PicoDetectRegion(void);
|
||||
PICO_INTERNAL void PicoSyncZ80(int m68k_cycles_done);
|
||||
|
|
36
Pico/Sek.c
36
Pico/Sek.c
|
@ -210,31 +210,35 @@ int SekIsIdleCode(unsigned short *dst, int bytes)
|
|||
switch (bytes)
|
||||
{
|
||||
case 4:
|
||||
if ( (*dst & 0xfff8) == 0x4a10 || // tst.b ($aX) // where should be no need to wait
|
||||
(*dst & 0xfff8) == 0x4a28 || // tst.b ($xxxx,a0) // for byte change anywhere
|
||||
(*dst & 0xff3f) == 0x4a38 || // tst.x ($xxxx.w), tas ($xxxx.w)
|
||||
if ( (*dst & 0xfff8) == 0x4a10 || // tst.b ($aX) // there should be no need to wait
|
||||
(*dst & 0xfff8) == 0x4a28 || // tst.b ($xxxx,a0) // for byte change anywhere
|
||||
(*dst & 0xff3f) == 0x4a38 || // tst.x ($xxxx.w); tas ($xxxx.w)
|
||||
(*dst & 0xc1ff) == 0x0038 || // move.x ($xxxx.w), dX
|
||||
(*dst & 0xf13f) == 0xb038) // cmp.x ($xxxx.w), dX
|
||||
return 1;
|
||||
break;
|
||||
case 6:
|
||||
if ( ((dst[1] & 0xe0) == 0xe0 && ( // RAM
|
||||
*dst == 0x4a39 || // tst.b ($xxxxxxxx)
|
||||
*dst == 0x4a79 || // tst.w ($xxxxxxxx)
|
||||
*dst == 0x4ab9)) || // tst.l ($xxxxxxxx)
|
||||
*dst == 0x0838) // btst $X, ($xxxx.w) [6 byte op]
|
||||
if ( ((dst[1] & 0xe0) == 0xe0 && ( // RAM and
|
||||
*dst == 0x4a39 || // tst.b ($xxxxxxxx)
|
||||
*dst == 0x4a79 || // tst.w ($xxxxxxxx)
|
||||
*dst == 0x4ab9 || // tst.l ($xxxxxxxx)
|
||||
(*dst & 0xc1ff) == 0x0039 || // move.x ($xxxxxxxx), dX
|
||||
(*dst & 0xf13f) == 0xb039))||// cmp.x ($xxxxxxxx), dX
|
||||
*dst == 0x0838 || // btst $X, ($xxxx.w) [6 byte op]
|
||||
(*dst & 0xffbf) == 0x0c38) // cmpi.{b,w} $X, ($xxxx.w)
|
||||
return 1;
|
||||
break;
|
||||
case 8:
|
||||
if ( (dst[2] & 0xe0) == 0xe0 && ( // RAM
|
||||
*dst == 0x0839 || // btst $X, ($xxxxxxxx.w) [8 byte op]
|
||||
(*dst & 0xffbf) == 0x0c39)) // cmpi.{b,w} $X, ($xxxxxxxx)
|
||||
if ( ((dst[2] & 0xe0) == 0xe0 && ( // RAM and
|
||||
*dst == 0x0839 || // btst $X, ($xxxxxxxx.w) [8 byte op]
|
||||
(*dst & 0xffbf) == 0x0c39))||// cmpi.{b,w} $X, ($xxxxxxxx)
|
||||
*dst == 0x0cb8) // cmpi.l $X, ($xxxx.w)
|
||||
return 1;
|
||||
break;
|
||||
case 12:
|
||||
if ((*dst & 0xf1f8) == 0x3010 && // move.w (aX), dX
|
||||
(dst[1]&0xf100) == 0x0000 && // arithmetic
|
||||
(dst[3]&0xf100) == 0x0000) // arithmetic
|
||||
(dst[1]&0xf100) == 0x0000 && // arithmetic
|
||||
(dst[3]&0xf100) == 0x0000) // arithmetic
|
||||
return 1;
|
||||
break;
|
||||
}
|
||||
|
@ -249,7 +253,7 @@ int SekRegisterIdlePatch(unsigned int pc, int oldop, int newop)
|
|||
#endif
|
||||
pc &= ~0xff000000;
|
||||
elprintf(EL_IDLE, "idle: patch %06x %04x %04x #%i", pc, oldop, newop, idledet_count);
|
||||
if (pc > Pico.romsize) {
|
||||
if (pc > Pico.romsize && !(PicoAHW & PAHW_SVP)) {
|
||||
if (++idledet_bads > 128) return 2; // remove detector
|
||||
return 1; // don't patch
|
||||
}
|
||||
|
@ -260,7 +264,9 @@ int SekRegisterIdlePatch(unsigned int pc, int oldop, int newop)
|
|||
idledet_addrs = tmp;
|
||||
}
|
||||
|
||||
idledet_addrs[idledet_count++] = pc;
|
||||
if (pc < Pico.romsize)
|
||||
idledet_addrs[idledet_count++] = pc;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue