aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRangi42 <sylvie.oukaour+rangi42@gmail.com>2025-08-11 16:31:18 -0400
committerRangi42 <sylvie.oukaour+rangi42@gmail.com>2025-08-11 16:35:07 -0400
commit1eb6f61d62133922ac15c61792be8ea901d6baba (patch)
tree50b14ca60db9675342d7993cf68aea6cbff6096a
parentUpdate hardware.inc to 5.3.0 and use its `JOYP_SGB_*` constants (diff)
downloadpokeyellow-1eb6f61d62133922ac15c61792be8ea901d6baba.tar.gz
pokeyellow-1eb6f61d62133922ac15c61792be8ea901d6baba.tar.xz
pokeyellow-1eb6f61d62133922ac15c61792be8ea901d6baba.zip
Identify `JOYP_SGB_MLT_REQ` constant
-rw-r--r--constants/misc_constants.asm3
-rw-r--r--engine/gfx/palettes.asm8
2 files changed, 7 insertions, 4 deletions
diff --git a/constants/misc_constants.asm b/constants/misc_constants.asm
index a542b4a7..8bd6f223 100644
--- a/constants/misc_constants.asm
+++ b/constants/misc_constants.asm
@@ -10,3 +10,6 @@ DEF TRUE EQU 1
; input
DEF NO_INPUT EQU 0
+
+; SGB command MLT_REQ can be used to detect SGB hardware
+DEF JOYP_SGB_MLT_REQ EQU %00000011
diff --git a/engine/gfx/palettes.asm b/engine/gfx/palettes.asm
index fe69144c..429d8123 100644
--- a/engine/gfx/palettes.asm
+++ b/engine/gfx/palettes.asm
@@ -462,8 +462,8 @@ CheckSGB:
ei
call Wait7000
ldh a, [rJOYP]
- and $3
- cp $3
+ and JOYP_SGB_MLT_REQ
+ cp JOYP_SGB_MLT_REQ
jr nz, .isSGB
ld a, JOYP_SGB_ZERO
ldh [rJOYP], a
@@ -494,8 +494,8 @@ CheckSGB:
call Wait7000
call Wait7000
ldh a, [rJOYP]
- and $3
- cp $3
+ and JOYP_SGB_MLT_REQ
+ cp JOYP_SGB_MLT_REQ
jr nz, .isSGB
call SendMltReq1Packet
and a