From 1963d7d8dd70ee9bc4cf9b81363aeab440a6f786 Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Fri, 3 Apr 2026 22:32:52 +0200 Subject: Add a table with tile IDs for shuttle parts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This will allow us to select the proper shuttle depending on 'Globals::zp_shuttle_kind'. Hence, now only the actual shuttle parts on the CHR file are missing, which is why I left a couple of TODOs on the table itself. Signed-off-by: Miquel Sabaté Solà --- src/items.s | 46 +++++++++++++++++++++++++++++++++++++++------- 1 file changed, 39 insertions(+), 7 deletions(-) (limited to 'src/items.s') diff --git a/src/items.s b/src/items.s index 9ad1aba..a2f867a 100644 --- a/src/items.s +++ b/src/items.s @@ -294,13 +294,20 @@ ;; Should we allocate a part from the shuttle? bne @try_next_shuttle - lda #$04 - bne @no_attributes + stx Globals::zp_tmp0 + ldx Globals::zp_shuttle_kind + lda Items::shuttle_sprites, x + ldx Globals::zp_tmp0 + jmp @no_attributes @try_next_shuttle: cmp #$01 bne @do_fuel_or_regular - lda #$06 - beq @do_fuel_or_regular + stx Globals::zp_tmp0 + ldx Globals::zp_shuttle_kind + lda Items::shuttle_sprites, x + clc + adc #2 + ldx Globals::zp_tmp0 @no_attributes: sta Globals::zp_arg0 @@ -1157,7 +1164,14 @@ ;; ;; NOTE: this has to be called with the PPU disabled. .proc draw_middle_part_shuttle - ldx #$08 + ;; Compute the tile ID for the middle part of the shuttle depending on + ;; the kind. + ldx Globals::zp_shuttle_kind + lda Items::shuttle_backgrounds, x + clc + adc #4 + tax + ldy #$2A bit PPU::m_status @@ -1184,7 +1198,11 @@ ;; ;; NOTE: this has to be called with the PPU disabled. .proc draw_high_part_shuttle - ldx #$04 + ;; Compute the tile ID for the middle part of the shuttle depending on + ;; the kind. + ldy Globals::zp_shuttle_kind + ldx Items::shuttle_backgrounds, y + ldy #$2A bit PPU::m_status @@ -1211,13 +1229,20 @@ ;; ;; NOTE: this has to be called with the PPU disabled. .proc draw_low_part_shuttle + ;; Compute the tile ID for the low part of the shuttle depending on the + ;; kind. + ldx Globals::zp_shuttle_kind + lda Items::shuttle_backgrounds, x + clc + adc #8 + tax + ;; The low part of the rocket. bit PPU::m_status lda #$2A sta PPU::m_address lda #$F5 sta PPU::m_address - ldx #$0C stx PPU::m_data inx stx PPU::m_data @@ -1233,4 +1258,11 @@ rts .endproc + +shuttle_sprites: + ;; TODO: rest of IDs + .byte $04, $00, $00, $00 +shuttle_backgrounds: + ;; TODO: rest of IDs + .byte $04, $00, $00, $00 .endscope -- cgit v1.2.3