1
0
Fork 0

Process repeated reset commands without delay. Fixes MPU detection in several games. Correct ACK for reset: entirely absent with dumb setting (mpu401=uart), and also absent when returning to intelligent mode from UART mode.

Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@4047
This commit is contained in:
ripsaw8080 2017-09-10 11:25:45 +00:00
parent 451d07d8da
commit 5c0b03c10c

View file

@ -122,7 +122,15 @@ static Bitu MPU401_ReadStatus(Bitu port,Bitu iolen) {
}
static void MPU401_WriteCommand(Bitu port,Bitu val,Bitu iolen) {
if (mpu.state.reset) {mpu.state.cmd_pending=val+1;return;}
if (mpu.mode==M_UART && val!=0xff) return;
if (mpu.state.reset) {
if (mpu.state.cmd_pending || (val!=0x3f && val!=0xff)) {
mpu.state.cmd_pending=val+1;
return;
}
PIC_RemoveEvents(MPU401_ResetDone);
mpu.state.reset=false;
}
if (val<=0x2f) {
switch (val&3) { /* MIDI stop, start, continue */
case 1: {MIDI_RawOutByte(0xfc);break;}
@ -246,8 +254,11 @@ static void MPU401_WriteCommand(Bitu port,Bitu val,Bitu iolen) {
LOG(LOG_MISC,LOG_NORMAL)("MPU-401:Reset %X",val);
PIC_AddEvent(MPU401_ResetDone,MPU401_RESETBUSY);
mpu.state.reset=true;
if (mpu.mode==M_UART) {
MPU401_Reset();
return; //do not send ack in UART mode
}
MPU401_Reset();
if (mpu.mode==M_UART) return;//do not send ack in UART mode
break;
case 0x3f: /* UART mode */
LOG(LOG_MISC,LOG_NORMAL)("MPU-401:Set UART mode %X",val);
@ -537,7 +548,6 @@ static void MPU401_Event(Bitu val) {
}
if (!mpu.state.irq_pending && mpu.state.req_mask) MPU401_EOIHandler();
next_event:
PIC_RemoveEvents(MPU401_Event);
Bitu new_time;
if ((new_time=mpu.clock.tempo*mpu.clock.timebase)==0) return;
PIC_AddEvent(MPU401_Event,MPU401_TIMECONSTANT/new_time);