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/driver.s | 28 ++++++++++++++++------------ src/items.s | 46 +++++++++++++++++++++++++++++++++++++++------- 2 files changed, 55 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/driver.s b/src/driver.s index 9d31604..67cba5c 100644 --- a/src/driver.s +++ b/src/driver.s @@ -714,34 +714,38 @@ sta OAM::m_sprites + 44 ;; Tile IDs - lda #$04 + ldx Globals::zp_shuttle_kind + lda Items::shuttle_sprites, x sta OAM::m_sprites + 1 - lda #$05 + clc + adc #1 sta OAM::m_sprites + 5 - lda #$14 + adc #$0F sta OAM::m_sprites + 9 - lda #$15 + adc #1 sta OAM::m_sprites + 13 - lda #$06 + lda Items::shuttle_sprites, x + adc #2 sta OAM::m_sprites + 17 - lda #$07 + adc #1 sta OAM::m_sprites + 21 - lda #$16 + adc #$0F sta OAM::m_sprites + 25 - lda #$17 + adc #1 sta OAM::m_sprites + 29 - lda #$08 + lda Items::shuttle_sprites, x + adc #4 sta OAM::m_sprites + 33 - lda #$09 + adc #1 sta OAM::m_sprites + 37 - lda #$18 + adc #$0F sta OAM::m_sprites + 41 - lda #$19 + adc #1 sta OAM::m_sprites + 45 ;; Zero out attributes 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