VOGONS


First post, by Mok

User metadata
Rank Newbie
Rank
Newbie

A couple of years back I found an obscure game: "Balance" by Kingsoft (http://www.mobygames.com/game/dos/balance) that failed to produce any MIDI music in dosbox (setup has SCC and LAPC options).

It uses MPU-401 intelligent mode a bit differently: no auto playback, the code turns on CLOCK TO HOST mode and just uses is as an extra timer to trigger music replay routine. Dosbox doesn't seem to emulate this mode properly. MPU-401 should constantly send 0xFD regardless of playback status. I have been able to make it work:

in MPU401_WriteCommand():
after: mpu.clock.clock_to_host=true;
added: PIC_AddEvent(MPU401_Event,MPU401_TIMECONSTANT/(mpu.clock.tempo*mpu.clock.timebase));

and in MPU401_Event():
after: mpu.state.req_mask|=(1<<13);
added: QueueByte(0xfd);

But this is just a crude hack. I don't know dosbox code at all and I don't code in C++. Anyone with decent knowledge of MPU-401 and dosbox can make a proper fix? Testing should be pretty easy: Just install an irq handler and turn CLOCK TO HOST mode on by sending command 95h to MPU. Your irq handler should start receiving 0xFD till you disable the mode by sending command 94h.