Skip to content

Commit 6aba095

Browse files
bbbbbravivace
andauthored
Clarify clock terminology and speed (#597)
* Clarify clock terminology and speed Currently there is some ambiguity about clock terminology and speed. This attempts to differentiate between a System Clock of ~1MHz and a Master Clock of ~4MHz (2x those in Double-speed mode). Alternatively "Oscillation Clock" could be used if that's preferable to "Master Clock" * Update src/Gameboy_Camera.md * Update src/External_Connectors.md --------- Co-authored-by: Antonio Vivace <avivace4@gmail.com>
1 parent 9eccb9e commit 6aba095

File tree

5 files changed

+16
-13
lines changed

5 files changed

+16
-13
lines changed

src/Audio.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ The speaker merges back the two channels, losing the stereo aspect entirely.
4747

4848
The Game Boy's sound chip is called the <abbr title="Audio Processing Unit">APU</abbr>.
4949

50-
The APU runs off the same master clock as the rest of the Game Boy, which is to say, it is fully synced with the CPU and [PPU](<#Rendering overview>).
50+
The APU runs off the same Master Clock as the rest of the Game Boy, which is to say, it is fully synced with the CPU and [PPU](<#Rendering overview>).
5151
This also means that the APU runs about 2.4% faster on the SGB1, increasing frequencies by as much and thus sounding slightly higher-pitched.
5252
The SGB2 rectifies this issue.
5353

src/External_Connectors.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Pin | Name | Explanation
66
------|--------|--------------
77
1 | VDD | Power Supply +5V DC
8-
2 | PHI | System Clock
8+
2 | PHI | System Clock ~ 1.05 MHz <br> (CGB Double-speed mode: ~ 2.10 MHz)
99
3 | /WR | Write
1010
4 | /RD | Read
1111
5 | /CS | Chip Select

src/Gameboy_Camera.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,14 +175,14 @@ Those registers form a 4×4 matrix with 3 bytes per element. They handle ditheri
175175
## Game Boy Camera Timings
176176

177177
The capture process is started when the A000 register of the Game Boy Camera cartridge is written with any value with bit 0 set to "1".
178-
The Game Boy Camera cartridge is one of the few cartridges that use the PHI signal (clock from the GB).
179-
That signal is a 1 MiHz clock (1047567 Hz).
180-
The M6438FP chip needs a clock input too, which is half the frequency of the PHI pin (0.5 Mihz, 524288Hz).
178+
The Game Boy Camera cartridge is one of the few cartridges that use the PHI cartridge signal (the System Clock).
179+
That signal is a 1.048576 MHz clock (2.097152 MHz in CGB Double-speed mode).
180+
The M6438FP chip needs a clock input too, which is half the frequency of the PHI signal.
181181
The reason for that is that the sensor chip sometimes handles the signals on the rising edge of the clock, but other times on the falling edge.
182182

183183
:::tip NOTE
184184

185-
This means that the GB Camera shouldn't be used in GBC double speed mode!
185+
Since the PHI signal runs twice as fast in CGB Double-speed mode, the values used for exposure time should be doubled.
186186

187187
:::
188188

src/SGB_Functions.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,10 @@ directly in order to produce other sound effects or music.
8484
Finally, it is possible to write program code or data into SNES memory,
8585
and to execute such program code by using the SNES CPU.
8686

87-
## SGB System Clock
87+
## SGB Clock Speed
8888

89-
Because the SGB is synchronized to the SNES CPU, the Game Boy system
90-
clock is directly chained to the SNES system clock. In result, the
89+
Because the SGB is synchronized to the SNES CPU, the Game Boy Master
90+
Clock is directly chained to the SNES Master Clock. In result, the
9191
Game Boy CPU, video controller, timers, and sound frequencies will be all
9292
operated approx 2.4% faster than handheld systems. Basically, this
9393
should be no problem, and the game will just run a little bit faster.
@@ -99,6 +99,6 @@ hardware. Also, "PAL version" SNES models which use a
9999
50Hz display refresh rate (rather than 60Hz) result in
100100
respectively slower Game Boy timings.
101101

102-
- NTSC SGB: 21.477 MHz master clock, 4.2955 MHz GB clock, 2.41% fast
103-
- PAL SGB: 21.281 MHz master clock, 4.2563 MHz GB clock, 1.48% fast
102+
- NTSC SGB: 21.477 MHz Master Clock, 4.2955 MHz GB Master Clock, 2.41% fast
103+
- PAL SGB: 21.281 MHz Master Clock, 4.2563 MHz GB Master Clock, 1.48% fast
104104
- NTSC SGB2: Separate 20.972 MHz crystal, correct speed

src/Specifications.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ td:first-child {
2020
<td>CPU</td><td colspan="4">8-bit 8080-like Sharp CPU (speculated to be a SM83 core)</td>
2121
</tr>
2222
<tr>
23-
<td>CPU freq</td><td colspan="2">4.194304&nbsp;MHz<sup class="footnote-reference"><a href="#dmg_clk">1</a></sup></td><td>Depends on revision<sup class="footnote-reference"><a href="#sgb_clk">2</a></sup></td><td>Up to 8.388608&nbsp;MHz</td>
23+
<td>Master Clock</td><td colspan="2">4.194304&nbsp;MHz<sup class="footnote-reference"><a href="#dmg_clk">1</a></sup></td><td>Depends on revision<sup class="footnote-reference"><a href="#sgb_clk">2</a></sup></td><td>Up to 8.388608&nbsp;MHz</td>
24+
</tr>
25+
<tr>
26+
<td>System Clock</td><td colspan="4">1/4 the frequency of Master Clock</td>
2427
</tr>
2528
<tr>
2629
<td>Work RAM</td><td colspan="3">8&nbsp;KiB</td><td>32&nbsp;KiB<sup class="footnote-reference"><a href="#compat">3</a></sup> (4&nbsp;+&nbsp;7&nbsp;×&nbsp;4&nbsp;KiB)</td>
@@ -62,7 +65,7 @@ td:first-child {
6265
Real DMG units tend to run about 50-70 PPM slow. Accuracy of other models is unknown. [See this page](https://github.com/jkotlinski/gbchrono) for more details.
6366

6467
[^sgb_clk]:
65-
SGB1 cartridges derive the GB CPU clock from the SNES' clock, [yielding a clock speed a bit higher](<#SGB System Clock>), which differs slightly between NTSC and PAL systems.
68+
SGB1 cartridges derive the GB CPU clock from the SNES' clock, [yielding a clock speed a bit higher](<#SGB Clock Speed>), which differs slightly between NTSC and PAL systems.
6669
SGB2 instead uses a clock internal to the cartridge, and so has the same speed as the handhelds.
6770

6871
[^compat]:

0 commit comments

Comments
 (0)