I think I've finally figured out why MasterTracks 1.8 was freezing after typing some midi keys, it's actually very subtle.

After setting up a new ubuntu system on a new laptop, I thought I'd download a fresh mame for experiments/mangling.

I totally forgot all about the typo in a2midi.cpp after a month or two of being busy with other stuff. (Yeah, I suppose I should read my own posts 8-)

(I mistakenly thought that this typo didn't make a difference)

https://github.com/mamedev/mame/blob/master/src/devices/bus/a2bus/a2midi.cpp

Code
WRITE_LINE_MEMBER( a2bus_midi_device::acia_irq_w )
{
	m_acia_irq = state ? true : false;

	if (m_acia_irq || m_ptm_irq)
	{
		raise_slot_irq();
	}
	else
	{
		lower_slot_irq();
	}
}

WRITE_LINE_MEMBER( a2bus_midi_device::ptm_irq_w )
{
	m_acia_irq = state ? true : false;                // should be m_ptm_irq

	if (m_acia_irq || m_ptm_irq)
	{
		raise_slot_irq();
	}
	else
	{
		lower_slot_irq();
	}
}


So how does the bug manifest itself?

You've got the 6840ptm and the 6850 acia both modifying the variable m_acia_irq.

The 6502 interrupt routine at $2572 (vector stored at $3FE/3FF) will first check the midi to see if there's data, if not the routine will check the timer and reset it by reading c0a1 and c0a4 which will clear the timer interrupt.

The problem comes in when you have midi data that comes in generating an IRQ while there's a timer IRQ as well. The 6840 routine update_interrupts() will only modify its IRQ variable on transitions from 0 to 1 or 1 to 0, so once it calls a2bus_midi_device::ptm_irq_w (true) and setting m_acia_irq to true it won't call it again.

But our interrupt routine processes the midi byte first, clearing the midi interrupt by reading $c0a9 and it calls a2bus_midi_device::acia_irq_w(false) which will set m_acia_irq to false.

This ends up dropping all interrupts for the timer so it will never update the clock.

It will keep processing the midi acia interrupts, but no timer processing will happen after this occurs.

I ended up disassembling a bunch of master tracks to figure out how it worked. I think I understand quite a bit more about the 6840 and the 6850 now. (the 6840 data sheet is really difficult to figure out)