aboutsummaryrefslogtreecommitdiffstats
path: root/src/boot.asm
diff options
context:
space:
mode:
Diffstat (limited to 'src/boot.asm')
-rw-r--r--src/boot.asm14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/boot.asm b/src/boot.asm
index 88eb240..f649008 100644
--- a/src/boot.asm
+++ b/src/boot.asm
@@ -44,6 +44,20 @@ KernelInit:
push af ; boot ROM hands the console model in A/B -
push bc ; park it on the (uncleared) stack for dmesg
+ ; CGB double-speed mode: 8.4 MHz for the whole kernel + userland. The
+ ; PPU/LCD keep their normal rate; the timer and DIV double with the CPU,
+ ; which TimerISR (128 Hz -> 64 Hz toggle) and sys_sleep (DIV halving)
+ ; compensate for. P1 select lines off first, per the hardware procedure.
+ ldh a, [$FF4D] ; KEY1
+ bit 7, a ; already fast? (warm reboot)
+ jr nz, .fast
+ ld a, $30
+ ldh [$FF00], a ; P1: no select lines (STOP quirk guard)
+ ld a, 1
+ ldh [$FF4D], a ; KEY1.0 = prepare speed switch
+ stop ; switch: continues in double speed
+.fast
+
; enable cart RAM (MBC5)
ld a, $0A
ld [MBC5_RAM_ENABLE], a