Sunday, June 2, 2013

IBM PCjr. and Tandy 1000 Sound : Multiplexer Weirdness

In the original sound system design for the IBM PCjr., there could be four sources of audio, the 8253 Timer-driven PC Speaker, the 3 Voice TI SN 76496, the Cassette input or an adapter on the bus like the IBM PCjr. Speech Attachment Sidecar.  IBM set aside two bits in the 8255 Programmable Peripheral Interface at I/O Port 61 to control a multiplexer which would determine the source to be used.  The bits used were 5 & 6, and here is what they controlled :

Bit 6  Bit 5
0       0       PC Speaker (Default)
0       1       I/O Channel Audio In (PCjr. Speech Attachment)
1       0       Cassette Audio Input
1       1       TI SN76496 3 Voice

Pretty logical.  An important point to note that this multiplexer only controlled the output to the external audio RCA output jack, the RF output connector or the PCjr. Monitor connector for an IBM 4863 PCjr. Display with built-in speaker.  The PCjr.'s internal beeper would only output PC Speaker Audio, doubtless IBM felt it was too tinny for anything else.

When Tandy cloned the PCjr., this arrangement served them just fine for the Tandy 1000 with two exceptions.  Since the 1000 did not support a cassette interface, the setting for the Cassette Audio Input sent nothing to the external audio RCA output jack.  However, they decided to engineer the outputs very differently.  The TI SN 76496 has an audio input pin which can mix an external audio source with the 3-voice sound the chip itself is producing.  On the PCjr., this pin is unconnected.  On the 1000, it is connected to the PC Speaker input.  Then the mixed audio is sent to the internal speaker and to the multiplexer.  Thus the bits operate as follows :

Bit 6  Bit 5
0       0       PC Speaker (Default)
0       1       I/O Channel Audio In
1       0       Nothing
1       1       PC Speaker + TI SN76496 3 Voice

No known device actually sent audio over the ISA bus, so the I/O Channel Audio In is effectively a "nothing" selection.  The Tandy 1000 had a very large internal speaker, so the PC Speaker and 3-Voice sound is done justice.  However, the internal speaker cannot be turned off without physically disconnecting it from the pins on the motherboard..

Thinking that inability to turn off the internal speaker was a bad thing, Tandy decided to make the multiplexer more complex in the SX and EX series.  They added a third bit which is intended to turn the internal speaker off if set to 1.  Tandy refers to these bits as follows :

SNDCTRL0 = Bit 5 of 8255 Port B / Connects to MC14529 Pin 6/"A"
SNDCTRL1 = Bit 6 of 8255 Port B / Connects to MC14529 Pin 7/"B"
SNDCTRL2 = Bit 4 of 8255 Port B / Connects to MC14529 Pin 15/"STy"

The internal outputs were thus made more complicated :

Bit 6  Bit 5  Bit 4       Internal                                                      External
0       0       0             PC Speaker + TI SN76496 3 Voice         PC Speaker (Default)
1       0       0             PC Speaker + TI SN76496 3 Voice         Nothing
0       1       0             I/O Channel Audio In                                I/O Channel Audio In
1       1       0             PC Speaker + TI SN76496 3 Voice         PC Speaker + TI SN76496 3 Voice
0       0       1             Nothing                                                     PC Speaker
0       1       1             Nothing                                                     Nothing
1       0       1             Nothing                                                     I/O Channel Audio In
1       1       1             Nothing                                                     PC Speaker + TI SN76496 3 Voice

Thus if a program sets Bit 4, the best you would hear from the external speaker would be the PC Speaker sound.  The SX's multiplexer is wired to have two outputs, one for the RCA jack and another for the internal speaker.  The EX's multiplexer has only one output wired, and it goes to an earphone jack and the internal speaker.  By default the audio is heard through the internal speaker, but plug in a mini-jack and the audio is switched to whatever is plugged into the jack, headphones or external speakers.  However, the the portion of the multiplexer the EX uses is controlled by Bit 4, so if that bit is set you will have the same problem as on the SX.  You will also have the same problem if a program sets bit Bit 5 without setting Bit 6.  If Bit 6 is set without Bit 5, you will get no external audio output on the SX.  The SX has a potentiometer inside the machine that can control the internal speaker's volume, but the EX has a volume wheel on the outside.

The HX, TX, TL, SL and later systems also have headphone jacks with external volume wheels.  However, Bits 5 & 6 do nothing in the HX, and in the TX and the other systems bit 5 has no function while bit 6's function is completely different.  Only bit 4 functions in these systems.  In addition, I/O Channel Audio In is no longer supported.

Since I have an SX, I can discuss its multiplexing scheme.  The default value for I/O port 61 on bootup is 08.    This means that Bits 4-6 are 0.  The external output will only output PC Speaker sound.  This is generally not desirable, and Sierra's games will enable the external audio.  After exiting from a Sierra game, the value for I/O port 61 is now 68.  The program has set bits 5 & 6.  LucasArts games will not enable the external audio output on the SX, so the simplest solution is to run a Sierra game before hand.  There is a program called tdyspkr.com that will allow you to make settings designed for the SX or easily allow you to manipulate the bits yourself.

3 comments:

Aybe said...

Your posts are extremely interesting, keep it up !

Best regards

Anonymous said...

Very interesting stuff. One issue though, either I'm confused or the chart detailing the Tandy 1000 SX/EX modes has some errors. Mode 011 is described twice and 001 is not described at all. If I'm reading this right, the external speaker behaves the same as in the older 1000s with bits 6 and 5, ignoring bit 4, and the internal speaker is mute if bit 4 is set, IO channel if bit 6 is 0 and bit 5 is 1, and PC speaker + SN76496 otherwise. Does that sound right?

Great Hierophant said...

This is a reply to a comment that was somehow wrongly filtered out by the spam filter. The original comment was :

Very interesting stuff. One issue though, either I'm confused or the chart detailing the Tandy 1000 SX/EX modes has some errors. Mode 011 is described twice and 001 is not described at all. If I'm reading this right, the external speaker behaves the same as in the older 1000s with bits 6 and 5, ignoring bit 4, and the internal speaker is mute if bit 4 is set, IO channel if bit 6 is 0 and bit 5 is 1, and PC speaker + SN76496 otherwise. Does that sound right?

My response :

The 011/001 error has been fixed, and you have it right otherwise.