summaryrefslogtreecommitdiff
path: root/src/home/double_speed.asm
diff options
context:
space:
mode:
Diffstat (limited to 'src/home/double_speed.asm')
-rw-r--r--src/home/double_speed.asm35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/home/double_speed.asm b/src/home/double_speed.asm
new file mode 100644
index 0000000..f3aa682
--- /dev/null
+++ b/src/home/double_speed.asm
@@ -0,0 +1,35 @@
+; switch to CGB Normal Speed Mode if playing on CGB and current mode is Double Speed Mode
+SwitchToCGBNormalSpeed: ; 7db (0:7db)
+ call CheckForCGB
+ ret c
+ ld hl, rKEY1
+ bit 7, [hl]
+ ret z
+ jr CGBSpeedSwitch
+
+; switch to CGB Double Speed Mode if playing on CGB and current mode is Normal Speed Mode
+SwitchToCGBDoubleSpeed:
+ call CheckForCGB
+ ret c
+ ld hl, rKEY1
+ bit 7, [hl]
+ ret nz
+; fallthrough
+
+; switch between CGB Double Speed Mode and Normal Speed Mode
+CGBSpeedSwitch:
+ ldh a, [rIE]
+ push af
+ xor a
+ ldh [rIE], a
+ set 0, [hl]
+ xor a
+ ldh [rIF], a
+ ldh [rIE], a
+ ld a, $30
+ ldh [rJOYP], a
+ stop
+ call SetupTimer
+ pop af
+ ldh [rIE], a
+ ret