First post, by aitotat
Many of the older General Midi games are hardcoded to use port 330h. It is not a problem if you have only one MIDI device. But if you do have more, wouldn't it be nice if you could choose what device to use?
MIDIto tries to do just that. It uses EMM386 or QEMM to trap ports and redirect data elsewhere, to user defined destination. EMM386 and QEMM have limitations, such as this approach does not work with protected mode games. Fortunately many of them allow to define MIDI port (but not all).
MIDIto can do other things as well. It can add delays for OPL port accesses so OPL2 cards could be used on faster systems. MIDIto can also make your CMS equipped Sound Blaster 1.x and 2.0 cards to be fully Game Blaster compatible when needed.
How to use MIDIto? I tried to make things as simple as possible:
MIDIto TSR - Release 5 - 2021.10.20
(C) 2021 by Tomi Tilli
Released under GNU GPL v2
Uses assembly libraries from XTIDE Universal BIOS and Associated Tools
Copyright (C) 2009-2010 by Tomi Tilli, 2011-2021 by XTIDE Universal BIOS Team.
Redirect MIDI data meant for port 330h to another MIDI device you like better.
Fix OPL2 for faster systems. Make SB with CMS fully Game Blaster compatible.
USAGE: midito [DESTINATION MIDI PORT] [OPTIONS]
Optional destination MIDI port. Accepted values are 100 - FFFE
-a or /a: Adlib - Trap Adlib ports with minimum I/O delay
-a=##### or /a=#####: Adlib - Trap Adlib ports with ##### number of extra
jumps when minimum delay is not enough. Values up to 65535 are accepted
-a=off or /a=off: Adlib - Disable Adlib ports
-cms or /cms: - Emulate CT-1302 for full CMS / Game Blaster support
-u or /u: Uninstall - Uninstalls MIDIto TSR from memory
-v or /v: Verbose - Prints extra install or uninstall information
More detailed description about the options
-a=##### or /a=##### Traps Adlib ports 388h (index) and 389h (data). OPL ports
from Sound Blaster address space are also trapped if Sound Blaster is detected.
Trapped ports are determined by Sound Blaster DSP version:
DSP versions 1.x and 2.x can only appear on Sound Blaster 1.0, 1.5 and 2.0
cards and they might have CMS chips and always have one OPL2 chip. It is not
possible to detect if the CMS chips are actually present. For those cards
MIDIto traps OPL2 ports at Sound Blaster base+8h and base+9h in addition to the
Sound Blasters with DSP version 3.x (Sound Blaster pro 1 and 2) and 4.x (Sound
Blaster 16/32/AWE) cannot have CMS chips. Instead, the CMS address space
(base+0...base+3) is used by OPL3 (or two OPL2 chips for SB Pro 1). For these
cards, MIDIto traps all the Adlib and SB OPL2 ports mentioned above plus the
##### is used to specify number of extra jumps after the port output. OPL2 is
very speed sensitive and you normally start having problems on a 386-33 and
faster systems. Some games are less sensitive than others since some games use
longer delays between port accesses. This also means that if you find a good
delay value for one game, it may not necessarily be enough for some other game.
The extra jumps are implemented by a single LOOP instruction that loops
specified number of times after output to port.
Extra jumps only affect output. For OPL2 there should be a delay of 23us after
data register write and 3.3us after index register write. MIDIto uses full
number of jumps only after output to data ports. 1/8 of extra jumps are used
after output to index port. No extra delay is used for port input.
If number of extra jumps is zero or number is not specified at all, then MIDIto
is set for minimum delay. Only data ports will be trapped without any extra
jumps. Index ports remain untrapped.
-a=off or /a=off will disable ports completely by ignoring outputs. For inputs
FFh is always returned to indicate that nothing was at that port. Disabling OPL
ports is necessary for some games to be forced to CMS/Game Blaster mode. Sound
Blaster DSP can be accessed normally and the card will be detected as a Sound
Blaster and not as a Game Blaster.
-cms or /cms will place Sound Blaster 1.x and 2.0 to a full Game Blaster
emulation mode. It does all the -a=off parameter does but in addition CT-1302
will be emulated. It is a chip on a Game Blaster that is used to detect the
card (since CMS chips are write only and cannot be detected). Some games will
require CT-1302 for CMS sounds. CT-1302 conflicts with Sound Blaster DSP so
Sound Blaster cannot be accessed when Game Blaster emulation mode is enabled.
Some games also require that the Game Blaster is at port 220h. That is not
necessary anymore since MIDIto will always map the virtual Game Blaster to 220h
even if you have a real Game Blaster on another address. This way you can use
real Game Blaster at any address and use Sound Blaster at port 220h without
loss of game compatibility. If you have CMS capable Sound Blaster and a Game
Blaster on a same system, MIDIto will always prefer real Game Blaster.
One more thing to note is that MIDIto will always trap CMS ports (so it can be
relocated to 220h when necessary). Port trapping will always have some delay.
That is likely a good thing since MIDIto requires a 386 and CMS games are
usually made for slower systems.
Some games will require the GBC-CMS.COM (for Game Blaster) or SBC-CMS.COM
(for Sound Blaster) driver. You must use the GBC-CMS.COM since the Sound
Blaster will be detected as a real Game Blaster.
Release 1 - 2021.9.16
* First release
Release 2 - 2021.9.17
* Extended destination port range from 100h-FFEh to 100h-FFFEh
Release 3 - 2021.9.24
* Added support for QEMM 7.03 and later
* Destination MIDI port is now optional
(so it is possible to only trap Adlib ports)
Release 4 - 2021.10.01
* EMM386/QEMM version check now accepts versions with greater major number
but lesser minor number than supported minimum version numbers.
* Adlib delay can now be specified and default value is set to zero. The extra
delay is for Adlib DATA port only. Address/Status port is trapped but
with minimum delay.
* Adlib ports can now be disabled completely
Release 5 - 2021.10.20
* Two (instead of four) OPL ports are now trapped from Adlib address 388h
* Added Sound Blaster and Game Blaster detection
* AUTO and NOEMS parameters are now supported for EMM386
* Adlib zero delay now traps only data ports for as little delay as possible
* Specified Adlib delay is now for output only. Full specified delay is for data ports
and index ports will have 1/8 delay. Inputs do not have extra delay.
* Added -cms command line parameter for full Game Blaster emulation to
maximize CMS compatibility
* Port trapping seems to be slower with QEMM
* EMM386 cannot be set to OFF (Cannot be fixed. Use AUTO parameter instead)
I took the same approach as mt32-pi control program. When there are no errors, there won't be any text output. Things just work silently. You can use the -v parameter to display what MIDIto tries to do. If you execute MIDIto without parameters or unsupported parameter, you get the instructions displayed above.