[Patch] Aztech Sound Cards

Post Reply
EluanCM
Posts: 105
Joined: Tue 27 Oct, 2015 2:07 pm
Location: Brazil
Contact:

[Patch] Aztech Sound Cards

Post by EluanCM »

UPDATE: Support for the NT 3.1 drivers: https://pcem-emulator.co.uk/phpBB3/viewtopic.php?f=4&t=3395&p=13262#p13262

This patch adds support for two types of Aztech sound cards: AZT2316A and AZT1605.
These cards are Sound Blaster Pro v2 (8-bit) + Windows Sound System (16-bit) combos that were very common OEM cards during the mid-90's, Packard Bell for example used them extensively (including on some of the models emulated by PCem.)
The cards do not do anything new or different, but having support for them enables the usage of the Master CD or HDD dumps from lots of systems without any further configuration (this is actually the reason why I created this patch).

The two emulated families are Washington (Aztech MMPRO16AB, Aztech Sound Galaxy Pro 16 AB, Aztech Sound Galaxy Washington 16, other OEM names with FCC ID I38-MMSN824 and others) and Clinton (Packard Bell FORTE16, Aztech Sound Galaxy Nova 16 Extra, Aztech Sound Galaxy Clinton 16, other OEM names)

It also works more or less for drivers of other models with the same chipsets.

Some of them use the CS4248 DSP which is pin and software compatible with the AD1848 that is already emulated. Others use a CS4231 in CS4248 mode. You need to select the right one for your driver.

There is a jumper to load the startup configuration from an EEPROM. This is implemented, so any software-configured parameters will be saved.

The CD-ROM interface commands are just ignored, along with gameport (PCem takes care of these in other places).
The MPU401 is always enabled, but IRQs are not implemented yet in PCem so it should work in polling mode. The OPL3 is always active in some (all?) drivers/cards, so there is no configuration for this.

Tested with DOS (driver installation, tools, diagnostics), Win3.1 (driver installation, tools), Win95 (driver auto-detection), lots of games.

I consider the Washington family (AZT2316A) to be functionally complete and very well tested. The Clinton (AZT1605) family should work better in WSS mode (explanation below).
BEWARE that there are *too many* driver types and OEM versions for each card. Maybe yours isn't emulated or you have the wrong driver. Some features of each card may work when using wrong drivers. CODEC selection is also important. A wrong codec may render you without cd-volume control, etc.

Beware that CD music for some (all?) DOS games does not work under Win95, this is a known bug in PCem in all sound cards. The mode selects get truncated and send all zeros for output channel selection and volume, Descent 2 in particular also has excess zeros! CD audio works in Windows programs and in pure DOS.

I still don't know how the Clinton family AZT1605 DMA is configured and the SBPROV2 emulation seems to be done partly by a TSR. It's better to remove the TSR for now. I need to investigate this. Mixer is also weird under DOS. I've read horror stories about this TSR on the internet. There is absolutely no documentation for both of these chips (and the Linux drivers are very basic), so more reverse engineering will be necessary.

Descent 2 W95 version can't start cd music. Happens on real hardware. The game calls auxGetNumDevs() to check if any of the AUX devices has caps.wTechnology == AUXCAPS_CDAUDIO, but this fails because the Aztech Win95 driver only returns a "Line-In" device. I'm not aware of any other game that does this and this is completely unnecessary. Other games that play cd audio correctly have the exact *same* initialization code, minus this check that only Descent 2 Win95 does. It would work if it just skipped this check and progressed with calling mciSendCommand() with mciOpenParms.lpstrDeviceType = "cdaudio", like other games do. There are some sound cards listed as incompatible in the game's README.TXT file that are probably due to this.

You need to run autotools before configure (there is a new file and I wanted to keep the patch clean).

I don't know how much screenshots would be useful for a *sound* card, but here they are. Bonus screenshot of me using Visual C++ 1.52 to confirm the hypothesis of why Descent 2 CD Audio didn't work.
Attachments
Screenshot from 2020-02-10 19-39-09.png
Screenshot from 2020-02-10 19-39-09.png (63.43 KiB) Viewed 6711 times
Screenshot from 2020-02-10 19-36-39.png
Screenshot from 2020-02-10 19-36-39.png (57.3 KiB) Viewed 6711 times
Screenshot from 2020-02-10 19-35-34.png
Screenshot from 2020-02-10 19-35-34.png (46.95 KiB) Viewed 6711 times
Screenshot from 2020-02-10 19-35-14.png
Screenshot from 2020-02-10 19-35-14.png (47.12 KiB) Viewed 6711 times
Screenshot from 2020-01-19 22-28-25.png
Screenshot from 2020-01-19 22-28-25.png (47.85 KiB) Viewed 6711 times
aztech_sound_cards.patch
(99.11 KiB) Downloaded 187 times
Last edited by EluanCM on Tue 18 Feb, 2020 1:11 am, edited 1 time in total.
User avatar
omarsis81
Posts: 857
Joined: Thu 17 Dec, 2015 6:20 pm

Re: [Patch] Aztech Sound Cards

Post by omarsis81 »

Impressive! 8-)
User avatar
leilei
Posts: 797
Joined: Fri 25 Apr, 2014 4:47 pm

Re: [Patch] Aztech Sound Cards

Post by leilei »

The Washington card seems to work fine with the '95 Packard legend's drivers :thumbsup:, surprised the other card didn't (especially considering the board names)

It didn't produce any additional luck on Turtle Beach drivers for their similar WSS clone though. :(
EluanCM
Posts: 105
Joined: Tue 27 Oct, 2015 2:07 pm
Location: Brazil
Contact:

Re: [Patch] Aztech Sound Cards

Post by EluanCM »

There are some Washington cards with Packard Bell names, but I can't confirm right now. I think Packard Bell Sound16A is one such OEM name.
altheos
Posts: 70
Joined: Wed 24 Feb, 2016 7:27 pm

Re: [Patch] Aztech Sound Cards

Post by altheos »

Hi.
Just asking here : do you use SB DSP as Asktek DSP ?
Does it means that Aztech DSP (AZT1605-U05 , AZT2316, AZT2320 ...) functions are really on par with Creative's part ?
EluanCM
Posts: 105
Joined: Tue 27 Oct, 2015 2:07 pm
Location: Brazil
Contact:

Re: [Patch] Aztech Sound Cards

Post by EluanCM »

Are you referring to the functionality or the quality?

It was made to mimic the SB Pro V2 DSP, so I use that with the Aztech extensions.
Also many people regard these cards as less noisy than the Creative cards of the time, but this makes no difference under emulation. (Unless you want to emulate analog noise!)
altheos
Posts: 70
Joined: Wed 24 Feb, 2016 7:27 pm

Re: [Patch] Aztech Sound Cards

Post by altheos »

I am referring to functionality : internal DSP functions, OPL version, MIDI, ADPCM, mono/stereo, known bugs ...
EluanCM
Posts: 105
Joined: Tue 27 Oct, 2015 2:07 pm
Location: Brazil
Contact:

Re: [Patch] Aztech Sound Cards

Post by EluanCM »

-I've implemented a few quirks of the DSP that should only affect poorly written software, but haven't tested every single command (there is no documentation anywhere).
-The OPL is always a real one, no clones like some SBs.
-For MIDI, there is no hanging notes bug in any model.
-There is also no reverse stereo bug in any model. This can be a problem with games that assume this bug is present because of the model selection and give no way of configuring the reversal! This probably should be an option in the PCem context menu. On real hardware you could use reversible cables for this rare occasion.
-Based on my experience from the past, the rest should be mostly the same.
SA1988
Posts: 268
Joined: Wed 30 Apr, 2014 9:38 am

Re: [Patch] Aztech Sound Cards

Post by SA1988 »

NT 3.1 drivers seem to not work at all, even if I select the right settings (Nova 16 Extra drivers), in the sense on the read data available read register it issues a 0x80, then a write data available read with 0x00, then, a read data available one with 0x00, then says the audio board is not the right one.
EluanCM
Posts: 105
Joined: Tue 27 Oct, 2015 2:07 pm
Location: Brazil
Contact:

Re: [Patch] Aztech Sound Cards

Post by EluanCM »

Are you using the right driver/AZT chip combination? There are various "Nova 16":

-Nova 16 (don't know the chip)
-Nova 16 Extra (AZT1605)
-Nova 16 Extra II (AZT2316A)
-...probably others I don't know about.

I've implemented only two types (0x0C and 0x11), which are the ones that I have. I've also put the exact names from my original driver files in the PCem config and didn't put names that I know but don't have the hardware to test. There are probably a dozen others.
SA1988
Posts: 268
Joined: Wed 30 Apr, 2014 9:38 am

Re: [Patch] Aztech Sound Cards

Post by SA1988 »

I've used the AZT1605 one.
Edit: got news, it tries to use command 0x08 with data 0x55.
EluanCM
Posts: 105
Joined: Tue 27 Oct, 2015 2:07 pm
Location: Brazil
Contact:

Re: [Patch] Aztech Sound Cards

Post by EluanCM »

OK, I've taken a look at the NT 3.X driver. It is somewhat different from the drivers I've used to test.

-Tries to identify the card with 0x08 0x55 instead of 0x08 0x05 - card behaviour seems to be the same.
-Accesses the CODEC differently, but luckily this was already handled.
-Tests MPU401 (after sending reset and UART mode commands) and WSS/CODEC interrupts (expects an interrupt after writing the config registers?)

The fixes:
-Added the new identification method.
-I've added the MPU401 interrupt selection so that they trigger after resetting/setting UART mode.
-Added an option to trigger the CODEC interrupt after configuring the WSS registers. I've kept this as an option because AFAIK the codec should only trigger interrupts on timer/DMA. Maybe this is just the AZT chip raising this interrupt and the option shouldn't be needed.

After that, installation works (don't forget to check the mixer settings).

I will post the patch later, my branch is quite polluted and I need to clean it.
User avatar
MiraiMiracle
Posts: 44
Joined: Fri 06 Jul, 2018 4:42 pm

Re: [Patch] Aztech Sound Cards

Post by MiraiMiracle »

Really nice!!

Should Sarah merge this patch ot not?
"I should stay rolling as alive and kicking!"

-NANA MIZUKI ACCENT/the Second's catchphrase
Image
EluanCM
Posts: 105
Joined: Tue 27 Oct, 2015 2:07 pm
Location: Brazil
Contact:

Re: [Patch] Aztech Sound Cards

Post by EluanCM »

Updated patch to support the NT 3.1 drivers.
Attachments
aztech_sound_cards_v2.patch
(105.8 KiB) Downloaded 176 times
Manaphy
Posts: 10
Joined: Sat 18 May, 2019 7:26 pm

Re: [Patch] Aztech Sound Cards

Post by Manaphy »

This appers to be licensed using GPL v3 while PCem is GPL v2, though GPL v2 allows for a "GPL v2 or later" clause that makes it compatible but since the code files have no header, what is the license PCem should be considered to be under? GPL 2 or GPL 2+ ("v2 or later")?
EluanCM
Posts: 105
Joined: Tue 27 Oct, 2015 2:07 pm
Location: Brazil
Contact:

Re: [Patch] Aztech Sound Cards

Post by EluanCM »

This was just a copy-paste error, I don't really care about the differences between GPL v2 and v3 GPL.
User avatar
SarahWalker
Site Admin
Posts: 1886
Joined: Thu 24 Apr, 2014 4:18 pm

Re: [Patch] Aztech Sound Cards

Post by SarahWalker »

Config options are a bit overwhelming. Are all the options strictly necessary, do these cards really require the user to manually configure all resources for SB, WSS & MPU401?

It would also seem more sensible to me to present the Washington/Clinton selection as two different sound cards rather than a separate type field.
EluanCM
Posts: 105
Joined: Tue 27 Oct, 2015 2:07 pm
Location: Brazil
Contact:

Re: [Patch] Aztech Sound Cards

Post by EluanCM »

Screenshot_2020-02-29_15-59-11_edited.png
Screenshot_2020-02-29_15-59-11_edited.png (69.44 KiB) Viewed 5196 times
You're right, the type (blue square) could be split into two separate cards.
The green square is an option because I don't know yet what the real behavior should be. (My cards are back in storage again and creating a test for this would be a pain :cry: )
All the options in the red squares can be completely removed. For a fresh driver install, only address = {220h, 240h, EEPROM setting} should be enough. The reason I put all as options was to skip one setup step and be able to directly boot dumped HDD images from real hardware without doing any setup, because dumping a 16-byte EEPROM from my cards would be overkill. (Some drivers have EEPROM overrides in config.sys, others do not.)

Would you recommend removing them?
User avatar
SarahWalker
Site Admin
Posts: 1886
Joined: Thu 24 Apr, 2014 4:18 pm

Re: [Patch] Aztech Sound Cards

Post by SarahWalker »

Yes, I'd suggest removing the red options. If setup can reprogram the EEPROM, then we could always supply a default image.
EluanCM
Posts: 105
Joined: Tue 27 Oct, 2015 2:07 pm
Location: Brazil
Contact:

Re: [Patch] Aztech Sound Cards

Post by EluanCM »

OK, the excessive options are now removed.
Now, when there is no EEPROM, a new one will be created with default values instead of creating from the PCem config.

I didn't have much time to test all the combinations, but everything seems fine. There is some code that I should de-duplicate in the future.

The AZT2316A is release-ready, the AZT1605 still has issues when the DOS TSR is loaded and with the DOS mixer, but should work perfectly under Windows 3.X/NT/95/98.

EDIT: Looks like nvr.c from another patch leaked here, sorry.
Attachments
aztech_sound_cards_v3.patch
(122.21 KiB) Downloaded 143 times
User avatar
SarahWalker
Site Admin
Posts: 1886
Joined: Thu 24 Apr, 2014 4:18 pm

Re: [Patch] Aztech Sound Cards

Post by SarahWalker »

Committed at rev 1534. I've marked the AZT1605 as DEVICE_NOT_WORKING due to the DOS issues, this will prevent it from showing in release builds but will still be available for dev builds.
User avatar
leilei
Posts: 797
Joined: Fri 25 Apr, 2014 4:47 pm

Re: [Patch] Aztech Sound Cards

Post by leilei »

Noticed it's this patch causing [url=http://pcem-emulator.co.uk/phpBB3/viewtopic.php?f=2&t=3440]a compatibility regression[/url] by uncommenting a couple lines to trigger fatal errors for bad/unknown commands. I might recomment those lines out that in my testing runs as I believe allowing it to fatal's a bit of an oversight
Post Reply