Sound Blaster 2.0 project & IRQ from OPL2

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

Sound Blaster 2.0 project & IRQ from OPL2

Postby LABS » 2018-6-07 @ 22:35

Hello there!

I'm currently working on a Sound Blaster 2.0-compatible ISA card based on Atmega MCU. My goal is to completely implement original SB's playback functionality using modern, available and better sounding parts (like DAC, op-amps, film capacitors, etc). I only keep genuine YM3812 FM synth and its DAC YM3014B. As with SB2.0, the card supports 8-bit mono PCM and ADPCM 1:2/1:3/1:4 playback in all modes (direct, single-cycle DMA, auto-init DMA, high-speed single-cycle and auto-init), OPL2 FM synth on real YM3812 sound chip, ALL playback-related DSP commands (even rarely used ones) to maximize compatibility with software that use the card for playback. However the card does NOT support sound recording and MIDI I/O (who needs that really?).

I chose Sound Blaster 2.0 because it is so much fun to implement it completely (the playback part) in hardware and software with all DSP commands, run the game like Gabriel Knight or Full Throttle and watch how it is detected and hear how it works... :lol: And SB 8-bit card can be built on Atmega328P MCU which I'm familiar with. SB Pro is 8-bit as well, but the mixer chip is a pain to implement, but without it the playback functionality will not be full. If I will ever take the challenge - then it will be SB16 anyway :cool:

The Adlib part is already finished as a prototype (see pics) and is autodetected by software. DOS games on Pentium 166 MMX plays music perfectly.. :cool: but without sound effects yet. OPL2 was an easy part as it replicates Adlib, but the DAC part is more tricky, as there are no schematics available and I do not have a Sound Blaster card for research. The only source of information is SoundBlaster Programmer's Manual, with all DSP commands described. So it took some time to sythesize inner workings of the card based on that manual and some example code. Nevertheless, the hardware part for DAC is already completed on paper, now I'm finishing software and soon will make a prototype. After finishing and debugging the prototype I will order some factory-made PCBs to make everything look good.

But there is one thing left unresolved - IRQ signal from OPL2. Does anybody know if pin 2 of YM3812 in SB card is connected to anything or not? Does it produce interrupt? If yes - what about IRQ sharing between DAC and OPL2? In Adlib the OPL2 does produce an interrupt and this is how the card is detected as Adlib. What with SB? Visually tried to trace SB PCB's photos found on the net, but with no luck. Looks like it is left unconnected, but not sure. Does anybody know exactly, please?

EDIT: Solved by cyclone3d:
Just looked at my CT1320C and CT1350B and pin 2 of the YM3812 is not connected to anything.


And if anyone knows any bugs in SB 1.0/1.5/2.0 - series of cards which are used as programming tricks, please let me know, so I could implement them as well)))

Thank you!
Attachments
IMG_20180607_214105.jpg
IMG_20180607_214037.jpg
Last edited by LABS on 2018-6-08 @ 09:22, edited 3 times in total.
User avatar
LABS
Newbie
 
Posts: 24
Joined: 2018-6-07 @ 16:49
Location: Latvia

Re: Sound Blaster 2.0 project & IRQ from OPL2

Postby cyclone3d » 2018-6-07 @ 23:38

Cool project!

Just looked at my CT1320C and CT1350B and pin 2 of the YM3812 is not connected to anything.
User avatar
cyclone3d
Oldbie
 
Posts: 1980
Joined: 2015-4-08 @ 06:06
Location: Huntsville, AL USA

Re: Sound Blaster 2.0 project & IRQ from OPL2

Postby Jo22 » 2018-6-08 @ 00:49

Cool project! :D

LABS wrote:ALL playback-related DSP commands (even rarely used ones) to maximize compatibility with software that use the card for playback.

Also the Thunder Board DSP commands ? ;)
Thunderboard was a decent SB 1.x/2.0 clone, but also had few extra DSP commands.
Nothing spectacluar, but if you like to add them, here's the SDK.
https://github.com/joncampbell123/doslib/issues/8

(The ThunderBoard chipset was also found on the Medis Vision PAS16, the Logiitech SoundMan 16 and the Protak card.)

Edit: Also check out this thread about SB 1.x/SB2.0 analgue mixing (OPL2/DAC audio level balance)..:
viewtopic.php?f=62&t=49683

Edit: Edited and typos fixed.
"Time, it seems, doesn't flow. For some it's fast, for some it's slow.
In what to one race is no time at all, another race can rise and fall..." - The Minstrel

//My video channel//
User avatar
Jo22
l33t
 
Posts: 2836
Joined: 2009-12-13 @ 07:06
Location: Europe

Re: Sound Blaster 2.0 project & IRQ from OPL2

Postby Beegle » 2018-6-08 @ 03:46

Very interesting!
User avatar
Beegle
Member
 
Posts: 421
Joined: 2013-12-01 @ 02:15
Location: Canada

Re: Sound Blaster 2.0 project & IRQ from OPL2

Postby LABS » 2018-6-08 @ 08:47

cyclone3d wrote:Cool project!

Just looked at my CT1320C and CT1350B and pin 2 of the YM3812 is not connected to anything.


Ufff... Thank you, cyclone3d! Well, the digital part is done then))

Jo22 wrote:Also the Thunder Board DSP commands ? ;)
Thunderboard was a decent SB 1.x/2.0 clone, but also had few extra DSP commands.
Nothing spectacluar, but if you like to add them, here's the SDK.
https://github.com/joncampbell123/doslib/issues/8

(The ThunderBoard chipset was also found on the Medis Vision PAS16, the Logiitech SoundMan 16 and the Protak card.)

Edit: Also check out this thread about SB 1.x/SB2.0 analgue mixing (OPL2/DAC audio level balance)..:
viewtopic.php?f=62&t=49683


Thanks for your input, Jo22! Making the card also PAS-compatible...got to think about it) Great post on OPL2/DAC level balance by the way. I just added simple 2-channel analog mixer to the output circuit to manually control the levels of DAC and OPL2, just 2 pots instead of 1 on ISA bracket. I think this the most flexible and simple way to control the balance.

Thanks everyone, will keep you informed about the progress :happy:
User avatar
LABS
Newbie
 
Posts: 24
Joined: 2018-6-07 @ 16:49
Location: Latvia

Re: Sound Blaster 2.0 project & IRQ from OPL2

Postby keropi » 2018-6-08 @ 09:02

this is very interesting - I will keep my eye on it! great job LABS!
User avatar
keropi
l33t++
 
Posts: 6491
Joined: 2003-9-08 @ 06:45
Location: Greece

Re: Sound Blaster 2.0 project & IRQ from OPL2

Postby 640K!enough » 2018-6-09 @ 17:55

If I'm not mistaken, the original Ad Lib card didn't make use of the interrupt pin. The officially-documented detection method involved setting an OPL2 timer, then polling the status register to see if the timer had expired. The MSC was a relatively simple design.
640K!enough
Member
 
Posts: 378
Joined: 2017-5-11 @ 17:52
Location: Canada

Re: Sound Blaster 2.0 project & IRQ from OPL2

Postby Jo22 » 2018-6-09 @ 19:13

LABS wrote:Thanks for your input, Jo22! Making the card also PAS-compatible...got to think about it) Great post on OPL2/DAC level balance by the way. I just added simple 2-channel analog mixer to the output circuit to manually control the levels of DAC and OPL2, just 2 pots instead of 1 on ISA bracket. I think this the most flexible and simple way to control the balance.

Glad to hear! ^^ The PAS16 had it's own, native DAC, TB was fully independed and could be disabled (or used simultanously with PAS native DAC).
ThunderBoard detection was done by sending the SB DSP version retrival command twice (to avoid compatibility issues with SB titles).
- Interestingly, some games like Knights of Xentar claimed to support the PAS16, but in reality used OPL3+TB DAC.
Which meant it also worked in stereo with the SB16 inofficially..
Your approach with the 2 pots is a fine idea, I think. That way, someone could adjust the balance as needed.
I'm speaking under correction, but some later games might use a different balance level, if developed on later hardware.
If we can help you with testing, just say so. ^^

640K!enough wrote:If I'm not mistaken, the original Ad Lib card didn't make use of the interrupt pin. The officially-documented detection method involved setting an OPL2 timer, then polling the status register to see if the timer had expired. The MSC was a relatively simple design.

I believe that's right. The YM3812's timers/ports we're readable and a delayed response was used to figure out presence of AdLib.
Anyway, I'm just a user. I've never written such detection codes myself and speaking under correction. :sweatdrop:
"Time, it seems, doesn't flow. For some it's fast, for some it's slow.
In what to one race is no time at all, another race can rise and fall..." - The Minstrel

//My video channel//
User avatar
Jo22
l33t
 
Posts: 2836
Joined: 2009-12-13 @ 07:06
Location: Europe

Re: Sound Blaster 2.0 project & IRQ from OPL2

Postby Tiido » 2018-6-10 @ 12:24

Real Adlib actually has IRQ almost ready for use, it just lacks the pin header (from factory) that actually connects IRQ output to ISA (though a buffer). I'm not aware of any sound card connecting the YM IRQ to ISA except YMF711/715/718/719 cards if the software configures the chip right.
User avatar
Tiido
Member
 
Posts: 333
Joined: 2018-1-14 @ 04:40
Location: Estonia

Re: Sound Blaster 2.0 project & IRQ from OPL2

Postby 640K!enough » 2018-6-10 @ 14:53

Tiido wrote:I'm not aware of any sound card connecting the YM IRQ to ISA except YMF711/715/718/719 cards if the software configures the chip right.

The Ad Lib Gold did, indirectly via the control chip.

Did the Media Vision cards not do something similar?
640K!enough
Member
 
Posts: 378
Joined: 2017-5-11 @ 17:52
Location: Canada

Re: Sound Blaster 2.0 project & IRQ from OPL2

Postby LABS » 2018-6-10 @ 17:04

640K!enough wrote:If I'm not mistaken, the original Ad Lib card didn't make use of the interrupt pin. The officially-documented detection method involved setting an OPL2 timer, then polling the status register to see if the timer had expired. The MSC was a relatively simple design.


Yes, guys, you are right. I was misleaded by an "exact :cool: " Adlib-replica schematics, which actually utilizes connection of IRQ pin to ISA IRQ5 and IRQ7 via selection jumper) - a real Adlib did not use IRQ pin at all. Which is strange, because you just get 2 extra timers with it. Sorry for that.

I looked thru Thunder Board Programmer's Reference (which is much better written than Sound Blaster's) after Jo22's advice and found only 3 functional commands of interest - 0x1E (2bit ADPCM auto-init output w/o reference byte), 0x7E (for 3bit ADPCM), 0x7C (for 4bit). These are easy to implement as well as extension to 0xE1 and diagnostic 0xF2/0xF8. Can't see any reason not to include them, so TB's compatibility will also be there.

For more compatibility I also decided to include all recording commands in all modes (including TB's ADPCM ones), but they will return silence.

Can anyone advice any game or app which use high-speed DMA output mode of SB DSP 2.01? Thanks.
User avatar
LABS
Newbie
 
Posts: 24
Joined: 2018-6-07 @ 16:49
Location: Latvia

Re: Sound Blaster 2.0 project & IRQ from OPL2

Postby Phreeze » 2018-6-13 @ 09:25

i'll follow this,always interested in community projects
ArGUS Parts list: http://bit.ly/2Ddf89V
User avatar
Phreeze
Member
 
Posts: 131
Joined: 2016-10-11 @ 08:24

Re: Sound Blaster 2.0 project & IRQ from OPL2

Postby root42 » 2018-6-13 @ 09:50

Me too. I already have my AdLib clones, so a DIY SoundBlaster would be the next welcome upgrade!
My ramblings on YouTube
Me playing games on my 286 and on my Sega MD2 on Twitch
80286@12 MHz, 2 MiB RAM, Tseng ET4000 1 MiB, schlae AdLib, XT CF Lite, OSSC 1.6
User avatar
root42
Member
 
Posts: 432
Joined: 2018-1-27 @ 13:23

Re: Sound Blaster 2.0 project & IRQ from OPL2

Postby Jo22 » 2018-6-13 @ 10:52

Me, too. I really like the design of LABS' prototype (visually has a bit of that charming 60's/70's flair).
It's true to the tradition of the do-it-youself scene (PCB looks like a precious vintage item to me),
despite beeing very clean looking at the same time (soldered traces, lots of surface for ground).
"Time, it seems, doesn't flow. For some it's fast, for some it's slow.
In what to one race is no time at all, another race can rise and fall..." - The Minstrel

//My video channel//
User avatar
Jo22
l33t
 
Posts: 2836
Joined: 2009-12-13 @ 07:06
Location: Europe

Re: Sound Blaster 2.0 project & IRQ from OPL2

Postby LABS » 2018-6-13 @ 14:25

Recently I started to assemble the DAC part on a breadboard (I know it looks messy). The digital part has 13 ICs in total - MCU, DAC, 2x registers, 1x buffer, 2x D-triggers, and the rest used for address decoding and internal logic. I made wire harness to connect it with Adlib part. First thing to do was to assemble address decoding and control logic and to test Adlib playback again, but this time already "being soundblaster". Unfortunately the resistance of a schematic assembled this way (breadboard+wire harness+dry contacts everywhere), was so high, that ISA supply voltage dropped to 3.8V, which is unacceptable. I tried to connect it to extra +5 supply, taken from IDE HDD power connector. Now it was around 4.5V (acceptable minimum), but was very unstable, sometimes dropped to 4.2 and raised to 4.6. Anyway Adlib was detected and I ran Heretic to test the music. It was playing but some OPL2 commands were lost during playback - some notes were missing and some just hanging. It is understood, that assembling more will make things even worse.
I am suprised, that 250W AT PSU cannot provide enough current to drive this kind of load, but anyway my breadboard experiments are not the way to go. Now I need to create a normal PCB for the DAC part and connect it to OPL2 part using the shortest possible wires. It will take 2-3 days.

Will inform you about my progress and thanks a lot for your interest and support! :happy:
Attachments
sb2_breadboard.jpg
User avatar
LABS
Newbie
 
Posts: 24
Joined: 2018-6-07 @ 16:49
Location: Latvia

Re: Sound Blaster 2.0 project & IRQ from OPL2

Postby LABS » 2018-6-17 @ 19:50

Can anyone suggest any game or other app for DOS which uses high-speed DMA transfer mode of Sound Blaster 2.0 (23kHz - 44.1kHz / 8-bit PCM)? Thanks.

PCB for the DAC part is in progress:
Attachments
pcb_scr.jpg
pcb_print.jpg
pcb1.jpg
User avatar
LABS
Newbie
 
Posts: 24
Joined: 2018-6-07 @ 16:49
Location: Latvia

Re: Sound Blaster 2.0 project & IRQ from OPL2

Postby Jo22 » 2018-6-17 @ 21:43

LABS wrote:Can anyone suggest any game or other app for DOS which uses high-speed DMA transfer mode of Sound Blaster 2.0 (23kHz - 44.1kHz / 8-bit PCM)?

Well, I would if if I knew. As a wild guess, I'd say SB 2.0 driver or TB driver on Windows 3.1 if an app (a game, MOD4WIN, etc) is using 22KHz or 44KHz sampling rate.
Or games like Jill of Jungle, Jazz Jackrabbit, Epic Pinball (highest audio settings for SB) *might* use such a transfer mode. Not sure, though.
Sorry, that's all that's comes to mind. I'm more of a tinkerer than a gamer, I'm afraid. :sweatdrop:

Edit: Forgot to mention the demoscene.. 8088 Corruption required a SB card with DMA Auto-Init, I recall.
Maybe there are others that do utilize more exotic Sound Blaster commands, too.
"Time, it seems, doesn't flow. For some it's fast, for some it's slow.
In what to one race is no time at all, another race can rise and fall..." - The Minstrel

//My video channel//
User avatar
Jo22
l33t
 
Posts: 2836
Joined: 2009-12-13 @ 07:06
Location: Europe

Re: Sound Blaster 2.0 project & IRQ from OPL2

Postby matze79 » 2018-6-18 @ 16:20

if you get this done, did you ever mind to work together with dreamblaster to add the DAC Part to his OPL2LPT Device
Happy Hacking :) A Nice Project!
matze79
Oldbie
 
Posts: 1085
Joined: 2014-12-12 @ 14:25
Location: Germany, Frankonia

Re: Sound Blaster 2.0 project & IRQ from OPL2

Postby root42 » 2018-6-18 @ 19:15

matze79 wrote:if you get this done, did you ever mind to work together with dreamblaster to add the DAC Part to his OPL2LPT Device
Happy Hacking :) A Nice Project!


I think it would be the other way around. DMA via the LPT will be a bit difficult, especially on older machines.
My ramblings on YouTube
Me playing games on my 286 and on my Sega MD2 on Twitch
80286@12 MHz, 2 MiB RAM, Tseng ET4000 1 MiB, schlae AdLib, XT CF Lite, OSSC 1.6
User avatar
root42
Member
 
Posts: 432
Joined: 2018-1-27 @ 13:23

Re: Sound Blaster 2.0 project & IRQ from OPL2

Postby 640K!enough » 2018-6-18 @ 20:11

root42 wrote:I think it would be the other way around. DMA via the LPT will be a bit difficult, especially on older machines.

Direct DMA transfers to audio hardware via the parallel port would be just about impossible; the parallel port and ISA bus are quite different. The DMA functionality would have to be accomplished with assistance from the software TSR that they have. It has been done before, and can be made to work; it would just depend on whether dreamblaster and LABS consider it a worthwhile collaboration effort, and whether this ends up being the least expensive way for dreamblaster to deliver such a product.
640K!enough
Member
 
Posts: 378
Joined: 2017-5-11 @ 17:52
Location: Canada

Next

Return to Sound

Who is online

Users browsing this forum: No registered users and 3 guests