use named memory addresses for score tiles
This commit is contained in:
parent
a21a428fd5
commit
af8d290492
|
@ -1482,9 +1482,9 @@ bank_1_unused_label_00:
|
|||
pha
|
||||
ldx #$00 ; x = #$00
|
||||
stx $e6
|
||||
lda $010a
|
||||
lda SOUND_CODE+4
|
||||
beq @pop_and_exit
|
||||
stx $010a ; set sound channel config register offset (#$00, #$04, #$08, or #$0c)
|
||||
stx SOUND_CODE+4 ; set sound channel config register offset (#$00, #$04, #$08, or #$0c)
|
||||
stx SOUND_CHNL_REG_OFFSET ; set sound channel config register offset (#$00, #$04, #$08, or #$0c)
|
||||
jsr init_pulse_channel
|
||||
|
||||
|
|
|
@ -303,7 +303,7 @@ nmi_start:
|
|||
bne handle_sounds_set_ppu_scroll_rti ; branch if nmi occurred before game loop was completed to skip game loop
|
||||
; instead just continue playing sounds, set ppu scroll, and rti
|
||||
; previously unfinished frame will finish after rti and then itself rti
|
||||
jsr clear_ppu ; first frame, so clear/init PPU
|
||||
jsr clear_ppu ; re-init PPU
|
||||
sta OAMADDR ; set OAM address to #00 (DMA is used instead)
|
||||
ldy #>OAMDMA_CPU_BUFFER ; setting OAMDMA to #$02 tells PPU to load sprite data from $0200-$02ff
|
||||
sty OAMDMA ; write #$100 (256 decimal) bytes ($0200 to $02ff) of data to PPU OAM (the entire screen)
|
||||
|
@ -2438,12 +2438,12 @@ draw_player_num_lives:
|
|||
beq @exit ; exit if just drew a 0, meaning no more digits to draw
|
||||
|
||||
@write_num_lives:
|
||||
sta $06fe,y ; set ones digit
|
||||
sta CPU_GRAPHICS_BUFFER-2,y ; set ones digit
|
||||
txa ; transfer 10s digit to a
|
||||
beq @exit ; exit without drawing 10s digit if #$00
|
||||
ora #$30 ; converting number to pattern tile offset
|
||||
; #$31 = 1, #$32 = 2, etc.
|
||||
sta $06fd,y ; set 10s digit of num lives
|
||||
sta CPU_GRAPHICS_BUFFER-3,y ; set 10s digit of num lives
|
||||
|
||||
@exit:
|
||||
rts
|
||||
|
@ -2461,7 +2461,7 @@ draw_stage_and_level_name:
|
|||
lda CURRENT_LEVEL ; current level number
|
||||
clc ; clear carry in preparation for addition
|
||||
adc #$31
|
||||
sta $06fe,x ; draw current level
|
||||
sta CPU_GRAPHICS_BUFFER-2,x ; draw current level
|
||||
lda CURRENT_LEVEL ; current level
|
||||
adc #$11 ; string id = level number + 11
|
||||
jmp load_bank_6_write_text_palette_to_mem ; draw text string
|
||||
|
@ -2507,7 +2507,7 @@ draw_the_scores:
|
|||
jsr calculate_score_digit ; calculate next digit and store into $02
|
||||
lda $02 ; load the digit of the score to display from $02
|
||||
ora #$30 ; convert from number to character to display. In Contra 30 = 0, 31 = 1, etc.
|
||||
sta $06fc,x ; draw digit
|
||||
sta CPU_GRAPHICS_BUFFER-4,x ; draw digit
|
||||
dex ; move to the previous digit (score drawn right to left)
|
||||
lda $00 ; load current low byte of score
|
||||
ora $01 ; combine low byte with high byte
|
||||
|
@ -2523,17 +2523,17 @@ draw_the_scores:
|
|||
ora $02 ; see if score is #$00
|
||||
beq @draw_zero_score ; handle when the score is #$00 (don't tack on ending 00s)
|
||||
lda #$30 ; set the character to display to 0
|
||||
sta $06fd,x ; display the character '0'
|
||||
sta CPU_GRAPHICS_BUFFER-3,x ; display the character '0'
|
||||
|
||||
@draw_final_0_exit:
|
||||
sta $06fe,x ; display the character '0'
|
||||
sta CPU_GRAPHICS_BUFFER-2,x ; display the character '0'
|
||||
|
||||
@exit:
|
||||
rts
|
||||
|
||||
; handle the case when player score is $00, i.e. no points were scored
|
||||
@draw_zero_score:
|
||||
sta $06fc,x ; this is the first decimal digit of the score, set it to '0'
|
||||
sta CPU_GRAPHICS_BUFFER-4,x ; this is the first decimal digit of the score, set it to '0'
|
||||
lda #$30 ; display the character '0'
|
||||
bne @draw_final_0_exit ; always branch, to exit out of @draw_score_digit
|
||||
|
||||
|
|
Loading…
Reference in New Issue