Reply 700 of 894, by Arkku
Actually it turns out the MPU stops sending the clock when switched to UART mode:
C:\>debug
-O 331 3F
All that is needed is writing 0x3F to port 0x331 (assuming the card is at 0x330). Resetting it (write 0xFF to the same port) restores the clock. This, at least, allows me to stop the clock output while idle. I'll look later into how the intelligent mode programming works, perhaps there is a way to control the clock there, or maybe it is indeed intended that the software in intelligent mode syncs to the hardware clock generated by the card. (Like said said in my previous post, it would still be unnecessary to send out the same clock in things like games where you are not controlling external clock-based equipment.)
Update
According to the MPU-401 Technical Reference manual "[the] MPU-401 can also be set up as a MIDI slave unit to other MIDI clocks". This is controlled by the intelligent mode commands 0x80 (master, default) and 0x82 (slave to MIDI). So, while staying in intelligent mode, the MPU can be set as a clock slave, which stops sending the clock output:
C:\>debug
-O 331 82
-I 330
The default behaviour can be reverted by sending either 0x80 (clock master) or 0xFF (reset to intelligent mode) instead of the 0x82.
It is also possible to disable the clocks from being sent out while still generating them. This makes sense if you are syncing your own software (like a game) to the MPU-401's intelligent mode hardware clock but have no other external clock-based devices. This is activated by sending 0x32 (disable realtime output, which is basically what I was doing earlier with the patchbay) and 0x95 (clock to host). However, this mode sends the clock beat as a non-standard byte 0xFD instead of standard 0xF8, presumably to differentiate from possible incoming MIDI clock. The byte 0xFD is not defined by the MIDI standard but it is in the "namespace" of realtime messages (having five most significant bits set), so Roland has taken the liberty of appropriating it for this use – most software should simply ignore it because typically there is a branch like "if ((byte & 0xF8) == 0xF8)" for the required special handling of any realtime bytes (which may be in between the bytes of multi-byte non-realtime messages). This requires any software wishing to read the MPU's hardware clock to specifically support it, but intelligent mode MPU-401 software will anyway have specific support for the MPU-401.
Ok, well, I guess in the end I answered my own question: yes, the clock can be disabled, or it can be read internally (albeit as a non-standard realtime message), and optionally it can be prevented from going out of the MIDI OUT. Also the UART mode disables the clock from being generated at all, and games don't send clock through the MIDI out. Hopefully someone else will find this interesting. I'll make a DOS program to control this setting at some point.