Shark disassembly ================= Shark was written by Sam Inglis, and was published by Audiogenic Software for the BBC Micro in 1988. It is a sideways scrolling platform shooter. The following disassembly was created by reverse engineering binary images, without access to any source code. It is nevertheless reasonably complete, allowing the technical approaches used to be understood. The author of this disassembly imposes no additional copyright restrictions beyond those already present on the game itself. It is provided for educational purposes only, and it is hoped that the original authors will accept it in the good faith it was intended - as a tribute to their skills. Technical notes =============== The BASIC loader stores the keys and colour choice as follows: ?&80 = 0 if colour or 1 if black and white ?&81 = &9E (Z) or keycode for left ?&82 = &BD (X) or keycode for right ?&83 = &FF (SHIFT) or keycode for jump ?&84 = &9D (SPACE) or keycode for duck ?&85 = &B6 (RETURN) or keycode for fire The sixteen colours of a custom-sized MODE 2 screen are configured to split the four bits per pixel into two pairs. This permits bitwise operations to change background or foreground separately. One bit of each pixel is used to indicate whether part of a sprite provides support for the player and enemies. A side effect of this is that enemies provide support for other enemies, e.g. soldiers can walk on bombs, and that an invulnerable player can fall through a surface if the surface is overplotted by an enemy. A cheat mode can be activated by holding down SHIFT-LOCK and typing FUGAZI on the title screen. This starts the game with twenty lives, and doubles the probability of destroyed soldiers dropping powerups. Interesting pokes ================= &0f75 = &ad infinite lives &165d = &f00 soldiers always drop powerups &1f49 = &8c, &1f5d = &10 keep system palette Game disassembly ================ ; SHARKMC ; 00000400 00004000 3E00 ; player_bullets_x &0400 00 00 00 00 00 00 00 00 ; player_bullets_y &0408 00 00 00 00 00 00 00 00 ; player_bullets_x_velocity &0410 00 00 00 00 00 00 00 00 ; player_next_free_bullet_slot &0418 00 ; unused &0419 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &0429 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &0439 00 00 00 00 00 00 00 ; sprite_21_data (SPRITE_STREET_BRICK_TOP) &0440 30 0f 03 03 00 02 02 02 00 03 03 03 00 02 02 02 &0450 30 0f 02 02 00 03 03 03 00 02 02 02 00 03 03 03 &0460 30 0f 03 03 00 02 02 02 00 03 03 03 00 02 02 02 &0470 30 0f 02 02 00 03 03 03 00 02 02 02 00 03 03 03 ; sprite_22_data (SPRITE_STREET_BRICK) &0480 00 03 03 03 00 02 02 02 00 03 03 03 00 02 02 02 &0490 00 02 02 02 00 03 03 03 00 02 02 02 00 03 03 03 &04a0 00 03 03 03 00 02 02 02 00 03 03 03 00 02 02 02 &04b0 00 02 02 02 00 03 03 03 00 02 02 02 00 03 03 03 ; sprite_23_data (SPRITE_STREET_GROUND) &04c0 30 1a 0f 0a 05 0f 05 0a 00 00 0a 00 00 00 00 00 &04d0 30 1a 0f 0f 05 0a 05 00 0a 00 00 00 00 0a 00 00 &04e0 30 1a 0f 0a 05 0f 05 0a 00 00 0a 00 00 00 00 00 &04f0 30 1a 0f 0f 05 0a 05 00 0a 00 00 00 00 0a 00 00 ; sprite_24_data (SPRITE_STREET_STONE) &0500 0c 08 00 05 04 04 00 05 0e 0c 0c 00 00 05 0e 0c &0510 08 00 0a 0c 0c 0c 08 05 08 08 05 0e 0c 00 08 08 &0520 0c 0c 00 05 04 00 0f 0c 0c 04 08 08 05 04 00 0e &0530 08 00 0f 0c 0c 0c 00 08 08 08 00 0e 0c 0c 08 00 ; sprite_25_data (SPRITE_STREET_STONE_TOP) &0540 30 0f 05 0e 0c 0c 00 05 0e 0c 0c 00 00 05 0e 0c &0550 30 0f 0a 0c 0c 08 00 05 08 08 05 0e 0c 00 08 08 &0560 30 0f 00 05 04 00 0f 0c 0c 04 08 08 05 04 00 0e &0570 30 0f 0f 0c 0c 0c 00 08 08 08 00 0e 0c 0c 08 00 ; sprite_26_data (SPRITE_STREET_TILES_TOP) &0580 30 02 02 01 02 02 00 03 03 01 02 02 00 03 03 01 &0590 30 02 02 01 03 03 01 02 02 00 03 03 01 02 02 00 &05a0 30 02 02 01 02 02 00 03 03 01 02 02 00 03 03 01 &05b0 30 02 02 01 03 03 01 02 02 00 03 03 01 02 02 00 ; sprite_27_data (SPRITE_STREET_TILES) &05c0 00 03 03 01 02 02 00 03 03 01 02 02 00 03 03 01 &05d0 00 02 02 00 03 03 01 02 02 00 03 03 01 02 02 00 &05e0 00 03 03 01 02 02 00 03 03 01 02 02 00 03 03 01 &05f0 00 02 02 00 03 03 01 02 02 00 03 03 01 02 02 00 ; sprite_28_data (SPRITE_STREET_WINDOWS_LEFT) &0600 0f 0b 0b 0b 0b 0b 0f 0b 0b 0b 0b 0b 0b 0b 0f 00 &0610 0f 03 00 00 00 00 0f 03 00 00 00 00 00 00 0f 00 &0620 0f 0b 0b 0b 0b 0b 0f 03 00 00 00 00 00 00 0f 00 &0630 0f 03 00 00 00 00 0f 03 00 00 00 00 00 00 0f 00 ; sprite_29_data (SPRITE_STREET_WINDOWS_RIGHT_BRICK) &0640 0a 0b 0b 0b 0a 0a 0a 0a 0a 0b 0b 0b 0a 0a 0a 00 &0650 00 02 02 02 00 03 03 03 00 02 02 02 00 03 03 03 &0660 00 03 03 03 00 02 02 02 00 03 03 03 00 02 02 02 &0670 00 02 02 02 00 03 03 03 00 02 02 02 00 03 03 03 ; sprite_2a_data (SPRITE_STREET_WINDOWS_RIGHT_STONE) &0680 0e 0a 0f 0e 0e 0e 0a 0f 0e 0e 0e 0a 0a 0f 0e 04 &0690 08 00 0a 0c 0c 08 00 05 08 08 05 0e 0c 00 08 08 &06a0 0c 0c 00 05 04 00 0f 0c 0c 04 08 08 05 04 00 0e &06b0 08 00 0f 0c 0c 0c 00 08 08 08 00 0e 0c 0c 08 00 ; sprite_2b_data (SPRITE_STREET_DOOR_TOP) &06c0 0c 0c 08 08 08 08 08 08 08 0d 0c 0c 0c 0c 0c 0c &06d0 0c 0c 00 00 00 00 00 00 00 0f 03 0c 0c 0c 0c 0c &06e0 0c 0c 00 00 00 00 00 00 00 0f 03 0c 0c 0c 0c 0c &06f0 0c 0c 04 04 04 04 04 04 04 0b 03 0c 0c 0e 0e 0c ; sprite_2c_data (SPRITE_STREET_DOOR_BOTTOM) &0700 0c 0c 0c 0c 0c 0c 0c 0c 0c 0c 0c 0c 0c 00 0f 0f &0710 0c 0f 0a 0c 0c 0c 0c 0c 0c 0c 0c 0c 0c 00 0f 0f &0720 0c 0f 05 0c 0c 0c 0c 0c 0c 0c 0c 0c 0c 00 0f 0f &0730 0c 0c 0c 0c 0c 0c 0c 0c 0c 0c 0c 0c 0c 00 0f 0f ; sprite_2d_data (SPRITE_STREET_CHIMNEY) &0740 00 00 01 00 00 00 00 00 00 00 01 01 01 01 01 01 &0750 00 03 00 03 03 03 03 03 03 03 03 03 03 03 03 03 &0760 00 03 00 03 03 02 01 02 03 02 01 02 03 02 01 02 &0770 00 00 02 00 00 00 00 00 00 00 00 02 00 02 00 02 ; sprite_2e_data (SPRITE_STREET_TILES_TOP_RIGHT) &0780 00 02 03 03 00 02 02 02 00 03 03 03 00 02 02 02 &0790 00 00 02 02 00 02 03 03 00 02 02 02 00 03 03 03 &07a0 00 00 00 00 00 00 00 00 00 03 03 03 00 02 02 02 &07b0 00 00 00 00 00 00 00 00 00 00 02 02 00 02 03 03 ; sprite_2f_data (SPRITE_STREET_TILES_TOP_LEFT) &07c0 00 00 00 00 00 00 00 00 00 00 01 01 00 00 02 02 &07d0 00 00 00 00 00 00 00 01 00 02 02 02 00 03 03 03 &07e0 00 00 01 03 00 02 02 02 00 03 03 03 00 02 02 02 &07f0 00 00 02 02 00 03 03 03 00 02 02 02 00 03 03 03 ; os_sound_workspace &0800 ff 00 00 00 00 00 00 80 c0 c0 c0 2f 04 04 04 00 &0810 00 00 00 64 00 00 00 ff 00 00 00 00 00 00 00 06 &0820 00 00 00 04 00 00 00 ff 00 00 00 00 00 00 00 00 &0830 00 00 00 64 00 00 00 00 ff 00 00 00 00 ef 00 0d &0840 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &0850 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &0860 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &0870 64 06 00 00 00 00 00 00 90 64 06 00 00 00 00 90 ; play_sound &0880 0a ASL A &0881 0a ASL A &0882 0a ASL A &0883 69 d0 ADC #&d0 ; &0ed0 = sound_data &0885 aa TAX &0886 a0 0e LDY #&0e &0888 90 01 BCC &088b ; skip_page &088a c8 INY ; skip_page &088b a9 07 LDA #&07 ; Generate a sound &088d 4c f1 ff JMP &fff1 ; OSWORD ; unused &0890 00 00 00 00 ; jump_table ; 0 1 2 3 4 5 6 7 8 9 a b c d e f &0894 00 f6 f6 f7 f8 fa fc fd fe ff 01 02 03 04 06 08 ; &00 &08a4 0c 0a 09 08 0c 0c 0c 0c 0c 0c 0c 0c 0c 0c 0c 0c ; &10 &08b4 0c 0c 0c 0c ; &20 ; unused &08b8 00 ; background_data_offset_low &08b9 00 ; background_data_offset_high &08ba 00 ; unused &08bb 00 00 00 00 00 ; os_envelope_storage &08c0 84 ff ff fe 0e 16 30 50 ff fe fc 7e 50 00 00 00 ; 1 # Helicopter dropping bomb, boss firing grenade &08d0 08 04 04 f4 01 01 01 7e fc 00 f8 7e 6e 00 00 00 ; 2 # Boss appearing &08e0 81 00 00 00 03 05 04 7f f1 fe f8 7e 50 00 00 00 ; 3 # Extra life, collecting parachute, music &08f0 82 ff 01 03 02 05 0a 6e f8 fc fa 7e 50 00 00 00 ; 4 # Player jumping ; sprite_addresses_low_table # Sprites &30 - &3f and &64 - &77 are unused ; 0 1 2 3 4 5 6 7 8 9 a b c d e f &0900 00 40 80 c0 00 40 80 c0 00 40 00 c0 00 40 80 c0 ; &00 &0910 00 40 80 c0 00 40 80 c0 00 40 80 c0 00 40 80 c0 ; &10 &0920 00 40 80 c0 00 40 80 c0 00 40 80 c0 00 40 80 c0 ; &20 &0930 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; &30 &0940 20 30 c0 50 e0 70 f0 00 78 f0 68 80 00 80 a0 50 ; &40 &0950 30 10 50 10 00 00 10 20 30 40 50 60 70 80 90 60 ; &50 &0960 c0 a0 f0 80 00 00 00 00 00 00 00 00 00 00 00 00 ; &60 &0970 00 00 00 00 00 00 00 00 ; &70 ; sprite_addresses_high_table ; 0 1 2 3 4 5 6 7 8 9 a b c d e f &0978 21 21 21 21 22 22 22 22 23 23 21 23 24 24 24 24 ; &00 &0988 21 25 25 25 26 26 26 26 27 27 27 27 28 28 28 28 ; &10 &0998 21 04 04 04 05 05 05 05 06 06 06 06 07 07 07 07 ; &20 &09a8 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; &30 &09b8 3d 3d 3d 3e 3e 3f 3c 2e 2e 2e 2f 2c 2d 2d 2b 2a ; &40 &09c8 2a 2a 29 29 3d 3c 3c 3c 3c 3c 3c 3c 3c 3c 3c 0b ; &50 &09d8 3c 3c 0c 23 00 00 00 00 00 00 00 00 00 00 00 00 ; &60 &09e8 00 00 00 00 00 00 00 00 ; &70 ; sprite_widths_table ; 0 1 2 3 4 5 6 7 8 9 a b c d e f &09f0 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 ; &00 &0a00 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 ; &10 &0a10 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 ; &20 &0a20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; &30 &0a30 03 06 06 06 06 06 03 05 05 05 05 06 06 06 0c 0c ; &40 &0a40 03 04 08 08 03 02 02 02 02 02 02 02 02 02 02 0c ; &50 &0a50 09 09 04 02 00 00 00 00 00 00 00 00 00 00 00 00 ; &60 &0a60 00 00 00 00 00 00 00 00 ; &70 ; sprite_heights_table ; 0 1 2 3 4 5 6 7 8 9 a b c d e f &0a68 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 ; &00 &0a78 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 ; &10 &0a88 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 ; &20 &0a98 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; &30 &0aa8 03 18 18 18 18 18 03 18 18 18 18 15 15 15 12 1c ; &40 &0ab8 08 06 18 08 0a 08 08 08 08 08 08 08 08 08 08 14 ; &50 &0ac8 03 03 04 08 00 00 00 00 00 00 00 00 00 00 00 00 ; &60 &0ad8 00 00 00 00 00 00 00 00 ; &70 ; music_data ; p d &0ae0 00 00 &0ae2 0d 07 &0ae4 0d 02 &0ae6 0d 05 &0ae8 0d 05 &0aea 19 05 &0aec 0d 05 &0aee 05 05 &0af0 0d 05 &0af2 0d 07 &0af4 0d 02 &0af6 0d 05 &0af8 0d 05 &0afa 19 05 &0afc 0d 05 &0afe 05 0a &0b00 0d 07 &0b02 0d 02 &0b04 0d 05 &0b06 0d 05 &0b08 19 05 &0b0a 0d 05 &0b0c 05 05 &0b0e 0d 05 &0b10 0d 07 &0b12 0d 02 &0b14 0d 05 &0b16 0d 05 &0b18 05 05 &0b1a 0d 05 &0b1c 0d 0a &0b1e 19 07 &0b20 19 02 &0b22 19 05 &0b24 19 05 &0b26 21 05 &0b28 19 05 &0b2a 19 05 &0b2c 0d 05 &0b2e 19 07 &0b30 19 02 &0b32 19 05 &0b34 19 05 &0b36 21 05 &0b38 19 05 &0b3a 0d 0a &0b3c 0d 07 &0b3e 0d 02 &0b40 19 05 &0b42 29 05 &0b44 29 05 &0b46 21 05 &0b48 21 05 &0b4a 19 05 &0b4c 15 07 &0b4e 0d 02 &0b50 0d 05 &0b52 0d 05 &0b54 0d 05 &0b56 05 05 &0b58 0d 0a ; unused &0b5a 00 00 00 00 00 ; music_offset &0b5f 00 ; sprite_5f_data (SPRITE_JEEP) &0b60 00 00 00 00 00 00 00 00 00 40 90 90 90 90 90 90 &0b70 c0 40 00 00 00 00 00 00 00 00 00 00 c0 30 30 30 &0b80 30 60 70 70 70 d0 d0 40 00 00 00 00 00 00 00 40 &0b90 90 30 30 30 c0 f0 e0 90 90 90 e0 f0 00 00 00 40 &0ba0 40 90 90 90 60 60 60 60 c0 e0 f0 d0 d0 d0 f0 e0 &0bb0 40 90 90 30 60 60 c0 c0 60 30 30 30 30 30 90 90 &0bc0 90 c0 80 00 30 30 c0 c0 c0 90 d0 d0 d0 30 60 30 &0bd0 30 30 30 30 30 c0 00 00 30 30 90 90 60 30 b0 b0 &0be0 60 60 c0 60 60 60 60 60 90 c0 00 00 80 60 90 90 &0bf0 30 90 90 30 60 30 30 30 30 30 60 60 60 c0 40 00 &0c00 c0 30 90 30 90 90 30 90 90 30 30 30 60 d0 f0 e0 &0c10 e0 e0 f0 d0 80 60 90 30 90 30 90 30 c0 30 30 30 &0c20 c0 f0 d0 60 60 60 d0 f0 c0 30 60 90 90 60 90 90 &0c30 60 30 30 30 30 90 e0 e0 e0 e0 e0 80 00 80 60 60 &0c40 60 60 60 60 60 c0 60 60 60 60 60 60 60 80 00 00 ; high_score &0c50 00 00 00 00 00 00 ; unused &0c56 00 00 00 00 00 00 00 00 00 00 ; tab_to_X_Y &0c60 a9 1f LDA #&1f ; TAB &0c62 20 ee ff JSR &ffee ; OSWRCH &0c65 8a TXA &0c66 20 ee ff JSR &ffee ; OSWRCH &0c69 98 TYA &0c6a 4c ee ff JMP &ffee ; OSWRCH ; write_string &0c6d 86 80 STX &80 ; text_address_low &0c6f 84 81 STY &81 ; text_address_high &0c71 a0 00 LDY #&00 ; write_string_loop &0c73 b1 80 LDA (&80),Y ; text_address &0c75 20 ee ff JSR &ffee ; OSWRCH &0c78 c8 INY &0c79 c9 0d CMP #&0d ; CR &0c7b d0 f6 BNE &0c73 ; write_string_loop &0c7d 60 RTS ; wait_for_A_vsyncs &0c7e 48 PHA ; count &0c7f a9 13 LDA #&13 ; Wait for vertical retrace &0c81 20 f4 ff JSR &fff4 ; OSBYTE &0c84 68 PLA ; count &0c85 38 SEC &0c86 e9 01 SBC #&01 &0c88 d0 f4 BNE &0c7e ; wait_for_A_vsyncs &0c8a 60 RTS ; plot_title_screen &0c8b a2 00 LDX #&00 ; plot_shark_logo_character_loop &0c8d bd e0 0c LDA &0ce0,X ; shark_string &0c90 8d 80 03 STA &0380 ; character_data &0c93 86 80 STX &80 ; character_offset &0c95 a2 80 LDX #&80 ; &0380 = character_data &0c97 a0 03 LDY #&03 &0c99 a9 0a LDA #&0a ; Read character definition &0c9b 20 f1 ff JSR &fff1 ; OSWORD &0c9e a5 80 LDA &80 ; character_offset &0ca0 0a ASL A &0ca1 0a ASL A &0ca2 0a ASL A &0ca3 0a ASL A &0ca4 85 f8 STA &f8 ; x &0ca6 a0 10 LDY #&10 &0ca8 84 81 STY &81 ; y &0caa a0 00 LDY #&00 ; plot_shark_logo_row_loop &0cac a6 f8 LDX &f8 ; x &0cae a9 80 LDA #&80 &0cb0 85 82 STA &82 ; mask ; plot_shark_logo_column_loop &0cb2 b9 81 03 LDA &0381,Y ; character_data + 1 &0cb5 25 82 AND &82 ; mask &0cb7 f0 0b BEQ &0cc4 ; skip_plotting_sprite &0cb9 98 TYA &0cba 48 PHA ; row &0cbb a9 63 LDA #&63 ; SPRITE_LOGO_SECTION &0cbd a4 81 LDY &81 ; y &0cbf 20 20 0d JSR &0d20 ; plot_sprite &0cc2 68 PLA ; row &0cc3 a8 TAY ; skip_plotting_sprite &0cc4 e8 INX &0cc5 e8 INX &0cc6 46 82 LSR &82 ; mask &0cc8 90 e8 BCC &0cb2 ; plot_shark_logo_column_loop &0cca a5 81 LDA &81 ; y &0ccc 18 CLC &0ccd 69 08 ADC #&08 &0ccf 85 81 STA &81 ; y &0cd1 c8 INY &0cd2 c0 08 CPY #&08 &0cd4 90 d6 BCC &0cac ; plot_shark_logo_row_loop &0cd6 a6 80 LDX &80 ; character_offset &0cd8 e8 INX &0cd9 e0 05 CPX #&05 &0cdb 90 b0 BCC &0c8d ; plot_shark_logo_character_loop &0cdd 4c 90 23 JMP &2390 ; plot_title_screen_sprites ; shark_string &0ce0 53 48 41 52 4b ; "SHARK" ; unused &0ce5 00 00 00 00 00 00 00 00 00 00 00 ; sprite_62_data (SPRITE_HALO) &0cf0 40 d0 40 00 f0 c0 f0 c0 f0 c0 f0 c0 80 e0 80 00 ; nmi_handler # Unused code on tape system &0d00 85 cc STA &cc # &0d00 - &0d1f matches NMI handler from Watford Electronics DDFS &0d02 84 cd STY &cd &0d04 ad 84 fe LDA &fe84 &0d07 8d 36 10 STA &1036 &0d0a ad 87 fe LDA &fe87 &0d0d a4 a3 LDY &a3 &0d0f c4 a2 CPY &a2 &0d11 90 04 BCC &0d17 &0d13 a4 a2 LDY &a2 &0d15 91 a0 STA (&a0),Y &0d17 e6 a2 INC &a2 &0d19 f0 05 BEQ &0d20 # Not plot_sprite! &0d1b a5 cc LDA &cc &0d1d a4 cd LDY &cd &0d1f 40 RTI ; plot_sprite # Called with A = sprite, X = x, Y = y &0d20 48 PHA ; sprite &0d21 20 b3 0d JSR &0db3 ; calculate_screen_address &0d24 68 PLA ; sprite &0d25 a8 TAY &0d26 b9 00 09 LDA &0900,Y ; sprite_addresses_low_table &0d29 85 78 STA &78 ; sprite_address_low &0d2b b9 78 09 LDA &0978,Y ; sprite_addresses_high_table &0d2e 85 79 STA &79 ; sprite_address_high &0d30 b9 f0 09 LDA &09f0,Y ; sprite_widths_table &0d33 85 7a STA &7a ; width &0d35 b9 68 0a LDA &0a68,Y ; sprite_heights_table &0d38 85 7b STA &7b ; height ; plot_sprite_column_loop &0d3a a0 00 LDY #&00 &0d3c a5 91 LDA &91 ; screen_address_high &0d3e 48 PHA ; screen_address_high &0d3f a5 90 LDA &90 ; screen_address_low &0d41 48 PHA ; screen_address_low &0d42 a5 7b LDA &7b ; height &0d44 85 7c STA &7c ; rows_remaining &0d46 a5 90 LDA &90 ; screen_address_low &0d48 29 07 AND #&07 &0d4a 85 7d STA &7d ; row_in_group &0d4c a5 90 LDA &90 ; screen_address_low &0d4e 29 f8 AND #&f8 &0d50 85 90 STA &90 ; screen_address_low &0d52 84 70 STY &70 ; sprite_offset ; plot_sprite_row_loop &0d54 a4 70 LDY &70 ; sprite_offset &0d56 b1 78 LDA (&78),Y ; sprite_address &0d58 c8 INY &0d59 84 70 STY &70 ; sprite_offset &0d5b a4 7d LDY &7d ; row_in_group &0d5d 51 90 EOR (&90),Y ; screen_address &0d5f 91 90 STA (&90),Y ; screen_address &0d61 c8 INY # Move down a row &0d62 c0 08 CPY #&08 &0d64 f0 26 BEQ &0d8c ; next_group ; next_row &0d66 84 7d STY &7d ; row_in_group &0d68 c6 7c DEC &7c ; rows_remaining &0d6a d0 e8 BNE &0d54 ; plot_sprite_row_loop &0d6c a5 78 LDA &78 ; sprite_address_low &0d6e 18 CLC &0d6f 65 7b ADC &7b ; height &0d71 85 78 STA &78 ; sprite_address_low &0d73 90 02 BCC &0d77 ; skip_page &0d75 e6 79 INC &79 ; sprite_address_high ; skip_page &0d77 18 CLC &0d78 68 PLA ; screen_address_low &0d79 69 08 ADC #&08 # Move right a column &0d7b 85 90 STA &90 ; screen_address_low &0d7d 68 PLA ; screen_address_high &0d7e 69 00 ADC #&00 &0d80 10 03 BPL &0d85 ; skip_wraparound &0d82 38 SEC &0d83 e9 40 SBC #&40 ; skip_wraparound &0d85 85 91 STA &91 ; screen_address_high &0d87 c6 7a DEC &7a ; width &0d89 d0 af BNE &0d3a ; plot_sprite_column_loop &0d8b 60 RTS ; next_group &0d8c a0 00 LDY #&00 &0d8e a5 90 LDA &90 ; screen_address_low &0d90 18 CLC &0d91 69 80 ADC #&80 # Move down a group &0d93 85 90 STA &90 ; screen_address_low &0d95 a5 91 LDA &91 ; screen_address_high &0d97 69 02 ADC #&02 &0d99 10 03 BPL &0d9e ; skip_wraparound &0d9b 38 SEC &0d9c e9 40 SBC #&40 ; skip_wraparound &0d9e 85 91 STA &91 ; screen_address_high &0da0 d0 c4 BNE &0d66 ; next_row # Always branches ; unused &0da2 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &0db2 00 ; calculate_screen_address # Called with X = x, Y = y &0db3 a9 00 LDA #&00 &0db5 85 91 STA &91 ; screen_address_high &0db7 98 TYA &0db8 48 PHA ; y &0db9 4a LSR A &0dba 4a LSR A &0dbb 4a LSR A &0dbc a8 TAY &0dbd 4a LSR A &0dbe 85 70 STA &70 ; tmp &0dc0 a9 00 LDA #&00 &0dc2 6a ROR A &0dc3 65 72 ADC &72 ; screen_start_address_low &0dc5 08 PHP ; page overflow &0dc6 85 90 STA &90 ; screen_address_low &0dc8 98 TYA &0dc9 0a ASL A &0dca 65 70 ADC &70 ; tmp &0dcc 28 PLP ; page overflow &0dcd 65 73 ADC &73 ; screen_start_address_high &0dcf 85 91 STA &91 ; screen_address_high &0dd1 a9 00 LDA #&00 &0dd3 85 70 STA &70 ; tmp &0dd5 8a TXA &0dd6 0a ASL A &0dd7 26 70 ROL &70 ; tmp &0dd9 0a ASL A &0dda 26 70 ROL &70 ; tmp &0ddc 0a ASL A &0ddd 26 70 ROL &70 ; tmp &0ddf 65 90 ADC &90 ; screen_address_low &0de1 85 90 STA &90 ; screen_address_low &0de3 a5 70 LDA &70 ; tmp &0de5 65 91 ADC &91 ; screen_address_high &0de7 10 03 BPL &0dec &0de9 38 SEC &0dea e9 40 SBC #&40 ; skip_wraparound ; skip_wraparound &0dec 85 91 STA &91 ; screen_address_high &0dee 68 PLA ; y &0def 29 07 AND #&07 &0df1 05 90 ORA &90 ; screen_address_low &0df3 85 90 STA &90 ; screen_address_low &0df5 60 RTS ; unused &0df6 00 00 00 00 00 00 ; plot_flipped_sprite # Called with A = sprite, X = x, Y = y &0dfc 48 PHA ; sprite &0dfd 20 b3 0d JSR &0db3 ; calculate_screen_address &0e00 68 PLA ; sprite &0e01 a8 TAY &0e02 b9 f0 09 LDA &09f0,Y ; sprite_widths_table &0e05 85 7a STA &7a ; width &0e07 aa TAX &0e08 b9 68 0a LDA &0a68,Y ; sprite_heights_table &0e0b 85 7b STA &7b ; height &0e0d b9 00 09 LDA &0900,Y ; sprite_addresses_low_table &0e10 85 78 STA &78 ; sprite_address_low &0e12 b9 78 09 LDA &0978,Y ; sprite_addresses_high_table &0e15 85 79 STA &79 ; sprite_address_high &0e17 ca DEX ; calculate_sprite_address_loop &0e18 18 CLC &0e19 a5 78 LDA &78 ; sprite_address_low &0e1b 65 7b ADC &7b ; height &0e1d 85 78 STA &78 ; sprite_address_low &0e1f a5 79 LDA &79 ; sprite_address_high &0e21 69 00 ADC #&00 &0e23 85 79 STA &79 ; sprite_address_high &0e25 ca DEX &0e26 d0 f0 BNE &0e18 ; calculate_sprite_address_loop ; plot_flipped_sprite_column_loop &0e28 a0 00 LDY #&00 &0e2a a5 91 LDA &91 ; screen_address_high &0e2c 48 PHA ; screen_address_high &0e2d a5 90 LDA &90 ; screen_address_low &0e2f 48 PHA ; screen_address_low &0e30 a5 7b LDA &7b ; height &0e32 85 7c STA &7c ; rows_remaining &0e34 a5 90 LDA &90 ; screen_address_low &0e36 29 07 AND #&07 &0e38 85 7d STA &7d ; row_in_group &0e3a a5 90 LDA &90 ; screen_address_low &0e3c 29 f8 AND #&f8 &0e3e 85 90 STA &90 ; screen_address_low &0e40 84 70 STY &70 ; plot_flipped_sprite_row_loop &0e42 a4 70 LDY &70 &0e44 b1 78 LDA (&78),Y ; sprite_address &0e46 29 aa AND #&aa # Get left pixel &0e48 4a LSR A # Shift to right pixel &0e49 85 70 STA &70 ; tmp &0e4b b1 78 LDA (&78),Y ; sprite_address &0e4d 29 55 AND #&55 # Get right pixel &0e4f 0a ASL A # Shift to left pixel &0e50 05 70 ORA &70 ; tmp # Merge shifted pixels, i.e. swap original pixels &0e52 c8 INY &0e53 84 70 STY &70 ; tmp &0e55 a4 7d LDY &7d ; row_in_group &0e57 51 90 EOR (&90),Y ; screen_address &0e59 91 90 STA (&90),Y ; screen_address &0e5b c8 INY # Move down a row &0e5c c0 08 CPY #&08 &0e5e f0 26 BEQ &0e86 ; next_group ; next_row &0e60 84 7d STY &7d ; row_in_group &0e62 c6 7c DEC &7c ; rows_remaining &0e64 d0 dc BNE &0e42 ; plot_flipped_sprite_row_loop &0e66 a5 78 LDA &78 ; sprite_address_low &0e68 38 SEC &0e69 e5 7b SBC &7b ; height &0e6b 85 78 STA &78 ; sprite_address_low &0e6d b0 02 BCS &0e71 ; skip_page &0e6f c6 79 DEC &79 ; sprite_address_high ; skip_page &0e71 18 CLC &0e72 68 PLA ; screen_address_low &0e73 69 08 ADC #&08 # Move right a column &0e75 85 90 STA &90 ; screen_address_low &0e77 68 PLA ; screen_address_high &0e78 69 00 ADC #&00 &0e7a 10 03 BPL &0e7f ; skip_wraparound &0e7c 38 SEC &0e7d e9 40 SBC #&40 ; skip_wraparound &0e7f 85 91 STA &91 ; screen_address_high &0e81 c6 7a DEC &7a ; width &0e83 d0 a3 BNE &0e28 ; plot_flipped_sprite_column_loop &0e85 60 RTS ; next_group &0e86 a0 00 LDY #&00 &0e88 a5 90 LDA &90 ; screen_address_low &0e8a 18 CLC &0e8b 69 80 ADC #&80 # Move down a group &0e8d 85 90 STA &90 ; screen_address_low &0e8f a5 91 LDA &91 ; screen_address_high &0e91 69 02 ADC #&02 &0e93 10 03 BPL &0e98 ; skip_wraparound &0e95 38 SEC &0e96 e9 40 SBC #&40 ; skip_wraparound &0e98 85 91 STA &91 ; screen_address_high &0e9a d0 c4 BNE &0e60 ; next_row # Always branches ; unused &0e9c 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &0eac 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &0ebc 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &0ecc 00 00 00 00 ; sound_data ; chan vol pitch dur &0ed0 10 00 f1 ff 06 00 03 00 ; 0 # Explosion &0ed8 10 00 f1 ff 05 00 01 00 ; 1 # Player or enemy firing bullet &0ee0 11 00 02 00 36 00 1e 00 ; 2 # Boss appearing &0ee8 12 00 01 00 c8 00 3c 00 ; 3 # Helicopter dropping bomb, boss firing grenade &0ef0 11 00 f1 ff c8 00 02 00 ; 4 # Invulnerability, enabling cheat mode &0ef8 12 00 04 00 50 00 01 00 ; 5 # Player jumping &0f00 11 00 03 00 b4 00 04 00 ; 6 # Extra life &0f08 10 00 03 00 c8 00 04 00 ; 7 # Collecting parachute ; unused &0f10 00 00 00 00 00 00 ; start_game_after_title_screen &0f16 a9 2f LDA #&2f ; &2fe0 = area_one_data &0f18 8d 3d 01 STA &013d ; area_data_address_high &0f1b a9 04 LDA #&04 # Start with four lives # actually LDA initial_lives # Start with twenty lives in cheat mode &0f1d 8d 31 01 STA &0131 ; lives &0f20 a9 e0 LDA #&e0 &0f22 8d 3c 01 STA &013c ; area_data_address_low &0f25 a9 01 LDA #&01 # Start on area one &0f27 8d 50 01 STA &0150 ; area &0f2a a9 08 LDA #&08 &0f2c 8d 4f 01 STA &014f ; probability_of_adding_enemy_or_bullet # Area one has 8 in 256 chance of adding per frame &0f2f 20 21 1d JSR &1d21 ; title_screen ; start_game &0f32 a9 00 LDA #&00 &0f34 8d 56 01 STA &0156 ; background_checkpoint &0f37 a2 05 LDX #&05 ; reset_score_loop &0f39 9d 28 01 STA &0128,X ; score_delta &0f3c 9d 43 01 STA &0143,X ; score &0f3f ca DEX &0f40 10 f7 BPL &0f39 ; reset_score_loop ; start_area &0f42 20 d0 1a JSR &1ad0 ; reset_screen &0f45 20 0d 1b JSR &1b0d ; initialise_area &0f48 20 ef 13 JSR &13ef ; initialise_player_and_bullets &0f4b ce 58 01 DEC &0158 ; allow_parachute # Set to negative to allow parachutes ; main_game_loop &0f4e a9 00 LDA #&00 &0f50 8d 30 01 STA &0130 ; player_killed # Set to zero to indicate player not killed &0f53 20 b4 0f JSR &0fb4 ; update_halo &0f56 20 2a 13 JSR &132a ; replot_player_and_background &0f59 20 69 11 JSR &1169 ; update_player &0f5c 20 7c 14 JSR &147c ; consider_adding_enemies &0f5f 20 57 15 JSR &1557 ; update_enemies &0f62 20 04 1d JSR &1d04 ; check_for_pause_and_escape &0f65 20 73 1e JSR &1e73 ; update_music_and_check_for_sound_keys &0f68 20 c6 1e JSR &1ec6 ; replot_enemies &0f6b ad ee 13 LDA &13ee ; escape_pressed &0f6e 30 a6 BMI &0f16 ; start_game_after_title_screen &0f70 ad 30 01 LDA &0130 ; player_killed # Non-zero if player was killed &0f73 f0 13 BEQ &0f88 ; not_killed ; end_of_life &0f75 ce 31 01 DEC &0131 ; lives &0f78 08 PHP ; out of lives &0f79 20 7d 1a JSR &1a7d ; reset_area &0f7c 28 PLP ; out of lives &0f7d f0 03 BEQ &0f82 ; end_of_game &0f7f 4c 42 0f JMP &0f42 ; start_area ; end_of_game &0f82 20 3a 20 JSR &203a ; game_over_screen &0f85 4c 16 0f JMP &0f16 ; start_game_after_title_screen ; not_killed &0f88 ad 3a 01 LDA &013a ; area_complete # Non-zero if boss was destroyed &0f8b f0 c1 BEQ &0f4e ; main_game_loop &0f8d ad 4f 01 LDA &014f ; probability_of_adding_enemy_or_bullet &0f90 18 CLC &0f91 69 0c ADC #&0c # Area two has 20 in 256 chance of adding per frame &0f93 8d 4f 01 STA &014f ; probability_of_adding_enemy_or_bullet # Area three has 32 in 256 chance of adding per frame &0f96 a5 68 LDA &68 ; area_sprite_base &0f98 18 CLC &0f99 69 10 ADC #&10 # Use sprites corresponding to next area &0f9b 85 68 STA &68 ; area_sprite_base &0f9d ad 3c 01 LDA &013c ; area_data_address_low &0fa0 18 CLC &0fa1 69 08 ADC #&08 ; &0408 = 86 * 12 # Areas are 86 * 2 = 172 tiles wide &0fa3 8d 3c 01 STA &013c ; area_data_address_low &0fa6 ad 3d 01 LDA &013d ; area_data_address_high &0fa9 69 04 ADC #&04 &0fab 8d 3d 01 STA &013d ; area_data_address_high &0fae 20 83 1b JSR &1b83 ; area_cleared_screen &0fb1 4c 42 0f JMP &0f42 ; start_area ; update_halo &0fb4 ad 40 01 LDA &0140 ; player_invulnerability_timer # Non-zero if player is invulnerable &0fb7 f0 1a BEQ &0fd3 ; skip_sound &0fb9 20 24 25 JSR &2524 ; unplot_halo &0fbc ce 40 01 DEC &0140 ; player_invulnerability_timer &0fbf f0 12 BEQ &0fd3 ; skip_sound &0fc1 20 00 25 JSR &2500 ; plot_halo &0fc4 a0 08 LDY #&08 &0fc6 ad 40 01 LDA &0140 ; player_invulnerability_timer &0fc9 20 a2 1c JSR &1ca2 ; calculate_A_mod_Y &0fcc d0 05 BNE &0fd3 ; skip_sound # Once every eight frames, &0fce a9 04 LDA #&04 &0fd0 4c 80 08 JMP &0880 ; play_sound # Play sound for invulnerability ; skip_sound &0fd3 60 RTS ; scroll_screen &0fd4 ad 3b 01 LDA &013b ; suppress_scrolling_at_right_of_area # Non-zero if player has reached right of area &0fd7 f0 01 BEQ &0fda ; can_scroll &0fd9 60 RTS ; can_scroll &0fda c6 69 DEC &69 ; player_x &0fdc c6 6c DEC &6c ; player_previous_x &0fde a5 72 LDA &72 ; screen_start_address_low &0fe0 18 CLC &0fe1 69 08 ADC #&08 # Scroll right a column &0fe3 85 72 STA &72 ; screen_start_address_low &0fe5 a5 73 LDA &73 ; screen_start_address_high &0fe7 69 00 ADC #&00 &0fe9 10 03 BPL &0fee ; skip_wraparound &0feb 38 SEC &0fec e9 40 SBC #&40 ; skip_wraparound &0fee 85 73 STA &73 ; screen_start_address_high &0ff0 e6 76 INC &76 ; crtc_start_address_low # Scroll right a column &0ff2 d0 0d BNE &1001 ; skip_wraparound_crtc &0ff4 e6 77 INC &77 ; crtc_start_address_high &0ff6 a5 77 LDA &77 ; crtc_start_address_high &0ff8 c9 10 CMP #&10 &0ffa d0 05 BNE &1001 ; skip_wraparound_crtc &0ffc 38 SEC &0ffd e9 08 SBC #&08 &0fff 85 77 STA &77 ; crtc_start_address_high ; skip_wraparound_crtc &1001 a2 07 LDX #&07 ; scroll_bullets_and_enemies_loop &1003 de 00 04 DEC &0400,X ; player_bullets_x # Move bullets and enemies left to compensate for scroll &1006 d6 08 DEC &08,X ; enemies_x &1008 ca DEX &1009 10 f8 BPL &1003 ; scroll_bullets_and_enemies_loop &100b a9 0d LDA #&0d ; R13: Displayed screen start address register (low) &100d 8d 00 fe STA &fe00 ; video register number &1010 a5 76 LDA &76 ; crtc_start_address_low &1012 8d 01 fe STA &fe01 ; video register value &1015 a9 0c LDA #&0c ; R12: Displayed screen start address register (high) &1017 8d 00 fe STA &fe00 ; video register number &101a a5 77 LDA &77 ; crtc_start_address_high &101c 8d 01 fe STA &fe01 ; video register value &101f a9 ff LDA #&ff &1021 8d 35 01 STA &0135 ; background_needs_plotting # Set to non-zero to indicate background needs plotting &1024 60 RTS ; plot_column_of_background &1025 a9 00 LDA #&00 &1027 8d 3e 01 STA &013e ; suppress_new_enemies_because_of_hole # Set to zero to allow spawning enemies by default &102a ad b9 08 LDA &08b9 ; background_data_offset_low &102d 18 CLC &102e 6d 3c 01 ADC &013c ; area_data_address_low &1031 85 81 STA &81 ; background_data_address_low &1033 ad 3d 01 LDA &013d ; area_data_address_high &1036 6d ba 08 ADC &08ba ; background_data_offset_high &1039 85 82 STA &82 ; background_data_address_high &103b a5 72 LDA &72 ; screen_start_address_low &103d 18 CLC &103e 69 78 ADC #&78 # Top right of screen &1040 85 90 STA &90 ; screen_address_low &1042 a5 73 LDA &73 ; screen_start_address_high &1044 69 02 ADC #&02 &1046 10 03 BPL &104b ; skip_wraparound &1048 38 SEC &1049 e9 40 SBC #&40 ; skip_wraparound &104b 85 91 STA &91 ; screen_address_high &104d a0 07 LDY #&07 &104f a9 00 LDA #&00 ; wipe_top_group_of_column_loop &1051 91 90 STA (&90),Y ; screen_address &1053 88 DEY &1054 10 fb BPL &1051 ; wipe_top_group_of_column_loop &1056 a8 TAY &1057 a5 90 LDA &90 ; screen_address_low &1059 18 CLC &105a 69 80 ADC #&80 # Move down a group &105c 85 90 STA &90 ; screen_address_low &105e a5 91 LDA &91 ; screen_address_high &1060 69 02 ADC #&02 &1062 10 03 BPL &1067 ; skip_wraparound &1064 38 SEC &1065 e9 40 SBC #&40 ; skip_wraparound &1067 85 91 STA &91 ; screen_address_high ; plot_column_of_background_tile_loop &1069 b1 81 LDA (&81),Y ; background_data_address # Get nibble of background data &106b 84 83 STY &83 ; background_data_offset &106d 25 80 AND &80 ; background_data_nibble &106f a6 80 LDX &80 ; background_data_nibble &1071 10 04 BPL &1077 ; not_top_nibble &1073 4a LSR A &1074 4a LSR A &1075 4a LSR A &1076 4a LSR A ; not_top_nibble &1077 85 87 STA &87 ; tile &1079 18 CLC &107a 65 68 ADC &68 ; area_sprite_base &107c aa TAX &107d bd 00 09 LDA &0900,X ; sprite_addresses_low_table &1080 18 CLC &1081 6d be 08 ADC &08be ; tile_x_fraction &1084 85 78 STA &78 ; tile_sprite_address_low &1086 bd 78 09 LDA &0978,X ; sprite_addresses_high_table &1089 69 00 ADC #&00 &108b 85 79 STA &79 ; tile_sprite_address_high &108d 20 ff 1e JSR &1eff ; plot_column_of_tile &1090 a4 83 LDY &83 ; background_data_offset &1092 c8 INY &1093 c0 0c CPY #&0c &1095 90 d2 BCC &1069 ; plot_column_of_background_tile_loop &1097 a5 87 LDA &87 ; tile &1099 c9 03 CMP #&03 ; TILE_NIBBLE_GROUND # Corresponds to SPRITE_*_GROUND &109b f0 05 BEQ &10a2 ; not_hole &109d a9 ff LDA #&ff &109f 8d 3e 01 STA &013e ; suppress_new_enemies_because_of_hole # Set to non-zero to suppress new enemies because of hole ; not_hole &10a2 ad be 08 LDA &08be ; tile_x_fraction &10a5 18 CLC &10a6 69 10 ADC #&10 &10a8 8d be 08 STA &08be ; tile_x_fraction &10ab c9 40 CMP #&40 &10ad b0 01 BCS &10b0 ; next_tile &10af 60 RTS ; next_tile &10b0 a9 00 LDA #&00 &10b2 8d be 08 STA &08be ; tile_x_fraction &10b5 a5 80 LDA &80 ; background_data_nibble &10b7 49 ff EOR #&ff # Move to next nibble of background data; low, then high &10b9 85 80 STA &80 ; background_data_nibble &10bb 10 01 BPL &10be ; next_bytes &10bd 60 RTS ; next_bytes &10be ad b9 08 LDA &08b9 ; background_data_offset_low &10c1 18 CLC &10c2 69 0c ADC #&0c # Move to next pair of columns of background data &10c4 8d b9 08 STA &08b9 ; background_data_offset_low &10c7 08 PHP ; address overflow &10c8 ad ba 08 LDA &08ba ; background_data_offset_high &10cb 69 00 ADC #&00 &10cd 8d ba 08 STA &08ba ; background_data_offset_high &10d0 28 PLP ; address overflow &10d1 b0 01 BCS &10d4 ; next_page &10d3 60 RTS ; next_page # Every 256 bytes of background data (approximately &10d4 c9 04 CMP #&04 # every 42 tiles), consider adding a parachute &10d6 b0 02 BCS &10da ; at_right_of_area &10d8 90 39 BCC &1113 ; consider_adding_parachute # Always branches ; at_right_of_area &10da a9 ff LDA #&ff &10dc 8d 3b 01 STA &013b ; suppress_scrolling_at_right_of_area # Set to non-zero to indicate player has reached right of area &10df a9 00 LDA #&00 &10e1 8d 3a 01 STA &013a ; area_complete # Set to zero to indicate boss not destroyed &10e4 ae 55 01 LDX &0155 ; next_free_enemy_slot &10e7 10 07 BPL &10f0 ; skip_removing_enemy # If no free enemy slot, &10e9 a2 00 LDX #&00 &10eb 20 97 15 JSR &1597 ; plot_enemy # Unplot enemy zero to free slot for boss &10ee a2 00 LDX #&00 ; skip_removing_enemy &10f0 a9 4f LDA #&4f ; SPRITE_BOSS &10f2 95 00 STA &00,X ; enemies_sprite &10f4 a9 4a LDA #&4a &10f6 95 10 STA &10,X ; enemies_y &10f8 a9 ff LDA #&ff &10fa 95 18 STA &18,X ; enemies_x_velocity &10fc 8d 55 01 STA &0155 ; next_free_enemy_slot &10ff a9 43 LDA #&43 &1101 95 08 STA &08,X ; enemies_x &1103 a9 00 LDA #&00 &1105 95 28 STA &28,X ; enemies_timer_jump_or_hit_count # Used as hit counter for boss &1107 a9 05 LDA #&05 ; ENEMY_TYPE_BOSS &1109 95 20 STA &20,X ; enemies_type &110b 20 97 15 JSR &1597 ; plot_enemy &110e a9 02 LDA #&02 &1110 4c 80 08 JMP &0880 ; play_sound # Play sound for boss appearing ; consider_adding_parachute &1113 ad 58 01 LDA &0158 ; allow_parachute &1116 d0 01 BNE &1119 ; is_ok &1118 60 RTS ; is_ok &1119 ae 55 01 LDX &0155 ; next_free_enemy_slot &111c 10 01 BPL &111f ; add_parachute &111e 60 RTS ; add_parachute &111f a9 07 LDA #&07 ; ENEMY_TYPE_PARACHUTE &1121 95 20 STA &20,X ; enemies_type &1123 a9 47 LDA #&47 &1125 95 08 STA &08,X ; enemies_x &1127 a9 00 LDA #&00 &1129 95 10 STA &10,X ; enemies_y &112b a9 52 LDA #&52 ; SPRITE_PARACHUTE &112d 95 00 STA &00,X ; enemies_sprite &112f a9 ff LDA #&ff &1131 8d 55 01 STA &0155 ; next_free_enemy_slot &1134 4c 97 15 JMP &1597 ; plot_enemy ; check_for_support # Called with A = width to check &1137 48 PHA ; width &1138 20 b3 0d JSR &0db3 ; calculate_screen_address &113b 68 PLA ; width &113c aa TAX &113d a0 00 LDY #&00 ; check_for_support_loop &113f b1 90 LDA (&90),Y ; screen_address &1141 29 aa AND #&aa ; left pixel &1143 c9 20 CMP #&20 ; left pixel colour 4 # Colours 4 - 7 (green) and 12 - 15 (red) provide support &1145 f0 1f BEQ &1166 ; leave_with_negative &1147 b1 90 LDA (&90),Y ; screen_address &1149 29 55 AND #&55 ; right pixel &114b c9 10 CMP #&10 ; right pixel colour 4 # if present in either pixel of a pair &114d f0 17 BEQ &1166 ; leave_with_negative &114f a5 90 LDA &90 ; screen_address_low &1151 18 CLC &1152 69 08 ADC #&08 # Move right a column &1154 85 90 STA &90 ; screen_address_low &1156 a5 91 LDA &91 ; screen_address_high &1158 69 00 ADC #&00 &115a 10 02 BPL &115e ; skip_wraparound &115c a9 40 LDA #&40 ; skip_wraparound &115e 85 91 STA &91 ; screen_address_high &1160 ca DEX &1161 10 dc BPL &113f ; check_for_support_loop &1163 a9 00 LDA #&00 # Leave with &00 to indicate no support &1165 60 RTS ; leave_with_negative &1166 a9 ff LDA #&ff # Leave with &ff to indicate support &1168 60 RTS ; update_player &1169 ad 18 04 LDA &0418 ; player_next_free_bullet_slot &116c 30 71 BMI &11df ; skip_firing &116e ad 7b 01 LDA &017b ; player_firing_cooldown &1171 d0 6c BNE &11df ; skip_firing &1173 ad 7b 14 LDA &147b ; player_controlled_by_computer # Negative if demo mode &1176 30 0d BMI &1185 ; force_firing # Computer always fires if possible &1178 a9 81 LDA #&81 ; Scan for a particular key &117a a2 b6 LDX #&b6 ; RETURN # actually LDX key_fire &117c a0 ff LDY #&ff &117e 20 f4 ff JSR &fff4 ; OSBYTE &1181 e0 ff CPX #&ff &1183 d0 5a BNE &11df ; skip_firing ; force_firing &1185 ae 18 04 LDX &0418 ; player_next_free_bullet_slot &1188 a5 6d LDA &6d ; player_flipped # Negative if player facing left &118a 30 0f BMI &119b ; fire_left ; fire_right &118c a9 02 LDA #&02 # Set bullet moving right &118e 9d 10 04 STA &0410,X ; player_bullets_x_velocity &1191 a5 69 LDA &69 ; player_x &1193 18 CLC &1194 69 06 ADC #&06 &1196 9d 00 04 STA &0400,X ; player_bullets_x &1199 d0 11 BNE &11ac ; set_bullet_y # Always branches ; fire_left &119b a5 69 LDA &69 ; player_x &119d c9 03 CMP #&03 &119f 90 3e BCC &11df ; skip_firing &11a1 38 SEC &11a2 e9 02 SBC #&02 &11a4 9d 00 04 STA &0400,X ; player_bullets_x &11a7 a9 fe LDA #&fe # Set bullet moving left &11a9 9d 10 04 STA &0410,X ; player_bullets_x_velocity ; set_bullet_y &11ac a5 6a LDA &6a ; player_y &11ae 18 CLC &11af 69 08 ADC #&08 &11b1 ac 42 01 LDY &0142 ; player_is_ducking # Negative if player is ducking &11b4 10 02 BPL &11b8 ; not_ducking &11b6 69 04 ADC #&04 ; not_ducking &11b8 9d 08 04 STA &0408,X ; player_bullets_y &11bb a9 ff LDA #&ff &11bd 8d 18 04 STA &0418 ; player_next_free_bullet_slot &11c0 ad 41 01 LDA &0141 ; player_can_fire_fast &11c3 f0 07 BEQ &11cc ; not_fast_firing &11c5 bd 10 04 LDA &0410,X ; player_bullets_x_velocity &11c8 0a ASL A # Bullets travel twice as fast with powerup &11c9 9d 10 04 STA &0410,X ; player_bullets_x_velocity ; not_fast_firing &11cc 20 d4 13 JSR &13d4 ; plot_bullet &11cf a0 04 LDY #&04 &11d1 cc 59 01 CPY &0159 ; number_of_player_player_bullets &11d4 b0 01 BCS &11d7 ; set_player_firing_cooldown &11d6 88 DEY # Player can fire more often with powerup ; set_player_firing_cooldown &11d7 8c 7b 01 STY &017b ; player_firing_cooldown &11da a9 01 LDA #&01 &11dc 20 80 08 JSR &0880 ; play_sound # Play sound for player firing ; skip_firing &11df ce 7b 01 DEC &017b ; player_firing_cooldown &11e2 10 05 BPL &11e9 ; skip_floor &11e4 a9 00 LDA #&00 &11e6 8d 7b 01 STA &017b ; player_firing_cooldown ; skip_floor &11e9 a5 89 LDA &89 ; player_jump_timer &11eb f0 03 BEQ &11f0 ; not_jumping &11ed 4c 90 12 JMP &1290 ; not_supported ; not_jumping &11f0 a5 6a LDA &6a ; player_y &11f2 18 CLC &11f3 69 18 ADC #&18 &11f5 a8 TAY &11f6 a6 69 LDX &69 ; player_x &11f8 e8 INX &11f9 e8 INX &11fa a9 01 LDA #&01 ; width &11fc 20 37 11 JSR &1137 ; check_for_support # Returns A = &ff if supported &11ff d0 03 BNE &1204 ; is_supported &1201 4c 90 12 JMP &1290 ; skip_checking_for_left_and_right ; is_supported &1204 ad 42 01 LDA &0142 ; player_is_ducking # Negative if player is ducking &1207 8d 6f 01 STA &016f ; player_previous_is_ducking &120a f0 04 BEQ &1210 ; was_not_ducking &120c a9 41 LDA #&41 ; SPRITE_PLAYER_STANDING &120e 85 86 STA &86 ; player_sprite ; was_not_ducking &1210 a9 00 LDA #&00 &1212 85 89 STA &89 ; player_jump_timer &1214 ad 7b 14 LDA &147b ; player_controlled_by_computer # Negative if demo mode &1217 30 15 BMI &122e ; not_starting_jump # Computer doesn't jump (but see &1297) &1219 a9 81 LDA #&81 ; Scan for a particular key &121b a2 ff LDX #&ff ; SHIFT # actually LDX key_jump &121d a0 ff LDY #&ff &121f 20 f4 ff JSR &fff4 ; OSBYTE &1222 e0 ff CPX #&ff &1224 d0 08 BNE &122e ; not_starting_jump &1226 a9 05 LDA #&05 &1228 20 80 08 JSR &0880 ; play_sound # Play sound for player jumping &122b 4c 9c 12 JMP &129c ; update_jumping_player ; not_starting_jump &122e a9 00 LDA #&00 &1230 85 8b STA &8b ; player_x_velocity &1232 8d 42 01 STA &0142 ; player_is_ducking # Negative if player is ducking &1235 ad 7b 14 LDA &147b ; player_controlled_by_computer # Negative if demo mode &1238 30 15 BMI &124f ; not_ducking # Computer doesn't duck &123a a9 81 LDA #&81 ; Scan for a particular key &123c a2 9d LDX #&9d ; SPACE # actually LDX key_duck &123e a0 ff LDY #&ff &1240 20 f4 ff JSR &fff4 ; OSBYTE &1243 e0 ff CPX #&ff &1245 d0 08 BNE &124f ; skip_starting_duck &1247 8e 42 01 STX &0142 ; player_is_ducking # Negative if player is ducking &124a a9 44 LDA #&44 ; SPRITE_PLAYER_DUCKING &124c 85 86 STA &86 ; player_sprite &124e 60 RTS ; not_ducking &124f ad 7b 14 LDA &147b ; player_controlled_by_computer # Negative if demo mode &1252 30 14 BMI &1268 ; not_moving_left # Computer doesn't move left &1254 a9 81 LDA #&81 ; Scan for a particular key &1256 a2 9e LDX #&9e ; Z # actually LDX key_left &1258 a0 ff LDY #&ff &125a 20 f4 ff JSR &fff4 ; OSBYTE &125d e0 ff CPX #&ff &125f d0 07 BNE &1268 ; not_moving_left &1261 c6 8b DEC &8b ; player_x_velocity &1263 86 6d STX &6d ; player_flipped # Negative if player facing left &1265 4c 9e 12 JMP &129e ; apply_player_velocities ; not_moving_left &1268 a5 8b LDA &8b ; player_x_velocity &126a c9 01 CMP #&01 &126c f0 30 BEQ &129e ; apply_player_velocities &126e ad 7b 14 LDA &147b ; player_controlled_by_computer # Negative if demo mode &1271 30 0d BMI &1280 ; move_right # Computer always moves right &1273 a9 81 LDA #&81 ; Scan for a particular key &1275 a2 bd LDX #&bd ; X # actually LDX key_right &1277 a0 ff LDY #&ff &1279 20 f4 ff JSR &fff4 ; OSBYTE &127c e0 ff CPX #&ff &127e d0 1e BNE &129e ; apply_player_velocities ; move_right &1280 e6 8b INC &8b ; player_x_velocity &1282 a9 00 LDA #&00 &1284 85 6d STA &6d ; player_flipped # Negative if player facing left &1286 a4 69 LDY &69 ; player_x &1288 c0 49 CPY #&49 &128a 90 12 BCC &129e ; apply_player_velocities &128c 85 8b STA &8b ; player_x_velocity &128e b0 0e BCS &129e ; apply_player_velocities # Always branches ; not_supported # If the player isn't supported, &1290 a5 89 LDA &89 ; player_jump_timer &1292 d0 08 BNE &129c ; update_jumping_player &1294 a9 0b LDA #&0b # Set the player falling if not in demo mode &1296 18 CLC &1297 6d 7b 14 ADC &147b ; player_controlled_by_computer # This is &f6 in demo mode; &f6 + &0b = &01 &129a 85 89 STA &89 ; player_jump_timer # i.e. start player jumping if not supported in demo mode ; update_jumping_player &129c e6 89 INC &89 ; player_jump_timer ; apply_player_velocities &129e a6 69 LDX &69 ; player_x &12a0 e0 01 CPX #&01 &12a2 d0 08 BNE &12ac ; not_at_left_of_screen &12a4 a5 8b LDA &8b ; player_x_velocity &12a6 10 04 BPL &12ac ; not_at_left_of_screen &12a8 a9 00 LDA #&00 &12aa 85 8b STA &8b ; player_x_velocity # Don't allow player to move off left edge of screen ; not_at_left_of_screen &12ac a5 69 LDA &69 ; player_x &12ae 18 CLC &12af 65 8b ADC &8b ; player_x_velocity &12b1 85 69 STA &69 ; player_x &12b3 a5 89 LDA &89 ; player_jump_timer &12b5 f0 46 BEQ &12fd ; skip_applying_y_velocity &12b7 aa TAX &12b8 bd 94 08 LDA &0894,X ; jump_table &12bb ac 5a 01 LDY &015a ; player_can_jump_high &12be f0 01 BEQ &12c1 ; skip_doubling_jump &12c0 0a ASL A # Player jumps and falls twice as much with powerup ; skip_doubling_jump &12c1 a8 TAY &12c2 10 11 BPL &12d5 ; is_falling ; is_jumping &12c4 18 CLC &12c5 65 6a ADC &6a ; player_y &12c7 85 6a STA &6a ; player_y &12c9 e9 04 SBC #&04 &12cb c9 c8 CMP #&c8 &12cd 90 2e BCC &12fd ; skip_applying_y_velocity &12cf a9 04 LDA #&04 # Don't allow player to jump beyond top of screen &12d1 85 6a STA &6a ; player_y &12d3 d0 28 BNE &12fd ; skip_applying_y_velocity # Always branches ; is_falling &12d5 18 CLC &12d6 65 6a ADC &6a ; player_y &12d8 85 7b STA &7b ; new_y ; apply_falling_velocity_loop &12da a6 69 LDX &69 ; player_x &12dc a5 6a LDA &6a ; player_y &12de e8 INX &12df e8 INX &12e0 18 CLC &12e1 69 18 ADC #&18 &12e3 a8 TAY &12e4 a9 01 LDA #&01 ; width &12e6 20 37 11 JSR &1137 ; check_for_support # Returns A = &ff if supported &12e9 f0 0a BEQ &12f5 ; continue_fall ; end_fall &12eb a9 41 LDA #&41 ; SPRITE_PLAYER_STANDING &12ed 85 86 STA &86 ; player_sprite &12ef a9 00 LDA #&00 &12f1 85 89 STA &89 ; player_jump_timer &12f3 f0 08 BEQ &12fd ; skip_applying_y_velocity # Always branches ; continue_fall &12f5 e6 6a INC &6a ; player_y &12f7 a5 6a LDA &6a ; player_y &12f9 c5 7b CMP &7b ; new_y &12fb 90 dd BCC &12da ; apply_falling_velocity_loop ; skip_applying_y_velocity &12fd a5 6a LDA &6a ; player_y &12ff c9 b0 CMP #&b0 &1301 90 05 BCC &1308 ; skip_killing_player # Has the player reached the bottom of the screen? &1303 a9 ff LDA #&ff &1305 8d 30 01 STA &0130 ; player_killed # Set to negative to kill player (falling into hole) ; skip_killing_player &1308 a5 89 LDA &89 ; player_jump_timer &130a f0 05 BEQ &1311 ; not_jumping &130c a9 45 LDA #&45 ; SPRITE_PLAYER_JUMPING &130e 85 86 STA &86 ; player_sprite &1310 60 RTS ; not_jumping &1311 a5 8b LDA &8b ; player_x_velocity &1313 d0 05 BNE &131a ; is_moving &1315 a9 41 LDA #&41 ; SPRITE_PLAYER_STANDING &1317 85 86 STA &86 ; player_sprite &1319 60 RTS ; is_moving &131a a5 86 LDA &86 ; player_sprite &131c 18 CLC &131d 69 01 ADC #&01 # Animate walking player &131f 85 86 STA &86 ; player_sprite &1321 c9 44 CMP #&44 ; SPRITE_PLAYER_WALKING_TWO + 1 &1323 d0 04 BNE &1329 ; leave &1325 a9 41 LDA #&41 ; SPRITE_PLAYER_STANDING &1327 85 86 STA &86 ; player_sprite ; leave &1329 60 RTS ; replot_player_and_background &132a a9 00 LDA #&00 &132c 8d 35 01 STA &0135 ; background_needs_plotting # Set to zero to indicate no plotting needed &132f a9 13 LDA #&13 ; Wait for vertical retrace &1331 20 f4 ff JSR &fff4 ; OSBYTE &1334 a5 69 LDA &69 ; player_x &1336 c9 26 CMP #&26 &1338 90 03 BCC &133d ; skip_scrolling_screen &133a 20 d4 0f JSR &0fd4 ; scroll_screen ; skip_scrolling_screen &133d a6 6c LDX &6c ; player_previous_x &133f a4 6b LDY &6b ; player_previous_y &1341 a5 6e LDA &6e ; player_previous_flipped # Negative if player was facing left &1343 d0 08 BNE &134d ; unplot_flipped_player ; unplot_unflipped_player &1345 a5 6f LDA &6f ; player_previous_sprite &1347 20 20 0d JSR &0d20 ; plot_sprite &134a 4c 52 13 JMP &1352 ; replot_player ; unplot_flipped_player &134d a5 6f LDA &6f ; player_previous_sprite &134f 20 fc 0d JSR &0dfc ; plot_flipped_sprite ; replot_player &1352 a6 69 LDX &69 ; player_x &1354 a4 6a LDY &6a ; player_y &1356 a5 6d LDA &6d ; player_flipped # Negative if player facing left &1358 d0 08 BNE &1362 ; replot_flipped_player ; replot_unflipped_player &135a a5 86 LDA &86 ; player_sprite &135c 20 20 0d JSR &0d20 ; plot_sprite &135f 4c 67 13 JMP &1367 ; consider_plotting_background ; replot_flipped_player &1362 a5 86 LDA &86 ; player_sprite &1364 20 fc 0d JSR &0dfc ; plot_flipped_sprite ; consider_plotting_background &1367 20 94 13 JSR &1394 ; update_player_bullets &136a ad 35 01 LDA &0135 ; background_needs_plotting # Negative if background needs plotting &136d f0 03 BEQ &1372 ; skip_plotting_background &136f 20 25 10 JSR &1025 ; plot_column_of_background ; skip_plotting_background &1372 a5 86 LDA &86 ; player_sprite &1374 85 6f STA &6f ; player_previous_sprite &1376 a5 6d LDA &6d ; player_flipped &1378 85 6e STA &6e ; player_previous_flipped &137a a5 69 LDA &69 ; player_x &137c 85 6c STA &6c ; player_previous_x &137e a5 6a LDA &6a ; player_y &1380 85 6b STA &6b ; player_previous_y &1382 60 RTS ; unused # Unused code &1383 a5 6c LDA &6c ; player_previous_x &1385 85 69 STA &69 ; player_x &1387 a5 6b LDA &6b ; player_previous_y &1389 85 6a STA &6a ; player_y &138b a5 86 LDA &86 ; player_sprite &138d 85 8a STA &8a ; unused_player_previous_sprite &138f a9 ff LDA #&ff &1391 85 86 STA &86 ; player_sprite &1393 60 RTS ; update_player_bullets &1394 a9 ff LDA #&ff &1396 8d 18 04 STA &0418 ; player_next_free_bullet_slot # Negative to indicate no free slot by default &1399 ae 59 01 LDX &0159 ; number_of_player_player_bullets ; update_player_bullets_loop &139c bd 10 04 LDA &0410,X ; player_bullets_x_velocity # Non-zero if bullet in slot &139f d0 06 BNE &13a7 ; update_bullet &13a1 8e 18 04 STX &0418 ; player_next_free_bullet_slot &13a4 4c c9 13 JMP &13c9 ; consider_next_bullet ; update_bullet &13a7 86 83 STX &83 ; bullet_offset &13a9 20 d4 13 JSR &13d4 ; plot_bullet # Unplot bullet &13ac a6 83 LDX &83 ; bullet_offset &13ae bd 10 04 LDA &0410,X ; player_bullets_x_velocity # &80 if bullet hit enemy (see &1919) &13b1 c9 80 CMP #&80 &13b3 f0 18 BEQ &13cd ; remove_bullet # Remove bullet if it hit an enemy &13b5 18 CLC &13b6 7d 00 04 ADC &0400,X ; player_bullets_x &13b9 9d 00 04 STA &0400,X ; player_bullets_x &13bc 30 0f BMI &13cd ; remove_bullet # Remove bullet at left of screen &13be f0 0d BEQ &13cd ; remove_bullet &13c0 c9 4d CMP #&4d &13c2 b0 09 BCS &13cd ; remove_bullet # Remove bullet at right of screen &13c4 20 d4 13 JSR &13d4 ; plot_bullet # Plot bullet &13c7 a6 83 LDX &83 ; bullet_offset ; consider_next_bullet &13c9 ca DEX &13ca 10 d0 BPL &139c ; update_player_bullets_loop &13cc 60 RTS ; remove_bullet &13cd a9 00 LDA #&00 &13cf 9d 10 04 STA &0410,X ; player_bullets_x_velocity # Set to zero to indicate no bullet in slot &13d2 f0 f5 BEQ &13c9 ; consider_next_bullet # Always branches ; plot_bullet &13d4 bd 08 04 LDA &0408,X ; player_bullets_y &13d7 a8 TAY &13d8 bd 00 04 LDA &0400,X ; player_bullets_x &13db aa TAX &13dc a9 46 LDA #&46 ; SPRITE_PLAYER_BULLET &13de 4c 20 0d JMP &0d20 ; plot_sprite ; check_for_escape &13e1 a9 81 LDA #&81 ; Scan for a particular key &13e3 a2 8f LDX #&8f ; ESCAPE &13e5 a0 ff LDY #&ff &13e7 20 f4 ff JSR &fff4 ; OSBYTE &13ea 8e ee 13 STX &13ee ; escape_pressed &13ed 60 RTS ; escape_pressed &13ee 00 ; initialise_player_and_bullets &13ef a9 03 LDA #&03 &13f1 8d 59 01 STA &0159 ; number_of_player_player_bullets # Player can fire four bullets &13f4 a9 00 LDA #&00 &13f6 8d 5a 01 STA &015a ; player_can_jump_high # Set to zero to indicate player can't jump high &13f9 8d 41 01 STA &0141 ; player_can_fire_fast # Set to zero to indicate player can't fire fast &13fc 8d 40 01 STA &0140 ; player_invulnerability_timer # Set to zero to indicate player isn't invulnerable &13ff 8d 7b 01 STA &017b ; player_firing_cooldown &1402 a2 07 LDX #&07 ; initialise_player_bullets_loop &1404 9d 10 04 STA &0410,X ; player_bullets_x_velocity # Set to zero to indicate no bullet in slot &1407 95 20 STA &20,X ; enemies_type # Set to zero to indicate no enemy in slot &1409 95 50 STA &50,X ; enemies_previous_type &140b ca DEX &140c 10 f6 BPL &1404 ; initialise_player_bullets_loop &140e a9 41 LDA #&41 ; SPRITE_PLAYER_STANDING &1410 85 86 STA &86 ; player_sprite &1412 85 6f STA &6f ; player_previous_sprite &1414 a9 00 LDA #&00 &1416 85 6d STA &6d ; player_flipped # Set to positive to indicate player facing right &1418 85 6e STA &6e ; player_previous_flipped &141a a2 25 LDX #&25 &141c 86 69 STX &69 ; player_x &141e 86 6c STX &6c ; player_previous_x &1420 a0 a0 LDY #&a0 &1422 84 6a STY &6a ; player_y &1424 84 6b STY &6b ; player_previous_y &1426 4c 52 13 JMP &1352 ; replot_player ; start_demo &1429 20 d0 1a JSR &1ad0 ; reset_screen &142c a9 f6 LDA #&f6 &142e 8d 7b 14 STA &147b ; player_controlled_by_computer # Set to negative to indicate demo mode (see &1297) &1431 a9 00 LDA #&00 &1433 8d 30 01 STA &0130 ; player_killed # Set to zero to indicate player not killed &1436 8d 56 01 STA &0156 ; background_checkpoint &1439 85 68 STA &68 ; area_sprite_base # Set to zero to use area one sprites &143b 20 0d 1b JSR &1b0d ; initialise_area &143e 20 ef 13 JSR &13ef ; initialise_player_and_bullets ; demo_loop &1441 20 b4 0f JSR &0fb4 ; update_halo &1444 20 2a 13 JSR &132a ; replot_player_and_background &1447 20 69 11 JSR &1169 ; update_player &144a 20 7c 14 JSR &147c ; consider_adding_enemies &144d 20 57 15 JSR &1557 ; update_enemies &1450 20 c6 1e JSR &1ec6 ; replot_enemies &1453 ad 30 01 LDA &0130 ; player_killed &1456 d0 15 BNE &146d ; was_killed &1458 a9 81 LDA #&81 ; Scan for a particular key &145a a2 9d LDX #&9d ; SPACE &145c a0 ff LDY #&ff &145e 20 f4 ff JSR &fff4 ; OSBYTE &1461 e0 ff CPX #&ff &1463 d0 dc BNE &1441 ; demo_loop # Continue demo until SPACE pressed &1465 a9 00 LDA #&00 &1467 8d 33 01 STA &0133 ; new_helicopter_cooldown &146a 4c d0 1a JMP &1ad0 ; reset_screen ; was_killed # or player is killed &146d 20 7d 1a JSR &1a7d ; reset_area &1470 a9 00 LDA #&00 &1472 8d 33 01 STA &0133 ; new_helicopter_cooldown &1475 aa TAX &1476 a9 0f LDA #&0f ; Flush all buffers &1478 4c f4 ff JMP &fff4 ; OSBYTE ; player_controlled_by_computer &147b 00 ; consider_adding_enemies &147c ad 33 01 LDA &0133 ; new_helicopter_cooldown &147f f0 03 BEQ &1484 ; skip_helicopter_cooldown &1481 ce 33 01 DEC &0133 ; new_helicopter_cooldown ; skip_helicopter_cooldown &1484 ad 34 01 LDA &0134 ; new_soldier_or_jeep_cooldown &1487 f0 03 BEQ &148c ; skip_soldier_or_jeep_cooldown &1489 ce 34 01 DEC &0134 ; new_soldier_or_jeep_cooldown ; skip_soldier_or_jeep_cooldown &148c 20 af 1f JSR &1faf ; rnd &148f cd 4f 01 CMP &014f ; probability_of_adding_enemy_or_bullet &1492 90 01 BCC &1495 ; is_ok &1494 60 RTS ; is_ok &1495 ad 55 01 LDA &0155 ; next_free_enemy_slot &1498 10 01 BPL &149b ; is_free_slot ; leave &149a 60 RTS ; is_free_slot &149b 48 PHA ; next_free_enemy_slot &149c 20 af 1f JSR &1faf ; rnd &149f 29 03 AND #&03 # 1 in 4 chance of adding helicopter or jeep &14a1 f0 23 BEQ &14c6 ; consider_adding_new_helicopter_or_jeep ; consider_adding_new_soldier &14a3 68 PLA ; next_free_enemy_slot &14a4 aa TAX &14a5 ad 3e 01 LDA &013e ; suppress_new_enemies_because_of_hole # Non-zero if bottom right of screen is a hole &14a8 d0 f0 BNE &149a ; leave &14aa ad 34 01 LDA &0134 ; new_soldier_or_jeep_cooldown &14ad d0 eb BNE &149a ; leave &14af a9 01 LDA #&01 ; ENEMY_TYPE_SOLDIER &14b1 95 20 STA &20,X ; enemies_type &14b3 a9 47 LDA #&47 ; SPRITE_SOLDIER_WALKING_ONE &14b5 95 00 STA &00,X ; enemies_sprite &14b7 a9 a0 LDA #&a0 &14b9 95 10 STA &10,X ; enemies_y &14bb a9 4a LDA #&4a &14bd 95 08 STA &08,X ; enemies_x &14bf a9 06 LDA #&06 &14c1 8d 34 01 STA &0134 ; new_soldier_or_jeep_cooldown &14c4 d0 55 BNE &151b ; plot_new_enemy_with_powerups # Always branches ; consider_adding_new_helicopter_or_jeep &14c6 20 af 1f JSR &1faf ; rnd &14c9 c9 73 CMP #&73 # 115 in 256 chance of helicopter &14cb b0 29 BCS &14f6 ; consider_adding_new_jeep ; add_new_helicopter &14cd 68 PLA ; next_free_enemy_slot &14ce aa TAX &14cf ad 33 01 LDA &0133 ; new_helicopter_cooldown &14d2 d0 c6 BNE &149a ; leave &14d4 a9 02 LDA #&02 ; ENEMY_TYPE_HELICOPTER &14d6 95 20 STA &20,X ; enemies_type &14d8 a9 4e LDA #&4e ; SPRITE_HELICOPTER &14da 95 00 STA &00,X ; enemies_sprite &14dc a9 60 LDA #&60 ; SPRITE_ROTORS_ONE &14de 95 60 STA &60,X ; enemies_rotor_sprite &14e0 86 70 STX &70 ; enemy &14e2 20 af 1f JSR &1faf ; rnd &14e5 a6 70 LDX &70 ; enemy &14e7 29 7f AND #&7f # Set random y position for helicopter &14e9 95 10 STA &10,X ; enemies_y &14eb a9 42 LDA #&42 &14ed 95 08 STA &08,X ; enemies_x &14ef a9 18 LDA #&18 &14f1 8d 33 01 STA &0133 ; new_helicopter_cooldown &14f4 d0 2a BNE &1520 ; plot_new_enemy # Always branches ; consider_adding_new_jeep &14f6 68 PLA ; next_free_enemy_slot &14f7 aa TAX &14f8 ad 3e 01 LDA &013e ; suppress_new_enemies_because_of_hole # Non-zero if bottom right of screen is a hole &14fb d0 9d BNE &149a ; leave &14fd ad 34 01 LDA &0134 ; new_soldier_or_jeep_cooldown &1500 d0 98 BNE &149a ; leave &1502 a9 0a LDA #&0a ; ENEMY_TYPE_JEEP &1504 95 20 STA &20,X ; enemies_type &1506 a9 5f LDA #&5f ; SPRITE_JEEP &1508 95 00 STA &00,X ; enemies_sprite &150a a9 a3 LDA #&a3 &150c 95 10 STA &10,X ; enemies_y &150e a9 43 LDA #&43 &1510 95 08 STA &08,X ; enemies_x &1512 a9 ff LDA #&ff &1514 95 18 STA &18,X ; enemies_x_velocity &1516 a9 0c LDA #&0c &1518 8d 34 01 STA &0134 ; new_soldier_or_jeep_cooldown ; plot_new_enemy_with_powerups &151b a9 01 LDA #&01 &151d 9d 70 01 STA &0170,X ; enemies_explosion_type # Set to one to drop powerup when destroyed ; plot_new_enemy &1520 a9 00 LDA #&00 &1522 95 28 STA &28,X ; enemies_timer_jump_or_hit_count &1524 a9 ff LDA #&ff &1526 95 18 STA &18,X ; enemies_x_velocity &1528 8d 55 01 STA &0155 ; next_free_enemy_slot &152b 4c 97 15 JMP &1597 ; plot_enemy ; backup_enemy_variables &152e b5 20 LDA &20,X ; enemies_type &1530 95 50 STA &50,X ; enemies_previous_type &1532 b5 00 LDA &00,X ; enemies_sprite &1534 95 30 STA &30,X ; enemies_previous_sprite &1536 b5 08 LDA &08,X ; enemies_x &1538 95 38 STA &38,X ; enemies_previous_x &153a b5 10 LDA &10,X ; enemies_y &153c 95 40 STA &40,X ; enemies_previous_y &153e b5 18 LDA &18,X ; enemies_x_velocity &1540 95 48 STA &48,X ; enemies_previous_flipped &1542 60 RTS ; update_routine_addresses_table &1543 3a 16 ; &01 (ENEMY_TYPE_SOLDIER) : &163a = update_enemy_soldier &1545 14 18 ; &02 (ENEMY_TYPE_HELICOPTER) : &1814 = update_enemy_helicopter &1547 cf 15 ; &03 (ENEMY_TYPE_EXPLOSION) : &15cf = update_explosion &1549 a7 17 ; &04 (ENEMY_TYPE_BULLET) : &17a7 = update_enemy_bullet &154b 27 19 ; &05 (ENEMY_TYPE_BOSS) : &1927 = update_enemy_boss &154d b0 19 ; &06 (ENEMY_TYPE_BOMB_OR_GRENADE) : &19b0 = update_enemy_bomb_or_grenade &154f 13 1a ; &07 (ENEMY_TYPE_PARACHUTE) : &1a13 = update_parachute &1551 6b 1a ; &08 (ENEMY_TYPE_PARACHUTE_SCORE) : &1a6b = update_parachute_score &1553 28 1c ; &09 (ENEMY_TYPE_POWERUP) : &1c28 = update_powerup &1555 a8 1d ; &0a (ENEMY_TYPE_JEEP) : &1da8 = update_enemy_jeep ; update_enemies &1557 ad 5c 01 LDA &015c ; suppress_animations &155a 49 ff EOF #&ff # Animate enemies one in two updates &155c 8d 5c 01 STA &015c ; suppress_animations &155f a9 00 LDA #&00 &1561 8d 3f 01 STA &013f ; unused # Unused variable &1564 a2 07 LDX #&07 ; update_enemies_loop &1566 20 2e 15 JSR &152e ; backup_enemy_variables &1569 b5 20 LDA &20,X ; enemies_type &156b d0 0d BNE &157a ; update_enemy &156d 86 83 STX &83 ; enemy &156f a9 32 LDA #&32 ; 50 &1571 20 f3 1e JSR &1ef3 ; delay_for_A &1574 8e 55 01 STX &0155 ; next_free_enemy_slot &1577 4c 91 15 JMP &1591 ; consider_next_enemy ; update_enemy &157a 86 83 STX &83 ; enemy &157c b5 20 LDA &20,X ; enemies_type &157e 0a ASL A &157f a8 TAY &1580 88 DEY &1581 88 DEY &1582 b9 43 15 LDA &1543,Y ; update_routine_addresses_table &1585 8d 8f 15 STA &158f ; update_routine_address_low &1588 b9 44 15 LDA &1544,Y ; update_routine_addresses_table + 1 &158b 8d 90 15 STA &1590 ; update_routine_address_high &158e 20 00 00 JSR &0000 # actually JSR update_routine_address ; consider_next_enemy &1591 a6 83 LDX &83 ; enemy &1593 ca DEX &1594 10 d0 BPL &1566 ; update_enemies_loop &1596 60 RTS ; plot_enemy &1597 b5 20 LDA &20,X ; enemies_type &1599 c9 02 CMP #&02 ; ENEMY_TYPE_HELICOPTER &159b d0 19 BNE &15b6 ; not_helicopter ; is_helocopter &159d 86 f8 STX &f8 ; enemy_type &159f b5 10 LDA &10,X ; enemies_y &15a1 a8 TAY &15a2 88 DEY &15a3 88 DEY &15a4 88 DEY &15a5 b5 08 LDA &08,X ; enemies_x &15a7 85 f9 STA &f9 ; enemy_x &15a9 8a TXA &15aa 29 07 AND #&07 &15ac aa TAX &15ad b5 60 LDA &60,X ; enemies_rotor_sprite &15af a6 f9 LDX &f9 ; enemy_x &15b1 20 20 0d JSR &0d20 ; plot_sprite # Plot helicopter rotor &15b4 a6 f8 LDX &f8 ; enemy_type ; not_helicopter &15b6 b5 10 LDA &10,X ; enemies_y &15b8 a8 TAY &15b9 b5 00 LDA &00,X ; enemies_sprite &15bb 48 PHA ; enemy_sprite &15bc b5 08 LDA &08,X ; enemies_x &15be 48 PHA ; enemy_x &15bf b5 18 LDA &18,X ; enemies_x_velocity &15c1 10 06 BPL &15c9 ; is_flipped ; not_flipped &15c3 68 PLA ; enemy_x &15c4 aa TAX &15c5 68 PLA ; enemy_sprite &15c6 4c 20 0d JMP &0d20 ; plot_sprite ; is_flipped &15c9 68 PLA ; enemy_x &15ca aa TAX &15cb 68 PLA ; enemy_sprite &15cc 4c fc 0d JMP &0dfc ; plot_flipped_sprite ; update_explosion &15cf 20 d0 17 JSR &17d0 ; check_for_deadly_collision_with_player # Returns A = &ff if collision with player &15d2 a6 83 LDX &83 ; enemy &15d4 c9 ff CMP #&ff &15d6 d0 05 BNE &15dd ; skip_killing_player &15d8 a9 ff LDA #&ff # Unnecessary code &15da 8d 30 01 STA &0130 ; player_killed # Set to negative to kill player (hitting explosion) ; skip_killing_player &15dd b5 08 LDA &08,X ; enemies_x &15df f0 18 BEQ &15f9 ; remove_explosion # Remove explosion at left of screen &15e1 b5 10 LDA &10,X ; enemies_y &15e3 c9 b8 CMP #&b8 &15e5 b0 12 BCS &15f9 ; remove_explosion # Remove explosion if off top or bottom edges of screen &15e7 ad 5c 01 LDA &015c ; suppress_animations &15ea 30 01 BMI &15ed ; animate_explosion &15ec 60 RTS ; animate_explosion &15ed b5 00 LDA &00,X ; enemies_sprite &15ef 18 CLC &15f0 69 01 ADC #&01 # Animate explosion &15f2 95 00 STA &00,X ; enemies_sprite &15f4 c9 4e CMP #&4e ; SPRITE_EXPLOSION_THREE + 1 &15f6 f0 01 BEQ &15f9 ; remove_explosion &15f8 60 RTS ; remove_explosion &15f9 a9 00 LDA #&00 ; ENEMY_TYPE_NONE &15fb 95 20 STA &20,X ; enemies_type &15fd bd 70 01 LDA &0170,X ; enemies_explosion_type &1600 d0 01 BNE &1603 ; replace_explosion_with_powerup_or_soldier &1602 60 RTS ; replace_explosion_with_powerup_or_soldier &1603 30 1b BMI &1620 ; boss_destroyed &1605 c9 01 CMP #&01 &1607 f0 1b BEQ &1624 ; replace_explosion_with_powerup ; replace_explosion_with_soldier &1609 b5 10 LDA &10,X ; enemies_y &160b c9 a0 CMP #&a0 &160d 90 02 BCC &1611 ; skip_celing &160f a9 a0 LDA #&a0 ; skip_ceiling &1611 95 10 STA &10,X ; enemies_y &1613 a9 01 LDA #&01 ; ENEMY_TYPE_SOLDIER &1615 95 20 STA &20,X ; enemies_type &1617 a9 4a LDA #&4a ; SPRITE_SOLDIER_JUMPING &1619 95 00 STA &00,X ; enemies_sprite &161b a9 0b LDA #&0b # Set soldier falling from destroyed helicopter or jeep &161d 95 28 STA &28,X ; enemies_timer_jump_or_hit_count # Used as jump timer for soldier &161f 60 RTS ; boss_destroyed &1620 8d 3a 01 STA &013a ; area_complete # Set to non-zero to indicate boss destroyed &1623 60 RTS ; replace_explosion_with_powerup &1624 f6 08 INC &08,X ; enemies_x &1626 b5 10 LDA &10,X ; enemies_y &1628 18 CLC &1629 69 02 ADC #&02 &162b 95 10 STA &10,X ; enemies_y &162d a9 09 LDA #&09 ; ENEMY_TYPE_POWERUP &162f 95 20 STA &20,X ; enemies_type &1631 a9 54 LDA #&54 ; SPRITE_POWERUP &1633 95 00 STA &00,X ; enemies_sprite &1635 a9 00 LDA #&00 &1637 95 28 STA &28,X ; enemies_timer_jump_or_hit_count # Used as timer for powerup &1639 60 RTS ; update_enemy_soldier &163a 20 d0 18 JSR &18d0 ; check_for_collision_with_player_bullets # Returns A = &ff if hit by player bullet &163d a6 83 LDX &83 ; enemy &163f c9 ff CMP #&ff &1641 d0 28 BNE &166b ; not_hit_by_player_bullet &1643 a9 00 LDA #&00 &1645 9d 70 01 STA &0170,X ; enemies_explosion_type # Set to zero to suppress dropping powerup by default &1648 a9 4b LDA #&4b ; SPRITE_EXPLOSION_ONE &164a 95 00 STA &00,X ; enemies_sprite &164c a9 03 LDA #&03 ; ENEMY_TYPE_EXPLOSION &164e 95 20 STA &20,X ; enemies_type &1650 a9 00 LDA #&00 &1652 20 80 08 JSR &0880 ; play_sound # Play sound for destroying soldier &1655 20 af 1f JSR &1faf ; rnd &1658 a6 83 LDX &83 ; enemy &165a c9 2f CMP #&2f # 47 in 256 chance of dropping powerup # actually CMP probability_of_dropping_powerup # 99 in 256 chance of dropping powerup in cheat mode &165c b0 05 BCS &1663 ; skip_dropping_powerup &165e a9 01 LDA #&01 &1660 9d 70 01 STA &0170,X ; enemies_explosion_type # Set to one to drop powerup ; skip_dropping_powerup &1663 a9 01 LDA #&01 # Score 100 for destroying soldier &1665 8d 2a 01 STA &012a ; score_delta + 2 &1668 4c df 1c JMP &1cdf ; add_to_score ; not_hit_by_player_bullet &166b 20 d0 17 JSR &17d0 ; check_for_deadly_collision_with_player # Returns &ff if collision with player &166e a6 83 LDX &83 ; enemy &1670 c9 ff CMP #&ff &1672 d0 03 BNE &1677 ; skip_killing_player &1674 8d 30 01 STA &0130 ; player_killed # Set to negative to kill player (hitting soldier) ; skip_killing_player &1677 b5 08 LDA &08,X ; enemies_x &1679 18 CLC &167a 75 18 ADC &18,X ; enemies_x_velocity # Move soldier horizontally &167c 95 08 STA &08,X ; enemies_x &167e a8 TAY &167f 88 DEY &1680 88 DEY &1681 10 05 BPL &1688 ; not_at_left_edge ; at_left_edge &1683 a9 00 LDA #&00 ; ENEMY_TYPE_NONE # Remove soldier at left edge of screen &1685 95 20 STA &20,X ; enemies_type &1687 60 RTS ; not_at_left_edge &1688 c9 4b CMP #&4b &168a 90 08 BCC &1694 ; not_at_right_edge ; at_right_edge &168c a9 4a LDA #&4a ; SPRITE_SOLDIER_JUMPING &168e 95 08 STA &08,X ; enemies_x &1690 a9 ff LDA #&ff # Set soldier moving left at right edge of screen &1692 95 18 STA &18,X ; enemies_x_velocity ; not_at_right_edge &1694 20 39 17 JSR &1739 ; consider_adding_enemy_bullet &1697 a6 83 LDX &83 ; enemy &1699 b5 28 LDA &28,X ; enemies_timer_jump_or_hit_count &169b d0 48 BNE &16e5 ; update_jumping_soldier ; not_jumping &169d 20 af 1f JSR &1faf ; rnd &16a0 a6 83 LDX &83 ; enemy &16a2 c9 0a CMP #&0a # 10 in 256 chance of soldier starting jump &16a4 b0 06 BCS &16ac ; skip_starting_jump &16a6 a9 01 LDA #&01 # Set soldier jumping &16a8 95 28 STA &28,X ; enemies_timer_jump_or_hit_count # Used as jump timer for soldier &16aa d0 39 BNE &16e5 ; update_jumping_soldier # Always branches ; skip_starting_jump &16ac b5 10 LDA &10,X ; enemies_y &16ae 18 CLC &16af 69 18 ADC #&18 &16b1 a8 TAY &16b2 b5 08 LDA &08,X ; enemies_x &16b4 aa TAX &16b5 e8 INX &16b6 e8 INX &16b7 a9 01 LDA #&01 ; width &16b9 20 37 11 JSR &1137 ; check_for_support # Returns A = &ff if supported &16bc a6 83 LDX &83 ; enemy &16be a8 TAY &16bf d0 0a BNE &16cb ; skip_flipping_soldier ; not_supported &16c1 b5 18 LDA &18,X ; enemies_x_velocity &16c3 49 fe EOR #&fe # Flip soldier at end of platform &16c5 95 18 STA &18,X ; enemies_x_velocity &16c7 a9 0a LDA #&0a # Set soldier falling &16c9 95 28 STA &28,X ; enemies_timer_jump_or_hit_count # Used as jump timer for soldier ; skip_flipping_soldier &16cb ad 5c 01 LDA &015c ; suppress_animations &16ce 30 14 BMI &16e4 ; leave &16d0 bd 70 01 LDA &0170,X ; enemies_explosion_type # Used as animation direction for soldiers &16d3 18 CLC &16d4 75 00 ADC &00,X ; enemies_sprite &16d6 95 00 STA &00,X ; enemies_sprite &16d8 c9 48 CMP #&48 ; SPRITE_SOLDIER_WALKING_TWO # Change direction of animation at end frames, i.e. &16da f0 08 BEQ &16e4 ; leave # use sprites ONE, TWO, THREE, TWO, ONE, TWO ... &16dc bd 70 01 LDA &0170,X ; enemies_explosion_type &16df 49 fe EOR #&fe # Alternate between &01 and &ff &16e1 9d 70 01 STA &0170,X ; enemies_explosion_type ; leave &16e4 60 RTS ; update_jumping_soldier &16e5 b5 28 LDA &28,X ; enemies_timer_jump_or_hit_count # Used as jump timer for soldier &16e7 a8 TAY &16e8 f6 28 INC &28,X ; enemies_timer_jump_or_hit_count &16ea b9 94 08 LDA &0894,Y ; jump_table &16ed 10 10 BPL &16ff ; is_falling_down ; is_jumping_up &16ef 18 CLC &16f0 75 10 ADC &10,X ; enemies_y &16f2 95 10 STA &10,X ; enemies_y &16f4 b0 04 BCS &16fa ; skip_floor &16f6 a9 00 LDA #&00 # Don't allow soldier to jump beyond top of screen &16f8 95 10 STA &10,X ; enemies_y ; skip_floor &16fa a9 4a LDA #&4a ; SPRITE_SOLDIER_JUMPING # Fixed sprite if soldier is jumping &16fc 95 00 STA &00,X ; enemies_sprite &16fe 60 RTS ; is_falling_down &16ff 18 CLC &1700 75 10 ADC &10,X ; enemies_y &1702 85 7b STA &7b ; new_y ; apply_enemy_y_velocity_loop &1704 b5 10 LDA &10,X ; enemies_y &1706 18 CLC &1707 69 18 ADC #&18 &1709 a8 TAY &170a b5 08 LDA &08,X ; enemies_x &170c aa TAX &170d e8 INX &170e e8 INX &170f a9 01 LDA #&01 ; width &1711 20 37 11 JSR &1137 ; check_for_support # Returns A = &ff if supported &1714 a6 83 LDX &83 ; enemy &1716 a8 TAY &1717 f0 0e BEQ &1727 ; continue_falling ; is_supported &1719 a9 47 LDA #&47 ; SPRITE_SOLDIER_WALKING_ONE &171b 95 00 STA &00,X ; enemies_sprite &171d a9 00 LDA #&00 &171f 95 28 STA &28,X ; enemies_timer_jump_or_hit_count # Used as jump timer for soldier &1721 a9 01 LDA #&01 &1723 9d 70 01 STA &0170,X ; enemies_explosion_type # Used as animation direction for soldiers &1726 60 RTS ; continue_falling &1727 f6 10 INC &10,X ; enemies_y &1729 b5 10 LDA &10,X ; enemies_y &172b c5 7b CMP &7b ; new_y &172d 90 d5 BCC &1704 ; apply_enemy_y_velocity_loop &172f c9 b0 CMP #&b0 &1731 b0 01 BCS &1734 ; at_bottom_of_screen &1733 60 RTS ; at_bottom_of_screen &1734 a9 00 LDA #&00 ; ENEMY_TYPE_NONE &1736 95 20 STA &20,X ; enemies_type # Remove soldiers that fall into bottom of screen &1738 60 RTS ; consider_adding_enemy_bullet &1739 20 af 1f JSR &1faf ; rnd &173c a6 83 LDX &83 ; enemy &173e cd 4f 01 CMP &014f ; probability_of_adding_enemy_or_bullet &1741 90 01 BCC &1744 ; is_ok &1743 60 RTS ; is_ok &1744 ac 55 01 LDY &0155 ; next_free_enemy_slot &1747 10 01 BPL &174a ; is_free_slot &1749 60 RTS ; is_free_slot &174a b5 10 LDA &10,X ; enemies_y &174c 18 CLC &174d 69 06 ADC #&06 &174f 99 10 00 STA &0010,Y ; enemies_y &1752 b5 18 LDA &18,X ; enemies_x_velocity &1754 10 16 BPL &176c ; add_enemy_bullet_to_right ; add_enemy_bullet_to_left &1756 a9 fe LDA #&fe # Set bullet moving left &1758 99 18 00 STA &0018,Y ; enemies_x_velocity &175b b5 08 LDA &08,X ; enemies_x &175d 38 SEC &175e e9 02 SBC #&02 &1760 99 08 00 STA &0008,Y ; enemies_x &1763 10 01 BPL &1766 ; not_beyond_left_edge &1765 60 RTS ; not_beyond_left_edge &1766 d0 01 BNE &1769 ; not_at_left_edge &1768 60 RTS ; not_at_left_edge &1769 4c 86 17 JMP &1786 ; add_enemy_bullet ; add_enemy_bullet_to_right &176c 84 70 STY &70 ; bullet &176e b5 00 LDA &00,X ; enemies_sprite &1770 a8 TAY &1771 b9 f0 09 LDA &09f0,Y ; sprite_widths_table &1774 18 CLC &1775 75 08 ADC &08,X ; enemies_x &1777 a4 70 LDY &70 ; bullet &1779 99 08 00 STA &0008,Y ; enemies_x &177c c9 4c CMP #&4c &177e 90 01 BCC &1781 ; not_at_right_edge &1780 60 RTS ; not_at_right_edge &1781 a9 02 LDA #&02 # Set bullet moving right &1783 99 18 00 STA &0018,Y ; enemies_x_velocity ; add_enemy_bullet &1786 a9 04 LDA #&04 ; ENEMY_TYPE_BULLET &1788 99 20 00 STA &0020,Y ; enemies_type &178b a9 00 LDA #&00 &178d 99 28 00 STA &0028,Y ; enemies_timer_jump_or_hit_count # Unused for enemy bullet &1790 a9 40 LDA #&40 ; SPRITE_ENEMY_BULLET &1792 99 00 00 STA &0000,Y ; enemies_sprite &1795 a9 ff LDA #&ff &1797 8d 55 01 STA &0155 ; next_free_enemy_slot &179a 98 TYA &179b aa TAX &179c 20 2e 15 JSR &152e ; backup_enemy_variables &179f 20 97 15 JSR &1597 ; plot_enemy # Plot new bullet &17a2 a9 01 LDA #&01 &17a4 4c 80 08 JMP &0880 ; play_sound # Play sound for enemy firing bullet ; update_enemy_bullet &17a7 a9 1d LDA #&1d &17a9 20 f3 1e JSR &1ef3 ; delay_for_A &17ac 20 d0 17 JSR &17d0 ; check_for_deadly_collision_with_player # Returns A = &ff if collision with player &17af f0 0a BEQ &17bb ; skip_killing_player &17b1 a9 ff LDA #&ff &17b3 8d 30 01 STA &0130 ; player_killed # Set to negative to kill player (hitting bullet) &17b6 a9 00 LDA #&00 ; ENEMY_TYPE_NONE &17b8 95 20 STA &20,X ; enemies_type # Remove bullet &17ba 60 RTS ; skip_killing_player &17bb b5 08 LDA &08,X ; enemies_x &17bd 18 CLC &17be 75 18 ADC &18,X ; enemies_x_velocity &17c0 95 08 STA &08,X ; enemies_x &17c2 30 07 BMI &17cb ; remove_enemy_bullet # Remove enemy bullet at left of screen &17c4 f0 05 BEQ &17cb ; remove_enemy_bullet &17c6 c9 4c CMP #&4c &17c8 b0 01 BCS &17cb ; remove_enemy_bullet # Remove enemy bullet at right of screen &17ca 60 RTS ; remove_enemy_bullet &17cb a9 00 LDA #&00 ; ENEMY_TYPE_NONE &17cd 95 20 STA &20,X ; enemies_type &17cf 60 RTS ; check_for_deadly_collision_with_player &17d0 ad 40 01 LDA &0140 ; player_invulnerability_timer # Non-zero if player is invulnerable &17d3 d0 3c BNE &1811 ; leave_with_zero &17d5 b5 00 LDA &00,X ; enemies_sprite &17d7 a8 TAY &17d8 b9 f0 09 LDA &09f0,Y ; sprite_widths_table &17db 18 CLC &17dc 75 08 ADC &08,X ; enemies_x &17de c5 69 CMP &69 ; player_x &17e0 90 2f BCC &1811 ; leave_with_zero &17e2 b9 68 0a LDA &0a68,Y ; sprite_heights_table &17e5 18 CLC &17e6 75 10 ADC &10,X ; enemies_y &17e8 85 87 STA &87 ; y &17ea ad 42 01 LDA &0142 ; player_is_ducking # Negative if player is ducking &17ed f0 07 BEQ &17f6 ; not_ducking &17ef a5 87 LDA &87 ; y &17f1 38 SEC &17f2 e9 0c SBC #&0c &17f4 85 87 STA &87 ; y ; not_ducking &17f6 a5 87 LDA &87 ; y &17f8 c5 6a CMP &6a ; player_y &17fa 90 15 BCC &1811 ; leave_with_zero &17fc a5 69 LDA &69 ; player_x &17fe 18 CLC &17ff 69 06 ADC #&06 &1801 d5 08 CMP &08,X ; enemies_x &1803 90 0c BCC &1811 ; leave_with_zero &1805 a5 6a LDA &6a ; player_y &1807 18 CLC &1808 69 18 ADC #&18 &180a d5 10 CMP &10,X ; enemies_y &180c 90 03 BCC &1811 ; leave_with_zero &180e a9 ff LDA #&ff # Leave with &ff to indicate collision with player &1810 60 RTS ; leave_with_zero &1811 a9 00 LDA #&00 # Leave with &00 to indicate no collision with player &1813 60 RTS ; update_enemy_helicopter &1814 20 d0 18 JSR &18d0 ; check_for_collision_with_player_bullets # Returns A = &ff if hit by player bullet &1817 a6 83 LDX &83 ; enemy &1819 a8 TAY &181a f0 27 BEQ &1843 ; not_hit_by_bullet &181c b5 28 LDA &28,X ; enemies_timer_jump_or_hit_count # Used as hit counter for helicopters &181e 18 CLC &181f 69 01 ADC #&01 &1821 95 28 STA &28,X ; enemies_timer_jump_or_hit_count &1823 c9 03 CMP #&03 # Helicopters need three hits to destroy &1825 90 1c BCC &1843 ; not_hit_by_bullet &1827 a9 03 LDA #&03 ; ENEMY_TYPE_EXPLOSION &1829 95 20 STA &20,X ; enemies_type &182b 9d 70 01 STA &0170,X ; enemies_explosion_type # Set to three to drop soldier &182e f6 08 INC &08,X ; enemies_x &1830 f6 08 INC &08,X ; enemies_x &1832 a9 4b LDA #&4b ; SPRITE_EXPLOSION_ONE &1834 95 00 STA &00,X ; enemies_sprite &1836 a9 00 LDA #&00 &1838 20 80 08 JSR &0880 ; play_sound # Play sound for destroying helicopter &183b a9 05 LDA #&05 # Score 500 for destroying helicopter &183d 8d 2a 01 STA &012a ; score_delta + 2 &1840 4c df 1c JMP &1cdf ; add_to_score ; not_hit_by_bullet &1843 20 d0 17 JSR &17d0 ; check_for_deadly_collision_with_player # Returns A = &ff if collision with player &1846 a6 83 LDX &83 ; enemy &1848 a8 TAY &1849 f0 06 BEQ &1851 ; skip_killing_player &184b a9 ff LDA #&ff &184d 8d 30 01 STA &0130 ; player_killed # Set to negative to kill player (hitting helicopter) &1850 60 RTS ; skip_killing_player &1851 b5 08 LDA &08,X ; enemies_x &1853 38 SEC &1854 e9 02 SBC #&02 &1856 b0 05 BCS &185d ; skip_removing_helicopter # Remove helicopter at left of screen &1858 a9 00 LDA #&00 ; ENEMY_TYPE_NONE &185a 95 20 STA &20,X ; enemies_type &185c 60 RTS ; skip_removing_helicopter &185d ad 5c 01 LDA &015c ; suppress_animations &1860 f0 02 BEQ &1864 ; skip_moving_helicopter &1862 d6 08 DEC &08,X ; enemies_x # Move helicopter left one in two updates ; skip_moving_helicopter &1864 20 87 18 JSR &1887 ; consider_adding_enemy_bomb &1867 a6 83 LDX &83 ; enemy &1869 a9 02 LDA #&02 # Move helicopter down if not below player &186b 85 70 STA &70 ; y_velocity &186d b5 10 LDA &10,X ; enemies_y &186f c5 6a CMP &6a ; player_y &1871 90 04 BCC &1877 ; not_below_player &1873 a9 fe LDA #&fe # Move helicopter up if below player &1875 85 70 STA &70 ; y_velocity ; not_below_player &1877 a5 70 LDA &70 ; y_velocity &1879 18 CLC &187a 75 10 ADC &10,X ; enemies_y &187c 95 10 STA &10,X ; enemies_y &187e c9 c8 CMP #&c8 &1880 90 04 BCC &1886 ; skip_floor # Don't allow player to go above top of screen &1882 a9 00 LDA #&00 &1884 95 10 STA &10,X ; enemies_y ; skip_floor &1886 60 RTS ; consider_adding_enemy_bomb &1887 ac 55 01 LDY &0155 ; next_free_enemy_slot &188a 10 01 BPL &188d ; is_free_slot &188c 60 RTS ; is_free_slot &188d 20 af 1f JSR &1faf ; rnd &1890 a6 83 LDX &83 ; enemy &1892 ac 55 01 LDY &0155 ; next_free_enemy_slot &1895 c9 10 CMP #&10 # 16 in 256 chance of helicopter dropping bomb &1897 90 01 BCC &189a ; is_ok &1899 60 RTS ; is_ok &189a b5 08 LDA &08,X ; enemies_x &189c 18 CLC &189d 69 02 ADC #&02 &189f 99 08 00 STA &0008,Y ; enemies_x &18a2 b5 10 LDA &10,X ; enemies_y &18a4 18 CLC &18a5 69 10 ADC #&10 &18a7 99 10 00 STA &0010,Y ; enemies_y &18aa a9 06 LDA #&06 ; ENEMY_TYPE_BOMB_OR_GRENADE &18ac 99 20 00 STA &0020,Y ; enemies_type &18af a9 ff LDA #&ff # Set bomb moving left &18b1 99 18 00 STA &0018,Y ; enemies_x_velocity &18b4 a9 51 LDA #&51 ; SPRITE_BOMB &18b6 99 00 00 STA &0000,Y ; enemies_sprite &18b9 a9 ff LDA #&ff &18bb 8d 55 01 STA &0155 ; next_free_enemy_slot &18be a9 0d LDA #&0d # Set bomb falling &18c0 99 28 00 STA &0028,Y ; enemies_timer_jump_or_hit_count # Used as jump timer for bombs &18c3 98 TYA &18c4 aa TAX &18c5 20 2e 15 JSR &152e ; backup_enemy_variables &18c8 20 97 15 JSR &1597 ; plot_enemy # Plot new bomb &18cb a9 03 LDA #&03 &18cd 4c 80 08 JMP &0880 ; play_sound # Play sound for helicopter dropping bomb ; check_for_collision_with_player_bullets &18d0 86 71 STX &71 ; enemy &18d2 ae 59 01 LDX &0159 ; number_of_player_player_bullets ; check_for_collision_with_player_bullets_loop &18d5 86 70 STX &70 ; player_bullet &18d7 bd 10 04 LDA &0410,X ; player_bullets_x_velocity # Zero if no player bullet in slot &18da f0 43 BEQ &191f ; consider_next_player_bullet &18dc bd 00 04 LDA &0400,X ; player_bullets_x &18df 85 90 STA &90 ; bullet_x &18e1 bd 08 04 LDA &0408,X ; player_bullets_y &18e4 85 91 STA &91 ; bullet_y &18e6 86 70 STX &70 ; player_bullet # Unnecessary code &18e8 a6 71 LDX &71 ; enemy &18ea b5 00 LDA &00,X ; enemies_sprite &18ec a8 TAY &18ed b9 f0 09 LDA &09f0,Y ; sprite_widths_table &18f0 18 CLC &18f1 75 08 ADC &08,X ; enemies_x &18f3 c5 90 CMP &90 ; screen_address_low &18f5 90 28 BCC &191f ; consider_next_player_bullet &18f7 b9 68 0a LDA &0a68,Y ; sprite_heights_table &18fa 18 CLC &18fb 75 10 ADC &10,X ; enemies_y &18fd c5 91 CMP &91 ; screen_address_high &18ff 90 1e BCC &191f ; consider_next_player_bullet &1901 e6 90 INC &90 ; bullet_x &1903 e6 91 INC &91 ; bullet_y &1905 e6 91 INC &91 ; bullet_y &1907 e6 91 INC &91 ; bullet_y &1909 a5 90 LDA &90 ; bullet_x &190b d5 08 CMP &08,X ; enemies_x &190d 90 10 BCC &191f ; consider_next_player_bullet &190f a5 91 LDA &91 ; bullet_y &1911 d5 10 CMP &10,X ; enemies_y &1913 90 0a BCC &191f ; consider_next_player_bullet &1915 a6 70 LDX &70 ; player_bullet &1917 a9 80 LDA #&80 &1919 9d 10 04 STA &0410,X ; player_bullets_x_velocity # Set to &80 to indicate bullet hit an enemy &191c a9 ff LDA #&ff # Leave with &ff to indicate collision with bullet &191e 60 RTS ; consider_next_player_bullet &191f a6 70 LDX &70 ; player_bullet &1921 ca DEX &1922 10 b1 BPL &18d5 ; check_for_collision_with_player_bullets_loop &1924 a9 00 LDA #&00 # Leave with &00 to indicate no collision with bullet &1926 60 RTS ; update_enemy_boss &1927 a9 1c LDA #&1c &1929 20 f3 1e JSR &1ef3 ; delay_for_A &192c 20 d0 17 JSR &17d0 ; check_for_deadly_collision_with_player # Returns A = &ff if collision with player &192f a6 83 LDX &83 ; enemy &1931 a8 TAY &1932 f0 06 BEQ &193a ; skip_killing_player &1934 a9 ff LDA #&ff &1936 8d 30 01 STA &0130 ; player_killed # Set to negative to kill player (hitting boss) &1939 60 RTS ; skip_killing_player &193a 20 d0 18 JSR &18d0 ; check_for_collision_with_player_bullets # Returns A = &ff if hit by player bullet &193d a6 83 LDX &83 ; enemy &193f a8 TAY &1940 f0 25 BEQ &1967 ; not_hit_by_bullet &1942 b5 28 LDA &28,X ; enemies_timer_jump_or_hit_count # Used as hit counter for boss &1944 18 CLC &1945 69 01 ADC #&01 &1947 95 28 STA &28,X ; enemies_timer_jump_or_hit_count &1949 c9 0f CMP #&0f # Boss needs fifteen hits to destroy &194b 90 1a BCC &1967 ; not_hit_by_bullet &194d 20 97 15 JSR &1597 ; plot_enemy &1950 a6 83 LDX &83 ; enemy &1952 a9 03 LDA #&03 ; ENEMY_TYPE_EXPLOSION &1954 95 20 STA &20,X ; enemies_type &1956 a9 4b LDA #&4b ; SPRITE_EXPLOSION_ONE &1958 95 00 STA &00,X ; enemies_sprite &195a a9 ff LDA #&ff &195c 9d 70 01 STA &0170,X ; enemies_explosion_type # Set to negative to indicate end of area &195f a9 05 LDA #&05 # Score 5000 for destroying boss &1961 8d 2b 01 STA &012b ; score_delta + 3 &1964 4c df 1c JMP &1cdf ; add_to_score ; not_hit_by_bullet &1967 20 af 1f JSR &1faf ; rnd &196a a6 83 LDX &83 ; enemy &196c 85 70 STA &70 ; r &196e ad 4f 01 LDA &014f ; probability_of_adding_enemy_or_bullet &1971 18 CLC &1972 69 1e ADC #&1e # Boss is 30 in 256 more likely to fire than soldiers &1974 c5 70 CMP &70 ; r &1976 b0 01 BCS &1979 ; consider_adding_boss_grenade &1978 60 RTS ; consider_adding_boss_grenade &1979 ae 55 01 LDX &0155 ; next_free_enemy_slot &197c 10 03 BPL &1981 ; is_free_slot &197e a6 83 LDX &83 ; enemy &1980 60 RTS ; is_free_slot &1981 20 af 1f JSR &1faf ; rnd &1984 ae 55 01 LDX &0155 ; next_free_enemy_slot &1987 29 0f AND #&0f # Give grenade random vertical velocity &1989 95 28 STA &28,X ; enemies_timer_jump_or_hit_count # Used as jump timer for grenade &198b a9 3f LDA #&3f &198d 95 08 STA &08,X ; enemies_x &198f a9 50 LDA #&50 ; SPRITE_GRENADE &1991 95 00 STA &00,X ; enemies_sprite &1993 a9 60 LDA #&60 &1995 95 10 STA &10,X ; enemies_y &1997 a9 06 LDA #&06 ; ENEMY_TYPE_BOMB_OR_GRENADE &1999 95 20 STA &20,X ; enemies_type &199b a9 fe LDA #&fe # Set grenade moving left &199d 95 18 STA &18,X ; enemies_x_velocity &199f 20 2e 15 JSR &152e ; backup_enemy_variables &19a2 20 97 15 JSR &1597 ; plot_enemy &19a5 a9 03 LDA #&03 &19a7 20 80 08 JSR &0880 ; play_sound # Play sound for boss firing grenade &19aa a9 ff LDA #&ff &19ac 8d 55 01 STA &0155 ; next_free_enemy_slot &19af 60 RTS ; update_enemy_bomb_or_grenade &19b0 a9 05 LDA #&05 &19b2 20 f3 1e JSR &1ef3 ; delay_for_A &19b5 20 d0 17 JSR &17d0 ; check_for_deadly_collision_with_player # Returns A = &ff if collision with player &19b8 a6 83 LDX &83 ; enemy &19ba a8 TAY &19bb f0 06 BEQ &19c3 ; skip_killing_player &19bd a9 ff LDA #&ff &19bf 8d 30 01 STA &0130 ; player_killed # Set to negative to kill player (hitting bomb or grenade) &19c2 60 RTS ; skip_killing_player &19c3 b5 28 LDA &28,X ; enemies_timer_jump_or_hit_count # Used as jump timer for bomb or grenade &19c5 a8 TAY &19c6 b9 94 08 LDA &0894,Y ; jump_table &19c9 18 CLC &19ca 75 10 ADC &10,X ; enemies_y &19cc 95 10 STA &10,X ; enemies_y &19ce c9 a6 CMP #&a6 &19d0 90 27 BCC &19f9 ; skip_exploding_bomb_or_grenade ; explode_bomb_or_grenade # Explode bomb or grenade on hitting ground &19d2 a9 15 LDA #&15 ; Flush buffer &19d4 a2 06 LDX #&06 ; sound channel 2 &19d6 20 f4 ff JSR &fff4 ; OSBYTE &19d9 a9 00 LDA #&00 &19db 20 80 08 JSR &0880 ; play_sound # Play sound for exploding bomb or grenade &19de a6 83 LDX &83 ; enemy &19e0 a9 03 LDA #&03 ; ENEMY_TYPE_EXPLOSION &19e2 95 20 STA &20,X ; enemies_type &19e4 a9 00 LDA #&00 &19e6 9d 70 01 STA &0170,X ; enemies_explosion_type # Set to zero to suppress dropping powerup &19e9 a9 4b LDA #&4b ; SPRITE_EXPLOSION_ONE &19eb 95 00 STA &00,X ; enemies_sprite &19ed b5 08 LDA &08,X ; enemies_x &19ef f0 1d BEQ &1a0e ; remove_bomb_or_grenade # No explosion at left edge of screen &19f1 d6 08 DEC &08,X ; enemies_x &19f3 f0 19 BEQ &1a0e ; remove_bomb_or_grenade &19f5 d6 08 DEC &08,X ; enemies_x &19f7 f0 15 BEQ &1a0e ; remove_bomb_or_grenade ; skip_exploding_bomb_or_grenade &19f9 f6 28 INC &28,X ; enemies_timer_jump_or_hit_count &19fb b5 08 LDA &08,X ; enemies_x &19fd c9 4c CMP #&4c &19ff b0 0d BCS &1a0e ; remove_bomb_or_grenade # Remove bomb or grenade at right edge of screen &1a01 38 SEC &1a02 e9 02 SBC #&02 &1a04 90 08 BCC &1a0e ; remove_bomb_or_grenade # Remove bomb or grenade at left edge of screen &1a06 b5 08 LDA &08,X ; enemies_x &1a08 18 CLC &1a09 75 18 ADC &18,X ; enemies_x_velocity &1a0b 95 08 STA &08,X ; enemies_x &1a0d 60 RTS ; remove_bomb_or_grenade &1a0e a9 00 LDA #&00 ; ENEMY_TYPE_NONE &1a10 95 20 STA &20,X ; enemies_type &1a12 60 RTS ; update_parachute &1a13 ad 40 01 LDA &0140 ; player_invulnerability_timer &1a16 85 7c STA &7c ; previous_player_invulnerability_timer &1a18 a9 00 LDA #&00 &1a1a 8d 40 01 STA &0140 ; player_invulnerability_timer # Temporarily set to zero to allow collisions &1a1d 20 d0 17 JSR &17d0 ; check_for_deadly_collision_with_player # Returns A = &ff if collision with player &1a20 a4 7c LDY &7c ; previous_player_invulnerability_timer &1a22 8c 40 01 STY &0140 ; player_invulnerability_timer # Restore any previous invulnerability &1a25 a6 83 LDX &83 ; enemy &1a27 a8 TAY &1a28 f0 29 BEQ &1a53 ; skip_collecting_parachute ; collect_parachute &1a2a a9 01 LDA #&01 # Score 1000 for collecting parachute &1a2c 8d 2b 01 STA &012b ; score_delta + 3 &1a2f 20 df 1c JSR &1cdf ; add_to_score &1a32 a6 83 LDX &83 ; enemy &1a34 a9 07 LDA #&07 &1a36 20 80 08 JSR &0880 ; play_sound # Play sound for collecting parachute &1a39 a6 83 LDX &83 ; enemy &1a3b a9 ff LDA #&ff &1a3d 95 18 STA &18,X ; enemies_x_velocity # Unused for parachute score &1a3f a9 08 LDA #&08 ; ENEMY_TYPE_PARACHUTE_SCORE &1a41 95 20 STA &20,X ; enemies_type &1a43 b5 10 LDA &10,X ; enemies_y &1a45 18 CLC &1a46 69 08 ADC #&08 &1a48 95 10 STA &10,X ; enemies_y &1a4a a9 53 LDA #&53 ; SPRITE_PARACHUTE_SCORE &1a4c 95 00 STA &00,X ; enemies_sprite &1a4e a9 00 LDA #&00 &1a50 95 28 STA &28,X ; enemies_timer_jump_or_hit_count # Used as timer for parachute score &1a52 60 RTS ; skip_collecting_parachute &1a53 f6 10 INC &10,X ; enemies_y # Move parachute down &1a55 f6 10 INC &10,X ; enemies_y &1a57 b5 10 LDA &10,X ; enemies_y &1a59 c9 a0 CMP #&a0 &1a5b 90 04 BCC &1a61 ; remove_if_at_left_edge_of_screen # Remove parachute at bottom of screen &1a5d a9 00 LDA #&00 ; ENEMY_TYPE_NONE &1a5f 95 20 STA &20,X ; enemies_type ; remove_if_at_left_edge_of_screen &1a61 b5 08 LDA &08,X ; enemies_x &1a63 f0 01 BEQ &1a66 ; remove_parachute # Remove parachute at left of screen &1a65 60 RTS ; remove_parachute &1a66 a9 00 LDA #&00 ; ENEMY_TYPE_NONE &1a68 95 20 STA &20,X ; enemies_type &1a6a 60 RTS ; update_parachute_score &1a6b a9 1c LDA #&1c &1a6d 20 f3 1e JSR &1ef3 ; delay_for_A &1a70 f6 28 INC &28,X ; enemies_timer_jump_or_hit_count # Used as timer for parachute score &1a72 b5 28 LDA &28,X ; enemies_timer_jump_or_hit_count &1a74 c9 32 CMP #&32 ; 50 # Remove parachute score after 50 frames &1a76 90 e9 BCC &1a61 ; remove_if_at_left_edge_of_screen &1a78 a9 00 LDA #&00 ; ENEMY_TYPE_NONE &1a7a 95 20 STA &20,X ; enemies_type &1a7c 60 RTS ; reset_area &1a7d a2 00 LDX #&00 &1a7f 8e 5f 0b STX &0b5f ; music_offset &1a82 a9 0f LDA #&0f ; Flush all buffers &1a84 20 f4 ff JSR &fff4 ; OSBYTE &1a87 20 ac 1c JSR &1cac ; plot_score_and_lives &1a8a 20 2a 13 JSR &132a ; replot_player_and_background &1a8d a9 4c LDA #&4c ; SPRITE_EXPLOSION_TWO &1a8f 85 86 STA &86 ; player_sprite &1a91 a9 4b LDA #&4b ; SPRITE_EXPLOSION_ONE &1a93 85 81 STA &81 ; player_explosion_sprite # Unnecessary code &1a95 20 2a 13 JSR &132a ; replot_player_and_background ; animate_player_explosion_loop &1a98 20 2a 13 JSR &132a ; replot_player_and_background &1a9b 20 57 15 JSR &1557 ; update_enemies &1a9e 20 c6 1e JSR &1ec6 ; replot_enemies &1aa1 a9 04 LDA #&04 ; delay_loop &1aa3 48 PHA ; count &1aa4 a9 13 LDA #&13 ; Wait for vertical retrace &1aa6 20 f4 ff JSR &fff4 ; OSBYTE &1aa9 68 PLA ; count &1aaa 38 SEC &1aab e9 01 SBC #&01 &1aad d0 f4 BNE &1aa3 ; delay_loop &1aaf e6 81 INC &81 ; player_explosion_sprite # Unnecessary code &1ab1 a5 86 LDA &86 ; player_sprite &1ab3 18 CLC &1ab4 69 01 ADC #&01 # Animate player explosion &1ab6 85 86 STA &86 ; player_sprite &1ab8 c9 4e CMP #&4e ; SPRITE_EXPLOSION_THREE + 1 &1aba 90 dc BCC &1a98 ; animate_player_explosion_loop &1abc a9 32 LDA #&32 ; 50 &1abe 20 7e 0c JSR &0c7e ; wait_for_A_vsyncs &1ac1 ad ba 08 LDA &08ba ; background_data_offset_high &1ac4 8d 56 01 STA &0156 ; background_checkpoint &1ac7 c9 04 CMP #&04 &1ac9 90 05 BCC &1ad0 ; reset_screen &1acb a9 03 LDA #&03 &1acd 8d 56 01 STA &0156 ; background_checkpoint ; reset_screen &1ad0 a9 40 LDA #&40 ; &4000 = screen_memory &1ad2 85 73 STA &73 ; screen_start_address_high &1ad4 85 91 STA &91 ; screen_address_high &1ad6 a9 00 LDA #&00 &1ad8 85 90 STA &90 ; screen_address_low &1ada 85 72 STA &72 ; screen_start_address_low &1adc 85 76 STA &76 ; crtc_start_address_low &1ade a9 08 LDA #&08 &1ae0 85 77 STA &77 ; crtc_start_address_high &1ae2 a9 00 LDA #&00 &1ae4 a0 00 LDY #&00 ; reset_screen_loop # Wipe &4000 - &7fff &1ae6 91 90 STA (&90),Y ; screen_address &1ae8 c8 INY &1ae9 d0 fb BNE &1ae6 ; reset_screen_loop &1aeb e6 91 INC &91 ; screen_address_high &1aed 10 f7 BPL &1ae6 ; reset_screen_loop &1aef a9 97 LDA #&97 ; Write SHEILA &1af1 a2 00 LDX #&00 ; &fe00 = video register number &1af3 a0 0c LDY #&0c ; R12: Displayed screen start address register (high) &1af5 20 f4 ff JSR &fff4 ; OSBYTE &1af8 a2 01 LDX #&01 ; &fe01 = video register value &1afa a0 08 LDY #&08 # Set screen start address to &4000 &1afc 20 f4 ff JSR &fff4 ; OSBYTE &1aff a2 00 LDX #&00 ; &fe00 = video register number &1b01 a0 0d LDY #&0d ; R13: Displayed screen start address register (low) &1b03 20 f4 ff JSR &fff4 ; OSBYTE &1b06 a2 01 LDX #&01 ; &fe01 = video register value &1b08 a0 00 LDY #&00 &1b0a 4c f4 ff JMP &fff4 ; OSBYTE ; initialise_area &1b0d a9 0f LDA #&0f &1b0f 85 80 STA &80 ; background_data_nibble &1b11 a9 00 LDA #&00 &1b13 85 89 STA &89 ; player_jump_timer &1b15 8d 5c 01 STA &015c ; suppress_animations &1b18 8d 58 01 STA &0158 ; allow_parachute # Set to zero to suppress parachutes while scrolling to checkpoint &1b1b 85 8b STA &8b ; player_x_velocity &1b1d 8d 18 04 STA &0418 ; player_next_free_bullet_slot &1b20 8d 55 01 STA &0155 ; next_free_enemy_slot &1b23 8d 3a 01 STA &013a ; area_complete # Set to zero to indicate boss not destroyed &1b26 8d 3b 01 STA &013b ; suppress_scrolling_at_right_of_area # Set to zero to allow screen to scroll right &1b29 8d b9 08 STA &08b9 ; background_data_offset_low # Set to zero to start at left of area &1b2c 8d ba 08 STA &08ba ; background_data_offset_high &1b2f 8d be 08 STA &08be ; tile_x_fraction &1b32 20 32 1f JSR &1f32 ; set_palette &1b35 ad 56 01 LDA &0156 ; background_checkpoint &1b38 f0 14 BEQ &1b4e ; plot_start_of_level_ground ; scroll_to_checkpoint_loop &1b3a 20 d4 0f JSR &0fd4 ; scroll_screen &1b3d 20 25 10 JSR &1025 ; plot_column_of_background &1b40 ad ba 08 LDA &08ba ; background_data_offset_high &1b43 cd 56 01 CMP &0156 ; background_checkpoint &1b46 90 f2 BCC &1b3a ; scroll_to_checkpoint_loop &1b48 a9 00 LDA #&00 &1b4a 8d 35 01 STA &0135 ; background_needs_plotting &1b4d 60 RTS ; plot_start_of_level_ground &1b4e aa TAX &1b4f a9 03 LDA #&03 ; SPRITE_*_GROUND &1b51 18 CLC &1b52 65 68 ADC &68 ; area_sprite_base &1b54 85 87 STA &87 ; ground_sprite ; plot_start_of_level_ground_loop &1b56 a0 b8 LDY #&b8 &1b58 a5 87 LDA &87 ; ground_sprite &1b5a 20 20 0d JSR &0d20 ; plot_sprite # Plot ground at start of level &1b5d e8 INX &1b5e e8 INX &1b5f e8 INX &1b60 e8 INX &1b61 e0 50 CPX #&50 &1b63 90 f1 BCC &1b56 ; plot_start_of_level_ground_loop &1b65 60 RTS ; area_string &1b66 41 52 45 41 20 0d ; "AREA " ; cleared_string &1b6c 43 4c 45 41 52 45 44 0d ; "CLEARED" ; entering_area_string &1b74 45 4e 54 45 52 49 4e 47 20 41 52 45 41 20 0d ; "ENTERING AREA " ; area_cleared_screen &1b83 ad 50 01 LDA &0150 ; area &1b86 c9 03 CMP #&03 &1b88 f0 66 BEQ &1bf0 ; area_three_cleared &1b8a 20 d0 1a JSR &1ad0 ; reset_screen &1b8d a9 11 LDA #&11 # COLOUR 12 &1b8f 20 ee ff JSR &ffee ; OSWRCH &1b92 a9 0c LDA #&0c &1b94 20 ee ff JSR &ffee ; OSWRCH &1b97 a2 03 LDX #&03 &1b99 a0 08 LDY #&08 &1b9b 20 60 0c JSR &0c60 ; tab_to_X_Y # TAB(&03, &08) &1b9e a2 66 LDX #&66 ; &1b66 = area_string &1ba0 a0 1b LDY #&1b &1ba2 20 6d 0c JSR &0c6d ; write_string # Write "AREA" &1ba5 a2 08 LDX #&08 &1ba7 a0 08 LDY #&08 &1ba9 20 60 0c JSR &0c60 ; tab_to_X_Y # TAB(&08, &08) &1bac ad 50 01 LDA &0150 ; area &1baf a2 00 LDX #&00 &1bb1 a0 ff LDY #&ff &1bb3 20 0d 1c JSR &1c0d ; write_two_digit_number # Write area number &1bb6 a2 0a LDX #&0a &1bb8 a0 08 LDY #&08 &1bba 20 60 0c JSR &0c60 ; tab_to_X_Y # TAB(&0a, &08) &1bbd a2 6c LDX #&6c ; &1b6c = cleared_string &1bbf a0 1b LDY #&1b &1bc1 20 6d 0c JSR &0c6d ; write_string # Write "CLEARED" &1bc4 a2 02 LDX #&02 &1bc6 a0 0c LDY #&0c &1bc8 20 60 0c JSR &0c60 ; tab_to_X_Y # TAB(&02, &0c) &1bcb a2 74 LDX #&74 ; &1b74 = entering_area_string &1bcd a0 1b LDY #&1b &1bcf 20 6d 0c JSR &0c6d ; write_string # Write "ENTERING AREA " &1bd2 ee 50 01 INC &0150 ; area &1bd5 a2 10 LDX #&10 &1bd7 a0 0c LDY #&0c &1bd9 20 60 0c JSR &0c60 ; tab_to_X_Y # TAB(&10, &0c) &1bdc ad 50 01 LDA &0150 ; area &1bdf a2 00 LDX #&00 &1be1 a0 ff LDY #&ff &1be3 20 0d 1c JSR &1c0d ; write_two_digit_number # Write next area number &1be6 a9 00 LDA #&00 &1be8 8d 56 01 STA &0156 ; background_checkpoint &1beb a9 c8 LDA #&c8 ; 200 &1bed 4c 7e 0c JMP &0c7e ; wait_for_A_vsyncs ; area_three_cleared # After area three is cleared, &1bf0 20 d0 1a JSR &1ad0 ; reset_screen &1bf3 20 8e 1f JSR &1f8e ; completion_screen # Display completion screen &1bf6 a9 00 LDA #&00 &1bf8 85 68 STA &68 ; area_sprite_base &1bfa 8d 56 01 STA &0156 ; background_checkpoint &1bfd a9 01 LDA #&01 # Start again on area one, but don't reset probability &1bff 8d 50 01 STA &0150 ; area # of new enemies and bullets, i.e. harder round &1c02 a9 2f LDA #&2f ; &2fe0 = area_one_data &1c04 8d 3d 01 STA &013d ; area_data_address_high &1c07 a9 e0 LDA #&e0 &1c09 8d 3c 01 STA &013c ; area_data_address_low &1c0c 60 RTS ; write_two_digit_number &1c0d 48 PHA ; number &1c0e 4a LSR A &1c0f 4a LSR A &1c10 4a LSR A &1c11 4a LSR A &1c12 20 18 1c JSR &1c18 ; write_one_digit_number &1c15 68 PLA ; number &1c16 29 0f AND #&0f ; write_one_digit_number &1c18 d0 03 BNE &1c1d ; write_digit &1c1a 98 TYA &1c1b d0 07 BNE &1c24 ; write_zero ; write_digit &1c1d a0 00 LDY #&00 &1c1f 09 30 ORA #&30 ; "0" &1c21 4c ee ff JMP &ffee ; OSWRCH ; write_zero &1c24 8a TXA &1c25 4c ee ff JMP &ffee ; OSWRCH ; update_powerup &1c28 a9 18 LDA #&18 &1c2a 20 f3 1e JSR &1ef3 ; delay_for_A &1c2d ad 40 01 LDA &0140 ; player_invulnerability_timer &1c30 85 7c STA &7c ; previous_player_invulnerability_timer &1c32 a9 00 LDA #&00 &1c34 8d 40 01 STA &0140 ; player_invulnerability_timer # Temporarily set to zero to allow collisions &1c37 20 d0 17 JSR &17d0 ; check_for_deadly_collision_with_player # Returns A = &ff if collision with player &1c3a a4 7c LDY &7c ; previous_player_invulnerability_timer &1c3c 8c 40 01 STY &0140 ; player_invulnerability_timer # Restore any previous invulnerability &1c3f a6 83 LDX &83 ; enemy &1c41 a8 TAY &1c42 f0 32 BEQ &1c76 ; not_collecting_powerup ; collect_powerup &1c44 a9 07 LDA #&07 &1c46 20 80 08 JSR &0880 ; play_sound # Play sound for collecting powerup &1c49 a6 83 LDX &83 ; enemy &1c4b a9 00 LDA #&00 ; ENEMY_TYPE_NONE &1c4d 95 20 STA &20,X ; enemies_type # Remove powerup &1c4f 20 af 1f JSR &1faf ; rnd &1c52 a6 83 LDX &83 ; enemy &1c54 a0 05 LDY #&05 &1c56 20 a2 1c JSR &1ca2 ; calculate_A_mod_Y # 1 in 5 chance of gaining a given type of powerup &1c59 a8 TAY &1c5a f0 2c BEQ &1c88 ; gain_fast_firing &1c5c c9 01 CMP #&01 &1c5e f0 2e BEQ &1c8e ; gain_extra_life &1c60 c9 02 CMP #&02 &1c62 f0 32 BEQ &1c96 ; gain_higher_jump &1c64 c9 03 CMP #&03 &1c66 f0 34 BEQ &1c9c ; gain_extra_player_bullets ; gain_invulnerability &1c68 ad 40 01 LDA &0140 ; player_invulnerability_timer # Non-zero if player is already invulnerable &1c6b d0 03 BNE &1c70 ; skip_adding_halo &1c6d 20 24 25 JSR &2524 ; unplot_halo ; skip_adding_halo &1c70 a9 6e LDA #&6e ; 110 # Powerup gives invulnerability for 110 frames &1c72 8d 40 01 STA &0140 ; player_invulnerability_timer &1c75 60 RTS ; not_collecting_powerup &1c76 f6 28 INC &28,X ; enemies_timer_jump_or_hit_count &1c78 b5 28 LDA &28,X ; enemies_timer_jump_or_hit_count &1c7a c9 5a CMP #&5a ; 90 &1c7c b0 05 BCS &1c83 ; remove_powerup # Remove powerup after 90 frames &1c7e b5 08 LDA &08,X ; enemies_x &1c80 f0 01 BEQ &1c83 ; remove_powerup # or at left of screen &1c82 60 RTS ; remove_powerup &1c83 a9 00 LDA #&00 ; ENEMY_TYPE_NONE &1c85 95 20 STA &20,X ; enemies_type &1c87 60 RTS ; gain_fast_firing &1c88 a9 ff LDA #&ff &1c8a 8d 41 01 STA &0141 ; player_can_fire_fast # Set to negative to allow player to fire fast &1c8d 60 RTS ; gain_extra_life &1c8e ee 31 01 INC &0131 ; lives &1c91 a9 06 LDA #&06 &1c93 4c 80 08 JMP &0880 ; play_sound # Play sound for extra life ; gain_higher_jump &1c96 a9 ff LDA #&ff &1c98 8d 5a 01 STA &015a ; player_can_jump_high # Set to negative to allow player to jump high &1c9b 60 RTS ; gain_extra_player_bullets &1c9c a9 07 LDA #&07 &1c9e 8d 59 01 STA &0159 ; number_of_player_player_bullets # Allow player to fire eight, nor four bullets &1ca1 60 RTS ; calculate_A_mod_Y &1ca2 84 70 STY &70 ; y &1ca4 38 SEC ; calculate_A_mod_Y_loop &1ca5 e5 70 SBC &70 ; y &1ca7 b0 fc BCS &1ca5 ; calculate_A_mod_Y_loop &1ca9 65 70 ADC &70 ; y &1cab 60 RTS ; plot_score_and_lives &1cac a9 0a LDA #&0a &1cae 85 87 STA &87 ; x &1cb0 a2 05 LDX #&05 ; plot_score_loop &1cb2 bd 43 01 LDA &0143,X ; score &1cb5 18 CLC &1cb6 69 55 ADC #&55 ; SPRITE_DIGIT_ZERO &1cb8 86 81 STX &81 ; score_offset &1cba a6 87 LDX &87 ; x &1cbc a0 00 LDY #&00 &1cbe 20 20 0d JSR &0d20 ; plot_sprite &1cc1 a6 81 LDX &81 ; score_offset &1cc3 a5 87 LDA &87 ; x &1cc5 18 CLC &1cc6 69 02 ADC #&02 &1cc8 85 87 STA &87 ; x &1cca ca DEX &1ccb 10 e5 BPL &1cb2 ; plot_score_loop &1ccd ad 31 01 LDA &0131 ; lives &1cd0 a0 0a LDY #&0a ; 10 &1cd2 20 a2 1c JSR &1ca2 ; calculate_A_mod_Y &1cd5 18 CLC &1cd6 69 55 ADC #&55 ; SPRITE_DIGIT_ZERO &1cd8 a2 1a LDX #&1a &1cda a0 00 LDY #&00 &1cdc 4c 20 0d JMP &0d20 ; plot_sprite ; add_to_score &1cdf a2 00 LDX #&00 ; add_to_score_loop &1ce1 bd 28 01 LDA &0128,X ; score_delta &1ce4 18 CLC &1ce5 7d 43 01 ADC &0143,X ; score &1ce8 48 PHA ; digit &1ce9 a0 0a LDY #&0a ; 10 &1ceb 20 a2 1c JSR &1ca2 ; calculate_A_mod_Y &1cee 9d 43 01 STA &0143,X ; score &1cf1 68 PLA ; digit &1cf2 c9 0a CMP #&0a ; 10 &1cf4 90 03 BCC &1cf9 ; skip_overflow &1cf6 fe 29 01 INC &0129,X ; score_delta + 1 ; skip_overflow &1cf9 a9 00 LDA #&00 &1cfb 9d 28 01 STA &0128,X ; score_delta &1cfe e8 INX &1cff e0 06 CPX #&06 &1d01 90 de BCC &1ce1 ; add_to_score_loop &1d03 60 RTS ; check_for_pause_and_escape &1d04 a9 81 LDA #&81 ; Scan for a particular key &1d06 a2 c8 LDX #&c8 ; P &1d08 a0 ff LDY #&ff &1d0a 20 f4 ff JSR &fff4 ; OSBYTE &1d0d e0 ff CPX #&ff &1d0f f0 03 BEQ &1d14 ; p_pressed &1d11 4c e1 13 JMP &13e1 ; check_for_escape ; p_pressed &1d14 20 ac 1c JSR &1cac ; plot_score_and_lives ; wait_for_unpause &1d17 20 e0 ff JSR &ffe0 ; OSRDCH &1d1a c9 55 CMP #&55 ; "U" &1d1c d0 f9 BNE &1d17 ; wait_for_unpause &1d1e 4c ac 1c JMP &1cac ; plot_score_and_lives ; title_screen &1d21 20 d0 1a JSR &1ad0 ; reset_screen ; title_screen_without_resetting_screen &1d24 a9 03 LDA #&03 &1d26 8d 50 01 STA &0150 ; area # Use area three colour scheme for title screen &1d29 20 32 1f JSR &1f32 ; set_palette &1d2c 20 8b 0c JSR &0c8b ; plot_title_screen &1d2f 20 96 20 JSR &2096 ; plot_title_screen_text ; title_screen_loop &1d32 a9 81 LDA #&81 ; Wait for input character &1d34 a2 00 LDX #&00 &1d36 a0 08 LDY #&08 &1d38 20 f4 ff JSR &fff4 ; OSBYTE # Returns Y = 0, X = key if key pressed &1d3b c0 ff CPY #&ff # Y = &ff if timed out &1d3d d0 0c BNE &1d4b ; key_pressed &1d3f 20 d0 1a JSR &1ad0 ; reset_screen &1d42 20 5a 1d JSR &1d5a ; use_area_one &1d45 20 29 14 JSR &1429 ; start_demo &1d48 4c 24 1d JMP &1d24 ; title_screen_without_resetting_screen ; key_pressed &1d4b 8a TXA &1d4c 20 62 1d JSR &1d62 ; check_for_cheat_mode &1d4f c9 20 CMP #&20 ; " " # SPACE starts game &1d51 d0 df BNE &1d32 ; title_screen_loop &1d53 a9 00 LDA #&00 &1d55 8d 7b 14 STA &147b ; player_controlled_by_computer # Set to zero to indicate not demo mode &1d58 85 68 STA &68 ; area_sprite_base # Set to zero to use area one sprites ; use_area_one &1d5a a9 01 LDA #&01 &1d5c 8d 50 01 STA &0150 ; area &1d5f 4c 32 1f JMP &1f32 ; set_palette ; check_for_cheat_mode &1d62 85 70 STA &70 ; key &1d64 a9 81 LDA #&81 ; Scan for a particular key &1d66 a2 af LDX #&af ; SHIFT-LOCK &1d68 a0 ff LDY #&ff &1d6a 20 f4 ff JSR &fff4 ; OSBYTE # Returns X = &ff if key pressed &1d6d a5 70 LDA &70 ; key &1d6f 38 SEC &1d70 e9 0a SBC #&0a &1d72 ac a1 1d LDY &1da1 ; key_offset &1d75 d9 a2 1d CMP &1da2,Y ; cheat_mode_keys # Has the next key in cheat password been pressed? &1d78 f0 03 BEQ &1d7d ; cheat_key_pressed &1d7a a5 70 LDA &70 ; key &1d7c 60 RTS ; cheat_key_pressed &1d7d e0 ff CPX #&ff &1d7f f0 03 BEQ &1d84 ; shift_lock_pressed # If so, was SHIFT-LOCK pressed? &1d81 a5 70 LDA &70 ; key &1d83 60 RTS ; shift_lock_pressed &1d84 a5 70 LDA &70 ; key &1d86 ee a1 1d INC &1da1 ; key_offset &1d89 c8 INY &1d8a c0 06 CPY #&06 &1d8c b0 01 BCS &1d8f ; enable_cheat_mode # If entire password successfully entered, &1d8e 60 RTS ; enable_cheat_mode &1d8f a9 14 LDA #&14 ; 20 # Start with twenty lives in cheat mode &1d91 8d 1c 0f STA &0f1c ; initial_lives &1d94 8d 31 01 STA &0131 ; lives &1d97 a9 63 LDA #&63 # 99 in 256 chance of dropping powerup in cheat mode &1d99 8d 5b 16 STA &165b ; probability_of_dropping_powerup &1d9c a9 04 LDA #&04 &1d9e 4c 80 08 JMP &0880 ; play_sound # Play sound for enabling cheat mode ; key_offset &1da1 00 ; cheat_mode_keys # Key values are stored - &0a &1da2 3c 4b 3d 37 50 3f ; "FUGAZI" ; update_enemy_jeep &1da8 20 d0 18 JSR &18d0 ; check_for_collision_with_player_bullets # Returns A = &ff if hit by player bullet &1dab a6 83 LDX &83 ; enemy &1dad a8 TAY &1dae f0 33 BEQ &1de3 ; not_hit_by_bullet &1db0 b5 28 LDA &28,X ; enemies_timer_jump_or_hit_count # Used as hit counter for jeeps &1db2 18 CLC &1db3 69 01 ADC #&01 &1db5 95 28 STA &28,X ; enemies_timer_jump_or_hit_count &1db7 c9 03 CMP #&03 # Jeeps need three hits to destroy &1db9 90 28 BCC &1de3 ; not_hit_by_bullet &1dbb a9 00 LDA #&00 &1dbd 20 80 08 JSR &0880 ; play_sound # Play sound for destroying jeep &1dc0 a6 83 LDX &83 ; enemy &1dc2 a9 07 LDA #&07 # Score 750 for destroying jeep &1dc4 8d 2a 01 STA &012a ; score_delta + 2 &1dc7 a9 05 LDA #&05 &1dc9 8d 29 01 STA &0129 ; score_delta + 1 &1dcc 20 df 1c JSR &1cdf ; add_to_score &1dcf a6 83 LDX &83 ; enemy &1dd1 a9 03 LDA #&03 # Set to three to drop soldier if destroyed by player ; explode_jeep &1dd3 9d 70 01 STA &0170,X ; enemies_explosion_type &1dd6 a9 03 LDA #&03 ; ENEMY_TYPE_EXPLOSION &1dd8 95 20 STA &20,X ; enemies_type &1dda f6 08 INC &08,X ; enemies_x &1ddc f6 08 INC &08,X ; enemies_x &1dde a9 4b LDA #&4b ; SPRITE_EXPLOSION_ONE &1de0 95 00 STA &00,X ; enemies_sprite &1de2 60 RTS ; not_hit_by_bullet &1de3 20 d0 17 JSR &17d0 ; check_for_deadly_collision_with_player # Returns A = &ff if collision with player &1de6 a6 83 LDX &83 ; enemy &1de8 a8 TAY &1de9 f0 05 BEQ &1df0 ; skip_killing_player &1deb a9 ff LDA #&ff &1ded 8d 30 01 STA &0130 ; player_killed # Set to negative to kill player (hitting jeep) ; skip_killing_player &1df0 d6 08 DEC &08,X ; enemies_x &1df2 b5 08 LDA &08,X ; enemies_x &1df4 10 05 BPL &1dfb ; not_at_left_edge # Remove jeep at left edge of screen ; remove_jeep &1df6 a9 00 LDA #&00 ; ENEMY_TYPE_NONE &1df8 95 20 STA &20,X ; enemies_type &1dfa 60 RTS ; not_at_left_edge &1dfb f0 f9 BEQ &1df6 ; remove_jeep &1dfd b5 10 LDA &10,X ; enemies_y &1dff 18 CLC &1e00 69 15 ADC #&15 &1e02 a8 TAY &1e03 b5 08 LDA &08,X ; enemies_x &1e05 aa TAX &1e06 a9 0a LDA #&0a ; width &1e08 20 37 11 JSR &1137 ; check_for_support # Returns A = &ff if supported &1e0b a6 83 LDX &83 ; enemy &1e0d a8 TAY &1e0e f0 c3 BEQ &1dd3 ; explode_jeep # Explode jeep if unsupported (A = 0 here, so don't drop soldier) &1e10 20 af 1f JSR &1faf ; rnd &1e13 a6 83 LDX &83 ; enemy &1e15 cd 4f 01 CMP &014f ; probability_of_adding_enemy_or_bullet &1e18 90 01 BCC &1e1b ; is_ok &1e1a 60 RTS ; is_ok &1e1b ac 55 01 LDY &0155 ; next_free_enemy_slot &1e1e 10 01 BPL &1e21 ; is_free_slot &1e20 60 RTS ; is_free_slot &1e21 b5 08 LDA &08,X ; enemies_x # Add grenade &1e23 18 CLC &1e24 69 03 ADC #&03 &1e26 99 08 00 STA &0008,Y ; enemies_x &1e29 a9 06 LDA #&06 ; ENEMY_TYPE_BOMB_OR_GRENADE &1e2b 99 20 00 STA &0020,Y ; enemies_type &1e2e a9 50 LDA #&50 ; SPRITE_GRENADE &1e30 99 00 00 STA &0000,Y ; enemies_sprite &1e33 b5 08 LDA &08,X ; enemies_x &1e35 38 SEC &1e36 e5 69 SBC &69 ; player_x &1e38 49 3f EOR #&3f &1e3a 30 0d BMI &1e49 ; is_right_of_player ; is_left_of_player &1e3c 4a LSR A &1e3d 4a LSR A &1e3e 4a LSR A &1e3f 99 28 00 STA &0028,Y ; enemies_timer_jump_or_hit_count # Angle of grenade depends on distance from player &1e42 a9 fe LDA #&fe # Set grenade moving left &1e44 99 18 00 STA &0018,Y ; enemies_x_velocity &1e47 30 12 BMI &1e5b ; set_grenade_y # Always branches ; is_right_of_player &1e49 85 70 STA &70 ; x_delta &1e4b a9 00 LDA #&00 &1e4d 38 SEC &1e4e e5 70 SBC &70 ; x_delta &1e50 4a LSR A &1e51 4a LSR A &1e52 4a LSR A &1e53 99 28 00 STA &0028,Y ; enemies_timer_jump_or_hit_count # Angle of grenade depends on distance from player &1e56 a9 01 LDA #&01 # Set grenade moving right &1e58 99 18 00 STA &0018,Y ; enemies_x_velocity ; set_grenade_y &1e5b b5 10 LDA &10,X ; enemies_y &1e5d 38 SEC &1e5e e9 04 SBC #&04 &1e60 99 10 00 STA &0010,Y ; enemies_y &1e63 98 TYA &1e64 aa TAX &1e65 20 2e 15 JSR &152e ; backup_enemy_variables &1e68 20 97 15 JSR &1597 ; plot_enemy # Plot new grenade &1e6b a6 83 LDX &83 ; enemy &1e6d a9 ff LDA #&ff &1e6f 8d 55 01 STA &0155 ; next_free_enemy_slot &1e72 60 RTS ; update_music_and_check_for_sound_keys &1e73 ad 32 01 LDA &0132 ; music_disabled # &ff if music disabled &1e76 c9 ff CMP #&ff &1e78 f0 03 BEQ &1e7d ; skip_updating_music &1e7a 20 e0 1f JSR &1fe0 ; update_music ; skip_updating_music &1e7d a9 81 LDA #&81 ; Scan for a particular key &1e7f a2 ef LDX #&ef ; Q &1e81 a0 ff LDY #&ff &1e83 20 f4 ff JSR &fff4 ; OSBYTE &1e86 e0 ff CPX #&ff &1e88 d0 09 BNE &1e93 ; q_not_pressed &1e8a a9 d2 LDA #&d2 ; Read/Write sound suppression flag &1e8c a2 01 LDX #&01 # Disable sound &1e8e a0 00 LDY #&00 &1e90 4c f4 ff JMP &fff4 ; OSBYTE ; q_not_pressed &1e93 a9 81 LDA #&81 ; Scan for a particular key &1e95 a2 9a LDX #&9a ; M &1e97 a0 ff LDY #&ff &1e99 20 f4 ff JSR &fff4 ; OSBYTE &1e9c e0 ff CPX #&ff &1e9e d0 0a BNE &1eaa ; m_not_pressed &1ea0 8e 32 01 STX &0132 ; music_disabled # Set to &ff to disable music &1ea3 a9 15 LDA #&15 ; Flush buffer &1ea5 a2 07 LDX #&07 ; sound channel 3 &1ea7 20 f4 ff JSR &fff4 ; OSBYTE ; m_not_pressed &1eaa a9 81 LDA #&81 ; Scan for a particular key &1eac a2 ae LDX #&ae ; S &1eae a0 ff LDY #&ff &1eb0 20 f4 ff JSR &fff4 ; OSBYTE &1eb3 e0 ff CPX #&ff &1eb5 d0 0e BNE &1ec5 ; s_not_pressed &1eb7 a9 00 LDA #&00 &1eb9 8d 32 01 STA &0132 ; music_disabled # Set to non-&ff to enable music &1ebc a9 d2 LDA #&d2 ; Read/Write sound suppression flag &1ebe a2 00 LDX #&00 # Enable sound &1ec0 a0 00 LDY #&00 &1ec2 20 f4 ff JSR &fff4 ; OSBYTE ; s_not_pressed &1ec5 60 RTS ; replot_enemies &1ec6 a2 07 LDX #&07 ; replot_enemies_loop &1ec8 b5 50 LDA &50,X ; enemies_previous_type # Non-zero if there was an enemy in this slot &1eca f0 10 BEQ &1edc ; skip_unplotting_enemy &1ecc c9 05 CMP #&05 ; ENEMY_TYPE_BOSS &1ece f0 1f BEQ &1eef ; consider_next_enemy # Don't replot boss &1ed0 86 83 STX &83 ; enemy &1ed2 8a TXA &1ed3 18 CLC &1ed4 69 30 ADC #&30 ; enemies_previous_* - enemies_* # Use previous values for unplotting enemy &1ed6 aa TAX &1ed7 20 97 15 JSR &1597 ; plot_enemy # Unplot enemy &1eda a6 83 LDX &83 ; enemy ; skip_unplotting_enemy &1edc b5 20 LDA &20,X ; enemies_type # Non-zero if there is an enemy in this slot &1ede f0 0f BEQ &1eef ; skip_plotting_enemy &1ee0 c9 02 CMP #&02 ; ENEMY_TYPE_HELICOPTER &1ee2 d0 06 BNE &1eea ; not_helicopter &1ee4 b5 60 LDA &60,X ; enemies_rotor_sprite &1ee6 49 01 EOR #&01 ; SPRITE_ROTORS_TWO ^ SPRITE_ROTORS_ONE # Animate helicopter rotors &1ee8 95 60 STA &60,X ; enemies_rotor_sprite ; not_helicopter &1eea 20 97 15 JSR &1597 ; plot_enemy # Plot enemy &1eed a6 83 LDX &83 ; enemy # Bug: this was only set if enemy was unplotted ; consider_next_enemy &1eef ca DEX &1ef0 10 d6 BPL &1ec8 ; update_enemies_loop &1ef2 60 RTS ; delay_for_A &1ef3 a8 TAY ; delay_for_A_outer_loop &1ef4 a9 29 LDA #&29 ; delay_for_A_inner_loop &1ef6 38 SEC &1ef7 e9 01 SBC #&01 &1ef9 10 fb BPL &1ef6 ; delay_for_A_inner_loop &1efb 88 DEY &1efc 10 f6 BPL &1ef4 ; delay_for_A_outer_loop &1efe 60 RTS ; plot_column_of_tile &1eff a0 00 LDY #&00 &1f01 84 70 STY &70 ; group ; plot_column_of_tile_group_loop ; plot_column_of_tile_row_loop &1f03 b1 78 LDA (&78),Y ; tile_sprite_address &1f05 91 90 STA (&90),Y ; screen_address &1f07 c8 INY &1f08 c0 08 CPY #&08 &1f0a 90 f7 BCC &1f03 ; plot_column_of_tile_row_loop &1f0c a5 78 LDA &78 ; tile_sprite_address_low &1f0e 18 CLC &1f0f 69 08 ADC #&08 &1f11 85 78 STA &78 ; tile_sprite_address_low &1f13 90 02 BCC &1f17 ; skip_page &1f15 e6 79 INC &79 ; tile_sprite_address_high ; skip_page &1f17 a5 90 LDA &90 ; screen_address_low &1f19 18 CLC &1f1a 69 80 ADC #&80 # Move down a group &1f1c 85 90 STA &90 ; screen_address_low &1f1e a5 91 LDA &91 ; screen_address_high &1f20 69 02 ADC #&02 &1f22 10 03 BPL &1f27 ; skip_wraparound &1f24 38 SEC &1f25 e9 40 SBC #&40 ; skip_wraparound &1f27 85 91 STA &91 ; screen_address_high &1f29 a4 70 LDY &70 ; group &1f2b d0 04 BNE &1f31 ; leave &1f2d e6 70 INC &70 ; group &1f2f 10 d2 BPL &1f03 ; plot_column_of_tile_group_loop # Always branches ; leave &1f31 60 RTS ; set_palette &1f32 ad 50 01 LDA &0150 ; area &1f35 38 SEC &1f36 e9 01 SBC #&01 &1f38 0a ASL A &1f39 0a ASL A &1f3a 18 CLC &1f3b 69 61 ADC #&61 ; &1f61 = area_palettes &1f3d 85 70 STA &70 ; palette_address_low &1f3f a9 1f LDA #&1f &1f41 69 00 ADC #&00 &1f43 85 71 STA &71 ; palette_address_high &1f45 a0 00 LDY #&00 ; set_palette_loop # Set colours 0 - 3 to colours in area palette &1f47 b1 70 LDA (&70),Y ; palette_address &1f49 8d 6e 1f STA &1f6e ; palette_block + 1 &1f4c 8c 6d 1f STY &1f6d ; palette_block + 0 &1f4f a2 6d LDX #&6d ; &1f6d = palette_block &1f51 a0 1f LDY #&1f &1f53 a9 0c LDA #&0c ; Write palette &1f55 20 f1 ff JSR &fff1 ; OSWORD &1f58 ac 6d 1f LDY &1f6d ; palette_block + 0 &1f5b c8 INY &1f5c c0 04 CPY #&04 &1f5e 90 e7 BCC &1f47 ; set_palette_loop &1f60 60 RTS ; area_palettes &1f61 00 05 02 03 ; area 1 : K M G Y &1f65 00 05 04 06 ; area 2 : K M B C &1f69 00 05 03 07 ; area 3 : K M Y W ; palette_block &1f6d 00 00 00 00 00 ; unused &1f72 00 ; well_done_string &1f73 57 45 4c 4c 20 44 4f 4e 45 0d ; "WELL DONE" ; mission_complete_string &1f7d 4d 49 53 53 49 4f 4e 20 43 4f 4d 50 4c 45 54 45 ; "MISSION COMPLETE" &1f8d 0d ; completion_screen &1f8e a2 05 LDX #&05 &1f90 a0 08 LDY #&08 &1f92 20 60 0c JSR &0c60 ; tab_to_X_Y # TAB(&05, &08) &1f95 a2 73 LDX #&73 ; &1f73 = well_done_string &1f97 a0 1f LDY #&1f &1f99 20 6d 0c JSR &0c6d ; write_string # Write "WELL DONE" &1f9c a2 02 LDX #&02 &1f9e a0 0c LDY #&0c &1fa0 20 60 0c JSR &0c60 ; tab_to_X_Y # TAB(&02, &0c) &1fa3 a2 7d LDX #&7d ; &1f7d = mission_complete_string &1fa5 a0 1f LDY #&1f &1fa7 20 6d 0c JSR &0c6d ; write_string # Write "MISSION COMPLETE" &1faa a9 c8 LDA #&c8 ; 200 &1fac 4c 7e 0c JMP &0c7e ; wait_for_A_vsyncs ; rnd &1faf a0 08 LDY #&08 ; rnd_loop &1fb1 18 CLC &1fb2 ad dc 1f LDA &1fdc ; rnd_state + 3 &1fb5 10 0f BPL &1fc6 ; skip_eor &1fb7 a2 02 LDX #&02 ; rnd_eor_loop &1fb9 bd d9 1f LDA &1fd9,X ; rnd_state &1fbc 5d dd 1f EOR &1fdd,X ; rnd_eor &1fbf 9d d9 1f STA &1fd9,X ; rnd_state &1fc2 ca DEX &1fc3 10 f4 BPL &1fb9 ; rnd_eor_loop &1fc5 38 SEC ; skip_eor &1fc6 2e d9 1f ROL &1fd9 ; rnd_state &1fc9 2e da 1f ROL &1fda ; rnd_state + 1 &1fcc 2e db 1f ROL &1fdb ; rnd_state + 2 &1fcf 2e dc 1f ROL &1fdc ; rnd_state + 3 &1fd2 88 DEY &1fd3 d0 dc BNE &1fb1 ; rnd_loop &1fd5 ad dc 1f LDA &1fdc ; rnd_state &1fd8 60 RTS ; rnd_state &1fd9 2d 38 4f ac ; rnd_eor &1fdd 53 b5 76 ; update_music &1fe0 a9 80 LDA #&80 ; Read buffer status &1fe2 a2 f8 LDX #&f8 ; sound channel 3 &1fe4 a0 ff LDY #&ff &1fe6 20 f4 ff JSR &fff4 ; OSBYTE &1fe9 8a TXA &1fea d0 01 BNE &1fed ; play_note &1fec 60 RTS ; play_note &1fed ae 5f 0b LDX &0b5f ; music_offset &1ff0 e8 INX # Move to next note of music &1ff1 e8 INX &1ff2 8e 5f 0b STX &0b5f ; music_offset &1ff5 bd e0 0a LDA &0ae0,X ; music_data &1ff8 8d 1c 20 STA &201c ; music_sound_block + 4 (pitch) &1ffb bd e1 0a LDA &0ae1,X ; music_data &1ffe 8d 1e 20 STA &201e ; music_sound_block + 6 (duration) &2001 a2 18 LDX #&18 ; &2018 = music_sound_block &2003 a0 20 LDY #&20 &2005 a9 07 LDA #&07 ; Generate a sound &2007 20 f1 ff JSR &fff1 ; OSWORD &200a ad 5f 0b LDA &0b5f ; music_offset &200d c9 7a CMP #&7a &200f b0 01 BCS &2012 ; restart_music &2011 60 RTS ; restart_music &2012 a9 00 LDA #&00 &2014 8d 5f 0b STA &0b5f ; music_offset &2017 60 RTS ; music_sound_block ; chan vol pitch dur &2018 03 00 03 00 00 00 00 00 ; copyright_asl_string &2020 11 03 ; COLOUR 3 &2022 28 43 29 20 41 2e 53 2e 4c 2e 20 31 39 38 38 0d ; "(C) A.S.L. 1988" ; high_string &2032 11 01 ; COLOUR 1 &2034 48 49 47 48 3a 0d ; "HIGH:" ; game_over_screen &203a a2 05 LDX #&05 ; check_for_high_score_loop &203c bd 43 01 LDA &0143,X ; score &203f dd 50 0c CMP &0c50,X ; high_score &2042 90 10 BCC &2054 ; skip_copying_score &2044 d0 03 BNE &2049 ; new_high_score &2046 ca DEX &2047 10 f3 BPL &203c ; check_for_high_score_loop ; new_high_score &2049 a2 05 LDX #&05 ; copy_score_loop &204b bd 43 01 LDA &0143,X ; score &204e 9d 50 0c STA &0c50,X ; high_score &2051 ca DEX &2052 10 f7 BPL &204b ; copy_score_loop ; skip_copying_score &2054 a2 05 LDX #&05 &2056 a0 0c LDY #&0c &2058 20 60 0c JSR &0c60 ; tab_to_X_Y &205b a2 67 LDX #&67 ; &2067 = game_over_string &205d a0 20 LDY #&20 &205f 20 6d 0c JSR &0c6d ; write_string &2062 a9 4b LDA #&4b &2064 4c 7e 0c JMP &0c7e ; wait_for_A_vsyncs ; game_over_string &2067 47 41 4d 45 20 4f 56 45 52 0d ; "GAME OVER" ; by_sam_inglis_string &2071 11 02 ; COLOUR 2 &2073 62 79 20 53 61 6d 20 49 6e 67 6c 69 73 0d ; "by Sam Inglis" ; audiogenic_present_string &2081 11 0c ; COLOUR 12 &2083 41 75 64 69 6f 67 65 6e 69 63 20 70 72 65 73 65 ; "Audiogenic present" &2093 6e 74 0d ; plot_title_screen_text &2096 a9 11 LDA #&11 # COLOUR 1 (unnecessary, included in high_string) &2098 20 ee ff JSR &ffee ; OSWRCH &209b a9 01 LDA #&01 &209d 20 ee ff JSR &ffee ; OSWRCH &20a0 a2 03 LDX #&03 &20a2 a0 13 LDY #&13 &20a4 20 60 0c JSR &0c60 ; tab_to_X_Y # TAB(&03, &13) &20a7 a2 32 LDX #&32 ; &2032 = high_string &20a9 a0 20 LDY #&20 &20ab 20 6d 0c JSR &0c6d ; write_string # Write "HIGH:" &20ae a2 08 LDX #&08 &20b0 a0 13 LDY #&13 &20b2 20 60 0c JSR &0c60 ; tab_to_X_Y # TAB(&08, &13) &20b5 a2 05 LDX #&05 ; write_high_score_loop &20b7 bd 50 0c LDA &0c50,X ; high_score &20ba 18 CLC &20bb 69 30 ADC #&30 &20bd 20 ee ff JSR &ffee ; OSWRCH # Write high score &20c0 ca DEX &20c1 10 f4 BPL &20b7 ; write_high_score_loop &20c3 a2 03 LDX #&03 &20c5 a0 0b LDY #&0b &20c7 20 60 0c JSR &0c60 ; tab_to_X_Y # TAB(&03, &0b) &20ca a2 71 LDX #&71 ; &2071 = by_sam_inglis_string &20cc a0 20 LDY #&20 &20ce 20 6d 0c JSR &0c6d ; write_string # Write "by Sam Inglis" &20d1 a2 01 LDX #&01 &20d3 a0 00 LDY #&00 &20d5 20 60 0c JSR &0c60 ; tab_to_X_Y # TAB(&01, &00) &20d8 a2 81 LDX #&81 ; &2081 = audiogenic_present_string &20da a0 20 LDY #&20 &20dc 20 6d 0c JSR &0c6d ; write_string # Write "Audiogenic present" &20df a2 02 LDX #&02 &20e1 a0 18 LDY #&18 &20e3 20 60 0c JSR &0c60 ; tab_to_X_Y # TAB(&02, &18) &20e6 a2 20 LDX #&20 ; &2020 = copyright_asl_string &20e8 a0 20 LDY #&20 &20ea 4c 6d 0c JMP &0c6d ; write_string # Write "(C) A.S.L. 1988" ; unused &20ed 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &20fd 00 00 00 ; sprite_00_data (SPRITE_JUNGLE_SPACE) ; sprite_0a_data (SPRITE_JUNGLE_HOLE) ; sprite_10_data (SPRITE_FACTORY_SPACE) ; sprite_20_data (SPRITE_STREET_SPACE) &2100 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &2110 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &2120 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &2130 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; sprite_01_data (SPRITE_JUNGLE_CLIFF_TOP) &2140 10 24 0c 0c 0d 09 03 02 02 01 03 01 03 02 02 00 &2150 20 18 0e 0c 06 09 07 06 02 01 03 01 01 01 00 00 &2160 20 18 0c 0e 07 09 09 01 02 02 02 02 01 02 03 02 &2170 30 18 0c 0d 06 09 0c 06 02 02 01 02 01 01 00 01 ; sprite_02_data (SPRITE_JUNGLE_CLIFF) &2180 02 02 01 01 03 02 01 02 02 02 00 01 00 02 02 01 &2190 03 03 01 00 01 01 00 01 00 01 03 01 03 03 03 01 &21a0 01 02 02 02 01 00 01 00 02 02 02 00 00 02 00 02 &21b0 02 03 02 02 00 00 00 02 02 03 01 03 02 01 03 02 ; sprite_03_data (SPRITE_JUNGLE_GROUND) &21c0 10 10 24 0c 0c 0d 0e 0f 0f 0a 0a 05 05 00 05 00 &21d0 00 20 18 0c 0c 0d 0c 0e 0f 0f 0f 05 05 05 00 00 &21e0 20 20 18 0c 0c 0c 0e 0f 0a 05 05 05 00 00 0a 00 &21f0 20 30 0c 0c 0c 0d 0e 0f 0a 0a 0a 0f 0a 0a 00 00 ; sprite_04_data (SPRITE_JUNGLE_HORIZONTAL_BRANCH) &2200 00 00 00 00 30 0f 07 03 0f 03 00 03 03 00 00 00 &2210 00 00 00 30 1a 25 0b 07 03 03 03 03 02 00 00 00 &2220 00 00 00 20 1a 0f 07 0b 07 00 03 03 00 00 00 00 &2230 00 00 00 00 30 03 0f 03 07 03 01 03 03 00 00 00 ; sprite_05_data (SPRITE_JUNGLE_DENSE_FOLIAGE) &2240 04 08 04 04 08 04 0c 04 00 0c 08 04 0c 04 08 04 &2250 04 08 00 04 08 0c 08 04 08 00 0c 04 08 04 0c 04 &2260 04 0c 08 04 08 08 0c 04 08 0c 04 0c 08 08 04 00 &2270 08 04 0c 04 08 08 04 00 08 04 08 04 08 04 0c 08 ; sprite_06_data (SPRITE_JUNGLE_FOLIAGE) &2280 04 00 04 08 00 04 08 00 04 00 08 00 04 04 08 00 &2290 00 04 00 04 00 00 08 0c 00 00 04 08 04 00 08 04 &22a0 04 00 0c 04 00 08 00 04 08 00 00 04 00 08 04 08 &22b0 00 04 00 08 00 08 04 08 00 08 04 00 08 00 04 00 ; sprite_07_data (SPRITE_JUNGLE_LIGHT_FOLIAGE) &22c0 00 00 04 00 08 00 00 00 04 00 00 00 08 00 04 00 &22d0 04 00 00 00 08 00 00 08 00 00 08 00 04 00 00 04 &22e0 00 00 08 00 04 08 08 00 04 00 00 04 00 08 00 00 &22f0 00 04 08 00 00 00 04 00 00 00 0c 00 00 04 00 08 ; sprite_08_data (SPRITE_JUNGLE_LARGE_TRUNK_LEFT) &2300 0d 0d 0d 04 04 04 0d 0d 05 05 0d 0d 0d 04 04 04 &2310 07 07 0b 0b 0b 0b 03 0b 0b 0b 07 07 07 0b 0b 0b &2320 03 03 0b 0b 03 03 0b 0b 0b 03 03 03 0b 0b 0b 0b &2330 07 07 03 03 0b 0b 0b 03 07 07 07 0b 0b 0a 02 02 ; sprite_09_data (SPRITE_JUNGLE_LARGE_TRUNK_RIGHT) &2340 03 03 03 07 07 07 03 03 03 03 0b 0b 03 03 03 03 &2350 03 02 02 02 03 03 03 03 02 02 03 03 03 0b 0b 03 &2360 01 01 03 03 02 03 01 01 02 03 03 03 02 03 02 03 &2370 02 00 02 01 02 03 02 01 02 00 02 01 02 00 02 01 ; sprite_63_data (SPRITE_LOGO_SECTION) &2380 00 05 0f 0e 1a 0f 05 00 00 00 0a 0a 0a 0a 00 00 ; plot_title_screen_sprites &2390 a9 41 LDA #&41 ; SPRITE_PLAYER_STANDING &2392 a2 02 LDX #&02 &2394 a0 90 LDY #&90 &2396 20 20 0d JSR &0d20 ; plot_sprite &2399 a9 5f LDA #&5f ; SPRITE_JEEP &239b a2 39 LDX #&39 &239d a0 94 LDY #&94 &239f 20 20 0d JSR &0d20 ; plot_sprite &23a2 a9 49 LDA #&49 ; SPRITE_SOLDIER_WALKING_THREE &23a4 a2 4a LDX #&4a &23a6 a0 90 LDY #&90 &23a8 20 20 0d JSR &0d20 ; plot_sprite &23ab a9 4e LDA #&4e ; SPRITE_HELICOPTER &23ad a2 34 LDX #&34 &23af a0 76 LDY #&76 &23b1 20 20 0d JSR &0d20 ; plot_sprite &23b4 a9 61 LDA #&61 ; SPRITE_ROTORS_TWO &23b6 a2 34 LDX #&34 &23b8 a0 74 LDY #&74 &23ba 4c 20 0d JMP &0d20 ; plot_sprite ; unused &23bd 98 98 00 ; sprite_0b_data (SPRITE_JUNGLE_FLOWER_YELLOW) &23c0 00 00 00 00 04 04 00 00 04 04 04 04 00 00 00 00 &23d0 05 05 05 0c 08 04 08 0c 0c 08 04 04 04 00 00 00 &23e0 05 0f 0f 0e 0c 0c 08 0c 0c 08 0c 08 08 08 08 08 &23f0 00 00 00 08 0c 04 08 08 0c 0c 04 04 00 00 00 00 ; sprite_0c_data (SPRITE_JUNGLE_FLOWER_MAGENTA) &2400 00 01 00 00 00 00 00 00 00 00 04 0c 08 00 04 04 &2410 02 01 03 03 04 04 04 00 00 08 0c 04 04 0c 08 00 &2420 02 02 02 00 00 00 00 08 08 08 04 0c 04 08 08 08 &2430 00 00 00 00 00 00 00 00 00 00 00 08 0c 04 00 00 ; sprite_0d_data (SPRITE_JUNGLE_VINE_WITH_SUPPORT) &2440 00 00 00 00 00 00 00 00 00 00 00 00 00 10 50 00 &2450 0c 0c 0c 04 04 0c 08 0c 0c 04 00 04 30 b0 58 0c &2460 00 08 00 08 08 00 08 00 00 08 08 08 18 70 a0 08 &2470 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; sprite_0e_data (SPRITE_JUNGLE_VINE) &2480 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &2490 08 0c 04 04 00 04 04 0c 0c 08 0c 04 04 00 04 04 &24a0 08 00 08 0c 0c 08 04 08 00 08 00 00 08 0c 0c 08 &24b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; sprite_0f_data (SPRITE_JUNGLE_TRUNK) &24c0 00 00 00 05 05 05 05 05 05 05 05 00 00 00 00 00 &24d0 0b 0b 0b 07 03 0b 0b 07 07 07 03 0b 0b 0b 0f 0f &24e0 03 0b 0b 03 03 03 03 03 03 03 03 03 03 03 03 03 &24f0 02 02 02 02 00 00 02 00 00 02 02 00 02 02 02 02 ; plot_halo &2500 a6 69 LDX &69 ; player_x &2502 a4 6a LDY &6a ; player_y &2504 a5 6d LDA &6d ; player_flipped # Negative if player facing left &2506 10 02 BPL &250a ; not_facing_left &2508 e8 INX &2509 e8 INX ; not_facing_left &250a ad 42 01 LDA &0142 ; player_is_ducking # Negative if player is ducking &250d 30 09 BMI &2518 ; plot_offset_halo ; plot_unoffset_halo &250f 88 DEY &2510 88 DEY &2511 88 DEY &2512 88 DEY &2513 a9 62 LDA #&62 ; SPRITE_HALO &2515 4c 20 0d JMP &0d20 ; plot_sprite ; plot_offset_halo &2518 c8 INY &2519 c8 INY &251a c8 INY &251b c8 INY &251c a9 62 LDA #&62 ; SPRITE_HALO &251e 4c 20 0d JMP &0d20 ; plot_sprite ; unused &2521 ea NOP &2522 ea NOP &2523 ea NOP ; unplot_halo &2524 a6 6c LDX &6c ; player_previous_x &2526 a4 6b LDY &6b ; player_previous_y &2528 a5 6e LDA &6e ; player_previous_flipped &252a 10 02 BPL &252e ; not_flipped &252c e8 INX &252d e8 INX ; not_flipped &252e ad 6f 01 LDA &016f ; player_previous_is_ducking &2531 30 e5 BMI &2518 ; plot_offset_halo &2533 10 da BPL &250f ; plot_unoffset_halo ; unused &2535 00 00 00 00 00 00 00 00 00 00 00 ; sprite_11_data (SPRITE_FACTORY_GIRDER) &2540 0f 30 0c 0c 00 00 00 00 04 04 08 08 0f 0c 0c 0c &2550 0f 30 0c 0c 04 04 08 08 00 00 00 00 0f 0c 0c 0c &2560 0f 30 0c 0c 08 08 04 04 00 00 00 00 0f 0c 0c 0c &2570 0f 30 0c 0c 00 00 00 00 08 08 04 04 0f 0c 0c 0c ; sprite_12_data (SPRITE_FACTORY_BRICKS) &2580 0f 03 03 03 0f 0b 03 03 0f 03 03 03 0f 0b 03 03 &2590 0f 07 07 07 0f 03 03 03 0f 07 07 07 0f 03 03 03 &25a0 0f 0b 03 03 0f 03 03 03 0f 0b 03 03 0f 03 03 03 &25b0 0f 03 03 03 0f 07 07 07 0f 03 03 03 0f 07 07 07 ; sprite_13_data (SPRITE_FACTORY_GROUND) &25c0 30 0c 08 04 08 04 08 04 08 00 08 04 00 04 00 00 &25d0 30 0c 0c 04 08 0c 08 04 04 08 00 04 00 00 00 00 &25e0 30 0c 08 04 08 04 08 08 04 08 00 00 00 00 08 00 &25f0 30 0c 08 04 0c 04 08 04 00 04 08 00 04 00 00 08 ; sprite_14_data (SPRITE_FACTORY_PIPE_HORIZONTAL) &2600 00 00 00 00 0a 0f 1a 0c 0e 08 0c 08 00 00 00 00 &2610 00 00 00 00 00 0f 30 0c 0c 08 04 00 00 00 00 00 &2620 00 00 00 00 0a 0f 1a 0c 0e 0c 08 08 00 00 00 00 &2630 00 00 00 00 00 0f 30 0c 0c 04 08 00 00 00 00 00 ; sprite_15_data (SPRITE_FACTORY_PIPE_TOP_RIGHT) &2640 00 00 00 00 0a 0f 1a 0c 0e 08 0c 08 00 00 00 00 &2650 00 00 00 00 00 0f 25 0e 0c 0c 0c 0c 04 08 04 08 &2660 00 00 00 00 00 00 0a 0a 0f 0d 0f 0d 0c 0d 0c 0c &2670 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; sprite_16_data (SPRITE_FACTORY_PIPE_VERTICAL) &2680 05 00 00 00 00 00 00 00 00 05 00 00 00 00 00 00 &2690 0d 0e 08 04 08 04 08 04 0f 0e 08 04 08 04 08 04 &26a0 0f 0f 0d 0d 0d 0c 0d 0d 0f 0f 0d 0c 0d 0d 0c 0d &26b0 0a 0a 00 00 00 00 00 00 0a 0a 00 00 00 00 00 00 ; sprite_17_data (SPRITE_FACTORY_PIPE_BOTTOM_RIGHT) &26c0 05 00 00 00 0a 0f 0e 0e 0c 0a 0c 08 00 00 00 00 &26d0 0d 0e 0c 04 0e 0c 0c 0c 08 04 0c 00 00 00 00 00 &26e0 0f 0f 0c 0d 0d 0d 04 04 08 08 00 00 00 00 00 00 &26f0 0a 0a 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; sprite_18_data (SPRITE_FACTORY_PIPE_BOTTOM_LEFT) &2700 00 05 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &2710 0e 0d 04 08 04 08 04 08 04 00 00 00 00 00 00 00 &2720 0e 0d 0c 08 0d 0c 0c 0c 04 08 04 00 00 00 00 00 &2730 0a 00 00 00 00 0f 30 0c 0c 08 04 00 00 00 00 00 ; sprite_19_data (SPRITE_FACTORY_PIPE_TOP_LEFT) &2740 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &2750 00 00 00 00 00 00 05 04 08 04 08 04 08 04 08 04 &2760 00 00 00 00 00 0f 30 04 0c 0c 0c 0c 08 0d 0d 0d &2770 00 00 00 00 00 0f 30 0c 0c 04 08 04 08 00 00 00 ; sprite_1a_data (SPRITE_FACTORY_STRUT_VERTICAL) &2780 00 00 00 00 00 00 00 04 00 04 00 00 00 00 00 00 &2790 0d 04 0d 04 0d 04 0d 0e 0d 0e 00 04 0d 04 0d 04 &27a0 0a 0a 0a 0a 0a 0a 0f 0f 0f 0f 08 0a 0a 0a 0a 0a &27b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; sprite_1b_data (SPRITE_FACTORY_CHECKBOARD) &27c0 06 06 09 09 06 06 09 09 06 06 09 09 06 06 09 09 &27d0 06 06 09 09 06 06 09 09 06 06 09 09 06 06 09 09 &27e0 06 06 09 09 06 06 09 09 06 06 09 09 06 06 09 09 &27f0 06 06 09 09 06 06 09 09 06 06 09 09 06 06 09 09 ; sprite_1c_data (SPRITE_FACTORY_CHECKBOARD_TOP) &2800 30 0c 00 09 06 06 09 09 06 06 09 09 06 06 09 09 &2810 30 0c 00 09 06 06 09 09 06 06 09 09 06 06 09 09 &2820 30 0c 00 09 06 06 09 09 06 06 09 09 06 06 09 09 &2830 30 0c 00 09 06 06 09 09 06 06 09 09 06 06 09 09 ; sprite_1d_data (SPRITE_FACTORY_WINDOW) &2840 0f 0f 0a 0a 0a 0a 0f 0a 0a 0a 0a 0a 0a 0a 0f 0f &2850 0f 0f 00 00 00 00 0f 00 00 00 00 00 00 00 0f 0f &2860 0f 0f 00 00 00 00 0f 00 00 00 00 00 00 00 0f 0f &2870 0f 0f 05 05 05 05 0f 05 05 05 05 05 05 05 0f 0f ; sprite_1e_data (SPRITE_FACTORY_STRUT_CROSS) &2880 00 00 00 00 00 00 00 0f 0d 0c 08 00 00 00 00 00 &2890 0d 04 0d 04 0d 04 0f 0f 0d 0f 0a 00 0d 04 0d 04 &28a0 0a 0a 0a 0a 0a 0a 0a 0f 0f 0e 0a 0a 0a 0a 0a 0a &28b0 00 00 00 00 00 00 00 0f 0d 0c 08 00 00 00 00 00 ; sprite_1f_data (SPRITE_FACTORY_STRUT_HORIZONTAL) &28c0 00 00 00 00 00 00 00 0f 0d 0c 08 00 00 00 00 00 &28d0 00 00 00 00 00 00 00 0f 0d 0c 08 00 00 00 00 00 &28e0 00 00 00 00 00 00 00 0f 0d 0c 08 00 00 00 00 00 &28f0 00 00 00 00 00 00 00 0f 0d 0c 08 00 00 00 00 00 ; unused &2900 44 58 23 b0 b0 b0 50 50 a0 a0 70 70 70 70 a0 a0 ; sprite_53_data (SPRITE_PARACHUTE_SCORE) &2910 00 50 00 00 00 00 00 00 a0 a0 a0 a0 a0 a0 a0 a0 &2920 50 a0 a0 a0 a0 a0 a0 50 00 a0 a0 a0 a0 a0 a0 00 &2930 50 a0 a0 a0 a0 a0 a0 50 00 a0 a0 a0 a0 a0 a0 00 &2940 50 a0 a0 a0 a0 a0 a0 50 00 a0 a0 a0 a0 a0 a0 00 ; sprite_52_data (SPRITE_PARACHUTE) &2950 00 00 00 40 40 90 90 90 c0 90 90 40 40 00 00 00 &2960 00 00 00 00 00 00 00 00 00 40 90 30 30 70 70 70 &2970 c0 80 80 60 60 90 90 40 40 00 00 00 00 00 00 00 &2980 40 90 70 f0 f0 f0 f0 f0 f0 c0 90 90 90 c0 c0 60 &2990 60 90 90 c0 d0 90 d0 c0 c0 b0 b0 30 30 30 30 30 &29a0 30 c0 80 80 80 60 60 60 60 60 30 c0 70 b0 70 c0 &29b0 c0 70 70 70 70 30 30 30 30 c0 90 90 90 90 60 60 &29c0 60 30 30 c0 70 b0 70 c0 80 60 b0 f0 f0 f0 f0 f0 &29d0 f0 c0 80 c0 c0 90 90 60 60 80 80 80 80 80 80 80 &29e0 00 80 60 30 30 b0 b0 b0 c0 90 90 60 60 80 80 00 &29f0 00 00 00 00 00 00 00 00 00 00 00 80 80 60 60 60 &2a00 80 80 80 00 00 00 00 00 00 00 00 00 00 00 00 00 ; sprite_51_data (SPRITE_BOMB) &2a10 00 40 90 90 40 00 c0 30 30 90 60 c0 c0 60 30 90 &2a20 60 c0 c0 30 30 30 30 c0 ; unused &2a28 00 00 80 c0 60 60 30 30 ; sprite_50_data (SPRITE_GRENADE) &2a30 00 00 40 90 90 90 40 00 40 d0 30 30 30 30 30 c0 &2a40 e0 d0 c0 60 60 60 80 00 ; unused &2a48 00 00 80 c0 60 60 30 30 ; sprite_4f_data (SPRITE_BOSS) &2a50 00 00 00 00 00 40 40 40 c0 90 90 90 90 90 90 40 &2a60 00 00 00 00 00 00 00 00 00 40 40 00 00 00 40 c0 &2a70 90 90 30 60 60 60 30 30 30 30 30 c0 00 00 00 00 &2a80 00 00 00 40 90 30 30 90 00 c0 90 30 60 c0 c0 c0 &2a90 c0 c0 30 30 30 30 30 c0 40 00 00 40 40 90 90 30 &2aa0 30 30 30 c0 c0 90 30 c0 c0 c0 c0 c0 c0 c0 30 c0 &2ab0 30 30 c0 30 c0 90 90 30 30 60 60 80 60 30 30 60 &2ac0 c0 30 30 c0 c0 c0 90 90 90 30 30 90 30 30 90 30 &2ad0 c0 60 60 80 d0 00 00 00 50 80 80 00 c0 30 30 30 &2ae0 30 30 70 70 70 70 70 30 30 30 30 90 c0 f0 f0 f0 &2af0 50 f0 a0 50 00 a0 00 00 c0 30 30 30 30 30 70 70 &2b00 f0 30 30 30 30 30 60 90 c0 f0 a0 f0 f0 a0 f0 50 &2b10 00 a0 00 00 c0 30 30 30 30 30 70 70 70 70 f0 30 &2b20 30 30 60 90 c0 90 90 e0 40 a0 00 00 00 40 40 00 &2b30 c0 60 30 30 30 30 b0 30 f0 70 70 30 30 90 60 90 &2b40 c0 60 60 30 30 90 90 40 90 30 30 90 00 c0 60 30 &2b50 30 30 30 30 30 30 30 30 60 90 60 c0 80 00 00 80 &2b60 80 60 60 30 30 30 30 c0 00 00 80 c0 60 60 30 30 &2b70 60 30 60 90 60 90 60 c0 00 00 00 00 00 00 00 80 &2b80 60 30 30 60 00 00 00 00 00 80 80 80 c0 c0 60 c0 &2b90 60 c0 c0 80 00 00 00 00 00 00 00 00 00 80 80 00 ; sprite_4e_data (SPRITE_HELICOPTER) &2ba0 00 00 00 00 00 00 40 40 40 d0 d0 d0 d0 d0 40 40 &2bb0 00 00 00 00 00 40 d0 d0 e0 e0 e0 d0 d0 c0 e0 f0 &2bc0 f0 f0 d0 40 00 40 d0 e0 c0 c0 c0 c0 c0 60 30 30 &2bd0 c0 f0 f0 f0 f0 c0 40 d0 e0 c0 90 30 f0 f0 30 90 &2be0 60 d0 f0 f0 f0 e0 d0 c0 c0 f0 c0 c0 60 30 30 30 &2bf0 60 d0 f0 f0 f0 f0 f0 e0 d0 c0 c0 f0 f0 d0 d0 d0 &2c00 d0 d0 f0 f0 f0 f0 f0 e0 d0 e0 d0 c0 00 80 e0 f0 &2c10 f0 f0 f0 f0 e0 d0 e0 f0 d0 e0 d0 e0 80 00 00 00 &2c20 00 80 e0 f0 f0 f0 c0 d0 e0 e0 80 80 80 00 00 00 &2c30 00 00 00 00 c0 f0 f0 f0 c0 80 00 00 00 00 00 00 &2c40 00 00 00 00 40 d0 f0 f0 f0 f0 c0 00 00 00 00 00 &2c50 00 00 00 00 40 d0 f0 f0 f0 f0 f0 f0 c0 00 00 00 &2c60 00 00 00 00 00 00 80 e0 e0 e0 e0 e0 e0 e0 80 00 &2c70 00 00 00 00 00 00 00 00 ; unused # Source code fragment &2c78 6c 6f 6f 70 20 4c 44 41 ; "loop LDA" ; sprite_4b_data (SPRITE_EXPLOSION_ONE) &2c80 00 00 00 40 40 40 00 40 d0 d0 40 00 40 d0 c0 d0 &2c90 40 00 00 00 00 00 40 d0 e0 d0 f0 d0 f0 f0 d0 e0 &2ca0 d0 f0 e0 e0 d0 e0 d0 d0 40 00 00 40 d0 e0 f0 e0 &2cb0 d0 f0 f0 f0 f0 f0 f0 f0 f0 d0 e0 f0 d0 f0 c0 c0 &2cc0 f0 d0 f0 f0 d0 e0 f0 f0 f0 f0 f0 f0 c0 f0 e0 d0 &2cd0 f0 e0 d0 40 00 80 e0 d0 f0 d0 e0 d0 e0 e0 f0 e0 &2ce0 d0 e0 f0 e0 f0 d0 f0 e0 80 00 00 00 80 80 e0 e0 &2cf0 80 e0 e0 c0 80 80 00 80 e0 e0 80 80 00 00 ; unused &2cfe f0 f0 ; sprite_4c_data (SPRITE_EXPLOSION_TWO) &2d00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &2d10 00 00 00 00 00 00 00 00 00 40 d0 c0 d0 40 d0 40 &2d20 40 d0 d0 40 d0 40 00 00 00 00 00 00 00 80 e0 d0 &2d30 f0 d0 f0 e0 f0 f0 d0 e0 f0 d0 f0 c0 00 00 00 00 &2d40 00 00 c0 f0 d0 e0 f0 d0 f0 f0 f0 e0 f0 f0 e0 d0 &2d50 40 00 00 00 00 00 00 00 80 40 e0 d0 f0 e0 d0 e0 &2d60 f0 d0 e0 e0 80 00 00 00 00 00 00 00 00 00 00 00 &2d70 80 80 00 80 00 80 80 00 00 00 00 00 00 00 ; unused &2d7e f0 f0 ; sprite_4d_data (SPRITE_EXPLOSION_THREE) &2d80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &2d90 00 00 00 00 00 00 00 00 00 00 00 00 00 40 40 40 &2da0 00 40 00 00 00 00 00 00 00 00 00 00 00 00 00 40 &2db0 d0 d0 f0 e0 f0 d0 e0 d0 d0 40 00 00 00 00 00 00 &2dc0 00 00 00 00 40 d0 e0 d0 f0 f0 e0 f0 f0 f0 e0 80 &2dd0 00 00 00 00 00 00 00 00 00 00 80 e0 80 e0 80 e0 &2de0 e0 80 80 00 00 00 00 00 00 00 00 00 00 00 00 00 &2df0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; unused &2dfe f0 f0 ; sprite_47_data (SPRITE_SOLDIER_WALKING_ONE) &2e00 00 00 00 00 00 00 00 00 80 e0 f0 e0 c0 00 00 00 &2e10 00 00 40 40 40 40 d0 40 00 40 90 d0 d0 d0 90 40 &2e20 00 c0 b0 b0 b0 c0 40 90 90 90 30 30 30 d0 f0 f0 &2e30 c0 30 30 b0 b0 30 60 90 90 90 60 30 30 c0 30 30 &2e40 30 30 60 60 60 60 e0 e0 00 80 60 60 60 d0 70 30 &2e50 30 30 30 30 60 90 30 60 90 90 30 c0 00 00 00 00 &2e60 00 00 00 80 e0 f0 f0 f0 d0 f0 d0 f0 e0 80 80 c0 &2e70 f0 f0 f0 d0 d0 40 00 00 ; sprite_48_data (SPRITE_SOLDIER_WALKING_TWO) &2e78 00 00 00 00 00 00 00 80 e0 f0 e0 c0 00 00 00 00 &2e88 00 00 00 00 00 00 00 00 40 90 d0 d0 d0 90 40 00 &2e98 c0 b0 b0 b0 c0 40 40 40 40 00 00 00 00 00 00 40 &2ea8 30 30 b0 b0 30 30 60 90 90 30 30 30 c0 30 30 30 &2eb8 30 90 90 90 40 40 d0 f0 80 60 60 60 60 d0 70 30 &2ec8 30 60 60 c0 30 30 30 60 60 60 30 30 30 b0 f0 f0 &2ed8 00 00 00 80 e0 f0 f0 f0 d0 f0 d0 f0 e0 80 80 00 &2ee8 00 00 80 80 80 80 80 80 ; sprite_49_data (SPRITE_SOLDIER_WALKING_THREE) &2ef0 00 00 00 00 00 00 00 80 e0 f0 e0 c0 00 00 00 00 &2f00 00 40 40 40 40 40 d0 40 00 40 90 d0 d0 d0 90 40 &2f10 c0 b0 b0 b0 c0 c0 40 90 90 60 30 30 30 d0 f0 f0 &2f20 c0 30 30 b0 b0 30 60 90 90 c0 30 30 30 c0 30 30 &2f30 30 30 c0 60 60 60 e0 e0 00 80 60 60 60 d0 70 30 &2f40 30 30 30 30 60 90 30 c0 30 30 30 c0 00 00 00 00 &2f50 00 00 00 80 e0 f0 f0 f0 d0 f0 d0 f0 e0 80 80 c0 &2f60 f0 f0 f0 d0 d0 40 00 00 ; sprite_4a_data (SPRITE_SOLDIER_JUMPING) &2f68 00 00 00 00 00 00 00 80 e0 f0 e0 c0 00 00 00 00 &2f78 00 40 40 00 00 00 00 00 00 40 90 d0 d0 d0 90 40 &2f88 c0 b0 b0 b0 c0 c0 40 90 90 60 30 90 40 00 00 00 &2f98 c0 30 30 b0 b0 30 60 90 90 c0 30 30 30 c0 30 30 &2fa8 30 30 c0 30 c0 00 00 00 00 80 60 60 60 d0 70 30 &2fb8 30 30 30 30 60 90 30 c0 30 30 c0 f0 d0 d0 40 00 &2fc8 00 00 00 80 e0 f0 f0 f0 d0 f0 d0 f0 e0 80 80 c0 &2fd8 f0 f0 f0 d0 d0 c0 00 00 ; area_one_data &2fe0 00 00 00 00 70 67 56 67 70 00 00 33 ; 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 &2fec 00 70 00 00 77 65 55 55 6f 0f 0f 33 ; f f f 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 &2ff8 67 56 56 70 00 07 07 07 00 11 22 33 ; e e f 0 1 1 2 3 4 4 5 6 7 7 8 9 a a b c d d &3004 85 85 84 87 80 84 80 80 80 81 82 33 ; 0 c 8 4 0 c 8 4 0 c 8 4 0 c 8 4 0 c 8 4 0 c &3010 59 59 69 49 09 09 19 29 29 29 29 33 ; &301c 75 07 00 04 00 00 11 22 12 22 22 33 ; .:8HH88. .:8888888. .::. .:88:: &3028 00 00 00 00 00 0b 11 22 11 22 22 33 ; .:88HH8. .:88888:. | :. .:88: &3034 70 00 40 00 00 00 00 00 01 02 c2 33 ; :8-HH: ----H88:. |f :8:. .H.. &3040 56 67 44 0d 0e 0d 0e 0d 00 00 00 aa ; ..HH-- = HH:. ____ 888: H &304c 55 55 84 80 80 80 80 80 80 80 80 3a ; ... HH = HH--- ###__ :88. H &3058 55 55 55 69 49 09 09 09 09 19 29 33 ; .:8:. -HH f = HH ##### .|. H _ &3064 55 65 76 07 44 00 00 00 00 11 22 33 ; :888. HH_____ = HH f ####___| __# &3070 07 07 00 00 00 00 c0 11 22 21 22 33 ; .:88. HH##### = HH ______####| __### &307c 70 00 00 10 20 20 20 11 22 22 22 33 ; .|: HH##____ HH #########__ ##_#8 &3088 66 f0 f0 11 22 22 22 11 22 22 22 33 ; | ___HH###### HH____#######__# ###_8 &3094 07 00 0b 01 11 22 12 22 22 22 12 33 ; | ###HH######f HH##########__## ####_ &30a0 00 00 60 50 60 70 11 22 12 11 21 33 ; ~~~~~~~~~~~~~~~~!!!~~~~~~~~~~~~~~~# !!#~~~~ &30ac 00 76 65 55 55 7f 0f 0f 01 02 02 02 &30b8 70 00 07 06 07 00 00 00 00 00 00 aa ; 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 &30c4 56 67 70 00 00 00 00 11 22 22 22 32 ; 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 &30d0 65 55 78 08 08 08 11 22 21 12 22 33 ; e f 0 0 1 2 3 3 4 5 6 6 7 8 9 9 a b c c d &30dc 76 76 07 00 00 11 22 62 55 55 51 33 ; 8 4 0 c 8 4 0 c 8 4 0 c 8 4 0 c 8 4 0 c 8 &30e8 56 57 60 70 00 01 02 12 26 65 65 33 ; &30f4 55 55 55 68 78 08 08 11 22 22 22 33 ; .:888:. .::HH:. .|.. =.:88HH8::888.:88 &3100 76 76 76 07 10 20 20 20 20 11 22 33 ; ..888:. .:HH--- |. = .:8HH:.:8H: :88 &310c 00 00 00 00 11 22 11 22 22 11 22 33 ; :88:. HH = | = ..HH .HH. :| &3118 70 00 00 40 00 00 11 22 22 11 22 33 ; .H:. ---HH = | = HH-- HH | &3124 66 67 00 44 00 00 01 02 11 22 22 33 ; H. ___ HH ___ = HH HH- | &3130 98 98 98 98 98 98 98 98 98 98 98 33 ; __ H ### HH---- ### = ---HH HH | &313c 76 44 00 00 00 44 0e 0d 7e 7d 00 33 ; ## H #_____ HH= ### HH HH ___ &3148 00 04 0e 0d 00 44 00 07 76 66 7f 33 ; :#___ ###### HH= . ______ HH----H ### &3154 00 00 00 00 00 00 00 11 22 22 22 33 ; 8:### #####__HH=.:.###### ----HH HH ##_ &3160 f7 f0 f0 f0 11 22 22 11 22 22 22 33 ; 88:##______##HH=.::###### HH HH ### &316c 77 07 00 00 01 02 02 11 22 22 22 33 ; 88:##########HH |.###### f HHf HH ### &3178 e0 e0 d0 d0 e0 d0 00 00 00 00 b0 33 ; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~! ### &3184 67 70 00 00 00 40 00 00 44 00 00 33 &3190 55 56 77 00 00 44 00 00 44 00 00 33 ; 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 &319c 98 98 98 98 98 98 98 98 98 98 98 33 ; 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 &31a8 65 76 00 44 00 00 00 44 00 00 0b 33 ; e f f 0 1 2 2 3 4 5 5 6 7 8 8 9 a b b c d e &31b4 56 56 87 80 80 80 80 44 80 80 80 33 ; 4 0 c 8 4 0 c 8 4 0 c 8 4 0 c 8 4 0 c 8 4 0 &31c0 55 69 79 09 49 09 09 09 09 09 09 a3 ; &31cc 67 60 00 00 00 00 10 20 20 20 20 20 ; 8.8:88:. ....:..HH:... HH &31d8 55 55 f6 f0 f0 f0 11 22 12 22 22 22 ; . :88:. ..----HH.. ---HH &31e4 75 07 00 00 00 00 11 22 11 22 22 33 ; ..H. ..:.HH--- _____ :. HH &31f0 65 56 77 00 00 00 01 02 11 22 22 33 ; H . .HH ___####:::. HH- &31fc 55 65 78 08 08 08 08 08 08 08 08 33 ; H -----HH ___#######:8.. HH &3208 76 07 00 00 00 00 00 00 00 70 67 33 ; H HH ####_____#.|. __ HH &3214 00 00 00 00 00 00 00 00 00 76 44 a3 ; ___ H HH- #___###### |__## HH &3220 77 70 00 00 00 00 00 00 00 00 44 aa ; ### H --HH ##########__#### HH &322c 77 47 70 00 44 00 00 00 00 00 44 aa ; ____H HH_____#######__###### HH &3238 76 44 67 07 44 00 00 40 00 00 44 aa ; ####H .:. HH#######____######____HH. &3244 87 84 87 87 84 80 80 84 80 80 8f 33 ; ####H .:--------|HH#####################HH. &3250 69 79 49 09 09 09 49 09 19 29 29 33 ; ~~~~~~~~~!!!!!!!~~~~~~~~~~~~~~~~~~~~~~~~~~~ &325c 77 07 44 00 00 00 00 00 11 22 22 33 &3268 07 00 00 00 10 20 20 20 11 22 22 33 ; 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 &3274 00 00 00 00 11 22 11 22 22 22 22 33 ; 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 &3280 00 00 00 11 22 12 21 22 22 11 22 33 ; e f 0 1 1 2 3 4 4 5 6 7 7 8 9 a a b c d d &328c 00 00 11 21 22 11 22 22 22 11 22 33 ; c 8 4 0 c 8 4 0 c 8 4 0 c 8 4 0 c 8 4 0 c &3298 00 00 11 22 22 11 22 22 12 22 22 33 ; &32a4 00 00 01 62 62 72 02 12 21 22 22 33 ; .:8888:.HH .. H::HH8... HH ..:8 &32b0 00 00 76 66 75 7f 1f 21 22 22 22 33 ; ::8888:HH.::.H.:HH.:::. HH .8: &32bc 00 40 00 07 07 10 21 22 22 11 22 33 ; .:8888:.HH::::H .HH:88:. ______ .: &32c8 00 44 00 00 00 01 02 02 02 11 22 33 ; - .8:H:. HH:::.H HH8H:. ###### . &32d4 98 98 98 98 98 98 98 98 98 98 98 33 ; ..H HH:|. H HH:H ###### &32e0 00 00 00 44 00 00 00 00 70 67 67 33 ; .. H HH.| H HH H ___8888___ &32ec 00 00 00 00 00 70 67 77 66 56 55 33 ; .:. H HH | H HH H ##8 8## &32f8 67 60 67 70 00 07 07 76 76 65 55 33 ; ..:. H HH | H. HH H #8 8# &3304 55 56 55 65 77 00 00 00 70 77 76 33 ; .:::. .H HH | .H:.HH H ___8 8___ &3310 55 55 55 68 08 08 08 08 08 08 08 33 ; ::88:..H HH |.:H8:HH H ###8 8### &331c 76 65 76 07 00 00 00 00 00 00 00 33 ; :8888:.H HH |.:H88HH H ###8 8### &3328 98 98 98 98 98 98 98 98 98 98 98 33 ; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ &3334 70 67 66 66 f6 f7 f0 f0 f0 f0 f0 33 &3340 07 76 66 76 07 00 00 00 70 67 67 33 &334c 68 78 08 08 08 08 08 78 68 58 58 33 &3358 86 86 87 80 80 80 80 80 87 86 85 33 &3364 59 79 69 59 69 09 09 09 09 09 09 33 &3370 77 66 55 68 08 08 08 08 08 08 08 33 &337c 07 76 76 07 00 00 00 00 00 00 00 33 &3388 00 00 00 00 00 00 00 00 11 22 22 33 &3394 00 00 00 00 00 11 22 52 51 52 52 33 &33a0 00 00 11 22 22 51 05 00 00 00 00 33 &33ac 98 98 11 22 22 55 00 00 00 00 00 33 &33b8 00 00 11 22 22 15 50 00 00 00 00 33 &33c4 00 00 00 00 00 11 22 25 15 25 25 33 &33d0 77 70 00 00 00 00 00 00 11 22 22 33 &33dc 56 65 67 70 00 00 00 00 00 00 00 33 ; area_two_data &33e8 00 20 20 20 20 20 20 20 20 20 20 33 ; 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 &33f4 00 11 60 60 11 60 60 44 74 00 00 33 ; 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 &3400 00 11 49 06 11 06 06 07 90 60 60 33 ; e f 0 0 1 2 3 3 4 5 6 6 7 8 9 9 a b c c d e &340c 00 11 54 79 11 26 26 16 46 06 06 33 ; 8 4 0 c 8 4 0 c 8 4 0 c 8 4 0 c 8 4 0 c 8 4 &3418 06 06 16 11 51 60 79 11 07 00 00 33 ; &3424 00 00 01 f2 02 02 f2 02 02 02 02 33 ; p | | pp &3430 00 00 00 ff 00 a0 ef a0 e0 a0 a0 33 ; |------p +-+ pppp &343c 00 00 00 ff 00 00 00 00 ff 00 00 33 ; | pppppp-- +---+ | pppppp pp &3448 00 00 fe 0e 0a 11 0a 0a 0e 0a 0a 33 ; | pp pp--|-----+ | | p pppp &3454 00 00 ff 00 00 11 00 00 00 00 00 33 ; |-------p| | |_______ ppp-------- &3460 0a fe 0e 0a ca b1 b0 b0 b0 b0 b0 33 ; | pp p| p| | -----#8#8#8# ----|pppp| &346c 0a 0e 0a 0a cc bd bb bd bb bd bb 33 ; | pp p|pp|--+ | #######pp pp |pppp| &3478 00 00 00 00 cc bd bb bd bb bd bb 33 ; |ppp p---| | | #8#8#8# p ppp |pppp|__ &3484 00 00 90 60 cc bd bb bd bb bd bb 33 ; |pp pppp | +--+ ####### ppppp |----|## &3490 00 00 44 00 00 00 54 60 80 00 00 33 ; | pp | | | #8#8#8# pppp|pppp|#8 &349c 00 00 54 60 60 10 00 90 44 60 60 33 ; | pp | | | ####### pp p|pppp|## &34a8 00 49 06 96 66 11 66 67 65 86 06 33 ; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ &34b4 66 67 79 07 11 21 20 20 20 25 26 33 &34c0 00 00 00 00 11 49 58 79 11 79 58 33 ; 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 &34cc 00 00 00 00 11 54 79 58 11 58 79 33 ; 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 &34d8 00 00 00 00 11 02 02 c2 b2 b2 b2 33 ; f f 0 1 2 2 3 4 5 5 6 7 8 8 9 a b b c d e &34e4 00 00 00 00 00 00 00 cc bb bd bb 33 ; 0 c 8 4 0 c 8 4 0 c 8 4 0 c 8 4 0 c 8 4 0 &34f0 00 00 00 00 00 00 00 cc bb bd bb 33 ; &34fc 00 00 00 00 00 00 00 cc bb bd bb 33 ; &3508 00 06 02 02 02 02 02 02 22 22 22 33 ; p p &3514 00 00 00 00 00 00 90 60 72 42 42 33 ; | pppp | &3520 00 00 00 00 00 00 54 c0 b9 b7 b4 33 ; | pp|---| p _______| &352c 00 00 00 00 00 00 00 cc bb bb bb 33 ; | p | | p #######|-----| &3538 00 00 00 00 00 00 00 cc bb bd bb 33 ; | p p | |----|8|8|8||---+-| &3544 00 00 00 00 00 90 20 cc bb bd bb 33 ; | ppp | p | | p |||||||| | | &3550 00 00 00 90 60 60 60 74 00 00 00 33 ; _____| p _______pp |---| p |8|8|8||| | | &355c 00 00 00 24 20 20 20 20 20 20 20 33 ; #####|||pp####### | |----||||||||||-+-| &3568 00 00 00 11 00 00 00 11 00 00 00 33 ; #8#8#|||pp###8#8# | | p |8|8|8|||| | | &3574 00 00 00 21 20 20 20 21 20 20 20 33 ; #####|||pp####### | | p |||||||||| | | &3580 00 00 00 00 00 11 00 00 11 00 00 33 ; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ &358c 00 00 49 06 06 11 06 06 11 06 06 33 &3598 00 00 54 cc bb d2 22 d2 22 d2 22 33 ; 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 &35a4 00 00 00 cc bb d2 22 d2 22 d2 22 33 ; 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 &35b0 00 00 00 cc bb d2 22 d2 22 d2 22 33 ; e f 0 1 1 2 3 4 4 5 6 7 7 8 9 a a b c d d e &35bc 00 60 20 2c 2b 22 22 22 22 22 22 33 ; c 8 4 0 c 8 4 0 c 8 4 0 c 8 4 0 c 8 4 0 c 8 &35c8 00 00 00 00 11 ff 00 02 22 22 22 33 ; &35d4 00 00 00 00 11 ef a0 a0 ef a0 a0 33 ; ____ ppppp ##### &35e0 00 00 00 00 21 2f 20 20 2f 20 20 33 ; #8## pp p_____ ppp##### &35ec 00 00 00 00 00 00 00 00 00 00 00 33 ; ####________ p#####ppppppp pp #8##8 &35f8 c0 b0 b0 b0 10 00 00 00 00 00 00 33 ; ############ p#8#8# -p- pppp##### &3604 cc bd bb bb 11 6a 8a fe 0a 0a 0a 33 ; -----------------### --p| -------- &3610 0c 0b cb bb 11 00 44 ef a0 a0 a0 33 ; |p | ||| pp|#### -- p| ppp # &361c 96 66 cc bb 11 a0 a5 a6 11 a6 a6 33 ; |pppp| | |pppp|------- |p pppp #__ &3628 44 00 cc bb 11 20 20 20 11 20 20 33 ; +--+p| |||ppp | +-+||---+pppppppp # &3634 07 00 cc bb 11 22 20 22 21 22 20 33 ; | |-----|p +-+ || | ppp ppp # &3640 00 00 0c 0b 11 00 44 49 06 06 06 33 ; | |p| |||p | | || | ppp p # &364c 00 90 80 80 11 79 46 07 00 00 00 33 ; | |p| | |p | | || | ppp p # &3658 00 cc bb db 11 ba 1a 0a fe 0a 0a 33 ; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ &3664 00 cc bb db bb bb 11 fe 0e 0a 0a 33 &3670 00 0c 4b 0b 0b 0b 11 2e 20 20 20 33 ; 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 &367c 00 00 44 00 00 10 11 f2 02 02 02 33 ; 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 &3688 00 00 44 10 11 01 00 ff 00 00 00 33 ; f 0 0 1 2 3 3 4 5 6 6 7 8 9 9 a b c c d e &3694 00 00 44 15 a6 a6 6a 8e 0a 0a 0a 33 ; 4 0 c 8 4 0 c 8 4 0 c 8 4 0 c 8 4 0 c 8 4 &36a0 00 00 00 00 00 00 00 44 00 00 00 33 ; &36ac 00 00 00 00 10 00 90 65 66 66 66 33 ; # # # p pp p &36b8 00 90 79 96 11 66 67 79 06 06 06 33 ; # #ppppp# p pp pp ---- &36c4 00 44 00 44 11 06 06 06 48 00 00 33 ; # #p p # p ppp p &36d0 bb bb db bb 11 00 00 00 05 06 06 33 ; # #pppp #----p -p-p pp &36dc bb bb bb bb 01 0b cb 0b 0b 0b 0b 33 ; # # pp # ppp p pp pp &36e8 bb bb bd bb b0 b0 bc b0 b0 b0 b0 33 ; # #pppp # ppppppppppp--- &36f4 00 00 00 00 00 00 cc 00 00 00 00 33 ; #_____#_____# ---- p p pp &3700 00 00 00 00 00 00 cc 0b 0b 0b 0b 33 ; # # #p # pppp p p p &370c b0 b0 b0 b0 b0 b0 bc b0 b0 b0 b0 33 ; # # #p # pppp ppppp p p &3718 00 49 06 48 00 49 cc 06 06 06 06 33 ; # # #p #ppppp pp ppp p &3724 00 44 60 65 66 67 cc 00 00 00 00 33 ; # # #p # pp p p p &3730 b0 b4 b0 b0 b0 b0 bc b0 b0 b0 b0 33 ; ~~~~~~~~~~~~~~~-pp p p p -~~~~~~ &373c 00 00 00 11 00 00 00 00 00 44 00 33 &3748 00 00 00 11 00 00 00 00 00 54 60 61 &3754 06 06 06 06 48 00 00 00 49 06 06 06 &3760 00 00 00 00 05 96 11 66 67 79 06 06 &376c 00 00 00 00 00 44 11 58 80 00 00 00 &3778 00 00 00 00 00 44 00 00 44 00 00 00 &3784 60 60 60 61 60 64 60 60 74 90 60 60 &3790 06 06 58 61 80 54 60 60 60 74 00 00 &379c 00 00 00 00 05 18 90 60 60 60 60 60 &37a8 00 00 00 00 90 11 07 00 00 00 00 00 &37b4 00 00 90 79 07 00 00 00 00 00 00 00 &37c0 60 79 00 00 00 00 00 00 00 00 00 10 &37cc 00 00 00 00 00 00 00 00 00 00 00 33 &37d8 00 11 00 00 00 00 00 00 00 00 00 33 &37e4 00 11 00 00 00 00 00 00 00 00 00 33 ; area_three_data &37f0 00 00 00 00 00 00 00 00 00 00 00 33 ; 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 &37fc 00 00 66 77 77 11 82 12 22 82 12 33 ; 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 &3808 00 00 66 77 77 11 89 12 22 b9 c2 33 ; f f 0 1 2 2 3 4 5 5 6 7 8 8 9 a b b c d e e &3814 00 00 66 77 77 11 89 12 22 82 12 33 ; 0 c 8 4 0 c 8 4 0 c 8 4 0 c 8 4 0 c 8 4 0 c &3820 0d 01 02 02 07 01 09 02 02 09 02 33 ; &382c 00 00 00 00 00 00 e0 20 20 20 20 33 ; ! #[]#[]#[] # &3838 00 00 00 00 00 00 00 f0 2e 98 21 33 ; # ######### # &3844 00 00 00 00 00 00 90 21 22 2b 2c 33 ; ______# ______ ######### # &3850 00 00 00 00 00 2f 98 21 22 98 21 33 ; %%%%%%# %%%%%% #[]#[]#[] # &385c 00 00 00 00 00 66 77 11 02 02 02 33 ; %%%%%%% @@@@@@ ######### # &3868 00 00 00 00 00 66 77 11 00 00 00 33 ; ####### /#____@[]@[] #########____# &3874 00 00 66 77 55 84 54 84 54 b4 c4 33 ; #[][][] \ ][]%%%%@@@@@@ #[]#[]#[]%%%%# &3880 00 00 66 77 55 4a 44 4a 44 44 44 33 ; ####### # /########@[]@[] ############## &388c 00 00 66 77 55 a8 45 a8 45 a8 45 33 ; ####### #\###### @@@@@@ ###@@@### # &3898 20 20 20 20 20 20 20 20 20 20 20 33 ; #[]D#[] #[]D#[]# @D@@[] #[]@D@#[] # &38a4 98 21 22 98 21 22 98 21 22 98 21 33 ; ###D### ###D#### @D@@@@ ###@D@### # &38b0 82 12 22 82 12 22 82 12 55 b4 c4 33 ; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ &38bc 29 22 22 29 22 22 29 22 25 24 24 33 &38c8 98 21 22 98 21 22 98 21 22 98 21 33 ; 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 &38d4 00 00 00 00 00 66 77 11 00 00 00 33 ; 8 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 &38e0 00 00 00 00 00 66 77 11 00 00 00 33 ; f 0 1 1 2 3 4 4 5 6 7 7 8 9 a a b c d d e &38ec 82 12 22 82 12 22 82 12 22 82 12 33 ; 8 4 0 c 8 4 0 c 8 4 0 c 8 4 0 c 8 4 0 c 8 &38f8 29 22 22 29 22 22 29 22 52 49 42 33 ; &3904 98 21 22 98 21 22 98 21 55 4b 4c 33 ; []#[]#[] # &3910 82 12 22 82 12 22 82 12 22 82 12 33 ; ######## ! ! # &391c 09 02 02 09 02 02 09 02 02 09 02 33 ; ######## # # # &3928 00 00 00 00 00 0e e2 82 22 82 22 33 ; []#[]#[] #_____# # &3934 00 00 00 00 00 00 00 00 fe b9 c2 33 ; ######## %%%%%%% # &3940 00 00 00 00 00 00 00 00 e2 02 22 33 ; ######## \ @@@@@@@ # &394c 00 00 00 00 00 00 00 00 00 0e 02 33 ; []#[]#[] #\ @[][][]_________# &3958 00 00 00 00 00 00 00 11 22 82 12 33 ; ######## #[ #########@@@@@@@########## &3964 00 00 00 00 00 00 00 11 22 89 12 33 ; ##@@@### ##\/#\ #########@@@@@@@#[[][[]### &3970 00 00 00 00 00 00 00 11 22 89 12 33 ; []@D@#[] #[]D# \ #[][][][]@[]D@[]#######D## &397c 00 00 00 00 00 00 00 11 22 89 12 33 ; ##@D@### ###D### #########@@@D@@@#######D## &3988 00 d0 20 20 70 50 40 41 42 49 42 33 ; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ &3994 00 00 00 66 77 55 a8 45 44 a8 45 33 &39a0 00 00 00 66 77 55 a8 45 44 4b 4c 33 ; 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 &39ac 00 d0 20 26 77 55 a8 45 44 a8 45 33 ; 9 a a a a a a a a a a a a a a a a a a a a a &39b8 00 00 00 00 00 00 66 11 82 12 22 33 ; f 0 0 1 2 3 3 4 5 6 6 7 8 9 9 a b c c d e f &39c4 00 00 00 00 00 00 66 11 98 21 22 33 ; 4 0 c 8 4 0 c 8 4 0 c 8 4 0 c 8 4 0 c 8 4 0 &39d0 00 00 00 00 00 00 66 11 88 11 22 33 ; &39dc 00 00 00 00 00 00 66 11 29 b2 c2 33 ; ######## %%%@@%%% &39e8 20 20 20 20 20 20 26 21 22 22 22 33 ; [][][][] ###@@### ! ____ &39f4 22 98 21 98 21 98 21 98 21 98 21 33 ; ######## __###@@###__ # %%%% &3a00 22 98 21 98 21 98 21 98 21 98 21 33 ; [][][][] %%#[]@@#[]%% # /# #### &3a0c 22 98 21 98 21 98 21 98 21 98 21 33 ; ######## #####@@##### /#/### ##[] &3a18 22 98 21 98 21 98 21 98 21 98 21 33 ; [][][][] __#[][]@@#[][]__ #####____#### &3a24 00 00 00 00 00 00 00 00 00 00 00 33 ; ######## %%#####@@#####%% # ]#%%%%%%%% &3a30 00 00 00 00 00 66 77 11 22 82 22 33 ; [][][][] ###[][]@@#[][]## /# /##@[][][][ &3a3c 00 00 66 77 11 82 22 82 22 89 22 33 ; ######## #######@@####### ######@@@@@@@@ &3a48 77 11 22 82 22 89 22 89 22 89 22 33 ; [][][][] #[][][]@@#[][][] ###D##@D@[][][ &3a54 47 41 42 49 42 49 42 49 42 49 42 33 ; ######## #######@@####### ###D##@D@@@@@@ &3a60 74 14 24 24 24 24 24 24 24 24 24 33 ; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ &3a6c 77 11 22 98 22 98 22 98 22 98 22 33 &3a78 00 00 66 77 11 98 22 98 22 98 22 33 ; 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 &3a84 00 00 00 00 00 66 77 11 22 98 22 33 ; a b b b b b b b b b b b b b b b b b b b b &3a90 00 00 00 00 00 00 00 00 00 00 00 33 ; f 0 1 2 2 3 4 5 5 6 7 8 8 9 a b b c d e e &3a9c 00 00 00 00 00 00 00 f0 20 20 20 33 ; c 8 4 0 c 8 4 0 c 8 4 0 c 8 4 0 c 8 4 0 c &3aa8 00 d0 20 20 2f 22 02 02 12 22 22 33 ; &3ab4 00 00 00 00 2f 22 90 2f 21 2b 2c 33 ; ! &3ac0 00 00 00 2f 22 62 72 52 42 42 42 33 ; # ! &3acc 00 00 00 00 00 66 77 a8 45 4b 4c 33 ; #_____ # &3ad8 00 60 70 10 20 26 77 a8 45 a8 45 33 ; #%%%%% # &3ae4 00 66 77 11 82 12 77 a8 45 a8 45 33 ; %%%%%% # &3af0 00 06 07 01 09 62 77 a8 45 a8 45 33 ; _ @@@@@@ _______ &3afc 00 00 00 00 00 00 00 00 11 22 22 33 ; % @[]@[] ##############\ %%%%%% &3b08 00 00 00 00 00 00 00 00 11 22 22 33 ; ] @@@@@@ ############### / #% &3b14 d0 10 20 20 70 50 40 40 11 22 22 33 ; @#########@@ ###############\ # # &3b20 00 00 66 77 77 55 a8 45 11 22 22 33 ; ]#########[] #[]#[][]#[]#D### /\ /# /# &3b2c 00 00 66 77 77 55 84 54 41 82 52 33 ; @#########@@ ############D### ##### ##/ &3b38 00 00 06 07 07 05 0a 04 04 0a 04 33 ; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ &3b44 00 00 00 00 00 00 00 00 00 00 00 33 &3b50 00 00 00 00 00 00 11 22 22 82 12 33 &3b5c 00 00 00 00 00 00 11 22 22 29 22 33 &3b68 00 00 00 00 00 00 11 22 22 98 21 33 &3b74 00 00 00 00 00 00 11 22 22 98 21 33 &3b80 00 00 00 00 00 00 11 22 22 82 12 33 &3b8c 00 00 00 00 00 00 11 22 22 29 22 33 &3b98 00 00 00 00 00 00 11 22 22 2b 2c 33 &3ba4 00 00 00 00 00 00 0e 02 e2 22 22 33 &3bb0 00 00 00 00 00 00 00 00 00 f0 20 33 &3bbc 00 00 00 00 00 60 00 00 00 0e 22 33 &3bc8 00 00 00 00 00 66 77 f0 20 2f 22 33 &3bd4 00 00 00 00 00 66 77 00 00 f0 20 33 &3be0 00 0d 01 02 02 66 77 72 02 02 f2 33 &3bec 00 00 00 00 00 00 00 00 00 00 00 33 ; unused # Source code fragment &3bf8 43 3a 41 44 43 20 65 79 ; "C:ADC ey" ; sprite_55_data (SPRITE_DIGIT_ZERO) &3c00 50 f0 a0 a0 a0 f0 50 00 00 a0 a0 a0 a0 a0 00 00 ; sprite_56_data (SPRITE_DIGIT_ONE) &3c10 50 f0 50 50 50 50 f0 00 00 00 00 00 00 00 a0 00 ; sprite_57_data (SPRITE_DIGIT_TWO) &3c20 50 a0 00 50 a0 a0 f0 00 00 a0 a0 00 00 00 a0 00 ; sprite_58_data (SPRITE_DIGIT_THREE) &3c30 50 a0 00 50 00 a0 50 00 00 a0 a0 a0 a0 a0 00 00 ; sprite_59_data (SPRITE_DIGIT_FOUR) &3c40 a0 a0 a0 f0 00 00 00 00 00 a0 a0 a0 a0 a0 a0 00 ; sprite_5a_data (SPRITE_DIGIT_FIVE) &3c50 f0 a0 a0 50 00 00 f0 00 a0 00 00 00 a0 a0 00 00 ; sprite_5b_data (SPRITE_DIGIT_SIX) &3c60 50 a0 a0 f0 a0 a0 50 00 00 a0 00 00 a0 a0 00 00 ; sprite_5c_data (SPRITE_DIGIT_SEVEN) &3c70 f0 00 00 50 50 50 50 00 a0 a0 a0 00 00 00 00 00 ; sprite_5d_data (SPRITE_DIGIT_EIGHT) &3c80 50 a0 a0 50 a0 a0 50 00 00 a0 a0 00 a0 a0 00 00 ; sprite_5e_data (SPRITE_DIGIT_NINE) &3c90 50 a0 a0 50 00 a0 50 00 00 a0 a0 a0 a0 a0 00 00 ; sprite_61_data (SPRITE_ROTORS_TWO) &3ca0 40 d0 40 c0 f0 c0 c0 f0 c0 c0 f0 c0 c0 f0 60 c0 &3cb0 f0 c0 c0 f0 c0 c0 f0 c0 00 80 00 ; unused &3cbb 00 00 00 00 00 ; sprite_60_data (SPRITE_ROTORS_ONE) &3cc0 00 00 00 00 00 00 40 d0 40 c0 f0 c0 c0 f0 60 c0 &3cd0 f0 c0 00 80 00 00 00 00 00 00 00 ; unused &3cdb 00 00 00 00 00 30 0c 00 09 06 06 09 09 06 06 09 &3ceb 09 06 06 09 09 ; sprite_46_data (SPRITE_PLAYER_BULLET) &3cf0 40 90 40 c0 30 c0 00 80 ; unused &3cf8 00 00 00 00 00 00 00 00 ; sprite_54_data (SPRITE_POWERUP) &3d00 40 d0 d0 40 40 40 40 40 40 00 e0 f0 f0 f0 d0 f0 &3d10 d0 f0 e0 80 00 80 80 80 80 80 80 80 00 00 ; unused &3d1e 90 40 ; sprite_40_data (SPRITE_ENEMY_BULLET) &3d20 40 d0 40 c0 f0 c0 00 80 00 00 00 00 00 00 00 00 ; sprite_41_data (SPRITE_PLAYER_STANDING) &3d30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &3d40 00 00 00 00 00 00 00 00 00 40 90 90 40 40 40 40 &3d50 90 90 90 c0 90 90 40 40 00 00 00 40 40 40 40 00 &3d60 c0 30 30 70 e0 d0 f0 30 30 70 30 30 90 60 30 30 &3d70 90 90 90 30 70 f0 f0 d0 30 30 30 d0 e0 f0 f0 e0 &3d80 60 f0 b0 30 30 c0 60 30 30 30 60 60 e0 e0 f0 f0 &3d90 80 80 60 80 00 80 80 00 c0 f0 70 70 c0 00 00 80 &3da0 80 80 00 00 00 00 80 e0 00 00 00 00 00 00 00 00 &3db0 c0 f0 c0 80 00 00 00 00 00 00 00 00 00 00 00 00 ; sprite_42_data (SPRITE_PLAYER_WALKING_ONE) &3dc0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &3dd0 00 00 00 40 d0 d0 40 00 00 00 40 90 90 40 40 40 &3de0 40 90 90 90 40 40 40 40 00 40 90 f0 f0 f0 f0 d0 &3df0 00 c0 30 30 70 e0 d0 f0 70 30 60 30 30 c0 30 30 &3e00 90 30 30 60 e0 80 e0 e0 c0 30 30 30 d0 e0 f0 f0 &3e10 e0 e0 30 f0 30 30 c0 30 30 60 90 30 90 d0 d0 40 &3e20 00 80 80 60 80 00 80 80 00 00 c0 f0 70 70 c0 80 &3e30 80 60 60 60 e0 f0 f0 f0 00 00 00 00 00 00 00 00 &3e40 00 00 c0 f0 c0 80 00 00 00 00 00 00 00 80 e0 e0 ; sprite_43_data (SPRITE_PLAYER_WALKING_TWO) &3e50 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &3e60 00 40 40 40 40 40 00 00 00 00 40 90 90 40 40 40 &3e70 40 90 90 c0 c0 90 40 00 c0 f0 f0 f0 e0 e0 80 00 &3e80 00 c0 30 30 70 e0 d0 f0 30 30 60 30 30 90 60 90 &3e90 c0 30 b0 c0 40 40 40 40 c0 30 30 30 d0 e0 f0 f0 &3ea0 e0 60 30 f0 30 30 c0 30 90 30 30 c0 30 70 f0 f0 &3eb0 00 80 80 60 80 80 80 80 00 00 c0 f0 70 70 c0 80 &3ec0 60 60 80 80 80 80 e0 f0 00 00 00 00 00 00 00 00 &3ed0 00 00 c0 f0 c0 80 00 00 00 00 00 00 00 00 00 80 ; sprite_44_data (SPRITE_PLAYER_DUCKING) &3ee0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 40 &3ef0 40 90 90 c0 d0 f0 f0 d0 00 00 00 00 00 00 00 00 &3f00 00 00 40 40 00 40 90 30 60 30 30 30 c0 b0 f0 f0 &3f10 00 00 00 00 00 00 00 00 40 90 30 60 90 30 60 30 &3f20 30 c0 30 30 90 60 30 90 00 00 00 00 00 00 00 40 &3f30 90 30 60 d0 60 f0 30 30 c0 30 c0 30 30 30 30 60 &3f40 00 00 00 00 00 00 00 80 60 30 e0 c0 e0 f0 e0 e0 &3f50 80 60 30 90 90 f0 f0 f0 00 00 00 00 00 00 00 00 &3f60 00 80 00 00 c0 f0 c0 00 00 00 80 80 80 80 e0 f0 ; sprite_45_data (SPRITE_PLAYER_JUMPING) &3f70 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &3f80 c0 f0 f0 f0 f0 d0 40 00 00 40 90 90 40 40 40 40 &3f90 40 90 90 c0 c0 90 40 00 c0 30 30 b0 c0 e0 e0 80 &3fa0 c0 30 30 70 e0 d0 f0 d0 30 30 60 30 90 60 30 90 &3fb0 60 30 30 60 80 00 00 00 30 30 30 d0 e0 f0 f0 e0 &3fc0 e0 30 d0 60 30 90 60 30 30 90 c0 40 40 40 40 40 &3fd0 80 80 60 80 80 80 80 00 00 c0 f0 e0 70 70 c0 60 &3fe0 30 30 30 30 70 f0 f0 f0 00 00 00 00 00 00 00 00 &3ff0 00 c0 f0 c0 80 80 00 00 80 80 80 c0 d0 f0 e0 80 ; entry_point &4000 a2 06 LDX #&06 ; set_video_registers_loop &4002 a9 17 LDA #&17 # Set CRTC register &4004 20 ee ff JSR &ffee ; OSWRCH &4007 a9 00 LDA #&00 &4009 20 ee ff JSR &ffee ; OSWRCH &400c bd 65 41 LDA &4165,X ; video_register_numbers &400f 20 ee ff JSR &ffee ; OSWRCH &4012 bd 5d 41 LDA &415d,X ; video_registers_values &4015 20 ee ff JSR &ffee ; OSWRCH &4018 a0 05 LDY #&05 &401a a9 00 LDA #&00 ; write_nulls_for_video_register_loop &401c 20 ee ff JSR &ffee ; OSWRCH &401f 88 DEY &4020 10 fa BPL &401c ; write_nulls_for_video_register_loop &4022 ca DEX &4023 10 dd BPL &4002 ; set_video_registers_loop &4025 a9 17 LDA #&17 # Disable cursor &4027 20 ee ff JSR &ffee ; OSWRCH &402a a9 01 LDA #&01 &402c 20 ee ff JSR &ffee ; OSWRCH &402f a2 07 LDX #&07 &4031 a9 00 LDA #&00 ; write_nulls_for_cursor_loop &4033 20 ee ff JSR &ffee ; OSWRCH &4036 ca DEX &4037 10 fa BPL &4033 ; ; write_nulls_for_cursor_loop &4039 a9 01 LDA #&01 # Use settings for MODE 2, &403b 8d 56 03 STA &0356 ; os_screen_memory_type &403e a9 40 LDA #&40 &4040 8d 54 03 STA &0354 ; os_screen_memory_size &4043 a9 03 LDA #&03 # but screen memory starting at &4000, as MODE 3 &4045 8d 55 03 STA &0355 ; os_mode &4048 a9 0f LDA #&0f &404a 8d 60 03 STA &0360 ; os_colours_available &404d a9 01 LDA #&01 &404f 8d 61 03 STA &0361 ; os_pixels_per_byte &4052 a9 20 LDA #&20 &4054 8d 4f 03 STA &034f ; os_bytes_per_character &4057 a9 55 LDA #&55 &4059 8d 63 03 STA &0363 ; os_right_colour_mask &405c a9 aa LDA #&aa &405e 8d 62 03 STA &0362 ; os_left_colour_mask &4061 a9 13 LDA #&13 &4063 8d 0a 03 STA &030a ; os_text_window_right &4066 a9 40 LDA #&40 &4068 8d 4e 03 STA &034e ; os_screen_memory_high_byte &406b a9 90 LDA #&90 ; Set TV offset and interlacing &406d a0 00 LDY #&00 ; turn off interlacing &406f a2 02 LDX #&02 ; vertical screen shift &4071 20 f4 ff JSR &fff4 ; OSBYTE &4074 a2 f4 LDX #&f4 # Use settings for MODE 2 &4076 a0 00 LDY #&00 &4078 a9 9a LDA #&9a ; Write to Video ULA control register and RAM copy &407a 20 f4 ff JSR &fff4 ; OSBYTE &407d a2 40 LDX #&40 &407f a9 00 LDA #&00 ; wipe_0130_to_0170_loop &4081 9d 30 01 STA &0130,X ; variables # Wipe &0130 - &0170 &4084 ca DEX &4085 10 fa BPL &4081 ; wipe_0130_to_0170_loop &4087 85 70 STA &70 ; check_address_low &4089 a9 42 LDA #&42 ; &4200 &408b 85 71 STA &71 ; check_address_high &408d a0 00 LDY #&00 ; check_4200_to_57ff_loop &408f b1 70 LDA (&70),Y ; check_address &4091 f0 03 BEQ &4096 ; is_zero &4093 4c 14 41 JMP &4114 ; tape_systems_only ; is_zero &4096 88 DEY &4097 c0 ff CPY #&ff &4099 d0 f4 BNE &408f ; check_4200_to_57ff_loop &409b e6 71 INC &71 ; check_address_high &409d a5 71 LDA &71 ; check_address_high &409f c9 58 CMP #&58 &40a1 d0 ec BNE &408f ; check_4200_to_57ff_loop &40a3 a2 0f LDX #&0f &40a5 a5 80 LDA &80 ; colour_or_black_and_white_from_loader &40a7 d0 20 BNE &40c9 ; is_black_and_white ; is_colour ; set_colour_colours_loop &40a9 a9 13 LDA #&13 ; Wait for vertical retrace &40ab 20 ee ff JSR &ffee ; OSWRCH &40ae 8a TXA &40af 20 ee ff JSR &ffee ; OSWRCH &40b2 bd 6d 41 LDA &416d,X ; colour_colours &40b5 20 ee ff JSR &ffee ; OSWRCH &40b8 a9 00 LDA #&00 &40ba 20 ee ff JSR &ffee ; OSWRCH &40bd 20 ee ff JSR &ffee ; OSWRCH &40c0 20 ee ff JSR &ffee ; OSWRCH &40c3 ca DEX &40c4 10 e3 BPL &40a9 ; set_colour_colours_loop &40c6 4c f3 40 JMP &40f3 ; set_keys ; is_black_and_white &40c9 a2 0f LDX #&0f ; set_black_and_white_colours_loop &40cb a9 13 LDA #&13 ; Wait for vertical retrace &40cd 20 ee ff JSR &ffee ; OSWRCH &40d0 8a TXA &40d1 20 ee ff JSR &ffee ; OSWRCH &40d4 bd 7d 41 LDA &417d,X ; black_and_white_colours &40d7 20 ee ff JSR &ffee ; OSWRCH &40da a9 00 LDA #&00 &40dc 20 ee ff JSR &ffee ; OSWRCH &40df 20 ee ff JSR &ffee ; OSWRCH &40e2 20 ee ff JSR &ffee ; OSWRCH &40e5 ca DEX &40e6 10 e3 BPL &40cb ; set_black_and_white_colours_loop &40e8 a2 0b LDX #&0b ; use_black_and_white_area_palettes_loop &40ea bd 8d 41 LDA &418d,X ; black_and_white_area_palettes &40ed 9d 61 1f STA &1f61,X ; area_palettes &40f0 ca DEX &40f1 10 f7 BPL &40ea ; use_black_and_white_area_palettes_loop ; set_keys &40f3 a5 81 LDA &81 ; key_left_from_loader &40f5 8d 57 12 STA &1257 ; key_left &40f8 a5 82 LDA &82 ; key_right_from_loader &40fa 8d 76 12 STA &1276 ; key_right &40fd a5 83 LDA &83 ; key_jump_from_loader &40ff 8d 1c 12 STA &121c ; key_jump &4102 a5 84 LDA &84 ; key_duck_from_loader &4104 8d 3d 12 STA &123d ; key_duck &4107 a5 85 LDA &85 ; key_fire_from_loader &4109 8d 7b 11 STA &117b ; key_fire &410c a9 1a LDA #&1a ; restore default windows &410e 20 ee ff JSR &ffee ; OSWRCH &4111 4c 16 0f JMP &0f16 ; start_game_after_title_screen ; tape_systems_only &4114 a9 16 LDA #&16 # Change to MODE 6 &4116 20 ee ff JSR &ffee ; OSWRCH &4119 a9 06 LDA #&06 &411b 20 ee ff JSR &ffee ; OSWRCH &411e a9 36 LDA #&36 ; &4136 = tape_systems_only_string &4120 85 70 STA &70 ; text_address_low &4122 a9 41 LDA #&41 &4124 85 71 STA &71 ; text_address_high &4126 a0 00 LDY #&00 ; write_tape_systems_only_loop &4128 b1 70 LDA (&70),Y ; text_address &412a 20 ee ff JSR &ffee ; OSWRCH &412d c8 INY &412e c9 0d CMP #&0d &4130 d0 f6 BNE &4128 ; write_tape_systems_only_loop ; infinite_loop &4132 ea NOP &4133 4c 32 41 JMP &4132 ; infinite_loop ; tape_systems_only_string &4136 54 68 69 73 20 76 65 72 73 69 6f 6e 20 69 73 20 ; "This version is for TAPE SYSTEMS ONLY!" &4146 66 6f 72 20 54 41 50 45 20 53 59 53 54 45 4d 53 &4156 20 4f 4e 4c 59 21 0d ; video_registers_values &415d 07 26 00 19 1b 08 00 # R9: Scan lines per character register # R4: Vertical total register ; unused # R5: Vertical total adjust register &4164 00 # R6: Vertical displayed register # R7: Vertical sync position ; video_register_numbers # R12: Displayed screen start address register (high) &4165 09 04 05 06 07 0c 0d # R13: Displayed screen start address register (low) ; unused &416c 00 ; colour_colours &416d 00 05 02 03 # Colours 0 - 3 are used for background colours &4171 02 02 02 02 # Colours 4 - 7 are green &4175 00 00 00 00 # Colours 8 - 11 are black &4179 01 01 01 01 # Colours 12 - 15 are red ; black_and_white_colours &417d 00 02 03 07 # Colours 0 - 3 are used for background colours &4181 03 03 03 03 # Colours 4 - 7 are yellow &4185 00 00 00 00 # Colours 8 - 11 are black &4189 06 06 06 06 # Colours 12 - 15 are cyan ; black_and_white_area_palettes &418d 00 02 03 07 ; area 1 : K G Y W &4191 00 05 06 07 ; area 1 : K M C W &4195 00 02 03 07 ; area 1 : K G Y W ; unused &4199 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &41a9 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &41b9 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &41c9 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &41d9 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &41e9 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &41f9 00 00 00 00 00 00 00