VOGONS


Reply 700 of 894, by Arkku

User metadata
Rank Newbie
Rank
Newbie

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.

Last edited by Arkku on 2019-02-12, 10:02. Edited 2 times in total.

Reply 701 of 894, by keropi

User metadata
Rank l33t++
Rank
l33t++

allright then since you solved it and are happy because it works with your setup like you want it then I am happy as well 😊

🎵 🎧 PCMIDI MPU , OrpheusII , Action Rewind , Megacard and 🎶GoldLib soundcard website

Reply 702 of 894, by Arkku

User metadata
Rank Newbie
Rank
Newbie
keropi wrote:

allright then since you solved it and are happy because it works with your setup like you want it then I am happy as well 😊

No worries, and thank you again for this great product! This behaviour of the real MPU-401 was just unexpected for me (and I still consider sending out a random tempo as power-on default a weird choice), but it is obviously a property of the original card and not your fault in any way. In the end the result was quite positive since it got me (and hopefully by extension, the readers of this forum) to learn a bit more about the MPU-401's internals.

Attached is a small 8086 DOS program which disables the MPU-401's real time message output (command 0x32), while staying in intelligent mode. This shouldn't prevent any conceivable game from working correctly, since neither MT-32 nor GM devices need the RTM output, and the internal clock is still available (if the game enables it, it is not enabled by default). One can also run mqreset.exe to undo this, and indeed any game/program which issues the intelligent mode reset will re-enable the clock. (This program is written with debug.com because I had no proper assembler on this machine, so the disassembly is exactly the source code.)

Caveat: The MPU-401 is assumed to be at 330h address and in intelligent mode (such as on power-on or after running mqreset.exe). The program might hang forever if you don't have an MPU-401 (although it should simply exit with no effect if you have one at 330h in UART mode), and it may do random things to non-MPU-401 devices at that address. As always, no warranty!

Attachments

  • Filename
    mqrtmoff.zip
    File size
    635 Bytes
    Downloads
    64 downloads
    File comment
    Disable MIDI RTM output in MPU-401 intelligent mode
    File license
    Fair use/fair dealing exception

Reply 703 of 894, by keropi

User metadata
Rank l33t++
Rank
l33t++

Well the more setup options the better in my book so thanks for sharing all this. Maybe someone else with requirements like yours will benefit from it in the future.
Thanks for supporting the project!

🎵 🎧 PCMIDI MPU , OrpheusII , Action Rewind , Megacard and 🎶GoldLib soundcard website

Reply 704 of 894, by Scali

User metadata
Rank l33t
Rank
l33t

I'd like to add that the IBM Music Feature Card does exactly the same: by default it sends clock commands to the MIDI out port.
I suppose the idea is that both the MPU-401 and the IMFC are semi-professional solutions, and the PC would normally be used as a MIDI sequencer, and as such, would provide the master clock for all devices.

http://scalibq.wordpress.com/just-keeping-it- … ro-programming/

Reply 705 of 894, by gdjacobs

User metadata
Rank l33t++
Rank
l33t++

Is this configurable by either register toggle or SYSEX?

Edit: Arkku explained the register toggle above. Sorry Keropi, not a great question. Back to regular programming?

Last edited by gdjacobs on 2019-02-12, 09:23. Edited 1 time in total.

All hail the Great Capacitor Brand Finder

Reply 706 of 894, by keropi

User metadata
Rank l33t++
Rank
l33t++
gdjacobs wrote:

Is this configurable by either register toggle or SYSEX?

don't mess with working things... Arkku had a reason to mess with it. 30+ years of usage in normal/simpler/gaming setups show this behavior was (at least) expected/normal.
Else Arkku posted info a couple of posts above to disable this.

🎵 🎧 PCMIDI MPU , OrpheusII , Action Rewind , Megacard and 🎶GoldLib soundcard website

Reply 707 of 894, by Arkku

User metadata
Rank Newbie
Rank
Newbie
Scali wrote:

I suppose the idea is that both the MPU-401 and the IMFC are semi-professional solutions, and the PC would normally be used as a MIDI sequencer, and as such, would provide the master clock for all devices.

Yes, based on the MPU-401 technical reference manual, I believe the intent is indeed that it's a card for musicians and composers, who would then be able to use the intelligent mode with a few simple commands to obtain things like a clock and metronome. The original 8086 computers were also slow and maintaining an accurate clock in software while doing other things would not have been a trivial task, hence the "MIDI Processing Unit" to aid the CPU… From today's perspective and gaming point of view it is just a surprising default since everything today uses a software clock, and games don't need to output the clock even in intelligent mode since MT-32/GM sound modules do not use it. And there is also a modern tendency to conserve resources by idling, while this powers up sending out the clock beat. But for the time it is understandable, especially as I think the musician was also expected to dabble in programming the MPU directly instead of firing up a DAW that takes care of everything. =)

keropi wrote:

Arkku had a reason to mess with it. 30+ years of usage in normal/simpler/gaming setups show this behavior was (at least) expected/normal.

Yes, if you have no other clocks masters in the MIDI system, any problems from the clock output are theoretical at best (negligible bandwidth use + possibly some energy spent blinking activity LEDs on modules/patchbays). Also note my discovery above that UART mode disables the clock output, so all the games that switch to UART mode disable it for you, so even the theoretical downside doesn't apply during gameplay. (Likewise UART-only MPU-401 compatible cards, like Sound Blasters etc., do not send the clock.)

Reply 708 of 894, by Arkku

User metadata
Rank Newbie
Rank
Newbie

An unrelated question: I'm now running this card in an IBM PS/2 model 35, and the Music Quest software is unable to detect it when configured to IRQ 2/9, even though I don't know of anything using IRQ 9 in the system (mouse, HDD, serial and parallel are the only things enabled/installed, and they have IRQs 12, 14, 4 and 7, MSD.EXE doesn't reveal anything unusual at 9 either). It works fine when set to IRQ 3, but I would like to have it at 2/9 for the few games having this setting hard-coded.

Is there any known solution, or at least something that would explain the issue? (For example, do even ISA PS/2 computers have something internally at IRQ 9?)

Reply 709 of 894, by keropi

User metadata
Rank l33t++
Rank
l33t++

Something it generating IRQs in your system, I have no experience with PS/2 systems (only have a PS1/pro 386sx that is ISA and irq2 is free on it) but maybe it's the vga? Have you checked if there is an IRQ jumper for it?
Scali also has a 286 that cannot use IRQ2, I have yet to find a board that won't free up IRQ2.... but it seems OEMs can disagree with this.
Not much help I know... 🙁

🎵 🎧 PCMIDI MPU , OrpheusII , Action Rewind , Megacard and 🎶GoldLib soundcard website

Reply 710 of 894, by Scali

User metadata
Rank l33t
Rank
l33t
Arkku wrote:

Yes, based on the MPU-401 technical reference manual, I believe the intent is indeed that it's a card for musicians and composers, who would then be able to use the intelligent mode with a few simple commands to obtain things like a clock and metronome. The original 8086 computers were also slow and maintaining an accurate clock in software while doing other things would not have been a trivial task, hence the "MIDI Processing Unit" to aid the CPU… From today's perspective and gaming point of view it is just a surprising default since everything today uses a software clock, and games don't need to output the clock even in intelligent mode since MT-32/GM sound modules do not use it. And there is also a modern tendency to conserve resources by idling, while this powers up sending out the clock beat. But for the time it is understandable, especially as I think the musician was also expected to dabble in programming the MPU directly instead of firing up a DAW that takes care of everything. =)

Yea, exactly... Intelligent Mode is very advanced, and is basically an 8-channel hardware sequencer, designed with a 'pull' datamodel: it requests the next note to play (and its timestamp) from the CPU as soon as it has sent the previous note for that channel.
This means that you get perfectly accurate MIDI timing, regardless of what the CPU is actually doing at the time. Timing is completely decoupled from the software.

The IMFC is not quite that advanced, but still they put a separate 8254 chip on there, which runs at 1 MHz, which is the exact resolution of MIDI timing. This allows you to fire off interrupts at exact MIDI timestamps, while having the onboard timer free for other tasks. Still better than the dumb MPU-401 UART mode that later games used.

http://scalibq.wordpress.com/just-keeping-it- … ro-programming/

Reply 711 of 894, by Scali

User metadata
Rank l33t
Rank
l33t
Arkku wrote:

An unrelated question: I'm now running this card in an IBM PS/2 model 35, and the Music Quest software is unable to detect it when configured to IRQ 2/9, even though I don't know of anything using IRQ 9 in the system (mouse, HDD, serial and parallel are the only things enabled/installed, and they have IRQs 12, 14, 4 and 7, MSD.EXE doesn't reveal anything unusual at 9 either). It works fine when set to IRQ 3, but I would like to have it at 2/9 for the few games having this setting hard-coded.

VGA has a vertical retrace interrupt at IRQ2/9. This is usually disabled on ISA systems (many PCBs do not even have the pin connected at all, others have a jumper to disconnect it, and are usually configured disconnected from the factory). On PS/2 systems however, the VGA chip is usually integrated, so it may be connected as well. In which case it may cause problems.

Also, as I mentioned earlier, my 286 doesn't want to use the card at IRQ2 either. I'm not entirely sure whether that is a problem with the 286 or with the MQ card.
I also tested a real MPU-401 and that did work, but that could just be 'chance', since if something else is connected to IRQ2/9 as well, it probably depends on some weird analog characteristics such as impedance whether or not the signal from the card is picked up properly.

I have yet to test the MQ card in other systems, to see if the IRQ2 itself is working correctly on the card (although I suspect it does, since it's a very simple scheme that just maps the IRQ signal from the microcontroller to the proper ISA pin with some jumpers).

http://scalibq.wordpress.com/just-keeping-it- … ro-programming/

Reply 712 of 894, by keropi

User metadata
Rank l33t++
Rank
l33t++

For what it's worth this is now the 2nd instance I hear of IRQ2 not working on a system that is not a pentium1 (which can be fixed if there is an option to disable ACPI).
There are some 300+ cards out there and the most common problems (aside from something like 3 hardware failures so far) are either ACPI or the user forgetting to move/disable his main soundcard's mpu address...
My PS1/pro also has a weird TI vga onboard but I would guess it would be generally a simpler controller compared to one inside a PS/2 .

🎵 🎧 PCMIDI MPU , OrpheusII , Action Rewind , Megacard and 🎶GoldLib soundcard website

Reply 713 of 894, by Arkku

User metadata
Rank Newbie
Rank
Newbie
keropi wrote:

Something it generating IRQs in your system, I have no experience with PS/2 systems (only have a PS1/pro 386sx that is ISA and irq2 is free on it) but maybe it's the vga? Have you checked if there is an IRQ jumper for it?
Scali also has a 286 that cannot use IRQ2, I have yet to find a board that won't free up IRQ2.... but it seems OEMs can disagree with this.
Not much help I know... 🙁

Hi, you also sent me a PM about this but apparently I don't have enough posts here to reply, so I sent you an e-mail instead.

Anyway, the PS/2 has no jumper configuration (and I have no other expansion cards installed). It does have a built-in VGA, but I can't find info about whether or not it has IRQs wired. Should MSD.EXE detect it in that case (it doesn't show anything on IRQ 9), or is there some other "IRQ tester" software that could tell this?

The Z8 chip is indeed a Zilog on my card, but I don't know of the potential differences that could make.

Reply 714 of 894, by Scali

User metadata
Rank l33t
Rank
l33t
Arkku wrote:

Anyway, the PS/2 has no jumper configuration (and I have no other expansion cards installed). It does have a built-in VGA, but I can't find info about whether or not it has IRQs wired. Should MSD.EXE detect it in that case (it doesn't show anything on IRQ 9), or is there some other "IRQ tester" software that could tell this?

I developed a little tool for it some time ago, when I wanted to investigate how many EGA/VGA cards have a working vsync IRQ.
You can find it here: The myth of the vertical retrace interrupt on EGA/VGA

http://scalibq.wordpress.com/just-keeping-it- … ro-programming/

Reply 715 of 894, by Arkku

User metadata
Rank Newbie
Rank
Newbie
Scali wrote:

I developed a little tool for it some time ago, when I wanted to investigate how many EGA/VGA cards have a working vsync IRQ.

Thanks! I tried the utility, but it just shows "IRQs: 0" on the PS/2, so it shouldn't be a case of VGA stealing it.

Not sure what to try next, though. (edit: Well, one thing I did try was installing the card set to IRQ 2 again, and I watched the IRQ 2 pin (B4) on the ISA bus with a logic probe while I ran mqdiag.exe – I can see it pulse, so the card definitely does signal the interrupt on that pin, it's just not getting through to the software.)

Reply 716 of 894, by keropi

User metadata
Rank l33t++
Rank
l33t++

it just doesn't make much sense to me if IRQ3 for example works and IRQ2 does not - provided IRQ2 is truly free. Can you probe it without the mpu installed at all, does it perhaps show some activity during system usage?
IRQ selection is really simple on the card, see this schematic - I edited out the other stuff :

jBuggdf.png

it's just a jumper that selects which isa pin ends up to the mcu , it's not like they go to different inputs/paths and one is damaged so it does not work.
Maybe IRQ2 cascading shenanigans are at play...
Weird!

🎵 🎧 PCMIDI MPU , OrpheusII , Action Rewind , Megacard and 🎶GoldLib soundcard website

Reply 717 of 894, by Arkku

User metadata
Rank Newbie
Rank
Newbie
keropi wrote:

it just doesn't make much sense to me if IRQ3 for example works and IRQ2 does not - provided IRQ2 is truly free. Can you probe it without the mpu installed at all, does it perhaps show some activity during system usage?

Yes, I actually already did that. The logic probe shows it as permanently high when the MPU is not installed (pull-up resistor?) but no activity.

Reply 718 of 894, by keropi

User metadata
Rank l33t++
Rank
l33t++

Is it the same with another unused IRQ? Did you check IRQ3 that we know for sure works?
You don't have a scsi card installed or a network adapter, right?

🎵 🎧 PCMIDI MPU , OrpheusII , Action Rewind , Megacard and 🎶GoldLib soundcard website

Reply 719 of 894, by Marmes

User metadata
Rank Member
Rank
Member
Arkku wrote:
keropi wrote:

it just doesn't make much sense to me if IRQ3 for example works and IRQ2 does not - provided IRQ2 is truly free. Can you probe it without the mpu installed at all, does it perhaps show some activity during system usage?

Yes, I actually already did that. The logic probe shows it as permanently high when the MPU is not installed (pull-up resistor?) but no activity.

What about IRQ3? Is it pulled up?