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. And last but not least MIDIto can lock Sound Blaster Pro and 16 mixer so games cannot mess with volumes and inputs.
How to use MIDIto? I tried to make things as simple as possible:
MIDIto TSR - Release 7 - 2021.11.25
(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.
Lock Sound Blaster Pro/16 mixer against unwanted changes.
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
-lock or /lock: Lock Sound Blaster Pro/16 mixer. See readme for more info
-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.
-lock or /lock will lock Sound Blaster Pro and 16 mixer to prevent unwanted
changes. Some games modify volumes and even disables inputs and leaves them
like that after game quits. These modified volumes might even cause clipping so
it affect the audio quality as well. Mixer locking will fix these issues.
By default, master, CD, Line In, MIC and PC-speaker (SB16 PC-speaker input)
are locked to whatever levels they happen to be when you start MIDIto.
Voice (DAC) and FM/MIDI volumes are not locked by default since games might use
those for effects (like stereo sound in Wolfenstein 3D).
MIDIto stores all mixer values during initialization and unlocked mixer values
are restored when game does mixer reset (normally that would restore hardware
defaults) or game exits. The latter is important since locking will not work
for protected mode games but mixer values can be restored after protected mode
You can customize what is locked with -lock=XX,YY,ZZ. Just separate locks with
commas and you can speficy as many as you need. For example -lock=MA,LI,LPE
would lock MAster volume, LIne in volume and force Low Pass filter Enabled.
Here are all the locks:
DEF Sets all default locks (MA, CD, LI, MIC, SP)
MA Locks MAster Volume
VO Locks VOice (DAC)
MI Locks MIdi volume (same as FM)
FM Locks FM volume (same as MI)
CD Locks CD volume
LI Locks Line In volume
MIC Locks MICrophone volume
SP Locks pc SPeaker volume (SB16 PC speaker input)
LPE Forces output Low Pass filter Enabled (only on Sound Blaster Pro)
LPD Forces output Low Pass filter Disabled (only on Sound Blaster Pro)
YMF Enables Yamaha YMF71x Master Volume fix
Low Pass Filter is not available on Sound Blaster 16/32/AWE cards. It is also
not available on some SB Pro compatibles but some do have it.
FM and MI are the same since that is how it is implemented on Sound Blaster 16:
FM volume and Waveblaster MIDI shares the same volume control. In some future
release of MIDIto that can be separated. Since games either use MIDI or FM,
it would be possible to set one volume when midi port (defined by SET BLASTER
P3xx) is accessed and switch to other volume level when FM port is accessed.
YMF enables fix for Yamaha YMF71x based cards. It's unknown if all YMF71x chips
require this fix but some have hardware bug where setting SB Pro master volume
to anything above 1 breaks volume controls. You can't hear stereo sounds on
Wolfenstein 3D for example. YMF-lock locks SB Master volume to 1 and redirects
SB master volume control to master volume available on YMF71x control ports.
This way you can have working volume controls. YMF-lock alone won't lock volume
controls. It justs sets the fix by hiding the problematic real SB master volume
control. If you also want to lock the controls, just specify the locks you want
or use "-lock=YMF, DEF" to set up default locks.
By default the YMF-fix uses control port 370h that is the default. If you have
set the control port to another address, you need to set R### to the end of
SET BLASTER string on autoexec.bat. This is the Unisound way to set the control
port so if you use Unisound to initialize the card, then nothing needs to be
done. For example to set the control port to 380h, make sure SET BLASTER string
Release 7 - 2021.11.26
* Fixed some uninstall error strings that were not correctly displayed
* Added mixer lock to fix Yamaha YMF71x SB Pro Master Volume control
* Fixes mixer locking for Star Trek: Judgment Rites by returning last written
MIC volume so MIC volume appears to be unlocked (but it is really locked).
Release 6 - 2021.11.19
* Optimizations to reduce TSR size, especially for QEMM
* MIDIto now automatically uninstalls if you try to reinstall with new options
* QEMM handler for Adlib delay with extra jumps no longer corrupt AH register.
That was the cause why QEMM was slower than EMM386 on Wolfenstein 3D.
* Added -lock command line parameter for Sound Blaster Pro and 16 mixer locking
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
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 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 2 - 2021.9.17
* Extended destination port range from 100h-FFEh to 100h-FFFEh
Release 1 - 2021.9.16
* First release
* EMM386 cannot be set to OFF (Cannot be fixed. Use AUTO parameter instead)
* Loading MIDIto can fail if VIDE-CDD.SYS CD-ROM driver is used. Reason
unknown. Likely does not affect every system.
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.