@@ -15,34 +15,41 @@ SGB functions.
15
15
16
16
## Detecting SGB hardware
17
17
18
- The recommended detection method is to send a MLT_REQ command which
19
- enables two (or four) joypads. A normal handheld Game Boy will ignore
20
- this command, a SGB will now return incrementing joypad IDs each time
21
- when deselecting keyboard lines (see MLT_REQ description for details).
22
- Now read-out joypad state/IDs several times, and if the ID-numbers are
23
- changing, then it is a SGB (a normal Game Boy would typically always
24
- return 0Fh as ID). Finally, when not intending to use more than one
25
- joypad, send another MLT_REQ command in order to re-disable the
26
- multi-controller mode. Detection works regardless of whether and how
27
- many joypads are physically connected to the SNES. However, detection
28
- works only when having unlocked SGB functions in the cartridge header,
29
- as described above.
30
-
31
- ## Separating between SGB and SGB2
32
-
33
- It is also possible to separate between SGB and SGB2 models by examining
34
- the inital value of the accumulator (register A) directly after startup.
35
-
36
- Value | Console
37
- ------|---------
38
- $01 | SGB or original Game Boy (DMG)
39
- $FF | SGB2 or Game Boy Pocket
40
- $11 | CGB or GBA
41
-
42
- Because values 01h and FFh are shared for both handhelds and SGBs, it is
43
- still required to use the above MLT_REQ detection procedure. As far as
44
- I know the SGB2 doesn't have any extra features which'd require
45
- separate SGB2 detection except for curiosity purposes, for example, the
46
- game "Tetris DX" chooses to display an alternate SGB border on SGB2s.
18
+ SGB hardware can be detected by examining the initial value of the C
19
+ register directly after startup: a value of $14 indicates SGB or SGB2
20
+ hardware. It is also possible to separate between SGB and SGB2 by
21
+ examining the initial value of the A register directly after startup.
22
+ Note that the DMG and MGB share initial A register values with the SGB
23
+ and SGB2 respectively.
24
+
25
+ Console | A Register | C Register
26
+ --------|------------|------------
27
+ DMG | $01 | $13
28
+ SGB | $01 | $14
29
+ MGB | $FF | $13
30
+ SGB2 | $FF | $14
31
+ CGB | $11 | $00
32
+ AGB | $11 | $00
33
+
34
+ For initial register values on all systems, see the table of all [ CPU
35
+ registers after power-up] ( < #CPU registers > ) .
36
+
37
+ The SGB2 doesn't have any extra features which'd require separate SGB2
38
+ detection except for curiosity purposes, for example, the game "Tetris
39
+ DX" chooses to display an alternate SGB border on SGB2s.
47
40
48
41
Only the SGB2 contains a link port.
42
+
43
+ SGB hardware has traditionally been detected by sending [ ` MLT_REQ ` commands] ( < #SGB Command 11h - MLT_REQ > ) , but this
44
+ method is more complicated and slower than checking the value of the A
45
+ and C registers after startup. The ` MLT_REQ ` command enables two (or four)
46
+ joypads; a normal handheld Game Boy will ignore this command, but an SGB
47
+ will return incrementing joypad IDs each time when deselecting keypad
48
+ lines ([ see ` MLT_REQ ` description] ( < #Reading Multiple Controllers (Joypads) > ) ). The joypad state/IDs can
49
+ then be read out several times, and if the IDs are changing, then it is
50
+ an SGB (a normal Game Boy would typically always return $0F as the ID).
51
+ Finally, when not intending to use more than one joypad, send another
52
+ ` MLT_REQ ` command in order to disable the multi-controller mode.
53
+ Detection works regardless of how many joypads are physically connected
54
+ to the SNES. However, unlike the C register method, this detection works only when
55
+ SGB functions [ are unlocked from the cartridge header] ( < #Cartridge Header > ) .
0 commit comments