junglejourney

changeset 152:ac122386cbad

Changed the vertical movement step size to 6 pixels as suggested in feedback from the first play test release.
author David Boddie <david@boddie.org.uk>
date Sat Sep 17 02:20:39 2011 +0200
parents 4eab1c5c40e1
children 7ae6c30ce06b
files build.py mapcode.oph
diffstat 2 files changed, 342 insertions(+), 347 deletions(-) [+]
line diff
     1.1 --- a/build.py	Tue Sep 13 21:13:01 2011 +0200
     1.2 +++ b/build.py	Sat Sep 17 02:20:39 2011 +0200
     1.3 @@ -89,7 +89,7 @@
     1.4      #        item: bits 0,1,2,3 are type, bit 2 is weapon/treasure
     1.5      #              0-3 weapons, 4 key, 5-8 treasure)
     1.6      #   n+2 y room offset (0-10)
     1.7 -    #   n+3 dy (0-5)
     1.8 +    #   n+3 dy (0-3)
     1.9      #   n+4 x room offset (0-10)
    1.10      #   n+5 dx (0-3)
    1.11      #
     2.1 --- a/mapcode.oph	Tue Sep 13 21:13:01 2011 +0200
     2.2 +++ b/mapcode.oph	Sat Sep 17 02:20:39 2011 +0200
     2.3 @@ -409,8 +409,7 @@
     2.4  
     2.5      ; Fill in the room details.
     2.6  
     2.7 -    lda $7f
     2.8 -    adc $79
     2.9 +    lda $79
    2.10      sta $7c
    2.11      sec
    2.12      ldx $578a
    2.13 @@ -930,156 +929,204 @@
    2.14  
    2.15  room_palettes: .byte 1, 6, 5, 7
    2.16  
    2.17 +; Sprite data stored in memory: 00 04 08 0c 10 14 18 1c 20 24 28 2c
    2.18 +
    2.19  plot8x24_y0:            ; $70,$71=source address
    2.20                          ; $72,$73=destination address
    2.21 -    ldy #15
    2.22 -
    2.23 -    plotloop8x24_y0_0:
    2.24 -        lda ($70),y
    2.25 -        eor ($72),y
    2.26 -        sta ($72),y
    2.27 -        dey
    2.28 -        bpl plotloop8x24_y0_0
    2.29 -    clc
    2.30 -
    2.31 -    lda $72
    2.32 -    adc #$30
    2.33 -    sta $72
    2.34 -    lda $73
    2.35 -    adc #$01
    2.36 -    sta $73     ; 0x140 - 16
    2.37 -    clc
    2.38 -
    2.39 -    ldy #31
    2.40 -
    2.41 -    plotloop8x24_y0_1:
    2.42 -        lda ($70),y
    2.43 -        eor ($72),y
    2.44 -        sta ($72),y
    2.45 -        dey
    2.46 -        cpy #16
    2.47 -        bpl plotloop8x24_y0_1
    2.48 -    clc
    2.49 -
    2.50 -    lda $72
    2.51 -    adc #$30
    2.52 -    sta $72
    2.53 -    lda $73
    2.54 -    adc #$01
    2.55 -    sta $73     ; 0x140 - 16
    2.56 -    clc
    2.57 -
    2.58 -    ldy #47
    2.59 -
    2.60 -    plotloop8x24_y0_2:
    2.61 -        lda ($70),y
    2.62 -        eor ($72),y
    2.63 -        sta ($72),y
    2.64 -        dey
    2.65 -        cpy #32
    2.66 -        bpl plotloop8x24_y0_2
    2.67 -
    2.68 -    clc
    2.69 -    jmp plot_buffer_loop_next
    2.70 -
    2.71 -; Sprite data stored in memory: 00 04 08 0c 10 14 18 1c 20 24 28 2c
    2.72 -;
    2.73 -; Write to screen in this arrangement:
    2.74 -; -- --
    2.75 -; 00 08
    2.76 -;
    2.77 -; 04 0c
    2.78 -; 10 18
    2.79 -;
    2.80 -; 14 1c
    2.81 -; 20 28
    2.82 -;
    2.83 -; 24 2c
    2.84 -
    2.85 -plot8x24_y1:            ; $70,$71=source address
    2.86 -                        ; $72,$73=destination address
    2.87 -
    2.88 -    ldx #2              ; plotting 3 8x8 pieces
    2.89 -
    2.90 -    plotloop8x24_y1_loop:
    2.91 -
    2.92 -        ldy #3
    2.93 -
    2.94 -        plotloop8x24_y1_0:
    2.95 +
    2.96 +    ldx #2
    2.97 +
    2.98 +    plot8x24_y0_loop:
    2.99 +
   2.100 +        ldy #15
   2.101 +
   2.102 +        plotloop8x24_y0_0:
   2.103              lda ($70),y
   2.104              eor ($72),y
   2.105              sta ($72),y
   2.106              dey
   2.107 -            bpl plotloop8x24_y1_0
   2.108 +            bpl plotloop8x24_y0_0
   2.109 +
   2.110 +        dex
   2.111 +        bmi plot8x24_y0_exit
   2.112 +        
   2.113 +        lda $72
   2.114 +        adc #$40
   2.115 +        sta $72
   2.116 +        lda $73
   2.117 +        adc #$01
   2.118 +        sta $73
   2.119          clc
   2.120  
   2.121 -        ldy #11
   2.122 -
   2.123 -        plotloop8x24_y1_1:
   2.124 -            lda ($70),y
   2.125 -            eor ($72),y
   2.126 -            sta ($72),y
   2.127 -            dey
   2.128 -            cpy #8
   2.129 -            bpl plotloop8x24_y1_1
   2.130 -        clc
   2.131 -
   2.132          lda $70
   2.133 -        adc #4
   2.134 +        adc #16
   2.135          sta $70
   2.136          lda $71
   2.137          adc #0
   2.138          sta $71
   2.139          clc
   2.140  
   2.141 -        lda $72
   2.142 -        adc #$3c
   2.143 +        jmp plot8x24_y0_loop
   2.144 +
   2.145 +    plot8x24_y0_exit:
   2.146 +    clc
   2.147 +    jmp plot_buffer_loop_next
   2.148 +
   2.149 +
   2.150 +plot8x8_y1:             ; $70,$71=source address
   2.151 +                        ; $72,$73=destination address
   2.152 +    lda #2
   2.153 +    sta $7e
   2.154 +    lda #10
   2.155 +    sta $7f
   2.156 +
   2.157 +    lda #0              ; plotting 1 8x8 piece
   2.158 +    sta $8a
   2.159 +
   2.160 +    jmp plot8x24_y123   ; optimise away the rts
   2.161 +
   2.162 +plot8x24_y1:            ; $70,$71=source address
   2.163 +                        ; $72,$73=destination address
   2.164 +    lda #2
   2.165 +    sta $7e
   2.166 +    lda #10
   2.167 +    sta $7f
   2.168 +
   2.169 +    lda #2              ; plotting 3 8x8 pieces
   2.170 +    sta $8a
   2.171 +
   2.172 +    jmp plot8x24_y123   ; optimise away the rts
   2.173 +
   2.174 +plot8x8_y2:             ; $70,$71=source address
   2.175 +                        ; $72,$73=destination address
   2.176 +    lda #4
   2.177 +    sta $7e
   2.178 +    lda #12
   2.179 +    sta $7f
   2.180 +
   2.181 +    lda #0              ; plotting 1 8x8 piece
   2.182 +    sta $8a
   2.183 +
   2.184 +    jmp plot8x24_y123   ; optimise away the rts
   2.185 +
   2.186 +plot8x24_y2:            ; $70,$71=source address
   2.187 +                        ; $72,$73=destination address
   2.188 +    lda #4
   2.189 +    sta $7e
   2.190 +    lda #12
   2.191 +    sta $7f
   2.192 +
   2.193 +    lda #2              ; plotting 3 8x8 pieces
   2.194 +    sta $8a
   2.195 +
   2.196 +    jmp plot8x24_y123   ; optimise away the rts
   2.197 +
   2.198 +plot8x8_y3:             ; $70,$71=source address
   2.199 +                        ; $72,$73=destination address
   2.200 +    lda #6
   2.201 +    sta $7e
   2.202 +    lda #14
   2.203 +    sta $7f
   2.204 +
   2.205 +    lda #0              ; plotting 1 8x8 piece
   2.206 +    sta $8a
   2.207 +
   2.208 +    jmp plot8x24_y123   ; optimise away the rts
   2.209 +
   2.210 +plot8x24_y3:            ; $70,$71=source address
   2.211 +                        ; $72,$73=destination address
   2.212 +    lda #6
   2.213 +    sta $7e
   2.214 +    lda #14
   2.215 +    sta $7f
   2.216 +
   2.217 +    lda #2              ; plotting 3 8x8 pieces
   2.218 +    sta $8a
   2.219 +
   2.220 +    ; Run on into the next routine.
   2.221 +
   2.222 +plot8x24_y123:          ; $70,$71=source address
   2.223 +                        ; $72,$73=destination address
   2.224 +                        ; $7e=offset into source data for first column
   2.225 +                        ; $7f=offset into source data for second column
   2.226 +
   2.227 +    plot8x24_y123_loop:
   2.228 +
   2.229 +        ldx #0
   2.230 +        plot8x24_y123_upper_loop_outer:
   2.231 +
   2.232 +            ldy $7e,x
   2.233 +            lda plot_upper_offsets,x
   2.234 +            sta $89
   2.235 +
   2.236 +            plot8x24_y123_upper_loop_inner:     ; plot the first column until
   2.237 +                dey                             ; we reach the start
   2.238 +                cpy $89
   2.239 +                bmi plot8x24_y123_upper_loop_inner_endloop
   2.240 +                lda ($70),y
   2.241 +                eor ($72),y
   2.242 +                sta ($72),y
   2.243 +                jmp plot8x24_y123_upper_loop_inner
   2.244 +
   2.245 +            plot8x24_y123_upper_loop_inner_endloop:
   2.246 +            clc
   2.247 +
   2.248 +            inx
   2.249 +            cpx #2
   2.250 +            bne plot8x24_y123_upper_loop_outer
   2.251 +
   2.252 +        clc
   2.253 +        lda $72       ; move the destination pointer to refer to the next line
   2.254 +        adc #$38
   2.255          sta $72
   2.256          lda $73
   2.257          adc #$01
   2.258          sta $73
   2.259          clc
   2.260  
   2.261 -        ldy #3
   2.262 -
   2.263 -        plotloop8x24_y1_2:
   2.264 -            lda ($70),y
   2.265 -            eor ($72),y
   2.266 -            sta ($72),y
   2.267 -            dey
   2.268 -            bpl plotloop8x24_y1_2
   2.269 +        ldx #0
   2.270 +        plot8x24_y123_lower_loop_outer:
   2.271 +        
   2.272 +            lda plot_lower_offsets,x
   2.273 +            tay
   2.274 +            lda $7e,x
   2.275 +            sta $89
   2.276 +
   2.277 +            plot8x24_y123_lower_loop_inner: ; plot until we reach the initial
   2.278 +                lda ($70),y                 ; offset for the column
   2.279 +                eor ($72),y
   2.280 +                sta ($72),y
   2.281 +                dey
   2.282 +                cpy $89
   2.283 +                bpl plot8x24_y123_lower_loop_inner
   2.284 +
   2.285 +            inx
   2.286 +            cpx #2
   2.287 +            bne plot8x24_y123_lower_loop_outer
   2.288 +        
   2.289 +        dec $8a
   2.290 +        bmi plot8x24_y123_exit
   2.291 +
   2.292          clc
   2.293 -
   2.294 -        ldy #11
   2.295 -
   2.296 -        plotloop8x24_y1_3:
   2.297 -            lda ($70),y
   2.298 -            eor ($72),y
   2.299 -            sta ($72),y
   2.300 -            dey
   2.301 -            cpy #8
   2.302 -            bpl plotloop8x24_y1_3
   2.303 -        clc
   2.304 -
   2.305 -        lda $70
   2.306 -        adc #12
   2.307 +        lda $70         ; update the source pointer to refer to the next piece
   2.308 +        adc #16         ; of sprite data
   2.309          sta $70
   2.310          lda $71
   2.311          adc #0
   2.312          sta $71
   2.313          clc
   2.314  
   2.315 -        lda $72
   2.316 -        adc #4
   2.317 +        lda $72         ; update the destination pointer to point to the next
   2.318 +        adc #8          ; space
   2.319          sta $72
   2.320          lda $73
   2.321          adc #0
   2.322          sta $73
   2.323          clc
   2.324  
   2.325 -        dex
   2.326 -        bpl plotloop8x24_y1_loop
   2.327 -
   2.328 +        jmp plot8x24_y123_loop
   2.329 +
   2.330 +    plot8x24_y123_exit:
   2.331      clc
   2.332      jmp plot_buffer_loop_next
   2.333  
   2.334 @@ -1117,115 +1164,140 @@
   2.335      jmp plot_buffer_loop_next
   2.336  
   2.337  ; Sprite data stored in memory: 00 04 08 0c 10 14 18 1c 20 24 28 2c 30 34 38 3c
   2.338 -;
   2.339 -; Write to screen in this arrangement:
   2.340 -; -- -- -- --
   2.341 -; 00 08 10 18
   2.342 -;
   2.343 -; 04 0c 14 1c
   2.344 -; 20 28 30 38
   2.345 -;
   2.346 -; 24 2c 34 3c
   2.347  
   2.348  plot16x16_y1:           ; $70,$71=source address
   2.349                          ; $72,$73=destination address
   2.350  
   2.351 -    ldx #3
   2.352 -
   2.353 -    plotloop16x16_y1_loop:
   2.354 -
   2.355 -        ldy #3
   2.356 -
   2.357 -        plotloop16x16_y1_0:
   2.358 -            lda ($70),y
   2.359 -            eor ($72),y
   2.360 -            sta ($72),y
   2.361 -            dey
   2.362 -            bpl plotloop16x16_y1_0
   2.363 +    lda #2
   2.364 +    sta $7e
   2.365 +    lda #10
   2.366 +    sta $7f
   2.367 +    lda #18
   2.368 +    sta $80
   2.369 +    lda #26
   2.370 +    sta $81
   2.371 +    jmp plot16x16_y123  ; optimise away the rts
   2.372 +
   2.373 +plot16x16_y2:           ; $70,$71=source address
   2.374 +                        ; $72,$73=destination address
   2.375 +
   2.376 +    lda #4
   2.377 +    sta $7e
   2.378 +    lda #12
   2.379 +    sta $7f
   2.380 +    lda #20
   2.381 +    sta $80
   2.382 +    lda #28
   2.383 +    sta $81
   2.384 +    jmp plot16x16_y123  ; optimise away the rts
   2.385 +
   2.386 +plot16x16_y3:           ; $70,$71=source address
   2.387 +                        ; $72,$73=destination address
   2.388 +
   2.389 +    lda #6
   2.390 +    sta $7e
   2.391 +    lda #14
   2.392 +    sta $7f
   2.393 +    lda #22
   2.394 +    sta $80
   2.395 +    lda #30
   2.396 +    sta $81
   2.397 +    ; Run on into the next routine.
   2.398 +
   2.399 +plot16x16_y123:         ; $70,$71=source address
   2.400 +                        ; $72,$73=destination address
   2.401 +                        ; $7e=offset into source data for first column
   2.402 +                        ; $7f=offset into source data for second column
   2.403 +                        ; $80=offset into source data for third column
   2.404 +                        ; $81=offset into source data for fourth column
   2.405 +
   2.406 +    lda #1
   2.407 +    sta $8a
   2.408 +
   2.409 +    plot16x16_y123_loop:
   2.410 +
   2.411 +        ldx #0
   2.412 +        plot16x16_y123_upper_loop_outer:
   2.413 +
   2.414 +            ldy $7e,x
   2.415 +            lda plot_upper_offsets,x
   2.416 +            sta $89
   2.417 +
   2.418 +            plot16x16_y123_upper_loop_inner:
   2.419 +
   2.420 +                dey
   2.421 +                cpy $89
   2.422 +                bmi plot16x16_y123_upper_loop_inner_endloop
   2.423 +                lda ($70),y
   2.424 +                eor ($72),y
   2.425 +                sta ($72),y
   2.426 +                jmp plot16x16_y123_upper_loop_inner
   2.427 +
   2.428 +            plot16x16_y123_upper_loop_inner_endloop:
   2.429 +            clc
   2.430 +
   2.431 +            inx
   2.432 +            cpx #4
   2.433 +            bne plot16x16_y123_upper_loop_outer
   2.434 +
   2.435          clc
   2.436 -
   2.437 -        ldy #11
   2.438 -
   2.439 -        plotloop16x16_y1_1:
   2.440 -            lda ($70),y
   2.441 -            eor ($72),y
   2.442 -            sta ($72),y
   2.443 -            dey
   2.444 -            cpy #8
   2.445 -            bpl plotloop16x16_y1_1
   2.446 +        lda $72       ; move the destination pointer to refer to the next line
   2.447 +        adc #$38
   2.448 +        sta $72
   2.449 +        lda $73
   2.450 +        adc #$01
   2.451 +        sta $73
   2.452          clc
   2.453  
   2.454 -        ldy #19
   2.455 -
   2.456 -        plotloop16x16_y1_2:
   2.457 -            lda ($70),y
   2.458 -            eor ($72),y
   2.459 -            sta ($72),y
   2.460 -            dey
   2.461 -            cpy #16
   2.462 -            bpl plotloop16x16_y1_2
   2.463 +        ldx #0
   2.464 +        plot16x16_y123_lower_loop_outer:
   2.465 +
   2.466 +            lda plot_lower_offsets,x
   2.467 +            tay
   2.468 +            lda $7e,x
   2.469 +            sta $89
   2.470 +
   2.471 +            plot16x16_y123_lower_loop_inner:    ; plot until we reach the initial offset
   2.472 +                lda ($70),y                     ; for the column
   2.473 +                eor ($72),y
   2.474 +                sta ($72),y
   2.475 +                dey
   2.476 +                cpy $89
   2.477 +                bpl plot16x16_y123_lower_loop_inner
   2.478 +
   2.479 +            inx
   2.480 +            cpx #4
   2.481 +            bne plot16x16_y123_lower_loop_outer
   2.482 +
   2.483 +        dec $8a
   2.484 +        bmi plot16x16_y123_exit
   2.485 +
   2.486          clc
   2.487 -
   2.488 -        ldy #27
   2.489 -
   2.490 -        plotloop16x16_y1_3:
   2.491 -            lda ($70),y
   2.492 -            eor ($72),y
   2.493 -            sta ($72),y
   2.494 -            dey
   2.495 -            cpy #24
   2.496 -            bpl plotloop16x16_y1_3
   2.497 -        clc
   2.498 -
   2.499 -        dex
   2.500 -        bmi plotloop16x16_y1_exit
   2.501 -        txa
   2.502 -        and #1
   2.503 -        bne plotloop16x16_y1_loop_next
   2.504 -
   2.505 -        lda $70         ; add by 4 to start the next half row
   2.506 -        adc #4
   2.507 +        lda $70         ; update the source pointer to refer to the next piece
   2.508 +        adc #32         ; of sprite data
   2.509          sta $70
   2.510          lda $71
   2.511          adc #0
   2.512          sta $71
   2.513          clc
   2.514  
   2.515 -        lda $72         ; add 0x140 - 4 to plot the next top half row
   2.516 -        adc #$3c
   2.517 -        sta $72
   2.518 -        lda $73
   2.519 -        adc #$01
   2.520 -        sta $73
   2.521 -        clc
   2.522 -
   2.523 -        jmp plotloop16x16_y1_loop
   2.524 -
   2.525 -        plotloop16x16_y1_loop_next:
   2.526 -        clc
   2.527 -
   2.528 -        lda $70         ; add 28 to start the next row
   2.529 -        adc #$1c
   2.530 -        sta $70
   2.531 -        lda $71
   2.532 -        adc #0
   2.533 -        sta $71
   2.534 -        clc
   2.535 -
   2.536 -        lda $72         ; add 4 to plot the next half row
   2.537 -        adc #4
   2.538 +        lda $72         ; update the destination pointer to point to the next
   2.539 +        adc #8          ; space
   2.540          sta $72
   2.541          lda $73
   2.542          adc #0
   2.543          sta $73
   2.544          clc
   2.545  
   2.546 -        jmp plotloop16x16_y1_loop
   2.547 -
   2.548 -    plotloop16x16_y1_exit:
   2.549 +        jmp plot16x16_y123_loop
   2.550 +
   2.551 +    plot16x16_y123_exit:
   2.552      clc
   2.553      jmp plot_buffer_loop_next
   2.554  
   2.555 +plot_upper_offsets: .byte 0, 8, 16, 24
   2.556 +plot_lower_offsets: .byte 7, 15, 23, 31
   2.557 +
   2.558  plot8x8_y0:             ; $70,$71=source address
   2.559                          ; $72,$73=destination address
   2.560      ldy #15
   2.561 @@ -1240,69 +1312,6 @@
   2.562  
   2.563      jmp plot_buffer_loop_next
   2.564  
   2.565 -; Sprite data stored in memory: 00 04
   2.566 -;
   2.567 -; Write to screen in this arrangement:
   2.568 -; --
   2.569 -; 00
   2.570 -;
   2.571 -; 04
   2.572 -
   2.573 -plot8x8_y1:             ; $70,$71=source address
   2.574 -                        ; $72,$73=destination address
   2.575 -
   2.576 -    ldx #1
   2.577 -
   2.578 -    plotloop8x8_y1_loop:
   2.579 -
   2.580 -        ldy #3
   2.581 -
   2.582 -        plotloop8x8_y1_0:
   2.583 -            lda ($70),y
   2.584 -            eor ($72),y
   2.585 -            sta ($72),y
   2.586 -            dey
   2.587 -            bpl plotloop8x8_y1_0
   2.588 -        clc
   2.589 -
   2.590 -        ldy #11
   2.591 -
   2.592 -        plotloop8x8_y1_1:
   2.593 -            lda ($70),y
   2.594 -            eor ($72),y
   2.595 -            sta ($72),y
   2.596 -            dey
   2.597 -            cpy #8
   2.598 -            bpl plotloop8x8_y1_1
   2.599 -        clc
   2.600 -
   2.601 -        dex
   2.602 -        bmi plot8x8_y1_exit
   2.603 -        clc
   2.604 -
   2.605 -        lda $70         ; add by 4 to start the next half row
   2.606 -        adc #4
   2.607 -        sta $70
   2.608 -        lda $71
   2.609 -        adc #0
   2.610 -        sta $71
   2.611 -        clc
   2.612 -
   2.613 -        lda $72         ; subtract by 0x140 - 4 to plot the next top half row
   2.614 -        adc #$3c
   2.615 -        sta $72
   2.616 -        lda $73
   2.617 -        adc #$01
   2.618 -        sta $73
   2.619 -        clc
   2.620 -
   2.621 -        jmp plotloop8x8_y1_loop
   2.622 -
   2.623 -    plot8x8_y1_exit:
   2.624 -    clc
   2.625 -
   2.626 -    jmp plot_buffer_loop_next
   2.627 -
   2.628  
   2.629  check_key:      ; x=key code
   2.630      lda #129    ; returns y=255 or 0
   2.631 @@ -1315,8 +1324,8 @@
   2.632  
   2.633  screen_rows_low: .byte $80,$40,$00,$c0,$80,$40,$00,$c0,$80,$40
   2.634  screen_rows_high: .byte $5a,$5e,$62,$65,$69,$6d,$71,$74,$78,$7c
   2.635 -screen_subrows_low: .byte $00,$04,$40,$44,$80,$84
   2.636 -screen_subrows_high: .byte $00,$00,$01,$01,$02,$02
   2.637 +screen_subrows_low: .byte $00,$06,$44,$82
   2.638 +screen_subrows_high: .byte $00,$00,$01,$02
   2.639  
   2.640  screen_columns_low: .byte $00,$20,$40,$60,$80,$a0,$c0,$e0,$00,$20
   2.641  screen_columns_high: .byte $00,$00,$00,$00,$00,$00,$00,$00,$01,$01
   2.642 @@ -1435,17 +1444,9 @@
   2.643      ; Use the dy value to determine which plotting routine to use.
   2.644  
   2.645      ldy #0
   2.646 -    lda $76
   2.647 -    and #1
   2.648 -    bne plot_characters_plot_8x24_1
   2.649 -
   2.650 -    lda #1
   2.651 -    sta ($78),y
   2.652 -    jmp plot_characters_stored
   2.653 -
   2.654 -    plot_characters_plot_8x24_1:
   2.655 -    clc
   2.656 -    lda #2
   2.657 +    ldx $76
   2.658 +    lda plot_routine_indices_8x24,x
   2.659 +
   2.660      sta ($78),y
   2.661      jmp plot_characters_stored
   2.662  
   2.663 @@ -1467,17 +1468,9 @@
   2.664      ; Use the dy value to determine which plotting routine to use.
   2.665  
   2.666      ldy #0
   2.667 -    lda $76
   2.668 -    and #1
   2.669 -    bne plot_characters_plot_8x8_1
   2.670 -
   2.671 -    lda #3
   2.672 -    sta ($78),y
   2.673 -    jmp plot_characters_stored
   2.674 -
   2.675 -    plot_characters_plot_8x8_1:
   2.676 -    clc
   2.677 -    lda #4
   2.678 +    ldx $76
   2.679 +    lda plot_routine_indices_8x8,x
   2.680 +
   2.681      sta ($78),y
   2.682      jmp plot_characters_stored
   2.683  
   2.684 @@ -1549,17 +1542,9 @@
   2.685      ; Use the dy value to determine which plotting routine to use.
   2.686  
   2.687      ldy #0
   2.688 -    lda $76
   2.689 -    and #1
   2.690 -    bne plot_characters_plot_16x16_1
   2.691 -
   2.692 -    lda #5
   2.693 -    sta ($78),y
   2.694 -    jmp plot_characters_stored
   2.695 -
   2.696 -    plot_characters_plot_16x16_1:
   2.697 -    clc
   2.698 -    lda #6
   2.699 +    ldx $76
   2.700 +    lda plot_routine_indices_16x16,x
   2.701 +
   2.702      sta ($78),y
   2.703  
   2.704      plot_characters_stored:
   2.705 @@ -1592,6 +1577,10 @@
   2.706      clc
   2.707      rts
   2.708  
   2.709 +plot_routine_indices_8x24:  .byte 1, 2, 3, 4
   2.710 +plot_routine_indices_8x8:   .byte 5, 6, 7, 8
   2.711 +plot_routine_indices_16x16: .byte 9, 10, 11, 12
   2.712 +
   2.713  reset_plot_buffer:
   2.714      lda #$06    ; reset the index into the plot buffer
   2.715      sta $84
   2.716 @@ -1614,8 +1603,15 @@
   2.717      sta ($82),y
   2.718      rts
   2.719  
   2.720 -plot_buffer_types_low:  .byte <plot_buffer_loop_next, <plot8x24_y0, <plot8x24_y1, <plot8x8_y0, <plot8x8_y1, <plot16x16_y0, <plot16x16_y1
   2.721 -plot_buffer_types_high: .byte >plot_buffer_loop_next, >plot8x24_y0, >plot8x24_y1, >plot8x8_y0, >plot8x8_y1, >plot16x16_y0, >plot16x16_y1
   2.722 +plot_buffer_types_low:  .byte <plot_buffer_loop_next
   2.723 +plot_buffer_types_low1: .byte <plot8x24_y0, <plot8x24_y1, <plot8x24_y2, <plot8x24_y3
   2.724 +plot_buffer_types_low2: .byte <plot8x8_y0, <plot8x8_y1, <plot8x8_y2, <plot8x8_y3
   2.725 +plot_buffer_types_low3: .byte <plot16x16_y0, <plot16x16_y1, <plot16x16_y2, <plot16x16_y3
   2.726 +
   2.727 +plot_buffer_types_high:  .byte >plot_buffer_loop_next
   2.728 +plot_buffer_types_high1: .byte >plot8x24_y0, >plot8x24_y1, >plot8x24_y2, >plot8x24_y3
   2.729 +plot_buffer_types_high2: .byte >plot8x8_y0, >plot8x8_y1, >plot8x8_y2, >plot8x8_y3
   2.730 +plot_buffer_types_high3: .byte >plot16x16_y0, >plot16x16_y1, >plot16x16_y2, >plot16x16_y3
   2.731  
   2.732  plot_buffer:
   2.733  
   2.734 @@ -2005,8 +2001,8 @@
   2.735      jsr unplot_character    ; unplot the player character
   2.736      lda $81
   2.737      sta $5282               ; store the new room y offset
   2.738 -    lda #5
   2.739 -    sta $5283               ; dy = 5
   2.740 +    lda #3
   2.741 +    sta $5283               ; dy = 3
   2.742      clc
   2.743      jmp animate_player_up   ; optimise away the rts
   2.744  
   2.745 @@ -2044,11 +2040,11 @@
   2.746      lda $5283                   ; read dy
   2.747      cmp #0
   2.748      beq move_player_down_check_y
   2.749 -    cmp #5
   2.750 +    cmp #3
   2.751      beq move_player_down_tile
   2.752  
   2.753      jsr unplot_character        ; unplot the player character
   2.754 -    inc $5283                   ; 0 < dy < 5
   2.755 +    inc $5283                   ; 0 <= dy < 3
   2.756      clc
   2.757      jmp animate_player_down    ; optimise away the rts
   2.758      
   2.759 @@ -2183,21 +2179,21 @@
   2.760      ora $5789       ; apply the projectile type
   2.761      sta $5287
   2.762  
   2.763 -    lda $5283       ; dy
   2.764 -    cmp #4
   2.765 +    lda $5283       ; if dy > 2, create the projectile on the tile below
   2.766 +    cmp #3
   2.767      bpl create_projectile_below
   2.768  
   2.769      clc
   2.770 -    adc #2
   2.771 -    sta $5289       ; dy + 2
   2.772 +    adc #1
   2.773 +    sta $5289       ; dy + 1
   2.774      lda $5282       ; y
   2.775      sta $5288
   2.776      jmp create_projectile_continue
   2.777  
   2.778      create_projectile_below:
   2.779      sec
   2.780 -    sbc #4
   2.781 -    sta $5289       ; dy - 4
   2.782 +    sbc #3
   2.783 +    sta $5289       ; dy - 3
   2.784      clc
   2.785      lda $5282       ; y
   2.786      adc #1
   2.787 @@ -2399,11 +2395,11 @@
   2.788  
   2.789      ldy #3
   2.790      lda ($74),y                 ; dy
   2.791 -    cmp #3
   2.792 +    cmp #2
   2.793      bmi move_enemy_allow_left
   2.794  
   2.795      clc
   2.796 -    lda $70                 ; dy > 2 so we need to check another tile
   2.797 +    lda $70                 ; dy > 1 so we need to check another tile
   2.798      adc #10
   2.799      sta $70
   2.800      ldy $81                 ; temporary (x - 1)
   2.801 @@ -2477,10 +2473,10 @@
   2.802  
   2.803      ldy #3
   2.804      lda ($74),y                 ; dy
   2.805 -    cmp #3
   2.806 +    cmp #2
   2.807      bmi move_enemy_allow_right
   2.808  
   2.809 -    clc                         ; dy > 2 so we need to check another tile
   2.810 +    clc                         ; dy > 1 so we need to check another tile
   2.811      lda $70
   2.812      adc #10
   2.813      sta $70
   2.814 @@ -2583,9 +2579,9 @@
   2.815      txa
   2.816      ldy #2
   2.817      sta ($74),y             ; store the new room y offset
   2.818 -    lda #5
   2.819 +    lda #3
   2.820      iny
   2.821 -    sta ($74),y             ; dy = 5
   2.822 +    sta ($74),y             ; dy = 3
   2.823      clc
   2.824      jmp animate_enemy_up   ; optimise away the rts
   2.825  
   2.826 @@ -2608,9 +2604,9 @@
   2.827  
   2.828      ldy #3
   2.829      lda ($74),y         ; dy
   2.830 -    cmp #2
   2.831 +    cmp #1
   2.832      beq move_enemy_down_check_y
   2.833 -    cmp #5
   2.834 +    cmp #3
   2.835      beq move_enemy_down_tile
   2.836  
   2.837      adc #1
   2.838 @@ -2838,10 +2834,10 @@
   2.839      bne move_projectile_left_wall
   2.840  
   2.841      lda $5289                   ; dy
   2.842 -    cmp #5
   2.843 +    cmp #3
   2.844      bmi move_projectile_allow_left
   2.845  
   2.846 -    clc                         ; dy > 4 so we need to check another tile
   2.847 +    clc                         ; dy > 2 so we need to check another tile
   2.848      lda $70
   2.849      adc #10
   2.850      sta $70
   2.851 @@ -2887,7 +2883,7 @@
   2.852      bne move_projectile_left_exit
   2.853  
   2.854      lda $5289                       ; dy
   2.855 -    cmp #5
   2.856 +    cmp #3
   2.857      beq move_projectile_left_exit   ; shots must be lined up
   2.858      
   2.859      lda ($70),y                 ; load the tile to the left
   2.860 @@ -2956,10 +2952,10 @@
   2.861      bne move_projectile_right_wall
   2.862  
   2.863      lda $5289                   ; dy
   2.864 -    cmp #5
   2.865 +    cmp #3
   2.866      bmi move_projectile_allow_right
   2.867  
   2.868 -    clc                         ; dy > 4 so we need to check another tile
   2.869 +    clc                         ; dy > 2 so we need to check another tile
   2.870      lda $70
   2.871      adc #10
   2.872      sta $70
   2.873 @@ -3010,7 +3006,7 @@
   2.874      bne move_projectile_right_exit
   2.875  
   2.876      lda $5289                   ; dy
   2.877 -    cmp #5
   2.878 +    cmp #3
   2.879      beq move_projectile_right_exit  ; shots must be lined up
   2.880      
   2.881      lda ($70),y                 ; load the tile to the right
   2.882 @@ -3085,8 +3081,8 @@
   2.883      move_projectile_allow_up:
   2.884      txa
   2.885      sta $5288               ; store the new room y offset
   2.886 -    lda #5
   2.887 -    sta $5289               ; dy = 5
   2.888 +    lda #3
   2.889 +    sta $5289               ; dy = 3
   2.890  
   2.891      clc
   2.892      rts
   2.893 @@ -3155,15 +3151,15 @@
   2.894  move_projectile_down:
   2.895  
   2.896      lda $5289                   ; read dy
   2.897 -    cmp #4
   2.898 +    cmp #2
   2.899      beq move_projectile_down_check_y
   2.900 -    cmp #5
   2.901 +    cmp #3
   2.902      beq move_projectile_down_tile
   2.903  
   2.904 -    inc $5289                   ; 0 < dy < 5
   2.905 +    inc $5289                   ; 0 <= dy < 3
   2.906      clc
   2.907      rts
   2.908 -    
   2.909 +
   2.910      move_projectile_down_check_y:  ; Check the y offset.
   2.911  
   2.912      lda $5288
   2.913 @@ -3864,24 +3860,24 @@
   2.914      rts
   2.915  
   2.916  ; The player collision masks use bits to represent where the player is in a
   2.917 -; tile.
   2.918 +; tile. See the collisions.txt file for more information.
   2.919  
   2.920  ; Player is above, enemy is below, checking the overlap in the lower tile.
   2.921 -player_collision_mask_above: .byte $00, $20, $30, $38, $3c, $3e
   2.922 -
   2.923 -projectile_collision_mask_above: .byte $00, $00, $00, $00, $00, $20
   2.924 +player_collision_mask_above: .byte $00, $c0, $f0, $fc
   2.925 +
   2.926 +projectile_collision_mask_above: .byte $00, $00, $00, $80
   2.927  
   2.928  ; Player and enemy share the same tile or player is on the tile below.
   2.929 -player_collision_mask_below:  .byte $3f, $1f, $0f, $07, $03, $01
   2.930 -
   2.931 -projectile_collision_mask_below: .byte $30, $18, $0c, $06, $03, $01
   2.932 +player_collision_mask_below:  .byte $ff, $3f, $0f, $03
   2.933 +
   2.934 +projectile_collision_mask_below: .byte $e0, $38, $e0, $03
   2.935  
   2.936  ; Player is above or on the same tile, enemy is below, checking the overlap in
   2.937  ; the lower tile.
   2.938 -enemy_collision_mask_above:  .byte $3c, $1e, $0f, $07, $03, $01
   2.939 +enemy_collision_mask_above:  .byte $f8, $3f, $0f, $03
   2.940  
   2.941  ; Enemy is above, player is below, checking the overlap in the lower tile.
   2.942 -enemy_collision_mask_below: .byte $00, $00, $00, $20, $30, $38
   2.943 +enemy_collision_mask_below: .byte $00, $00, $c0, $f0
   2.944  
   2.945  ; Player is to the left, enemy is to the right, checking the overlap in the
   2.946  ; right hand tile.
   2.947 @@ -5066,8 +5062,7 @@
   2.948          lda $5283       ; dy
   2.949          cmp #2
   2.950          bmi high_score_entry_aligned
   2.951 -        cmp #5
   2.952 -        bne high_score_entry_not_aligned
   2.953 +        jmp high_score_entry_not_aligned
   2.954  
   2.955          lda $5282       ; y again (don't apply the touching rule to the bottom
   2.956          cmp #7          ;          row of characters)
   2.957 @@ -5258,7 +5253,7 @@
   2.958      sta $5281
   2.959      lda #4      ; y=4
   2.960      sta $5282
   2.961 -    lda #3      ; dy=3
   2.962 +    lda #2      ; dy=2
   2.963      sta $5283
   2.964      lda #4      ; x=4
   2.965      sta $5284