mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 07:17:45 -04:00
core, add TH pad pin latency (regression after 5 min)
This commit is contained in:
parent
66e9abff6d
commit
e05680a2b9
1 changed files with 12 additions and 5 deletions
|
@ -328,7 +328,11 @@ static NOINLINE u32 port_read(int i)
|
|||
// disables output before doing TH-low read, so don't emulate it for TH.
|
||||
// Decap Attack reportedly doesn't work on Nomad but works on must
|
||||
// other MD revisions (different pull-up strength?).
|
||||
u32 mask = 0x3f | (padTHLatency[i] < SekCyclesDone() ? 0x40 : 0);
|
||||
u32 mask = 0x3f;
|
||||
if (CYCLES_GE(SekCyclesDone(), padTHLatency[i])) {
|
||||
mask |= 0x40;
|
||||
padTHLatency[i] = SekCyclesDone();
|
||||
}
|
||||
out |= mask & ~ctrl_reg;
|
||||
|
||||
in = port_readers[i](i, out);
|
||||
|
@ -407,10 +411,13 @@ NOINLINE void io_ports_write(u32 a, u32 d)
|
|||
Pico.m.padTHPhase[a - 1]++;
|
||||
}
|
||||
|
||||
// after pulling down TH there's a latency before the new value can be read
|
||||
// back as input (see Decap Attack, not in Samurai Showdown, 32x WWF Raw)
|
||||
if (a >= 4 && a <= 5 && !(d & 0x40))
|
||||
padTHLatency[a - 4] = SekCyclesDone() + 25;
|
||||
// after switching TH to input there's a latency before the pullup value is
|
||||
// read back as input (see Decap Attack, not in Samurai Showdown, 32x WWF Raw)
|
||||
if (a >= 4 && a <= 5) {
|
||||
padTHLatency[a - 4] = SekCyclesDone(); // if output, effective immediately
|
||||
if ((PicoMem.ioports[a] & 0x40) && !(d & 0x40))
|
||||
padTHLatency[a - 4] += 25; // latency after switching to input
|
||||
}
|
||||
|
||||
// certain IO ports can be used as RAM
|
||||
PicoMem.ioports[a] = d;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue