little-scale — Underclocking a Game Boy, and retuning it afterwards (2009)
The pair that makes the point of the whole cluster: there are two ways to move a Game Boy's pitch, one in the hardware and one in the ROM, and doing the first without the second leaves you out of tune. The second post is the most data-rich thing in this collection — it prints all 216 replacement bytes.
Key claims#
The mod (2009-04-03, four photos)
- Replacing the DMG's crystal oscillator underclocks the whole machine; the procedure is "documented by the genius Gieskes" (
gieskes.nl/underclocking_or_overclocking_the_gameboy_classic_tutorial/, not fetched). - The stock value is 4.194304 MHz; he fits 2 MHz "because 2MHz crystals are easy to find in shops and on the internet, or at least thats what I do".
- Physical note from the photos: "The original crystal oscillator is much shorter than the new one, so the new one needs to be bent over and put on its side, with some tape that insulates it from the rest of the PCB." The last photo shows the replacement laid flat under red tape on a DMG board; no component markings are legible.
The problem (2009-07-22)
- "the crystal oscillator is responsible for controlling all timing aspects of the Game Boy including the frequency pitches of the pulse oscillators. As a result, the underclocked Game Boy plays back just under an octave lower than its unmodified counterpart. This tuning difference is annoying and means that its not very satisfying to use an underclocked Game Boy at the same time as a normal Game Boy or any other instrument."
- 2.000000 ÷ 4.194304 = 0.4768, which is an octave and 82 cents — nearly a semitone past the octave, which is why he describes the un-retuned result as "some disgustingly out of tune B or something similar" (arithmetic done here).
The fix
- The idea comes from Tom Gilmore aka 10k (
10kfreemen.com). - "replace the tuning table inside of LSDJ with a newly created tuning table that uses 4Mhz as a master clock source (which is 2 \* 2MHz) instead of 4.194304 MHz. As a result, a C3 will play back on the unmodified Game Boy as a C2, instead of some disgustingly out of tune B or something similar." Tuning for exactly twice the real clock lands the machine an exact octave down and in tune, instead of an octave plus a bit and useless.
- Procedure: open the LSDJ ROM in a hex editor ("I use Hex Fiend for OS X"); "Find the tuning table in the LSDJ, which starts just after location
$6D30with the bytes2C 00 9C 00 06 01. Select 216 bytes starting with2Cand00." Paste the 216 replacement bytes over it, save, flash, play. - The replacement table is in the post as 108 four-digit words (
8900 F400 5901 B901 1302 6802 B902 0403 4C03 9003 CF03 0C04 4404 …through… FB07 FC07 FC07 FC07; the full list is in the raw file). Counted here: exactly 108 entries = 216 bytes, matching the 108 notes of s-little-scale-lsdj-tuning-tables. - Decoded here as little-endian period values against a 4.000000 MHz master (
f = 4000000 ÷ 32 ÷ (2048 − v)), the first octave is 65.41, 69.29, 73.40, 77.79, 82.40, 87.29, 92.52, 97.96, 103.82, 110.04, 116.50, 123.52 Hz — 12-TET from C2, A = 110.04 Hz. Against the machine's real 2 MHz clock those same bytes sound exactly one octave lower (C2 → 32.71 Hz), in tune with concert pitch. The table checks out. - And it syncs: "You can sync your normal Game Boy as slave from your underclocked Game Boy as master." (sync)
From the comments
- nitro2k01: "Or, you can use the microtuner tool, as described here." little-scale: "Yes, I've blogged about that microtuner tool too, Nitro, but — it seems it hasn't worked for everyone and this is a very straightforward way of doing things (for me at least)."
- 10k quotes a nitro2k01 forum post of 2009-06-25, "Re: [underclocking] tracking the elusive 2.097152mhz crystal oscillator" — 2.097152 MHz being exactly half of 4.194304, the crystal that would give a clean octave with no retune at all. "Beaten! Funny part is I never read it."
- Asked about an 8 MHz crystal, little-scale: "so in theory, the same pitch table should also work for an 8MHz clock, simply try out the above procedure because I haven't actually tried it out with an overclocked GB."
- The version trap, reported 2010-08-26 and never answered: "I tried this on version 4.0.5 and some of the coding was different, so literally pasted over the code starting from ---- C3 upto B.B and when i put the cart into my gameboy it would not boot up. Do you have the specific code for this version… i would only need it for 3.8.7 and 4.0.5".
Practical takeaways#
- Pick the crystal first. 2.097152 MHz halves the clock exactly: one octave down, everything still in tune, nothing to patch. 2.000000 MHz is the one you can actually buy, and it costs you a ROM patch.
- Compute the replacement table for twice the fitted crystal, not for the crystal itself — that is the trick that keeps the result on a 12-TET grid instead of merely lower.
$6D3Ais a 3.8.9 address. Check the bytes2C 00 9C 00 06 01are really there before overwriting, or you brick the cartridge, as the 4.0.5 commenter did.- An underclocked machine still slaves or masters a stock one over the link port — a free sub-octave voice in a two-Game-Boy setup (sync).
Notable quotes#
"the crystal oscillator is responsible for controlling all timing aspects of the Game Boy including the frequency pitches of the pulse oscillators."
"a C3 will play back on the unmodified Game Boy as a C2, instead of some disgustingly out of tune B or something similar."
Relevance to the wiki#
The wiki already said (from s-chipmusic-lsdj-faq) that "an underclocked Game Boy is a free sub-octave when synced". This is the primary source underneath that, and it corrects it: only an exactly halved clock, or a retuned ROM, gives a clean octave.
To verify#
- The sentence "a C3 will play back on the unmodified Game Boy as a C2" reads as though the modified machine now matches an unmodified one an octave down; he does not spell out which machine is playing. The arithmetic above supports that reading.
- Whether the same table really works at 8 MHz is his own guess, marked as untested in the comment. Partly answered: he had in fact built an 8 MHz DMG in May 2008 — "almost twice the speed, almost twice the pitch" — but says nothing about retuning it, so the table question stands (source: s-little-scale-overclocked-game-boy).
- The "microtuner tool" nitro2k01 points at is not identified in this post; little-scale says he blogged about it elsewhere. Not in the wiki yet.
Pages touched#
rom-retuning · alternative-tunings · game-boy · game-boy-apu · lsdj · sync · nitro2k01 · little-scale