Wohlstand / OPL3BankEditor

A small cross-platform editor of the OPL3 FM banks of different formats (Downloads in README below)
GNU General Public License v3.0
143 stars 12 forks source link

Can I use a real YMF724 board by OPL3BankEditor on modern Windows(x64) ? #191

Closed 110-kenichi closed 2 years ago

110-kenichi commented 2 years ago

Can I use a real YMF724 board by OPL3BankEditor on modern Windows(x64) ? If YES, could you please tell me the way to use it ?

Wohlstand commented 2 years ago

Yes, it should work if there is an OPL3-compatible interface available. First off, you need to figure the address of your sound card and then, learn the exact offset of OPL3-compatible chip. At the settings you need to set its address. Recent 64bit build of the thing should work, I added the 64bit variant of the interface driver.

110-kenichi commented 2 years ago

Thank you so much!!!

So... the address of my sound card is 0x40000 ? ( Please see the attached picture. ) And, Do you know how to figure out the exact offset of OPL3 chip ?

image

Wohlstand commented 2 years ago

The address should be at "りそーす"

P.S. Don't worry, I actually learn Japanese, and I understand the rest of written :fox_face:

Wohlstand commented 2 years ago

And, Do you know how to figure out the exact offset of OPL3 chip ?

Need to check out the specification on where the chip is located. If 0x380 offset won't work, then it should be another one (CMedia chips actually has it different). Actually it should be between one of I/O ranges at "りそーす"

110-kenichi commented 2 years ago

Thanks! ありがとうございます! I need to find out the I/O address range from [Resource]... Hmm...

110-kenichi commented 2 years ago

I think that the FM address of my device is 388 or 398 or 3A0 or 3A8 .

image

So, I'd selected "Proxy to the real OPL3" for the chip type and set the hardware address value to both 388 & 398 & 3A0 & 3A8 and loaded sound samples.

However, I can't sound anything... Hmm... Any idea?

How to check inpoutx64.dll is working...

Wohlstand commented 2 years ago

How to check inpoutx64.dll is working...

Try to run the thing as admin for the first time (to let it register all necessary stuff).

EDIT: And ye, the 0x388 means an OFFSET relative to the sound card's address. Your address should be a sum of sound card's address and 0x388

110-kenichi commented 2 years ago

My sound card address is 0xf7500000 ?

image

And also I used the setpci command to query some I/O addresses. The result is here. Hmm...

.\setpci.exe -v -s 08:04.0 CB_LEGACY_MODE_BASE CB_IO_BASE_0 CB_IO_BASE_1 IO_BASE_UPPER16 IO_BASE 0000:08:04.0 @44 = 00041073 0000:08:04.0 @2c = 1073 0000:08:04.0 @34 = 0050 0000:08:04.0 @30 = 0000 0000:08:04.0 @1c = 00

Wohlstand commented 2 years ago

Looks like yes :thinking:

110-kenichi commented 2 years ago

Sorry, where do I input the value 0xf7500000 + 0x388 ?

I can input 4 hex digits onlyt into this dialog box... image

Wohlstand commented 2 years ago

I could try to fix this, but, before, I want to ask some from @nukeykt what he knows about such things

110-kenichi commented 2 years ago

Thanks @Wohlstand -san, @nukeykt -san !

NOTE: I've checked the InpOut API. The port address type was ushort(16bit)...

void outportb(unsigned short PortAddress, unsigned short Data)

void _stdcall Out32(short PortAddress, short data)

Can we access a real OPL chip on x64/x86 windows ? I think the PCI BAR is 32bit.

It seems the InpOut driver has the following APIs.

void _stdcall DlPortWritePortUchar(USHORT port, UCHAR Value); void _stdcall DlPortWritePortUshort(USHORT port, USHORT Value); void _stdcall DlPortWritePortUlong(ULONG port, ULONG Value);

EDIT: InpOut32 driver does not support DlPortWritePortUlong ... image

110-kenichi commented 2 years ago

Hmm. WinRing0 works on Win10(x64) to write/read data from IO ?

AutoHotKey uses WinRing0 to do that. https://www.autohotkey.com/boards/viewtopic.php?f=6&t=9009&sid=d8bb6f2585cb75aafee9a6751212d3cd&start=20

110-kenichi commented 2 years ago

I'll close it for now. ( I will investigation... )

110-kenichi commented 2 years ago

Thanks all. @Wohlstand

I could write a custom device driver for CMI8738(OPL3) for Windows11(x64) to sound OPL3. If you would like to use my driver, please grab it here. https://github.com/110-kenichi/mame/tree/master/src/CMI8738OPL3

And, I would like to support YMF724 card, too. But, it is so hard...