OPL3 Progress

synthop
Core Developer
Posts: 18
Joined: Fri Apr 05, 2024 12:23 pm
Has thanked: 5 times
Been thanked: 53 times

Re: OPL3 Progress

Unread post by synthop »

Sure, I'm AFK this weekend but early next week I'll upload a build.

synthop
Core Developer
Posts: 18
Joined: Fri Apr 05, 2024 12:23 pm
Has thanked: 5 times
Been thanked: 53 times

Re: OPL3 Progress

Unread post by synthop »

I've added https://github.com/gtaylormb/ao486_MiST ... 240405.rbf.

I should get my board tomorrow, fingers crossed. In the meantime I've gotten the resources down another 25% or so, that's not in the PR yet though. Still some room for improvement.

synthop
Core Developer
Posts: 18
Joined: Fri Apr 05, 2024 12:23 pm
Has thanked: 5 times
Been thanked: 53 times

Re: OPL3 Progress

Unread post by synthop »

Last build was pretty broken. New build: https://github.com/gtaylormb/ao486_MiST ... 240410.rbf

Changes required for Quartus 17 were backported into my original opl3_fpga project and tested on my Zybo board so I have better confidence now.

Interestingly, Altera's Cyclone V does not contain 0-cycle LUT RAM (distributed RAM) that is present on the Xilinx 7-series, so a lot of the optimizations I've made for area on Xilinx did not translate over. I suspect if I add a cycle to the read ports these RAMs will be inferred in BRAM on the Cyclone V and greatly reduce the area, but it's is going to take a significant amount of time to update the design to work this way.

I literally just received my DE-10 Nano board so when I find the time I'll verify/debug. In the meantime let me know how the build works.

synthop
Core Developer
Posts: 18
Joined: Fri Apr 05, 2024 12:23 pm
Has thanked: 5 times
Been thanked: 53 times

Re: OPL3 Progress

Unread post by synthop »

Well it didn't take that much time really, heh. I got the ALMs to within 1% of the total with the NextZ80CPU implementation. It's now only using 199 more ALMs but 35 less block RAMs, so I'd say that's a win.

Of course I still need to try it out to see if it works in the MiSTer. The core is well tested on my Zybo board but there could be some interfacing issues depending on how the address/data bus operates. The writes need to be synchronized to a slower clock domain, so that's the likeliest point of failure. If it's broken I can replace the handshaking with a FIFO.

User avatar
remax
Posts: 32
Joined: Sun Nov 21, 2021 8:24 pm
Has thanked: 12 times
Been thanked: 13 times

Re: OPL3 Progress

Unread post by remax »

Adlib tracker II G3 : http://www.adlibtracker.net/downloads.php

crash at launch

I have also some OPL3 utilities from a thread on vogons : https://www.vogons.org/viewtopic.php?t=55181

Unisound detects a SB16 with DSP 4.05

OPL_ID returns

Code: Select all

Chip Type : None

OPLCLONE returns

Code: Select all

OPL is not detected

OPLTEST from OPLDUMP returns

Code: Select all

OPL Detect status = 00 -> 00
OPL detect : FAIL
Chip is likely to be an OPL3
single OPL2 is decoded at both 388 and 38A
Chip Type : OPL3
OPL REG4 read : FF FF FF
OPL Timer retriggered

Here is also a thread with verified OPL3 games. I'll try to test them later : https://www.vogons.org/viewtopic.php?f=62&t=96649

jordi
Posts: 282
Joined: Thu Jun 11, 2020 10:11 am
Has thanked: 112 times
Been thanked: 87 times

Re: OPL3 Progress

Unread post by jordi »

remax wrote: Thu Apr 11, 2024 1:31 pm

Adlib tracker II G3 : http://www.adlibtracker.net/downloads.php

crash at launch

I have also some OPL3 utilities from a thread on vogons : https://www.vogons.org/viewtopic.php?t=55181

Unisound detects a SB16 with DSP 4.05

OPL_ID returns

Code: Select all

Chip Type : None

OPLCLONE returns

Code: Select all

OPL is not detected

OPLTEST from OPLDUMP returns

Code: Select all

OPL Detect status = 00 -> 00
OPL detect : FAIL
Chip is likely to be an OPL3
single OPL2 is decoded at both 388 and 38A
Chip Type : OPL3
OPL REG4 read : FF FF FF
OPL Timer retriggered

Here is also a thread with verified OPL3 games. I'll try to test them later : https://www.vogons.org/viewtopic.php?f=62&t=96649

more over here
https://github.com/dosbox-staging/dosbo ... OPL2-games

synthop
Core Developer
Posts: 18
Joined: Fri Apr 05, 2024 12:23 pm
Has thanked: 5 times
Been thanked: 53 times

Re: OPL3 Progress

Unread post by synthop »

Thanks @jordi, that stuff was useful. I've made a bunch of fixes to the host interface and timers. Oplclone is now passing and generating a sine wave. Day of the Tentacle works and sounds great! Doom does not--just silence. I suspect there's something going on with the OPL detection in that game. Looks like there's some code in master that fires off the timer overflows if 20 reads has occurred since the last write to the timer flag register. I assume that has something to do with tricking OPL detection. I'll try that next.

My latest release is at https://github.com/gtaylormb/ao486_MiST ... 240412.rbf

flynnsbit
Top Contributor
Posts: 552
Joined: Sun May 24, 2020 8:07 pm
Has thanked: 185 times
Been thanked: 310 times
Contact:

Re: OPL3 Progress

Unread post by flynnsbit »

synthop wrote: Fri Apr 12, 2024 7:26 pm

Thanks @jordi, that stuff was useful. I've made a bunch of fixes to the host interface and timers. Oplclone is now passing and generating a sine wave. Day of the Tentacle works and sounds great! Doom does not--just silence. I suspect there's something going on with the OPL detection in that game. Looks like there's some code in master that fires off the timer overflows if 20 reads has occurred since the last write to the timer flag register. I assume that has something to do with tricking OPL detection. I'll try that next.

My latest release is at https://github.com/gtaylormb/ao486_MiST ... 240412.rbf

This build has a video artifact problem compared to yesterdays for me. Anyone else? The builds before didn't do this.

IMG_1330.gif
IMG_1330.gif (3.36 MiB) Viewed 8809 times
jordi
Posts: 282
Joined: Thu Jun 11, 2020 10:11 am
Has thanked: 112 times
Been thanked: 87 times

Re: OPL3 Progress

Unread post by jordi »

flynnsbit wrote: Fri Apr 12, 2024 9:04 pm
synthop wrote: Fri Apr 12, 2024 7:26 pm

Thanks @jordi, that stuff was useful. I've made a bunch of fixes to the host interface and timers. Oplclone is now passing and generating a sine wave. Day of the Tentacle works and sounds great! Doom does not--just silence. I suspect there's something going on with the OPL detection in that game. Looks like there's some code in master that fires off the timer overflows if 20 reads has occurred since the last write to the timer flag register. I assume that has something to do with tricking OPL detection. I'll try that next.

My latest release is at https://github.com/gtaylormb/ao486_MiST ... 240412.rbf

This build has a video artifact problem compared to yesterdays for me. Anyone else? The builds before didn't do this.IMG_1330.gif

Yes, I got same issue.

jordi
Posts: 282
Joined: Thu Jun 11, 2020 10:11 am
Has thanked: 112 times
Been thanked: 87 times

Re: OPL3 Progress

Unread post by jordi »

synthop wrote: Fri Apr 12, 2024 7:26 pm

Thanks @jordi, that stuff was useful. I've made a bunch of fixes to the host interface and timers. Oplclone is now passing and generating a sine wave. Day of the Tentacle works and sounds great! Doom does not--just silence. I suspect there's something going on with the OPL detection in that game. Looks like there's some code in master that fires off the timer overflows if 20 reads has occurred since the last write to the timer flag register. I assume that has something to do with tricking OPL detection. I'll try that next.

My latest release is at https://github.com/gtaylormb/ao486_MiST ... 240412.rbf

Incredible, hats off.

synthop
Core Developer
Posts: 18
Joined: Fri Apr 05, 2024 12:23 pm
Has thanked: 5 times
Been thanked: 53 times

Re: OPL3 Progress

Unread post by synthop »

flynnsbit wrote: Fri Apr 12, 2024 9:04 pm

This build has a video artifact problem compared to yesterdays for me. Anyone else? The builds before didn't do this.IMG_1330.gif

This might have something to do with the build failing timing, but the failure is present in master as well. My last build just failed by a larger amount. Timing can vary from build to build, it's pretty random.

Master:

Code: Select all

Critical Warning (332148): Timing requirements not met
    Info (11105): For recommendations on closing timing, run Report Timing Closure Recommendations in the TimeQuest Timing Analyzer.
Info (332146): Worst-case setup slack is -5.396
    Info (332119):     Slack       End Point TNS Clock 
    Info (332119): ========= =================== =====================
    Info (332119):    -5.396          -18607.176 emu|pll|pll_inst|altera_pll_i|cyclonev_pll|counter[0].output_counter|divclk 
    Info (332119):     0.463               0.000 pll_hdmi|pll_hdmi_inst|altera_pll_i|cyclonev_pll|counter[0].output_counter|divclk 
    Info (332119):     0.673               0.000 emu|pll|pll_inst|altera_pll_i|cyclonev_pll|counter[4].output_counter|divclk 
    Info (332119):     3.541               0.000 FPGA_CLK2_50 
    Info (332119):     3.583               0.000 emu|pll|pll_inst|altera_pll_i|cyclonev_pll|counter[3].output_counter|divclk 
    Info (332119):     5.315               0.000 spi_sck 
    Info (332119):     8.053               0.000 FPGA_CLK1_50 
    Info (332119):     9.522               0.000 emu|pll|pll_inst|altera_pll_i|cyclonev_pll|counter[1].output_counter|divclk 
    Info (332119):    14.661               0.000 pll_audio|pll_audio_inst|altera_pll_i|general[0].gpll~PLL_OUTPUT_COUNTER|divclk 
    Info (332119):   326.606               0.000 emu|pll|pll_inst|altera_pll_i|cyclonev_pll|counter[2].output_counter|divclk 
    Info (332119):   535.424               0.000 emu|pll|pll_inst|altera_pll_i|cyclonev_pll|counter[5].output_counter|divclk 

ao486_20240412.rbf:

Code: Select all

Critical Warning (332148): Timing requirements not met
    Info (11105): For recommendations on closing timing, run Report Timing Closure Recommendations in the TimeQuest Timing Analyzer.
Info (332146): Worst-case setup slack is -6.128
    Info (332119):     Slack       End Point TNS Clock 
    Info (332119): ========= =================== =====================
    Info (332119):    -6.128          -19127.459 emu|pll|pll_inst|altera_pll_i|cyclonev_pll|counter[0].output_counter|divclk 
    Info (332119):     0.286               0.000 pll_hdmi|pll_hdmi_inst|altera_pll_i|cyclonev_pll|counter[0].output_counter|divclk 
    Info (332119):     0.491               0.000 emu|pll|pll_inst|altera_pll_i|cyclonev_pll|counter[4].output_counter|divclk 
    Info (332119):     3.799               0.000 emu|pll|pll_inst|altera_pll_i|cyclonev_pll|counter[3].output_counter|divclk 
    Info (332119):     3.823               0.000 FPGA_CLK2_50 
    Info (332119):     4.985               0.000 spi_sck 
    Info (332119):     6.849               0.000 FPGA_CLK1_50 
    Info (332119):     9.949               0.000 emu|pll|pll_inst|altera_pll_i|cyclonev_pll|counter[1].output_counter|divclk 
    Info (332119):    14.624               0.000 pll_audio|pll_audio_inst|altera_pll_i|general[0].gpll~PLL_OUTPUT_COUNTER|divclk 
    Info (332119):   326.560               0.000 emu|pll|pll_inst|altera_pll_i|cyclonev_pll|counter[2].output_counter|divclk 
    Info (332119):   525.254               0.000 emu|pll|pll_inst|altera_pll_i|cyclonev_pll|counter[5].output_counter|divclk 

There also might be missing and/or incorrect timing constraints. I probably need to discuss with @sorgelig. I might be able to help out there.

synthop
Core Developer
Posts: 18
Joined: Fri Apr 05, 2024 12:23 pm
Has thanked: 5 times
Been thanked: 53 times

Re: OPL3 Progress

Unread post by synthop »

The logic to fake out the detection scheme worked. Doom now has music. The visual artifacts also seem to be gone. Let me know what you guys think! And if you encounter any issues of course.

I just replaced the previous .rbf with the new one: https://github.com/gtaylormb/ao486_MiST ... 240412.rbf

I'm going to polish up the PR and hopefully we can get this merged soon!

jordi
Posts: 282
Joined: Thu Jun 11, 2020 10:11 am
Has thanked: 112 times
Been thanked: 87 times

Re: OPL3 Progress

Unread post by jordi »

Duke is back!!

https://youtu.be/cLBNbIpcfMs?si=KkLXQGqSJHOZQqnh

Also tried doom2 in opl3 mode, so nice

synthop
Core Developer
Posts: 18
Joined: Fri Apr 05, 2024 12:23 pm
Has thanked: 5 times
Been thanked: 53 times

Re: OPL3 Progress

Unread post by synthop »

There's still some minor tweaks I want to do, some straight forward easy stuff. The OPl3 volume vs the DSP volume is very low, too low in my opinion. In Doom I have to lower the DSP volume all the way down and raise the music volume all the way up to really hear it. There is also a loss of fidelity/precision/noise added along the audio pipeline external to the OPL3 as sound outputs from various sources are added together and re-clamped to 16-bits multiple times; normally these are combined in the analog domain so this would not be present on a real card. But this is fairly minor unless you're an audiophile. There also appears to be an incorrect clock domain crossing from the CPU clock to the audio clock which would result in bad samples, maybe too few to notice.

Possibly some instruments sound weird to me. This one will be trickier, because I'm just going off memory, and finding where the discrepancies are and how to fix them is hard. I need actual comparisons vs. a real OPL3. This will probably have to pushed down the road.

I only just got my DE-10 Nano so I haven't had a chance to compare vs. the old implementation. If this is an improvement that's great! ALM usage is about 1% above the old total and we free up a bunch of BRAMs, so shouldn't be any issue with area.

HarborSeal
Posts: 51
Joined: Sun Jul 12, 2020 6:54 am
Has thanked: 42 times
Been thanked: 16 times

Re: OPL3 Progress

Unread post by HarborSeal »

OPl3 stereo music isn't working in Doom for me. I entered the SET DMXOPTION=-opl3 -phase command before starting the game, but no luck.

OPL3 stereo does work in Dark Forces.

jordi
Posts: 282
Joined: Thu Jun 11, 2020 10:11 am
Has thanked: 112 times
Been thanked: 87 times

Re: OPL3 Progress

Unread post by jordi »

Repeating my post from Github

https://github.com/MiSTer-devel/ao486_M ... /sound.zip

  • duke2.mp3 is the new core
  • duke2_old.mp3 is the old (current release) of the core.

New one (from the new code) sounds cleaner and more 'punchy' on bass, also for me is more pleasant.

Someone said that some notes are missing on new one (0:58), but I don't hear it, and it might happen on a real opl.

synthop
Core Developer
Posts: 18
Joined: Fri Apr 05, 2024 12:23 pm
Has thanked: 5 times
Been thanked: 53 times

Re: OPL3 Progress

Unread post by synthop »

HarborSeal wrote: Mon Apr 15, 2024 7:33 pm

OPl3 stereo music isn't working in Doom for me. I entered the SET DMXOPTION=-opl3 -phase command before starting the game, but no luck.

OPL3 stereo does work in Dark Forces.

I'm also seeing the same thing in Doom. It must be doing some additional detection scheme that we need to fake out. I suspect DosBox has implemented this; might be worth looking through their code.

Edit: Stereo works in the FastDoom port variants, but these have really crappy OPL3 instrumentation (i.e. they sound fucking weird) so I don't recommend. Will try to fix as Doom is one of my favs. Might have to sniff the traffic on the bus to figure out what it's trying to detect.

synthop
Core Developer
Posts: 18
Joined: Fri Apr 05, 2024 12:23 pm
Has thanked: 5 times
Been thanked: 53 times

Re: OPL3 Progress

Unread post by synthop »

New build at https://github.com/gtaylormb/ao486_MiST ... 240418.rbf

Fixed 4-channel operators, carrying full 16-bit precision through to the DAC, running at real OPL3 clock frequency of 14.31818MHz.

synthop
Core Developer
Posts: 18
Joined: Fri Apr 05, 2024 12:23 pm
Has thanked: 5 times
Been thanked: 53 times

Re: OPL3 Progress

Unread post by synthop »

jordi wrote: Tue Apr 16, 2024 1:17 pm

Repeating my post from Github

https://github.com/MiSTer-devel/ao486_M ... /sound.zip

  • duke2.mp3 is the new core
  • duke2_old.mp3 is the old (current release) of the core.

New one (from the new code) sounds cleaner and more 'punchy' on bass, also for me is more pleasant.

Someone said that some notes are missing on new one (0:58), but I don't hear it, and it might happen on a real opl.

Oh yeah that's night and day for me with headphones. Thanks for the careful recording of samples! BTW, I moved my PR from Draft to Ready for Review.

jordi
Posts: 282
Joined: Thu Jun 11, 2020 10:11 am
Has thanked: 112 times
Been thanked: 87 times

Re: OPL3 Progress

Unread post by jordi »

synthop wrote: Thu Apr 18, 2024 5:13 pm
jordi wrote: Tue Apr 16, 2024 1:17 pm

Repeating my post from Github

https://github.com/MiSTer-devel/ao486_M ... /sound.zip

  • duke2.mp3 is the new core
  • duke2_old.mp3 is the old (current release) of the core.

New one (from the new code) sounds cleaner and more 'punchy' on bass, also for me is more pleasant.

Someone said that some notes are missing on new one (0:58), but I don't hear it, and it might happen on a real opl.

Oh yeah that's night and day for me with headphones. Thanks for the careful recording of samples! BTW, I moved my PR from Draft to Ready for Review.

Doom might do this?

1.Detect OPL2. If present, continue.
2.Read status register: read port base+0.
3.AND the result with 06h.
If the result is zero, you have OPL3, otherwise OPL2.

jordi
Posts: 282
Joined: Thu Jun 11, 2020 10:11 am
Has thanked: 112 times
Been thanked: 87 times

Re: OPL3 Progress

Unread post by jordi »

synthop wrote: Thu Apr 18, 2024 5:13 pm
jordi wrote: Tue Apr 16, 2024 1:17 pm

Repeating my post from Github

https://github.com/MiSTer-devel/ao486_M ... /sound.zip

  • duke2.mp3 is the new core
  • duke2_old.mp3 is the old (current release) of the core.

New one (from the new code) sounds cleaner and more 'punchy' on bass, also for me is more pleasant.

Someone said that some notes are missing on new one (0:58), but I don't hear it, and it might happen on a real opl.

Oh yeah that's night and day for me with headphones. Thanks for the careful recording of samples! BTW, I moved my PR from Draft to Ready for Review.

I have used a real OPL3 from Yamaha:
https://github.com/MiSTer-devel/ao486_M ... amples.zip

The Most important is the excerpt
fpga_bad.mp3 => this is the 18th of April RBF. As you can notice, it does skip a note or two.
realOPL3_good.mp3 => this is from a good old authentic Yamaha OPL3 chip, using a Pentium 3 computer with MS-DOS 7 with an OPL3LPT.

synthop
Core Developer
Posts: 18
Joined: Fri Apr 05, 2024 12:23 pm
Has thanked: 5 times
Been thanked: 53 times

Re: OPL3 Progress

Unread post by synthop »

FYI the core has been merged into master. ALM count just under the previous core.

jordi
Posts: 282
Joined: Thu Jun 11, 2020 10:11 am
Has thanked: 112 times
Been thanked: 87 times

Re: OPL3 Progress

Unread post by jordi »

synthop wrote: Tue Apr 23, 2024 2:24 am

FYI the core has been merged into master. ALM count just under the previous core.

Vogons might help with opl3 detection.
https://www.vogons.org/viewtopic.php?f=7&t=100285
Wich doom version did you used? Not all support opl3
Someone said "It works in DOOM/DOOM II up to 1.7 and all other DOOM engine based games."

synthop
Core Developer
Posts: 18
Joined: Fri Apr 05, 2024 12:23 pm
Has thanked: 5 times
Been thanked: 53 times

Re: OPL3 Progress

Unread post by synthop »

We have stereo in Doom! New PR at https://github.com/MiSTer-devel/ao486_MiSTer/pull/145

Sorgelig doesn't want me to include release binaries in my PRs so I've put the latest release in a separate branch if anyone wants to try it: https://github.com/gtaylormb/ao486_MiST ... 240430.rbf

breiztiger
Top Contributor
Posts: 468
Joined: Sun May 24, 2020 7:17 pm
Has thanked: 35 times
Been thanked: 99 times

Re: OPL3 Progress

Unread post by breiztiger »

http://www.adlibtracker.net/index.php

does it work for someone

in msdos 6.22 when i type adt2rack2 just stuck at prompt

CPC-Power Staff
synthop
Core Developer
Posts: 18
Joined: Fri Apr 05, 2024 12:23 pm
Has thanked: 5 times
Been thanked: 53 times

Re: OPL3 Progress

Unread post by synthop »

breiztiger wrote: Tue Apr 30, 2024 1:52 pm

http://www.adlibtracker.net/index.php

does it work for someone

in msdos 6.22 when i type adt2rack2 just stuck at prompt

Same. I think it requires an FPU? Says minimum requirements are 386DX. Search "fpu" on this page: http://www.adlibtracker.net/messageboard.php?page=5

Bas
Top Contributor
Posts: 622
Joined: Fri Jan 22, 2021 4:36 pm
Has thanked: 80 times
Been thanked: 324 times

Re: OPL3 Progress

Unread post by Bas »

386DX doesn't include an FPU, just a 32-bit data bus. The FPU came with the 486DX.

thorr
Top Contributor
Posts: 1311
Joined: Mon Jul 06, 2020 9:37 pm
Has thanked: 634 times
Been thanked: 308 times

Re: OPL3 Progress

Unread post by thorr »

If an FPU requirement is still in question, maybe try Q87 which is an FPU emulator to see if it helps. As stated, 386DX does not come with an FPU, but it could be added with a separate math co-processor chip.

breiztiger
Top Contributor
Posts: 468
Joined: Sun May 24, 2020 7:17 pm
Has thanked: 35 times
Been thanked: 99 times

Re: OPL3 Progress

Unread post by breiztiger »

just try with q87 ... the same

edit : https://archive.org/details/sadt2_zip work

has someone 2.0.27 version (last g2) or 2.0.30 (before extended mode) to try ?

edit 2 : 2.0.27 work also (found at https://archive.org/details/adlib-tracker-ii-for-dos)

CPC-Power Staff
jordi
Posts: 282
Joined: Thu Jun 11, 2020 10:11 am
Has thanked: 112 times
Been thanked: 87 times

Re: OPL3 Progress

Unread post by jordi »

breiztiger wrote: Tue Apr 30, 2024 1:52 pm

http://www.adlibtracker.net/index.php

does it work for someone

in msdos 6.22 when i type adt2rack2 just stuck at prompt

Ao486 is not perfect

Just try different software?
https://www.vogons.org/viewtopic.php?t=47059

Even simpler

https://github.com/mills32/Adplug-for-8088-86

Post Reply