From 2f140cfb7ea73e631fce086327bcb3a674758b0e Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Tue, 1 Apr 2025 16:23:34 +0200 Subject: player: First PAL implementation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The steps by which a player increases its current velocity to reach the target one has been adapted on PAL, so every five frames it takes an extra step compared to NTSC. This at least brings PAL to grow its values at the same rate as NTSC. Signed-off-by: Miquel Sabaté Solà --- src/player.s | 55 ++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 48 insertions(+), 7 deletions(-) (limited to 'src/player.s') diff --git a/src/player.s b/src/player.s index 55245f6..9cb73f3 100644 --- a/src/player.s +++ b/src/player.s @@ -100,6 +100,14 @@ ;; Simple counter for the walking animation. zp_walk_counter = $51 + .ifdef PAL + ;; The increment/decrement to be applied to the velocity on a PAL + ;; system. This value is updated on `driver.s` on each frame. + ;; + ;; NOTE: only used on PAL. + zp_step_on_pal = $52 + .endif + ;; How many animations are there for walking? WALK_ANIMATION_NR = 3 @@ -113,6 +121,12 @@ lda #%01000100 sta zp_state + ;; Set the step to be applied on PAL. + .ifdef PAL + lda #1 + sta zp_step_on_pal + .endif + ;; Reset velocity and walking counter. lda #0 sta zp_target_velocity_y @@ -236,13 +250,27 @@ sbc Globals::zp_tmp0 beq @apply_velocity - ;; Increase or decrease depending on what we have now. - ;; TODO: inc/dec might not quite cut it in NTSC vs PAL + ;; Increase or decrease depending on what we have now. Note that how + ;; this is done depends on whether we are on NTSC or PAL. bmi @down - dec zp_velocity_y + .ifdef PAL + lda zp_velocity_y + sec + sbc zp_step_on_pal + sta zp_velocity_y + .else + dec zp_velocity_y + .endif jmp @apply_velocity @down: - inc zp_velocity_y + .ifdef PAL + lda zp_velocity_y + clc + adc zp_step_on_pal + sta zp_velocity_y + .else + inc zp_velocity_y + .endif jmp @apply_velocity @blast_off: @@ -334,17 +362,30 @@ ;; and we just subtract the current velocity and see if we either have ;; to accelerate or decelerate to reach that, and we do that with steps. @apply_acceleration: - ;; TODO: as with vertical motion, mind NTSC vs PAL sta Globals::zp_tmp0 lda zp_velocity_x sec sbc Globals::zp_tmp0 beq @apply_velocity bmi @accelerate_left - dec zp_velocity_x + .ifdef PAL + lda zp_velocity_x + sec + sbc zp_step_on_pal + sta zp_velocity_x + .else + dec zp_velocity_x + .endif jmp @apply_velocity @accelerate_left: - inc zp_velocity_x + .ifdef PAL + lda zp_velocity_x + clc + adc zp_step_on_pal + sta zp_velocity_x + .else + inc zp_velocity_x + .endif ;; With the final velocity already at hand, update the position with it. @apply_velocity: -- cgit v1.2.3