From bd97502a0c07428d9fed59f65556cad502769adb Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Wed, 11 Mar 2026 23:36:48 +0100 Subject: Apply a correction on enemy movement for PAL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We cannot just "inc"/"dec" for enemy movement, but we have to apply an overstep on PAL every 5 frames in order to be equivalent to the NTSC version. This has been abstracted away on a macro that just does "inc"/"dec" on NTSC, but does this proper "adc"/"sbc" instructions with a helper memory region which is updated every 5 frames. Signed-off-by: Miquel Sabaté Solà --- src/driver.s | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/driver.s') diff --git a/src/driver.s b/src/driver.s index 4f0e501..3d9eb53 100644 --- a/src/driver.s +++ b/src/driver.s @@ -562,15 +562,22 @@ .proc pal_handler ;; Check if 5 frames have passed since last counter reset. lda Driver::zp_pal_counter + beq @reset_movement_arg cmp #4 beq @do_handle + @player_timer_reset: ;; Nope! Reset the player's step on PAL and increase the counter. lda #1 sta Player::zp_step_on_pal inc Driver::zp_pal_counter bne @end + @reset_movement_arg: + ;; Restore the enemy movement to the same value as NTSC. + dec Enemies::zp_movement_arg + jmp @player_timer_reset + @do_handle: ;; Increase the step just for this frame and reset the counter. lda Player::zp_step_on_pal @@ -579,6 +586,11 @@ sta Player::zp_step_on_pal lda #0 sta Driver::zp_pal_counter + + ;; Increase the movement arg for this frame. This way we catch up to + ;; the NTSC real velocity on screen. + inc Enemies::zp_movement_arg + @end: rts .endproc -- cgit v1.2.3