Skip to content

Commit 8fc7831

Browse files
committed
figures: port STOP diagram to SVG
1 parent d4e3f7b commit 8fc7831

File tree

3 files changed

+142
-1
lines changed

3 files changed

+142
-1
lines changed

src/Reducing_Power_Consumption.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,20 @@ reason, d-pad and/or button inputs should be enabled by writing $00,
8080
$10 or $20 to the `P1` register before entering STOP (depending on which
8181
buttons you want to terminate the STOP on).
8282

83+
### The bizarre case of the Game Boy STOP instruction, before even considering timing.
84+
85+
The Game Boy STOP instruction is weird. Normally, it should enter STOP mode, where the CPU sits idle until a button is pressed. The STOP instruction was reused on the Game Boy Color to trigger a CPU speed switch, so executing STOP after writing 1 to KEY1 normally causes a speed switch. STOP is normally a 2-byte instruction where the second byte is ignored.
86+
87+
*But the Game Boy isn't normal. Depending on various factors, the STOP instruction might do different things. Will it actually enter STOP mode? Will it enter HALT mode instead? Will it just be a NOP? Will it perform the speed switch I requested? Will it magically become a 1-byte opcode and execute its second byte as another opcode? Will it glitch the CPU in a non-deterministic fashion? Follow the chart to figure out!*
88+
8389
<p align="center">
84-
<img src="imgs/gb_stop.png">
90+
<img src="imgs/stop_diagram.svg">
8591
<br>
8692
<i>Source: Lior Halphon</i>
8793
</p>
8894

95+
96+
8997
## Disabling the Sound Controller
9098

9199
If your program doesn't use sound at all (or during some periods) then

0 commit comments

Comments
 (0)