junglejourney
changeset 10:fb75b13a8938
Updated the routine to handle larger character sprites.
| author | David Boddie <david@boddie.org.uk> |
|---|---|
| date | Mon Aug 08 23:11:33 2011 +0200 |
| parents | bdf8ef70ed44 |
| children | 4316cc634ab2 |
| files | mapcode.oph |
| diffstat | 1 files changed, 135 insertions(+), 145 deletions(-) [+] |
line diff
1.1 --- a/mapcode.oph Mon Aug 08 22:20:14 2011 +0200 1.2 +++ b/mapcode.oph Mon Aug 08 23:11:33 2011 +0200 1.3 @@ -12,12 +12,12 @@ 1.4 rts 1.5 1.6 div9: ; A = value 1.7 -divide_loop: 1.8 - cmp #9 1.9 - bcc after_divide_loop ; bmi should work here, I think, but it doesn't 1.10 - sec 1.11 - sbc #9 1.12 - jmp divide_loop 1.13 + divide_loop: 1.14 + cmp #9 1.15 + bcc after_divide_loop ; bmi should work here, I think, but it doesn't 1.16 + sec 1.17 + sbc #9 1.18 + jmp divide_loop 1.19 1.20 after_divide_loop: 1.21 clc 1.22 @@ -36,80 +36,81 @@ 1.23 draw_top_line: 1.24 ldx #9 1.25 lda #6 1.26 -draw_top_line_loop0: 1.27 - sta $57f6,x 1.28 - dex 1.29 - bpl draw_top_line_loop0 1.30 + 1.31 + draw_top_line_loop0: 1.32 + sta $57f6,x 1.33 + dex 1.34 + bpl draw_top_line_loop0 1.35 1.36 ldx #3 1.37 lda $76 1.38 -draw_top_line_loop1: 1.39 - sta $57f9,x 1.40 - dex 1.41 - bpl draw_top_line_loop1 1.42 + draw_top_line_loop1: 1.43 + sta $57f9,x 1.44 + dex 1.45 + bpl draw_top_line_loop1 1.46 clc 1.47 rts 1.48 1.49 draw_left_line: 1.50 ldx #99 1.51 -draw_left_line_loop0: 1.52 - lda #6 1.53 - sta $579c,x 1.54 - txa 1.55 - sec 1.56 - sbc #10 1.57 - tax 1.58 - bpl draw_left_line_loop0 1.59 + draw_left_line_loop0: 1.60 + lda #6 1.61 + sta $579c,x 1.62 + txa 1.63 + sec 1.64 + sbc #10 1.65 + tax 1.66 + bpl draw_left_line_loop0 1.67 1.68 ldx #39 1.69 -draw_left_line_loop1: 1.70 - lda $77 1.71 - sta $57ba,x 1.72 - txa 1.73 - sec 1.74 - sbc #10 1.75 - tax 1.76 - bpl draw_left_line_loop1 1.77 + draw_left_line_loop1: 1.78 + lda $77 1.79 + sta $57ba,x 1.80 + txa 1.81 + sec 1.82 + sbc #10 1.83 + tax 1.84 + bpl draw_left_line_loop1 1.85 clc 1.86 rts 1.87 1.88 draw_bottom_line: 1.89 ldx #9 1.90 lda #6 1.91 -draw_bottom_line_loop0: 1.92 - sta $579c,x 1.93 - dex 1.94 - bpl draw_bottom_line_loop0 1.95 + draw_bottom_line_loop0: 1.96 + sta $579c,x 1.97 + dex 1.98 + bpl draw_bottom_line_loop0 1.99 1.100 ldx #3 1.101 lda $76 1.102 -draw_bottom_line_loop1: 1.103 - sta $579f,x 1.104 - dex 1.105 - bpl draw_bottom_line_loop1 1.106 + draw_bottom_line_loop1: 1.107 + sta $579f,x 1.108 + dex 1.109 + bpl draw_bottom_line_loop1 1.110 clc 1.111 rts 1.112 1.113 draw_right_line: 1.114 ldx #90 1.115 -draw_right_line_loop0: 1.116 - lda #6 1.117 - sta $579c,x 1.118 - txa 1.119 - sec 1.120 - sbc #10 1.121 - tax 1.122 - bpl draw_right_line_loop0 1.123 + draw_right_line_loop0: 1.124 + lda #6 1.125 + sta $579c,x 1.126 + txa 1.127 + sec 1.128 + sbc #10 1.129 + tax 1.130 + bpl draw_right_line_loop0 1.131 1.132 ldx #30 1.133 -draw_right_line_loop1: 1.134 - lda $77 1.135 - sta $57ba,x 1.136 - txa 1.137 - sec 1.138 - sbc #10 1.139 - tax 1.140 - bpl draw_right_line_loop1 1.141 + draw_right_line_loop1: 1.142 + lda $77 1.143 + sta $57ba,x 1.144 + txa 1.145 + sec 1.146 + sbc #10 1.147 + tax 1.148 + bpl draw_right_line_loop1 1.149 clc 1.150 rts 1.151 1.152 @@ -271,22 +272,22 @@ 1.153 clc 1.154 ; Discard the first ten values. 1.155 ldy #10 1.156 -make_room_loop0: 1.157 - jsr unlimited_values 1.158 - dey 1.159 - bne make_room_loop0 1.160 + make_room_loop0: 1.161 + jsr unlimited_values 1.162 + dey 1.163 + bne make_room_loop0 1.164 1.165 ; Fill the room array with values. 1.166 ldx #78 1.167 ldy #63 1.168 -make_room_loop1: 1.169 - jsr next_value 1.170 - sta $57a6,x 1.171 - dey 1.172 - tya 1.173 - and #7 1.174 - cmp #7 1.175 - bne next1 1.176 + make_room_loop1: 1.177 + jsr next_value 1.178 + sta $57a6,x 1.179 + dey 1.180 + tya 1.181 + and #7 1.182 + cmp #7 1.183 + bne next1 1.184 dex 1.185 dex 1.186 1.187 @@ -301,11 +302,11 @@ 1.188 plot: ; $70,$71=source address 1.189 ; $72,$73=destination address 1.190 ldy #$1f 1.191 -plotloop0: 1.192 - lda ($70),y 1.193 - sta ($72),y 1.194 - dey 1.195 - bpl plotloop0 1.196 + plotloop0: 1.197 + lda ($70),y 1.198 + sta ($72),y 1.199 + dey 1.200 + bpl plotloop0 1.201 1.202 lda $72 1.203 adc #$20 1.204 @@ -316,12 +317,12 @@ 1.205 clc 1.206 1.207 ldy #$3f 1.208 -plotloop1: 1.209 - lda ($70),y 1.210 - sta ($72),y 1.211 - dey 1.212 - cpy #$20 1.213 - bpl plotloop1 1.214 + plotloop1: 1.215 + lda ($70),y 1.216 + sta ($72),y 1.217 + dey 1.218 + cpy #$20 1.219 + bpl plotloop1 1.220 1.221 lda $72 1.222 adc #$20 1.223 @@ -332,12 +333,12 @@ 1.224 clc 1.225 1.226 ldy #$5f 1.227 -plotloop2: 1.228 - lda ($70),y 1.229 - sta ($72),y 1.230 - dey 1.231 - cpy #$40 1.232 - bpl plotloop2 1.233 + plotloop2: 1.234 + lda ($70),y 1.235 + sta ($72),y 1.236 + dey 1.237 + cpy #$40 1.238 + bpl plotloop2 1.239 1.240 sec 1.241 lda $72 1.242 @@ -400,57 +401,58 @@ 1.243 1.244 lda #99 1.245 sta $7a 1.246 -row_loop: 1.247 + row_loop: 1.248 1.249 - lda #9 1.250 - sta $76 1.251 -column_loop: 1.252 - lda $7a 1.253 - tax 1.254 - lda $579c,x 1.255 - sta $7b 1.256 - jsr plot_tile 1.257 + lda #9 1.258 + sta $76 1.259 1.260 - lda $7a 1.261 - sec 1.262 - sbc #1 1.263 - sta $7a 1.264 - lda $76 1.265 - sec 1.266 - sbc #1 1.267 - sta $76 1.268 - clc 1.269 - cmp #0 1.270 - bpl column_loop 1.271 + column_loop: 1.272 + lda $7a 1.273 + tax 1.274 + lda $579c,x 1.275 + sta $7b 1.276 + jsr plot_tile 1.277 1.278 - clc 1.279 + lda $7a 1.280 + sec 1.281 + sbc #1 1.282 + sta $7a 1.283 + lda $76 1.284 + sec 1.285 + sbc #1 1.286 + sta $76 1.287 + clc 1.288 + cmp #0 1.289 + bpl column_loop 1.290 1.291 - lda $72 1.292 - adc #$80 1.293 - sta $72 1.294 - lda $73 1.295 - adc #$02 1.296 - sta $73 1.297 - clc 1.298 - cmp #$7d 1.299 - beq end_rows 1.300 + clc 1.301 1.302 - jmp row_loop 1.303 + lda $72 1.304 + adc #$80 1.305 + sta $72 1.306 + lda $73 1.307 + adc #$02 1.308 + sta $73 1.309 + clc 1.310 + cmp #$7d 1.311 + beq end_rows 1.312 + 1.313 + jmp row_loop 1.314 1.315 end_rows: 1.316 rts 1.317 1.318 1.319 1.320 -plot12x16_y0: ; $70,$71=source address 1.321 +plot12x24_y0: ; $70,$71=source address 1.322 ; $72,$73=destination address 1.323 ldy #23 1.324 1.325 -plotloop12x15_y0_0: 1.326 - lda ($70),y 1.327 - sta ($72),y 1.328 - dey 1.329 - bpl plotloop12x15_y0_0 1.330 + plotloop12x24_y0_0: 1.331 + lda ($70),y 1.332 + sta ($72),y 1.333 + dey 1.334 + bpl plotloop12x24_y0_0 1.335 clc 1.336 1.337 lda $72 1.338 @@ -463,24 +465,12 @@ 1.339 1.340 ldy #47 1.341 1.342 -plotloop12x15_y0_1: 1.343 - lda ($70),y 1.344 - sta ($72),y 1.345 - dey 1.346 - cpy #24 1.347 - bpl plotloop12x15_y0_1 1.348 - 1.349 - rts 1.350 - 1.351 -plot12x16_y1: ; $70,$71=source address 1.352 - ; $72,$73=destination address 1.353 - ldy #3 1.354 - 1.355 -plotloop12x15_y1_0: 1.356 - lda ($70),y 1.357 - sta ($72),y 1.358 - dey 1.359 - bpl plotloop12x15_y1_0 1.360 + plotloop12x24_y0_1: 1.361 + lda ($70),y 1.362 + sta ($72),y 1.363 + dey 1.364 + cpy #24 1.365 + bpl plotloop12x24_y0_1 1.366 clc 1.367 1.368 lda $72 1.369 @@ -491,13 +481,13 @@ 1.370 sta $73 1.371 clc 1.372 1.373 - ldy #47 1.374 + ldy #71 1.375 1.376 -plotloop12x15_y1_1: 1.377 - lda ($70),y 1.378 - sta ($72),y 1.379 - dey 1.380 - cpy #24 1.381 - bpl plotloop12x15_y1_1 1.382 + plotloop12x24_y0_2: 1.383 + lda ($70),y 1.384 + sta ($72),y 1.385 + dey 1.386 + cpy #48 1.387 + bpl plotloop12x24_y0_2 1.388 1.389 rts
