Re: [hatari-devel] Enabling of ACIA IRQs

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


On 31/05/2013 18:53, Eero Tamminen wrote:
Hi,

On perjantai 31 toukokuu 2013, Nicolas Pomarède wrote:
I don't use midi, so I never really noticed.

In midi.c Midi_Data_WriteByte(), we have :

          if (!ConfigureParams.Midi.bEnableMidi)
                  return;

So, if midi is not enabled, byte are not processed and nothing will
happen (including irq).

I don't think 1) is really a problem.  But MIDI should work if we
have an option for enabling it at run-time.


As for 2), maybe the files to communicate via midi are only opened when
Hatari starts, not later when you check/uncheck ? But Midi_Init()
already seems to be called in change.c, so I don't know what is missing.

Midi_Reset() which starts the MIDI interrupt:
-------
void Midi_Reset(void)
{
         MidiControlRegister = 0;
         MidiStatusRegister = ACIA_SR_TX_EMPTY;
         nRxDataByte = 1;

         if (ConfigureParams.Midi.bEnableMidi)
         {
                 CycInt_AddRelativeInterrupt(2050, INT_CPU_CYCLE,
INTERRUPT_MIDI);
         }
}
-------

Is called only when emulated is reseted.


couple of alternatives:
1) enabling MIDI triggers emulation reset
2) enabling MIDI calls Midi_Reset()

1) is probably the safer option.

yes, maybe it's possible to use 2), but it would require tests to ensure it doesn't break anything. At least, a forced reset will warn the user. We can improve later.


I also guess the interrupt should be disabled in Midi_Reset(),
if MIDI isn't enabled...

you can add to the above 'if' :

	else
	{
		CycInt_RemovePendingInterrupt ( INTERRUPT_MIDI )
	}

midi's int is not really pending, but it doesn't matter, it will be disabled.

Could you do the change ? I'm not familiar with midi to check it works.

Nicolas




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/