IBM PS/1 Audio Card.

Developer's Forum, for discussion of bugs, code, and other developmental aspects of DOSBox.

IBM PS/1 Audio Card.

Postby jmk » 2008-4-15 @ 23:26

I didn't know this existed, but Mobygames says it does... very hard to find any information on it. Sure enough, my old KQ5 EGA supports it.

According to this:
http://www.old-computers.com/museum/doc.asp?c=1274&st=1

The Audio card, which fits into the system unit, includes the following:

· 3 voice synthesizer plus noise generator


Hmm... sounds a bit familiar, yes? :sly:

Sure enough, I did a bit of poking around and set port 0x0205 to write to the SN76496 The result: some PCJr/Tandy-like sounds! Yet another change where I can't be sure of finding any original content! :blush:

Works fine on KQ5 EGA. I tried it on Prince Of Persia 2, but it requires some rather strict checks:

INT 15h AH = C0h (SYSTEM - GET CONFIGURATION).
Then checks:
CMP [BX+2],0BFC (OK - PS/1 LW-Type 44 and Model 2011 (286-10))
CMP [BX+2],30F8 (OK - PS/1 Model 2121 (386SX-16))

then...

OUT 70,2F (CMOS Reg 2F, usually the low byte of the checksum).
IN AL,71
If bit 4 high, then OK.

If all that passes, then it will play the sound in the intro, although it does get stuck in the game itself.

POP2 allows the PS/1 card to be used as a "sound device" as well as a "music synth". It does some reading/writing to 0x0200-0x0204 (excluding the joystick at 0x0201). Possibly some sort of sample-playing facility? The mystery deepens...
jmk
Newbie
 
Posts: 34
Joined: 2008-4-13 @ 10:50
Location: Paisley, UK.

Re: IBM PS/1 Audio Card.

Postby Great Hierophant » 2008-4-17 @ 03:31

Did you compare the output between the PS/1 and the Tandy options in KQ5? They should sound the same, unless the PS/1's TI SN74696 clone's tone generators are operating at different frequency. Interestingly, MobyGames does not include Tandy sound for PoP2's list of supported sound devices, yet the disk says "For IBM/Tandy & 100% compatibles."

That the PS/1 Audio Card supports sampled sounds is known, but how it supports those samples may be lost to time. The Tandy sound chip that combined the Waveform Generator and the DAC is called the PSSJ and is detailed in 1000 technical references available online. Perhaps IBM took more inspiration from its rival?
User avatar
Great Hierophant
l33t
 
Posts: 2338
Joined: 2003-4-27 @ 08:20

Re: IBM PS/1 Audio Card.

Postby jmk » 2008-4-17 @ 14:46

Well, just judging by ear, the KQ5 music sounds the same in Tandy and PS/1 mode.

You don't think that IBM had a load of old PCjr parts lying around that they had to get rid of? :wink:

The version of KQ5 I have doesn't seem to support samples, so I'm still looking at PoP2 to try and figure out the "DAC" part of it. It's still a bit confusing, but at least I think I've found the start of the code that sets up a single-play sample.
jmk
Newbie
 
Posts: 34
Joined: 2008-4-13 @ 10:50
Location: Paisley, UK.

Re: IBM PS/1 Audio Card.

Postby Great Hierophant » 2008-4-17 @ 15:38

Sierra does have an option for Tandy SL, TL & RL series; those machines support the Tandy DAC. However, you are correct in that the driver does not support digital sound, lazy Sierra. Why bother with the option at all?
User avatar
Great Hierophant
l33t
 
Posts: 2338
Joined: 2003-4-27 @ 08:20

Re: IBM PS/1 Audio Card.

Postby jmk » 2008-4-18 @ 22:34

I've compared the two and I think they're different.

The PS/1 driver (for PoP2 at least) uses what looks like a FIFO, rather than DMA. It does trigger IRQ7 and the interrupt handler reads some status bits and feeds more to the FIFO (via an OUTSB).

It also uses ( 1,000,000 / HZ ) - 1 for calculating the timing, rather than the Tandy DAC's ~3.57 Mhz clock.

Another thing to note is that the PoP2 Tandy driver uses direct I/O (not the BIOS calls) so you don't get any DAC sounds under DOSBox... :sad:
jmk
Newbie
 
Posts: 34
Joined: 2008-4-13 @ 10:50
Location: Paisley, UK.

Re: IBM PS/1 Audio Card.

Postby jmk » 2008-4-21 @ 00:16

I thought I was getting somewhere... I got the PoP2 DAC playing and Space Quest 4 playing (with a bit of stutter - it doesn't use interrupts, just keeps on feeding the FIFO).

But... get to level 2 on PoP2 and things go wrong.

It plays a long sample then ends up with:
"CPU:Illegal Unhandled Interrupt Called F".

So... after a time of happy IRQ 7 triggering, that error is reported and IRQ 7 never triggers again...

Hmm... what does the error mean exactly? A re-entrant IRQ? A CPU trap interfering?

Still puzzled. :sad:
jmk
Newbie
 
Posts: 34
Joined: 2008-4-13 @ 10:50
Location: Paisley, UK.

Re: IBM PS/1 Audio Card.

Postby wd » 2008-4-21 @ 07:43

what does the error mean exactly?

This is the default callback handler, means that irq7 was not hooked by
the game (at the moment when the irq7 is executed).
Maybe add a dummy handler that issues an out 20,20 to acknowledge the irq.
wd
DOSBox Author
 
Posts: 10818
Joined: 2003-12-03 @ 21:23

Re: IBM PS/1 Audio Card.

Postby jmk » 2008-4-22 @ 00:26

OK, thanks.

The interrupt routine was trying to loop a sample by calling the "play sample" function again, which was resulting in a flag bit (which I assumed to be "confirm that the audio card caused the interrupt") to be low when the IRQ was reentered, which resulted in it calling the old IRQ routine - which just happened to be the unhandled one.

Well, apart from some on-off clicks and a little bit of stutter on SQ4, I'd say that the PS1 Audio Card emulation was (un)officially "OK".

Tested on:
Prince Of Persia 2 (Interrupt-driven FIFO).
Space Quest 4 (Manually-fed FIFO).
King's Quest 5 (No DAC, just SN76496).

Space Quest 4 has the distinction of not having Tandy support, so it's the only one that gives you (sort of) something new. :cool:
jmk
Newbie
 
Posts: 34
Joined: 2008-4-13 @ 10:50
Location: Paisley, UK.

Re: IBM PS/1 Audio Card.

Postby Servo » 2008-4-23 @ 14:48

jmk wrote:Space Quest 4 has the distinction of not having Tandy support, so it's the only one that gives you (sort of) something new. :cool:
If you want to hear Space Quest 4 with Tandy sound this is supported in the 16 color version of the game; from memory I think it also worked fine if you copied the drivers from the 16 color version to the 256 color version. I've always wondered what the PS/1 audio card sounded like, it's one of the few sound cards I haven't heard in action!
User avatar
Servo
Newbie
 
Posts: 65
Joined: 2005-9-28 @ 14:38

Re: IBM PS/1 Audio Card.

Postby jmk » 2008-4-24 @ 00:59

Servo wrote:If you want to hear Space Quest 4 with Tandy sound this is supported in the 16 color version of the game; from memory I think it also worked fine if you copied the drivers from the 16 color version to the 256 color version.

Ah, I didn't know about that one. Scratch the "original content" idea. :blush:

I've now tested it on the following:
    Prince Of Persia ("ibmg" on command line - SN + DAC) - OK.
    Prince Of Persia 2 (SN + DAC) - OK.
    Bard's Tale III (SN - opening title) - OK.
    Space Quest IV VGA (SN + DAC) - OK, occasional stutter.
    King's Quest V EGA (SN) - OK.
I've also found some play & record VOC programs that someone made, so I'll have a look at them as well.

Servo wrote:I've always wondered what the PS/1 audio card sounded like, it's one of the few sound cards I haven't heard in action!

Erm, sounds a bit like a Tandy... with a DAC. :sweatdrop:

The FIFO method plays sounds as clearly as the SB, but taking a bit more CPU time (but still quite a bit less than direct I/O). I'll stick a build on a patch thread soon, assuming that's the correct course of action around here.
jmk
Newbie
 
Posts: 34
Joined: 2008-4-13 @ 10:50
Location: Paisley, UK.

Re: IBM PS/1 Audio Card.

Postby jmk » 2008-4-27 @ 00:49

OK, time is a bit limited for me (at the moment) so here is a build...

dosbox.conf accepts the following new fields for this version:

ps1audio=true
ps1audiorate=22050

These two activate the IBM PS/1 Audio Card. It is always situated at ports 0200, 0202-0204, so there's no need for a "base" value.

machine=AMSTRAD

This activates the Amstrad PC1512 video mode (640x200x16) - an extension to standard CGA, for the handful of software that can actually use it... Some occasional glitchy issues, possibly BIOS text problems to blame.
Attachments
dosbox_ps1_amstrad_experimental.zip
IBM PS/1 Audio Card and Amstrad PC1512 video mode WIP version.
(681.6 KiB) Downloaded 945 times
jmk
Newbie
 
Posts: 34
Joined: 2008-4-13 @ 10:50
Location: Paisley, UK.

Re: IBM PS/1 Audio Card.

Postby ih8registrations » 2008-4-27 @ 01:20

To mimic a standard internet meme; source, or it didn't happen.
ih8registrations
Oldbie
 
Posts: 931
Joined: 2003-7-25 @ 17:20

Re: IBM PS/1 Audio Card.

Postby jmk » 2008-4-27 @ 12:24

Ah... :sly:

Here's a quick grab of the "unabridged" src dir.
Attachments
dbps1am_src.zip
Quick grab of the src dir of PS/1 and Amstrad first build.
(991.41 KiB) Downloaded 916 times
jmk
Newbie
 
Posts: 34
Joined: 2008-4-13 @ 10:50
Location: Paisley, UK.

Re: IBM PS/1 Audio Card.

Postby Myloch » 2008-5-22 @ 15:17

Oh fuck... you're THE MAN Jmk... I waited for Ps/1 soundcard emulation for AGES!!! I'm so happy that I'm crying :D I had an IBM PS/1 386sx 20mhz when I was a child and now finally I can play again Silpheed and Bushbuck with decent music/sound. Note: other games that supported Ibm ps1 card were Roger Rabbit and Rocketeer (and maybe some other Disney software). Thank you thank you thank you, ps/1 emulation works great (except some minor problems):

TESTED GAMES:
King's Quest 5 (very good)
Silpheed (good - some random corrupt/static sound)
Prince of persia 1 (very good - disable other sound cards to avoid adlib music loops when you kill first enemy at level 2, maybe other bugs)
Prince of persia 2 (very good - even with ambient music activated, you can hear Ps/1 music only during intro, intermissions and when you die. I'm not sure this is a bug!)
Rocketeer (good - random sound skips/repete, pitch is too high)
Roger Rabbit (good - same problems as rocketeer)
Stunt island (good - same problems as rocketeer)
Bushbuck (good - sound pitch/speed is too low)

The pitch/speed problem is weird: some games seem to have too high pitch, others too low.
By ear, memory and confronting with pc speaker, adlib and sb counterparts, pitch should be approximately +1st and speed +3% (for Bushbuck)
For Rocketeer (and probably also Roger Rabbit and Stunt Island) speed is correct but pitch should be -1st.

Keep up the good work! :)
Last edited by Myloch on 2008-5-24 @ 19:15, edited 1 time in total.
User avatar
Myloch
Member
 
Posts: 401
Joined: 2007-4-18 @ 22:13

Re: IBM PS/1 Audio Card.

Postby jmk » 2008-5-23 @ 21:45

One happy customer. :wink:

Thanks for the testing, I've found that Stunt Island and Roger Rabbit 2 read port 0203 for proper detection. (Gets rid of the "I can't find the card, force it?" question on the installer).

Also, Bush Buck reads ports 0205 and 0206 and expects both to return 0 if the PS/1 card is present.

Prince of Persia is a strange one. I wonder if it could happen on the real thing? V1.0 of the EXE will play Adlib music with PS/1 samples, if it detects both, whereas V1.3 of the EXE will use PS/1 music with PS/1 samples, even if the Adlib card is present.

Skipping and repeating are still issues I need to figure out, but hopefully I will.
jmk
Newbie
 
Posts: 34
Joined: 2008-4-13 @ 10:50
Location: Paisley, UK.

Re: IBM PS/1 Audio Card.

Postby Myloch » 2008-5-24 @ 09:25

Made other tests and I'm pretty sure that SN76496 music generated pitch and speed for Bush Buck are wrong: they should be "pitch +1 st" and "speed +3%".
No problems with Prince of persia 1 and 2 (100% correct SN76496 and DAC). Another situation for King's Quest 5 and Silpheed (100% correct SN76496 but wrong DAC pitch, 1 semitone too high). Again another different case for Rocketeer and Roger Rabbit (wrong DAC pitch, it should be -1st)
very strange behaviours!!!

I have a very good musical ear and I played all these games on a real Ps/1 with audiocard for so many years that I'm pretty sure about what I'm saying. :)

I used ctrl-f6 to record wav files and Audioretoucher 3.1.2.13 for my tests.

And yeah, prince of persia 1 is a strange one: the adlib music loop is not necessarily a dosbox bug, it can also be a game bug.
User avatar
Myloch
Member
 
Posts: 401
Joined: 2007-4-18 @ 22:13

Re: IBM PS/1 Audio Card.

Postby Neville » 2008-5-24 @ 18:33

Sounds interesting. Will this be on the next official version?
User avatar
Neville
Oldbie
 
Posts: 968
Joined: 2004-8-09 @ 14:01

Re: IBM PS/1 Audio Card.

Postby jmk » 2008-5-25 @ 01:02

Here is a new version which fixes skipping/repeating (bug in FIFO_FULL flag) and reduces "pops". Detection is better (as mentioned in a previous post) so it should help in certain cases where a game would decide to use the internal speaker for sample playing instead (e.g. Stunt Island).

Further testing is, of course, appreciated. :happyhappy:

Neville wrote:Sounds interesting. Will this be on the next official version?

That's up to the maintainers. :wink:

The one source file that has changed since the previous source attachment is included in the zip.
Attachments
dosbox_ps1_amstrad_experimental2.zip
(687.59 KiB) Downloaded 865 times
jmk
Newbie
 
Posts: 34
Joined: 2008-4-13 @ 10:50
Location: Paisley, UK.

Re: IBM PS/1 Audio Card.

Postby jal » 2008-5-25 @ 08:08

Myloch wrote:very strange behaviours!!!


If it is exactly +/-1 semitone, one would almost think (without having any knowledge of the PS/1 audio card) that there's some register one can set a semitone offset or something. But I doubt jmk would have missed that...


JAL
User avatar
jal
Member
 
Posts: 494
Joined: 2004-1-02 @ 15:30
Location: Amersfoort, Netherlands

Re: IBM PS/1 Audio Card.

Postby Myloch » 2008-5-25 @ 11:16

yes this is a mistery. I dunno if it's like Jal said because some games seem correct and I cannot be 100% sure the difference is exactly 1 semitone.
In Bushbuck the problem is more evident and it has obviously something wrong.

I'm looking for some old tape recordings of Ps/1 songs I made when I was a little child (yes, I was a crazy maniac), if they are not lost in time, that could help.

Dunno if it can help jmk, I have got some old ibm hardware pieces (one of them is the ps/1 audio/joystick card), I can snap some hires photos of the board front/back and post them here.
User avatar
Myloch
Member
 
Posts: 401
Joined: 2007-4-18 @ 22:13

Next

Return to DOSBox Development

Who is online

Users browsing this forum: Peter Swinkels and 3 guests