Region autodetection for PAL/NTSC

dale_coop

Moderator
Staff member
Thanks, it's a strange behavior over all.

Here is the intialization script (what should be totally okay, it's the version I last saved in june 2022 since when it worked well) ...

Try changing those lines:
Code:
    JSR getTVSystem
    ;;;; lda #SOUND_REGION_NTSC ;or #SOUND_REGION_PAL, or #SOUND_REGION_DENDY
    sta sound_param_byte_0

Into:
Code:
    LDA #1
    STA skipNMI
    JSR getTVSystem ; loads region instead of hardcoding it
    ;;;; lda #SOUND_REGION_NTSC ;or #SOUND_REGION_PAL, or #SOUND_REGION_DENDY
    sta sound_param_byte_0
    LDA #0
    STA skipNMI

Let me know if it helps with your issue.
 

force73

Member
Try changing those lines:
Code:
    JSR getTVSystem
    ;;;; lda #SOUND_REGION_NTSC ;or #SOUND_REGION_PAL, or #SOUND_REGION_DENDY
    sta sound_param_byte_0

Into:
Code:
    LDA #1
    STA skipNMI
    JSR getTVSystem ; loads region instead of hardcoding it
    ;;;; lda #SOUND_REGION_NTSC ;or #SOUND_REGION_PAL, or #SOUND_REGION_DENDY
    sta sound_param_byte_0
    LDA #0
    STA skipNMI

Let me know if it helps with your issue.
Thanks for your code but unfortunately it didn't changed anything. PAL music still slower.
 

force73

Member
Gentlemen, there is an update to this topic. The code works fine, the PAL and NTSC switching works fine. It really is, how the music was made in Famitracker. It's not finally clear how to descibe it, but we've found out, one song in the game plays totally fine in NTSC and PAL. Another song didn't. What's behind will be found out the next days for sure.

Thanks for helping! It simply hadn't to do with the game code. Strange anyway.
 
Last edited:

Retroplasmid

New member
Hey! I know you asked about this a long time ago but if you haven't figured it out yet maybe this will help for 4.5.9...

Create your getTVSystem.asm file, just save it into System directory as there is no InitializationScripts folder for 4.5.9.

Scroll to the bottom of Bank1B and...
Code:
;;; ADD THIS LINE ;;;

.include ROOT\System\getTVSystem.asm

;;; BEFORE THIS LINE ;;;

.include ROOT\System\ggsound.asm

Then in your initialization.asm script do this...
Code:
;;; ADD THIS LINE ;;;

JSR getTVSystem

;;; BEFORE THIS LINE ;;;

;;; LDA #SOUND_REGION_NTSC ;;; <<< COMMENT OUT THIS LINE ;;;

That sould be it. Let me know if you have any problems because I had to do a few extra things for music bank switching so haven't tested for 1 music bank but should work fingers crossed. When testing in mesen between PAL and NTSC make sure you reset as it will stay slow/fast until initialisation is run again obviously. I'm only saying that because, like an idiot, I was wondering why it wan't working.
Hi! If I do this for version 4.5.9, do i still need to compile the MainASM.asm file like described above or is not necessary? Thanks!
 
Top Bottom