castleraider

changeset 340:cfd396bc7d4f

More preparatory work for the ending sequence.
author David Boddie <david@boddie.org.uk>
date Sun Oct 12 23:46:28 2014 +0200
parents 4e2c053a8d56
children 245eb88d1ec8
files ending.oph
diffstat 1 files changed, 22 insertions(+), 23 deletions(-) [+]
line diff
     1.1 --- a/ending.oph	Sun Oct 12 19:44:45 2014 +0200
     1.2 +++ b/ending.oph	Sun Oct 12 23:46:28 2014 +0200
     1.3 @@ -40,14 +40,13 @@
     1.4  
     1.5          lda $72
     1.6          sta $78
     1.7 +        sta $76     ; Use $76,$77 for the source address.
     1.8          lda $73
     1.9          sec
    1.10          sbc #$0a    ; Subtract 8 rows ($a00) from the address.
    1.11          sta $79
    1.12          clc
    1.13  
    1.14 -        lda $78     ; Use $76,$77 for the source address.
    1.15 -        sta $76
    1.16          lda $79
    1.17          adc #$28    ; Find the corresponding bank 2 address.
    1.18          sta $77     ; This addition will not cause the carry flag to be set.
    1.19 @@ -56,8 +55,8 @@
    1.20          jsr plot_roll
    1.21          ldx $7a
    1.22  
    1.23 -        inc $75                     ; Increment the vertical counter.
    1.24          lda $75
    1.25 +        adc #1                      ; Increment the vertical counter.
    1.26          and #$07
    1.27          sta $75
    1.28          bne game_completed_copy_loop
    1.29 @@ -77,32 +76,28 @@
    1.30                  ; $78,$79=start address of a row in the display area
    1.31                  ; $75=offset within the row (0 - 7) to start from
    1.32  
    1.33 -    lda $78     ; Set the initial destination address within the row.
    1.34 -    adc $75
    1.35 -    sta $78
    1.36 -
    1.37 -    lda $76     ; Set the initial destination address within the row.
    1.38 -    adc $75
    1.39 -    sta $76
    1.40 -
    1.41      lda $75
    1.42 -    tax         ; Use the row offset as an index.
    1.43      adc #8
    1.44      sta $7b     ; Define an end value for the index.
    1.45  
    1.46      ldy #0
    1.47 +    ldx $75     ; Use the row offset as an index.
    1.48  
    1.49      plot_roll_loop:
    1.50  
    1.51 -        ldx #4
    1.52 -        plot_roll_restore_addresses_loop:
    1.53 -            dex
    1.54 -            lda $76,x
    1.55 -            sta $70,x
    1.56 -            cpx #0
    1.57 -            bne plot_roll_restore_addresses_loop
    1.58 +        lda $78
    1.59 +        adc roll_row_offsets_low,x
    1.60 +        sta $72
    1.61 +        lda $79
    1.62 +        adc roll_row_offsets_high,x
    1.63 +        sta $73
    1.64  
    1.65 -        clc
    1.66 +        lda $76
    1.67 +        adc roll_row_offsets_low,x
    1.68 +        sta $70
    1.69 +        lda $77
    1.70 +        adc roll_row_offsets_high,x
    1.71 +        sta $71
    1.72  
    1.73          lda #4                  ; Draw from column 4 to column 35.
    1.74          sta $74
    1.75 @@ -126,9 +121,8 @@
    1.76              cmp #36
    1.77              bne plot_roll_pixel_row_loop
    1.78  
    1.79 -        inc $75
    1.80 -        lda $75
    1.81 -        cmp $7b
    1.82 +        inx
    1.83 +        cpx $7b
    1.84          bne plot_roll_loop
    1.85  
    1.86      plot_roll_exit:
    1.87 @@ -141,3 +135,8 @@
    1.88  completed_text_end:
    1.89  
    1.90  .alias completed_text_length [completed_text_end - completed_text]
    1.91 +
    1.92 +roll_row_offsets_low:   .byte 0,1,2,3,4,5,6,7,$40,$41,$42,$43,$44,$45,$46
    1.93 +roll_row_offsets_high:  .byte 0,0,0,0,0,0,0,0,1,1,1,1,1,1,1
    1.94 +
    1.95 +roll_row_source_offsets: .byte 0,7,6,5,4,3,2,1