From 430949a48440a61ee7af2a078140ef8e841ec4ec Mon Sep 17 00:00:00 2001 From: Michael Miceli Date: Wed, 3 Apr 2024 18:36:24 -0400 Subject: [PATCH] minor documentation corrections/clarifications --- docs/Enemy Glossary.md | 2 +- src/bank0.asm | 4 ++-- src/bank1.asm | 32 ++++++++++++++++---------------- src/bank7.asm | 11 +++++++---- 4 files changed, 26 insertions(+), 23 deletions(-) diff --git a/docs/Enemy Glossary.md b/docs/Enemy Glossary.md index f8d098e..44db8b8 100644 --- a/docs/Enemy Glossary.md +++ b/docs/Enemy Glossary.md @@ -182,7 +182,7 @@ destroyed. ### 03 - Flying Capsule Other Names: Weapon Zeppelin, Power-Up Capsule, Weapon Wings, Weapon Drop, - or Flying Item Pod + Flying Item Pod, or Football Weapon Item transportation device that which travels from the left end of the screen to the other in a wave-like pattern. diff --git a/src/bank0.asm b/src/bank0.asm index c8d2eec..c7d98cd 100644 --- a/src/bank0.asm +++ b/src/bank0.asm @@ -345,7 +345,7 @@ set_weapon_item_sprite: lsr lsr ; flash every #$08 frames and #$03 ; keep bits .... ..xx - ora #$04 ; set bit 3 + ora #$04 ; set bit 2 (use palette defined in bits 0 and 1) sta ENEMY_SPRITE_ATTR,x ; update enemy sprite attribute so it flashes @set_sprite_code: @@ -735,7 +735,7 @@ flying_capsule_routine_01: ; weapon zeppelin pointer 3 flying_capsule_routine_02: - jmp play_explosion_sound + jmp play_explosion_sound ; create explosion sound and 2 sets of explosion type #$89 at location ; pointer table for rotating gun (#$a * #$2 = #$14 bytes) ; level 1 or level 3 enemy diff --git a/src/bank1.asm b/src/bank1.asm index b7a13e3..c57bbc9 100644 --- a/src/bank1.asm +++ b/src/bank1.asm @@ -1430,7 +1430,7 @@ init_pulse_and_noise_channels: lda #$00 tax -; write #$00-#$05 to $0106 +; write #$00 to all sound slots' sound code @loop: sta SOUND_CODE,x inx @@ -4100,10 +4100,10 @@ load_sprite_to_cpu_mem: iny ; increment sprite_xx read offset lda ($08),y ; load low byte of new sprite read address sta $06 ; store low byte into $06 - iny + iny ; increment sprite_xx read offset lda ($08),y ; load high byte of new sprite read address sta $09 ; replace existing read high byte in $09 with new address - lda $06 ; load low byte back into $06 + lda $06 ; load low byte sta $08 ; replace existing read low byte in $08 with new address ldy #$00 ; clear sprite_xx read offset since starting at new address @@ -4135,7 +4135,7 @@ load_sprite_to_cpu_mem: lda ($08),y ; read 3rd byte (sprite tile attributes) (Byte 2) and $0d ; keep/strip sprite palette from sprite tile byte 2, based on bit 2 of SPRITE_ATTR ora $00 ; merge sprite code tile byte 2 with attribute data from SPRITE_ATTR - eor $0b ; exclusive to handle flipping a flipped sprite tile, e.g. flip + flip = no flip + eor $0b ; exclusive or to handle flipping a flipped sprite tile, e.g. flip + flip = no flip sta OAMDMA_CPU_BUFFER+2,x ; write sprite attributes to CPU buffer iny ; increment sprite_xx read offset lda $0b @@ -4218,7 +4218,7 @@ draw_player_hud_sprites: ldy #$04 ; set hud_sprites base offset to show GAME OVER lsr bcs @four_sprites ; branch if in game over - ldy $00 ; not in game over, load number of lives remaining + ldy $00 ; not in game over, load number of lives remaining for current player lda P1_NUM_LIVES,y ; player y lives ldy #$00 ; set hud_sprites base offset to show medals cmp #$04 @@ -4231,18 +4231,18 @@ draw_player_hud_sprites: sta $01 ; store number of medals to draw in $01 @draw_p_sprite: - dec $01 ; decrement number of medals to draw - bmi @move_to_next_player ; if done drawing all sprites, move to next player - lda #$10 ; a = #$10 - sta OAMDMA_CPU_BUFFER,x ; set y position of medal/game over hud sprite to #$10 - lda hud_sprites,y ; load HUD sprite (either medal, or game over text) - sta OAMDMA_CPU_BUFFER+1,x ; write tile number to OAM + dec $01 ; decrement number of medals to draw + bmi @move_to_next_player ; if done drawing all sprites, move to next player + lda #$10 ; a = #$10 + sta OAMDMA_CPU_BUFFER,x ; set y position of medal/game over hud sprite to #$10 + lda hud_sprites,y ; load HUD sprite (either medal, or game over text) + sta OAMDMA_CPU_BUFFER+1,x ; write tile number to OAM lda $00 - sta OAMDMA_CPU_BUFFER+2,x ; write the tile attributes (blue palette for p1, red palette for p2) - lsr ; set carry flag if on player 2 - lda sprite_sprite_medal_x_offset,y ; load x offset based on sprite number + sta OAMDMA_CPU_BUFFER+2,x ; write the tile attributes (blue palette for p1, red palette for p2) + lsr ; set carry flag if on player 2 + lda sprite_medal_x_offset,y ; load x offset based on sprite number bcc @continue - adc #$af ; add #$af to sprite x offset if on player 2 (see previous lsr) + adc #$af ; add #$af to sprite x offset if on player 2 (see previous lsr) @continue: jsr set_x_adv_OAMDMA_addr ; set sprite tile x position (a) in OAMDMA and advance OAMDMA write address @@ -4263,7 +4263,7 @@ hud_sprites: .byte $0a,$0a,$0a,$0a ; medals .byte $02,$04,$06,$08 ; game over text -sprite_sprite_medal_x_offset: +sprite_medal_x_offset: .byte $10,$1c,$28,$34 .byte $10,$1c,$28,$34 diff --git a/src/bank7.asm b/src/bank7.asm index 16da256..fb2c632 100644 --- a/src/bank7.asm +++ b/src/bank7.asm @@ -341,7 +341,7 @@ remove_registers_from_stack_and_rti: pla ; remove byte from stack tay ; store in y pla ; remove byte from stack - tax ; story in x + tax ; store in x pla ; remove byte stack plp ; set cpu flags from stack @@ -2380,7 +2380,7 @@ change_ppu_write_address: lda #$01 ; specifies to increment graphic read address by 1 byte ldx #$00 ; specifies that the 2-byte graphic read address is located at $00 jsr advance_graphic_read_addr ; increment 2-byte graphic read address at $00 by 1 byte - jmp begin_ppu_graphics_block_write ; start populating nametable with zeros + jmp begin_ppu_graphics_block_write ; start writing graphics block to PPU ; handle when entire graphic data code has been read ; restore previously-loaded bank and re-init the PPU @@ -3905,7 +3905,7 @@ set_frame_scroll_weapon_strength: @p2_game_over_status: ldy P2_GAME_OVER_STATUS ; player 2 game over state (1 = game over) bne run_player_invincibility_and_weapon_strength ; branch if player 2 is in game over, or if this is a single player game - ora #$02 ; set bit 2 to #$01 when player 2 is not in game over + ora #$02 ; set bit 1 to #$01 when player 2 is not in game over ; a will be #$00 when both players are in game over ; a will be #$01 when player 1 not game over, player 2 game over (or not playing) @@ -5107,7 +5107,7 @@ apply_gravity: ; player death init_player_dec_num_lives: - jsr init_player_and_weapon + jsr init_player_and_weapon ; initialize player variables to 0 sta PLAYER_STATE,x ; set player state to #$00 (falling into level) lda P1_NUM_LIVES,x ; load player number of lives beq @set_game_over ; branch if no more lives @@ -5291,6 +5291,9 @@ set_carry_exit: sec ; set carry flag rts +; initialize player variables to 0 +; input +; * x - player offset (0 = p1, 1 = p2) init_player_and_weapon: lda #$00 ; a = #$00 sta P1_CURRENT_WEAPON,x ; reset current player's weapon