Reply 100 of 514, by Scali
Thanks for the explanation! 😀
So I assume it's not possible to write a software-based TSR that uses polling method to monitor
a given i/o port and then sends a copy of that data to another location ?
Not without patching the software.
However, for the Tandy sound card we had a similar issue: software assumes the SN76489 chip is at address C0h. Problem is, that is not possible on any AT or newer system, since they have a second DMA controller at that address. So you configure the card to be at a different address, eg 1E0h (which is what later Tandys use for the same reason) or 2C0h.
The solution we created is quite simple:
Whenever software writes to the card, it uses the following instruction:
out C0h, al
We can find all occurences of that instruction, and replace them with:
This instruction is the same size, and differs by only one byte.
Instead of writing to port C0h, it now calls the handler for interrupt C0h.
A simple TSR can install that C0h handler, and write whatever value is in the al-register to the correct address of the card.
OPL2 commands are slightly more complicated in nature, but the basic idea can probably also be applied to OPL2: just patch the proper out-instructions with int instructions, and use a TSR to write to the LPT.
This works on any CPU, 8088 or higher.