From 695d225256ed129ce55eb2dfde9de33d3d5f3af9 Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Fri, 6 Mar 2026 16:12:12 +0100 Subject: Small savings on re-using untouched registers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miquel Sabaté Solà --- src/enemies.s | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'src') 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 -- cgit v1.2.3