junglejourney
changeset 117:86033c6faa01
Finished the high score entry screen.
Moved the character list to make room for code.
Moved common code into routines.
| author | David Boddie <david@boddie.org.uk> |
|---|---|
| date | Wed Sep 07 00:09:07 2011 +0200 |
| parents | 101d8474c62d |
| children | c6571847fe50 |
| files | TODO.txt build.py loader.oph mapcode.oph |
| diffstat | 4 files changed, 373 insertions(+), 261 deletions(-) [+] |
line diff
1.1 --- a/TODO.txt Mon Sep 05 23:08:49 2011 +0200 1.2 +++ b/TODO.txt Wed Sep 07 00:09:07 2011 +0200 1.3 @@ -4,12 +4,13 @@ 1.4 Convert all emerging enemies to explosions at game over time. 1.5 Improve the fire, explosion and player sprites. 1.6 Add sounds. 1.7 -Nice to have: make projectiles start next to the player, not on top of him. 1.8 +Nice to have: analogue joystick support. 1.9 Nice to have: make one of the enemies have different movement. 1.10 Nice to have: make the boomerang turn before hitting a wall. 1.11 +Nice to have: make projectiles start next to the player, not on top of him. 1.12 1.13 Things to look out for 1.14 1.15 -Score text disappearing - probably caused by incorrect colour setting 1.16 -between levels. 1.17 Strength level increasing unexpectedly. 1.18 +A high score not causing the high score screen to be activated. 1.19 +Flickering and jerky player motion at the top of the screen.
2.1 --- a/build.py Mon Sep 05 23:08:49 2011 +0200 2.2 +++ b/build.py Wed Sep 07 00:09:07 2011 +0200 2.3 @@ -50,31 +50,7 @@ 2.4 # 1000 completion screen 2.5 # 1780 title screen 2.6 # 1F00 CODE 2.7 - # 3??0 space 2.8 - # 3D00 character table (0x24/6 = 6 entries + 1 special entry) 2.9 - # n type (0 missing, 1 player, 2 projectile, 3 explosion, 2.10 - # 4 item, 2.11 - # 8 and higher enemy - bits 4,5,6 are enemy type) 2.12 - # n+1 counter/direction 2.13 - # (player: bits 1,2 are direction, bit 0 is animation 2.14 - # projectile: bits 4,5 are direction, bits 1,2 are type, 2.15 - # bit 0 is animation 2.16 - # enemy: bits 2,3 are direction, bits 1,0 are animation 2.17 - # emerging, explosion: bits 4,5,6 are enemy type for emerging, 2.18 - # bit 3 is type 0=emerge,1=explode, 2.19 - # bits 0,1 are animation 2.20 - # item: bits 0,1,2,3 are type, bit 2 is weapon/treasure 2.21 - # 0-3 weapons, 4 key, 5-8 treasure) 2.22 - # n+2 y room offset (0-10) 2.23 - # n+3 dy (0-5) 2.24 - # n+4 x room offset (0-10) 2.25 - # n+5 dx (0-3) 2.26 # 2.27 - # first character is always the player 2.28 - # second character is always the player's weapon 2.29 - # new characters are added after these 2.30 - # 2.31 - # 3D2A space 2.32 # 3DF0 item/player flags (128=leave level, 64=player demise, 2.33 # bits 4,5,6=enemy limit, 2=complete game, 2.34 # 1=has key) 2.35 @@ -102,7 +78,7 @@ 2.36 # 2 * 0x60 (exit) 4500 2.37 # 2 * 0x60 (final exit) 2.38 # 2.39 - # 4*2*0x30 + 4*0x30 + 4*2*0x10 + 5*4*2*0x40 + 4*0x40 + 4*0x40 + 4*0x40 + 5*0x40 + 2*0x60 + 2*0x60 + 0x3400 2.40 + # 4*2*0x30 + 4*0x30 + 4*2*0x10 + 5*4*2*0x40 + 4*0x40 + 4*0x40 + 4*0x40 + 5*0x40 + 2*0x60 + 2*0x60 + 0x3e00 2.41 # 2.42 # 5080 high scores (8 * 12 = 0xe0) 2.43 # n 3 bytes score + 9 bytes ASCII 2.44 @@ -110,7 +86,30 @@ 2.45 # 5100 objects/treasure table (121 entries) 2.46 # n type 2.47 # 2.48 - # 51F2 space 2.49 + # 5179 space 2.50 + # 5180 character table (0x24/6 = 6 entries + 1 special entry) 2.51 + # n type (0 missing, 1 player, 2 projectile, 3 explosion, 2.52 + # 4 item, 2.53 + # 8 and higher enemy - bits 4,5,6 are enemy type) 2.54 + # n+1 counter/direction 2.55 + # (player: bits 1,2 are direction, bit 0 is animation 2.56 + # projectile: bits 4,5 are direction, bits 1,2 are type, 2.57 + # bit 0 is animation 2.58 + # enemy: bits 2,3 are direction, bits 1,0 are animation 2.59 + # emerging, explosion: bits 4,5,6 are enemy type for emerging, 2.60 + # bit 3 is type 0=emerge,1=explode, 2.61 + # bits 0,1 are animation 2.62 + # item: bits 0,1,2,3 are type, bit 2 is weapon/treasure 2.63 + # 0-3 weapons, 4 key, 5-8 treasure) 2.64 + # n+2 y room offset (0-10) 2.65 + # n+3 dy (0-5) 2.66 + # n+4 x room offset (0-10) 2.67 + # n+5 dx (0-3) 2.68 + # 2.69 + # first character is always the player 2.70 + # second character is always the player's weapon 2.71 + # new characters are added after these 2.72 + # 2.73 # 5200 plot buffer (alternate unplot/plot entries terminating in 255) 2.74 # n type 2.75 # n+1,n+2 source address
3.1 --- a/loader.oph Mon Sep 05 23:08:49 2011 +0200 3.2 +++ b/loader.oph Wed Sep 07 00:09:07 2011 +0200 3.3 @@ -94,8 +94,8 @@ 3.4 code_block: .byte <code_file_name, >code_file_name 3.5 .byte $00, $1f, 0, 0 3.6 .byte $00, $1f, 0, 0 3.7 - .byte $bf, $1d, 0, 0 3.8 - .byte $bf, $3c, 0, 0 3.9 + .byte $69, $1e, 0, 0 3.10 + .byte $69, $3d, 0, 0 3.11 3.12 init_load_window_vdu_bytes: .byte 28,0,29,19,24 3.13
4.1 --- a/mapcode.oph Mon Sep 05 23:08:49 2011 +0200 4.2 +++ b/mapcode.oph Wed Sep 07 00:09:07 2011 +0200 4.3 @@ -416,7 +416,6 @@ 4.4 lda seeds,x 4.5 sbc $78 4.6 sec 4.7 - sbc $7e 4.8 sta $7d 4.9 clc 4.10 4.11 @@ -501,12 +500,12 @@ 4.12 4.13 sec 4.14 sbc #1 4.15 - sta $3d0d ; store weapon/treasure type 4.16 + sta $518d ; store weapon/treasure type 4.17 clc 4.18 4.19 lda $78 4.20 eor $79 4.21 - adc $3d0d 4.22 + adc $518d 4.23 and #15 4.24 sta $70 4.25 4.26 @@ -540,19 +539,19 @@ 4.27 bne add_treasure_loop_next 4.28 4.29 lda #4 ; type (weapon/treasure) 4.30 - sta $3d0c 4.31 + sta $518c 4.32 lda $8d ; y 4.33 - sta $3d0e 4.34 + sta $518e 4.35 lda #1 ; dy 4.36 - sta $3d0f 4.37 + sta $518f 4.38 lda $8e ; x 4.39 - sta $3d10 4.40 + sta $5190 4.41 lda #0 ; dx 4.42 - sta $3d11 4.43 - 4.44 - lda #$0c 4.45 + sta $5191 4.46 + 4.47 + lda #$8c 4.48 sta $74 4.49 - lda #$3d 4.50 + lda #$51 4.51 sta $75 4.52 jmp plot_character ; optimise away the rts 4.53 4.54 @@ -1595,10 +1594,10 @@ 4.55 4.56 ; Set the direction and toggle the animation bit. 4.57 4.58 - lda $3d01 4.59 + lda $5181 4.60 and #1 4.61 eor #1 ; toggle animation flag 4.62 - sta $3d01 ; left (directional bits are 0) 4.63 + sta $5181 ; left (directional bits are 0) 4.64 4.65 jsr plot_character 4.66 rts 4.67 @@ -1607,11 +1606,11 @@ 4.68 4.69 ; Set the direction and toggle the animation bit. 4.70 4.71 - lda $3d01 4.72 + lda $5181 4.73 and #1 ; remove direction information (result is 0) 4.74 eor #1 ; toggle animation flag 4.75 ora #2 ; right 4.76 - sta $3d01 4.77 + sta $5181 4.78 4.79 jsr plot_character 4.80 rts 4.81 @@ -1620,11 +1619,11 @@ 4.82 4.83 ; Set the direction and toggle the animation bit. 4.84 4.85 - lda $3d01 4.86 + lda $5181 4.87 and #1 ; remove direction information (result is 0) 4.88 eor #1 ; toggle animation flag 4.89 ora #4 ; up 4.90 - sta $3d01 4.91 + sta $5181 4.92 4.93 jsr plot_character 4.94 rts 4.95 @@ -1633,11 +1632,11 @@ 4.96 4.97 ; Set the direction and toggle the animation bit. 4.98 4.99 - lda $3d01 4.100 + lda $5181 4.101 and #1 ; remove direction information (result is 0) 4.102 eor #1 ; toggle animation flag 4.103 ora #6 ; down 4.104 - sta $3d01 4.105 + sta $5181 4.106 4.107 jsr plot_character 4.108 rts 4.109 @@ -1653,9 +1652,9 @@ 4.110 4.111 move_player_allowed: 4.112 4.113 - lda #$00 ; set up the address of the player character 4.114 + lda #$80 ; set up the address of the player character 4.115 sta $74 4.116 - lda #$3d 4.117 + lda #$51 4.118 sta $75 4.119 4.120 ; Handle the left key. 4.121 @@ -1665,25 +1664,25 @@ 4.122 cpy #255 4.123 bne move_player_not_left_key 4.124 4.125 - lda $3d05 ; read dx 4.126 + lda $5185 ; read dx 4.127 cmp #0 4.128 beq move_player_left_check_x 4.129 4.130 jsr unplot_character ; unplot the player character 4.131 - dec $3d05 4.132 + dec $5185 4.133 clc 4.134 jmp animate_player_left ; optimise away the rts 4.135 4.136 move_player_left_check_x: ; Check the x offset. 4.137 4.138 - lda $3d04 4.139 + lda $5184 4.140 cmp #0 4.141 beq move_player_leave_room_left 4.142 4.143 clc 4.144 tay 4.145 dey ; x - 1 4.146 - lda $3d02 ; load the y offset 4.147 + lda $5182 ; load the y offset 4.148 tax ; as an index 4.149 lda room_row_offsets_low,x ; read the address of the row 4.150 sta $70 4.151 @@ -1699,7 +1698,7 @@ 4.152 cmp #0 4.153 bne move_player_not_left_key 4.154 4.155 - lda $3d03 ; dy 4.156 + lda $5183 ; dy 4.157 cmp #0 4.158 beq move_player_allow_left 4.159 4.160 @@ -1722,9 +1721,9 @@ 4.161 sta $81 ; temporary 4.162 jsr unplot_character ; unplot the player character 4.163 lda $81 4.164 - sta $3d04 ; store the new room x offset 4.165 + sta $5184 ; store the new room x offset 4.166 lda #3 4.167 - sta $3d05 ; dx = 3 4.168 + sta $5185 ; dx = 3 4.169 clc 4.170 jmp animate_player_left ; optimise away the rts 4.171 4.172 @@ -1740,9 +1739,9 @@ 4.173 ; No need to unplot. 4.174 4.175 lda #9 ; x = 9 4.176 - sta $3d04 4.177 + sta $5184 4.178 lda #2 ; dx = 2 4.179 - sta $3d05 4.180 + sta $5185 4.181 4.182 jsr animate_player_left 4.183 sec ; indicate to the calling routine that the player 4.184 @@ -1759,27 +1758,27 @@ 4.185 jmp move_player_not_right_key 4.186 4.187 move_player_right_key: 4.188 - lda $3d05 ; read dx 4.189 + lda $5185 ; read dx 4.190 cmp #2 4.191 beq move_player_right_check_x 4.192 cmp #3 4.193 beq move_player_right_tile 4.194 4.195 jsr unplot_character ; unplot the player character 4.196 - inc $3d05 4.197 + inc $5185 4.198 clc 4.199 jmp animate_player_right ; optimise away the rts 4.200 4.201 move_player_right_check_x: ; Check the x offset. 4.202 4.203 - lda $3d04 4.204 + lda $5184 4.205 cmp #9 4.206 beq move_player_leave_room_right 4.207 4.208 clc 4.209 tay 4.210 iny ; x + 1 4.211 - lda $3d02 ; load the y offset 4.212 + lda $5182 ; load the y offset 4.213 tax ; as an index 4.214 lda room_row_offsets_low,x ; read the address of the row 4.215 sta $70 4.216 @@ -1795,7 +1794,7 @@ 4.217 cmp #0 4.218 bne move_player_not_right_key 4.219 4.220 - lda $3d03 ; dy 4.221 + lda $5183 ; dy 4.222 cmp #0 4.223 beq move_player_allow_right 4.224 4.225 @@ -1816,16 +1815,16 @@ 4.226 move_player_allow_right: 4.227 4.228 jsr unplot_character ; unplot the player character 4.229 - inc $3d05 ; update dx 4.230 + inc $5185 ; update dx 4.231 clc 4.232 jmp animate_player_right ; optimise away the rts 4.233 4.234 move_player_right_tile: 4.235 4.236 jsr unplot_character ; unplot the player character 4.237 - inc $3d04 ; store the new room x offset 4.238 + inc $5184 ; store the new room x offset 4.239 lda #0 4.240 - sta $3d05 ; dx = 0 4.241 + sta $5185 ; dx = 0 4.242 clc 4.243 jmp animate_player_right ; optimise away the rts 4.244 4.245 @@ -1839,9 +1838,9 @@ 4.246 ; No need to unplot. 4.247 4.248 lda #0 ; x = 0 4.249 - sta $3d04 4.250 + sta $5184 4.251 lda #0 ; dx = 0 4.252 - sta $3d05 4.253 + sta $5185 4.254 4.255 jsr animate_player_right 4.256 sec ; indicate to the calling routine that the 4.257 @@ -1856,24 +1855,24 @@ 4.258 cpy #255 4.259 bne move_player_not_up_key 4.260 4.261 - lda $3d03 ; read dy 4.262 + lda $5183 ; read dy 4.263 cmp #0 4.264 beq move_player_up_check_y 4.265 4.266 jsr unplot_character ; unplot the player character 4.267 - dec $3d03 4.268 + dec $5183 4.269 clc 4.270 jmp animate_player_up ; optimise away the rts 4.271 4.272 move_player_up_check_y: ; Check the y offset. 4.273 4.274 - lda $3d02 4.275 + lda $5182 4.276 cmp #0 4.277 beq move_player_leave_room_up 4.278 4.279 tax ; use the y offset as an index 4.280 dex ; y - 1 4.281 - ldy $3d04 ; load the x offset 4.282 + ldy $5184 ; load the x offset 4.283 lda room_row_offsets_low,x ; read the address of the row 4.284 sta $70 4.285 lda #$57 4.286 @@ -1888,7 +1887,7 @@ 4.287 cmp #0 4.288 bne move_player_not_up_key 4.289 4.290 - lda $3d05 ; dx 4.291 + lda $5185 ; dx 4.292 cmp #3 4.293 bmi move_player_allow_up 4.294 4.295 @@ -1909,9 +1908,9 @@ 4.296 sta $81 ; temporary 4.297 jsr unplot_character ; unplot the player character 4.298 lda $81 4.299 - sta $3d02 ; store the new room y offset 4.300 + sta $5182 ; store the new room y offset 4.301 lda #5 4.302 - sta $3d03 ; dy = 5 4.303 + sta $5183 ; dy = 5 4.304 clc 4.305 jmp animate_player_up ; optimise away the rts 4.306 4.307 @@ -1927,9 +1926,9 @@ 4.308 ; No need to unplot. 4.309 4.310 lda #9 ; y = 9 4.311 - sta $3d02 4.312 + sta $5182 4.313 lda #0 ; dy = 0 4.314 - sta $3d03 4.315 + sta $5183 4.316 4.317 jsr animate_player_up 4.318 sec ; indicate to the calling routine that the player 4.319 @@ -1946,27 +1945,27 @@ 4.320 jmp move_player_not_down_key 4.321 4.322 move_player_down_key: 4.323 - lda $3d03 ; read dy 4.324 + lda $5183 ; read dy 4.325 cmp #0 4.326 beq move_player_down_check_y 4.327 cmp #5 4.328 beq move_player_down_tile 4.329 4.330 jsr unplot_character ; unplot the player character 4.331 - inc $3d03 ; 0 < dy < 5 4.332 + inc $5183 ; 0 < dy < 5 4.333 clc 4.334 jmp animate_player_down ; optimise away the rts 4.335 4.336 move_player_down_check_y: ; Check the y offset. 4.337 4.338 - lda $3d02 4.339 + lda $5182 4.340 cmp #9 4.341 beq move_player_leave_room_down 4.342 4.343 clc 4.344 tax 4.345 inx ; y + 1 4.346 - ldy $3d04 ; load the x offset 4.347 + ldy $5184 ; load the x offset 4.348 lda room_row_offsets_low,x ; read the address of the row 4.349 sta $70 4.350 lda #$57 4.351 @@ -1981,7 +1980,7 @@ 4.352 cmp #0 4.353 bne move_player_not_down_key 4.354 4.355 - lda $3d05 ; dx 4.356 + lda $5185 ; dx 4.357 cmp #3 4.358 bmi move_player_allow_down 4.359 4.360 @@ -2000,16 +1999,16 @@ 4.361 move_player_allow_down: 4.362 4.363 jsr unplot_character ; unplot the player character 4.364 - inc $3d03 ; update dy 4.365 + inc $5183 ; update dy 4.366 clc 4.367 jmp animate_player_down ; optimise away the rts 4.368 4.369 move_player_down_tile: 4.370 4.371 jsr unplot_character ; unplot the player character 4.372 - inc $3d02 ; store the new room y offset 4.373 + inc $5182 ; store the new room y offset 4.374 lda #0 4.375 - sta $3d03 ; dy = 0 4.376 + sta $5183 ; dy = 0 4.377 clc 4.378 jmp animate_player_down ; optimise away the rts 4.379 4.380 @@ -2022,9 +2021,9 @@ 4.381 ; No need to unplot. 4.382 4.383 lda #0 ; y = 0 4.384 - sta $3d02 4.385 + sta $5182 4.386 lda #0 ; dy = 0 4.387 - sta $3d03 4.388 + sta $5183 4.389 4.390 jsr animate_player_down 4.391 sec ; indicate to the calling routine that the 4.392 @@ -2062,7 +2061,7 @@ 4.393 cpy #255 4.394 bne check_fire_key_exit 4.395 4.396 - lda $3d06 4.397 + lda $5186 4.398 cmp #0 4.399 bne check_fire_key_exit 4.400 4.401 @@ -2078,46 +2077,46 @@ 4.402 create_projectile: 4.403 4.404 lda #2 4.405 - sta $3d06 4.406 - 4.407 - lda $3d01 4.408 + sta $5186 4.409 + 4.410 + lda $5181 4.411 and #$06 ; copy the direction information 4.412 asl 4.413 asl 4.414 asl 4.415 ora $3df9 ; apply the projectile type 4.416 - sta $3d07 4.417 - 4.418 - lda $3d03 ; dy 4.419 + sta $5187 4.420 + 4.421 + lda $5183 ; dy 4.422 cmp #4 4.423 bpl create_projectile_below 4.424 4.425 clc 4.426 adc #2 4.427 - sta $3d09 ; dy + 2 4.428 - lda $3d02 ; y 4.429 - sta $3d08 4.430 + sta $5189 ; dy + 2 4.431 + lda $5182 ; y 4.432 + sta $5188 4.433 jmp create_projectile_continue 4.434 4.435 create_projectile_below: 4.436 sec 4.437 sbc #4 4.438 - sta $3d09 ; dy - 4 4.439 + sta $5189 ; dy - 4 4.440 clc 4.441 - lda $3d02 ; y 4.442 + lda $5182 ; y 4.443 adc #1 4.444 - sta $3d08 4.445 + sta $5188 4.446 4.447 create_projectile_continue: 4.448 - lda $3d04 ; x 4.449 - sta $3d0a 4.450 - 4.451 - lda $3d05 ; dx 4.452 - sta $3d0b 4.453 - 4.454 - lda #$06 4.455 + lda $5184 ; x 4.456 + sta $518a 4.457 + 4.458 + lda $5185 ; dx 4.459 + sta $518b 4.460 + 4.461 + lda #$86 4.462 sta $74 4.463 - lda #$3d 4.464 + lda #$51 4.465 sta $75 4.466 jsr plot_character 4.467 4.468 @@ -2154,13 +2153,13 @@ 4.469 emerge_x_position: ; returns A=position 4.470 4.471 jsr unlimited_values 4.472 - lda $3d04 4.473 + lda $5184 4.474 jmp emerge_position_common 4.475 4.476 emerge_y_position: ; returns A=position 4.477 4.478 jsr unlimited_values 4.479 - lda $3d02 4.480 + lda $5182 4.481 ; run on into the next routine 4.482 4.483 emerge_position_common: 4.484 @@ -2226,9 +2225,9 @@ 4.485 sta $81 4.486 emerge_character_loop: 4.487 4.488 - jsr emerge_y_position ; obtain a y position 4.489 + jsr emerge_y_position ; obtain a y position 4.490 tax 4.491 - jsr emerge_x_position ; obtain an x position 4.492 + jsr emerge_x_position ; obtain an x position 4.493 sta $80 ; temporary 4.494 tay 4.495 4.496 @@ -2689,13 +2688,13 @@ 4.497 4.498 ldy #2 4.499 lda ($74),y ; y 4.500 - cmp $3d02 ; player y 4.501 + cmp $5182 ; player y 4.502 bmi move_enemy_downwards 4.503 bne move_enemy_upwards 4.504 4.505 ldy #3 4.506 lda ($74),y ; dy 4.507 - cmp $3d03 ; player y 4.508 + cmp $5183 ; player y 4.509 beq move_enemy_horizontally 4.510 bpl move_enemy_upwards 4.511 4.512 @@ -2712,7 +2711,7 @@ 4.513 move_enemy_horizontally: 4.514 ldy #4 4.515 lda ($74),y ; x 4.516 - cmp $3d04 ; player x 4.517 + cmp $5184 ; player x 4.518 bmi move_enemy_rightwards 4.519 bne move_enemy_leftwards 4.520 4.521 @@ -2776,32 +2775,32 @@ 4.522 create_explosion: ; X=y, Y=x 4.523 4.524 lda #3 4.525 - sta $3d24 4.526 + sta $51a4 4.527 lda #8 4.528 - sta $3d25 4.529 + sta $51a5 4.530 txa 4.531 - sta $3d26 4.532 + sta $51a6 4.533 lda #1 4.534 - sta $3d27 4.535 + sta $51a7 4.536 tya 4.537 - sta $3d28 4.538 + sta $51a8 4.539 lda #0 4.540 - sta $3d29 4.541 + sta $51a9 4.542 rts 4.543 4.544 move_projectile_left: 4.545 4.546 - lda $3d0b 4.547 + lda $518b 4.548 cmp #0 4.549 beq move_projectile_left_check_x 4.550 4.551 - dec $3d0b 4.552 + dec $518b 4.553 clc 4.554 rts 4.555 4.556 move_projectile_left_check_x: 4.557 4.558 - lda $3d0a 4.559 + lda $518a 4.560 cmp #0 4.561 bne move_projectile_left_in_room 4.562 jmp move_projectile_left_exit 4.563 @@ -2809,7 +2808,7 @@ 4.564 move_projectile_left_in_room: 4.565 tay 4.566 dey ; x - 1 4.567 - ldx $3d08 ; y 4.568 + ldx $5188 ; y 4.569 lda room_row_offsets_low,x ; read the address of the row 4.570 sta $70 4.571 lda #$57 4.572 @@ -2819,7 +2818,7 @@ 4.573 cmp #0 4.574 bne move_projectile_left_wall 4.575 4.576 - lda $3d09 ; dy 4.577 + lda $5189 ; dy 4.578 cmp #5 4.579 bmi move_projectile_allow_left 4.580 4.581 @@ -2834,9 +2833,9 @@ 4.582 4.583 move_projectile_allow_left: 4.584 4.585 - sty $3d0a ; x 4.586 + sty $518a ; x 4.587 lda #3 4.588 - sta $3d0b ; dx = 3 4.589 + sta $518b ; dx = 3 4.590 4.591 clc 4.592 rts 4.593 @@ -2844,7 +2843,7 @@ 4.594 move_projectile_left_wall: ; the projectile hit a wall 4.595 clc 4.596 4.597 - lda $3d07 ; type 2 can pass through walls 4.598 + lda $5187 ; type 2 can pass through walls 4.599 and #$06 4.600 cmp #4 4.601 beq move_projectile_allow_left 4.602 @@ -2852,14 +2851,14 @@ 4.603 cmp #2 4.604 bne move_projectile_left_not_boomerang 4.605 4.606 - lda $3d07 4.607 + lda $5187 4.608 and #$0f 4.609 cmp #8 4.610 bpl move_projectile_left_exit 4.611 4.612 - ldx $3d05 ; player's dx 4.613 + ldx $5185 ; player's dx 4.614 ora boomerang_horizontal,x 4.615 - sta $3d07 4.616 + sta $5187 4.617 clc 4.618 rts ; exit without moving or registering a collision 4.619 4.620 @@ -2868,7 +2867,7 @@ 4.621 cmp #6 ; type 3 can destroy certain walls 4.622 bne move_projectile_left_exit 4.623 4.624 - lda $3d09 ; dy 4.625 + lda $5189 ; dy 4.626 cmp #5 4.627 beq move_projectile_left_exit ; shots must be lined up 4.628 4.629 @@ -2884,9 +2883,9 @@ 4.630 jsr create_explosion 4.631 jsr plot_blank_xy ; corrupted X 4.632 4.633 - lda #$24 4.634 + lda #$a4 4.635 sta $74 4.636 - lda #$3d 4.637 + lda #$51 4.638 sta $75 4.639 jsr plot_character 4.640 4.641 @@ -2903,19 +2902,19 @@ 4.642 4.643 ; Fire right. 4.644 4.645 - lda $3d0b 4.646 + lda $518b 4.647 cmp #2 4.648 beq move_projectile_right_check_x 4.649 cmp #3 4.650 beq move_projectile_right_tile 4.651 4.652 - inc $3d0b 4.653 + inc $518b 4.654 clc 4.655 rts 4.656 4.657 move_projectile_right_check_x: 4.658 4.659 - lda $3d0a ; x 4.660 + lda $518a ; x 4.661 cmp #9 4.662 bne move_projectile_right_not_edge 4.663 jmp move_projectile_right_exit 4.664 @@ -2924,7 +2923,7 @@ 4.665 clc 4.666 tay 4.667 iny ; x + 1 4.668 - ldx $3d08 ; y 4.669 + ldx $5188 ; y 4.670 lda room_row_offsets_low,x ; read the address of the row 4.671 sta $70 4.672 lda #$57 4.673 @@ -2934,7 +2933,7 @@ 4.674 cmp #0 4.675 bne move_projectile_right_wall 4.676 4.677 - lda $3d09 ; dy 4.678 + lda $5189 ; dy 4.679 cmp #5 4.680 bmi move_projectile_allow_right 4.681 4.682 @@ -2949,22 +2948,22 @@ 4.683 4.684 move_projectile_allow_right: 4.685 4.686 - inc $3d0b ; dx 4.687 + inc $518b ; dx 4.688 clc 4.689 rts 4.690 4.691 move_projectile_right_tile: 4.692 4.693 - inc $3d0a ; x 4.694 + inc $518a ; x 4.695 lda #0 4.696 - sta $3d0b ; dx 4.697 + sta $518b ; dx 4.698 clc 4.699 rts 4.700 4.701 move_projectile_right_wall: ; the projectile hit a wall 4.702 clc 4.703 4.704 - lda $3d07 ; type 2 can pass through walls 4.705 + lda $5187 ; type 2 can pass through walls 4.706 and #$06 4.707 cmp #4 4.708 beq move_projectile_allow_right 4.709 @@ -2972,14 +2971,14 @@ 4.710 cmp #2 4.711 bne move_projectile_right_not_boomerang 4.712 4.713 - lda $3d07 4.714 + lda $5187 4.715 and #$0f 4.716 cmp #8 4.717 bpl move_projectile_right_exit 4.718 4.719 - ldx $3d05 ; player's dx 4.720 + ldx $5185 ; player's dx 4.721 ora boomerang_horizontal,x 4.722 - sta $3d07 4.723 + sta $5187 4.724 clc 4.725 rts ; exit without moving or registering a collision 4.726 4.727 @@ -2988,7 +2987,7 @@ 4.728 cmp #6 ; type 3 can destroy certain walls 4.729 bne move_projectile_right_exit 4.730 4.731 - lda $3d09 ; dy 4.732 + lda $5189 ; dy 4.733 cmp #5 4.734 beq move_projectile_right_exit ; shots must be lined up 4.735 4.736 @@ -3004,9 +3003,9 @@ 4.737 jsr create_explosion 4.738 jsr plot_blank_xy ; corrupted X 4.739 4.740 - lda #$24 4.741 + lda #$a4 4.742 sta $74 4.743 - lda #$3d 4.744 + lda #$51 4.745 sta $75 4.746 jsr plot_character 4.747 4.748 @@ -3019,23 +3018,23 @@ 4.749 4.750 move_projectile_up: 4.751 4.752 - lda $3d09 ; read dy 4.753 + lda $5189 ; read dy 4.754 cmp #0 4.755 beq move_projectile_up_check_y 4.756 4.757 - dec $3d09 4.758 + dec $5189 4.759 clc 4.760 rts 4.761 4.762 move_projectile_up_check_y: ; Check the y offset. 4.763 4.764 - lda $3d08 4.765 + lda $5188 4.766 cmp #0 4.767 beq move_projectile_up_exit 4.768 4.769 tax ; use the y offset as an index 4.770 dex ; y - 1 4.771 - ldy $3d0a ; load the x offset 4.772 + ldy $518a ; load the x offset 4.773 lda room_row_offsets_low,x ; read the address of the row 4.774 sta $70 4.775 lda #$57 4.776 @@ -3045,7 +3044,7 @@ 4.777 cmp #0 4.778 bne move_projectile_up_wall 4.779 4.780 - lda $3d0b ; dx 4.781 + lda $518b ; dx 4.782 cmp #3 4.783 bmi move_projectile_allow_up 4.784 4.785 @@ -3058,9 +3057,9 @@ 4.786 4.787 move_projectile_allow_up: 4.788 txa 4.789 - sta $3d08 ; store the new room y offset 4.790 + sta $5188 ; store the new room y offset 4.791 lda #5 4.792 - sta $3d09 ; dy = 5 4.793 + sta $5189 ; dy = 5 4.794 4.795 clc 4.796 rts 4.797 @@ -3068,7 +3067,7 @@ 4.798 move_projectile_up_wall: ; the projectile hit a wall 4.799 clc 4.800 4.801 - lda $3d07 ; type 2 can pass through walls 4.802 + lda $5187 ; type 2 can pass through walls 4.803 and #$06 4.804 cmp #4 4.805 beq move_projectile_allow_up 4.806 @@ -3076,14 +3075,14 @@ 4.807 cmp #2 4.808 bne move_projectile_up_not_boomerang 4.809 4.810 - lda $3d07 4.811 + lda $5187 4.812 and #$0f 4.813 cmp #8 4.814 bpl move_projectile_up_exit 4.815 4.816 - ldx $3d03 ; player's dy 4.817 + ldx $5183 ; player's dy 4.818 ora boomerang_vertical,x 4.819 - sta $3d07 4.820 + sta $5187 4.821 clc 4.822 rts ; exit without moving or registering a collision 4.823 4.824 @@ -3092,7 +3091,7 @@ 4.825 cmp #6 ; type 3 can destroy certain walls 4.826 bne move_projectile_up_exit 4.827 4.828 - lda $3d0b ; dx 4.829 + lda $518b ; dx 4.830 cmp #3 4.831 bpl move_projectile_up_exit ; shots must be lined up 4.832 4.833 @@ -3108,9 +3107,9 @@ 4.834 jsr create_explosion 4.835 jsr plot_blank_xy ; corrupted X 4.836 4.837 - lda #$24 4.838 + lda #$a4 4.839 sta $74 4.840 - lda #$3d 4.841 + lda #$51 4.842 sta $75 4.843 jsr plot_character 4.844 4.845 @@ -3125,19 +3124,19 @@ 4.846 4.847 move_projectile_down: 4.848 4.849 - lda $3d09 ; read dy 4.850 + lda $5189 ; read dy 4.851 cmp #4 4.852 beq move_projectile_down_check_y 4.853 cmp #5 4.854 beq move_projectile_down_tile 4.855 4.856 - inc $3d09 ; 0 < dy < 5 4.857 + inc $5189 ; 0 < dy < 5 4.858 clc 4.859 rts 4.860 4.861 move_projectile_down_check_y: ; Check the y offset. 4.862 4.863 - lda $3d08 4.864 + lda $5188 4.865 cmp #9 4.866 bne move_projectile_down_in_room 4.867 jmp move_projectile_down_exit 4.868 @@ -3146,7 +3145,7 @@ 4.869 clc 4.870 tax 4.871 inx ; y + 1 4.872 - ldy $3d0a ; load the x offset 4.873 + ldy $518a ; load the x offset 4.874 lda room_row_offsets_low,x ; read the address of the row 4.875 sta $70 4.876 lda #$57 4.877 @@ -3156,7 +3155,7 @@ 4.878 cmp #0 4.879 bne move_projectile_down_wall 4.880 4.881 - lda $3d0b ; dx 4.882 + lda $518b ; dx 4.883 cmp #3 4.884 bmi move_projectile_allow_down 4.885 4.886 @@ -3169,22 +3168,22 @@ 4.887 4.888 move_projectile_allow_down: 4.889 4.890 - inc $3d09 ; update dy 4.891 + inc $5189 ; update dy 4.892 clc 4.893 rts 4.894 4.895 move_projectile_down_tile: 4.896 4.897 - inc $3d08 ; store the new room y offset 4.898 + inc $5188 ; store the new room y offset 4.899 lda #0 4.900 - sta $3d09 ; dy = 0 4.901 + sta $5189 ; dy = 0 4.902 clc 4.903 rts 4.904 4.905 move_projectile_down_wall: ; the projectile hit a wall 4.906 clc 4.907 4.908 - lda $3d07 ; type 2 can pass through walls 4.909 + lda $5187 ; type 2 can pass through walls 4.910 and #$06 4.911 cmp #4 4.912 beq move_projectile_allow_down 4.913 @@ -3192,14 +3191,14 @@ 4.914 cmp #2 4.915 bne move_projectile_down_not_boomerang 4.916 4.917 - lda $3d07 4.918 + lda $5187 4.919 and #$0f 4.920 cmp #8 4.921 bpl move_projectile_down_exit 4.922 4.923 - ldx $3d03 ; player's dy 4.924 + ldx $5183 ; player's dy 4.925 ora boomerang_vertical,x 4.926 - sta $3d07 4.927 + sta $5187 4.928 clc 4.929 rts ; exit without moving or registering a collision 4.930 4.931 @@ -3208,7 +3207,7 @@ 4.932 cmp #6 ; type 3 can destroy certain walls 4.933 bne move_projectile_down_exit 4.934 4.935 - lda $3d0b ; dx 4.936 + lda $518b ; dx 4.937 cmp #3 4.938 bpl move_projectile_down_exit ; shots must be lined up 4.939 4.940 @@ -3224,9 +3223,9 @@ 4.941 jsr create_explosion 4.942 jsr plot_blank_xy ; corrupted X 4.943 4.944 - lda #$24 4.945 + lda #$a4 4.946 sta $74 4.947 - lda #$3d 4.948 + lda #$51 4.949 sta $75 4.950 jsr plot_character 4.951 4.952 @@ -3239,14 +3238,14 @@ 4.953 4.954 move_projectile_animate: 4.955 4.956 - lda $3d07 4.957 + lda $5187 4.958 eor #1 4.959 - sta $3d07 4.960 + sta $5187 4.961 rts 4.962 4.963 move_projectile: 4.964 4.965 - lda $3d06 4.966 + lda $5186 4.967 cmp #0 4.968 bne move_projectile_move 4.969 jmp move_projectile_exit 4.970 @@ -3254,13 +3253,13 @@ 4.971 move_projectile_move: 4.972 clc 4.973 4.974 - lda #$06 4.975 + lda #$86 4.976 sta $74 4.977 - lda #$3d 4.978 + lda #$51 4.979 sta $75 4.980 jsr unplot_character 4.981 4.982 - lda $3d07 4.983 + lda $5187 4.984 and #$30 ; direction 4.985 4.986 cmp #0 4.987 @@ -3300,9 +3299,9 @@ 4.988 4.989 jsr move_projectile_animate 4.990 4.991 - lda #$06 4.992 + lda #$86 4.993 sta $74 4.994 - lda #$3d 4.995 + lda #$51 4.996 sta $75 4.997 jmp plot_character ; optimise away the rts 4.998 4.999 @@ -3342,7 +3341,7 @@ 4.1000 4.1001 move_projectile_no_enemy_collision: 4.1002 4.1003 - lda $3d07 ; type 2 projectiles pass through everything 4.1004 + lda $5187 ; type 2 projectiles pass through everything 4.1005 and #$06 4.1006 cmp #4 4.1007 bne move_projectile_remove_projectile 4.1008 @@ -3351,22 +3350,22 @@ 4.1009 ; that we don't perform these checks again here, but it would just add 4.1010 ; overhead to the normal movement routines for the other weapons. 4.1011 4.1012 - lda $3d08 ; y 4.1013 + lda $5188 ; y 4.1014 cmp #0 4.1015 beq move_projectile_remove_projectile 4.1016 cmp #9 4.1017 beq move_projectile_remove_projectile 4.1018 4.1019 - lda $3d0a ; x 4.1020 + lda $518a ; x 4.1021 cmp #0 4.1022 beq move_projectile_remove_projectile 4.1023 cmp #9 4.1024 beq move_projectile_remove_projectile 4.1025 4.1026 clc 4.1027 - lda #$06 4.1028 + lda #$86 4.1029 sta $74 4.1030 - lda #$3d 4.1031 + lda #$51 4.1032 sta $75 4.1033 4.1034 jsr plot_character 4.1035 @@ -3375,7 +3374,7 @@ 4.1036 move_projectile_remove_projectile: 4.1037 4.1038 lda #0 ; remove the projectile from the character list 4.1039 - sta $3d06 4.1040 + sta $5186 4.1041 4.1042 move_projectile_exit: 4.1043 clc 4.1044 @@ -3383,9 +3382,9 @@ 4.1045 4.1046 move_characters: 4.1047 4.1048 - lda #$0c ; set the character address 4.1049 + lda #$8c ; set the character address 4.1050 sta $74 4.1051 - lda #$3d 4.1052 + lda #$51 4.1053 sta $75 4.1054 4.1055 move_characters_loop: 4.1056 @@ -3396,7 +3395,7 @@ 4.1057 bne move_characters_read_character 4.1058 4.1059 lda $74 4.1060 - cmp #$24 4.1061 + cmp #$a4 4.1062 bpl move_characters_read_character 4.1063 4.1064 ; See if it is time to generate a new enemy. 4.1065 @@ -3446,7 +3445,7 @@ 4.1066 lda $74 4.1067 adc #6 4.1068 4.1069 - cmp #$2a 4.1070 + cmp #$aa 4.1071 bpl move_characters_endloop 4.1072 sta $74 4.1073 jmp move_characters_loop 4.1074 @@ -3748,19 +3747,19 @@ 4.1075 lda #64 ; reset the delay counter 4.1076 sta $3df5 4.1077 4.1078 - lda #$00 ; unplot the player 4.1079 + lda #$80 ; unplot the player 4.1080 sta $74 4.1081 - lda #$3d 4.1082 + lda #$51 4.1083 sta $75 4.1084 4.1085 jsr unplot_character 4.1086 4.1087 lda #8 ; change the player's direction to the demise animation 4.1088 - sta $3d01 4.1089 + sta $5181 4.1090 4.1091 jsr plot_character 4.1092 4.1093 - lda #$0c 4.1094 + lda #$8c 4.1095 sta $74 4.1096 4.1097 reduce_strength_destroy_enemies_loop: 4.1098 @@ -3801,7 +3800,7 @@ 4.1099 lda $74 4.1100 adc #6 4.1101 sta $74 4.1102 - cmp #$24 4.1103 + cmp #$a4 4.1104 bmi reduce_strength_destroy_enemies_loop 4.1105 4.1106 reduce_strength_exit: 4.1107 @@ -3815,7 +3814,7 @@ 4.1108 ldx #6 4.1109 remove_characters_loop: 4.1110 lda #0 4.1111 - sta $3d00,x 4.1112 + sta $5180,x 4.1113 txa 4.1114 adc #6 4.1115 tax 4.1116 @@ -3863,17 +3862,17 @@ 4.1117 4.1118 player_collide: 4.1119 4.1120 - lda $3d02 ; player y 4.1121 + lda $5182 ; player y 4.1122 sta $8a 4.1123 - lda $3d04 ; player x 4.1124 + lda $5184 ; player x 4.1125 sta $8b 4.1126 4.1127 - ldx $3d03 ; player dy 4.1128 + ldx $5183 ; player dy 4.1129 lda player_collision_mask_above,x 4.1130 sta $86 4.1131 lda player_collision_mask_below,x 4.1132 sta $88 4.1133 - ldx $3d05 ; player dx 4.1134 + ldx $5185 ; player dx 4.1135 lda player_collision_mask_left,x 4.1136 sta $87 4.1137 lda player_collision_mask_right,x 4.1138 @@ -3883,17 +3882,17 @@ 4.1139 4.1140 projectile_collide: 4.1141 4.1142 - lda $3d08 ; projectile y 4.1143 + lda $5188 ; projectile y 4.1144 sta $8a 4.1145 - lda $3d0a ; projectile x 4.1146 + lda $518a ; projectile x 4.1147 sta $8b 4.1148 4.1149 - ldx $3d09 ; projectile dy 4.1150 + ldx $5189 ; projectile dy 4.1151 lda projectile_collision_mask_above,x 4.1152 sta $86 4.1153 lda projectile_collision_mask_below,x 4.1154 sta $88 4.1155 - ldx $3d0b ; projectile dx 4.1156 + ldx $518b ; projectile dx 4.1157 lda projectile_collision_mask_left,x 4.1158 sta $87 4.1159 lda projectile_collision_mask_right,x 4.1160 @@ -3903,9 +3902,9 @@ 4.1161 4.1162 collide: 4.1163 4.1164 - lda #$0c ; set the character address 4.1165 + lda #$8c ; set the character address 4.1166 sta $74 4.1167 - lda #$3d 4.1168 + lda #$51 4.1169 sta $75 4.1170 4.1171 collide_loop: 4.1172 @@ -4021,7 +4020,7 @@ 4.1173 lda $74 4.1174 adc #6 4.1175 4.1176 - cmp #$24 4.1177 + cmp #$a4 4.1178 bpl collide_exit 4.1179 sta $74 4.1180 jmp collide_loop 4.1181 @@ -4227,7 +4226,7 @@ 4.1182 sta $70 4.1183 lda #$50 4.1184 sta $71 4.1185 - lda #$16 4.1186 + lda #$08 4.1187 sta $72 4.1188 4.1189 init_define_high_scores_loop: 4.1190 @@ -4255,7 +4254,7 @@ 4.1191 sed 4.1192 lda $72 4.1193 sec 4.1194 - sbc #2 4.1195 + sbc #1 4.1196 sta $72 4.1197 cld 4.1198 clc 4.1199 @@ -4336,10 +4335,7 @@ 4.1200 4.1201 ; Show the high scores. 4.1202 4.1203 - lda #17 4.1204 - jsr $ffee 4.1205 - lda #3 4.1206 - jsr $ffee 4.1207 + jsr colour3 4.1208 4.1209 lda #$80 4.1210 sta $70 4.1211 @@ -4555,9 +4551,9 @@ 4.1212 ; $74,$75 should be unchanged 4.1213 jsr unplot_character 4.1214 4.1215 - lda $3d01 4.1216 + lda $5181 4.1217 eor #1 4.1218 - sta $3d01 4.1219 + sta $5181 4.1220 jsr plot_character 4.1221 4.1222 jsr plot_buffer 4.1223 @@ -4686,9 +4682,13 @@ 4.1224 jsr reset_unplot_buffer 4.1225 jsr reset_plot_buffer 4.1226 4.1227 - lda #$00 ; plot the player 4.1228 + ; Run on into the next routine. 4.1229 + 4.1230 +plot_the_player: 4.1231 + 4.1232 + lda #$80 ; plot the player 4.1233 sta $74 4.1234 - lda #$3d 4.1235 + lda #$51 4.1236 sta $75 4.1237 jsr plot_character 4.1238 4.1239 @@ -4861,10 +4861,7 @@ 4.1240 jsr plot_room_tiles 4.1241 4.1242 ; Add text characters to the room. 4.1243 - lda #17 4.1244 - jsr $ffee 4.1245 - lda #3 4.1246 - jsr $ffee 4.1247 + jsr colour3 4.1248 4.1249 lda #3 ; x 4.1250 sta $70 4.1251 @@ -4930,39 +4927,140 @@ 4.1252 4.1253 jsr set_standard_palette 4.1254 4.1255 + ldx #0 4.1256 + high_score_vdu_loop: 4.1257 + 4.1258 + lda high_score_vdu_bytes,x 4.1259 + jsr $ffee 4.1260 + inx 4.1261 + cpx #12 4.1262 + bne high_score_vdu_loop 4.1263 + 4.1264 high_score_entry_loop: 4.1265 4.1266 jsr reset_unplot_buffer 4.1267 jsr reset_plot_buffer 4.1268 4.1269 jsr move_player 4.1270 - bcs high_score_entry_after_loop ; check if the player leaves the room 4.1271 - 4.1272 - lda $3303 ; dy 4.1273 - cmp #0 4.1274 - bne high_score_entry_not_aligned 4.1275 - 4.1276 - lda $3302 ; y 4.1277 + ; Check if the player leaves the room. 4.1278 + bcc high_score_entry_check_position 4.1279 + jmp high_score_entry_after_loop 4.1280 + 4.1281 + high_score_entry_check_position: 4.1282 + 4.1283 + lda $5185 ; dx 4.1284 + cmp #2 4.1285 + beq high_score_entry_maybe_aligned 4.1286 + jmp high_score_entry_not_aligned 4.1287 + 4.1288 + high_score_entry_maybe_aligned: 4.1289 + 4.1290 + lda $5182 ; y 4.1291 + tay 4.1292 cmp #8 4.1293 bpl high_score_entry_not_aligned 4.1294 4.1295 - adc $3304 ; x 4.1296 + lda $5184 ; x 4.1297 + tax 4.1298 and #1 4.1299 beq high_score_entry_not_aligned 4.1300 - 4.1301 - lda $3305 ; dx 4.1302 + cmp #9 4.1303 + beq high_score_entry_not_aligned 4.1304 + 4.1305 + lda $5183 ; dy 4.1306 cmp #2 4.1307 + bmi high_score_entry_aligned 4.1308 + cmp #5 4.1309 bne high_score_entry_not_aligned 4.1310 + iny ; we are really touching the character below 4.1311 + 4.1312 + high_score_entry_aligned: 4.1313 + 4.1314 + lda $3dfd 4.1315 + cmp #1 4.1316 + beq high_score_entry_next 4.1317 4.1318 ; The player is aligned with a letter. 4.1319 + txa 4.1320 + sec 4.1321 + sbc #1 4.1322 + lsr 4.1323 + sta $7e ; record (x - 1) / 2 4.1324 + 4.1325 + tya ; recall y 4.1326 + sec 4.1327 + sbc #1 4.1328 + asl 4.1329 + asl ; (y - 1) * 4 4.1330 + clc 4.1331 + 4.1332 + adc $7e ; (y - 1) * 4 + (x - 1) / 2 4.1333 + adc #65 4.1334 + sta $7e ; record the ASCII code 4.1335 + 4.1336 + cmp #91 4.1337 + bmi insert_character 4.1338 + 4.1339 + cmp #92 4.1340 + beq delete_character 4.1341 + 4.1342 + ; Insert a space. 4.1343 + lda #32 4.1344 + sta $7e 4.1345 + 4.1346 + insert_character: 4.1347 + lda $8f 4.1348 + cmp #12 4.1349 + bpl high_score_entry_pressed 4.1350 + 4.1351 + tay ; insert the character 4.1352 + lda $7e 4.1353 + sta ($8d),y 4.1354 + jsr print_high_score_character 4.1355 + 4.1356 + inc $8f 4.1357 + jmp high_score_entry_pressed 4.1358 + 4.1359 + delete_character: 4.1360 + lda $8f 4.1361 + cmp #4 4.1362 + bmi high_score_entry_pressed 4.1363 + 4.1364 + cmp #12 4.1365 + beq high_score_delete_previous_character 4.1366 + 4.1367 + tay 4.1368 + lda #32 ; insert a space 4.1369 + sta ($8d),y 4.1370 + jsr print_high_score_character 4.1371 + 4.1372 + high_score_delete_previous_character: 4.1373 + dec $8f 4.1374 + lda $8f 4.1375 + tay ; insert a space 4.1376 + lda #32 4.1377 + sta ($8d),y 4.1378 + jsr print_high_score_character 4.1379 + 4.1380 + high_score_entry_pressed: 4.1381 + lda #1 4.1382 + sta $3dfd 4.1383 + jmp high_score_entry_next 4.1384 4.1385 high_score_entry_not_aligned: 4.1386 + lda #0 4.1387 + sta $3dfd 4.1388 + 4.1389 + high_score_entry_next: 4.1390 4.1391 jsr wait_for_vsync 4.1392 jsr plot_buffer 4.1393 4.1394 jmp high_score_entry_loop 4.1395 4.1396 + inc $3dfe 4.1397 + clc 4.1398 + 4.1399 high_score_entry_after_loop: 4.1400 clc 4.1401 4.1402 @@ -4971,11 +5069,31 @@ 4.1403 4.1404 rts 4.1405 4.1406 +high_score_vdu_bytes: .byte 17,2, 31,5,27, ">", 31,15,27, "<", 17,1 4.1407 + 4.1408 cls: 4.1409 lda #12 4.1410 jsr $ffee 4.1411 rts 4.1412 4.1413 +colour3: 4.1414 + lda #17 4.1415 + jsr $ffee 4.1416 + lda #3 4.1417 + jsr $ffee 4.1418 + rts 4.1419 + 4.1420 +print_high_score_character: ; A=ASCII code 4.1421 + 4.1422 + clc 4.1423 + sta $72 ; store the character 4.1424 + lda $8f 4.1425 + adc #3 4.1426 + sta $70 ; store the x position of the character 4.1427 + lda #27 4.1428 + sta $71 4.1429 + ; Run on into the next routine. 4.1430 + 4.1431 print_xy: 4.1432 4.1433 lda #31 4.1434 @@ -5003,7 +5121,7 @@ 4.1435 ; Set the score. 4.1436 lda #0 4.1437 sta $3df6 4.1438 - lda #$02 4.1439 + lda #0 4.1440 sta $3df7 4.1441 lda #0 4.1442 sta $3df8 4.1443 @@ -5013,7 +5131,7 @@ 4.1444 jsr blank_screen 4.1445 4.1446 ; Set the player's strength. 4.1447 - lda #4 4.1448 + lda #64 4.1449 sta $70 4.1450 jsr add_strength 4.1451 4.1452 @@ -5026,17 +5144,17 @@ 4.1453 reset_player_position: 4.1454 4.1455 lda #1 ; player 4.1456 - sta $3d00 4.1457 + sta $5180 4.1458 lda #6 ; down (first frame) 4.1459 - sta $3d01 4.1460 + sta $5181 4.1461 lda #4 ; y=4 4.1462 - sta $3d02 4.1463 + sta $5182 4.1464 lda #3 ; dy=3 4.1465 - sta $3d03 4.1466 + sta $5183 4.1467 lda #4 ; x=4 4.1468 - sta $3d04 4.1469 + sta $5184 4.1470 lda #3 ; dx=3 4.1471 - sta $3d05 4.1472 + sta $5185 4.1473 4.1474 rts 4.1475 4.1476 @@ -5182,13 +5300,7 @@ 4.1477 jsr set_room_palette 4.1478 jsr add_treasure 4.1479 4.1480 - lda #$00 ; plot the player 4.1481 - sta $74 4.1482 - lda #$3d 4.1483 - sta $75 4.1484 - jsr plot_character 4.1485 - 4.1486 - jsr plot_buffer 4.1487 + jsr plot_the_player 4.1488 4.1489 lda #0 ; reset projectile counter 4.1490 sta $3dfd 4.1491 @@ -5215,7 +5327,7 @@ 4.1492 dec $3df5 ; leave the loop when the delay 4.1493 beq after_room_loop ; counter is about to reset 4.1494 4.1495 - lda $3d01 ; leave the loop when the player 4.1496 + lda $5181 ; leave the loop when the player 4.1497 cmp #11 ; animation has finished 4.1498 beq room_loop_after_player_move 4.1499 clc 4.1500 @@ -5224,14 +5336,14 @@ 4.1501 and #7 4.1502 bne room_loop_after_player_move 4.1503 4.1504 - lda #$00 4.1505 + lda #$80 4.1506 sta $74 4.1507 - lda #$3d 4.1508 + lda #$51 4.1509 sta $75 4.1510 4.1511 jsr unplot_character 4.1512 4.1513 - inc $3d01 4.1514 + inc $5181 4.1515 jsr plot_character 4.1516 jmp room_loop_after_player_move 4.1517 4.1518 @@ -5251,7 +5363,7 @@ 4.1519 ldx #143 4.1520 jsr check_key 4.1521 cpy #255 4.1522 - beq exit 4.1523 + beq game_over 4.1524 clc 4.1525 4.1526 lda $3dfd
