Update bubble escape 2k.p65 to Bubble Escape 2K (mini game compo).
Cat's Eye Technologies
13 years ago
1 | 1 | ; ; |
2 | 2 | ; Cat's Eye Technologies' ; |
3 | 3 | ; Bubble Escape 2009 ; |
4 | ; !!! 2K VERSION !!! ; | |
5 | ; Submitted to the Mini Game Compo 2009 ; | |
4 | 6 | ; ; |
5 | 7 | ;---------------------------------------------------------------------; |
6 | 8 | ; Copyright (c)2009 Cat's Eye Technologies. All rights reserved. ; |
138 | 140 | .alias destptr $fd |
139 | 141 | .alias sprite_len $0200 |
140 | 142 | |
141 | ;----------------------------------; | |
142 | ; Symbolic constants for debugging ; | |
143 | ;----------------------------------; | |
144 | ||
145 | ; | |
146 | ; Set these to colors other than game_border_color if you want a | |
147 | ; visual indication of how long the raster interrupt takes to execute. | |
148 | ; | |
149 | ||
150 | ;.alias display_critical_border_color color_red | |
151 | .alias display_critical_border_color game_border_color | |
152 | ;.alias irq_progress_border_color color_yellow | |
153 | .alias irq_progress_border_color game_border_color | |
154 | ||
155 | 143 | |
156 | 144 | ;=================================================================== |
157 | 145 | ; ... Header ... |
158 | 146 | ;=================================================================== |
159 | 147 | |
160 | .org 0 ; no real address, we're just faking up a header | |
161 | .word $0801 ; we start here. | |
162 | .org $0801 ; 2049 | |
163 | ||
164 | ||
165 | ;=================================================================== | |
166 | ; ... BASIC loader stub ... | |
167 | ;=================================================================== | |
168 | ||
169 | .byte $10, $08 ; base address | |
170 | .byte $c9, $07 ; line number: 1993 | |
171 | .byte $9e ; SYS | |
172 | .byte $32, $30, $36, $31 ; '2061' | |
173 | .byte $00, $00, $00 ; end of program | |
174 | ||
175 | ; here is 2061 ($080d) | |
176 | ||
148 | .org 0 | |
149 | .word $c000 | |
150 | .org $c000 | |
177 | 151 | |
178 | 152 | ;=================================================================== |
179 | 153 | ; ... Global Initialization ... |
184 | 158 | ; |
185 | 159 | |
186 | 160 | init: |
187 | lda #$80 | |
188 | sta mode ; disable SHIFT+C= changing charset | |
189 | lda vic_vmcsb | |
190 | and #%11111000 | |
191 | ora #$05 | |
192 | sta vic_vmcsb ; set character map base to uppercase set | |
193 | ||
194 | lda #game_bg_color | |
161 | lda #0 | |
195 | 162 | sta vic_bg_0_color |
196 | lda #game_border_color | |
197 | 163 | sta vic_border_color |
164 | sta irq_active | |
165 | sta waiting_collision_clear | |
166 | tay | |
198 | 167 | |
199 | 168 | lda #$8f ; volume = 15, bit 7 = voice 3 silenced |
200 | 169 | sta sid_volume |
209 | 178 | lda #3 |
210 | 179 | sta vic_sprite_0_color |
211 | 180 | |
212 | copy_sprites: | |
213 | ||
214 | lda #<sprite_source | |
215 | sta srcptr | |
216 | lda #>sprite_source | |
217 | sta srcptr+1 | |
218 | ||
219 | lda #<sprite_dest | |
220 | sta destptr | |
221 | lda #>sprite_dest | |
222 | sta destptr+1 | |
223 | ||
224 | ldx #>sprite_len | |
225 | ||
226 | outer_loop: | |
227 | ldy #0 | |
228 | ||
229 | inner_loop: | |
230 | lda (srcptr), y | |
231 | sta (destptr), y | |
181 | copy_sprites_loop: | |
182 | lda sprite_source, y | |
183 | sta sprite_dest, y | |
184 | lda sprite_source+256, y | |
185 | sta sprite_dest+256, y | |
232 | 186 | iny |
233 | bne inner_loop | |
234 | ||
235 | inc srcptr+1 ; bump up high bytes | |
236 | inc destptr+1 | |
237 | dex | |
238 | bne outer_loop | |
187 | bne copy_sprites_loop | |
188 | ||
189 | lda #$ff | |
190 | ldy #63 | |
191 | wall_loop: | |
192 | sta wall_sprite_dest-1, y | |
193 | dey | |
194 | bne wall_loop | |
195 | ||
196 | lda #$cc | |
197 | ldy #63 | |
198 | teleporter_loop: | |
199 | sta teleporter_sprite_dest-1, y | |
200 | dey | |
201 | bne teleporter_loop | |
239 | 202 | |
240 | 203 | ; |
241 | 204 | ; Set up the IRQ handler routine. |
242 | 205 | ; |
243 | ||
244 | lda #$00 | |
245 | sta irq_active | |
246 | sta waiting_collision_clear | |
247 | 206 | |
248 | 207 | patch_cinv: |
249 | 208 | sei ; disable interrupts |
273 | 232 | |
274 | 233 | |
275 | 234 | ;=================================================================== |
276 | ; ... Title Screen ... | |
277 | ;=================================================================== | |
278 | ||
279 | title_screen: | |
280 | ||
281 | lda #<title_text | |
282 | sta srcptr | |
283 | lda #>title_text | |
284 | sta srcptr+1 | |
285 | jsr show_message_screen | |
286 | ||
287 | ||
288 | ;=================================================================== | |
289 | 235 | ; ... Game State Initialization ... |
290 | 236 | ;=================================================================== |
291 | 237 | |
296 | 242 | new_game: |
297 | 243 | |
298 | 244 | lda #$00 |
299 | sta player_died | |
300 | 245 | sta player_won |
301 | ||
302 | ; | |
303 | ; For debugging, uncomment some of these lines | |
304 | ; | |
305 | ||
306 | .alias start_room 0 | |
307 | ;.alias start_room 18 ; near NE teleporter | |
308 | ;.alias start_room 198 ; near exit | |
309 | .alias initial_keys 0 | |
310 | ;.alias initial_keys 5 | |
311 | ||
312 | lda #initial_keys | |
246 | sta room_num | |
313 | 247 | sta num_keys |
314 | ldy #start_room | |
315 | sty room_num | |
316 | lda map, y | |
317 | ora #c_start | |
318 | sta map, y | |
319 | ||
320 | ldy #0 | |
321 | lda #0 | |
248 | ||
249 | ;XXXXXXXXXXXXXXXXXX | |
250 | ; lda #198 | |
251 | ; sta room_num | |
252 | ; tay | |
253 | ; lda #5 | |
254 | ; sta num_keys | |
255 | ; lda map, y | |
256 | ; and #%11110000 | |
257 | ; ora #c_start | |
258 | ; sta map, y | |
259 | ; lda #0 | |
260 | ;XXXXXXXXXXXXXXXXXX | |
261 | ||
262 | tay | |
322 | 263 | reset_actors_loop: |
323 | 264 | sta actor_table_base, y |
324 | 265 | iny |
330 | 271 | ; Position bubble in center of room. |
331 | 272 | ; |
332 | 273 | |
333 | ldy #0 | |
274 | tay | |
334 | 275 | jsr center_actor_number_y |
335 | 276 | |
336 | 277 | lda #<bubble_logic_routine |
341 | 282 | lda #$09 |
342 | 283 | sta num_lives |
343 | 284 | |
285 | lda #45 | |
286 | sta sentry_initial | |
287 | ||
344 | 288 | set_up_map: |
345 | 289 | ldy #200 |
346 | 290 | set_up_map_loop: |
347 | 291 | dey |
348 | 292 | |
349 | lda map, y | |
350 | ||
351 | and #$0f | |
352 | cmp #c_start | |
293 | jsr check_map_for_existing | |
353 | 294 | beq next_map_loop |
354 | cmp #c_telep | |
355 | beq next_map_loop | |
356 | cmp #c_exit | |
357 | beq next_map_loop | |
358 | 295 | |
359 | 296 | jsr gen_random_4 |
360 | clc | |
361 | adc #c_walls | |
297 | ora #c_walls | |
362 | 298 | sta baddie |
363 | 299 | |
364 | 300 | lda map, y |
375 | 311 | place_keys_loop: |
376 | 312 | jsr gen_random_room |
377 | 313 | tay |
378 | lda map, y | |
379 | ||
380 | and #$0f | |
381 | cmp #c_start | |
382 | beq place_keys_loop | |
383 | cmp #c_telep | |
384 | beq place_keys_loop | |
385 | cmp #c_exit | |
386 | beq place_keys_loop | |
387 | cmp #c_key | |
314 | ||
315 | jsr check_map_for_existing | |
388 | 316 | beq place_keys_loop |
389 | 317 | |
390 | 318 | lda map, y |
434 | 362 | lda #bubble_page ; to reset to bubble after it was possibly showing "pop" sprite |
435 | 363 | sta sprite_0_ptr |
436 | 364 | |
437 | lda #$01 | |
438 | sta vic_sprite_enable | |
439 | ||
440 | 365 | jsr clear_monsters |
441 | 366 | jsr set_up_monsters |
442 | 367 | jsr update_sprites |
476 | 401 | bne death_sequence |
477 | 402 | |
478 | 403 | lda player_won |
479 | bne game_won | |
480 | 404 | |
481 | jmp play_game | |
482 | ||
405 | beq play_game | |
483 | 406 | |
484 | 407 | ;=================================================================== |
485 | 408 | ; ... Outside Game Play Sequences ... |
486 | 409 | ;=================================================================== |
487 | 410 | |
411 | ;----------; | |
412 | ; Game Won ; | |
413 | ;----------; | |
414 | ||
415 | game_won: | |
416 | lda #color_yellow | |
417 | sta vic_bg_0_color | |
418 | lda #color_lt_red | |
419 | sta vic_bg_0_color | |
420 | jmp game_won | |
421 | ||
488 | 422 | ;---------------; |
489 | 423 | ; Bubble Popped ; |
490 | 424 | ;---------------; |
491 | 425 | |
492 | 426 | death_sequence: |
493 | lda #0 | |
494 | sta player_died | |
495 | ||
496 | lda #state_alive | |
497 | sta player_state | |
498 | ||
499 | 427 | ldy num_lives |
500 | 428 | dey |
429 | sty num_lives | |
501 | 430 | bne reset_bubble |
502 | 431 | |
503 | jmp game_over | |
432 | jsr draw_corners | |
433 | sty vic_sprite_enable | |
434 | ||
435 | wait_joystick_button: | |
436 | lda joy2 | |
437 | and #$10 | |
438 | bne wait_joystick_button | |
439 | ||
440 | jmp new_game ; game over | |
504 | 441 | |
505 | 442 | reset_bubble: |
506 | sty num_lives | |
507 | 443 | |
508 | 444 | ldy #0 ; affect actor #0, the bubble |
509 | 445 | |
511 | 447 | ; If the room is walls or empty, place bubble in very center. |
512 | 448 | ; Else place bubble offset a bit. |
513 | 449 | ; |
450 | jsr be_still_actor_number_y | |
451 | jsr center_actor_number_y | |
514 | 452 | |
515 | 453 | lda current_room |
516 | 454 | and #$0f |
520 | 458 | cmp #c_start |
521 | 459 | beq very_center |
522 | 460 | |
523 | jsr offset_actor_number_y | |
524 | ||
525 | jmp be_still_my_bubble | |
461 | jsr offset_ur_actor_number_y | |
526 | 462 | |
527 | 463 | very_center: |
528 | jsr center_actor_number_y | |
529 | ||
530 | be_still_my_bubble: | |
531 | jsr be_still_actor_number_y | |
532 | ||
533 | 464 | jmp initialize_room |
534 | ||
535 | ;-----------; | |
536 | ; Game Over ; | |
537 | ;-----------; | |
538 | ||
539 | game_over: | |
540 | lda #<game_over_text | |
541 | sta srcptr | |
542 | lda #>game_over_text | |
543 | sta srcptr+1 | |
544 | jsr show_message_screen | |
545 | ||
546 | jmp title_screen | |
547 | ||
548 | ;----------; | |
549 | ; Game Won ; | |
550 | ;----------; | |
551 | ||
552 | game_won: | |
553 | lda #<game_won_text | |
554 | sta srcptr | |
555 | lda #>game_won_text | |
556 | sta srcptr+1 | |
557 | jsr show_message_screen | |
558 | ||
559 | jmp title_screen | |
560 | ||
561 | 465 | |
562 | 466 | ;=================================================================== |
563 | 467 | ; ... Gameplay Subroutines ... |
569 | 473 | |
570 | 474 | draw_room_contents: |
571 | 475 | lda current_room |
476 | tax | |
572 | 477 | and #wall_n |
573 | 478 | beq not_north |
574 | 479 | jsr draw_north |
575 | 480 | not_north: |
576 | lda current_room | |
481 | txa | |
577 | 482 | and #wall_w |
578 | 483 | beq not_west |
579 | 484 | jsr draw_west |
580 | 485 | not_west: |
581 | lda current_room | |
486 | txa | |
582 | 487 | and #wall_e |
583 | 488 | beq not_east |
584 | 489 | jsr draw_east |
585 | 490 | not_east: |
586 | lda current_room | |
491 | txa | |
587 | 492 | and #wall_s |
588 | 493 | beq not_south |
589 | 494 | jsr draw_south |
619 | 524 | draw_north_loop: |
620 | 525 | lda #north_wall_char |
621 | 526 | sta screen-1, y |
622 | lda #north_wall_color | |
623 | sta colormap-1, y | |
624 | 527 | dey |
625 | 528 | bne draw_north_loop |
626 | 529 | rts |
630 | 533 | draw_south_loop: |
631 | 534 | lda #south_wall_char |
632 | 535 | sta screen+959, y |
633 | lda #south_wall_color | |
634 | sta colormap+959, y | |
635 | 536 | dey |
636 | 537 | bne draw_south_loop |
637 | 538 | rts |
645 | 546 | sta screen+320, y |
646 | 547 | sta screen+560, y |
647 | 548 | sta screen+800, y |
648 | lda #west_wall_color | |
649 | sta colormap, y | |
650 | sta colormap+240, y | |
651 | sta colormap+320, y | |
652 | sta colormap+560, y | |
653 | sta colormap+800, y | |
549 | ||
654 | 550 | tya |
655 | 551 | sec |
656 | 552 | sbc #40 |
668 | 564 | sta screen+359, y |
669 | 565 | sta screen+599, y |
670 | 566 | sta screen+839, y |
671 | lda #east_wall_color | |
672 | sta colormap+39, y | |
673 | sta colormap+279, y | |
674 | sta colormap+359, y | |
675 | sta colormap+599, y | |
676 | sta colormap+839, y | |
677 | 567 | |
678 | 568 | tya |
679 | 569 | sec |
720 | 610 | ldy #1 |
721 | 611 | jsr center_actor_number_y |
722 | 612 | |
723 | lda vic_sprite_enable | |
724 | ora #%00000010 | |
613 | lda #%00000011 | |
725 | 614 | sta vic_sprite_enable |
726 | 615 | |
727 | 616 | rts |
762 | 651 | |
763 | 652 | ldy #2 |
764 | 653 | |
765 | lda #>wall_1_x_pos | |
766 | sta actor_0_xpos_high, y | |
767 | lda #<wall_1_x_pos | |
768 | sta actor_0_xpos_low, y | |
769 | ||
770 | lda #>wall_1_y_pos | |
771 | sta actor_0_ypos_high, y | |
772 | lda #<wall_1_y_pos | |
773 | sta actor_0_ypos_low, y | |
654 | jsr offset_ul_actor_number_y | |
774 | 655 | |
775 | 656 | lda #8 |
776 | 657 | sta actor_0_xvel, y |
777 | 658 | |
778 | 659 | iny |
779 | 660 | |
780 | lda #>wall_2_x_pos | |
781 | sta actor_0_xpos_high, y | |
782 | lda #<wall_2_x_pos | |
783 | sta actor_0_xpos_low, y | |
784 | ||
785 | lda #>wall_2_y_pos | |
786 | sta actor_0_ypos_high, y | |
787 | lda #<wall_2_y_pos | |
788 | sta actor_0_ypos_low, y | |
661 | jsr offset_lr_actor_number_y | |
789 | 662 | |
790 | 663 | lda #248 ; -8 |
791 | 664 | sta actor_0_xvel, y |
792 | 665 | |
793 | lda vic_sprite_enable | |
794 | ora #%00001100 | |
666 | lda #%00001101 | |
795 | 667 | sta vic_sprite_enable |
796 | 668 | |
797 | 669 | rts |
812 | 684 | lda #>sentry_logic_routine |
813 | 685 | sta actor_0_logic_high, y |
814 | 686 | |
815 | lda #45 | |
687 | lda sentry_initial | |
816 | 688 | sta sentry_timer |
817 | 689 | |
818 | jmp setup_single_beast_tail | |
690 | ldy #2 | |
691 | jsr center_actor_number_y | |
692 | ||
693 | enable_single_beast_tail: | |
694 | lda #%00000101 | |
695 | sta vic_sprite_enable | |
696 | ||
697 | rts | |
819 | 698 | |
820 | 699 | is_it_dragon: |
821 | 700 | cmp #c_dragon |
845 | 724 | |
846 | 725 | jmp enable_single_beast_tail |
847 | 726 | |
848 | setup_single_beast_tail: | |
849 | ldy #2 | |
850 | jsr center_actor_number_y | |
851 | ||
852 | enable_single_beast_tail: | |
853 | lda vic_sprite_enable | |
854 | ora #%00000100 | |
855 | sta vic_sprite_enable | |
856 | ||
857 | rts | |
858 | ||
859 | 727 | is_it_three: |
860 | 728 | cmp #c_three |
861 | 729 | bne its_not_anything |
872 | 740 | |
873 | 741 | ldy #2 |
874 | 742 | |
875 | lda #>fireball_1_x_pos | |
876 | sta actor_0_xpos_high, y | |
877 | lda #<fireball_1_x_pos | |
878 | sta actor_0_xpos_low, y | |
879 | ||
880 | lda #>fireball_1_y_pos | |
881 | sta actor_0_ypos_high, y | |
882 | lda #<fireball_1_y_pos | |
883 | sta actor_0_ypos_low, y | |
884 | ||
743 | jsr offset_ul_actor_number_y | |
885 | 744 | iny |
886 | ||
887 | lda #>fireball_2_x_pos | |
888 | sta actor_0_xpos_high, y | |
889 | lda #<fireball_2_x_pos | |
890 | sta actor_0_xpos_low, y | |
891 | ||
892 | lda #>fireball_2_y_pos | |
893 | sta actor_0_ypos_high, y | |
894 | lda #<fireball_2_y_pos | |
895 | sta actor_0_ypos_low, y | |
896 | ||
745 | jsr center_actor_number_y | |
897 | 746 | iny |
898 | ||
899 | lda #>fireball_3_x_pos | |
900 | sta actor_0_xpos_high, y | |
901 | lda #<fireball_3_x_pos | |
902 | sta actor_0_xpos_low, y | |
903 | ||
904 | lda #>fireball_3_y_pos | |
905 | sta actor_0_ypos_high, y | |
906 | lda #<fireball_3_y_pos | |
907 | sta actor_0_ypos_low, y | |
908 | ||
909 | lda vic_sprite_enable | |
910 | ora #%00011100 | |
747 | jsr offset_lr_actor_number_y | |
748 | ||
749 | lda #%00011101 | |
911 | 750 | sta vic_sprite_enable |
751 | rts | |
912 | 752 | |
913 | 753 | its_not_anything: |
754 | lda #%00000001 | |
755 | sta vic_sprite_enable | |
914 | 756 | rts |
915 | 757 | |
916 | 758 | |
927 | 769 | lda vic_intr ; see if this IRQ was caused by the VIC chip |
928 | 770 | sta vic_intr |
929 | 771 | and #$01 |
930 | cmp #$01 | |
931 | beq we_handle_it | |
932 | jmp (savecinv) | |
772 | beq not_handled_by_us | |
933 | 773 | |
934 | 774 | ; |
935 | 775 | ; Check to see if our IRQ handler is told to run or not. |
936 | 776 | ; |
937 | 777 | we_handle_it: |
938 | 778 | lda irq_active |
939 | bne check_waiting_collision_clear | |
940 | jmp (savecinv) | |
779 | beq not_handled_by_us | |
941 | 780 | |
942 | 781 | ; |
943 | 782 | ; Check to see if the VIC's collision register is clear |
944 | 783 | ; or not, if requested. If not clear, wait until the next |
945 | ; raster interrupt before doing anything. XXX this logic | |
946 | ; seems a little borked, since we don't move any sprites | |
947 | ; between the two interrupts, so how's it going to change? | |
784 | ; raster interrupt before doing anything. | |
948 | 785 | ; |
949 | 786 | check_waiting_collision_clear: |
950 | 787 | lda waiting_collision_clear |
952 | 789 | |
953 | 790 | lda vic_sprite_collision |
954 | 791 | ora vic_bg_collision |
955 | bne not_clear_yet | |
956 | ||
957 | lda #0 | |
792 | bne not_handled_by_us | |
793 | ||
794 | ;lda #0 | |
958 | 795 | sta waiting_collision_clear |
959 | 796 | jmp start_display_critical_region |
960 | 797 | |
961 | not_clear_yet: | |
798 | not_handled_by_us: | |
962 | 799 | jmp (savecinv) |
963 | 800 | |
964 | 801 | ;--------------------------------------------------------------------------; |
968 | 805 | ;--------------------------------------------------------------------------; |
969 | 806 | |
970 | 807 | start_display_critical_region: |
971 | lda #display_critical_border_color | |
972 | sta vic_border_color | |
973 | ||
974 | 808 | jsr update_sprites |
975 | 809 | |
976 | 810 | ;--------------------------------------------------------------------------; |
978 | 812 | ; the raster scan line is drawing the video display. ; |
979 | 813 | ; @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ; |
980 | 814 | ;--------------------------------------------------------------------------; |
981 | ||
982 | lda #irq_progress_border_color | |
983 | sta vic_border_color | |
984 | 815 | |
985 | 816 | ;--------------------------------------------------------; |
986 | 817 | ; Check for collisions that moving the sprites produced. ; |
1067 | 898 | and #wall_mask |
1068 | 899 | sta map, y |
1069 | 900 | |
901 | ldy sentry_initial | |
902 | dey | |
903 | dey | |
904 | dey | |
905 | sty sentry_initial | |
906 | ||
1070 | 907 | make_ding_sound: |
1071 | 908 | lda #100 |
1072 | 909 | sta sid_1_high_freq |
1092 | 929 | cmp #c_telep |
1093 | 930 | bne try_collide_exit |
1094 | 931 | |
932 | ldx #180 | |
933 | ||
1095 | 934 | lda room_num |
1096 | 935 | cmp #180 |
1097 | bne try_ne | |
1098 | ||
1099 | lda #19 | |
936 | bne teleport_out | |
937 | ||
938 | ldx #19 | |
1100 | 939 | |
1101 | 940 | teleport_out: |
1102 | sta room_num | |
941 | stx room_num | |
1103 | 942 | |
1104 | 943 | lda #1 |
1105 | 944 | sta room_changed |
1106 | lda #0 | |
1107 | sta irq_active | |
1108 | 945 | |
1109 | 946 | ldy #0 |
1110 | jsr offset_actor_number_y | |
947 | jsr offset_ur_actor_number_y | |
1111 | 948 | jsr be_still_actor_number_y |
1112 | 949 | |
1113 | jmp clean_exeunt | |
1114 | ||
1115 | try_ne: | |
1116 | lda #180 | |
1117 | jmp teleport_out | |
950 | jmp disable_irq_exeunt | |
1118 | 951 | |
1119 | 952 | try_collide_exit: |
1120 | 953 | cmp #c_exit |
1121 | 954 | bne done_with_collision_checks |
1122 | 955 | |
1123 | lda vic_sprite_enable | |
1124 | ora #%00000010 | |
956 | lda #%00000011 | |
1125 | 957 | sta vic_sprite_enable |
1126 | 958 | |
1127 | 959 | lda num_keys |
1128 | 960 | cmp #5 |
1129 | 961 | bne done_with_collision_checks |
1130 | 962 | |
1131 | lda #0 | |
1132 | sta irq_active | |
1133 | 963 | lda #1 |
1134 | 964 | sta player_won |
1135 | 965 | |
1136 | jmp clean_exeunt | |
966 | jmp disable_irq_exeunt | |
1137 | 967 | |
1138 | 968 | done_with_collision_checks: |
1139 | 969 | |
1154 | 984 | sta indirect_jump_vector |
1155 | 985 | tya |
1156 | 986 | pha |
1157 | jmp (indirect_jump_vector) | |
1158 | ||
1159 | logic_routine_return_address: | |
987 | jsr indirect_jsr_trick | |
1160 | 988 | pla |
1161 | 989 | tay |
1162 | 990 | |
1174 | 1002 | cmp #max_vel |
1175 | 1003 | bcc xvel_within_limit ; branch if accumulator is less |
1176 | 1004 | cmp #min_vel |
1177 | bcs xvel_within_limit ; branch if accumulator is greater or equal | |
1178 | jmp update_xpos | |
1005 | bcc update_xpos ; bcs xvel_within_limit ; branch if accumulator is greater or equal | |
1006 | ;jmp update_xpos | |
1179 | 1007 | |
1180 | 1008 | xvel_within_limit: |
1181 | 1009 | sta actor_0_xvel, y |
1205 | 1033 | cmp #max_vel |
1206 | 1034 | bcc yvel_within_limit ; branch if accumulator is less |
1207 | 1035 | cmp #min_vel |
1208 | bcs yvel_within_limit ; branch if accumulator is greater or equal | |
1209 | jmp update_ypos | |
1036 | bcc update_ypos ; bcs yvel_within_limit ; branch if accumulator is greater or equal | |
1037 | ;jmp update_ypos | |
1210 | 1038 | |
1211 | 1039 | yvel_within_limit: |
1212 | 1040 | sta actor_0_yvel, y |
1247 | 1075 | go_west: |
1248 | 1076 | lda #>east_boundary |
1249 | 1077 | sta actor_0_xpos_high, y |
1250 | lda #<east_boundary | |
1251 | sec | |
1252 | sbc #1 ; to make sure it is not over | |
1078 | lda #<east_boundary-1 | |
1253 | 1079 | sta actor_0_xpos_low, y |
1254 | 1080 | |
1255 | 1081 | lda #$ff ; -1 |
1267 | 1093 | go_east: |
1268 | 1094 | lda #>west_boundary |
1269 | 1095 | sta actor_0_xpos_high, y |
1270 | lda #<west_boundary | |
1271 | clc | |
1272 | adc #1 ; to make sure it is not over | |
1096 | lda #<west_boundary+1 | |
1273 | 1097 | sta actor_0_xpos_low, y |
1274 | 1098 | |
1275 | 1099 | lda #$01 ; +1 |
1287 | 1111 | go_north: |
1288 | 1112 | lda #>south_boundary |
1289 | 1113 | sta actor_0_ypos_high, y |
1290 | lda #<south_boundary | |
1291 | sec | |
1292 | sbc #1 ; to make sure it is not over | |
1114 | lda #<south_boundary-1 | |
1293 | 1115 | sta actor_0_ypos_low, y |
1294 | 1116 | |
1295 | 1117 | lda #0 |
1309 | 1131 | go_south: |
1310 | 1132 | lda #>north_boundary |
1311 | 1133 | sta actor_0_ypos_high, y |
1312 | lda #<north_boundary | |
1313 | clc | |
1314 | adc #1 ; to make sure it is not over | |
1134 | lda #<north_boundary+1 | |
1315 | 1135 | sta actor_0_ypos_low, y |
1316 | 1136 | |
1317 | 1137 | lda #map_width |
1336 | 1156 | |
1337 | 1157 | lda #1 |
1338 | 1158 | sta room_changed |
1339 | lda #0 | |
1340 | sta irq_active | |
1341 | jmp no_more_boundaries | |
1159 | ||
1160 | jmp disable_irq_exeunt | |
1161 | ||
1162 | ;lda #0 | |
1163 | ;sta irq_active | |
1164 | ;jmp no_more_boundaries | |
1342 | 1165 | |
1343 | 1166 | |
1344 | 1167 | exeunt: |
1345 | 1168 | lda player_died |
1346 | 1169 | beq clean_exeunt |
1347 | 1170 | |
1171 | disable_irq_exeunt: | |
1348 | 1172 | lda #0 |
1349 | 1173 | sta irq_active |
1350 | 1174 | |
1351 | 1175 | clean_exeunt: |
1352 | lda #game_border_color | |
1353 | sta vic_border_color | |
1354 | ||
1355 | 1176 | pla |
1356 | 1177 | tay |
1357 | 1178 | pla |
1361 | 1182 | rti |
1362 | 1183 | |
1363 | 1184 | |
1185 | indirect_jsr_trick: | |
1186 | jmp (indirect_jump_vector) | |
1187 | ||
1188 | ||
1364 | 1189 | ;=================================================================== |
1365 | 1190 | ; ... Logic Routines ... |
1366 | 1191 | ;=================================================================== |
1375 | 1200 | ; 1. Must not be placed in zero page, as a high byte of 0 is used to |
1376 | 1201 | ; indicate 'no logic routine'. |
1377 | 1202 | ; |
1378 | ; 2. Must execute jmp logic_routine_return_address at the end. | |
1203 | ; 2. Must execute rts at the end. | |
1379 | 1204 | ; |
1380 | 1205 | |
1381 | 1206 | ; ********** |
1421 | 1246 | lda #$01 |
1422 | 1247 | sta actor_0_xacc, y |
1423 | 1248 | not_right: |
1424 | txa | |
1425 | and #$10 | |
1426 | bne not_fire | |
1427 | ; ... | |
1428 | not_fire: | |
1429 | jmp logic_routine_return_address | |
1249 | rts | |
1430 | 1250 | |
1431 | 1251 | popped_state_handling: |
1432 | lda player_timer | |
1433 | sec | |
1434 | sbc #1 | |
1435 | sta player_timer | |
1436 | cmp #0 | |
1437 | beq we_have_died | |
1438 | ||
1439 | jmp logic_routine_return_address | |
1440 | ||
1441 | we_have_died: | |
1442 | ||
1443 | lda #$01 | |
1444 | sta player_died | |
1445 | ||
1446 | jmp logic_routine_return_address | |
1252 | ldx player_timer | |
1253 | dex | |
1254 | stx player_timer | |
1255 | bne we_have_not_died | |
1256 | ||
1257 | inx | |
1258 | stx player_died | |
1259 | ||
1260 | we_have_not_died: | |
1261 | rts | |
1447 | 1262 | |
1448 | 1263 | |
1449 | 1264 | ; ********** |
1454 | 1269 | ; |
1455 | 1270 | sentry_logic_routine: |
1456 | 1271 | ldx sentry_timer |
1457 | cpx #0 | |
1458 | 1272 | beq sentry_is_active |
1459 | 1273 | dex |
1460 | 1274 | stx sentry_timer |
1461 | jmp logic_routine_return_address | |
1275 | rts | |
1462 | 1276 | |
1463 | 1277 | sentry_is_active: |
1464 | 1278 | lda #$00 |
1510 | 1324 | sentry_done: |
1511 | 1325 | sta actor_0_yacc, y |
1512 | 1326 | |
1513 | jmp logic_routine_return_address | |
1327 | rts | |
1514 | 1328 | |
1515 | 1329 | |
1516 | 1330 | ;=================================================================== |
1517 | 1331 | ; ... General Subroutines ... |
1518 | 1332 | ;=================================================================== |
1519 | 1333 | |
1334 | check_map_for_existing: | |
1335 | lda map, y | |
1336 | and #$0f | |
1337 | cmp #c_start | |
1338 | beq map_has_existing | |
1339 | cmp #c_telep | |
1340 | beq map_has_existing | |
1341 | cmp #c_exit | |
1342 | beq map_has_existing | |
1343 | cmp #c_key | |
1344 | map_has_existing: | |
1345 | rts | |
1346 | ||
1520 | 1347 | clear_screen: |
1521 | 1348 | ldy #0 |
1522 | 1349 | |
1523 | 1350 | clear_screen_loop: |
1524 | lda #0 | |
1351 | lda #north_wall_color | |
1525 | 1352 | sta colormap, y |
1526 | 1353 | sta colormap+250, y |
1527 | 1354 | sta colormap+500, y |
1537 | 1364 | cpy #250 |
1538 | 1365 | bne clear_screen_loop |
1539 | 1366 | |
1540 | rts | |
1541 | ||
1542 | wait_joystick_button: | |
1543 | lda joy2 | |
1544 | and #$10 | |
1545 | bne wait_joystick_button | |
1546 | wait_joystick_release: | |
1547 | lda joy2 | |
1548 | and #$10 | |
1549 | beq wait_joystick_release | |
1550 | 1367 | rts |
1551 | 1368 | |
1552 | 1369 | gen_random_room: |
1600 | 1417 | rts |
1601 | 1418 | |
1602 | 1419 | ; not in the center, but offset a bit so as not to collide immediately with thing in center |
1603 | offset_actor_number_y: | |
1420 | offset_ur_actor_number_y: | |
1604 | 1421 | lda #>initial_x_bubble |
1605 | 1422 | sta actor_0_xpos_high, y |
1606 | 1423 | lda #<initial_x_bubble |
1609 | 1426 | lda #>initial_y_bubble |
1610 | 1427 | sta actor_0_ypos_high, y |
1611 | 1428 | lda #<initial_y_bubble |
1429 | sta actor_0_ypos_low, y | |
1430 | ||
1431 | rts | |
1432 | ||
1433 | offset_ul_actor_number_y: | |
1434 | lda #>fireball_1_x_pos | |
1435 | sta actor_0_xpos_high, y | |
1436 | lda #<fireball_1_x_pos | |
1437 | sta actor_0_xpos_low, y | |
1438 | ||
1439 | lda #>fireball_1_y_pos | |
1440 | sta actor_0_ypos_high, y | |
1441 | lda #<fireball_1_y_pos | |
1442 | sta actor_0_ypos_low, y | |
1443 | ||
1444 | rts | |
1445 | ||
1446 | offset_lr_actor_number_y: | |
1447 | lda #>fireball_3_x_pos | |
1448 | sta actor_0_xpos_high, y | |
1449 | lda #<fireball_3_x_pos | |
1450 | sta actor_0_xpos_low, y | |
1451 | ||
1452 | lda #>fireball_3_y_pos | |
1453 | sta actor_0_ypos_high, y | |
1454 | lda #<fireball_3_y_pos | |
1612 | 1455 | sta actor_0_ypos_low, y |
1613 | 1456 | |
1614 | 1457 | rts |
1638 | 1481 | sta msb_counter |
1639 | 1482 | |
1640 | 1483 | update_sprite_loop: |
1641 | ; XXX check if actor/sprite #y is active. | |
1642 | ; if not, we may skip all this. | |
1643 | ; However, it is not necessary until we start to stuff | |
1644 | ; so much into this IRQ handler that performance is threatened. | |
1645 | 1484 | |
1646 | 1485 | set_sprite_x: |
1647 | 1486 | lda actor_0_xpos_low, y |
1678 | 1517 | inx |
1679 | 1518 | inx |
1680 | 1519 | cpy #8 |
1681 | beq done_moving_sprites | |
1682 | jmp update_sprite_loop | |
1520 | bne update_sprite_loop | |
1683 | 1521 | |
1684 | 1522 | done_moving_sprites: |
1685 | 1523 | rts |
1689 | 1527 | ; ... Game-state Routines ... |
1690 | 1528 | ;=================================================================== |
1691 | 1529 | |
1692 | show_message_screen: | |
1693 | ||
1694 | lda #0 | |
1695 | sta vic_sprite_enable | |
1696 | ||
1697 | jsr clear_screen | |
1698 | ||
1699 | ldy #0 | |
1700 | ||
1701 | print_loop: ; print out message and wait for fire button | |
1702 | lda (srcptr), y | |
1703 | beq end_of_message | |
1704 | sta screen, y | |
1705 | lda #1 | |
1706 | sta colormap, y | |
1707 | iny | |
1708 | jmp print_loop | |
1709 | ||
1710 | end_of_message: | |
1711 | jsr wait_joystick_button | |
1712 | rts | |
1713 | ||
1714 | 1530 | |
1715 | 1531 | ;*****************; |
1716 | 1532 | ; CONSTANT DATA ; |
1717 | 1533 | ;*****************; |
1718 | ||
1719 | title_text: .byte 2, 21, 2, 2, 12, 5, 32, 5, 19, 3, 1, 16, 5, 0 ; "BUBBLE ESCAPE" | |
1720 | game_over_text: .byte 7, 1, 13, 5, 32, 15, 22, 5, 18, 0 ; "GAME OVER" | |
1721 | game_won_text: .byte 25, 15, 21, 32, 5, 19, 3, 1, 16, 5, 4, 0 ; "YOU ESCAPED" | |
1722 | 1534 | |
1723 | 1535 | |
1724 | 1536 | ;==================================================================== |
1767 | 1579 | |
1768 | 1580 | sprite_source: |
1769 | 1581 | |
1770 | .alias sprite_dest $2000 | |
1771 | .alias sprite_0_page $80 ; 192 | |
1582 | .alias sprite_dest $2000 ; 8192 = 128 * 64 | |
1583 | .alias sprite_0_page $80 ; 128 | |
1772 | 1584 | |
1773 | 1585 | ; Bubble |
1774 | 1586 | .alias bubble_page sprite_0_page |
1824 | 1636 | |
1825 | 1637 | .byte 0 |
1826 | 1638 | |
1639 | ; POP | |
1640 | .alias pop_page sprite_0_page+2 | |
1641 | ||
1642 | .byte $00,$08,$00 | |
1643 | .byte $20,$08,$02 | |
1644 | .byte $10,$08,$04 | |
1645 | .byte $08,$08,$08 | |
1646 | .byte $04,$08,$10 | |
1647 | .byte $02,$08,$20 | |
1648 | .byte $00,$00,$00 | |
1649 | .byte $03,$19,$80 | |
1650 | .byte $02,$a5,$40 | |
1651 | .byte $fb,$25,$9f | |
1652 | .byte $02,$25,$00 | |
1653 | .byte $02,$19,$00 | |
1654 | .byte $00,$00,$40 | |
1655 | .byte $02,$10,$20 | |
1656 | .byte $04,$10,$10 | |
1657 | .byte $08,$10,$08 | |
1658 | .byte $10,$10,$04 | |
1659 | .byte $20,$10,$02 | |
1660 | .byte $40,$10,$00 | |
1661 | .byte $00,$10,$00 | |
1662 | .byte $00,$10,$00 | |
1663 | ||
1664 | .byte 0 | |
1665 | ||
1666 | ; Guard | |
1667 | .alias guard_page sprite_0_page+3 | |
1668 | ||
1669 | .byte $00,$00,$00 | |
1670 | .byte $00,$00,$00 | |
1671 | .byte $00,$00,$00 | |
1672 | .byte $00,$3f,$00 | |
1673 | .byte $00,$4c,$80 | |
1674 | .byte $00,$9e,$40 | |
1675 | .byte $01,$3b,$20 | |
1676 | .byte $01,$3b,$20 | |
1677 | .byte $00,$9e,$40 | |
1678 | .byte $00,$4c,$80 | |
1679 | .byte $00,$3f,$00 | |
1680 | .byte $00,$0c,$10 | |
1681 | .byte $00,$1e,$10 | |
1682 | .byte $07,$ff,$f8 | |
1683 | .byte $07,$ff,$f8 | |
1684 | .byte $03,$0c,$30 | |
1685 | .byte $01,$ff,$e0 | |
1686 | .byte $00,$ff,$c0 | |
1687 | .byte $00,$7f,$80 | |
1688 | .byte $00,$00,$00 | |
1689 | .byte $00,$00,$00 | |
1690 | ||
1691 | .byte 0 | |
1692 | ||
1693 | ; Key | |
1694 | .alias key_page sprite_0_page+4 | |
1695 | ||
1696 | .byte $00,$00,$00 | |
1697 | .byte $00,$00,$00 | |
1698 | .byte $00,$00,$00 | |
1699 | .byte $00,$7e,$00 | |
1700 | .byte $00,$e7,$00 | |
1701 | .byte $01,$e7,$80 | |
1702 | .byte $01,$ff,$80 | |
1703 | .byte $01,$ff,$80 | |
1704 | .byte $00,$ff,$00 | |
1705 | .byte $00,$7e,$00 | |
1706 | .byte $00,$18,$00 | |
1707 | .byte $00,$18,$00 | |
1708 | .byte $00,$78,$00 | |
1709 | .byte $00,$78,$00 | |
1710 | .byte $00,$18,$00 | |
1711 | .byte $00,$78,$00 | |
1712 | .byte $00,$78,$00 | |
1713 | .byte $00,$00,$00 | |
1714 | .byte $00,$00,$00 | |
1715 | .byte $00,$00,$00 | |
1716 | .byte $00,$00,$00 | |
1717 | ||
1718 | .byte 0 | |
1719 | ||
1827 | 1720 | ; Fireball |
1828 | .alias fireball_page sprite_0_page+2 | |
1721 | .alias fireball_page sprite_0_page+5 | |
1829 | 1722 | |
1830 | 1723 | .byte $00,$00,$00 |
1831 | 1724 | .byte $00,$00,$00 |
1852 | 1745 | .byte 0 |
1853 | 1746 | |
1854 | 1747 | ; Wall |
1855 | .alias wall_page sprite_0_page+3 | |
1856 | ||
1857 | .byte $ff,$ff,$ff | |
1858 | .byte $ff,$ff,$ff | |
1859 | .byte $ff,$ff,$ff | |
1860 | .byte $ff,$ff,$ff | |
1861 | .byte $ff,$ff,$ff | |
1862 | .byte $ff,$ff,$ff | |
1863 | .byte $ff,$ff,$ff | |
1864 | .byte $ff,$ff,$ff | |
1865 | .byte $ff,$ff,$ff | |
1866 | .byte $ff,$ff,$ff | |
1867 | .byte $ff,$ff,$ff | |
1868 | .byte $ff,$ff,$ff | |
1869 | .byte $ff,$ff,$ff | |
1870 | .byte $ff,$ff,$ff | |
1871 | .byte $ff,$ff,$ff | |
1872 | .byte $ff,$ff,$ff | |
1873 | .byte $ff,$ff,$ff | |
1874 | .byte $ff,$ff,$ff | |
1875 | .byte $ff,$ff,$ff | |
1876 | .byte $ff,$ff,$ff | |
1877 | .byte $ff,$ff,$ff | |
1878 | ||
1879 | .byte 0 | |
1748 | .alias wall_page sprite_0_page+6 | |
1749 | .alias wall_sprite_dest 8576 ; (128 + 6) * 64 | |
1880 | 1750 | |
1881 | 1751 | ; Teleporter |
1882 | .alias teleporter_page sprite_0_page+4 | |
1883 | ||
1884 | .byte $cc,$cc,$cc | |
1885 | .byte $cc,$cc,$cc | |
1886 | .byte $cc,$cc,$cc | |
1887 | .byte $cc,$cc,$cc | |
1888 | .byte $cc,$cc,$cc | |
1889 | .byte $cc,$cc,$cc | |
1890 | .byte $cc,$cc,$cc | |
1891 | .byte $cc,$cc,$cc | |
1892 | .byte $cc,$cc,$cc | |
1893 | .byte $cc,$cc,$cc | |
1894 | .byte $cc,$cc,$cc | |
1895 | .byte $cc,$cc,$cc | |
1896 | .byte $cc,$cc,$cc | |
1897 | .byte $cc,$cc,$cc | |
1898 | .byte $cc,$cc,$cc | |
1899 | .byte $cc,$cc,$cc | |
1900 | .byte $cc,$cc,$cc | |
1901 | .byte $cc,$cc,$cc | |
1902 | .byte $cc,$cc,$cc | |
1903 | .byte $cc,$cc,$cc | |
1904 | .byte $cc,$cc,$cc | |
1905 | ||
1906 | .byte 0 | |
1907 | ||
1908 | ; Key | |
1909 | .alias key_page sprite_0_page+5 | |
1910 | ||
1911 | .byte $00,$00,$00 | |
1912 | .byte $00,$00,$00 | |
1913 | .byte $00,$00,$00 | |
1914 | .byte $00,$7e,$00 | |
1915 | .byte $00,$e7,$00 | |
1916 | .byte $01,$e7,$80 | |
1917 | .byte $01,$ff,$80 | |
1918 | .byte $01,$ff,$80 | |
1919 | .byte $00,$ff,$00 | |
1920 | .byte $00,$7e,$00 | |
1921 | .byte $00,$18,$00 | |
1922 | .byte $00,$18,$00 | |
1923 | .byte $00,$78,$00 | |
1924 | .byte $00,$78,$00 | |
1925 | .byte $00,$18,$00 | |
1926 | .byte $00,$78,$00 | |
1927 | .byte $00,$78,$00 | |
1928 | .byte $00,$00,$00 | |
1929 | .byte $00,$00,$00 | |
1930 | .byte $00,$00,$00 | |
1931 | .byte $00,$00,$00 | |
1932 | ||
1933 | .byte 0 | |
1934 | ||
1935 | ; POP | |
1936 | .alias pop_page sprite_0_page+6 | |
1937 | ||
1938 | .byte $00,$08,$00 | |
1939 | .byte $20,$08,$02 | |
1940 | .byte $10,$08,$04 | |
1941 | .byte $08,$08,$08 | |
1942 | .byte $04,$08,$10 | |
1943 | .byte $02,$08,$20 | |
1944 | .byte $00,$00,$00 | |
1945 | .byte $03,$19,$80 | |
1946 | .byte $02,$a5,$40 | |
1947 | .byte $fb,$25,$9f | |
1948 | .byte $02,$25,$00 | |
1949 | .byte $02,$19,$00 | |
1950 | .byte $00,$00,$40 | |
1951 | .byte $02,$10,$20 | |
1952 | .byte $04,$10,$10 | |
1953 | .byte $08,$10,$08 | |
1954 | .byte $10,$10,$04 | |
1955 | .byte $20,$10,$02 | |
1956 | .byte $40,$10,$00 | |
1957 | .byte $00,$10,$00 | |
1958 | .byte $00,$10,$00 | |
1959 | ||
1960 | .byte 0 | |
1961 | ||
1962 | ; Guard | |
1963 | .alias guard_page sprite_0_page+7 | |
1964 | ||
1965 | .byte $00,$00,$00 | |
1966 | .byte $00,$00,$00 | |
1967 | .byte $00,$00,$00 | |
1968 | .byte $00,$3f,$00 | |
1969 | .byte $00,$4c,$80 | |
1970 | .byte $00,$9e,$40 | |
1971 | .byte $01,$3b,$20 | |
1972 | .byte $01,$3b,$20 | |
1973 | .byte $00,$9e,$40 | |
1974 | .byte $00,$4c,$80 | |
1975 | .byte $00,$3f,$00 | |
1976 | .byte $00,$0c,$10 | |
1977 | .byte $00,$1e,$10 | |
1978 | .byte $07,$ff,$f8 | |
1979 | .byte $07,$ff,$f8 | |
1980 | .byte $03,$0c,$30 | |
1981 | .byte $01,$ff,$e0 | |
1982 | .byte $00,$ff,$c0 | |
1983 | .byte $00,$7f,$80 | |
1984 | .byte $00,$00,$00 | |
1985 | .byte $00,$00,$00 | |
1986 | ||
1987 | .byte 0 | |
1988 | ||
1989 | ||
1990 | ;==================================================================== | |
1991 | ;**** ***** ***** ***** ***** VARIABLES ***** ***** ***** ***** ***** | |
1992 | ;==================================================================== | |
1993 | ||
1994 | ; | |
1995 | ; Game State | |
1996 | ; | |
1997 | ||
1998 | .space room_num 1 ; index into map array of room currently occupied by the bubble | |
1999 | .space current_room 1 ; cache of map cell representing current room (i.e. "lda map, y" where y = room_num) | |
2000 | .space num_lives 1 | |
2001 | .space num_keys 1 | |
2002 | ||
2003 | .space player_state 1 | |
2004 | ||
2005 | .alias state_alive 0 | |
2006 | .alias state_popped 1 | |
2007 | ||
2008 | .space player_timer 1 | |
2009 | .space sentry_timer 1 | |
2010 | ||
2011 | ; | |
2012 | ; Arithmetic | |
2013 | ; | |
2014 | ||
2015 | .space temp_low 1 | |
2016 | .space temp_high 1 | |
2017 | .space sign_extend 1 | |
2018 | ||
2019 | ; | |
2020 | ; Interrupt Handling | |
2021 | ; | |
2022 | ||
2023 | .space savecinv 2 | |
2024 | .space irq_active 1 | |
2025 | .space waiting_collision_clear 1 | |
2026 | ||
2027 | ; | |
2028 | ; Flags | |
2029 | ; | |
2030 | ||
2031 | .space room_changed 1 | |
2032 | .space player_died 1 | |
2033 | .space player_won 1 | |
2034 | ||
2035 | ; | |
2036 | ; Temporary Storage in IRQ handler | |
2037 | ; | |
2038 | ||
2039 | .space msb_counter 1 ; for calculating sprite's x msb | |
2040 | .space indirect_jump_vector 2 | |
2041 | ||
2042 | ; | |
2043 | ; Temporary Storage for Setting up Room etc. | |
2044 | ; | |
2045 | ||
2046 | .space baddie 1 | |
2047 | .space room_delta 1 | |
1752 | .alias teleporter_page sprite_0_page+7 | |
1753 | .alias teleporter_sprite_dest 8640 ; (128 + 7) * 64 | |
2048 | 1754 | |
2049 | 1755 | |
2050 | 1756 | ;===================================================================== |
2161 | 1867 | |
2162 | 1868 | .space actor_0_logic_low 8 |
2163 | 1869 | .space actor_0_logic_high 8 |
1870 | ||
1871 | ;==================================================================== | |
1872 | ;**** ***** ***** ***** ***** VARIABLES ***** ***** ***** ***** ***** | |
1873 | ;==================================================================== | |
1874 | ||
1875 | ; | |
1876 | ; Game State | |
1877 | ; | |
1878 | ||
1879 | .space room_num 1 ; index into map array of room currently occupied by the bubble | |
1880 | .space current_room 1 ; cache of map cell representing current room (i.e. "lda map, y" where y = room_num) | |
1881 | .space num_lives 1 | |
1882 | .space num_keys 1 | |
1883 | ||
1884 | .space player_state 1 | |
1885 | ||
1886 | .alias state_alive 0 | |
1887 | .alias state_popped 1 | |
1888 | ||
1889 | .space player_timer 1 | |
1890 | .space sentry_timer 1 | |
1891 | .space sentry_initial 1 | |
1892 | ||
1893 | ; | |
1894 | ; Arithmetic | |
1895 | ; | |
1896 | ||
1897 | .space temp_low 1 | |
1898 | .space temp_high 1 | |
1899 | .space sign_extend 1 | |
1900 | ||
1901 | ; | |
1902 | ; Interrupt Handling | |
1903 | ; | |
1904 | ||
1905 | .space savecinv 2 | |
1906 | .space irq_active 1 | |
1907 | .space waiting_collision_clear 1 | |
1908 | ||
1909 | ; | |
1910 | ; Flags | |
1911 | ; | |
1912 | ||
1913 | .space room_changed 1 | |
1914 | .space player_died 1 | |
1915 | .space player_won 1 | |
1916 | ||
1917 | ; | |
1918 | ; Temporary Storage in IRQ handler | |
1919 | ; | |
1920 | ||
1921 | .space msb_counter 1 ; for calculating sprite's x msb | |
1922 | .space indirect_jump_vector 2 | |
1923 | ||
1924 | ; | |
1925 | ; Temporary Storage for Setting up Room etc. | |
1926 | ; | |
1927 | ||
1928 | .space baddie 1 | |
1929 | .space room_delta 1 |