Friday, December 16, 2022

The strange case of BeOS, SRS and the silent Power Mac 6500

Tonight's story time: the Power Macintosh that wouldn't make any sound in BeOS R5, how I figured out the problem, and how I hacked the sound driver to fix it. (Download link at the end.)

My favourite beige Power Mac is the Power Macintosh 7300 and its relatives. They're compact, capable, upgradable and easy to work on. For as much as people raved about the pull-down side door of the Yosemite G3 and the Power Mac G4, they owe their design to their fold-out Outrigger Power Mac ancestors which did it all and did it horizontally — and in some ways did it better.

However, when it came time to setting up a second PowerPC BeOS system to go with my 133MHz BeBox (the two run the same applications), although the Outriggers are well supported in BeOS 5 I decided to get a tower Mac for space reasons. Since NuBus, G3 and New World Macs were out (not compatible with BeOS) there's only a few choices, namely the 8500, 8600, 9500, 9600 and the 6400 and 6500. I despise the 8500 case (I only tolerate my clock-chipped Quadra 800 in the same style because it runs A/UX so well), the 8600 is bulky, and while all beige Power Macs have succumbed to the general price inflation that has afflicted every corner of vintage computing, the 9500 and 9600 6-slot Power Macs have really taken it on the chin (and the 9600 is bulky too).

That left the Insta-Towers, or what I like to call the Stormtrooper Macs:

Meet the Power Macintosh 6500/275. The Insta-Tower Macs started with the 1997 Power Mac 6400 and were intended as home Macs (the 6400 was separately rebadged as the only mini-tower Performa, and along with the 6360 and the All-in-One 5400 was the last Mac model to bear the Performa name). Their non-pro deficiencies include a relatively low RAM ceiling for the time (136MB, counting the 8MB on the board), a non-upgradable 603e CPU (though companies like Sonnet eventually made G3 upgrades for the L2 cache slot) and only two official PCI slots (the Communication Slot II is PCI-like and has PCI lines for Ethernet NICs, but isn't mechanically compatible and has additional lines for modem cards). On the other hand, it came with built-in good-enough 2D "Valkyrie" video and a 28.8kbps modem in the Comm Slot (though this locks out the serial port until the card is removed, and a plug shipped from the factory covering it up), plus remote control, video input and TV/FM tuner card options, and arguably the best audio on any pre-G3 Power Mac due to onboard SRS surround and its built-in subwoofer (enabled if external speakers are connected).

The 6400, the AIO 5400 and the closely related 6360 are based on Apple's Alchemy logic board, and they are all listed as supported in BeOS. For the 6400's follow-on, however, Apple made several significant changes to what would become the 6500: no RAM on board (so a lower RAM ceiling of 128MB), a built-in 3D accelerator (an off-the-shelf ATI 3D Rage II) and a much faster selection of 603e CPUs up to 300MHz, which Apple alleged as being the first personal computer to do so. The enhanced audio and tuner options, however, were maintained. Early 6500s had defects with their video circuitry that caused jittery or blurry video, and some shipped with incompatible L2 cache DIMMs; conversely, the last-of-the-line 300MHz 6500 is reportedly quite a rare bird. Apple called the new logic board Gazelle, which apparently had at least one subsequent revision (but we're getting ahead of ourselves), and used it for the functionally identical AIO 5500 and the Twentieth Anniversary Macintosh. The 6500/300 was the final Insta-Tower as all of the four digit Power Macs were subsequently replaced by the beige Power Macintosh G3 except the 9600.

Gazelle is similar enough to Alchemy that Be believed it would work with the BeOS, but didn't get around to testing it, hence marking it as "Unsupported but Compatible" in their model matrix. I settled on this 6500/275 because it was clean, it was (unnecessarily, but why not) recapped, 275MHz would be an obvious upgrade over 133MHz, it had 128MB of RAM already and came with an iXmicro Twin Turbo 128MA, a better 2D card for BeOS (BeOS for Power Macs has no 3D accelerator support), and a third-party 1MB L2 cache stick (the 275MHz came with 512K). With that in mind the price the seller wanted wasn't outrageous, so I gritted my teeth and bought it. Plus, even though I already have a Gazelle Mac in the form of my Twentieth Anniversary Macintosh, I didn't have any Insta-Towers in my collection, and the people I consulted with reported theirs worked fine.

Much to my irritation and contrary to the way it was described, the machine arrived in somewhat less than pristine condition. The subwoofer volume control knob was loose and didn't actually turn the control (good thing I wasn't planning to use it), one of the feet was missing, and it needed a good general scrub. I had some spare 6400 feet in my box of junk (one just acquires these things after many years with old Macs) and wiped it down, and then turned to getting it suitable for dual-booting.

The front panel comes off to reveal the drives mounted on chassis sleds. The 6500 uses an PATA IDE disk, so I replaced the 4GB drive it had with an old 20GB from a Power Mac G4, giving me comfortably way more space than needed to run Mac OS and BeOS.
The other upgrade I did was to replace the modem with a Comm Slot II Ethernet card from my stash (the spare for my TAM, which also has a Comm Slot II). This is an Apple Ethernet CS II Twisted-Pair card (820-0784-A) based on the DEC Tulip 21041. BeOS supports NICs with this chip and will see the Ethernet card as "PCI" (because of the Comm Slot II's PCI lines).
Parenthetically, the motherboard for these units is on a pull-out drawer (a single screw prevents irresponsible housemates from yanking on it, but I didn't bother putting the screw back in since a friction fit holds fine). Assuming you don't need to get deep into the chassis this makes installing RAM and cards very easy. This unit has the video input option but not the TV tuner option, which would go behind the plate on the top right. The motherboard ATI video is via a separate DA-15 connector above the serial number bar code in this view; the Twin Turbo is in the PCI slot not visible here. We'll come back to the logic board presently.
BeOS needs a Mac OS partition to start the system (like MkLinux and A/UX). It can either be launched from a boot extension (the typical way) or from a launcher application in the Finder, which is also how you start the BeOS installer from CD. This puts the PowerPC back into supervisor mode, shuts down the Mac OS, and starts the BeOS kernel. The undocumented manner in which it achieves supervisor mode is not compatible with Mac OS 9, requiring 8.6 or lower (a better choice anyway without a G3 CPU). I partitioned it into two 1GB partitions, one to have a clean BeOS install as an emergency boot and one with a plain HFS (not HFS+) filesystem as an interchange volume since BeOS doesn't understand HFS+, plus a 4GB HFS+ partition for Mac OS and the rest for the main BeOS partition. Then I installed Mac OS 8.6.
Mac OS booted and ran fine, including the startup bong and all system sounds, ahem, so next was installing the BeOS. Initially I used the BeOS R5 disc that came with my BeBox (this detail will be important shortly). Although the BeOS Launcher and OS Chooser extension seem to lack resource forks on the CD, they "get fixed" when you copy them over to the Mac. With the BeOS CD in, I started the BeOS Launcher from the Finder.
The entire install with "everything" is just 225MB. Remember when that was a lot?
Selecting BeOS from the OS Chooser (the extension was not updated after R4.5).
And into the BeOS desktop. But as I clicked around and worked with the system a bit, there was something odd going on: it was silent. The Media preference showed what looked like standard Mac sound input and output, but it was absolutely mute. Even more odd was that when I tried to play even the BeBeep.wav and BeStartup.wav that came on the disc, Media Player complained it couldn't even decode the file.

I compared the decoders and extractors with the ones on my BeBox and they were the same and intact, since they both came from the same disc (the BeBox plays audio fine). I went ahead and updated the 6500 to BeOS 5.0.3, and the installation was successful, but there was still no audio and still no functioning Media Player. I plugged in headphones in the front and back to see if there was any difference, and there was, but only slightly: with the headphones in the front jack, there was the tiniest pop in my ears when I muted and unmuted the sound output, so at least something was working. Someone on Twitter had a similarly mute TAM, which is also a Gazelle board. However, my own TAM (with a 500MHz G3 L2 card) runs 9.2.2, so it wouldn't be able to boot the BeOS CD, and I had no interest in trying to set up a new drive and installation just for this. It seemed like there might be a way to make the internal speaker work.

Sound on pre-G3 Power Macs was generally based on some version of the AWACS (or AWAC, or AWACs, depending on document) chip, standing for Audio Waveform Amplifier and ConverterS (not to be confused with the military surveillance and command plane). AWACS descends from the Singer chip used in later 68K Macintoshes and internally incorporates the Waveform Amplifier Chip, thus the name. It exposes a set of control registers and plays audio stored in various formats via DMA. By the time of the beige PCI Power Macs, the AWACS was hung off Grand Central I/O (not to be confused with the stations or the later Apple programming technology), which among other functions serviced interrupts and the system bus, and for AWACS handled its bus interfacing for DMA and PCI devices sending audio. The control registers are accessed through Grand Central's I/O range. Grand Central evolved into O'Hare in later Power Macs (not to be confused with the airport), which was functionally identical but consolidated several other chips internally; AWACS proper, however, was still a separate IC and handled in the same fashion. AWACS and its supporting electronics remained relatively unchanged over the life of the Old World Power Macs until the beige G3's Screamer chip, an upgraded AWACS with a new name (not to be confused with the horror movie with the letters E and R added at the end), which itself was replaced by a variety of successor chips in New World Macs.

The 6500/275 logic board looks like this with the Twin Turbo video card removed. The two RAM DIMMs and the L2 cache DIMM are at the top and the 603e is under the active cooler in the centre with the ATI 3D Rage II GPU to its right. The solder pads south of the L2 cache DIMM were for a ROM socket which is not in production models; the actual ROMs are south of that. The velcro pad is for the 4.5V PRAM battery (Ray-O-Vac 840 or equivalent) which is not needed to boot, and can easily be replaced with the equivalent number of AA batteries.

AWACS on the 6500 is the small IC in the lower left corner. It is generally marked 343S0140 or 343S0150; this one is 343S0150-B (National Semiconductor part# S9706AL). The O'Hare I/O chip is the big Lucent IC above it marked 343S0172.

On the back side of the logic board the largest chip is the 343S0065-01 PSX+, marked with a Texas Instruments logo. This is the CPU-PCI bridge chip (the processor bus runs at 50MHz, but the PCI bus runs at 33MHz), and also provides control and timing signals for system cache, ROM, and RAM. The memory control logic supports byte, word, longword and burst accesses to system memory, and can translate unaligned memory accesses into equivalent multiple bus transfers. A mystery chip at the top left is the Orbit chip (343S0014), but its location near the slot for the video input card on the other side suggests it might serve as its bus interface. There are solder pads for motherboard RAM but obviously no RAM is present.

BeOS on x86 has lots of sound card support, but there are just two drivers on PowerPC BeOS, namely AWACS and S3 Sonic Vibes (yes, that S3, the graphics chip makers). Since AWACS wasn't working, my first attempt was to locate an S3 Sonic Vibes PCI card and put it in. Mac OS didn't use it and neither did BeOS. Later I found out that this is because it was only designed for the BeBox (which doesn't have an AWACS) and requires kernel support for the joystick port, which the Power Mac kernel doesn't have.

After spinning my wheels with that and fruitless fiddling with settings, I heard from another 6500 owner with a 250MHz CPU whose audio seemed to work just fine. However, they used the Gobe 5.0.3 Professional Edition CD (the PowerPC version was never available in the free Personal Edition format). This has different media add-ons than the BeBox release I was using.

Having nothing to lose, I went ahead and wiped the BeOS partitions and installed the Gobe version of BeOS 5.0.3. Amazingly, the new decoders actually did try to play stuff now, but the 6500 was still silent ... until I listened with headphones again. The audio was scratchy and awful, but it was recognizable! It was at the right speed, so the sample rate was right, and it was recognizable enough that it probably wasn't a sample size or endianness issue. This suggested that the problem wasn't DMA but rather in the way the BeOS AWACS driver was controlling the sound output.

Classic AWACS has five registers (Screamer has eight). I should note for this discussion before anyone under an Apple NDA starts hyperventilating that all of this can be derived from existing open source descriptions such as the Linux AWACS driver or even Apple's own drivers. In beige PCI Power Macs these registers are part of Grand Central/O'Hare's address range with 16-byte alignment. The control register (0) handles gain, input and subframe control; AWACS supports up to four subframes of audio. The codec control register (1) sets sample rates and outputs, the codec status register (2) provides chip status on reads such as identifiers and the state of the headphone jack, and on writes line out and headphone (output "A") channel volumes, the clipping count register (3) provides the number of clipping events that occurred and the output attenuation control register (4) sets channel volumes for the internal speaker (output "C") plus bits for controlling byteswapping of sample data in later versions.

I went with the Linux AWACS driver as a model since it has specific support for beige Power Macs, but it does a lot of messing around on its Power Mac 5500 specific path. After puzzling over this for awhile, it dawned on me that this was all irrelevant for BeOS, since it handles its own mixers rather differently. Most likely we wanted to look at how the AWACS driver writes to either registers 1 or 4, since those control outputs and the internal speaker levels.

To make sure we were still dealing with a "real" AWACS and that Apple hadn't snuck in a differently behaving part, the first order of business was to actually identify what was there and see if this triggered different codepaths in Linux. At this point I altered the BeOS AWACS driver binary to emit the manufacturer and revision. When classic BeOS debug mode is turned on, this (and other debugging output) is sent out the serial port at 19200bps 8N1. Since we have already removed the 6500's modem and the serial port is thus no longer locked out, I popped out its factory-shipped plug and got a Mac printer cable out from the box of junk (the beige Mac equivalent of a null modem cable).

Our sidecar terminal will be the recently refurbished PowerBook 1400 running ZTerm. To start the BeOS kernel in debug mode, we hold down Delete on the keyboard until we start seeing output (but not so long that the Mac goes into the boot device menu).
The traceback shows this to be a manufacturer 2 and revision 2 (both values are stored in register 2). I don't know what that refers to exactly, but it proves the BeOS driver loads and neither is a value the Linux driver seems to be looking for, suggesting any oddity about the chip is external to it. There are other values the Linux driver checks for but these appear to be derived from Open Firmware properties and there's no obvious facility in the driver binary to do that, so I started taking a few shots in the dark.

My first attempt was another hack to the BeOS AWACS driver to show what values were being passed into the routine that sets register 4. Register 4 controls the channel volumes for output "C" which is the internal speaker. That came up with normal appearing values and hacking it to force it to a particular value, even the maximum amplitude, didn't make any sound. For obvious reasons I reverted this.

My second attempt was to look at how the BeOS AWACS driver initialized the chip. The Linux driver has a comment that "looks like MASK_GAINLINE triggers something, so we set here as start-up" [sic]. I changed the initial value the BeOS AWACS driver pushes to register 0 to be exactly what the Linux driver does. It sounded a bit better in the headphones, maybe placebo effect, but the speaker was still silent. I kept it anyway because it was probably more correct than what was there previously. While snooping around what sets register 0 I also found a bug that set the mic gain wrong and fixed that too, though obviously that wasn't the problem I was trying to fix.

My third attempt was to look at the outputs when it set register 1. There are two bits that the Linux driver marks as "Parallel Out (???)" and "Parallel Out (enable speaker)." Those notations make it sound suspiciously like a third output, but the BeOS AWACS driver doesn't ever set them, potentially explained by this comment in the Linux AWACS driver: "Only machines with external SRS module need MASK_PAROUT." Well, we have SRS audio — maybe the whole problem is we're one of those systems with an external SRS module. So everywhere that set register 1 (except for muting everything when the driver shuts down), I made it set the parallel output bits. Bam! The speaker works! The best part is, because the BeOS mixer handles outputs manually (e.g., plugging in the headphones does not automatically mute the speaker), muting worked without having to squeeze in any code to read the state of the headphone jack.

Now our remaining problem is the audio quality. On my BeBox I have Real-Time Audio enabled in the BeOS Media preference because that really helps on its much slower CPUs (it does have plenty of memory, after all), and I had set it here expecting the audio to similarly improve. Spoiler alert: for reasons unclear to me, this option makes the audio worse on the 6500, possibly other Power Macs. In fairness, the Media preference says you shouldn't turn it on unless you absolutely need the lowest-latency audio possible, and indeed on my long list of things I do not need is low-latency audio that sounds like an emasculated chainsaw.

This improvement was nevertheless not nearly enough for my tender discriminating ears. Remember that we have SRS audio. SRS audio can be turned off from the Monitors & Sound control panel in Mac OS:

I did that, and the audio got even clearer. (Maybe something to consider for your 6400 with scratchy audio too?) This setting sticks because BeOS requires Mac OS to boot first and SRS gets turned off as part of the boot process.

But it still wasn't clear enough! There are two parallel output bits. I tried setting the "???" bit and got no output, but (naturally) "enable speaker" worked, and sounded a little clearer still.

And, well, that's as far as I could go at this point. The audio is much less scratchy and definitely listenable, but it's that last little bit that was still bedeviling me. We know the caps are good because they were (unnecessarily) replaced. We know the chip is fine because audio is fine in Mac OS. But bouncing the media server up and down (by restarting it from the Media preference) does, if you hit it right, yield perfectly clean output.

I don't have a theory for why this is. If the media server were being starved for data, you would expect Real-Time Audio to make the problem better, not worse. If it were a problem with clipping or overdriving, it should be consistent at certain volume levels, whereas even if you crank down the audio to barely audible you can still hear cracks and pops now and then. Oh well! With this hacked driver I now have audio on the built-in speaker! I (mostly) win!

At some point I'd like to dig into the media server and get the output even nicer. It's still possible it could be another driver issue yet to be discovered, though since the BeBox can also sound scratchy and the Power Mac can sound perfect, I'm not entirely convinced the driver is further at fault at this point.

As our theme music plays over the closing credits (with a minimum of distortion), what have we learned?

  • There appears to be a difference with later 6500s (and other Gazelle systems, presumably) where the internal speaker goes through the AWACS' parallel output. If the Linux driver's comments are accurate, this is because they have an external SRS module. This is different from the 5400, 6360, 6400 and earlier 5500s, 6500s and TAMs.
  • BeOS may not handle systems with SRS audio correctly. Turn it off from Mac OS if you have bad sound.
  • BeOS' Real-Time Audio is not a panacea on Power Macs. Turn it off if you have bad sound.
  • Scratchy audio can just as easily be software as it can be capacitors. Prophylactically replacing capacitors not proven to be defective runs the risk of wrecking your logic board, even if that risk is small in the hands of someone experienced with soldering. Why not rule out other problems first instead?

The AWACS 6500 BeOS driver is a hacked version of a BeOS system driver. It is issued without the permission of ACCESS Co., Ltd., the current owners of the intellectual property of the former Be, Inc. and the Be Operating System, who retain any residual unexpired copyright, trademarks and patents upon it. This driver is offered in binary format only and its public availability in no way implies the tacit, implicit or explicit approval of ACCESS Co., Ltd. of its use or distribution. Your use of this driver accepts all potential legal eventualities for doing so, however remote or unlikely, and that THERE IS NO WARRANTY, NOT EVEN AN IMPLIED WARRANTY, OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. YOU USE THIS DRIVER AT YOUR OWN RISK.

The AWACS 6500 BeOS driver is available via Gopher at Be-Power, or see more PowerPC-compatible BeOS software. Be sure to read the instructions before installing!

2 comments:

  1. In about 1998 my friend got what I think was a Performa 6400/180, while I had a lowly 33mhz 486 PC at home. His looked very similar to this.

    This was the fastest computer I had seen at this time. Remember seeing Quake and other games on this. Also he installed BeOS from a magazine CD. FWIW from my old memory I am pretty sure sound worked in BeOS on his machine.

    Thanks for a fun trip down memory lane. :)

    ReplyDelete
  2. Man, I kid you not... I'm so mad right now.

    I bought back from a friend, cca 2003, a lovely, mint 6500/300, with matching 15AV monitor, plaintalk mic, the awful keyboard-mouse standard ADB combo.

    It was my main Mac until I got a G4 733 DA from my job that was going bankrupt cca 2005 and my mom used the 6500 as her main pc as long as she could log into bank ~2008.

    It even had the nicer Zip drive bezel, and I upgraded it with 128MB RAM, Radeon 7000 and commslot ethernet.

    I moved to Europe in 2009 and left my 6500 at my grandfather's. At some point, someone connected it to the wrong voltage blowing the PSU. I couldn't afford shipping it to Europe and he ended up getting rid of it... =(((((((((((((

    I run Haiku regularly and would love to have the 6500 back and try BeOS... =((

    Shiunbird

    ReplyDelete

Comments are subject to moderation. Be nice.


See more of my general vintage computing projects,
mostly microcomputers, 6502, PalmOS, 68K/Power Mac
and Unix workstations, but that's not all. Be kind, REWIND and PLAY.

Buy Me a Coffee at ko-fi.com

Old VCR is advertisement- and donation-funded, and what I get
goes to maintaining the hardware here at Floodgap.
I don't drink coffee, but the Mr Pibb doesn't buy itself. :-)
Thanks for reading. -- Cameron Kaiser