castleraider

changeset 335:a58a3d4023de

Moved some code in the plotting.oph file into a separate routine so that it can be used in the ending code. Worked on basic plotting code in the ending sequence.
author David Boddie <david@boddie.org.uk>
date Sat Oct 11 01:36:11 2014 +0200
parents eaf2149855f7
children b82acbb8d06c
files ending.oph plotting.oph
diffstat 2 files changed, 53 insertions(+), 32 deletions(-) [+]
line diff
     1.1 --- a/ending.oph	Fri Oct 10 00:22:36 2014 +0200
     1.2 +++ b/ending.oph	Sat Oct 11 01:36:11 2014 +0200
     1.3 @@ -33,34 +33,50 @@
     1.4      ldx #0
     1.5      game_completed_copy_loop:
     1.6  
     1.7 -        lda #4                          ; column 4 is text column 2
     1.8 -        jsr read_screen_address_bank2   ; $72,$73=address
     1.9 +        ; Traverse each column in the row
    1.10  
    1.11 -        lda $72     ; Use $70,$71 for the source address.
    1.12 -        sta $70
    1.13 -        lda $73
    1.14 -        sec
    1.15 -        sbc #$0a    ; Subtract 8 rows ($a00) from the address.
    1.16 -        sta $71
    1.17 -        clc
    1.18 +        ldy #0
    1.19 +        game_completed_column_loop:
    1.20  
    1.21 -        lda #4
    1.22 -        jsr read_screen_address_bank1   ; $72,$73=address
    1.23 +            lda #4                          ; Draw from column 4 to column 35,
    1.24 +            sta $74
    1.25 +            jsr read_screen_address_bank1   ; $72,$73=address
    1.26  
    1.27 -        lda $73
    1.28 -        sec
    1.29 -        sbc #$0a    ; Subtract 8 rows ($a00) from the address.
    1.30 -        sta $73
    1.31 -        clc
    1.32 +            lda $73
    1.33 +            sec
    1.34 +            sbc #$0a    ; Subtract 8 rows ($a00) from the address.
    1.35 +            sta $73
    1.36 +            clc
    1.37  
    1.38 -        ldy #255
    1.39 -        game_completed_copy_inner_loop:
    1.40 +            lda $72     ; Use $70,$71 for the source address.
    1.41 +            sta $70
    1.42 +            lda $73
    1.43 +            adc #$28    ; Find the corresponding bank 2 address.
    1.44 +            sta $71     ; This addition will not cause the carry flag to be set.
    1.45  
    1.46 -            lda ($70),y
    1.47 -            sta ($72),y
    1.48 -            dey
    1.49 -            cpy #255
    1.50 -            bne game_completed_copy_inner_loop
    1.51 +            game_completed_copy_inner_loop:
    1.52 +
    1.53 +                lda ($70),y
    1.54 +                sta ($72),y
    1.55 +
    1.56 +                jsr next_cell   ; Reuse a plotting routine to increase $72,$73
    1.57 +                                ; by 8 and $74 by 1.
    1.58 +
    1.59 +                lda $70
    1.60 +                adc #8
    1.61 +                sta $70
    1.62 +                lda $71
    1.63 +                adc #0
    1.64 +                sta $71
    1.65 +                clc
    1.66 +
    1.67 +                lda $74
    1.68 +                cmp #36
    1.69 +                bne game_completed_copy_inner_loop
    1.70 +
    1.71 +            iny
    1.72 +            cpy #8
    1.73 +            bne game_completed_column_loop
    1.74  
    1.75          inx
    1.76          cpx #12
     2.1 --- a/plotting.oph	Fri Oct 10 00:22:36 2014 +0200
     2.2 +++ b/plotting.oph	Sat Oct 11 01:36:11 2014 +0200
     2.3 @@ -981,15 +981,7 @@
     2.4  
     2.5      jsr plot_tile_bank
     2.6  
     2.7 -    lda $72
     2.8 -    adc #8
     2.9 -    sta $72
    2.10 -    lda $73
    2.11 -    adc #0
    2.12 -    sta $73
    2.13 -    clc
    2.14 -
    2.15 -    inc $74         ; one tile filled on the screen
    2.16 +    jsr next_cell
    2.17  
    2.18      lda bank_number ; check if we are showing bank 2 and plotting on bank 1
    2.19      cmp #1
    2.20 @@ -1016,6 +1008,19 @@
    2.21      initial_plot_bank_tile_loop_span_endloop1:
    2.22      jmp initial_plot_bank1_span_endloop
    2.23  
    2.24 +next_cell:
    2.25 +
    2.26 +    lda $72
    2.27 +    adc #8
    2.28 +    sta $72
    2.29 +    lda $73
    2.30 +    adc #0
    2.31 +    sta $73
    2.32 +    clc
    2.33 +
    2.34 +    inc $74         ; one tile filled on the screen
    2.35 +    rts
    2.36 +
    2.37  player_sprites_low:  .byte <player_left1, <player_left2, <player_right1, <player_right2
    2.38  player_sprites_high: .byte >player_left1, >player_left2, >player_right1, >player_right2
    2.39  player_y_offset:     .byte 0, 4