Re: [hatari-devel] Hatari ACIA TX interrupts

[ Thread Index | Date Index | More Archives ]


On perjantai 12 syyskuu 2014, Douglas Little wrote:
> I have been trying to debug some MIDI code and getting different results
> between Hatari and a real Falcon.

MIDI emulation file in Hatari has following comment:
  Note that this code is far from being perfect. However, it is already
  enough to let some ST programs (e.g. the game Pirates!) use the host's
  midi system.

   - Most bits in the ACIA's status + control registers are currently 
   - Check when we have to clear the ACIA_SR_INTERRUPT_REQUEST bit in the
     ACIA status register (it is currently done when reading or writing to
     the data register, but probably it should rather be done when reading 
     status register?).

It would be good to improve that, is there documentation
somewhere how it should work?

At least MIDI playback works in all the sequencers I've tested.
I didn't try replay in one Hatari instance with recording in

> Setting TX interrupt enable on the MIDI ACIA seems to have no effect - no
> interrupts are generated when writing to the MIDI data port.

I'm not really familiar how this should work at the HW level,
what means "interrupts being generated" in case of writing to
MIDI port?

Hatari's internal MIDI interrupts happen constantly at fixed
interval. Only thing that depends on reads/writes, is what is
done with MIDI/ACIA register bits.

What happens at the code level on MIDI data reg write ($FFFC06):
0. Nothing happens if MIDI emulation is disabled, or
   Hatari MIDI output file is specified, but not writable
   (in which case MIDI output & interrupts are disabled)
   are cleared for MidiStatusRegister variable
2. at MIDI interrupt interval:
        if (!(MidiStatusRegister & ACIA_SR_TX_EMPTY))
                /* Do we need to generate a transfer interrupt? */
                if ((MidiControlRegister & 0xA0) == 0xA0)
                        LOG_TRACE(TRACE_MIDI, "MIDI: WriteData transfer 
                        /* Acknowledge in MFP circuit, pass 
bit,enable,pending */
                        MFP_InputOnChannel ( MFP_INT_ACIA , 0 );
                        MidiStatusRegister |= ACIA_SR_INTERRUPT_REQUEST;
                MidiStatusRegister |= ACIA_SR_TX_EMPTY;

> Testing the same code on a real Falcon does generate interrupts as
> expected when the port clears.
> I also noticed that setting the RX interrupt enable bit will generate
> interrupts when writing data to the MIDI data port, which seems a bit
> strange? I didn't test that on a real Falcon but at face value it seems
> incorrect? RX interrupts should only occur when data is flowing into the
> machine via the (virtual) midi socket.

What "--trace midi" tells you?  Does it show any errors?

> *While I am using a Windows build of Hatari and external Windows MIDI
> support isn't implemented - I think the emulated side should not behave
> in this way regardless.*
> Any info welcome.

	- Eero

Mail converted by MHonArc 2.6.19+