Ok.. What are they actually using the PIO stuff for on the system?
It is used as an interrupt controller receiving the INT pins from both V9938s. I added logging to demonstrate how fucked up the V9938 interrupt callbacks are:
VINT2 1 y 136 frame 5 VINT2 0 y 155 frame 5 VINT2 1 y 454 frame 5 VINT2 0 y 268 frame 130 ...
But this doesn't explain why Megatouch games break with new PIO, V9938 didn't change afterall.
The code in meritm.c was calling PIO port write only when interrupt line has actually changed (line state was cached) and only when it changed to 1 (interrupt active). I don't remember at the moment why I had to put it that way. Maybe just try to remove one of these kludges at a time to see if it fixes anything?