aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <mssola@mssola.com>2026-03-16 22:08:46 +0100
committerMiquel Sabaté Solà <mssola@mssola.com>2026-03-16 22:08:46 +0100
commit3a4ae1f5ef956ff243b80610e0ca00085edba0e5 (patch)
treec4df5696c4e11d0c06eb7eb204e8a9faf5b6a905
parentb701e5fc34351a727a217542c60f22beda7681e7 (diff)
downloadjetpac.nes-3a4ae1f5ef956ff243b80610e0ca00085edba0e5.tar.gz
jetpac.nes-3a4ae1f5ef956ff243b80610e0ca00085edba0e5.zip
Avoid a jmp by moving update_sprites()
Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
-rw-r--r--.nasm/segments.txt2
-rw-r--r--src/player.s36
2 files changed, 19 insertions, 19 deletions
diff --git a/.nasm/segments.txt b/.nasm/segments.txt
index 7ba06cb..1b553ca 100644
--- a/.nasm/segments.txt
+++ b/.nasm/segments.txt
@@ -1,4 +1,4 @@
- HEADER: 16/16 (100%)
-- ROM0: 8034/32762 (24.52%)
+- ROM0: 8031/32762 (24.51%)
- ROMV: 6/6 (100%)
- ROM2: 8192/8192 (100%)
diff --git a/src/player.s b/src/player.s
index fa649c6..5060e87 100644
--- a/src/player.s
+++ b/src/player.s
@@ -238,7 +238,24 @@
@do_update_sprites:
;; And with that, update all the sprites with the information we have
;; collected (i.e. heading, thrust, coordinates).
- JAL update_sprites
+ __fallthrough__ update_sprites
+ .endproc
+
+ .proc update_sprites
+ ;; It's just an update of coordinates or something more?
+ lda #%00000100
+ and zp_state
+ beq @update_coordinates
+
+ jsr update_player_tiles
+
+ ;; Clear out `update` flag.
+ lda zp_state
+ and #%11111011
+ sta zp_state
+
+ @update_coordinates:
+ JAL update_sprites_coordinates
.endproc
;; Updates the `zp_velocity_y` and the `zp_position_y` depending on whether
@@ -703,23 +720,6 @@
rts
.endproc
- .proc update_sprites
- ;; It's just an update of coordinates or something more?
- lda #%00000100
- and zp_state
- beq @update_coordinates
-
- jsr update_player_tiles
-
- ;; Clear out `update` flag.
- lda zp_state
- and #%11111011
- sta zp_state
-
- @update_coordinates:
- JAL update_sprites_coordinates
- .endproc
-
;; Update the tiles used for the player's sprites. This includes which tile
;; IDs to use on each slot, and also the attributes to be used, as the
;; heading affects whether things are to be flipped horizontally or not.