mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 07:17:45 -04:00
32x, improve poll detection
This commit is contained in:
parent
3368c27707
commit
bd07808352
6 changed files with 17 additions and 4 deletions
|
@ -119,8 +119,9 @@ void NOINLINE p32x_sh2_poll_detect(u32 a, SH2 *sh2, u32 flags, int maxcnt)
|
|||
// reading 2 consecutive 16bit values is probably a 32bit access. detect this
|
||||
// by checking address (max 2 bytes away) and cycles (max 2 cycles later).
|
||||
// no polling if more than 20 cycles have passed since last detect call.
|
||||
if (a - sh2->poll_addr <= 2 && CYCLES_GE(10, cycles_diff)) {
|
||||
if (CYCLES_GT(cycles_diff, 2) && ++sh2->poll_cnt >= maxcnt) {
|
||||
if (a - sh2->poll_addr <= 2 && CYCLES_GE(20, cycles_diff)) {
|
||||
if (!sh2_not_polling(sh2) && CYCLES_GT(cycles_diff, 2) &&
|
||||
++sh2->poll_cnt >= maxcnt) {
|
||||
if (!(sh2->state & flags))
|
||||
elprintf_sh2(sh2, EL_32X, "state: %02x->%02x",
|
||||
sh2->state, sh2->state | flags);
|
||||
|
@ -144,6 +145,7 @@ void NOINLINE p32x_sh2_poll_detect(u32 a, SH2 *sh2, u32 flags, int maxcnt)
|
|||
sh2->poll_addr = a;
|
||||
}
|
||||
sh2->poll_cycles = cycles_done;
|
||||
sh2_set_polling(sh2);
|
||||
}
|
||||
|
||||
void NOINLINE p32x_sh2_poll_event(SH2 *sh2, u32 flags, u32 m68k_cycles)
|
||||
|
|
|
@ -224,6 +224,8 @@ extern SH2 sh2s[2];
|
|||
# define sh2_cycles_left(sh2) (sh2)->icount
|
||||
# define sh2_burn_cycles(sh2, n) (sh2)->icount -= n
|
||||
# define sh2_pc(sh2) (sh2)->ppc
|
||||
# define sh2_not_polling(sh2) (sh2)->no_polling
|
||||
# define sh2_set_polling(sh2) (sh2)->no_polling = 0
|
||||
#else
|
||||
# define sh2_end_run(sh2, after_) do { \
|
||||
int left_ = ((signed int)(sh2)->sr >> 12) - (after_); \
|
||||
|
@ -235,6 +237,8 @@ extern SH2 sh2s[2];
|
|||
# define sh2_cycles_left(sh2) ((signed int)(sh2)->sr >> 12)
|
||||
# define sh2_burn_cycles(sh2, n) (sh2)->sr -= ((n) << 12)
|
||||
# define sh2_pc(sh2) (sh2)->pc
|
||||
# define sh2_not_polling(sh2) ((sh2)->sr & SH2_NO_POLLING)
|
||||
# define sh2_set_polling(sh2) ((sh2)->sr &= ~SH2_NO_POLLING)
|
||||
#endif
|
||||
|
||||
#define sh2_cycles_done(sh2) (unsigned)((int)(sh2)->cycles_timeslice - sh2_cycles_left(sh2))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue