bjt42 / softmpu

An MPU-401 emulation TSR for DOS
http://bjt42.github.io/softmpu/
GNU General Public License v2.0
103 stars 15 forks source link

Feature Request: Add support for the port trapping API that was recently introduced in HDPMI32i #31

Open hjnijlunsing opened 10 months ago

hjnijlunsing commented 10 months ago

Add support for the port trapping API that was recently introduced in HDPMI32i (part of the HX project), so SoftMPU can also work with protected mode games.

This is a split of this Feature Request: https://github.com/bjt42/softmpu/issues/30

Thanks volkertb for the clarifications.

bjt42 commented 9 months ago

Hi, thanks for opening this issue, I've been catching up on the discussion so far.

My understanding is that the motivation behind adding HDMPI32i port trapping support to SoftMPU would be to support protected-mode games. To my knowledge, there aren't any protected mode games that require SoftMPU's 'Intelligent Mode' emulation. Therefore, I believe the use-case is more specifically to support MIDI redirection (serial port or otherwise) for protected-mode game, as a way of achieving MIDI output on machines without hardware MIDI ports.

While SoftMPU does support MIDI redirection, it's very much an adjunct to the core 'Intelligent Mode' functionality. Furthermore, MIDI redirection is a relatively straightforward case of capturing output to the MPU I/O ports and outputting it instead to the serial port.

SoftMPU also does some fairly hairy things to support 'Intelligent Mode' emulation (for example, reprogramming the RTC, writing to the GDT from within the port trap handler) that while well-tolerated by EMM386/QEMM/possibly JEMM, and the smaller set of older real-mode games requiring 'Intelligent Mode', are likely to reduce compatibility in the general sense. For this reason I regard SoftMPU as a 'load only when needed' proposition.

To summarise, if the specific requirement is for MIDI redirection for PM games, I feel there is a strong case for implementing that in a new, more compatible TSR, likely leveraging HDPMI32i (from what I have read about it).

volkertb commented 9 months ago

Interesting to read how the Intelligent Mode emulation adds such complexity that it is "likely to reduce compatibility in the general sense". It makes sense, although it would be much more convenient to have a single emulator (or redirector) that would support any MPU-401 mode (Intelligent Mode, Interrupt-driven, UART) transparently and with equal accuracy.

On the other hand, it might not be that big a deal to have the more complicated Intelligent Mode emulator loaded in a batch file in the few games that explicitly need such compatibility.

By the way, don't underestimate how many people use SoftMPU for its MPU-401 to serial port redirection functionality, even if they don't necessarily need Intelligent Mode compatibility in the games that they play. A lot of us find it a fun challenge to get DOS games to run (mostly) natively on modern hardware that isn't supposed to be able to run them, let alone with full sound support. :grin:

hjnijlunsing commented 8 months ago

Related post: https://github.com/crazii/SBEMU/issues/40#issuecomment-1938758360