ATARI 8-BIT IN STEREO #2

By Frankenstein

In issue #2 we published the document from Chuck Steinman about 'How to install a second Pokey chip'.
Since I tried this myself, I will tell you more about the hardware details and how to modify/create software for this great gadget.


HARDWARE:

At first I thought it would be rather difficult to create this gadget, but after reading the article carefully I discovered that it was actually very easy, so I could do it myself.
In fact I got the idea to add a switch, so I could switch between stereo-stereo or mono-stereo. More about this later..

I used the following parts:

- Pokey chip (CO12294)
- 74LS14 inverter IC
- 1000 Ohm resistor
- Two RCA stereo jacks
- Two 100nF capacitors
- Some shielded audio cable
- double-polar select switch

The inverter and Pokey information is clear enough (see issue #2).
Instead of leading the Pokey audio pins directly to two jacks, I first lead them to one side (3 contact points) of a switch. Just watch the diagram on side two.
With help of the switch you can select from two systems:

1. stereo- stereo. This is exactly how Chuck described it, old pokey pin 37 to the left jack and new pokey pin 37 to the right jack. Now you can write your own four channel stereo music or sample player!

2. stereo- mono. The problem of stereo- stereo is that if you play music or samples which are not modified or specially made for the stereo upgrade, you will hear these sounds only from the left speaker since normal software only uses the old pokey. By switching to stereo- mono, old pokey pin 37 will be lead to both audio jacks (left and right) and disconnect the new pokey.

Nothing more to say about the hardware. It works, so if you have the chance to get a second pokey, go ahead and install it!


SOFTWARE:

Let me first name the extra hardware registers you get when you've installed the second pokey:

Adr.  Name   Description
----- ------ ------------------
$D210 AUDF5  Audio #5 frequency
$D211 AUDC5  Audio #5 control
$D212 AUDF6  Audio #6 frequency
$D213 AUDC6  Audio #6 control
$D214 AUDF7  Audio #7 frequency
$D215 AUDC7  Audio #7 control
$D216 AUDF8  Audio #8 frequency
$D217 AUDC8  Audio #8 control
$D218 AUDCT2 Audio control #5-#8
$D21F SKCTL2 Serial Port Control

All registers work exactly the same as the normal 'old' pokey. Notice that the second pokey is located right above the old one:

OLD POKEY: $D200-$D20F
NEW POKEY: $D210-$D21F

As I said before, almost all software does NOT support the second pokey. It would be a real 'wow!' to have a program which does support editing four channel sound in stereo (that's 8 channels all together). Because I'm not much of a musician and I don't have enough time to learn it, I thought about a different way of using the upgrade which is modifying existing software for two channel stereo.
This can be done by searching all the 'pokes' in the old pokey and replacing all 'pokes' from two channels of the old pokey, into 'pokes' from two channels of the new (second) pokey!

But where there are answers, there are problems. Like you can 'poke' in much different ways:

STA $D200, STA $D201
STX $D200, STX $D201
STY $D200, STY $D201

or even with index like:
LDY #1
STA $D1FF,Y

which is ofcourse very hard to find (nice protection though).
Another problem is that some program (or most programs) link channels to have 16-bit sound or to insert a filter. According to 'Mapping the Atari' you can..

- join channels one and two to get 16-bit sound
- join channels three and four to get 16-bit sound
- insert a high pass filter into channel one, clocked by channel two
- insert a high pass filter into channel two, clocked by channel four

If the program doesn't use filters, you can simply throw channel one and two on the old pokey and channel three and four on the new (second) pokey.
If it uses a filter into channel two, clocked by channel four, you got a problem, since you've just shared those channels with the new pokey!
Fortunately this filter is not used in all music programs..

With this idea in mind I began to write a short program to update the best music program for the Atari 8-bit computer; SoftSynth!
The program needs an original SoftSynth program disk and it will update all three music play files. Because I only change the $D205 to $D215 and $D217 to $D217, the program won't act differently if you use an ordinary 'single pokey' computer (on a normal system $D210-$D2FF are duplications of locations $D200-$D20F).

This way it's also easy to modify the so called ZUPKGC musix. Examples of ZUPKGC music are; draconus, zybex, panther, bmx simulator etc. (all musix from the BIG demo music menu and probably a few more).
The programmer who made the play routine for these musix has been very friendly to us, because he only 'pokes' the sound channels at one point in the program. Several demo coders have taken advantage of this, by directing these 'pokes' to an equalizer graphic or something like that. So, why not direct two channels to the new pokey!?
Okey, I'll give you some tips about how to change such music files:

First search for a piece of program which looks like this:

          LDX #8
LOOP      LDA $xxxx,X
          STA $D200,X
          DEX
          BPL LOOP

Here the sound channels are 'poked'. Notice that $xxxx can be anything! It depends on where in memory the music player is located.
We replace this routine by:

          JSR NEWROUT
          NOP
          NOP
          NOP
          NOP
          NOP
          NOP
          NOP
          NOP

NEWROUT is our own routine to 'poke' both pokey chips. Without loops and things it would be like this:

NEWROUT   LDA $xxxx
          STA AUDF1     ; $D200
          LDA $xxxx + 1
          STA AUDC1     ; $D201
          LDA $xxxx + 2
          STA AUDF2     ; $D202
          LDA $xxxx + 3
          STA AUDC2     ; $D203
          LDA $xxxx + 4
          STA AUDF7     ; $D214
          LDA $xxxx + 5
          STA AUDC7     ; $D215
          LDA $xxxx + 6
          STA AUDF8     ; $D216
          LDA $xxxx + 7
          STA AUDC8     ; $D217
          LDA $xxxx + 8
          STA AUDCT1    ; $D208
          STA AUDCT2    ; $D218
          RTS

Notice that we poke the AUDCT of BOTH pokeys (AUDCT1 and AUDCT2). As far as I know the ZUPKGC musix doesn't use filters, but does link two channels to act like one 16-bit channel (Thanx Yeb for this info). So, it can happen that you hear two channels through the left speaker, and only one channel (16-bit) through the right speaker.

One thing must not be forgotten. The pokeys have to be initialized before you start the music (VBI). Normally the old pokey is already initialized by the OS, but after each I/O operation it needs to be re-initialized. Just insert something like this:

INIT      LDA #3
          STA SKCTL1    ; $D20F
          STA SKCTL2    ; $D21F
          RTS

Well, that it! I hope this will help you to update any program you like.
Please let me know which ones you updated so maybe we can publish more update progs in the future. How about arcade games in stereo!? Maybe more about this in the next issue..

Have fun!

PS: On side two you'll also find the Turbo Basic program 'WONDERS.TRB'. This is made to update the 'World of Wonders' demo containing music made with the SoftSynth program.


10 Note from the editor: GOTO 10