aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <mssola@mssola.com>2026-03-06 16:12:12 +0100
committerMiquel Sabaté Solà <mssola@mssola.com>2026-03-06 16:12:12 +0100
commit695d225256ed129ce55eb2dfde9de33d3d5f3af9 (patch)
treef340ab777c3ccd6b7a2dba2a24c0929c751006d3 /src
parentf1133047080fed08d7829a5115bd8c9e42cc1dfc (diff)
downloadjetpac.nes-695d225256ed129ce55eb2dfde9de33d3d5f3af9.tar.gz
jetpac.nes-695d225256ed129ce55eb2dfde9de33d3d5f3af9.zip
Small savings on re-using untouched registers
Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
Diffstat (limited to 'src')
-rw-r--r--src/enemies.s10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/enemies.s b/src/enemies.s
index 2c43d77..64e4b23 100644
--- a/src/enemies.s
+++ b/src/enemies.s
@@ -158,8 +158,7 @@
;; Initialize the enemy arg, which is always 1 except for homing
;; attacks.
ldy #1
- txa
- cmp #3
+ cpx #3
bne @set_enemy_arg
iny
@set_enemy_arg:
@@ -435,11 +434,6 @@
;; NOTE: this function assumes that the enemy is in a valid state. That's up
;; to the caller to check before calling this function.
.proc allocate_x_y
- ;; Save the 'y' index, as it's faster to do funny address arithmetics
- ;; and add 16 in the end than constantly 'iny' every time in the right
- ;; order.
- sty Globals::zp_tmp0
-
;; Y coordinates for each sprite of the enemy.
lda Enemies::zp_enemies_pool_base + 1, x
sta OAM::m_sprites, y ; top left
@@ -521,7 +515,7 @@
sta OAM::m_sprites + 15, y ; bottom right
;; And update the 'y' register to notify 16 bytes were stored.
- lda Globals::zp_tmp0
+ tya
clc
adc #16
tay