Very interesting to read about this common issue between NTSC/PAL for support. These posts are great! keep em coming :)
NTSC and PAL support
Today we fixed NTSC & PAL support.
for this we have to detect the type of machine we're running on, this can be achieved by a simple blob of code
lda #$00 sta isNTSC w0: lda $d012 w1: cmp $d012 beq w1 bmi w0 cmp #$37 beq isPal inc isNTSC isPal: rts
this is counting the raster lines of the machine, where the low byte of the count is ( found here )
#$37 -> 312 rasterlines #$06 -> 263 rasterlines #$05 -> 262 rasterlines
next in our game update loop. for NTSC we have a clock counter that increments and runs the game logic for 5 frames, then skips a frame. this forces the logic to run at the same speed on pal vs ntsc
This change also pushed me to make a few optimizations, to perform correctly with NTSC. we have a chunk less time to run the game in.
the easy one was for the baddies. I now only check for ground collisions when we've moved to a different cell than we're on. this reduces the workload quite a bit, as when I was initially throwing this together I checked for ground every frame. This same fix was applied to the elevators.
we also fiddled with the border knock out routine, and fixed the screen shake to not affect the bottom text display. which may or may not be used in the end.