Sega Master System / Mark III / Game Gear
For the Sega 8-bit systems, region detection consists of determining if the console is Japanese or Export (non-Japanese). By pairing this with TV type detection it is possible to produce four results, if further regionalisation is wanted:
|NTSC/PAL-M||Japan, Korea||USA, Brazil|
Region detection on the Master System is done by attempting to use port $3F. A game will attempt to configure one or more of the four available output lines as an output with a known value; it will then read back the value and see if it matches what was written. By doing this multiple times with different values, it reduces the chance that the value read back is coincidentally the same due to user input or some other factor.
Later systems (in particular, the Mega Drive with Power Base Convertor) support this by inverting the values read back when set to Japanese mode; this satisfies the tests but is different to the behaviour of a real Japanese system where the TH lines are presumably unconnected and TR lines connected to the controller. This could be used to detect a PBC.
The Game Gear simplifies matters by having a port-mapped register which tells the software which region the system is from. Bit 6 of port $00 is
0 for a Japanese system and
The SG-1000 and SC-3000 appear not to have any region detection techniques. Detecting PAL/NTSC may be useful for determining whether the system is Japanese or not, since Japan is the only known NTSC region where they were officially released.