Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ampfix — speakers under Mac OS 9 on unsupported G4 Macs

Deutsche Fassung

On G4 Macs that only boot Mac OS 9 through the MacOS9Lives route, the headphone jack may play while the built-in speakers stay silent — or are barely audible. The cause: Mac OS 9 leaves the output amplifier switched off.

ampfix turns it on. Nothing is hard-coded — the pin addresses come from the device tree (Name Registry), so the same program runs unchanged on different models.

Four builds, one source

Build What it is
1.5 silent startup item, no window (80 KB) put this one in Startup Items
1.6 diagnostic tool with a window and a menu use this one to investigate
1.2 like 1.6, without the exact-volume keys earlier diagnostic build
1.1 like 1.2, plus a volume nudge and a 2 s tone fallback, in case the pin alone is not enough on some model

1.1, 1.2 and 1.6 come from ampfix.c via a build option (AMPFIX_SILENT_START); 1.5 has its own tiny source, ampstart.c. All of them share ampcore.c — the pin logic exists exactly once and cannot drift apart.

On the iMac G4 (PowerMac6,1), simply setting the pin is enough — the volume nudge and the tone are not needed there.

Besides switching the amplifier, 1.5 records a comparison profile: system volume as a number, Sound Manager version, gestaltSoundAttr, a full dump of GPIO registers 0x500x7F, and the identifiers of the sound, deq and i2s-a nodes. The report is named after the machine (serial number), so two machines never overwrite each other's file.

Usage

Just launch it — it switches the amplifier on, briefly shows a report and quits by itself. That is how it belongs in the Startup Items folder inside the System Folder (not in Extensions: it is a normal application, not an INIT).

Hold the Option key while launching — it stays open, with a test tone and a menu:

Key Effect
a amplifier on (value computed per pin)
4 amplifier off — the counter-test
5 / 1 fixed values; both are ON, since bit 0 is set
t / x test tone on / off
+ / - test tone louder / quieter
v nudge the volume
9 / 8 / 7 set volume to exactly 256 / 128 / 64
s show pin state
p live view — plug headphones in and out while it runs
w write test on the pins
d show the audio branch of the device tree
q quit

It writes ampfix-report.txt next to itself containing everything measured, including the machine identifier. If you try it on another model, please send that file back — that is exactly what is needed to judge whether it applies there.

What was measured (iMac G4, PowerMac6,1, Mac OS 9.2.2)

mac-io base 0x80000000, pins read from the device tree:

Role Node Offset after cold boot
headphone-mute gpio5 0x6F 0x07
amp-mute gpio6 0x70 0x04 = off
line-input-detect extint-gpio4 0x5C 0x02
audio-hw-reset gpio11 0x75 0x07
headphone-detect extint-gpio15 0x67 0x82
speaker-detect extint-gpio16 0x68 0x82

Bit 0 (output enable) is what matters, not the data bit. 0x04 means the output is disabled; 0x05 and 0x01 are both on. Anyone who assumes 0x01 means "mute" builds a counter-test that proves nothing — that happened to us and cost several rounds. Switching takes effect with a 2–3 s delay (soft-mute against switch-on thump).

The codec is correctly declared from the factory: sound node compatible = "snapper" (TAS3004), device_type = "soundchip"; codec deq@6a, compatible = "DigitalSnd", on I²C under /pci@f2000000/mac-io@17/i2c@18000. A screamer patch is wrong here and makes things worse — the node already carries the right value.

What was not the cause, although each looked plausible: system volume (GetDefaultOutputVolume cleanly returns 0x01000100), a missing Apple Audio Extension, codec registers sitting at zero, and the sound-objects detect bits (Mac OS 9 does not evaluate them; the class names come from Mac OS X's AppleOnboardAudio).

One more trap, found while comparing two identical machines: the Control Strip volume slider is useless as a measurement. Two units whose sliders looked the same measured 262 and 44 out of 256 — roughly 15 dB apart. To compare two machines, set the numeric value (keys 9/8/7) and read it back; do not trust the slider.

Prebuilt

prebuilt/ holds ampfix-1.5.bin (startup item) and ampfix-1.6.bin (diagnostic tool) as MacBinary — decode them on the Mac with StuffIt Expander. ampfix-1.2.bin is the earlier diagnostic build.

Note on the prebuilt files: the Retro68 C library embeds the build path in a few assert strings. Those have been replaced by a same-length placeholder so no personal path is published. The files are otherwise untouched.

Building

Needs Retro68 with the PowerPC target:

export RETRO68=/path/to/Retro68-build/toolchain
cmake -S . -B build \
      -DCMAKE_TOOLCHAIN_FILE=$RETRO68/powerpc-apple-macos/cmake/retroppc.toolchain.cmake
cmake --build build

Result: build/ampfix-1.5.bin plus the diagnostic builds.

  • ampcore.c/.h — read the device tree, find the pins, switch them. No output.
  • ampfix.c — user interface, test tone, diagnostics, report (builds 1.1, 1.2, 1.6).
  • ampstart.c — silent startup item and comparison profile (build 1.5).

License

MIT — see LICENSE.

About

Turns on the speaker amplifier under Mac OS 9 on unsupported G4 Macs (reads the GPIO pins from the device tree, nothing hard-coded)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages