Reply 60 of 76, by NewRisingSun
wrote:I'm pretty sure these issues are timing dependent, as break-pointing the code invariably makes things work properly.
What kind of breakpoint do you mean, DosBox' debugger or on a real machine? Because a debugger on a real machine would have to EOI the Timer Interrupt, otherwise you couldn't use the keyboard in the debugger, and that EOI would then allow IRQ2 to occur as well. DosBox' debugger should not be affected by this at all, because it runs completely outside the emulated machine, if I understand it correctly.
Since the problem occurs with a real MPU-401 as well, just with a lower probability, DosBox might just leave this problem as it is and blame the programmers (and direct players to the GATEFIX utility). Or add a hack just for this one game. The latter could be justified if it doesn't break anything else. Swapping the ACK and version bytes would break any program that reads the version correctly, though not necessarily in a fatal manner. Since the problem seems to be that IRQ2 does not get serviced because IRQ0 is still being serviced, and everything else follows from that, how about the following hack:
--- mpu401.cpp.old 2012-09-26 11:29:09 +0000
+++ mpu401.cpp 2014-01-18 14:00:17 +0000
@@ -210,6 +210,7 @@
QueueByte(0);
return;
case 0xac: /* Request version */
+ PIC_WriteCommand(0x20,0x60,1); // Hack for Frederik Pohl's Gateway
QueueByte(MSG_MPU_ACK);
QueueByte(MPU401_VERSION);
return;
This fixes the second song in all attempts that I have tried, and I could not imagine how this would break any other game or application, which are not insane enough to read the MPU version in the timer handler.