aboutsummaryrefslogtreecommitdiff
path: root/src/driver.s
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <mssola@mssola.com>2026-03-11 23:36:48 +0100
committerMiquel Sabaté Solà <mssola@mssola.com>2026-03-11 23:36:48 +0100
commitbd97502a0c07428d9fed59f65556cad502769adb (patch)
tree736939a6ac99a5b233228e48746ac86a796fdea8 /src/driver.s
parent68e63fa4ff68d7124b178a9378a9b293f5ddaed4 (diff)
downloadjetpac.nes-bd97502a0c07428d9fed59f65556cad502769adb.tar.gz
jetpac.nes-bd97502a0c07428d9fed59f65556cad502769adb.zip
Apply a correction on enemy movement for PAL
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à <mssola@mssola.com>
Diffstat (limited to 'src/driver.s')
-rw-r--r--src/driver.s12
1 files changed, 12 insertions, 0 deletions
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