Overview

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:

 JapaneseExport
PALImpossibleEurope, Australia
NTSC/PAL-MJapan, KoreaUSA, Brazil

Master System region detection

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.

Sample code

;==============================================================
; Region detector
; Returns a=1 for Japanese, 0 for export
; Based on code found in many Sega games (eg. Super Tennis)
;==============================================================
IsJapanese:
    ld a,%11110101  ; Output 1s on both TH lines
    out ($3f),a
    in a,($dd)
    and %11000000  ; See what the TH inputs are
    cp %11000000  ; If the input does not match the output then it's a Japanese system
    jp nz,_IsJap

    ld a,%01010101  ; Output 0s on both TH lines
    out ($3f),a
    in a,($dd)
    and %11000000  ; See what the TH inputs are
    jp nz,_IsJap    ; If the input does not match the output then it's a Japanese system

    ld a,%11111111  ; Set everything back to being inputs
    out ($3f),a

    ld a,0
    ret

_IsJap:
    ld a,1
    ret

Game Gear region detection

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 1 otherwise.

Sample code

;==============================================================
; Region detector
; Returns a=0 for Japanese, non-zero for export
;==============================================================
IsJapanese:
    in a,($00)             ; port $00 contains Start button and Region
    and %01000000          ; $40 or 64 decimal
    ret                    ; result in a

Other systems

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.




Return to top
0.053s