MLdB Posted June 27, 2018 Share Posted June 27, 2018 While converting UT2600 to PAL I noticed the awful slowdown in the music. (The beat variable that controls the playback speed of the track is updated on every nth frame, so PALs 50hz slows it down). I've come up with a fix for this, so PAL will play at the same speed as NTSC, but as I can't find anything on this issue on the forums or elsewhere, I'd like to ask if any other solutions for this already exist. If not, I will post my fix as soon as it's done. Quote Link to comment Share on other sites More sharing options...
+SpiceWare Posted June 27, 2018 Share Posted June 27, 2018 I used it for the music in Medieval Mayhem. In October 2006 moderntimes99 made a revision to it to play back correct in PAL. I don't recall specifics, can look into it later. Quote Link to comment Share on other sites More sharing options...
MLdB Posted June 27, 2018 Author Share Posted June 27, 2018 At a glance, the basic idea is the same - although I don't skip beats, only the spacing between them. And because UT2600 has 7 songs which do not all use the same tenpodelay, I needed a generic solution. I will post my completed song player code when I find some time to materialize my thoughts Quote Link to comment Share on other sites More sharing options...
MLdB Posted June 28, 2018 Author Share Posted June 28, 2018 (edited) Ok, here is the fix: In Paul Slocum's songplayer, right below bitMaskArray, I placed PALSyncPattern byte #%00000000 byte #%00001001 byte #%00010101 byte #%00011011 byte #%00011111 byte #%00111111 byte #%10000001 byte #%10001001 byte #%10010101 byte #%10011011 These are patterns of 6 bits (bits 5..0) each and they correspond to the various TEMPODELAY options (1..10). I need a single variable to keep track of the number of times tempoCount is reset (it resets every TEMPODELAY frames): PALSyncCounter Slocum's tracker starts with (at the entry point): inc tempoCount lda tempoCount eor TEMPODELAY,X bne quitTempo sta tempoCount The last line resets tempoCount. Below this (and only for PAL) I place: ; Load PALSyncPattern corresponding to TEMPODELAY of this track lda TEMPODELAY,X tay lda PALSyncPattern-1,Y sta tmp_PALSyncPattern ; If bit 7 is set, we need to INC tempoCount on EVERY reset bpl .SkipFirstINC inc tempoCount (Note that TEMPODELAY is a table in UT2600, because I have multiple tracks. X is the offset/number of the track. In Paul's original kit TEMPODELAY is a constant.) I use bit 7 of the pattern to indicate that tempoCount should be incremented EVERY time it is reset. It will then start at 1 instead of 0 and thus the next beat will come one frame earlier. Then: .SkipFirstINC ; PALSyncPattern is 6 bits long, corresponding to 6 resets of tempoCount inc PALSyncCounter lda PALSyncCounter tay ; If it's at 6, reset to 0 eor #6 bne .SkipResetSyncCounter sta PALSyncCounter .SkipResetSyncCounter ; If bit N (N being PALSyncCounter) of the PALSyncPattern is set, INC tempoCount (again) lda tmp_PALSyncPattern and bitMaskArray+2,Y beq .SkipSecondINC inc tempoCount I increment PALSyncCounter to select the right bit from the pattern, use bitMaskArray (already in the songplayer) to mask off the other bits and if the result is non-zero, skip (another) tempoCount. The patterns are carefully chosen to make sure PAL is keeping up pace with NTSC, albeit with some skipping, like the littlest dwarf from the Snow White animated movie trying to walk in sync with the others... As an homage to that I'll call this addition to Slocum's tracker: "The Dopey fix" Here are PAL and NTSC for comparison:ut2600-pal.bin ut2600-ntsc.bin Edited June 28, 2018 by MLdB Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.