OPL2LPT

Discussion about old sound cards, MIDI devices and sound related accessories.

Re: OPL2LPT

Postby Scali » 2017-11-02 @ 11:24

Jo22 wrote: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:
int C0h

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.
Scali
l33t
 
Posts: 3545
Joined: 2014-12-13 @ 14:24

Re: OPL2LPT

Postby dreamblaster » 2017-11-02 @ 12:19

konc wrote:5?

hehe no, sorry
I gave E hint already
now I give a hextra hint
Visit http://www.serdashop.com for retro sound cards, MIDI PCB's, and video converters
OPL2LPT, OPL3LPT, X2, S2, S2P, MCE2VGA, ... many projects ! Have a look, and thanks for your support !
dreamblaster
Oldbie
 
Posts: 603
Joined: 2015-1-18 @ 19:34
Location: Belgium

Re: OPL2LPT

Postby Malvineous » 2017-11-02 @ 12:21

Jo22 wrote:I believe there's at least one "USB to LPT" project that aims to provide a true parallel port.

Converter From USB To Parallel
https://www-user.tu-chemnitz.de/~heha/b ... C/USB2LPT/

You can get cheap USB to Parallel converters on eBay using the PL-2305 chipset which has been available for many years. This chipset has a special mode it can be switched into which allows pin-level control of most of the pins. Last I looked (5+ years ago) there were no drivers that did this, but all it needs is for someone to write one. It's probably the cheapest way to get a full Parallel port connected via USB.

dreamblaster wrote:none of these
I give E hint

I take that to mean 14? What a shame I'm in Australia :)

By the way, where are you sourcing the OPL chips and DACs from?
User avatar
Malvineous
Oldbie
 
Posts: 549
Joined: 2006-6-11 @ 02:24
Location: Brisbane, Australia

Re: OPL2LPT

Postby dreamblaster » 2017-11-02 @ 13:07

Malvineous wrote: I take that to mean 14? What a shame I'm in Australia

Hehe yeah, you are right, but so sorry - only for EU - I'd love quick feedback.
Well no more guessing, first EU solderer that answers gets it.

Malvineous wrote: By the way, where are you sourcing the OPL chips and DACs from?

https://www.utsource.net/
Visit http://www.serdashop.com for retro sound cards, MIDI PCB's, and video converters
OPL2LPT, OPL3LPT, X2, S2, S2P, MCE2VGA, ... many projects ! Have a look, and thanks for your support !
dreamblaster
Oldbie
 
Posts: 603
Joined: 2015-1-18 @ 19:34
Location: Belgium

Re: OPL2LPT

Postby killerclems » 2017-11-02 @ 13:14

Im a french solderer ;)
killerclems
Newbie
 
Posts: 3
Joined: 2017-4-14 @ 13:49

Re: OPL2LPT

Postby dreamblaster » 2017-11-02 @ 13:36

killerclems wrote:Im a french solderer ;)

hehe
and can you type quatorze in numbers ?
Then the kit is yours :-)
pm me your address, also
Visit http://www.serdashop.com for retro sound cards, MIDI PCB's, and video converters
OPL2LPT, OPL3LPT, X2, S2, S2P, MCE2VGA, ... many projects ! Have a look, and thanks for your support !
dreamblaster
Oldbie
 
Posts: 603
Joined: 2015-1-18 @ 19:34
Location: Belgium

Re: OPL2LPT

Postby killerclems » 2017-11-02 @ 13:46

14 ! ;)
killerclems
Newbie
 
Posts: 3
Joined: 2017-4-14 @ 13:49

Re: OPL2LPT

Postby dreamblaster » 2017-11-02 @ 14:11

killerclems wrote:14 ! ;)

oh, we have a winner !
Send me a pm with your shipping address, i will send you an opl2lpt KIT right away.
Visit http://www.serdashop.com for retro sound cards, MIDI PCB's, and video converters
OPL2LPT, OPL3LPT, X2, S2, S2P, MCE2VGA, ... many projects ! Have a look, and thanks for your support !
dreamblaster
Oldbie
 
Posts: 603
Joined: 2015-1-18 @ 19:34
Location: Belgium

Re: OPL2LPT

Postby dreamblaster » 2017-11-02 @ 16:45

Okay
I uploaded the soldering instructions and DOS utilities here : http://serdaco.com/downloads/OPL2LPT/
Visit http://www.serdashop.com for retro sound cards, MIDI PCB's, and video converters
OPL2LPT, OPL3LPT, X2, S2, S2P, MCE2VGA, ... many projects ! Have a look, and thanks for your support !
dreamblaster
Oldbie
 
Posts: 603
Joined: 2015-1-18 @ 19:34
Location: Belgium

Re: OPL2LPT

Postby matze79 » 2017-11-04 @ 10:33

hehe today i will build your device,
does the tsr work together with win 3.x adlib driver ? :D

btw. where the hell can i purchase OPL2 IC's ? looking for ages to build a adlib isa clone :O
matze79
Oldbie
 
Posts: 1123
Joined: 2014-12-12 @ 14:25
Location: Germany, Frankonia

Re: OPL2LPT

Postby Scali » 2017-11-04 @ 11:00

matze79 wrote:btw. where the hell can i purchase OPL2 IC's ?


https://www.utsource.net/itm/p/816077.html
https://www.utsource.net/itm/p/1714079.html (the DAC you need, YM3812 only outputs digital audio)
Scali
l33t
 
Posts: 3545
Joined: 2014-12-13 @ 14:24

Re: OPL2LPT

Postby matze79 » 2017-11-04 @ 13:15

Thanks Scali :D

I build it :) and it actually works very well.
The 386SX 33Mhz Laptop is a bit too slow for running wolf3d with lpt adlib :)

Windows 3.x does not work with the Adlib Driver :/ maybe there is some driver in place which also access lpt ?

Merci beaucoup :)

i really enjoy this!

Can you tell me what the TSR exactly does ?
Some Games can be patched to work native with LPT2OPL..
Maybe Wolfenstein 3D, its source is avaible as far as i remember :D
matze79
Oldbie
 
Posts: 1123
Joined: 2014-12-12 @ 14:25
Location: Germany, Frankonia

Re: OPL2LPT

Postby pdw » 2017-11-04 @ 21:40

Lots of questions :)

Technique: The TSR uses the "I/O port virtualization" feature of EMM386 & QEMM. This allows a TSR to emulate I/O port accesses. I don't know why this feature was originally designed but it's exactly what's needed to emulate an Adlib card. For programming information, see here (yeah, there's minimal documentation online).

Performance: This emulation does come with a cost. Unfortunately this is pretty much all EMM386 overhead, so there's little that can be done. One possibility is using JEMM, an alternative to EMM386 that's quite a bit faster. This should help games which play almost-but-not-quite fast enough when using EMM386. A version of the TSR that works with JEMM is nearly done.

Windows support: I think the TSR might work with Windows 3.x if you run Windows in "Standard Mode" (i.e. 286-compatible mode) using the command "WIN /S". But it won't work in the normal "386 Enhanced Mode". In general the TSR won't work with protected mode software.

Writing a Windows driver might be possible. I believe Microsoft released their Adlib driver as sample code in the Windows 3.1 Multimedia SDK. But 16-bit Windows driver development is a pretty arcane subject...

Wolfenstein: I've found this article and I'll attempt to build a OPT2LPT version :)
I fear patching in general might be tricky... I haven't investigated it yet.
pdw
Newbie
 
Posts: 33
Joined: 2016-12-26 @ 18:45

Re: OPL2LPT

Postby matze79 » 2017-11-05 @ 07:14

Simply redirecting Port will not work ?
Status Lines are used for WR and other Stuff ?
So the TSR does more then just redirection of port access.

yeah impact of performance can easily seen in games like wolf3d on slow cpu's :)
also hocus pocus is getting a performance penalty.

i will try win 3.x standard mode :) and report.
i don't think win 3.x can enter std mode with being already in vm86 mode ?

hopefully i don't write senseless stuff, my grammars are horrible.
matze79
Oldbie
 
Posts: 1123
Joined: 2014-12-12 @ 14:25
Location: Germany, Frankonia

Re: OPL2LPT

Postby Scali » 2017-11-05 @ 11:14

matze79 wrote:Simply redirecting Port will not work ?
Status Lines are used for WR and other Stuff ?
So the TSR does more then just redirection of port access.


The OPL2 chip has two ports:
388h is the index port
389h is the data port

Any register write is done by first writing the index of the register to 388h, and then writing the byte of data for that register to 389h.
Since the printer port is just a single 8-bit port, you would need some way to differentiate between the two ports on the OPL2.
I suppose one of the status lines controls this.

If you would want to do an OPL3 version, it has two pairs of index and data ports, so 4 ports in total.
Doable, but would require another status line for selecting.
Scali
l33t
 
Posts: 3545
Joined: 2014-12-13 @ 14:24

Re: OPL2LPT

Postby Jepael » 2017-11-05 @ 19:23

Scali wrote:
matze79 wrote:Simply redirecting Port will not work ?
Status Lines are used for WR and other Stuff ?
So the TSR does more then just redirection of port access.


The OPL2 chip has two ports:
388h is the index port
389h is the data port

Any register write is done by first writing the index of the register to 388h, and then writing the byte of data for that register to 389h.
Since the printer port is just a single 8-bit port, you would need some way to differentiate between the two ports on the OPL2.
I suppose one of the status lines controls this.


Exactly. So each time the game writes to index/data port, the trap is run, and that amounts to 4 writes to LPT port.
First, the LPT control port is written to select address bit to select either index or data write to OPL2.
Second, the LPT control port is written to enable writing, by setting OPL2 write pin low.
Third, the LPT data port is written to set OPL2 data bus with correct data.
Fourth, the LPT control port is written to terminate the write cycle, by setting OPL2 write pin high.

If you are wondering why 3 writes is not enough, well, it may or may not be. The address bit needs to be correct and stable for some time before setting write pin low (and during the whole write cycle), and the data pins must be correct and stable for some time before setting write pin high. If it can be guaranteed with hardware such as RC filter that even if address and write pins are written at the same time, the write will be delayed enough so it works.

Scali wrote:If you would want to do an OPL3 version, it has two pairs of index and data ports, so 4 ports in total.
Doable, but would require another status line for selecting.


Yes, it needs one more address bit to select if you are writing to the high or low bank when writing the index port, but there's only one data port, as the chip does not care if you are writing to high or low data port. That might enable some new hardware features if someone wants to do an OPL3 version, as the chip can be used with three ports, so one is free for something else.
Jepael
Oldbie
 
Posts: 1195
Joined: 2005-6-15 @ 19:28
Location: Finland

Re: OPL2LPT

Postby matze79 » 2017-11-06 @ 14:22

nice so miles soundsystem driver can be hacked to run nativ without tsr also.
too bad i'm not a good programmer at all :/

Its Opensource now:
http://www.ke5fx.com/
Download Link:
http://www.thegleam.com/ke5fx/misc/AIL2.ZIP

i tested the OPL2LPT now on modern Machines with lpt and it also works here very well :)
For Slow Machines the DSS is still a better choice. 7khz Output has less impact on Performance.
matze79
Oldbie
 
Posts: 1123
Joined: 2014-12-12 @ 14:25
Location: Germany, Frankonia

Re: OPL2LPT

Postby dr.zeissler » 2017-11-06 @ 15:17

But DSS means "Digisound only", OPL2LPT means FM-Music and no Digisound, two complete different things, or am I wrong here?

Greetings
Doc
CPU: PII 133-333 MOBO: SNI-D981 RAM: 512- FDD: Dualfloppy 3,5"HD/5,25"HD - 3,5"HD - 5,25"DD ISA-Catweasel HDD: 2x40GB - DVD
ISA(3): Audician32-S2Dreamblaster - GusACE PCI(3): Monster3D- Intel NW AGP(1): 3dfx V3-3000
dr.zeissler
Oldbie
 
Posts: 1432
Joined: 2011-9-28 @ 15:33

Re: OPL2LPT

Postby dr.zeissler » 2017-11-06 @ 15:19

OPL2LPT would be a "killer-feature" for my HP-NX6125 Laptop. With it, I could play lots of very old games that support adlib.
The problem is, I would have to choose if I put the covox in to have digi-sound and "tandy-emulation" or to have fm-music
with the opl2lpt.
CPU: PII 133-333 MOBO: SNI-D981 RAM: 512- FDD: Dualfloppy 3,5"HD/5,25"HD - 3,5"HD - 5,25"DD ISA-Catweasel HDD: 2x40GB - DVD
ISA(3): Audician32-S2Dreamblaster - GusACE PCI(3): Monster3D- Intel NW AGP(1): 3dfx V3-3000
dr.zeissler
Oldbie
 
Posts: 1432
Joined: 2011-9-28 @ 15:33

Re: OPL2LPT

Postby Scali » 2017-11-06 @ 15:59

dr.zeissler wrote:But DSS means "Digisound only", OPL2LPT means FM-Music and no Digisound, two complete different things, or am I wrong here?


Yes... however...
There is a trick to make OPL2 play digital samples as well.
Some games use this (I believe Supaplex is one).
In theory you could create a TSR that simulates Covox and DSS through an OPL2LPT.
Scali
l33t
 
Posts: 3545
Joined: 2014-12-13 @ 14:24

PreviousNext

Return to Sound

Who is online

Users browsing this forum: No registered users and 2 guests