Detecting for NTSC or PAL

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems.

Moderator: Moderators

tepples
Posts: 22345
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Post by tepples »

Shouldn't that be $2002 (PPUSTATUS), not $2007 (PPUDATA)?
Sivak wrote:
blargg wrote:

Code: Select all

         
        lda $2007
        sta ntsc_if_neg
Sorry for sounding like a noob, but what exactly would the value be in $2007 at this point if it was PAL? 0?
The state of $2002 after this many cycles of PAL could be any number from 0 to 127, depending on the state of the sprite hardware and various internal PPU buffers, but bit 7 will be clear. You can 'bpl' to test this number: 'bpl' is taken if PAL (was "branch if PLus" now "branch if PaL"), 'bmi' if NTSC.
User avatar
Sivak
Posts: 316
Joined: Tue Jul 17, 2007 9:04 am
Location: Somewhere
Contact:

Post by Sivak »

I saw the revised code. Thanks for the assistance, PAL emulation on 3 different emus produces the new results.

I originally had this configurable in the option screen, but now this test works. Kinda cool that my game is "region-free". 8)
Post Reply