Eagle's Wing disassembly ======================== Eagle's Wing was written by Marcus Bott-Obi (using the alias Boris Obinskofh), and was published by Software Invasion for the BBC Micro in 1984. It is a side-scrolling shooter in which the player flies a plane through a canyon. 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. Interesting pokes ================= &1c4c = &a5 player is invulnerable to enemy projectiles &23b2 = &a5 player is invulnerable to enemy planes &22ae = &a5 player can fly over rock &296f = &a9, &2970 = &00 infinite fuel &221f = &00, &2244 = &00 infinite shots &2269 = &00 infinite missiles &11df = x start next game at x km Loader disassembly ================== ; Eagle-Wing ; 00000000 00008023 0600 &1900 0d # Start of BASIC program &1901 00 0a 15 eb 37 3a d3 3d 26 37 41 30 30 3a f4 7f ; 10MODE7:HIMEM=&7A00:REM &1911 7f 7f 7f 15 0d ; HIMEM=&7A00: ; REM # Embedded backspaces and disable VDU &1916 00 0f 16 24 26 36 46 46 30 3d 22 4d 42 4f 53 44 ; 15$&6FF0="MBOSDC": # Set decryption_key &1926 43 22 3a f4 06 0d ; REM # Embedded enable VDU &192c 00 14 19 ee 85 f1 22 4e 65 65 64 73 20 4f 2e 53 ; 20ONERRORPRINT"Needs O.S. 1.2":END &193c 2e 20 31 2e 32 22 3a e0 0d &1945 00 1e 42 e3 46 25 3d 30 b8 26 36 30 30 88 34 3a ; 30FORF%=0TO&600STEP4: &1955 46 25 21 26 37 41 30 30 3d 46 25 21 90 3a ed 3a ; F%!&7A00=F%!PAGE: &1965 e2 33 2c 31 2c 30 2c 30 2c 30 2c 30 2c 30 2c 30 ; NEXT: &1975 2c 30 2c 2d 31 2c 2d 31 2c 2d 31 2c 31 32 36 2c ; ENVELOPE3,1,0,0,0,0,0,0,0,-1,-1,-1,126,0 &1985 30 0d &1987 00 28 23 d6 26 37 41 43 30 3a ef 32 38 2c 32 2c ; 40CALL&7AC0: # Call initialise_music &1997 32 34 2c 32 30 2c 32 32 3a 2a 2f 31 2e 45 41 47 ; VDU28,2,24,20,22: # Define text window &19a7 4c 45 0d ; */1.EAGLE &19aa ff # End of BASIC program ; unused &19ab 2c 00 1e 00 28 # &19b0 - &1eff is moved to &7ab0 - &7fff at line 30 ; silence_sound ; chan vol pitch dur &7ab0 03 10 00 00 00 00 00 00 ; note_sound ; chan vol pitch dur &7ab8 03 00 03 00 00 00 00 00 ; initialise_music &7ac0 a2 ff LDX #&ff &7ac2 86 77 STX &77 ; logo_colours_offset &7ac4 e8 INX ; 0 &7ac5 8e 57 72 STX &7257 ; scrolltext_data - 1 &7ac8 8e 3d 75 STX &753d ; scrolltext_enabled &7acb 8e 80 70 STX &7080 ; music_data - 1 &7ace 86 82 STX &82 ; check_vectors_address_low &7ad0 e8 INX ; 1 &7ad1 86 78 STX &78 ; logo_colours_cooldown &7ad3 86 72 STX &72 ; scrolltext_count &7ad5 86 76 STX &76 ; scroll_cooldown &7ad7 a9 58 LDA #&58 ; &7258 = scrolltext_data &7ad9 85 70 STA &70 ; scrolltext_address_low &7adb a9 72 LDA #&72 &7add 85 71 STA &71 ; scrolltext_address_high &7adf 20 ee 7b JSR &7bee ; restart_music &7ae2 78 SEI &7ae3 a9 f7 LDA #&f7 ; &7af7 = event_handler &7ae5 8d 20 02 STA &0220 ; event_vector_low &7ae8 a9 7a LDA #&7a &7aea 8d 21 02 STA &0221 ; event_vector_high &7aed 58 CLI &7aee a9 0e LDA #&0e ; Enable event &7af0 a2 04 LDX #&04 ; v-sync event &7af2 a0 00 LDY #&00 &7af4 4c f4 ff JMP &fff4 ; OSBYTE ; event_handler &7af7 08 PHP &7af8 48 PHA ; tmp_a &7af9 8a TXA &7afa 48 PHA ; tmp_x &7afb 98 TYA &7afc 48 PHA ; tmo_y &7afd 20 8e 7b JSR &7b8e ; update_music &7b00 20 f7 7b JSR &7bf7 ; consider_checking_vectors &7b03 ad 80 70 LDA &7080 ; music_data - 1 &7b06 c9 ff CMP #&ff &7b08 d0 2c BNE &7b36 ; skip_updating_logo_colours # Leave if logo colours not fully loaded &7b0a c6 78 DEC &78 ; logo_colours_cooldown &7b0c d0 28 BNE &7b36 ; skip_updating_logo_colours &7b0e a9 03 LDA #&03 &7b10 85 78 STA &78 ; logo_colours_cooldown &7b12 e6 77 INC &77 ; logo_colours_offset &7b14 a4 77 LDY &77 ; logo_colours_offset &7b16 c0 20 CPY #&20 &7b18 d0 04 BNE &7b1e ; skip_wraparound &7b1a a0 00 LDY #&00 &7b1c 84 77 STY &77 ; logo_colours_offset ; skip_wraparound ; update_logo_colours &7b1e b9 00 70 LDA &7000,Y ; logo_colours_data &7b21 8d 28 7c STA &7c28 ; screen_memory + &28 &7b24 b9 20 70 LDA &7020,Y ; logo_colours_data &7b27 8d 50 7c STA &7c50 ; screen_memory + &28 * 2 &7b2a b9 40 70 LDA &7040,Y ; logo_colours_data &7b2d 8d 78 7c STA &7c78 ; screen_memory + &28 * 3 &7b30 b9 60 70 LDA &7060,Y ; logo_colours_data &7b33 8d a0 7c STA &7ca0 ; screen_memory + &28 * 4 ; skip_updating_logo_colours &7b36 ad 3d 75 LDA &753d ; scrolltext_enabled &7b39 c9 ff CMP #&ff &7b3b f0 03 BEQ &7b40 ; update_scrolltext &7b3d 4c 7c 7b JMP &7b7c ; leave_after_restoring_registers ; update_scrolltext &7b40 c6 76 DEC &76 ; scroll_cooldown &7b42 d0 38 BNE &7b7c ; leave_after_restoring_registers &7b44 a9 08 LDA #&08 &7b46 85 76 STA &76 ; scroll_cooldown &7b48 a0 04 LDY #&04 ; scroll_scrolltext_loop &7b4a b9 c9 7c LDA &7cc9,Y ; screen_memory + &c9 &7b4d 99 c8 7c STA &7cc8,Y ; screen_memory + &c8 &7b50 99 f0 7c STA &7cf0,Y ; screen_memory + &f0 &7b53 c8 INY &7b54 c0 25 CPY #&25 &7b56 d0 f2 BNE &7b4a ; scroll_scrolltext_loop &7b58 c6 72 DEC &72 ; scrolltext_count &7b5a d0 18 BNE &7b74 ; skip_getting_byte ; get_byte_of_scrolltext &7b5c a9 01 LDA #&01 &7b5e 85 72 STA &72 ; scrolltext_count &7b60 a0 00 LDY #&00 &7b62 b1 70 LDA (&70),Y ; scrolltext_address # Get byte of scrolltext &7b64 e6 70 INC &70 ; scrolltext_address_low &7b66 d0 02 BNE &7b6a ; skip_page &7b68 e6 71 INC &71 ; scrolltext_address_high ; skip_page &7b6a c9 ff CMP #&ff &7b6c f0 15 BEQ &7b83 ; restart_scrolltext &7b6e 10 06 BPL &7b76 ; use_character &7b70 29 7f AND #&7f &7b72 85 72 STA &72 ; scrolltext_count ; skip_getting_byte &7b74 a9 20 LDA #&20 ; use_character &7b76 8d ed 7c STA &7ced ; screen_memory + &ed &7b79 8d 15 7d STA &7d15 ; screen_memory + &115 ; leave_after_restoring_registers &7b7c 68 PLA ; tmp_y &7b7d a8 TAY &7b7e 68 PLA ; tmp_x &7b7f aa TAX &7b80 68 PLA ; tmp_a &7b81 28 PLP &7b82 60 RTS ; restart_scrolltext &7b83 a9 58 LDA #&58 ; &7258 = scrolltext_data &7b85 85 70 STA &70 ; scrolltext_address_low &7b87 a9 72 LDA #&72 &7b89 85 71 STA &71 ; scrolltext_address_high &7b8b 4c 7c 7b JMP &7b7c ; leave_after_restoring_registers ; update_music &7b8e a9 80 LDA #&80 ; Read buffer status &7b90 a2 f8 LDX #&f8 ; Sound output buffer 3 &7b92 a0 ff LDY #&ff &7b94 20 f4 ff JSR &fff4 ; OSBYTE &7b97 e0 06 CPX #&06 &7b99 90 5b BCC &7bf6 ; leave # Leave if previous note still playing ; consider_next_byte_of_music_data &7b9b ad 57 72 LDA &7257 ; scrolltext_data - 1 &7b9e c9 ff CMP #&ff &7ba0 d0 54 BNE &7bf6 ; leave # Leave if music not fully loaded &7ba2 a9 3e LDA #&3e ; &753e = second_stage_entry_point &7ba4 8d c2 03 STA &03c2 ; tape_execution_address_low &7ba7 a9 75 LDA #&75 &7ba9 8d c3 03 STA &03c3 ; tape_execution_address_high &7bac a0 00 LDY #&00 &7bae b1 80 LDA (&80),Y ; music_data # Get first byte of music data &7bb0 c9 ff CMP #&ff # &ff indicates end of music &7bb2 d0 06 BNE &7bba ; not_end_of_music &7bb4 20 ee 7b JSR &7bee ; restart_music &7bb7 4c 9b 7b JMP &7b9b ; consider_next_byte_of_music_data ; not_end_of_music &7bba c9 fe CMP #&fe # &fe indicates silence &7bbc d0 12 BNE &7bd0 ; not_silence &7bbe c8 INY &7bbf b1 80 LDA (&80),Y ; music_data # Second byte sets duration &7bc1 8d b6 7a STA &7ab6 ; silence_sound + 6 (duration) &7bc4 a9 07 LDA #&07 ; Generate a sound &7bc6 a2 b0 LDX #&b0 ; &7ab0 = silence_sound &7bc8 a0 7a LDY #&7a &7bca 20 f1 ff JSR &fff1 ; OSWORD &7bcd 4c e2 7b JMP &7be2 ; move_to_next_note ; not_silence &7bd0 8d be 7a STA &7abe ; note_sound + 6 (duration) # Otherwise, first byte sets duration &7bd3 c8 INY &7bd4 b1 80 LDA (&80),Y ; music_data # Second byte sets pitch &7bd6 8d bc 7a STA &7abc ; note_sound + 4 (pitch) &7bd9 a9 07 LDA #&07 ; Generate a sound &7bdb a2 b8 LDX #&b8 ; &7ab8 = note_sound &7bdd a0 7a LDY #&7a &7bdf 20 f1 ff JSR &fff1 ; OSWORD ; move_to_next_note &7be2 18 CLC &7be3 a5 80 LDA &80 ; music_address_low &7be5 69 02 ADC #&02 &7be7 85 80 STA &80 ; music_address_low &7be9 90 02 BCC &7bed ; skip_page &7beb e6 81 INC &81 ; music_address_high ; skip_page &7bed 60 RTS ; restart_music &7bee a9 81 LDA #&81 ; &7081 = music_data &7bf0 85 80 STA &80 ; music_address_low &7bf2 a9 70 LDA #&70 &7bf4 85 81 STA &81 ; music_address_high ; leave &7bf6 60 RTS ; consider_checking_vectors &7bf7 a5 82 LDA &82 ; check_vectors_address_low &7bf9 f0 fb BEQ &7bf6 ; leave &7bfb 6c 82 00 JMP (&0082) ; check_vectors_address_low # Call check_vectors_and_update_filename if loaded ; unused &7bfe 00 00 ; screen_data &7c00 20 20 a0 20 20 20 20 20 a0 a0 20 a0 a0 a0 a0 20 ; " . .. .... . . .." &7c10 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ; "........................................" &7c20 a0 20 20 a0 20 20 a0 a0 93 9a ff af a4 fe af fd ; "........................................" &7c30 e8 bf af a4 ff a0 a0 ea bf ad ea e8 bf af a4 a0 ; "........................................" &7c40 a0 ff a0 ff a0 ff ea b5 ff a0 ff e8 bf af a4 a0 ; "........................................" &7c50 96 9a ff f0 b0 ff f0 ff ea b5 a0 a0 ff a0 a0 ea ; ".... .................. . " &7c60 f5 f0 a0 ea f5 f0 a0 a0 a0 ff a0 ff a0 ff ea b5 ; "........ " &7c70 ff f4 ff ea b5 a0 a0 a0 92 9a ff a3 a1 ff a3 ff ; "...Mission: ............ " &7c80 ea b5 ef b4 ff a0 a0 ea b7 a3 a0 a0 a3 eb b5 a0 ; ".Destroy enemy surface targets & planes." &7c90 a0 ff a0 ff a0 ff ea b5 ff ab ff ea b5 ef b4 a0 ; ".Avoid enemy flak,guided missiles,chase " &7ca0 91 9a ff fc a4 ff a0 ff aa fd fe a5 ff fc fc ea ; ".planes,interceptors & canyon walls to " &7cb0 fd bc a0 a8 fc fe a5 a0 a0 ef fc af fc bf ea b5 ; ".survive.Try to reach the missile silos " &7cc0 ff a0 ff aa fd fe a5 a0 84 9d 87 8d 20 20 20 20 ; ".& command centres.Slow down to dock " &7cd0 20 20 20 20 20 a0 a0 a0 a0 a0 a0 a0 a0 a0 a0 a0 ; ".with sister plane to rearm,refuel and " &7ce0 a0 a0 a0 a0 a0 a0 a0 20 20 20 20 20 20 20 a0 20 ; ".repair plane. .Good Luck ! " &7cf0 84 9d 87 8d a0 a0 a0 a0 20 20 20 20 20 20 20 20 ; "...Keys: . " &7d00 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ; ".A - Up COPY - Accelerates" &7d10 20 20 20 20 20 20 20 20 81 9d 83 4d 69 73 73 69 ; ".Z - Down DELETE - Decelerates" &7d20 6f 6e 3a 20 20 9c a0 a0 a0 a0 a0 a0 a0 a0 a0 a0 ; ".RETURN - Surface fire Q - Sound off " &7d30 a0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ; ".SHIFT - Air fire S - Sound on " &7d40 82 44 65 73 74 72 6f 79 20 65 6e 65 6d 79 20 73 ; ".TAB - Missile fire " &7d50 75 72 66 61 63 65 20 74 61 72 67 65 74 73 20 26 ; ".ESCAPE - Escapes from game or demo " &7d60 20 70 6c 61 6e 65 73 2e 82 41 76 6f 69 64 20 65 ; ".. . " &7d70 6e 65 6d 79 20 66 6c 61 6b 2c 67 75 69 64 65 64 ; ".. . " &7d80 20 6d 69 73 73 69 6c 65 73 2c 63 68 61 73 65 20 ; ".. .. Boris Obinskofh " &7d90 82 70 6c 61 6e 65 73 2c 69 6e 74 65 72 63 65 70 ; " " &7da0 74 6f 72 73 20 26 20 63 61 6e 79 6f 6e 20 77 61 &7db0 6c 6c 73 20 74 6f 20 20 82 73 75 72 76 69 76 65 &7dc0 2e 54 72 79 20 74 6f 20 72 65 61 63 68 20 74 68 &7dd0 65 20 6d 69 73 73 69 6c 65 20 73 69 6c 6f 73 20 &7de0 82 26 20 63 6f 6d 6d 61 6e 64 20 63 65 6e 74 72 &7df0 65 73 2e 53 6c 6f 77 20 64 6f 77 6e 20 74 6f 20 &7e00 64 6f 63 6b 20 20 20 20 82 77 69 74 68 20 73 69 &7e10 73 74 65 72 20 70 6c 61 6e 65 20 74 6f 20 72 65 &7e20 61 72 6d 2c 72 65 66 75 65 6c 20 61 6e 64 20 20 &7e30 82 72 65 70 61 69 72 20 70 6c 61 6e 65 2e 20 20 &7e40 20 20 81 47 6f 6f 64 20 4c 75 63 6b 20 21 20 20 &7e50 20 20 20 20 20 20 20 20 81 9d 83 4b 65 79 73 3a &7e60 20 20 9c 20 20 20 20 20 20 20 20 20 20 20 20 20 &7e70 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 &7e80 82 41 20 2d 20 55 70 20 20 20 20 20 20 20 20 20 &7e90 20 20 20 20 20 20 43 4f 50 59 20 2d 20 41 63 63 &7ea0 65 6c 65 72 61 74 65 73 82 5a 20 2d 20 44 6f 77 &7eb0 6e 20 20 20 20 20 20 20 20 20 20 20 44 45 4c 45 &7ec0 54 45 20 2d 20 44 65 63 65 6c 65 72 61 74 65 73 &7ed0 82 52 45 54 55 52 4e 20 2d 20 53 75 72 66 61 63 &7ee0 65 20 66 69 72 65 20 20 20 51 20 2d 20 53 6f 75 &7ef0 6e 64 20 6f 66 66 20 20 82 53 48 49 46 54 20 20 &7f00 2d 20 41 69 72 20 66 69 72 65 20 20 20 20 20 20 &7f10 20 53 20 2d 20 53 6f 75 6e 64 20 6f 6e 20 20 20 &7f20 82 54 41 42 20 20 20 20 2d 20 4d 69 73 73 69 6c &7f30 65 20 66 69 72 65 20 20 20 20 20 20 20 20 20 20 &7f40 20 20 20 20 20 20 20 20 82 45 53 43 41 50 45 20 &7f50 2d 20 45 73 63 61 70 65 73 20 66 72 6f 6d 20 67 &7f60 61 6d 65 20 6f 72 20 64 65 6d 6f 20 20 20 20 20 &7f70 9d 84 20 20 20 20 20 20 20 20 20 20 20 20 20 20 &7f80 20 20 20 20 20 9c 20 20 20 20 20 20 20 20 20 20 &7f90 20 20 20 20 20 20 20 20 9d 84 20 20 20 20 20 20 &7fa0 20 20 20 20 20 20 20 20 20 20 20 20 20 9c 20 20 &7fb0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 &7fc0 9d 84 20 20 20 20 20 20 20 20 20 20 20 20 20 20 &7fd0 20 20 20 20 20 9c 86 20 42 6f 72 69 73 20 4f 62 &7fe0 69 6e 73 6b 6f 66 68 20 20 20 20 20 20 20 20 20 &7ff0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ; 1.EAGLE ; 00000000 00000000 0600 # Loads at &7000, entry_point set at &7ba2 of Eagle-Wing ; logo_colours_data &7000 18 18 18 17 13 16 12 15 11 14 18 18 18 18 18 18 &7010 17 13 16 12 15 11 14 18 18 18 18 18 18 18 18 18 &7020 18 18 17 13 16 12 15 11 14 18 18 18 18 18 18 18 &7030 18 17 13 16 12 15 11 14 18 18 18 18 18 18 18 18 &7040 18 17 13 16 12 15 11 14 18 18 18 18 18 18 18 18 &7050 18 18 17 13 16 12 15 11 14 18 18 18 18 18 18 18 &7060 17 13 16 12 15 11 14 18 18 18 18 18 18 18 18 18 &7070 18 18 18 17 13 16 12 15 11 14 18 18 18 18 18 18 &7080 ff ; music_data &7081 fe 00 10 51 08 65 08 51 08 51 04 49 04 45 08 49 &7091 08 51 10 59 08 6d 08 59 08 59 04 51 04 49 08 51 &70a1 08 59 10 61 08 75 08 61 08 61 04 59 04 51 08 59 &70b1 08 61 10 65 08 79 08 65 08 65 04 61 04 59 08 61 &70c1 08 65 10 6d 08 81 08 6d 20 79 10 6d 08 81 08 6d &70d1 18 79 08 6d 08 81 fe 00 04 81 04 81 08 81 fe 00 &70e1 04 81 04 81 08 81 08 81 08 81 08 81 08 81 08 81 &70f1 08 81 04 51 04 55 08 59 08 51 08 45 08 3d 08 45 &7101 08 51 08 59 08 65 0c 75 04 71 0c 75 04 71 18 75 &7111 04 51 04 55 08 59 08 51 08 45 08 3d 08 45 08 51 &7121 08 59 08 65 0c 75 04 71 0c 75 04 71 18 75 08 4d &7131 08 49 08 75 08 75 08 75 08 75 10 6d 08 49 08 45 &7141 08 6d 08 6d 08 6d 08 6d 10 65 04 51 04 59 08 61 &7151 10 6d 08 81 08 75 10 65 08 4d 0c 59 04 51 0c 59 &7161 04 51 0c 59 04 51 08 59 04 51 04 55 08 59 08 51 &7171 08 45 08 3d 08 45 08 51 08 59 08 65 0c 75 04 71 &7181 0c 75 04 71 18 75 04 65 04 69 08 6d 08 65 08 59 &7191 08 51 08 59 08 65 08 6d 08 75 0c 81 04 79 0c 81 &71a1 04 79 10 81 04 81 04 79 08 75 08 81 08 6d 08 79 &71b1 08 65 08 75 08 61 04 65 04 61 08 59 08 65 08 51 &71c1 08 61 08 49 08 59 08 45 04 49 04 45 08 3d 08 45 &71d1 08 49 08 51 08 59 08 61 08 65 08 75 20 6d 08 65 &71e1 fe 00 17 35 0b 49 0b 35 0b 35 05 2d 05 29 0b 2d &71f1 0b 35 17 29 0b 35 0b 29 0b 29 05 21 05 19 0b 15 &7201 0b 21 11 19 05 21 0b 29 0b 3d 11 35 05 29 17 35 &7211 0b 21 0b 35 05 3d 05 45 0b 49 17 45 17 45 17 35 &7221 0b 49 0b 35 0b 35 05 2d 05 29 0b 2d 0b 35 17 29 &7231 0b 3d 0b 29 0b 29 05 21 05 19 0b 15 0b 21 0b 19 &7241 0b 1d 0b 21 0b 29 0b 2d 0b 49 0b 45 0b 3d 17 29 &7251 17 21 05 19 fe 00 ff ; scrolltext_data &7258 45 61 67 6c 65 27 73 20 57 69 6e 67 20 2d 20 74 ; "Eagle's Wing - t" &7268 68 65 20 65 78 63 69 74 69 6e 67 20 6e 65 77 20 ; "he exciting new " &7278 67 61 6d 65 20 66 72 6f 6d 20 42 6f 72 69 73 20 ; "game from Boris " &7288 4f 62 69 6e 73 6b 6f 66 68 20 61 6e 64 20 53 6f ; "Obinskofh and So" &7298 66 74 77 61 72 65 20 49 6e 76 61 73 69 6f 6e 2e ; "ftware Invasion." &72a8 85 46 6c 79 20 74 68 65 20 45 61 67 6c 65 20 61 ; ".Fly the Eagle a" &72b8 73 73 61 75 6c 74 20 70 6c 61 6e 65 20 6f 6e 20 ; "ssault plane on " &72c8 6f 70 65 72 61 74 69 6f 6e 20 45 61 67 6c 65 27 ; "operation Eagle'" &72d8 73 20 57 69 6e 67 2e 85 46 6f 72 20 4d 6f 64 65 ; "s Wing..For Mode" &72e8 6c 20 42 20 77 69 74 68 20 63 75 72 72 65 6e 74 ; "l B with current" &72f8 20 4f 53 20 6f 6e 6c 79 2e 85 4f 74 68 65 72 20 ; " OS only..Other " &7308 67 61 6d 65 73 20 66 72 6f 6d 20 53 6f 66 74 77 ; "games from Softw" &7318 61 72 65 20 49 6e 76 61 73 69 6f 6e 3a 20 56 6f ; "are Invasion: Vo" &7328 72 74 65 78 2c 20 47 75 6e 73 6d 6f 6b 65 20 61 ; "rtex, Gunsmoke a" &7338 6e 64 20 33 44 20 42 6f 6d 62 20 41 6c 6c 65 79 ; "nd 3D Bomb Alley" &7348 2e 8a 49 6e 73 74 72 75 63 74 69 6f 6e 73 3a 85 ; "..Instructions:." &7358 55 73 65 20 74 68 65 20 6b 65 79 73 20 73 68 6f ; "Use the keys sho" &7368 77 6e 20 62 65 6c 6f 77 20 74 6f 20 66 6c 79 20 ; "wn below to fly " &7378 79 6f 75 72 20 70 6c 61 6e 65 20 61 6c 6f 6e 67 ; "your plane along" &7388 20 74 68 65 20 72 69 76 65 72 2e 85 44 6f 20 6e ; " the river..Do n" &7398 6f 74 20 63 72 61 73 68 20 69 6e 74 6f 20 74 68 ; "ot crash into th" &73a8 65 20 62 72 6f 77 6e 20 63 61 6e 79 6f 6e 20 77 ; "e brown canyon w" &73b8 61 6c 6c 73 20 6f 72 20 74 68 65 20 65 6e 65 6d ; "alls or the enem" &73c8 79 20 70 6c 61 6e 65 73 2e 85 57 68 65 6e 20 64 ; "y planes..When d" &73d8 61 6d 61 67 65 20 72 65 61 63 68 65 73 20 39 39 ; "amage reaches 99" &73e8 20 6f 72 20 74 68 65 20 70 6c 61 6e 65 20 72 75 ; " or the plane ru" &73f8 6e 73 20 6f 75 74 20 6f 66 20 66 75 65 6c 20 74 ; "ns out of fuel t" &7408 68 65 20 67 61 6d 65 20 69 73 20 6f 76 65 72 2e ; "he game is over." &7418 85 54 6f 20 72 65 70 61 69 72 2c 20 72 65 66 75 ; ".To repair, refu" &7428 65 6c 20 61 6e 64 20 72 65 61 72 6d 20 74 68 65 ; "el and rearm the" &7438 20 70 6c 61 6e 65 20 79 6f 75 20 6d 75 73 74 20 ; " plane you must " &7448 73 6c 6f 77 20 64 6f 77 6e 20 74 6f 20 64 6f 63 ; "slow down to doc" &7458 6b 20 77 69 74 68 20 74 68 65 20 73 69 73 74 65 ; "k with the siste" &7468 72 20 70 6c 61 6e 65 20 77 68 69 63 68 20 61 70 ; "r plane which ap" &7478 70 65 61 72 73 20 66 72 6f 6d 20 72 69 67 68 74 ; "pears from right" &7488 20 6f 66 20 73 63 72 65 65 6e 2e 85 4f 6e 20 79 ; " of screen..On y" &7498 6f 75 72 20 6d 69 73 73 69 6f 6e 20 79 6f 75 20 ; "our mission you " &74a8 77 69 6c 6c 20 65 6e 63 6f 75 6e 74 65 72 3a 20 ; "will encounter: " &74b8 50 69 6c 6c 62 6f 78 65 73 2c 20 53 2e 41 2e 4d ; "Pillboxes, S.A.M" &74c8 2e 73 2c 20 42 72 69 64 67 65 73 2c 20 50 61 74 ; ".s, Bridges, Pat" &74d8 72 6f 6c 20 53 68 69 70 73 2c 20 49 6e 74 65 72 ; "rol Ships, Inter" &74e8 63 65 70 74 6f 72 73 2c 20 44 65 73 74 72 6f 79 ; "ceptors, Destroy" &74f8 65 72 73 20 61 6e 64 20 43 68 61 73 65 20 50 6c ; "ers and Chase Pl" &7508 61 6e 65 73 85 28 43 29 20 53 6f 66 74 77 61 72 ; "anes.(C) Softwar" &7518 65 20 49 6e 76 61 73 69 6f 6e 20 31 39 38 34 20 ; "e Invasion 1984 " &7528 41 6c 6c 20 72 69 67 68 74 73 20 72 65 73 65 72 ; "All rights reser" &7538 76 65 64 8a 8a ff ; "ved.." ; second_stage_entry_point &753e a9 3f LDA #&3f ; "?" &7540 8d f6 6f STA &6ff6 ; decryption_key + 6 &7543 a9 c8 LDA #&c8 ; Read/Write BREAK/ESCAPE effect &7545 a2 02 LDX #&02 ; Clear memory on next RESET &7547 20 f4 ff JSR &fff4 ; OSBYTE &754a a9 75 LDA #&75 ; &7560 = check_vectors &754c 85 83 STA &83 ; check_vectors_address_high &754e a9 60 LDA #&60 &7550 85 82 STA &82 ; check_vectors_address_low &7552 a2 9f LDX #&9f ; &759f = run_two_eagle_command # *RUN 2.EAGLE &7554 a0 75 LDY #&75 &7556 4c f7 ff JMP &fff7 ; OSCLI ; infinite_loop_if_vector_in_ram &7559 e0 20 CPX #&20 ; &0221 = event_vector_high &755b f0 0c BEQ &7569 ; consider_next_vector &755d 4c 59 75 JMP &7559 ; infinite_loop_if_vector_in_ram ; check_vectors_and_update_filename &7560 a2 00 LDX #&00 ; check_vectors_loop &7562 bd 01 02 LDA &0201,X ; os_vector_table + 1 &7565 c9 80 CMP #&80 &7567 90 f0 BCC &7559 ; infinite_loop_if_vector_in_ram ; consider_next_vector &7569 e8 INX &756a e8 INX &756b e0 30 CPX #&30 &756d d0 f3 BNE &7562 ; check_vectors_loop &756f a5 b4 LDA &b4 ; os_current_block_number &7571 09 80 ORA #&80 &7573 8d d9 03 STA &03d9 ; block_header_filename + 7 &7576 29 7f AND #&7f &7578 c9 2b CMP #&2b &757a f0 01 BEQ &757d ; is_final_block &757c 60 RTS ; is_final_block &757d a9 88 LDA #&88 ; &7588 = write_press_space_and_run_game &757f 8d c2 03 STA &03c2 ; tape_execution_address_low &7582 a9 75 LDA #&75 &7584 8d c3 03 STA &03c3 ; tape_execution_address_high &7587 60 RTS ; write_press_space_and_run_game &7588 a2 00 LDX #&00 ; write_press_space_loop &758a bd ab 75 LDA &75ab,X ; press_space_string # Write "PRESS SPACE" &758d 20 ee ff JSR &ffee ; OSWRCH &7590 e8 INX &7591 e0 0b CPX #&0b &7593 d0 f5 BNE &758a ; write_press_space_loop ; wait_for_space &7595 20 e0 ff JSR &ffe0 ; OSRDCH &7598 c9 20 CMP #&20 ; " " &759a d0 f9 BNE &7595 ; wait_for_space &759c 4c 00 32 JMP &3200 ; main_binary_entry_point ; run_two_eagle_command # Last character of filename changes each block &759f 2f 22 32 2e 45 41 47 4c 45 20 22 0d ; "/"2.EAGLE "" ; press_space_string &75ab 50 52 45 53 53 20 53 50 41 43 45 ; "PRESS SPACE" ; unused &75b6 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &75c6 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &75d6 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &75e6 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &75f6 00 00 00 00 00 00 00 00 00 00 Game disassembly ================ ; 2.EAGLE? ; 00000000 00000000 2C00 # Loads at &1200 - &3dff # &1200 - &2fff is decrypted at &320b ; rnd &1200 a0 08 LDY #&08 ; shuffle_rnd_loop &1202 18 CLC &1203 ad 2d 12 LDA &122d ; rnd_state + 3 &1206 10 0f BPL &1217 ; skip_eoring &1208 a2 02 LDX #&02 ; eor_rnd_loop &120a bd 2a 12 LDA &122a,X ; rnd_state &120d 5d 2e 12 EOR &122e,X ; rnd_ror &1210 9d 2a 12 STA &122a,X ; rnd_state &1213 ca DEX &1214 10 f4 BPL &120a ; eor_rnd_loop &1216 38 SEC ; skip_eoring &1217 2e 2a 12 ROL &122a ; rnd_state &121a 2e 2b 12 ROL &122b ; rnd_state + 1 &121d 2e 2c 12 ROL &122c ; rnd_state + 2 &1220 2e 2d 12 ROL &122d ; rnd_state + 3 &1223 88 DEY &1224 d0 dc BNE &1202 ; shuffle_rnd_loop &1226 ad 2d 12 LDA &122d ; rnd_state + 3 ; rnd_leave &1229 60 RTS ; rnd_state &122a 00 00 00 00 ; rnd_eor &122e 53 b5 76 ; plot_sprite # Called with X = colour for filling, Y = sprite &1231 a9 b1 LDA #&b1 ; LDA(&..),Y &1233 8d de 12 STA &12de ; get_sprite_byte &1236 a9 82 LDA #&82 ; sprite_address &1238 8d df 12 STA &12df ; get_sprite_byte + 1 &123b a5 78 LDA &78 ; plotting_mode # .......1 if set, &123d 4a LSR A &123e 90 08 BCC &1248 ; not_filling ; is_filling &1240 8e df 12 STX &12df ; get_sprite_byte + 1 &1243 a2 a9 LDX #&a9 ; LDA #fill_value # fill outline of sprite in colour specified by X &1245 8e de 12 STX &12de ; get_sprite_byte ; not_filling &1248 29 03 AND #&03 # .....42. mask colour &124a aa TAX &124b bd 49 13 LDA &1349,X ; mask_values_table &124e 8d e7 12 STA &12e7 ; mask_value &1251 b9 ff 03 LDA &03ff,Y ; sprite_widths_table - 1 &1254 85 80 STA &80 ; sprite_width &1256 b9 13 04 LDA &0413,Y ; sprite_heights_table - 1 &1259 85 81 STA &81 ; sprite_height &125b b9 27 04 LDA &0427,Y ; sprite_addresses_low_table - 1 &125e 85 82 STA &82 ; sprite_address_low &1260 b9 3b 04 LDA &043b,Y ; sprite_addresses_high_table - 1 &1263 85 83 STA &83 ; sprite_address_high &1265 b9 4f 04 LDA &044f,Y ; buffer_addresses_low_table - 1 &1268 85 84 STA &84 ; buffer_address_low &126a b9 55 04 LDA &0455,Y ; buffer_addresses_high_table - 1 &126d 85 85 STA &85 ; buffer_address_high &126f 24 78 BIT &78 ; plotting_mode # 84...... plotting mode &1271 10 1b BPL &128e ; is_plotting # &00 : plot, &80 : buffer and plot, &c0 : unplot &1273 70 0c BVS &1281 ; is_unbuffering ; is_buffering_and_plotting # If buffering and plotting, store sprite position &1275 a5 76 LDA &76 ; sprite_x &1277 99 5b 04 STA &045b,Y ; sprites_previous_x - 1 &127a a5 77 LDA &77 ; sprite_y &127c 99 61 04 STA &0461,Y ; sprites_previous_y - 1 &127f 50 0d BVC &128e ; is_plotting # Always branches ; is_unbuffering # If unplotting, use previous sprite position &1281 b9 5b 04 LDA &045b,Y ; sprites_previous_x - 1 &1284 38 SEC &1285 e5 ba SBC &ba ; x_scrolling &1287 85 76 STA &76 ; sprite_x &1289 b9 61 04 LDA &0461,Y ; sprites_previous_y - 1 &128c 85 77 STA &77 ; sprite_y ; is_plotting &128e a9 00 LDA #&00 &1290 85 7d STA &7d ; column_offset_high &1292 a5 76 LDA &76 ; sprite_x &1294 0a ASL A &1295 0a ASL A &1296 26 7d ROL &7d ; column_offset_high &1298 0a ASL A &1299 26 7d ROL &7d ; column_offset_high &129b 85 7c STA &7c ; column_offset_low &129d a2 00 LDX #&00 ; plot_sprite_row_loop &129f a5 77 LDA &77 ; sprite_y &12a1 4a LSR A &12a2 4a LSR A &12a3 4a LSR A &12a4 a8 TAY &12a5 18 CLC &12a6 a5 77 LDA &77 ; sprite_y &12a8 29 07 AND #&07 &12aa 6d 50 03 ADC &0350 ; os_screen_start_address_low &12ad 79 1f 05 ADC &051f,Y ; group_offsets_low_table &12b0 85 72 STA &72 ; screen_address_low &12b2 ad 51 03 LDA &0351 ; os_screen_start_address_high &12b5 79 3f 05 ADC &053f,Y ; group_offsets_high_table &12b8 85 73 STA &73 ; screen_address_high &12ba a0 00 LDY #&00 &12bc a5 72 LDA &72 ; screen_address_low &12be 65 7c ADC &7c ; column_offset_low &12c0 85 72 STA &72 ; screen_address_low &12c2 a5 73 LDA &73 ; screen_address_high &12c4 65 7d ADC &7d ; column_offset_high &12c6 c9 80 CMP #&80 &12c8 90 02 BCC &12cc ; skip_wraparound &12ca e9 50 SBC #&50 ; skip_wraparound &12cc 85 73 STA &73 ; screen_address_high ; plot_sprite_column_loop &12ce 24 78 BIT &78 ; plotting_mode &12d0 10 0c BPL &12de ; is_plotting &12d2 50 06 BVC &12da ; is_buffering_and_plotting ; is_unplotting &12d4 b1 84 LDA (&84),Y ; buffer_address &12d6 81 72 STA (&72,X) ; screen_address &12d8 70 32 BVS &130c ; next_column # Always branches ; is_buffering_and_plotting &12da a1 72 LDA (&72,X) ; screen_address &12dc 91 84 STA (&84),Y ; buffer_address ; is_plotting ; get_sprite_byte &12de b1 82 LDA (&82),Y ; sprite_address # or LDA #fill_value if filling &12e0 f0 2a BEQ &130c ; next_column &12e2 85 7e STA &7e ; sprite_byte &12e4 a1 72 LDA (&72,X) ; screen_address &12e6 c9 3c CMP #&3c ; CC # actually CMP mask_value &12e8 f0 22 BEQ &130c ; next_column &12ea 85 7f STA &7f ; screen_byte &12ec a5 7e LDA &7e ; sprite_byte &12ee 29 aa AND #&aa ; left pixel &12f0 d0 08 BNE &12fa ; not_masked_left_pixel ; masked_left_pixel # If left pixel of sprite byte is colour 0, &12f2 a5 7f LDA &7f ; screen_byte &12f4 29 aa AND #&aa ; left pixel &12f6 05 7e ORA &7e ; sprite_byte # use left pixel of screen byte &12f8 85 7e STA &7e ; sprite_byte ; not_masked_left_pixel &12fa a5 7e LDA &7e ; sprite_byte &12fc 29 55 AND #&55 ; right pixel &12fe d0 08 BNE &1308 ; not_masked_right_pixel ; masked_right_pixel # If right pixel of sprite byte is colour 0, &1300 a5 7f LDA &7f ; screen_byte &1302 29 55 AND #&55 ; right pixel &1304 05 7e ORA &7e ; sprite_byte # use right pixel of screen byte &1306 85 7e STA &7e ; sprite_byte ; not_masked_right_pixel &1308 a5 7e LDA &7e ; sprite_byte &130a 81 72 STA (&72,X) ; screen_address # Plot to screen ; next_column &130c c8 INY &130d c4 80 CPY &80 ; sprite_width &130f f0 18 BEQ &1329 ; next_row &1311 18 CLC &1312 a5 72 LDA &72 ; screen_address_low &1314 69 08 ADC #&08 # Move right two pixels &1316 85 72 STA &72 ; screen_address_low &1318 90 0c BCC &1326 ; skip_page &131a e6 73 INC &73 ; screen_address_high &131c a5 73 LDA &73 ; screen_address_high &131e c9 80 CMP #&80 &1320 90 04 BCC &1326 ; skip_wraparound &1322 a9 30 LDA #&30 &1324 85 73 STA &73 ; screen_address_high ; skip_wraparound ; skip_page &1326 4c ce 12 JMP &12ce ; plot_sprite_column_loop ; next_row &1329 e6 77 INC &77 ; sprite_y &132b c6 81 DEC &81 ; sprite_height &132d f0 19 BEQ &1348 ; leave &132f 18 CLC &1330 a5 82 LDA &82 ; sprite_address_low &1332 65 80 ADC &80 ; sprite_width &1334 85 82 STA &82 ; sprite_address_low &1336 90 03 BCC &133b ; skip_page_sprite &1338 e6 83 INC &83 ; sprite_address_high &133a 18 CLC ; skip_page_sprite &133b a5 84 LDA &84 ; buffer_address_low &133d 65 80 ADC &80 ; sprite_width &133f 85 84 STA &84 ; buffer_address_low &1341 90 02 BCC &1345 ; skip_page_buffer &1343 e6 85 INC &85 ; buffer_address_high ; skip_page_buffer &1345 4c 9f 12 JMP &129f ; plot_sprite_row_loop ; leave &1348 60 RTS ; mask_values_table ; 0 1 2 0 1 2 &1349 00 3c 0c ; KK CC GG ; irq1_handler &134c 08 PHP &134d 48 PHA ; tmp_a &134e a5 cd LDA &cd ; vsync_occurred &1350 d0 0b BNE &135d ; not_vsync &1352 ad 4d fe LDA &fe4d ; System VIA interrupt flag register &1355 29 82 AND #&82 &1357 c9 82 CMP #&82 # &80 set for any interrupt, &02 set for v-sync &1359 d0 02 BNE &135d ; not_vsync &135b c6 cd DEC &cd ; vsync_occurred # Set to negative to indicate v-sync has occurred ; not_vsync &135d 68 PLA ; tmp_a &135e 28 PLP &135f 4c 93 dc JMP &dc93 ; os_irq1_handler ; plot_a_pixel_of_enemy_projectile &1362 a5 78 LDA &78 ; angle &1364 aa TAX ; angle &1365 29 0f AND #&0f &1367 a8 TAY &1368 8a TXA ; angle &1369 29 10 AND #&10 &136b d0 0f BNE &137c ; not_first_quadrant ; is_first_quadrant &136d b1 80 LDA (&80),Y ; pixel_offsets_table_address &136f 85 7a STA &7a ; sine_angle &1371 98 TYA &1372 49 0f EOR #&0f &1374 a8 TAY &1375 c8 INY &1376 b1 80 LDA (&80),Y ; pixel_offsets_table_address &1378 85 7b STA &7b ; cosine_angle &137a 10 0d BPL &1389 ; done_quads # Always branches ; not_first_quadrant &137c b1 80 LDA (&80),Y ; pixel_offsets_table_address &137e 85 7b STA &7b ; cosine_angle &1380 98 TYA &1381 49 0f EOR #&0f &1383 a8 TAY &1384 c8 INY &1385 b1 80 LDA (&80),Y ; pixel_offsets_table_address &1387 85 7a STA &7a ; sine_angle ; done_quads &1389 a5 76 LDA &76 ; enemy_projectile_x &138b e0 20 CPX #&20 &138d 90 0c BCC &139b ; is_positive_sine ; is_negative_sine &138f 38 SEC &1390 e5 7a SBC &7a ; sine_angle &1392 90 04 BCC &1398 ; is_offscreen &1394 c9 04 CMP #&04 &1396 b0 0a BCS &13a2 ; is_onscreen_in_x ; is_offscreen &1398 a0 ff LDY #&ff # Leave with Y = &ff to indicate pixel is offscreen &139a 60 RTS ; is_positive_sine &139b 18 CLC &139c 65 7a ADC &7a ; sine_angle &139e c9 9c CMP #&9c &13a0 b0 f6 BCS &1398 ; is_offscreen ; is_onscreen_in_x &13a2 85 7c STA &7c ; new_enemy_projectile_x &13a4 a5 77 LDA &77 ; enemy_projectile_y &13a6 e0 10 CPX #&10 &13a8 90 0a BCC &13b4 ; is_negative_cosine &13aa e0 30 CPX #&30 &13ac b0 06 BCS &13b4 ; is_negative_cosine ; is_positive_cosine &13ae 65 7b ADC &7b ; cosine_angle &13b0 90 07 BCC &13b9 ; set_new_enemy_projectile_y &13b2 b0 e4 BCS &1398 ; is_offscreen ; is_negative_cosine &13b4 38 SEC &13b5 e5 7b SBC &7b ; cosine_angle &13b7 90 df BCC &1398 ; is_offscreen ; set_new_enemy_projectile_y &13b9 85 7d STA &7d ; new_enemy_projectile_y &13bb 4a LSR A &13bc 4a LSR A &13bd 4a LSR A &13be a8 TAY &13bf 18 CLC &13c0 a5 7d LDA &7d ; new_enemy_projectile_y &13c2 29 07 AND #&07 &13c4 6d 50 03 ADC &0350 ; os_screen_start_address_low &13c7 79 1f 05 ADC &051f,Y ; group_offsets_low_table &13ca 85 72 STA &72 ; screen_address_low &13cc ad 51 03 LDA &0351 ; os_screen_start_address_high &13cf 79 3f 05 ADC &053f,Y ; group_offsets_high_table &13d2 85 73 STA &73 ; screen_address_high &13d4 a0 00 LDY #&00 &13d6 84 7e STY &7e ; column_offset_high &13d8 a5 7c LDA &7c ; new_enemy_projectile_x &13da 4a LSR A &13db 66 7f ROR &7f ; pixel_in_pair &13dd 0a ASL A &13de 0a ASL A &13df 26 7e ROL &7e ; column_offset_high &13e1 0a ASL A &13e2 26 7e ROL &7e ; column_offset_high &13e4 18 CLC &13e5 65 72 ADC &72 ; screen_address_low &13e7 85 72 STA &72 ; screen_address_low &13e9 a5 7e LDA &7e ; column_offset_high &13eb 65 73 ADC &73 ; screen_address_high &13ed c9 80 CMP #&80 &13ef 90 02 BCC &13f3 ; skip_wraparound &13f1 e9 50 SBC #&50 ; skip_wraparound &13f3 85 73 STA &73 ; screen_address_high &13f5 b1 72 LDA (&72),Y ; screen_address &13f7 85 7e STA &7e ; screen_byte # Used for unplotting enemy projectile &13f9 24 7f BIT &7f ; pixel_in_pair &13fb 30 0b BMI &1408 ; set_left_pixel_in_pair ; set_right_pixel_in_pair &13fd 29 55 AND #&55 &13ff 85 7f STA &7f ; left_pixel &1401 a5 79 LDA &79 ; enemy_projectile_colour &1403 0a ASL A &1404 05 7f ORA &7f ; left_pixel &1406 d0 04 BNE &140c ; set_screen ; set_left_pixel_in_pair &1408 29 aa AND #&aa &140a 05 79 ORA &79 ; enemy_projectile_colour ; set_screen &140c 91 72 STA (&72),Y ; screen_address # Plot pixel of enemy projectile &140e 60 RTS # Leave with Y = 0 to indicate onscreen ; calculate_angle_and_distance_to_target &140f a9 00 LDA #&00 &1411 85 7c STA &7c ; signs &1413 38 SEC &1414 a5 78 LDA &78 ; target_x # Calculate abs(target_x - enemy_projectile_x) &1416 e5 76 SBC &76 ; enemy_projectile_x &1418 b0 04 BCS &141e ; skip_inversion_x &141a 49 ff EOR #&ff &141c 69 01 ADC #&01 ; skip_inversion_x &141e 85 7a STA &7a ; absolute_delta_x &1420 66 7c ROR &7c ; signs # Set what will become &40 to indicate delta_x positive &1422 38 SEC &1423 a5 79 LDA &79 ; target_y # Calculate abs(target_y - enemy_projectile_y) &1425 e5 77 SBC &77 ; enemy_projectile_y &1427 b0 04 BCS &142d ; skip_inversion_y &1429 49 ff EOR #&ff &142b 69 01 ADC #&01 ; skip_inversion_y &142d 66 7c ROR &7c ; signs # Set &80 to indicate delta_y positive &142f 85 7b STA &7b ; absolute_delta_y &1431 a5 7a LDA &7a ; absolute_delta_x &1433 c5 7b CMP &7b ; absolute_delta_y &1435 d0 04 BNE &143b ; not_diagonal ; is_diagonal &1437 a2 08 LDX #&08 ; 45 degrees &1439 d0 4c BNE &1487 ; set_angle_in_quadrant # Always branches ; not_diagonal &143b 90 08 BCC &1445 ; delta_y_is_larger ; delta_x_is_larger &143d 85 7f STA &7f ; larger_delta &143f a5 7b LDA &7b ; absolute_delta_y &1441 85 7e STA &7e ; smaller_delta &1443 b0 08 BCS &144d ; divide_smaller_delta_by_larger_delta # Always branches ; delta_y_is_larger &1445 85 7e STA &7e ; smaller_delta &1447 a5 7b LDA &7b ; absolute_delta_y &1449 85 7f STA &7f ; larger_delta &144b e6 7c INC &7c ; signs # Set &01 to indicate delta y > delta_x ; divide_smaller_delta_by_larger_delta &144d a9 00 LDA #&00 &144f 85 7d STA &7d ; result # Calculate result = smaller_delta / larger_delta &1451 85 80 STA &80 ; smaller_delta_high &1453 a2 10 LDX #&10 ; division_loop &1455 06 7d ASL &7d ; result &1457 26 7e ROL &7e ; smaller_delta &1459 2a ROL A &145a a8 TAY &145b 26 80 ROL &80 ; smaller_delta_high &145d c5 7f CMP &7f ; larger_delta &145f a5 80 LDA &80 ; smaller_delta_high &1461 e9 00 SBC #&00 &1463 90 0c BCC &1471 ; skip_subtraction &1465 98 TYA &1466 e5 7f SBC &7f ; larger_delta &1468 a8 TAY &1469 a5 80 LDA &80 ; smaller_delta_high &146b e9 00 SBC #&00 &146d 85 80 STA &80 ; smaller_delta_high &146f e6 7d INC &7d ; result ; skip_subtraction &1471 98 TYA &1472 ca DEX &1473 d0 e0 BNE &1455 ; division_loop &1475 c9 00 CMP #&00 &1477 10 02 BPL &147b ; skip_inc &1479 e6 7d INC &7d ; result ; skip_inc &147b a2 08 LDX #&08 &147d a5 7d LDA &7d ; result ; find_entry_in_tan_table_loop &147f dd a2 05 CMP &05a2,X ; tan_table - 1 &1482 b0 03 BCS &1487 ; set_angle_in_quadrant &1484 ca DEX &1485 d0 f8 BNE &147f ; find_entry_in_tan_table_loop ; set_angle_in_quadrant &1487 86 79 STX &79 ; angle_in_quadrant &1489 24 7c BIT &7c ; signs &148b 30 0a BMI &1497 ; is_y_positive ; is_y_negative &148d 70 04 BVS &1493 ; is_y_negative_x_positive ; is_y_negative_x_negative &148f a9 30 LDA #&30 &1491 d0 0c BNE &149f ; set_angle_quadrant ; is_y_negative_x_positive &1493 a9 00 LDA #&00 &1495 f0 08 BEQ &149f ; set_angle_quadrant ; is_y_positive &1497 70 04 BVS &149d ; is_y_positive_x_positive ; is_y_positive_x_negative &1499 a9 20 LDA #&20 &149b d0 02 BNE &149f ; set_angle_quadrant ; is_y_positive_x_positive &149d a9 10 LDA #&10 ; set_angle_quadrant &149f 85 78 STA &78 ; angle_quadrant &14a1 4a LSR A # 8421.... -> ....8421 &14a2 4a LSR A &14a3 4a LSR A &14a4 4a LSR A # i.e. &01 set if second or fourth quadrant &14a5 45 7c EOR &7c ; signs # &01 set if delta y > delta_x &14a7 a4 79 LDY &79 ; angle_in_quadrant &14a9 29 01 AND #&01 &14ab d0 05 BNE &14b2 ; not_second_half_of_quadrant ; is_second_half_of_quadrant &14ad 98 TYA ; angle_in_quadrant &14ae 49 0f EOR #&0f &14b0 a8 TAY ; angle_in_quadrant &14b1 c8 INY ; not_second_half_of_quadrant &14b2 18 CLC &14b3 98 TYA ; angle_in_quadrant &14b4 65 78 ADC &78 ; angle_quadrant &14b6 85 78 STA &78 ; angle &14b8 a8 TAY ; angle &14b9 29 0f AND #&0f &14bb d0 07 BNE &14c4 ; not_horizontal_or_vertical ; is_horizontal_or_vertical &14bd a5 7a LDA &7a ; absolute_delta_x &14bf 05 7b ORA &7b ; absolute_delta_y &14c1 85 7d STA &7d ; distance &14c3 60 RTS ; not_horizontal_or_vertical &14c4 aa TAX ; angle_in_quadrant &14c5 bd aa 05 LDA &05aa,X ; sine_table - 1 &14c8 85 7f STA &7f ; sine_angle &14ca 98 TYA ; angle &14cb 29 10 AND #&10 # &10 set if second or fourth quadrant &14cd d0 04 BNE &14d3 ; use_x ; use_x &14cf a5 7a LDA &7a ; absolute_delta_x &14d1 d0 02 BNE &14d5 ; set_delta # Always branches ; use_y &14d3 a5 7b LDA &7b ; absolute_delta_y ; set_delta &14d5 85 7e STA &7e ; delta ; divide_delta_by_sine_angle &14d7 a2 10 LDX #&10 &14d9 a9 00 LDA #&00 &14db 85 7d STA &7d ; distance # Calculate distance = delta / sine_angle &14dd 85 80 STA &80 ; delta_high ; division_loop &14df 06 7d ASL &7d ; distance &14e1 26 7e ROL &7e ; delta &14e3 2a ROL A &14e4 a8 TAY &14e5 26 80 ROL &80 ; delta_high &14e7 c5 7f CMP &7f ; sine_angle &14e9 a5 80 LDA &80 ; delta_high &14eb e9 00 SBC #&00 &14ed 90 0c BCC &14fb ; skip_subtraction &14ef 98 TYA &14f0 e5 7f SBC &7f ; sine_angle &14f2 a8 TAY &14f3 a5 80 LDA &80 ; delta_high &14f5 e9 00 SBC #&00 &14f7 85 80 STA &80 ; delta_high &14f9 e6 7d INC &7d ; distance ; skip_subtraction &14fb 98 TYA &14fc ca DEX &14fd d0 e0 BNE &14df ; division_loop &14ff 60 RTS ; plot_label # Called with X = offset to label sprite &1500 a0 00 LDY #&00 ; plot_label_loop &1502 bd c0 0f LDA &0fc0,X ; label_sprites &1505 91 72 STA (&72),Y ; screen_address # Plot label &1507 e8 INX &1508 c8 INY &1509 c0 20 CPY #&20 &150b d0 f5 BNE &1502 ; plot_label_loop &150d 18 CLC &150e a5 72 LDA &72 ; screen_address_low &1510 69 20 ADC #&20 &1512 85 72 STA &72 ; screen_address_low &1514 90 0c BCC &1522 ; skip_page &1516 e6 73 INC &73 ; screen_address_high &1518 a5 73 LDA &73 ; screen_address_high &151a c9 80 CMP #&80 &151c 90 04 BCC &1522 ; skip_wraparound &151e e9 50 SBC #&50 &1520 85 73 STA &73 ; screen_address_high ; skip_wraparound ; skip_page &1522 a0 00 LDY #&00 &1524 98 TYA ; plot_label_padding_loop &1525 91 72 STA (&72),Y ; screen_address # Plot padding to right of label &1527 c8 INY &1528 c0 08 CPY #&08 &152a d0 f9 BNE &1525 ; plot_label_padding_loop &152c 18 CLC &152d a5 72 LDA &72 ; screen_address_low &152f 69 08 ADC #&08 # Move right two pixels &1531 85 72 STA &72 ; screen_address_low &1533 90 0c BCC &1541 ; skip_page &1535 e6 73 INC &73 ; screen_address_high &1537 a5 73 LDA &73 ; screen_address_high &1539 c9 80 CMP #&80 &153b 90 04 BCC &1541 ; skip_wraparound &153d e9 50 SBC #&50 &153f 85 73 STA &73 ; screen_address_high ; skip_wraparound ; skip_page &1541 60 RTS ; plot_number # Called with X = variable address, Y = number of pairs &1542 86 76 STX &76 ; variable_address &1544 84 77 STY &77 ; pairs_remaining ; plot_number_loop &1546 a5 76 LDA &76 ; variable_address &1548 8d 4f 15 STA &154f ; variable_for_tens &154b 8d 76 15 STA &1576 ; variable_for_ones ; plot_tens &154e a5 ff LDA &ff # actually LDA variable_for_tens &1550 29 f0 AND #&f0 &1552 aa TAX &1553 a0 00 LDY #&00 ; plot_tens_loop &1555 bd 60 10 LDA &1060,X ; digit_sprites &1558 91 72 STA (&72),Y ; screen_address # Plot tens &155a e8 INX &155b c8 INY &155c c0 10 CPY #&10 &155e d0 f5 BNE &1555 ; plot_tens_loop &1560 18 CLC &1561 a5 72 LDA &72 ; screen_address_low &1563 69 10 ADC #&10 &1565 85 72 STA &72 ; screen_address_low &1567 90 0c BCC &1575 ; skip_page &1569 e6 73 INC &73 ; screen_address_high &156b a5 73 LDA &73 ; screen_address_high &156d c9 80 CMP #&80 &156f 90 04 BCC &1575 ; skip_wraparound &1571 e9 50 SBC #&50 &1573 85 73 STA &73 ; screen_address_high ; skip_wraparound ; skip_page ; plot_ones &1575 a5 ff LDA &ff # actually LDA variable_for_ones &1577 29 0f AND #&0f &1579 0a ASL A &157a 0a ASL A &157b 0a ASL A &157c 0a ASL A &157d aa TAX &157e a0 00 LDY #&00 ; plot_ones_loop &1580 bd 60 10 LDA &1060,X ; digit_sprites &1583 91 72 STA (&72),Y ; screen_address # Plot ones &1585 e8 INX &1586 c8 INY &1587 c0 10 CPY #&10 &1589 d0 f5 BNE &1580 ; plot_ones_loop &158b 18 CLC &158c a5 72 LDA &72 ; screen_address_low &158e 69 10 ADC #&10 &1590 85 72 STA &72 ; screen_address_low &1592 90 0c BCC &15a0 ; skip_page &1594 e6 73 INC &73 ; screen_address_high &1596 a5 73 LDA &73 ; screen_address_high &1598 c9 80 CMP #&80 &159a 90 04 BCC &15a0 ; skip_wraparound &159c e9 50 SBC #&50 &159e 85 73 STA &73 ; screen_address_high ; skip_wraparound ; skip_page &15a0 c6 76 DEC &76 ; variable_address &15a2 c6 77 DEC &77 ; pairs_remaining &15a4 d0 a0 BNE &1546 ; plot_number_loop &15a6 60 RTS ; plot_bar &15a7 86 78 STX &78 ; scale_low &15a9 84 79 STY &79 ; scale_high ; plot_bar_left &15ab a0 00 LDY #&00 &15ad a9 15 LDA #&15 ; plot_bar_left_loop &15af 91 72 STA (&72),Y ; screen_address # Plot left of bar &15b1 c8 INY &15b2 c0 07 CPY #&07 &15b4 d0 f9 BNE &15af ; plot_bar_left_loop &15b6 18 CLC &15b7 a5 72 LDA &72 ; screen_address_low &15b9 69 08 ADC #&08 # Move right two pixels &15bb 85 72 STA &72 ; screen_address_low &15bd 85 80 STA &80 ; bar_screen_address_low &15bf a5 73 LDA &73 ; screen_address_high &15c1 69 00 ADC #&00 &15c3 c9 80 CMP #&80 &15c5 90 02 BCC &15c9 ; skip_wraparound &15c7 e9 50 SBC #&50 ; skip_wraparound &15c9 85 73 STA &73 ; screen_address_high &15cb 85 81 STA &81 ; bar_screen_address_high ; plot_outer_bar &15cd a2 05 LDX #&05 ; plot_outer_bar_section_loop &15cf a0 00 LDY #&00 ; plot_outer_bar_byte_loop &15d1 b9 b0 0f LDA &0fb0,Y ; outer_bar_sprite &15d4 91 72 STA (&72),Y ; screen_address # Plot outer bar &15d6 c8 INY &15d7 c0 10 CPY #&10 &15d9 d0 f6 BNE &15d1 ; plot_outer_bar_byte_loop &15db 18 CLC &15dc a5 72 LDA &72 ; screen_address_low &15de 69 10 ADC #&10 &15e0 85 72 STA &72 ; screen_address_low &15e2 90 0c BCC &15f0 ; skip_page &15e4 e6 73 INC &73 ; screen_address_high &15e6 a5 73 LDA &73 ; screen_address_high &15e8 c9 80 CMP #&80 &15ea 90 04 BCC &15f0 ; skip_wraparound &15ec e9 50 SBC #&50 &15ee 85 73 STA &73 ; screen_address_high ; skip_wraparound ; skip_page &15f0 ca DEX &15f1 d0 dc BNE &15cf ; plot_outer_bar_section_loop ; plot_inner_bar &15f3 a9 01 LDA #&01 ; KR &15f5 85 7a STA &7a ; pixel_value ; plot_inner_bar_section_loop &15f7 a2 02 LDX #&02 ; plot_inner_bar_pixel_loop &15f9 a0 02 LDY #&02 &15fb f8 SED &15fc 38 SEC &15fd a5 76 LDA &76 ; number_low &15ff e5 78 SBC &78 ; scale_low &1601 85 76 STA &76 ; number_low &1603 a5 77 LDA &77 ; number_high &1605 e5 79 SBC &79 ; scale_high &1607 85 77 STA &77 ; number_high &1609 d8 CLD &160a 90 29 BCC &1635 ; leave &160c a5 7a LDA &7a ; pixel_value &160e 49 03 EOR #&03 # KR <-> RK &1610 85 7a STA &7a ; pixel_value &1612 11 80 ORA (&80),Y ; bar_screen_address ; plot_inner_bar_byte_loop &1614 91 80 STA (&80),Y ; bar_screen_address # Plot inner bar &1616 c8 INY &1617 c0 05 CPY #&05 &1619 d0 f9 BNE &1614 ; plot_inner_bar_byte_loop &161b ca DEX &161c d0 db BNE &15f9 ; plot_inner_bar_section_loop &161e 18 CLC &161f a5 80 LDA &80 ; bar_screen_address_low &1621 69 08 ADC #&08 # Move right two pixels &1623 85 80 STA &80 ; bar_screen_address_low &1625 90 0c BCC &1633 ; skip_page &1627 e6 81 INC &81 ; bar_screen_address_high &1629 a5 81 LDA &81 ; bar_screen_address_high &162b c9 80 CMP #&80 &162d 90 04 BCC &1633 ; skip_wraparound &162f e9 50 SBC #&50 &1631 85 81 STA &81 ; bar_screen_address_high ; skip_wraparound ; skip_page &1633 d0 c2 BNE &15f7 ; plot_inner_bar_section_loop ; leave &1635 60 RTS ; set_velocity_pitch &1636 bd 07 17 LDA &1707,X ; velocity_pitch_table - &10 &1639 8d 2c 17 STA &172c ; sound_data + 4 (sound &21 pitch) &163c a9 21 LDA #&21 ; &1728 # Play sound to set velocity pitch &163e 4c fb 16 JMP &16fb ; play_sound ; play_sound_for_firing &1641 a9 80 LDA #&80 ; Read buffer status &1643 a2 fb LDX #&fb ; Sound output buffer 0 &1645 a0 ff LDY #&ff &1647 20 f4 ff JSR &fff4 ; OSBYTE &164a e0 0f CPX #&0f # Leave if any sounds pending on channel 0 &164c d0 27 BNE &1675 ; leave # i.e. if firing, firing missile, damage, explosion &164e a9 85 LDA #&85 ; &178c # Set envelope for firing &1650 20 09 17 JSR &1709 ; set_envelope &1653 a9 31 LDA #&31 ; &1738 # Play sound for firing &1655 20 fb 16 JSR &16fb ; play_sound &1658 4c f9 16 JMP &16f9 ; play_sound_for_velocity ; play_sound_for_missile &165b a9 80 LDA #&80 ; Read buffer status &165d a2 fb LDX #&fb ; Sound output buffer 0 &165f a0 ff LDY #&ff &1661 20 f4 ff JSR &fff4 ; OSBYTE &1664 e0 0c CPX #&0c # Leave if two sounds pending on channel 0 &1666 90 0d BCC &1675 ; leave # i.e. if explosion &1668 a9 93 LDA #&93 ; &179a # Set envelope for firing missile &166a 20 09 17 JSR &1709 ; set_envelope &166d a9 39 LDA #&39 ; &1740 # Play sound for firing missile &166f 20 fb 16 JSR &16fb ; play_sound &1672 4c f9 16 JMP &16f9 ; play_sound_for_velocity ; leave &1675 60 RTS ; play_sound_for_damage &1676 a9 80 LDA #&80 ; Read buffer status &1678 a2 fb LDX #&fb ; Sound output buffer 0 &167a a0 ff LDY #&ff &167c 20 f4 ff JSR &fff4 ; OSBYTE &167f e0 0d CPX #&0d # Leave if any sounds pending on channel 0 &1681 90 75 BCC &16f8 ; leave # i.e. if firing, firing missile, damage, explosion &1683 a9 a1 LDA #&a1 ; &17a8 # Set envelope for damage &1685 20 09 17 JSR &1709 ; set_envelope &1688 a9 41 LDA #&41 ; &1748 # Play sound for damage &168a 20 fb 16 JSR &16fb ; play_sound &168d 4c f9 16 JMP &16f9 ; play_sound_for_velocity ; play_sound_for_explosion &1690 a9 af LDA #&af ; &17b6 # Set envelope for explosion &1692 20 09 17 JSR &1709 ; set_envelope &1695 a9 49 LDA #&49 ; &1750 # Play sound for explosion &1697 20 fb 16 JSR &16fb ; play_sound &169a a9 51 LDA #&51 ; &1758 # Play sound for explosion &169c 20 fb 16 JSR &16fb ; play_sound &169f 4c f9 16 JMP &16f9 ; play_sound_for_velocity ; play_sound_for_empty &16a2 a9 80 LDA #&80 ; Read buffer status &16a4 a2 f9 LDX #&f9 ; Sound output buffer 2 &16a6 a0 ff LDY #&ff &16a8 20 f4 ff JSR &fff4 ; OSBYTE &16ab e0 0f CPX #&0f # Leave if any sounds pending on channel 2 &16ad d0 49 BNE &16f8 ; leave # i.e. if empty, warning, sister plane, command centre &16af a9 bd LDA #&bd ; &17c4 # Set envelope for empty &16b1 20 09 17 JSR &1709 ; set_envelope &16b4 a9 59 LDA #&59 ; &1760 # Play sound for empty &16b6 20 fb 16 JSR &16fb ; play_sound &16b9 a9 f5 LDA #&f5 ; &17fc # Play sound for empty &16bb 4c fb 16 JMP &16fb ; play_sound ; play_sound_for_warning &16be a9 80 LDA #&80 ; Read buffer status &16c0 a2 f9 LDX #&f9 ; Sound output buffer 2 &16c2 a0 ff LDY #&ff &16c4 20 f4 ff JSR &fff4 ; OSBYTE &16c7 e0 0f CPX #&0f # Leave if any sounds pending on channel 2 &16c9 d0 2d BNE &16f8 ; leave # i.e. if empty, warning, sister plane, command centre &16cb a9 cb LDA #&cb ; &17d2 # Set envelope for warning &16cd 20 09 17 JSR &1709 ; set_envelope &16d0 a9 65 LDA #&65 ; &176c # Play sound for warning &16d2 20 fb 16 JSR &16fb ; play_sound &16d5 a9 f5 LDA #&f5 ; &17fc # Play sound for warning &16d7 4c fb 16 JMP &16fb ; play_sound ; play_sound_for_sister_plane &16da a9 d9 LDA #&d9 ; &17e0 # Set envelope for sister plane &16dc 20 09 17 JSR &1709 ; set_envelope &16df a9 71 LDA #&71 ; &1778 # Play sound for sister plane &16e1 20 fb 16 JSR &16fb ; play_sound &16e4 a9 f5 LDA #&f5 ; &17fc # Play sound for sister plane &16e6 4c fb 16 JMP &16fb ; play_sound ; play_sound_for_command_centre &16e9 a9 e7 LDA #&e7 ; &17ee # Set envelope for command centre appearing &16eb 20 09 17 JSR &1709 ; set_envelope &16ee a9 7d LDA #&7d ; &1784 # Play sound for command centre appearing &16f0 20 fb 16 JSR &16fb ; play_sound &16f3 a9 f5 LDA #&f5 ; &17fc # Play sound for command centre appearing &16f5 4c fb 16 JMP &16fb ; play_sound ; leave &16f8 60 RTS ; play_sound_for_velocity &16f9 a9 29 LDA #&29 ; &1730 # Play sound for velocity ; play_sound &16fb 18 CLC &16fc 69 07 ADC #&07 ; &1707 = sound_data - &21 &16fe aa TAX &16ff a9 00 LDA #&00 &1701 69 17 ADC #&17 &1703 a8 TAY &1704 a9 07 LDA #&07 ; Generate a sound &1706 4c f1 ff JMP &fff1 ; OSWORD ; set_envelope &1709 18 CLC &170a 69 07 ADC #&07 ; &1707 = envelope_data - &85 &170c aa TAX &170d a9 00 LDA #&00 &170f 69 17 ADC #&17 &1711 a8 TAY &1712 a9 08 LDA #&08 ; Define a sound envelope &1714 4c f1 ff JMP &fff1 ; OSWORD ; velocity_pitch_table ; 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 &1717 7c 84 8c 94 9c a3 ab b3 bb c3 ca d2 da e2 ea f1 f9 ; sound_data ; chan vol pitch dur &1728 11 00 00 00 64 00 01 00 ; &21 # Set velocity pitch &1730 00 00 f9 ff 07 00 ff 00 ; &29 # Velocity &1738 10 00 01 00 06 00 01 00 ; &31 # Firing &1740 10 00 01 00 04 00 0a 00 ; &39 # Firing missile &1748 10 00 01 00 06 00 0a 00 ; &41 # Damage &1750 10 00 01 00 06 00 05 00 ; &49 # Explosion &1758 00 10 00 00 00 00 0f 00 ; &51 # Explosion &1760 12 00 04 00 00 00 02 00 ; &59 # Empty &1768 00 02 00 05 ; (unused) &176c 12 00 04 00 00 00 32 00 ; &65 # Warning &1774 00 32 00 80 ; (unused) &1778 12 00 04 00 00 00 28 00 ; &71 # Sister plane appearance or docking &1780 00 28 00 50 ; (unused) &1784 12 00 04 00 c8 00 63 00 ; &7d # Island with C appearance ; envelope_data &178c 01 01 00 00 00 00 00 00 00 fb fb fb 7e 00 ; &85 # Firing &179a 01 01 00 00 00 00 00 00 19 fe fe fe 7e 00 ; &93 # Firing missile &17a8 01 01 00 00 00 00 00 00 00 ff ff ff 64 00 ; &a1 # Damage &17b6 01 01 00 00 00 00 00 00 00 00 00 ff 7e 00 ; &af # Explosion &17c4 04 01 05 05 05 63 63 63 00 00 00 82 7e 7e ; &bd # Empty &17d2 04 01 02 02 02 0a 0a 0a 00 00 00 ff 7e 7e ; &cb # Warning &17e0 04 01 00 ff 00 0a 01 02 00 00 00 82 7e 7e ; &d9 # Sister plane appearance or docking &17ee 04 01 02 02 fe 05 05 0a 00 00 00 ff 7e 7e ; &e7 # Island with C appearance ; sound_data_continued ; chan vol pitch dur &17fc 02 10 00 00 00 00 01 00 ; &f5 # Empty, warning, sister plane, command centre ; tune_sound ; chan vol pitch dur &1804 03 00 f1 ff 00 00 01 00 ; continuation_sound ; chan vol pitch dur &180c 03 00 03 00 00 00 00 00 ; high_score_tune_data ; p d &1814 04 08 &1816 18 0c &1818 fe 01 &181a 18 04 &181c 18 08 &181e 28 08 &1820 20 0c &1822 18 04 &1824 20 08 &1826 28 08 &1828 18 0c &182a 18 04 &182c 28 08 &182e 34 08 &1830 3c 19 &1832 3c 08 &1834 34 0c &1836 28 04 &1838 28 08 &183a 18 08 &183c 20 0c &183e 18 04 &1840 20 08 &1842 28 08 &1844 18 0c &1846 0c 04 &1848 0c 08 &184a 04 08 &184c 18 19 &184e ff ; end of tune ; title_screen_tune_data ; p d &184f 50 02 &1851 44 02 &1853 34 05 &1855 44 05 &1857 50 05 &1859 64 0a &185b 74 02 &185d 6c 02 &185f 64 05 &1861 44 05 &1863 4c 05 &1865 50 0a &1867 ff ; end of tune ; event_handler &1868 08 PHP &1869 a5 5d LDA &5d ; tune_state # Zero if tune playing &186b f0 03 BEQ &1870 ; update_tune &186d 4c e6 18 JMP &18e6 ; leave_after_restoring_A ; update_tune &1870 8a TXA &1871 48 PHA ; tmp_x &1872 98 TYA &1873 48 PHA ; tmp_y &1874 a9 80 LDA #&80 ; Read buffer status &1876 a2 f8 LDX #&f8 ; Sound output buffer 3 &1878 a0 ff LDY #&ff &187a 20 f4 ff JSR &fff4 ; OSBYTE &187d e0 09 CPX #&09 &187f 90 61 BCC &18e2 ; leave_after_restoring_registers # Leave if three sounds pending on channel &1881 a0 00 LDY #&00 # i.e. previous note is still playing &1883 b1 5e LDA (&5e),Y ; tune_data_address &1885 c9 ff CMP #&ff # &ff indicates end of tune &1887 f0 61 BEQ &18ea ; end_of_tune &1889 c9 fe CMP #&fe # &fe indicates silence &188b d0 11 BNE &189e ; play_note ; is_silence &188d a9 10 LDA #&10 &188f 8d 0d 18 STA &180d ; continuation_sound + 1 (channel high) # Set &10 to continue previous sound &1892 c8 INY &1893 b1 5e LDA (&5e),Y ; tune_data_address # Second byte sets duration of silence &1895 8d 12 18 STA &1812 ; continuation_sound + 6 (duration) &1898 20 ee 18 JSR &18ee ; play_continuation_sound # Continue previous note &189b 4c d7 18 JMP &18d7 ; move_to_next_note ; play_note &189e 8c 05 18 STY &1805 ; tune_sound + 1 (channel high) # Clear &10 to play new sound &18a1 8d 08 18 STA &1808 ; tune_sound + 4 (pitch) # First byte sets pitch &18a4 a9 01 LDA #&01 &18a6 8d 0a 18 STA &180a ; tune_sound + 6 (duration) &18a9 a9 07 LDA #&07 ; Generate a sound &18ab a2 04 LDX #&04 ; &1804 = tune_sound &18ad a0 18 LDY #&18 &18af 20 f1 ff JSR &fff1 ; OSWORD # Play sound to set pitch of note &18b2 a9 00 LDA #&00 &18b4 8d 0d 18 STA &180d ; continuation_sound + 1 (channel high) # Clear &10 to play new sound &18b7 a9 01 LDA #&01 &18b9 8d 12 18 STA &1812 ; continuation_sound + 6 (duration) &18bc 20 ee 18 JSR &18ee : play_continuation_sound # End previous note &18bf a9 10 LDA #&10 &18c1 8d 05 18 STA &1805 ; tune_sound + 1 (channel high) # Set &10 to continue previous sound &18c4 a0 01 LDY #&01 &18c6 b1 5e LDA (&5e),Y ; tune_data_address # Second byte sets duration &18c8 38 SEC &18c9 e9 02 SBC #&02 &18cb 8d 0a 18 STA &180a ; tune_sound + 6 (duration) &18ce a9 07 LDA #&07 ; Generate a sound &18d0 a2 04 LDX #&04 ; &1804 = tune_sound &18d2 a0 18 LDY #&18 &18d4 20 f1 ff JSR &fff1 ; OSWORD # Play sound to set duration of note ; move_to_next_note &18d7 18 CLC &18d8 a5 5e LDA &5e ; tune_data_address_low &18da 69 02 ADC #&02 &18dc 85 5e STA &5e ; tune_data_address_low &18de 90 02 BCC &18e2 ; leave_after_restoring_registers &18e0 e6 5f INC &5f ; tune_data_address_high ; leave_after_restoring_registers &18e2 68 PLA ; tmp_y &18e3 a8 TAY &18e4 68 PLA ; tmp_x &18e5 aa TAX ; leave_after_restoring_A &18e6 a9 04 LDA #&04 &18e8 28 PLP &18e9 60 RTS ; end_of_tune &18ea e6 5d INC &5d ; tune_state # Set to non-zero to stop tune &18ec d0 f4 BNE &18e2 ; leave_after_restoring_registers # Always branches ; play_continuation_sound &18ee a0 00 LDY #&00 &18f0 b1 5e LDA (&5e),Y ; tune_data_address &18f2 8d 10 18 STA &1810 ; continuation_sound + 4 (pitch) &18f5 a9 07 LDA #&07 ; Generate a sound &18f7 a2 0c LDX #&0c ; &180c = continuation_sound &18f9 a0 18 LDY #&18 &18fb 4c f1 ff JMP &fff1 ; OSWORD ; plot_landscape &18fe a5 ba LDA &ba ; x_scrolling &1900 85 76 STA &76 ; columns_remaining_for_updating_address &1902 85 77 STA &77 ; columns_remaining_for_plotting &1904 18 CLC &1905 a5 70 LDA &70 ; landscape_screen_address_low &1907 69 08 ADC #&08 # Move right two pixels &1909 85 80 STA &80 ; features_screen_address_low &190b 85 72 STA &72 ; screen_address_low &190d a5 71 LDA &71 ; landscape_screen_address_high &190f 69 00 ADC #&00 &1911 c9 80 CMP #&80 &1913 90 02 BCC &1917 ; skip_wraparound &1915 e9 50 SBC #&50 ; skip_wraparound &1917 85 81 STA &81 ; features_screen_address_high &1919 85 73 STA &73 ; screen_address_high ; update_screen_address_loop &191b 18 CLC &191c a5 70 LDA &70 ; landscape_screen_address_low &191e 69 08 ADC #&08 # Move right two pixels &1920 85 70 STA &70 ; landscape_screen_address_low &1922 90 0c BCC &1930 ; skip_page &1924 e6 71 INC &71 ; landscape_screen_address_high &1926 a5 71 LDA &71 ; landscape_screen_address_high &1928 c9 80 CMP #&80 &192a 90 04 BCC &1930 ; skip_wraparound &192c e9 50 SBC #&50 &192e 85 71 STA &71 ; landscape_screen_address_high ; skip_wraparound ; skip_page &1930 18 CLC &1931 ad 50 03 LDA &0350 ; os_screen_start_address_low &1934 69 08 ADC #&08 # Move right two pixels &1936 8d 50 03 STA &0350 ; os_screen_start_address_low &1939 90 0f BCC &194a ; skip_page_os &193b ee 51 03 INC &0351 ; os_screen_start_address_high &193e ad 51 03 LDA &0351 ; os_screen_start_address_high &1941 c9 80 CMP #&80 &1943 90 05 BCC &194a ; skip_wraparound_os &1945 e9 50 SBC #&50 &1947 8d 51 03 STA &0351 ; os_screen_start_address_high ; skip_page_os ; skip_wraparound_os &194a c6 76 DEC &76 ; columns_remaining_for_updating_address &194c d0 cd BNE &191b ; update_screen_address_loop ; plot_landscape_loop &194e a2 00 LDX #&00 # Start at top row of screen &1950 a0 00 LDY #&00 &1952 a5 74 LDA &74 ; landscape_top_rock_end &1954 8d bd 19 STA &19bd ; strip_end_y &1957 a9 5c LDA #&5c ; Gr &1959 8d c2 19 STA &19c2 ; strip_colour &195c 20 bc 19 JSR &19bc ; plot_vertical_strip # Plot top rock (dithered, from &1997) &195f a9 00 LDA #&00 # Don't dither grass or river &1961 8d c4 19 STA &19c4 ; strip_eor &1964 a5 8c LDA &8c ; landscape_top_grass_end &1966 8d bd 19 STA &19bd ; strip_end_y &1969 a9 0c LDA #&0c ; GG &196b 8d c2 19 STA &19c2 ; strip_colour &196e 20 bc 19 JSR &19bc ; plot_vertical_strip # Plot top grass &1971 a5 8d LDA &8d ; landscape_bottom_grass_start &1973 8d bd 19 STA &19bd ; strip_end_y &1976 a9 3c LDA #&3c ; CC &1978 8d c2 19 STA &19c2 ; strip_colour &197b 20 bc 19 JSR &19bc ; plot_vertical_strip # Plot river &197e a5 75 LDA &75 ; landscape_bottom_rock_start &1980 8d bd 19 STA &19bd ; strip_end_y &1983 a9 0c LDA #&0c ; GG &1985 8d c2 19 STA &19c2 ; strip_colour &1988 20 bc 19 JSR &19bc ; plot_vertical_strip # Plot bottom grass &198b a9 00 LDA #&00 &198d 8d bd 19 STA &19bd ; strip_end_y # Continue until bottom row of screen &1990 a9 5c LDA #&5c ; Gr &1992 8d c2 19 STA &19c2 ; strip_colour &1995 a9 f0 LDA #&f0; Gr ^ rG # Dither bottom and top rock &1997 8d c4 19 STA &19c4 ; strip_eor &199a 20 bc 19 JSR &19bc ; plot_vertical_strip # Plot bottom rock &199d a5 72 LDA &72 ; screen_address_low &199f 18 CLC &19a0 69 08 ADC #&08 # Move right two pixels &19a2 85 72 STA &72 ; screen_address_low &19a4 90 0c BCC &19b2 ; skip_page &19a6 e6 73 INC &73 ; screen_address_high &19a8 a5 73 LDA &73 ; screen_address_high &19aa c9 80 CMP #&80 &19ac 90 04 BCC &19b2 ; skip_wraparound &19ae a9 30 LDA #&30 &19b0 85 73 STA &73 ; screen_address_high ; skip_wraparound ; skip_page &19b2 c6 77 DEC &77 ; columns_remaining_for_plotting &19b4 f0 03 BEQ &19b9 ; to_plot_features &19b6 4c 4e 19 JMP &194e ; plot_landscape_loop ; to_plot_features &19b9 4c e8 19 JMP &19e8 ; plot_features ; plot_vertical_strip ; plot_vertical_strip_loop &19bc e0 ff CPX #&ff # actually CPX strip_end_y &19be d0 01 BNE &19c1 ; not_end_of_strip &19c0 60 RTS ; not_end_of_strip &19c1 a9 ff LDA #&ff # actually LDA strip_colour &19c3 49 f0 EOR #&f0 ; Gr ^ rG # actually LDA strip_eor # &f0 for dithered rock, &00 for solid grass and river &19c5 8d c2 19 STA &19c2 ; strip_colour &19c8 91 72 STA (&72),Y ; screen_address # Plot landscape &19ca e8 INX &19cb c8 INY &19cc c0 08 CPY #&08 &19ce d0 ec BNE &19bc ; plot_vertical_strip_loop ; next_group &19d0 a0 00 LDY #&00 &19d2 18 CLC &19d3 a5 72 LDA &72 ; screen_address_low &19d5 69 80 ADC #&80 # Move down a group &19d7 85 72 STA &72 ; screen_address_low &19d9 a5 73 LDA &73 ; screen_address_high &19db 69 02 ADC #&02 &19dd c9 80 CMP #&80 &19df 90 02 BCC &19e3 ; skip_wraparound &19e1 e9 50 SBC #&50 ; skip_wraparound &19e3 85 73 STA &73 ; screen_address_high &19e5 4c bc 19 JMP &19bc ; plot_vertical_strip_loop ; plot_features &19e8 a2 00 LDX #&00 ; plot_features_loop &19ea bd 78 07 LDA &0778,X ; features_type # Non-zero if feature in slot &19ed d0 08 BNE &19f7 ; plot_feature ; consider_next_feature &19ef e8 INX &19f0 e0 0a CPX #&0a &19f2 d0 f6 BNE &19ea ; plot_features_loop &19f4 4c a7 1a JMP &1aa7 ; leave ; plot_feature &19f7 a8 TAY ; feature type &19f8 bd 82 07 LDA &0782,X ; features_y &19fb 85 78 STA &78 ; feature_y &19fd bd 8c 07 LDA &078c,X ; features_x_offset &1a00 85 79 STA &79 ; feature_x_offset &1a02 b9 31 04 LDA &0431,Y ; sprite_addresses_low_table - 1 + SPRITE_SAM_DOWN - 1 &1a05 85 76 STA &76 ; feature_sprite_address_low &1a07 b9 45 04 LDA &0445,Y ; sprite_addresses_high_table - 1 + SPRITE_SAM_DOWN - 1 &1a0a 85 77 STA &77 ; feature_sprite_address_high &1a0c b9 09 04 LDA &0409,Y ; sprite_widths_table - 1 + SPRITE_SAM_DOWN - 1 &1a0f 85 7a STA &7a ; feature_sprite_width &1a11 b9 1d 04 LDA &041d,Y ; sprite_widths_height - 1 + SPRITE_SAM_DOWN - 1 &1a14 85 7b STA &7b ; feature_sprite_height &1a16 a9 00 LDA #&00 &1a18 85 7f STA &7f ; row_in_sprite &1a1a 18 CLC &1a1b a5 79 LDA &79 ; feature_x_offset &1a1d 65 76 ADC &76 ; feature_sprite_address_low &1a1f 85 76 STA &76 ; feature_sprite_address_low &1a21 90 02 BCC &1a25 ; skip_page &1a23 e6 77 INC &77 ; feature_sprite_address_high ; skip_page ; plot_feature_row_loop &1a25 a9 00 LDA #&00 &1a27 85 7e STA &7e ; offset &1a29 a5 78 LDA &78 ; feature_y &1a2b 4a LSR A &1a2c 4a LSR A &1a2d 4a LSR A &1a2e a8 TAY &1a2f 18 CLC &1a30 a5 78 LDA &78 ; feature_y &1a32 29 07 AND #&07 &1a34 65 80 ADC &80 ; features_screen_address_low &1a36 79 1f 05 ADC &051f,Y ; group_offsets_low_table &1a39 85 72 STA &72 ; screen_address_low &1a3b a5 81 LDA &81 ; features_screen_address_high &1a3d 79 3f 05 ADC &053f,Y ; group_offsets_high_table &1a40 c9 80 CMP #&80 &1a42 90 02 BCC &1a46 ; skip_wraparound &1a44 e9 50 SBC #&50 ; skip_wraparound &1a46 85 73 STA &73 ; screen_address_high ; plot_feature_column_loop &1a48 a4 7e LDY &7e ; offset &1a4a b1 76 LDA (&76),Y ; feature_sprite_address &1a4c a0 00 LDY #&00 &1a4e 91 72 STA (&72),Y ; screen_address # Plot ground or river feature &1a50 18 CLC &1a51 a5 72 LDA &72 ; screen_address_low &1a53 69 08 ADC #&08 # Move right two pixels &1a55 85 72 STA &72 ; screen_address_low &1a57 90 0c BCC &1a65 ; skip_page &1a59 e6 73 INC &73 ; screen_address_high &1a5b a5 73 LDA &73 ; screen_address_high &1a5d c9 80 CMP #&80 &1a5f d0 04 BNE &1a65 ; skip_wraparound &1a61 a9 30 LDA #&30 &1a63 85 73 STA &73 ; screen_address_high ; skip_wraparound ; skip_page &1a65 e6 7e INC &7e ; offset &1a67 a5 7e LDA &7e ; offset &1a69 c5 ba CMP &ba ; x_scrolling &1a6b f0 09 BEQ &1a76 ; next_row &1a6d 18 CLC &1a6e 65 79 ADC &79 ; feature_x_offset &1a70 c5 7a CMP &7a ; feature_sprite_width &1a72 f0 02 BEQ &1a76 ; next_row &1a74 d0 d2 BNE &1a48 ; plot_feature_column_loop ; next_row &1a76 e6 78 INC &78 ; feature_y &1a78 f0 16 BEQ &1a90 ; finished_plotting_feature &1a7a e6 7f INC &7f ; row_in_sprite &1a7c a5 7f LDA &7f ; row_in_sprite &1a7e c5 7b CMP &7b ; feature_sprite_height &1a80 f0 0e BEQ &1a90 ; finished_plotting_feature &1a82 18 CLC &1a83 a5 76 LDA &76 ; feature_sprite_address_low &1a85 65 7a ADC &7a ; feature_sprite_width &1a87 85 76 STA &76 ; feature_sprite_address_low &1a89 90 02 BCC &1a8d ; skip_page &1a8b e6 77 INC &77 ; feature_sprite_address_high ; skip_page &1a8d 4c 25 1a JMP &1a25 ; plot_feature_row_loop ; finished_plotting_feature &1a90 18 CLC &1a91 a5 7e LDA &7e ; offset &1a93 65 79 ADC &79 ; feature_x_offset &1a95 9d 8c 07 STA &078c,X ; features_x_offset &1a98 c5 7a CMP &7a ; feature_sprite_width &1a9a 90 08 BCC &1aa4 ; to_consider_next_feature # Has all of the feature been plotted? &1a9c a9 00 LDA #&00 &1a9e 9d 78 07 STA &0778,X ; features_type # If so, set to zero to indicate no feature in slot &1aa1 9d 8c 07 STA &078c,X ; features_x_offset ; to_consider_next_feature &1aa4 4c ef 19 JMP &19ef ; consider_next_feature ;leave &1aa7 60 RTS ; scroll_screen &1aa8 a5 ba LDA &ba ; x_scrolling &1aaa 85 76 STA &76 ; count ; scroll_screen_loop &1aac a2 0d LDX #&0d ; R13: Displayed screen start address register (low) &1aae e6 ce INC &ce ; crtc_start_address_low &1ab0 a5 ce LDA &ce ; crtc_start_address_low &1ab2 8e 00 fe STX &fe00 ; video register number &1ab5 8d 01 fe STA &fe01 ; video register value &1ab8 d0 13 BNE &1acd ; skip_page &1aba e6 cf INC &cf ; crtc_start_address_high &1abc a5 cf LDA &cf ; crtc_start_address_high &1abe c9 10 CMP #&10 ; &1000 = &8000 / 8 &1ac0 d0 04 BNE &1ac6 ; skip_wraparound &1ac2 a9 06 LDA #&06 ; &0600 = &3000 / 8 &1ac4 85 cf STA &cf ; crtc_start_address_high ; skip_wraparound &1ac6 ca DEX ; &0c : R12: Displayed screen start address register (high) &1ac7 8e 00 fe STX &fe00 ; video register number &1aca 8d 01 fe STA &fe01 ; video register value ; skip_page &1acd c6 76 DEC &76 ; count &1acf d0 db BNE &1aac ; scroll_screen_loop &1ad1 60 RTS ; plot_status &1ad2 ad 50 03 LDA &0350 ; os_screen_start_address_low &1ad5 85 72 STA &72 ; screen_address_low &1ad7 ad 51 03 LDA &0351 ; os_screen_start_address_high &1ada 85 73 STA &73 ; screen_address_high &1adc a2 00 LDX #&00 ; MI &1ade 20 00 15 JSR &1500 ; plot_label # Plot MI &1ae1 a2 b7 LDX #&b7 ; &b7 = player_missiles &1ae3 a0 01 LDY #&01 &1ae5 20 42 15 JSR &1542 ; plot_number # Plot number of missiles &1ae8 a5 b7 LDA &b7 ; player_missiles &1aea 85 76 STA &76 ; number_low &1aec a9 00 LDA #&00 &1aee 85 77 STA &77 ; number_high &1af0 a2 01 LDX #&01 # Divide number by 1 for bar &1af2 a0 00 LDY #&00 &1af4 20 a7 15 JSR &15a7 ; plot_bar # Plot bar for missiles &1af7 a2 20 LDX #&20 ; SH &1af9 20 00 15 JSR &1500 ; plot_label # Plot SH &1afc a2 b6 LDX #&b6 ; &b6 = player_shots_high &1afe a0 02 LDY #&02 &1b00 20 42 15 JSR &1542 ; plot_number # Plot number of shots &1b03 a5 b5 LDA &b5 ; player_shots_low &1b05 85 76 STA &76 ; number_low &1b07 a5 b6 LDA &b6 ; player_shots_high &1b09 85 77 STA &77 ; number_high &1b0b a2 25 LDX #&25 # Divide number by 25 for bar &1b0d a0 00 LDY #&00 &1b0f 20 a7 15 JSR &15a7 ; plot_bar # Plot bar for shots &1b12 a2 40 LDX #&40 ; FU &1b14 20 00 15 JSR &1500 ; plot_label # Plot FU &1b17 a2 bc LDX #&bc ; &bc = fuel_high &1b19 a0 02 LDY #&02 &1b1b 20 42 15 JSR &1542 ; plot_number # Plot number for fuel &1b1e a5 bb LDA &bb ; fuel_low &1b20 85 76 STA &76 ; number_low &1b22 a5 bc LDA &bc ; fuel_high &1b24 85 77 STA &77 ; number_high &1b26 a2 50 LDX #&50 # Divide number by 250 for bar &1b28 a0 02 LDY #&02 &1b2a 20 a7 15 JSR &15a7 ; plot_bar # Plot bar for fuel &1b2d a2 60 LDX #&60 ; DA &1b2f 20 00 15 JSR &1500 ; plot_label # Plot DA &1b32 a2 bf LDX #&bf ; &bf = player_damage &1b34 a0 01 LDY #&01 &1b36 20 42 15 JSR &1542 ; plot_number # Plot number for damage &1b39 18 CLC &1b3a ad 50 03 LDA &0350 ; os_screen_start_address_low &1b3d 69 80 ADC #&80 # Move down a group &1b3f 85 72 STA &72 ; screen_address_low &1b41 ad 51 03 LDA &0351 ; os_screen_start_address_high &1b44 69 02 ADC #&02 &1b46 c9 80 CMP #&80 &1b48 90 02 BCC &1b4c ; skip_wraparound &1b4a e9 50 SBC #&50 ; skip_wraparound &1b4c 85 73 STA &73 ; screen_address_high &1b4e a2 80 LDX #&80 ; SC &1b50 20 00 15 JSR &1500 ; plot_label # Plot SC &1b53 a2 c2 LDX #&c2 ; &c2 = score + 2 &1b55 a0 03 LDY #&03 &1b57 20 42 15 JSR &1542 ; plot_number # Plot number for score &1b5a 60 RTS ; replot_planes &1b5b a0 01 LDY #&01 ; replot_planes_loop &1b5d b9 cb 05 LDA &05cb,Y ; planes_state - 1 # Non-zero if plane in slot &1b60 d0 06 BNE &1b68 ; replot_plane ; consider_next_plane &1b62 c8 INY &1b63 c0 05 CPY #&05 &1b65 d0 f6 BNE &1b5d ; replot_planes_loop &1b67 60 RTS ; replot_plane &1b68 84 6a STY &6a ; plane_slot # Y is used for sprite &1b6a a9 c0 LDA #&c0 ; unplot &1b6c 85 78 STA &78 ; plotting_mode &1b6e 20 31 12 JSR &1231 ; plot_sprite # Unplot plane from old position &1b71 a4 6a LDY &6a ; plane_slot &1b73 a9 80 LDA #&80 ; buffer and plot, use KK as mask &1b75 85 78 STA &78 ; plotting_mode &1b77 b9 cf 05 LDA &05cf,Y ; planes_x - 1 &1b7a 4a LSR A &1b7b 85 76 STA &76 ; sprite_x &1b7d b9 d3 05 LDA &05d3,Y ; planes_y - 1 &1b80 85 77 STA &77 ; sprite_y &1b82 20 31 12 JSR &1231 ; plot_sprite # Plot plane in new position &1b85 a4 6a LDY &6a ; plane_slot &1b87 d0 d9 BNE &1b62 ; consider_next_plane # Always branches ; unplot_projectiles ; unplot_player_projectiles &1b89 a2 0b LDX #&0b ; unplot_player_projectiles_loop &1b8b bd a0 06 LDA &06a0,X ; player_projectiles_state # Non-zero if projectile in slot &1b8e d0 05 BNE &1b95 ; unplot_player_projectile ; consider_next_player_projectile &1b90 ca DEX &1b91 10 f8 BPL &1b8b ; unplot_projectiles_loop &1b93 30 1b BMI &1bb0 ; unplot_enemy_projectiles # Always branches ; unplot_player_projectile &1b95 bd d0 06 LDA &06d0,X ; player_projectiles_screen_address_low &1b98 85 72 STA &72 ; screen_address_low &1b9a bd dc 06 LDA &06dc,X ; player_projectiles_screen_address_high &1b9d 85 73 STA &73 ; screen_address_high &1b9f a0 00 LDY #&00 &1ba1 bd e8 06 LDA &06e8,X ; player_projectiles_left_buffer &1ba4 91 72 STA (&72),Y ; screen_address # Unplot left of player projectile &1ba6 a0 08 LDY #&08 &1ba8 bd f4 06 LDA &06f4,X ; player_projectiles_right_buffer &1bab 91 72 STA (&72),Y ; screen_address # Unplot right of player projectile &1bad 4c 90 1b JMP &1b90 ; consider_next_player_projectile ; unplot_enemy_projectiles &1bb0 a2 09 LDX #&09 &1bb2 a0 00 LDY #&00 ; unplot_enemy_projectiles_loop &1bb4 bd 00 06 LDA &0600,X ; enemy_projectiles_state # Non-zero if projectile in slot &1bb7 d0 05 BNE &1bbe ; unplot_enemy_projectile ; consider_next_enemy_projectile &1bb9 ca DEX &1bba 10 f8 BPL &1bb4 ; unplot_enemy_projectiles_loop &1bbc 30 23 BMI &1be1 ; leave # Always branches ; unplot_enemy_projectile &1bbe 86 76 STX &76 ; enemy_projectile_slot &1bc0 8a TXA &1bc1 0a ASL A &1bc2 0a ASL A &1bc3 aa TAX &1bc4 a9 04 LDA #&04 &1bc6 85 83 STA &83 ; rows_remaining ; unplot_enemy_projectile_pixel_loop &1bc8 bd 28 06 LDA &0628,X ; enemy_projectiles_screen_addresses_low &1bcb 85 72 STA &72 ; screen_address_low &1bcd bd 50 06 LDA &0650,X ; enemy_projectiles_screen_addresses_high &1bd0 85 73 STA &73 ; screen_address_high &1bd2 bd 78 06 LDA &0678,X ; enemy_projectiles_buffer &1bd5 91 72 STA (&72),Y ; screen_address # Unplot pixel of enemy projectile &1bd7 e8 INX &1bd8 c6 83 DEC &83 ; rows_remaining &1bda d0 ec BNE &1bc8 ; unplot_enemy_projectile_pixel_loop &1bdc a6 76 LDX &76 ; enemy_projectile_slot &1bde 4c b9 1b JMP &1bb9 ; consider_next_enemy_projectile ; leave &1be1 60 RTS ; update_projectiles ; update_enemy_projectiles &1be2 a5 ba LDA &ba ; x_scrolling &1be4 0a ASL A &1be5 8d 05 1c STA &1c05 ; x_scrolling_times_two &1be8 a2 00 LDX #&00 ; update_enemy_projectiles_loop &1bea bd 00 06 LDA &0600,X ; enemy_projectiles_state # Non-zero if projectile in slot &1bed d0 08 BNE &1bf7 ; update_enemy_projectile ; consider_next_enemy_projectile &1bef e8 INX &1bf0 e0 0a CPX #&0a &1bf2 d0 f6 BNE &1bea ; update_enemy_projectiles_loop &1bf4 4c d8 1c JMP &1cd8 ; update_player_projectiles ; update_enemy_projectile &1bf7 86 85 STX &85 ; enemy_projectile_slot &1bf9 85 82 STA &82 ; enemy_projectile_state &1bfb bd 0a 06 LDA &060a,X ; enemy_projectiles_angle &1bfe 85 78 STA &78 ; angle &1c00 bd 14 06 LDA &0614,X ; enemy_projectiles_x &1c03 38 SEC &1c04 e9 ff SBC #&ff # actually SBC x_scrolling_times_two &1c06 85 76 STA &76 ; enemy_projectile_x &1c08 b0 03 BCS &1c0d ; not_at_left_edge_of_screen &1c0a 4c 4e 1c JMP &1c4e ; remove_enemy_projectile ; not_at_left_edge_of_screen &1c0d bd 1e 06 LDA &061e,X ; enemy_projectiles_y &1c10 85 77 STA &77 ; enemy_projectile_y &1c12 c6 82 DEC &82 ; enemy_projectile_state &1c14 a5 82 LDA &82 ; enemy_projectile_state &1c16 29 3f AND #&3f # Low six bits specify time to live &1c18 f0 34 BEQ &1c4e ; remove_enemy_projectile &1c1a a9 28 LDA #&28 &1c1c c5 76 CMP &76 ; enemy_projectile_x &1c1e b0 4d BCS &1c6d ; no_collision_with_player &1c20 a9 32 LDA #&32 &1c22 c5 76 CMP &76 ; enemy_projectile_x &1c24 90 47 BCC &1c6d ; no_collision_with_player &1c26 a5 b3 LDA &b3 ; player_y &1c28 38 SEC &1c29 e9 05 SBC #&05 &1c2b c5 77 CMP &77 ; enemy_projectile_y &1c2d b0 3e BCS &1c6d ; no_collision_with_player &1c2f 69 0a ADC #&0a &1c31 c5 77 CMP &77 ; enemy_projectile_y &1c33 90 38 BCC &1c6d ; no_collision_with_player ; collision_with_player &1c35 20 76 16 JSR &1676 ; play_sound_for_damage &1c38 f8 SED &1c39 a5 bf LDA &bf ; player_damage &1c3b 18 CLC &1c3c 24 82 BIT &82 ; enemy_projectile_state # Negative if homing &1c3e 10 05 BPL &1c45 ; do_two_damage ; do_ten_damage &1c40 69 0a ADC #&0a # Homing projectiles do 10 damage &1c42 4c 47 1c JMP &1c47 ; do_damage ; do_two_damage &1c45 69 02 ADC #&02 # Regular projectiles do 2 damage ; do_damage &1c47 90 02 BCC &1c4b ; skip_ceiling &1c49 a9 99 LDA #&99 # Set to &99 to kill player (too much damage) ; skip_ceiling &1c4b 85 bf STA &bf ; player_damage &1c4d d8 CLD ; remove_enemy_projectile &1c4e a6 85 LDX &85 ; enemy_projectile_slot &1c50 a9 00 LDA #&00 &1c52 9d 00 06 STA &0600,X ; enemy_projectiles_state # Set to zero to indicate no projectile in slot &1c55 8a TXA &1c56 0a ASL A &1c57 0a ASL A &1c58 a8 TAY &1c59 a9 80 LDA #&80 # Set to &80 to suppress unplotting &1c5b 99 50 06 STA &0650,Y ; enemy_projectiles_screen_addresses_high &1c5e c8 INY &1c5f 99 50 06 STA &0650,Y ; enemy_projectiles_screen_addresses_high &1c62 c8 INY &1c63 99 50 06 STA &0650,Y ; enemy_projectiles_screen_addresses_high &1c66 c8 INY &1c67 99 50 06 STA &0650,Y ; enemy_projectiles_screen_addresses_high &1c6a 4c ef 1b JMP &1bef ; consider_next_enemy_projectile ; no_collision_with_player &1c6d 24 82 BIT &82 ; enemy_projectile_state # Negative if homing &1c6f 30 04 BMI &1c75 ; move_towards_player ; is_regular_projectile &1c71 a9 15 LDA #&15 ; KW &1c73 d0 0f BNE &1c84 ; plot_enemy_projectile # Always branches ; is_homing_projectile &1c75 a9 2d LDA #&2d &1c77 85 78 STA &78 ; target_x &1c79 a5 b3 LDA &b3 ; player_y &1c7b 85 79 STA &79 ; target_y &1c7d 20 0f 14 JSR &140f ; calculate_angle_and_distance_to_target # Angle is used for plotting pixels &1c80 a6 85 LDX &85 ; enemy_projectile_slot &1c82 a9 01 LDA #&01 ; KR ; plot_enemy_projectile &1c84 85 79 STA &79 ; enemy_projectile_colour &1c86 a9 5f LDA #&5f ; &055f = pixel_offsets_table &1c88 85 80 STA &80 ; pixel_offsets_table_address_low &1c8a a9 05 LDA #&05 &1c8c 85 81 STA &81 ; pixel_offsets_table_address_high &1c8e a9 04 LDA #&04 &1c90 85 83 STA &83 ; count &1c92 a5 85 LDA &85 ; enemy_projectile_slot &1c94 0a ASL A &1c95 0a ASL A &1c96 18 CLC &1c97 69 03 ADC #&03 &1c99 aa TAX ; plot_enemy_projectile_pixel_loop &1c9a 86 84 STX &84 ; buffer_offset &1c9c 20 62 13 JSR &1362 ; plot_a_pixel_of_enemy_projectile # Returns Y = &ff if pixel offscreen &1c9f a6 84 LDX &84 ; buffer_offset &1ca1 c0 ff CPY #&ff &1ca3 f0 a9 BEQ &1c4e ; remove_enemy_projectile &1ca5 a5 7e LDA &7e ; screen_byte # Set in plot_a_pixel_of_enemy_projectile &1ca7 9d 78 06 STA &0678,X ; enemy_projectiles_buffer &1caa a5 72 LDA &72 ; screen_address_low &1cac 9d 28 06 STA &0628,X ; enemy_projectiles_screen_addresses_low &1caf a5 73 LDA &73 ; screen_address_high &1cb1 9d 50 06 STA &0650,X ; enemy_projectiles_screen_addresses_high &1cb4 ca DEX &1cb5 18 CLC &1cb6 a5 80 LDA &80 ; pixel_offsets_table_address_low &1cb8 69 11 ADC #&11 # Move to row of table for next pixel &1cba 85 80 STA &80 ; pixel_offsets_table_address_low &1cbc 90 02 BCC &1cc0 ; skip_page &1cbe e6 81 INC &81 ; pixel_offsets_table_address_high ; skip_page &1cc0 c6 83 DEC &83 ; count &1cc2 d0 d6 BNE &1c9a ; plot_enemy_projectile_pixel_loop &1cc4 a6 85 LDX &85 ; enemy_projectile_slot &1cc6 a5 82 LDA &82 ; enemy_projectile_state &1cc8 9d 00 06 STA &0600,X ; enemy_projectiles_state &1ccb a5 7c LDA &7c ; new_enemy_projectile_x &1ccd 9d 14 06 STA &0614,X ; enemy_projectiles_x &1cd0 a5 7d LDA &7d ; new_enemy_projectile_y &1cd2 9d 1e 06 STA &061e,X ; enemy_projectiles_y &1cd5 4c ef 1b JMP &1bef ; consider_next_enemy_projectile ; update_player_projectiles &1cd8 a2 00 LDX #&00 ; update_player_projectiles_loop &1cda bd a0 06 LDA &06a0,X ; player_projectiles_state # Non-zero if projectile in slot &1cdd d0 08 BNE &1ce7 ; update_player_projectile ; consider_next_player_projectile &1cdf e8 INX &1ce0 e0 0c CPX #&0c &1ce2 d0 f6 BNE &1cda ; update_player_projectiles_loop &1ce4 4c 5d 1f JMP &1f5d ; leave ; update_player_projectile &1ce7 85 76 STA &76 ; player_projectile_state &1ce9 bd ac 06 LDA &06ac,X ; player_projectiles_x &1cec 38 SEC &1ced e5 ba SBC &ba ; x_scrolling &1cef 9d ac 06 STA &06ac,X ; player_projectiles_x &1cf2 85 77 STA &77 ; player_projectile_x &1cf4 86 7a STX &7a ; player_projectile_slot &1cf6 bd b8 06 LDA &06b8,X ; player_projectiles_screen_x &1cf9 85 78 STA &78 ; player_projectile_screen_x &1cfb bd c4 06 LDA &06c4,X ; player_projectiles_y &1cfe 85 79 STA &79 ; player_projectile_y &1d00 24 76 BIT &76 ; player_projectile_state # &40 air fire, &80 missile, &c0 surface fire &1d02 10 0c BPL &1d10 ; is_air_fire &1d04 a5 77 LDA &77 ; player_projectile_x &1d06 c5 78 CMP &78 ; player_projectile_screen_x # Remove surface fire after fixed distance &1d08 90 03 BCC &1d0d ; to_remove_player_projectile &1d0a 4c 97 1d JMP &1d97 ; replot_player_projectile ; to_remove_player_projectile &1d0d 4c 0e 1e JMP &1e0e ; remove_player_projectile ; is_air_fire ; check_for_collision_with_planes &1d10 a2 01 LDX #&01 ; check_for_collision_with_planes_loop &1d12 bd cb 05 LDA &05cb,X ; planes_state - 1 # Non-zero if plane in slot &1d15 d0 07 BNE &1d1e ; check_for_collision_with_plane ; consider_next_plane &1d17 e8 INX &1d18 e0 05 CPX #&05 &1d1a d0 f6 BNE &1d12 ; check_for_collision_with_planes_loop &1d1c f0 31 BEQ &1d4f ; check_for_collision_with_enemy_projectiles ; check_for_collision_with_plane &1d1e bd cf 05 LDA &05cf,X ; planes_x - 1 &1d21 4a LSR A &1d22 c5 78 CMP &78 ; player_projectile_screen_x &1d24 b0 f1 BCS &1d17 ; consider_next_plane &1d26 7d ff 03 ADC &03ff,X ; sprite_widths_table - 1 &1d29 c5 78 CMP &78 ; player_projectile_screen_x &1d2b 90 ea BCC &1d17 ; consider_next_plane &1d2d bd d3 05 LDA &05d3,X ; planes_y - 1 &1d30 c5 79 CMP &79 ; player_projectile_y &1d32 b0 e3 BCS &1d17 ; consider_next_plane &1d34 7d 13 04 ADC &0413,X ; sprite_heights_table - 1 &1d37 c5 79 CMP &79 ; player_projectile_y &1d39 90 dc BCC &1d17 ; consider_next_plane ; collision_with_plane &1d3b 86 84 STX &84 ; plane &1d3d 20 00 12 JSR &1200 ; rnd &1d40 a6 84 LDX &84 ; plane &1d42 3d 88 04 AND &0488,X ; planes_destruction_probability_table - 1 # Bug: should probably be AND &0487,X &1d45 d0 c6 BNE &1d0d ; to_remove_player_projectile &1d47 a9 ff LDA #&ff &1d49 9d cb 05 STA &05cb,X ; planes_state - 1 # Set to negative to indicate explosion pending &1d4c 4c 0e 1e JMP &1e0e ; remove_player_projectile ; check_for_collision_with_enemy_projectiles &1d4f a5 78 LDA &78 ; player_projectile_screen_x &1d51 0a ASL A &1d52 85 80 STA &80 ; min_x &1d54 18 CLC &1d55 69 04 ADC #&04 &1d57 85 82 STA &82 ; max_x &1d59 a5 79 LDA &79 ; player_projectile_y &1d5b 38 SEC &1d5c e9 02 SBC #&02 &1d5e 85 81 STA &81 ; min_y &1d60 18 CLC &1d61 69 05 ADC #&05 &1d63 85 83 STA &83 ; max_y &1d65 a2 00 LDX #&00 ; check_for_collision_with_enemy_projectiles_loop &1d67 bd 00 06 LDA &0600,X ; enemy_projectiles_state # Non-zero if enemy projectile in slot &1d6a d0 0e BNE &1d7a ; check_for_collision_with_enemy_projectile ; consider_next_enemy_projectile &1d6c e8 INX &1d6d e0 0a CPX #&0a &1d6f d0 f6 BNE &1d67 ; check_for_collision_with_enemy_projectiles_loop &1d71 a5 78 LDA &78 ; player_projectile_screen_x &1d73 c9 4b CMP #&4b &1d75 90 20 BCC &1d97 ; replot_player_projectile &1d77 4c 0e 1e JMP &1e0e ; remove_player_projectile # Remove player projectile at right of screen ; check_for_collision_with_enemy_projectile &1d7a bd 14 06 LDA &0614,X ; enemy_projectiles_x &1d7d c5 80 CMP &80 ; min_x &1d7f 90 eb BCC &1d6c ; consider_next_enemy_projectile &1d81 c5 82 CMP &82 ; max_x &1d83 b0 e7 BCS &1d6c ; consider_next_enemy_projectile &1d85 bd 1e 06 LDA &061e,X ; enemy_projectiles_y &1d88 c5 81 CMP &81 ; min_y &1d8a 90 e0 BCC &1d6c ; consider_next_enemy_projectile &1d8c c5 83 CMP &83 ; max_y &1d8e b0 dc BCS &1d6c ; consider_next_enemy_projectile ; collision_with_enemy_projectile &1d90 a9 01 LDA #&01 # Set time to live to one &1d92 9d 00 06 STA &0600,X ; enemy_projectiles_state # i.e. unplot and remove on next update &1d95 90 d5 BCC &1d6c ; consider_next_enemy_projectile # Always branches ; replot_player_projectile &1d97 24 76 BIT &76 ; player_projectile_state # &40 air fire, &80 missile, &c0 surface fire &1d99 50 06 BVC &1da1 ; is_missile ; not_missile &1d9b a9 3f LDA #&3f ; WW &1d9d a2 03 LDX #&03 ; unused speed &1d9f d0 04 BNE &1da5 ; set_colour # Always branches ; is_missile &1da1 a9 03 LDA #&03 ; RR &1da3 a2 02 LDX #&02 ; unused speed ; set_colour &1da5 85 7b STA &7b ; player_projectile_colour &1da7 8a TXA # Unnecessary code &1da8 18 CLC &1da9 a9 04 LDA #&04 # Use same speed for all player projectiles &1dab 65 78 ADC &78 ; player_projectile_screen_x &1dad 85 78 STA &78 ; player_projectile_screen_x &1daf a6 7a LDX &7a ; player_projectile_slot &1db1 9d b8 06 STA &06b8,X ; player_projectiles_screen_x &1db4 a5 79 LDA &79 ; player_projectile_y &1db6 4a LSR A &1db7 4a LSR A &1db8 4a LSR A &1db9 a8 TAY &1dba 18 CLC &1dbb a5 79 LDA &79 ; player_projectile_y &1dbd 29 07 AND #&07 &1dbf 6d 50 03 ADC &0350 ; os_screen_start_address_low &1dc2 79 1f 05 ADC &051f,Y ; group_offsets_low_table &1dc5 85 72 STA &72 ; screen_address_low &1dc7 ad 51 03 LDA &0351 ; os_screen_start_address_high &1dca 79 3f 05 ADC &053f,Y ; group_offsets_high_table &1dcd 85 73 STA &73 ; screen_address_high &1dcf a0 00 LDY #&00 &1dd1 84 7c STY &7c ; column_offset_high &1dd3 a5 78 LDA &78 ; player_projectile_screen_x &1dd5 0a ASL A &1dd6 0a ASL A &1dd7 26 7c ROL &7c ; column_offset_high &1dd9 0a ASL A &1dda 26 7c ROL &7c ; column_offset_high &1ddc 18 CLC &1ddd 65 72 ADC &72 ; screen_address_low &1ddf 85 72 STA &72 ; screen_address_low &1de1 a5 7c LDA &7c ; column_offset_high &1de3 65 73 ADC &73 ; screen_address_high &1de5 c9 80 CMP #&80 &1de7 90 02 BCC &1deb ; skip_wraparound &1de9 e9 50 SBC #&50 ; skip_wraparound &1deb 85 73 STA &73 ; screen_address_high &1ded a5 72 LDA &72 ; screen_address_low &1def 9d d0 06 STA &06d0,X ; player_projectiles_screen_address_low &1df2 a5 73 LDA &73 ; screen_address_high &1df4 9d dc 06 STA &06dc,X ; player_projectiles_screen_address_high &1df7 b1 72 LDA (&72),Y ; screen_address &1df9 9d e8 06 STA &06e8,X ; player_projectiles_left_buffer # Store previous screen value for unplotting &1dfc a5 7b LDA &7b ; player_projectile_colour &1dfe 91 72 STA (&72),Y ; screen_address # Plot left of player projectile &1e00 a0 08 LDY #&08 &1e02 b1 72 LDA (&72),Y ; screen_address &1e04 9d f4 06 STA &06f4,X ; player_projectiles_right_buffer # Store previous screen value for unplotting &1e07 a5 7b LDA &7b ; player_projectile_colour &1e09 91 72 STA (&72),Y ; screen_address # Plot right of player projectile &1e0b 4c df 1c JMP &1cdf ; consider_next_player_projectile ; remove_player_projectile &1e0e a6 7a LDX &7a ; player_projectile_slot &1e10 a9 00 LDA #&00 &1e12 9d a0 06 STA &06a0,X ; player_projectiles_state # Set to zero to remove projectile &1e15 a9 80 LDA #&80 # Set to &80 to suppress unplotting &1e17 9d dc 06 STA &06dc,X ; player_projectiles_screen_address_high &1e1a 24 76 BIT &76 ; player_projectile_state # &40 air fire, &80 missile, &c0 surface fire &1e1c 30 03 BMI &1e21 ; is_missile_or_surface_fire ; is_air_fire &1e1e 4c df 1c JMP &1cdf ; consider_next_player_projectile ; is_missile_or_surface_fire &1e21 24 76 BIT &76 ; player_projectile_state # &40 air fire, &80 missile, &c0 surface fire &1e23 70 19 BVS &1e3e ; is_surface_fire ; is_missile &1e25 a5 78 LDA &78 ; player_projectile_screen_x &1e27 38 SEC &1e28 e9 02 SBC #&02 &1e2a 85 80 STA &80 ; projectile_min_x &1e2c 69 06 ADC #&06 &1e2e 85 82 STA &82 ; projectile_max_x &1e30 a5 79 LDA &79 ; player_projectile_y &1e32 e9 06 SBC #&06 &1e34 85 81 STA &81 ; projectile_min_y &1e36 69 0e ADC #&0e &1e38 85 83 STA &83 ; projectile_max_y &1e3a a9 04 LDA #&04 # Missiles can destroy a maximum of four enemies &1e3c d0 15 BNE &1e53 ; check_for_collision_with_enemies # Always branches ; is_surface_fire &1e3e a5 78 LDA &78 ; player_projectile_screen_x &1e40 85 80 STA &80 ; projectile_min_x &1e42 18 CLC &1e43 69 01 ADC #&01 &1e45 85 82 STA &82 ; projectile_max_x &1e47 a5 79 LDA &79 ; player_projectile_y &1e49 e9 00 SBC #&00 &1e4b 85 81 STA &81 ; projectile_min_y &1e4d 69 02 ADC #&02 &1e4f 85 83 STA &83 ; projectile_max_y &1e51 a9 01 LDA #&01 # Surface fire can destroy a maximum of one enemy ; check_for_collision_with_enemies &1e53 85 7b STA &7b ; number_of_enemies_projectile_can_destroy &1e55 a2 00 LDX #&00 ; check_for_collision_with_enemies_loop &1e57 bd 00 07 LDA &0700,X ; enemies_state # Non-zero if enemy in slot &1e5a f0 02 BEQ &1e5e ; consider_next_enemy &1e5c 10 08 BPL &1e66 ; check_for_collision_with_enemy # Negative if enemy exploding ; consider_next_enemy &1e5e e8 INX &1e5f e0 14 CPX #&14 &1e61 d0 f4 BNE &1e57 ; check_for_collision_with_enemies_loop &1e63 4c 35 1f JMP &1f35 ; add_explosion_if_missile ; check_for_collision_with_enemy &1e66 29 0f AND #&0f &1e68 a8 TAY # Y = enemy type &1e69 24 76 BIT &76 ; player_projectile_state # &40 air fire, &80 missile, &c0 surface fire &1e6b 50 10 BVC &1e7d ; consider_collision # Branch if missile; missile always destroy enemies &1e6d 86 86 STX &86 ; tmp_x &1e6f 84 87 STY &87 ; tmp_y &1e71 20 00 12 JSR &1200 ; rnd &1e74 a6 86 LDX &86 ; tmp_x &1e76 a4 87 LDY &87 ; tmp_y &1e78 39 95 04 AND &0495,Y ; enemy_types_destruction_probability_table - 1 &1e7b d0 e1 BNE &1e5e ; consider_next_enemy # Otherwise, consider probability of destroying enemy ; consider_collision &1e7d bd 14 07 LDA &0714,X ; enemies_x &1e80 4a LSR A &1e81 85 84 STA &84 ; enemy_min_x &1e83 bd 28 07 LDA &0728,X ; enemies_y &1e86 85 85 STA &85 ; enemy_min_y &1e88 b9 09 04 LDA &0409,Y ; sprite_widths_table + 9 &1e8b 18 CLC &1e8c 65 84 ADC &84 ; enemy_min_x &1e8e 85 86 STA &86 ; enemy_max_x &1e90 b9 1d 04 LDA &041d,Y ; sprite_widths_height + 9 &1e93 18 CLC &1e94 65 85 ADC &85 ; enemy_min_y &1e96 85 87 STA &87 ; enemy_max_y ; check_left_edge_of_projectile &1e98 a5 80 LDA &80 ; projectile_min_x &1e9a c5 84 CMP &84 ; enemy_min_x &1e9c 90 04 BCC &1ea2 ; check_right_edge_of_projectile &1e9e c5 86 CMP &86 ; enemy_max_x &1ea0 90 1e BCC &1ec0 ; check_top_edge_of_projectile ; check_right_edge_of_projectile &1ea2 a5 82 LDA &82 ; projectile_max_x &1ea4 c5 84 CMP &84 ; enemy_min_x &1ea6 90 04 BCC &1eac ; check_left_edge_of_enemy &1ea8 c5 86 CMP &86 ; enemy_max_x &1eaa 90 14 BCC &1ec0 ; check_top_edge_of_projectile ; check_left_edge_of_enemy &1eac a5 84 LDA &84 ; enemy_min_x &1eae c5 80 CMP &80 ; projectile_min_x &1eb0 90 04 BCC &1eb6 ; check_right_edge_of_enemy &1eb2 c5 82 CMP &82 ; projectile_max_x &1eb4 90 0a BCC &1ec0 ; check_top_edge_of_projectile ; check_right_edge_of_enemy &1eb6 a5 86 LDA &86 ; enemy_max_x &1eb8 c5 80 CMP &80 ; projectile_min_x &1eba 90 a2 BCC &1e5e ; consider_next_enemy &1ebc c5 82 CMP &82 ; projectile_max_x &1ebe b0 9e BCS &1e5e ; consider_next_enemy ; check_top_edge_of_projectile &1ec0 a5 81 LDA &81 ; projectile_min_y &1ec2 c5 85 CMP &85 ; enemy_min_y &1ec4 90 04 BCC &1eca ; check_bottom_edge_of_projectile &1ec6 c5 87 CMP &87 ; enemy_max_y &1ec8 90 21 BCC &1eeb ; collision_with_enemy ; check_bottom_edge_of_projectile &1eca a5 83 LDA &83 ; projectile_max_y &1ecc c5 85 CMP &85 ; enemy_min_y &1ece 90 04 BCC &1ed4 ; check_top_edge_of_enemy &1ed0 c5 87 CMP &87 ; enemy_max_y &1ed2 90 17 BCC &1eeb ; collision_with_enemy ; check_top_edge_of_enemy &1ed4 a5 85 LDA &85 ; enemy_min_y &1ed6 c5 81 CMP &81 ; projectile_min_y &1ed8 90 04 BCC &1ede ; check_bottom_edge_of_enemy &1eda c5 83 CMP &83 ; projectile_max_y &1edc 90 0d BCC &1eeb ; collision_with_enemy ; check_bottom_edge_of_enemy &1ede a5 87 LDA &87 ; enemy_max_y &1ee0 c5 81 CMP &81 ; projectile_min_y &1ee2 90 04 BCC &1ee8 ; to_consider_next_enemy &1ee4 c5 83 CMP &83 ; projectile_max_y &1ee6 90 03 BCC &1eeb ; collision_with_enemy ; to_consider_next_enemy &1ee8 4c 5e 1e JMP &1e5e ; consider_next_enemy ; collision_with_enemy &1eeb b9 e3 04 LDA &04e3,Y ; enemy_types_explosion_state_table - 1 # Y = enemy type &1eee 9d 00 07 STA &0700,X ; enemies_state # Add explosion for enemy &1ef1 98 TYA &1ef2 9d 3c 07 STA &073c,X ; enemies_type_for_explosion # Note type of exploding enemy &1ef5 18 CLC &1ef6 a5 84 LDA &84 ; enemy_min_x &1ef8 9d 50 07 STA &0750,X ; enemies_secondary_x &1efb 79 ed 04 ADC &04ed,Y ; enemy_types_explosion_x_offset_table - 1 &1efe 0a ASL A &1eff 9d 14 07 STA &0714,X ; enemies_x &1f02 a5 85 LDA &85 ; enemy_min_y &1f04 9d 64 07 STA &0764,X ; enemies_secondary_y &1f07 79 f7 04 ADC &04f7,Y ; enemy_types_explosion_y_offset_table - 1 &1f0a 9d 28 07 STA &0728,X ; enemies_y &1f0d b9 6f 04 LDA &046f,Y ; enemy_types_scoring_low_table - 1 &1f10 f8 SED &1f11 65 c0 ADC &c0 ; score # Score for destroying enemy &1f13 85 c0 STA &c0 ; score &1f15 b9 79 04 LDA &0479,Y ; enemy_types_scoring_high_table - 1 &1f18 65 c1 ADC &c1 ; score + 1 &1f1a 85 c1 STA &c1 ; score + 1 &1f1c 86 77 STX &77 ; enemy_slot &1f1e 90 08 BCC &1f28 ; skip_overflow &1f20 c6 50 DEC &50 ; ten_thousands_required_for_sister_plane &1f22 a5 c2 LDA &c2 ; score + 2 &1f24 69 00 ADC #&00 &1f26 85 c2 STA &c2 ; score + 2 ; skip_overflow &1f28 d8 CLD &1f29 20 90 16 JSR &1690 ; play_sound_for_explosion &1f2c c6 7b DEC &7b ; number_of_enemies_projectile_can_destroy &1f2e f0 05 BEQ &1f35 ; add_explosion_if_missile &1f30 a6 77 LDX &77 ; enemy_slot &1f32 4c 5e 1e JMP &1e5e ; consider_next_enemy ; add_explosion_if_missile &1f35 24 76 BIT &76 ; player_projectile_state # &40 air fire, &80 missile, &c0 surface fire &1f37 70 1f BVS &1f58 ; to_consider_next_player_projectile ; is_missile # Add explosion for missile &1f39 a2 00 LDX #&00 ; find_free_explosion_slot_loop &1f3b bd 00 07 LDA &0700,X ; enemies_state &1f3e f0 08 BEQ &1f48 ; found_free_explosion_slot &1f40 e8 INX &1f41 e0 14 CPX #&14 &1f43 d0 f6 BNE &1f3b ; find_free_explosion_slot_loop &1f45 4c 58 1f JMP &1f58 ; to_consider_next_player_projectile ; found_free_explosion_slot &1f48 a9 83 LDA #&83 ; ENEMY_STATE_EXPLODING | (SPRITE_EXPLOSION_THREE - SPRITE_EXPLOSION_ZERO) &1f4a 9d 00 07 STA &0700,X ; enemies_state # Set to negative to indicate exploding &1f4d a5 80 LDA &80 ; projectile_min_x &1f4f 0a ASL A &1f50 9d 14 07 STA &0714,X ; enemies_x &1f53 a5 81 LDA &81 ; projectile_min_y &1f55 9d 28 07 STA &0728,X ; enemies_y ; to_consider_next_player_projectile &1f58 a6 7a LDX &7a ; player_projectile_slot &1f5a 4c df 1c JMP &1cdf ; consider_next_player_projectile ; leave &1f5d 60 RTS ; update_explosions &1f5e a2 00 LDX #&00 ; update_explosions_loop &1f60 bd 00 07 LDA &0700,X ; enemies_state # Negative if exploding &1f63 30 06 BMI &1f6b ; is_exploding ; consider_next_enemy &1f65 e8 INX &1f66 e0 14 CPX #&14 &1f68 d0 f6 BNE &1f60 ; update_explosions_loop &1f6a 60 RTS ; is_exploding &1f6b 29 7f AND #&7f &1f6d 49 08 EOR #&08 ; ENEMY_STATE_DEFER_EXPLOSION_ANIMATION # Toggle &08 to determine whether to animate explosion &1f6f 85 87 STA &87 ; explosion_state &1f71 29 08 AND #&08 ; ENEMY_STATE_DEFER_EXPLOSION_ANIMATION &1f73 d0 09 BNE &1f7e ; animate_explosion # Animate explosion only every other frame &1f75 a5 87 LDA &87 ; explosion_state &1f77 09 80 ORA #&80 ; ENEMY_STATE_EXPLODING &1f79 9d 00 07 STA &0700,X ; enemies_state &1f7c d0 e7 BNE &1f65 ; consider_next_enemy # Always branches ; animate_explosion &1f7e 86 86 STX &86 ; explosion_slot &1f80 e6 87 INC &87 ; explosion_state # Zero becomes one on first update &1f82 a5 87 LDA &87 ; explosion_state &1f84 18 CLC &1f85 29 07 AND #&07 ; ENEMY_STATE_EXPLOSION_FRAME_MASK &1f87 c9 07 CMP #&07 ; ENEMY_STATE_EXPLOSION_FRAME_MASK &1f89 f0 39 BEQ &1fc4 ; check_if_end_of_explosion ; plot_explosion &1f8b 69 06 ADC #&06 ; SPRITE_EXPLOSION_ZERO - 1 # Use SPRITE_EXPLOSION_ZERO for first update &1f8d a8 TAY # Y = sprite &1f8e bd 14 07 LDA &0714,X ; enemies_x &1f91 4a LSR A &1f92 85 76 STA &76 ; sprite_x &1f94 bd 28 07 LDA &0728,X ; enemies_y &1f97 85 77 STA &77 ; sprite_y &1f99 a9 02 LDA #&02 ; plot without buffering, use CC as mask &1f9b 85 78 STA &78 ; plotting_mode &1f9d 20 31 12 JSR &1231 ; plot_sprite # Plot explosion &1fa0 a6 86 LDX &86 ; explosion_slot &1fa2 a5 87 LDA &87 ; explosion_state &1fa4 38 SEC &1fa5 e9 10 SBC #&10 ; ENEMY_STATE_EXPLOSION_EXTRA_FRAME &1fa7 09 80 ORA #&80 ; ENEMY_STATE_EXPLODING &1fa9 b0 02 BCS &1fad ; skip_floor &1fab a9 8e LDA #&8e ; ENEMY_STATE_EXPLODING | ENEMY_STATE_DEFER_EXPLOSION_ANIMATION | (7 - 1) # Six becomes seven on next update, removes explosion ; skip_floor &1fad 9d 00 07 STA &0700,X ; enemies_state &1fb0 bd 14 07 LDA &0714,X ; enemies_x &1fb3 38 SEC &1fb4 e9 02 SBC #&02 &1fb6 9d 14 07 STA &0714,X ; enemies_x &1fb9 bd 28 07 LDA &0728,X ; enemies_y &1fbc 38 SEC &1fbd e9 02 SBC #&02 &1fbf 9d 28 07 STA &0728,X ; enemies_y &1fc2 d0 a1 BNE &1f65 ; consider_next_enemy # Always branches ; check_if_end_of_explosion &1fc4 a5 87 LDA &87 ; explosion_state &1fc6 38 SEC &1fc7 e9 10 SBC #&10 ; ENEMY_STATE_EXPLOSION_EXTRA_FRAME &1fc9 90 09 BCC &1fd4 ; end_of_explosion # Always branches ; unused # Unused code &1fcb 29 fe AND #&fe # &1fcd 09 80 ORA #&80 ; ENEMY_STATE_EXPLODING # &1fcf 9d 00 07 STA &0700,X ; enemies_state # &1fd2 d0 91 BNE &1f65 ; consider_next_enemy # Would always branch ; end_of_explosion &1fd4 bd 3c 07 LDA &073c,X ; enemies_type_for_explosion &1fd7 c9 04 CMP #&04 ; ENEMY_TYPE_SHIP_HORIZONTAL &1fd9 f0 08 BEQ &1fe3 ; unplot_river_enemy &1fdb c9 05 CMP #&05 ; ENEMY_TYPE_SHIP_VERTICAL &1fdd f0 04 BEQ &1fe3 ; unplot_river_enemy &1fdf c9 07 CMP #&07 ; ENEMY_TYPE_BRIDGE_MIDDLE &1fe1 d0 19 BNE &1ffc ; remove_explosion ; unplot_river_enemy &1fe3 18 CLC &1fe4 69 0a ADC #&0a ; SPRITE_SAM_DOWN - 1 &1fe6 a8 TAY # Y = sprite &1fe7 bd 50 07 LDA &0750,X ; enemies_secondary_x &1fea 85 76 STA &76 ; sprite_x &1fec bd 64 07 LDA &0764,X ; enemies_secondary_y &1fef 85 77 STA &77 ; sprite_y &1ff1 a2 3c LDX #&3c ; CC &1ff3 a9 05 LDA #&05 ; fill sprite with colour, use GG as mask &1ff5 85 78 STA &78 ; plotting_mode &1ff7 20 31 12 JSR &1231 ; plot_sprite # Unplot river enemy &1ffa a6 86 LDX &86 ; explosion_slot ; remove_explosion &1ffc a9 00 LDA #&00 &1ffe 9d 00 07 STA &0700,X ; enemies_state # Set to zero to remove explosion &2001 9d 3c 07 STA &073c,X ; enemies_type_for_explosion # Set to zero to indicate no type &2004 4c 65 1f JMP &1f65 ; consider_next_enemy ; plot_landscape_after_vsync &2007 a5 ba LDA &ba ; x_scrolling &2009 d0 2e BNE &2039 ; is_scrolling # Always branches ; not_scrolling # Unused code; x_scrolling is never zero here &200b 20 d2 1a JSR &1ad2 ; plot_status &200e 20 89 1b JSR &1b89 ; unplot_projectiles &2011 a0 06 LDY #&06 ; SPRITE_AIMING_SIGHT &2013 a9 c0 LDA #&c0 ; unplot &2015 85 78 STA &78 ; plotting_mode &2017 20 31 12 JSR &1231 ; plot_sprite # Unplot aiming sight &201a 20 5b 1b JSR &1b5b ; replot_planes &201d 20 5e 1f JSR &1f5e ; update_explosions &2020 a0 06 LDY #&06 ; SPRITE_AIMING_SIGHT &2022 a9 80 LDA #&80 ; buffer and plot, use KK as mask &2024 85 78 STA &78 ; plotting_mode &2026 a9 31 LDA #&31 &2028 85 76 STA &76 ; sprite_x &202a a5 b3 LDA &b3 ; player_y &202c e9 03 SBC #&03 &202e 85 77 STA &77 ; sprite_y &2030 20 31 12 JSR &1231 ; plot_sprite # Plot aiming sight &2033 20 e2 1b JSR &1be2 ; update_projectiles &2036 4c e4 20 JMP &20e4 ; wait_for_clock ; is_scolling &2039 a9 00 LDA #&00 &203b 85 cd STA &cd ; vsync_occurred # Set to positive to indicate v-sync hasn't occurred ; wait_for_vsync &203d 24 cd BIT &cd ; vsync_occurred # Becomes negative when v-sync occurs &203f 10 fc BPL &203d ; wait_for_vsync &2041 a9 01 LDA #&01 &2043 85 c8 STA &c8 ; irq2_interrupt_occurred # Set to non-zero to indicate interrupt hasn't occurred &2045 a9 10 LDA #&10 &2047 8d 68 fe STA &fe68 ; User VIA timer 2 counter LSB &204a a9 20 LDA #&20 &204c 8d 69 fe STA &fe69 ; User VIA timer 2 counter MSB &204f 20 fe 18 JSR &18fe ; plot_landscape &2052 4c e0 20 JMP &20e0 ; wait_for_irq2_interrupt ; irq2_handler &2055 08 PHP &2056 48 PHA ; tmp_a &2057 ad 68 fe LDA &fe68 ; User VIA timer 2 counter LSB &205a 8e fe 05 STX &05fe ; tmp_x_for_irq2_handler &205d 8c ff 05 STY &05ff ; tmp_y_for_irq2_handler ; backup_variables &2060 a0 1b LDY #&1b ; backup_variables_loop &2062 b9 70 00 LDA &0070,Y ; variables # Backup &71 - &8b &2065 99 e0 05 STA &05e0,Y ; variables_backup - 1 &2068 88 DEY &2069 d0 f7 BNE &2062 ; backup_variables_loop &206b 20 a8 1a JSR &1aa8 ; scroll_screen &206e 20 d2 1a JSR &1ad2 ; plot_status &2071 20 89 1b JSR &1b89 ; unplot_projectiles &2074 a5 b2 LDA &b2 ; suppress_game_features_flags &2076 29 20 AND #&20 ; SUPPRESS_PLOTTING_PLAYER &2078 f0 0c BEQ &2086 ; replot_player ; suppress_replotting_player &207a 20 5b 1b JSR &1b5b ; replot_planes &207d 20 5e 1f JSR &1f5e ; update_explosions &2080 20 e2 1b JSR &1be2 ; update_projectiles &2083 4c c8 20 JMP &20c8 ; restore_variables ; replot_player &2086 a0 05 LDY #&05 ; SPRITE_PLAYER &2088 a9 c0 LDA #&c0 ; unplot &208a 85 78 STA &78 ; plotting_mode &208c 20 31 12 JSR &1231 ; plot_sprite # Unplot player &208f 20 5e 1f JSR &1f5e ; update_explosions &2092 a0 05 LDY #&05 ; SPRITE_PLAYER &2094 a9 14 LDA #&14 &2096 85 76 STA &76 ; sprite_x &2098 a5 b3 LDA &b3 ; player_y &209a 38 SEC &209b e9 05 SBC #&05 &209d 85 77 STA &77 ; sprite_y &209f a9 80 LDA #&80 ; buffer and plot, use KK as mask &20a1 85 78 STA &78 ; plotting_mode &20a3 20 31 12 JSR &1231 ; plot_sprite # Plot player &20a6 a0 06 LDY #&06 ; SPRITE_AIMING_SIGHT &20a8 a9 c0 LDA #&c0 ; unplot &20aa 85 78 STA &78 ; plotting_mode &20ac 20 31 12 JSR &1231 ; plot_sprite # Unplot aiming sight &20af 20 5b 1b JSR &1b5b ; replot_planes &20b2 a0 06 LDY #&06 ; SPRITE_AIMING_SIGHT &20b4 a9 80 LDA #&80 ; buffer and plot, use KK as mask &20b6 85 78 STA &78 ; plotting_mode &20b8 a9 31 LDA #&31 &20ba 85 76 STA &76 ; sprite_x &20bc a5 b3 LDA &b3 ; player_y &20be e9 03 SBC #&03 &20c0 85 77 STA &77 ; sprite_y &20c2 20 31 12 JSR &1231 ; plot_sprite # Plot aiming sight &20c5 20 e2 1b JSR &1be2 ; update_projectiles ; restore_variables &20c8 a0 1b LDY #&1b ; restore_variables_loop &20ca b9 e0 05 LDA &05e0,Y ; variables_backup - 1 &20cd 99 70 00 STA &0070,Y ; variables # Restore &71 - &8b &20d0 88 DEY &20d1 d0 f7 BNE &20ca ; restore_variables_loop &20d3 a9 00 LDA #&00 &20d5 85 c8 STA &c8 ; irq2_interrupt_occurred # Set to zero to indicate irq2 interrupt occurred &20d7 ae fe 05 LDX &05fe ; tmp_x_for_irq2_handler &20da ac ff 05 LDY &05ff ; tmp_y_for_irq2_handler &20dd 68 PLA ; tmp_a &20de 28 PLP &20df 40 RTI ; wait_for_irq2_interrupt &20e0 a5 c8 LDA &c8 ; irq2_interrupt_occurred # Becomes zero when irq2 interrupt has occurred &20e2 d0 fc BNE &20e0 ; wait_for_irq2_interrupt ; wait_for_clock &20e4 24 b2 BIT &b2 ; suppress_game_features_flags &20e6 70 10 BVS &20f8 ; leave # Leave if SUPPRESS_WAITING_FOR_CLOCK set (game over) &20e8 a9 01 LDA #&01 ; Read system clock &20ea a2 f9 LDX #&f9 ; &20f9 = read_clock_block &20ec a0 20 LDY #&20 &20ee 20 f1 ff JSR &fff1 ; OSWORD &20f1 ad f9 20 LDA &20f9 ; read_clock_block &20f4 c9 05 CMP #&05 &20f6 90 ec BCC &20e4 ; wait_for_clock # Set minimum update rate of 0.05s ; leave &20f8 60 RTS ; read_clock_block &20f9 00 00 00 00 00 ; add_feature # Called with X = feature type, Y = y &20fe 86 72 STX &72 ; feature_type &2100 84 73 STY &73 ; feature_y &2102 a2 00 LDX #&00 &2104 a0 00 LDY #&00 ; find_free_feature_slot_loop &2106 bd 78 07 LDA &0778,X ; features_type # Zero if no feature in slot &2109 f0 06 BEQ &2111 ; found_feature_slot &210b e8 INX &210c e0 0a CPX #&0a &210e d0 f6 BNE &2106 ; find_free_feature_slot_loop &2110 60 RTS ; found_feature_slot &2111 a5 72 LDA &72 ; feature_type &2113 9d 78 07 STA &0778,X ; features_type # Set to non-zero to indicate feature in slot &2116 a5 73 LDA &73 ; feature_y &2118 9d 82 07 STA &0782,X ; features_y ; find_free_enemy_slot_loop &211b b9 00 07 LDA &0700,Y ; enemies_state # Zero if no enemy in slot &211e f0 06 BEQ &2126 ; found_enemy_slot &2120 c8 INY &2121 c0 14 CPY #&14 &2123 d0 f6 BNE &211b ; find_free_enemy_slot_loop &2125 60 RTS ; found_enemy_slot &2126 a5 72 LDA &72 ; feature_type &2128 99 00 07 STA &0700,Y ; enemies_state # Set to non-zero to indicate enemy in slot &212b a9 50 LDA #&50 &212d 38 SEC &212e e5 ba SBC &ba ; x_scrolling &2130 0a ASL A &2131 99 14 07 STA &0714,Y ; enemies_x &2134 a5 73 LDA &73 ; feature_y &2136 99 28 07 STA &0728,Y ; enemies_y &2139 60 RTS ; check_for_keypresses &213a a2 04 LDX #&04 &213c 86 76 STX &76 ; key_offset ; check_for_movement_keypresses_loop &213e a6 76 LDX &76 ; key_offset &2140 bd bb 05 LDA &05bb,X ; movement_keys - 1 &2143 aa TAX &2144 a0 ff LDY #&ff &2146 a9 81 LDA #&81 ; Scan for a particular key &2148 20 f4 ff JSR &fff4 ; OSBYTE &214b 66 77 ROR &77 ; keys_pressed &214d c6 76 DEC &76 ; key_offset &214f d0 ed BNE &213e ; check_for_movement_keypresses_loop &2151 a5 77 LDA &77 ; keys_pressed &2153 49 80 EOR #&80 # &80 set if DELETE not pressed &2155 85 77 STA &77 ; keys_pressed &2157 a5 b9 LDA &b9 ; player_x_velocity &2159 06 77 ASL &77 ; keys_pressed # Set carry if DELETE not pressed &215b e9 00 SBC #&00 # i.e. subtract one if DELETE pressed &215d 06 77 ASL &77 ; keys_pressed # Set carry if COPY pressed &215f 69 00 ADC #&00 # i.e. add one if COPY pressed &2161 c9 10 CMP #&10 &2163 b0 02 BCS &2167 ; skip_floor &2165 a9 10 LDA #&10 # Minimum player x velocity ; skip_floor &2167 c9 21 CMP #&21 &2169 90 02 BCC &216d ; skip_ceiling &216b a9 20 LDA #&20 # Maximum player x velocity ; skip_ceiling &216d 85 b9 STA &b9 ; player_x_velocity &216f a5 ba LDA &ba ; x_scrolling &2171 f0 56 BEQ &21c9 ; skip_applying_y_velocity &2173 a5 77 LDA &77 ; keys_pressed # &80 set if A pressed, &40 set if Z pressed &2175 29 c0 AND #&c0 &2177 f0 04 BEQ &217d ; clear_y_velocity # Branch if neither A nor Z pressed &2179 49 c0 EOR #&c0 &217b d0 05 BNE &2182 ; consider_y_velocity ; clear_y_velocity &217d a9 00 LDA #&00 &217f 85 bd STA &bd ; player_y_velocity &2181 60 RTS ; consider_y_velocity &2182 a5 77 LDA &77 ; keys_pressed # &80 set if A pressed &2184 49 80 EOR #&80 # &80 set if A not pressed &2186 85 77 STA &77 ; keys_pressed &2188 06 77 ASL &77 ; keys_pressed # Set carry if A not pressed &218a a5 bd LDA &bd ; player_y_velocity &218c 69 00 ADC #&00 # i.e. add one if A not pressed &218e 06 77 ASL &77 ; keys_pressed # Clear carry if Z not pressed &2190 e9 00 SBC #&00 # i.e. subtract one if Z not pressed &2192 85 bd STA &bd ; player_y_velocity &2194 10 05 BPL &219b ; skip_inversion_for_absolute # Consider absolute value of player_y_velocity &2196 49 ff EOR #&ff &2198 18 CLC &2199 69 01 ADC #&01 ; skip_inversion_for_absolute &219b c9 05 CMP #&05 &219d 90 02 BCC &21a1 ; skip_ceiling &219f a9 04 LDA #&04 # Maximum absolute player y velocity ; skip_ceiling &21a1 aa TAX ; absolute_player_y_velocity &21a2 24 bd BIT &bd ; player_y_velocity &21a4 10 05 BPL &21ab ; skip_inversion_for_sign # Restore sign to value &21a6 49 ff EOR #&ff &21a8 18 CLC &21a9 69 01 ADC #&01 ; skip_inversion_for_sign &21ab 85 bd STA &bd ; player_y_velocity &21ad 8a TXA ; absolute_player_y_velocity &21ae 4a LSR A &21af 24 bd BIT &bd ; player_y_velocity &21b1 10 05 BPL &21b8 ; skip_inversion_for_applying_velocity &21b3 49 ff EOR #&ff &21b5 18 CLC &21b6 69 01 ADC #&01 ; skip_inversion_for_applying_velocity &21b8 18 CLC &21b9 65 b3 ADC &b3 ; player_y # Apply y velocity &21bb c9 0d CMP #&0d &21bd b0 02 BCS &21c1 ; not_at_top_edge_of_screen &21bf a9 0d LDA #&0d ; not_at_top_edge_of_screen &21c1 c9 f4 CMP #&f4 &21c3 90 02 BCC &21c7 ; not_at_bottom_edge_of_screen &21c5 a9 f3 LDA #&f3 ; not_at_bottom_edge_of_screen &21c7 85 b3 STA &b3 ; player_y ; skip_applying_y_velocity &21c9 24 bd BIT &bd ; player_y_velocity &21cb 30 03 BMI &21d0 ; leave &21cd 20 00 12 JSR &1200 ; rnd ; leave &21d0 60 RTS ; reset_clock_and_consider_checking_for_player_firing &21d1 a2 dd LDX #&dd ; &21dd = write_clock_block &21d3 a0 21 LDY #&21 &21d5 a9 02 LDA #&02 ; Write system clock &21d7 20 f1 ff JSR &fff1 ; OSWORD &21da 4c e2 21 JMP &21e2 ; consider_checking_for_player_firing ; write_clock_block &21dd 00 00 00 00 00 ; consider_checking_for_player_firing &21e2 a5 b2 LDA &b2 ; suppress_game_features_flags &21e4 29 10 AND #&10 ; SUPPRESS_PLAYER_FIRING &21e6 f0 03 BEQ &21eb ; check_for_player_firing &21e8 4c 99 22 JMP &2299 ; skip_adding_projectile ; check_for_player_firing &21eb c6 b4 DEC &b4 ; firing_cooldown &21ed 10 04 BPL &21f3 ; skip_floor &21ef a9 00 LDA #&00 &21f1 85 b4 STA &b4 ; firing_cooldown ; skip_floor &21f3 a2 03 LDX #&03 &21f5 86 76 STX &76 ; key_offset ; check_for_firing_keypresses_loop &21f7 a6 76 LDX &76 ; key_offset &21f9 bd bf 05 LDA &05bf,X ; firing_keys- 1 &21fc aa TAX &21fd a0 ff LDY #&ff &21ff a9 81 LDA #&81 ; Scan for a particular key &2201 20 f4 ff JSR &fff4 ; OSBYTE &2204 66 77 ROR &77 ; keys_pressed &2206 c6 76 DEC &76 ; key_offset &2208 d0 ed BNE &21f7 ; check_for_firing_keypresses_loop &220a f8 SED &220b 06 77 ASL &77 ; keys_pressed &220d 90 21 BCC &2230 ; return_not_pressed ; return_pressed # If RETURN pressed, &220f a5 b5 LDA &b5 ; player_shots_low &2211 05 b6 ORA &b6 ; player_shots_high &2213 d0 07 BNE &221c ; add_surface_projectile # Is the player out of shots? &2215 d8 CLD &2216 20 a2 16 JSR &16a2 ; play_sound_for_empty # If so, play empty sound &2219 4c 99 22 JMP &2299 ; skip_adding_projectile ; add_surface_projectile # Otherwise add surface projectile &221c a5 b5 LDA &b5 ; player_shots_low &221e e9 01 SBC #&01 &2220 85 b5 STA &b5 ; player_shots_low &2222 a5 b6 LDA &b6 ; player_shots_high &2224 e9 00 SBC #&00 &2226 85 b6 STA &b6 ; player_shots_high &2228 d8 CLD &2229 20 41 16 JSR &1641 ; play_sound_for_firing &222c a9 c0 LDA #&c0 ; surface fire &222e d0 46 BNE &2276 ; add_projectile # Always branches ; return_not_pressed &2230 06 77 ASL &77 ; keys_pressed &2232 90 21 BCC &2255 ; shift_not_pressed ; shift_pressed # If SHIFT pressed, &2234 a5 b5 LDA &b5 ; player_shots_low &2236 05 b6 ORA &b6 ; player_shots_high &2238 d0 07 BNE &2241 ; add_air_projectile # Is the player out of shots? &223a d8 CLD &223b 20 a2 16 JSR &16a2 ; play_sound_for_empty # If so, play empty sound &223e 4c 99 22 JMP &2299 ; skip_adding_projectile ; add_air_projectile # Otherwise, add air projectile &2241 a5 b5 LDA &b5 ; player_shots_low &2243 e9 01 SBC #&01 &2245 85 b5 STA &b5 ; player_shots_low &2247 a5 b6 LDA &b6 ; player_shots_high &2249 e9 00 SBC #&00 &224b 85 b6 STA &b6 ; player_shots_high &224d d8 CLD &224e 20 41 16 JSR &1641 ; play_sound_for_firing &2251 a9 40 LDA #&40 ; air fire &2253 d0 21 BNE &2276 ; add_projectile # Always branches ; shift_not_pressed &2255 06 77 ASL &77 ; keys_pressed &2257 90 3f BCC &2298 ; tab_not_pressed ; tab_pressed # If TAB pressed, &2259 a5 b4 LDA &b4 ; firing_cooldown &225b d0 3b BNE &2298 ; tab_not_pressed # and the player hasn't recently fired a missile &225d a5 b7 LDA &b7 ; player_missiles &225f d0 07 BNE &2268 ; add_missile # Is the player out of missiles? &2261 d8 CLD &2262 20 a2 16 JSR &16a2 ; play_sound_for_empty # If so, play empty sound &2265 4c 99 22 JMP &2299 ; skip_adding_projectile ; add_missile # Otherwise, add missile &2268 e9 01 SBC #&01 &226a 85 b7 STA &b7 ; player_missiles &226c d8 CLD &226d 20 5b 16 JSR &165b ; play_sound_for_missile &2270 a9 04 LDA #&04 &2272 85 b4 STA &b4 ; firing_cooldown &2274 a9 80 LDA #&80 ; missile ; add_projectile &2276 a8 TAY &2277 a2 00 LDX #&00 ; find_free_player_projectile_slot_loop &2279 bd a0 06 LDA &06a0,X ; player_projectiles_state # Zero if no projectile in slot &227c f0 07 BEQ &2285 ; found_free_player_projectile_slot &227e e8 INX &227f e0 0c CPX #&0c &2281 d0 f6 BNE &2279 ; find_free_player_projectile_slot_loop &2283 f0 14 BEQ &2299 ; skip_adding_projectile # Always branches ; found_free_player_projectile_slot &2285 98 TYA &2286 9d a0 06 STA &06a0,X ; player_projectiles_state # Set to non-zero to indicate projectile in slot &2289 a9 32 LDA #&32 &228b 9d ac 06 STA &06ac,X ; player_projectiles_x &228e a9 19 LDA #&19 &2290 9d b8 06 STA &06b8,X ; player_projectiles_screen_x &2293 a5 b3 LDA &b3 ; player_y &2295 9d c4 06 STA &06c4,X ; player_projectiles_y ; tab_not_pressed &2298 d8 CLD ; skip_adding_projectile ; check_for_player_collision_with_rock &2299 a2 00 LDX #&00 # Set to zero to indicate no overlap with rock &229b a0 37 LDY #&37 ; check_for_player_collision_with_rock_loop &229d b9 58 0a LDA &0a58,Y ; sprite_05_buffer (SPRITE_PLAYER) &22a0 c9 5c CMP #&5c ; Gr &22a2 d0 01 BNE &22a5 ; not_rock &22a4 e8 INX # Increment to indicate overlap with rock ; not_rock &22a5 88 DEY &22a6 d0 f5 BNE &229d ; check_for_player_collision_with_rock_loop &22a8 e0 05 CPX #&05 &22aa 90 04 BCC &22b0 ; check_for_player_collision_with_planes ; collision_between_player_and_rock # Kill player if too much overlap with rock &22ac a9 99 LDA #&99 &22ae 85 bf STA &bf ; player_damage # Set to &99 to kill player (colliding with rock) ; check_for_player_collision_with_planes &22b0 a2 01 LDX #&01 ; check_for_player_collision_with_planes_loop &22b2 bd cb 05 LDA &05cb,X ; planes_state - 1 # Non-zero if plane in slot &22b5 d0 08 BNE &22bf ; check_for_player_collision_with_plane ; consider_next_plane_for_player_collision &22b7 e8 INX &22b8 e0 05 CPX #&05 &22ba d0 f6 BNE &22b2 ; check_for_player_collision_with_planes_loop &22bc 4c c8 23 JMP &23c8 ; consider_summoning_sister_plane ; check_for_player_collision_with_plane &22bf bd cf 05 LDA &05cf,X ; planes_x - 1 # Use plane as source &22c2 4a LSR A &22c3 85 80 STA &80 ; source_min_x &22c5 18 CLC &22c6 7d ff 03 ADC &03ff,X ; sprite_widths_table &22c9 85 82 STA &82 ; source_max_x &22cb bd d3 05 LDA &05d3,X ; planes_y - 1 &22ce 85 81 STA &81 ; source_min_y &22d0 18 CLC &22d1 7d 13 04 ADC &0413,X ; sprite_heights_table - 1 &22d4 85 83 STA &83 ; source_max_y &22d6 a9 14 LDA #&14 # Use player as target &22d8 85 84 STA &84 ; target_min_x &22da a9 19 LDA #&19 &22dc 85 86 STA &86 ; target_max_x &22de a5 b3 LDA &b3 ; player_y &22e0 38 SEC &22e1 e9 05 SBC #&05 &22e3 85 85 STA &85 ; target_min_y &22e5 18 CLC &22e6 69 0b ADC #&0b &22e8 85 87 STA &87 ; target_max_y &22ea 86 76 STX &76 ; plane_slot &22ec a5 b2 LDA &b2 ; suppress_game_features_flags &22ee 29 20 AND #&20 ; SUPPRESS_PLOTTING_PLAYER &22f0 d0 08 BNE &22fa ; consider_next_plane_for_plane_collisions &22f2 a2 00 LDX #&00 # Set collision_type to zero to indicate player &22f4 f0 25 BEQ &231b ; check_for_collision_with_plane # Always branches ; to_consider_next_plane_for_player_collision &22f6 a6 76 LDX &76 ; plane_slot &22f8 d0 bd BNE &22b7 ; consider_next_plane_for_player_collision # Always branches ; consider_next_plane_for_plane_collisions &22fa e8 INX &22fb e0 05 CPX #&05 &22fd f0 f7 BEQ &22f6 ; to_consider_next_plane_for_player_collision &22ff bd cb 05 LDA &05cb,X ; planes_state - 1 # Non-zero if plane in slot &2302 f0 f6 BEQ &22fa ; consider_next_plane_for_plane_collisions &2304 bd cf 05 LDA &05cf,X ; planes_x - 1 # Use plane as target &2307 4a LSR A &2308 85 84 STA &84 ; target_min_x &230a 18 CLC &230b 7d ff 03 ADC &03ff,X ; sprite_widths_table - 1 &230e 85 86 STA &86 ; target_max_x &2310 bd d3 05 LDA &05d3,X ; planes_y - 1 &2313 85 85 STA &85 ; target_min_y &2315 18 CLC &2316 7d 13 04 ADC &0413,X ; sprite_heights_table - 1 &2319 85 87 STA &87 ; target_max_y ; check_for_collision_with_plane ; check_left_edge_of_source &231b a5 80 LDA &80 ; source_min_x &231d c5 84 CMP &84 ; target_min_x &231f 90 04 BCC &2325 ; check_right_edge_of_source &2321 c5 86 CMP &86 ; target_max_x &2323 90 1e BCC &2343 ; check_top_edge_of_source ; check_right_edge_of_source &2325 a5 82 LDA &82 ; source_max_x &2327 c5 84 CMP &84 ; target_min_x &2329 90 04 BCC &232f ; check_left_edge_of_target &232b c5 86 CMP &86 ; target_max_x &232d 90 14 BCC &2343 ; check_top_edge_of_source ; check_left_edge_of_target &232f a5 84 LDA &84 ; target_min_x &2331 c5 80 CMP &80 ; source_min_x &2333 90 04 BCC &2339 ; check_right_edge_of_target &2335 c5 82 CMP &82 ; source_max_x &2337 90 0a BCC &2343 ; check_top_edge_of_source ; check_right_edge_of_target &2339 a5 86 LDA &86 ; target_max_x &233b c5 80 CMP &80 ; source_min_x &233d 90 7d BCC &23bc ; no_collision_between_source_and_target &233f c5 82 CMP &82 ; source_max_x &2341 b0 79 BCS &23bc ; no_collision_between_source_and_target ; check_top_edge_of_source &2343 a5 81 LDA &81 ; source_min_y &2345 c5 85 CMP &85 ; target_min_y &2347 90 04 BCC &234d ; check_bottom_edge_of_source &2349 c5 87 CMP &87 ; target_max_y &234b 90 1e BCC &236b ; collision_between_source_and_target ; check_bottom_edge_of_source &234d a5 83 LDA &83 ; source_max_y &234f c5 85 CMP &85 ; target_min_y &2351 90 04 BCC &2357 ; check_top_edge_of_target &2353 c5 87 CMP &87 ; target_max_y &2355 90 14 BCC &236b ; collision_between_source_and_target ; check_top_edge_of_target &2357 a5 85 LDA &85 ; target_min_y &2359 c5 81 CMP &81 ; source_min_y &235b 90 04 BCC &2361 ; check_bottom_edge_of_target &235d c5 83 CMP &83 ; source_max_y &235f 90 0a BCC &236b ; collision_between_source_and_target ; check_bottom_edge_of_target &2361 a5 87 LDA &87 ; target_max_y &2363 c5 81 CMP &81 ; source_min_y &2365 90 55 BCC &23bc ; no_collision_between_source_and_target &2367 c5 83 CMP &83 ; source_max_y &2369 b0 51 BCS &23bc ; no_collision_between_source_and_target ; collision_between_source_and_target &236b 86 77 STX &77 ; collision_source &236d a6 76 LDX &76 ; plane_slot &236f a9 ff LDA #&ff &2371 9d cb 05 STA &05cb,X ; planes_state - 1 # Set to &ff to indicate explosion pending &2374 a6 77 LDX &77 ; collision_source # Zero if player, non-zero if plane &2376 d0 3e BNE &23b6 ; collision_between_plane_and_plane ; collision_between_plane_and_player &2378 a2 04 LDX #&04 &237a e4 76 CPX &76 ; plane_slot &237c d0 32 BNE &23b0 ; destroy_player # Did the player hit the sister plane? ; check_for_collision_between_player_and_sister_plane &237e a5 81 LDA &81 ; source_min_y &2380 18 CLC &2381 69 02 ADC #&02 # Require closer collision for refuelling &2383 c5 b3 CMP &b3 ; player_y &2385 b0 3c BCS &23c3 ; to_consider_next_plane_for_plane_collisions &2387 69 07 ADC #&07 &2389 c5 b3 CMP &b3 ; player_y &238b 90 36 BCC &23c3 ; to_consider_next_plane_for_plane_collisions &238d a5 b9 LDA &b9 ; player_x_velocity &238f c9 11 CMP #&11 # Player must be slow to dock &2391 b0 30 BCS &23c3 ; to_consider_next_plane_for_plane_collisions ; collision_between_player_and_sister_plane &2393 a9 00 LDA #&00 &2395 9d cb 05 STA &05cb,X ; planes_state - 1 # Set to zero to remove sister plane &2398 20 da 16 JSR &16da ; play_sound_for_sister_plane # Play sound for docking &239b a2 00 LDX #&00 ; restore_fuel_and_weapons_loop &239d bd c0 11 LDA &11c0,X ; initial_variables_for_game &23a0 8d a8 23 STA &23a8 ; variable_address &23a3 e8 INX &23a4 bd c0 11 LDA &11c0,X ; initial_variables_for_game &23a7 85 ff STA &ff # actually STA variable_address # Reset fuel and weapons to initial values &23a9 e8 INX &23aa e0 10 CPX #&10 &23ac d0 ef BNE &239d ; restore_fuel_and_weapons_loop &23ae f0 13 BEQ &23c3 ; to_consider_next_plane_for_plane_collisions # Always branches ; destroy_player &23b0 a9 99 LDA #&99 &23b2 85 bf STA &bf ; player_damage # Set to &99 to kill player (colliding with enemy plane) &23b4 d0 0d BNE &23c3 ; to_consider_next_plane_for_plane_collisions # Always branches ; collision_between_plane_and_plane &23b6 9d cb 05 STA &05cb,X ; planes_state - 1 # Set to &ff to indicate explosion pending &23b9 4c fa 22 JMP &22fa ; consider_next_plane_for_plane_collisions ; no_collision_between_source_and_target &23bc e0 00 CPX #&00 &23be f0 03 BEQ &23c3 ; use_source_plane_and_consider_next_plane_for_plane_collisions &23c0 4c fa 22 JMP &22fa ; consider_next_plane_for_plane_collisions ; use_source_plane_and_consider_next_plane_for_plane_collisions &23c3 a6 76 LDX &76 ; plane_slot # Source plane, set at &22ea &23c5 4c fa 22 JMP &22fa ; consider_next_plane_for_plane_collisions ; consider_summoning_sister_plane &23c8 a6 50 LDX &50 ; ten_thousands_required_for_sister_plane &23ca d0 1e BNE &23ea ; skip_summoning_sister_plane &23cc ca DEX ; &ff &23cd 86 be STX &be ; sister_plane_present # Set to negative to summon sister plane &23cf 20 da 16 JSR &16da ; play_sound_for_sister_plane # Play sound for appearance &23d2 a5 c2 LDA &c2 ; score + 2 &23d4 4a LSR A &23d5 4a LSR A &23d6 4a LSR A &23d7 4a LSR A &23d8 aa TAX &23d9 bd e0 23 LDA &23e0,X ; ten_thousands_required_for_sister_plane_table &23dc 85 50 STA &50 ; ten_thousands_required_for_sister_plane &23de d0 0a BNE &23ea ; skip_summoning_sister_plane # Always branches ; ten_thousands_required_for_sister_plane_table ; 0 1 2 3 4 5 6 7 8 9 x100,000 &23e0 01 02 02 02 02 02 05 05 05 05 x10,000 ; skip_summoning_sister_plane &23ea 24 be BIT &be ; sister_plane_present # Negative if sister plane present &23ec 10 05 BPL &23f3 ; skip_setting_firing_cooldown &23ee a9 ff LDA #&ff # Prevent sister plane firing &23f0 8d db 05 STA &05db ; planes_firing_cooldown - 1 + 4 (PLANE_TYPE_SISTER) ; skip_setting_firing_cooldown &23f3 a9 00 LDA #&00 # No vertical movement by default &23f5 8d 10 05 STA &0510 ; planes_y_velocity_minus - 1 + 3 (PLANE_TYPE_RIGHT) &23f8 8d 14 05 STA &0514 ; planes_y_velocity_plus - 1 + 3 (PLANE_TYPE_RIGHT) &23fb 8d 11 05 STA &0511 ; planes_y_velocity_minus - 1 + 4 (PLANE_TYPE_SISTER) &23fe 8d 15 05 STA &0515 ; planes_y_velocity_plus - 1 + 4 (PLANE_TYPE_SISTER) &2401 a5 75 LDA &75 ; landscape_bottom_rock_start &2403 e5 74 SBC &74 ; landscape_top_rock_end # Right plane and sister plane start in centre of canyon &2405 4a LSR A &2406 65 74 ADC &74 ; landscape_top_rock_end &2408 8d 08 05 STA &0508 ; planes_initial_y - 1 + 3 (PLANE_TYPE_RIGHT) &240b 8d 09 05 STA &0509 ; planes_initial_y - 1 + 4 (PLANE_TYPE_SISTER) &240e cd d6 05 CMP &05d6 ; planes_y - 1 + 3 (PLANE_TYPE_RIGHT) &2411 b0 05 BCS &2418 ; move_right_plane_down # Right plane follows centre of canyon ; move_right_plane_up &2413 ee 10 05 INC &0510 ; planes_y_velocity_minus - 1 + 3 (PLANE_TYPE_RIGHT) &2416 d0 03 BNE &241b ; not_moving_right_plane_down # Always branches ; move_right_plane_down &2418 ee 14 05 INC &0514 ; planes_y_velocity_plus - 1 + 3 (PLANE_TYPE_RIGHT) ; not_moving_right_plane_down &241b a5 b3 LDA &b3 ; player_y &241d 38 SEC &241e e9 05 SBC #&05 &2420 cd d7 05 CMP &05d7 ; planes_y - 1 + 4 (PLANE_TYPE_SISTER) &2423 f0 0a BEQ &242f ; not_moving_sister_plane_down # Sister plane moves towards player vertically &2425 b0 05 BCS &242c ; move_sister_plane_down ; move_sister_plane_up &2427 ee 11 05 INC &0511 ; planes_y_velocity_minus - 1 + 4 (PLANE_TYPE_SISTER) &242a d0 03 BNE &242f ; not_moving_sister_plane_down # Always branches ; move_sister_plane_down &242c ee 15 05 INC &0515 ; planes_y_velocity_plus - 1 + 4 (PLANE_TYPE_SISTER) ; not_moving_sister_plane_down &242f 24 b2 BIT &b2 ; suppress_game_features_flags &2431 70 7c BVS &24af ; skip_adding_planes # Branch if SUPPRESS_WAITING_FOR_CLOCK set (game over) &2433 a9 80 LDA #&80 ; buffer and plot, use KK as mask &2435 85 78 STA &78 ; plotting_mode ; consider_adding_planes &2437 a2 01 LDX #&01 ; consider_adding_planes_loop &2439 bd cb 05 LDA &05cb,X ; planes_state - 1 # Zero if no plane in slot &243c f0 07 BEQ &2445 ; consider_adding_plane ; consider_next_plane &243e e8 INX &243f e0 05 CPX #&05 &2441 d0 f6 BNE &2439 ; consider_adding_planes_loop &2443 f0 6a BEQ &24af ; skip_adding_planes # Always branches ; consider_adding_plane &2445 86 86 STX &86 ; plane_slot &2447 a5 b1 LDA &b1 ; player_world_x_high &2449 dd 83 04 CMP &0483,X ; minimum_world_x_high_for_planes_table - 1 &244c 90 f0 BCC &243e ; consider_next_plane &244e e0 04 CPX #&04 &2450 d0 20 BNE &2472 ; is_enemy_plane ; is_sister_plane &2452 24 be BIT &be ; sister_plane_present # Negative if sister plane present &2454 10 e8 BPL &243e ; consider_next_plane ; update_sister_plane &2456 a5 51 LDA &51 ; sister_plane_x &2458 38 SEC &2459 e5 ba SBC &ba ; x_scrolling # Move sister plane left &245b 85 51 STA &51 ; sister_plane_x &245d b0 df BCS &243e ; consider_next_plane # If off-screen, set delay before sister plane reappears &245f 20 00 12 JSR &1200 ; rnd &2462 29 1f AND #&1f # Random delay &2464 69 28 ADC #&28 # Fixed delay &2466 65 b1 ADC &b1 ; player_world_x_high # More delay later in game &2468 90 02 BCC &246c ; skip_ceiling &246a a9 ff LDA #&ff ; skip_ceiling &246c 85 51 STA &51 ; sister_plane_x &246e a6 86 LDX &86 ; plane_slot &2470 d0 12 BNE &2484 ; add_plane # Always branches ; is_enemy_plane &2472 20 00 12 JSR &1200 ; rnd &2475 a6 86 LDX &86 ; plane_slot &2477 c5 b1 CMP &b1 ; player_world_x_high # Enemy planes more likely to appear later in game &2479 b0 c3 BCS &243e ; consider_next_plane &247b 20 00 12 JSR &1200 ; rnd &247e a6 86 LDX &86 ; plane_slot &2480 29 3f AND #&3f &2482 d0 ba BNE &243e ; consider_next_plane ; add_plane &2484 a9 01 LDA #&01 &2486 9d cb 05 STA &05cb,X ; planes_state - 1 # Set to non-zero to indicate plane in slot &2489 a5 b9 LDA &b9 ; player_x_velocity &248b 4a LSR A &248c 4a LSR A &248d 4a LSR A &248e 18 CLC &248f 7d 09 05 ADC &0509,X ; planes_initial_x_velocity - 1 &2492 9d db 05 STA &05db,X ; planes_x_velocity - 1 &2495 bd 01 05 LDA &0501,X ; planes_initial_x - 1 &2498 9d cf 05 STA &05cf,X ; planes_x - 1 &249b 4a LSR A &249c 85 76 STA &76 ; sprite_x &249e bd 05 05 LDA &0505,X ; planes_initial_y - 1 &24a1 9d d3 05 STA &05d3,X ; planes_y - 1 &24a4 85 77 STA &77 ; sprite_y &24a6 a4 86 LDY &86 ; plane_slot &24a8 20 31 12 JSR &1231 ; plot_sprite # Plot new plane &24ab a6 86 LDX &86 ; plane_slot &24ad d0 8f BNE &243e ; consider_next_plane # Always branches ; skip_adding_planes &24af a9 c0 LDA #&c0 ; unplot &24b1 85 78 STA &78 ; plotting_mode &24b3 a5 ba LDA &ba ; x_scrolling &24b5 0a ASL A &24b6 8d 1d 25 STA &251d ; x_scrolling_times_two ; update_planes &24b9 a2 01 LDX #&01 ; update_planes_loop &24bb bd cb 05 LDA &05cb,X ; planes_state - 1 # Non-zero if plane in slot &24be 30 0a BMI &24ca ; explode_plane # Negative if explosion pending &24c0 d0 52 BNE &2514 ; update_plane ; consider_next_plane &24c2 e8 INX &24c3 e0 05 CPX #&05 &24c5 d0 f4 BNE &24bb ; update_planes_loop &24c7 4c af 25 JMP &25af ; check_tape_block_spare_bytes ; explode_plane &24ca a0 00 LDY #&00 ; find_free_explosion_slot_loop &24cc b9 00 07 LDA &0700,Y ; enemies_state &24cf f0 07 BEQ &24d8 ; found_free_explosion_slot &24d1 c8 INY &24d2 c0 14 CPY #&14 &24d4 d0 f6 BNE &24cc ; find_free_explosion_slot_loop &24d6 f0 ea BEQ &24c2 ; consider_next_plane # Always branches ; found_free_explosion_slot &24d8 a9 b0 LDA #&b0 ; ENEMY_STATE_EXPLODING | (SPRITE_EXPLOSION_THREE - SPRITE_EXPLOSION_ZERO) * &10 &24da 99 00 07 STA &0700,Y ; enemies_state # Set to negative to indicate exploding &24dd 18 CLC &24de bd cf 05 LDA &05cf,X ; planes_x - 1 &24e1 69 04 ADC #&04 &24e3 99 14 07 STA &0714,Y ; enemies_x &24e6 18 CLC &24e7 bd d3 05 LDA &05d3,X ; planes_y - 1 &24ea 69 04 ADC #&04 &24ec 99 28 07 STA &0728,Y ; enemies_y &24ef f8 SED &24f0 18 CLC &24f1 a5 c0 LDA &c0 ; score &24f3 7d 67 04 ADC &0467,X ; planes_scoring_low_table - 1 # Score for destroying plane &24f6 85 c0 STA &c0 ; score &24f8 a5 c1 LDA &c1 ; score + 1 &24fa 7d 6b 04 ADC &046b,X ; planes_scoring_high_table - 1 &24fd 85 c1 STA &c1 ; score + 1 &24ff 90 08 BCC &2509 ; skip_overflow &2501 c6 50 DEC &50 ; ten_thousands_required_for_sister_plane &2503 a5 c2 LDA &c2 ; score + 2 &2505 69 00 ADC #&00 &2507 85 c2 STA &c2 ; score + 2 ; skip_overflow &2509 d8 CLD &250a 86 86 STX &86 ; plane_slot &250c 20 90 16 JSR &1690 ; play_sound_for_explosion &250f a6 86 LDX &86 ; plane_slot &2511 4c 4a 25 JMP &254a ; remove_plane ; update_plane &2514 86 86 STX &86 ; plane_slot &2516 bd cf 05 LDA &05cf,X ; planes_x - 1 &2519 85 76 STA &76 ; sprite_x &251b 38 SEC &251c e9 ff SBC #&ff # actually SBC x_scrolling_times_two &251e 90 2a BCC &254a ; remove_plane # Remove plane at left of screen &2520 18 CLC &2521 7d db 05 ADC &05db,X ; planes_x_velocity - 1 &2524 c9 08 CMP #&08 &2526 90 22 BCC &254a ; remove_plane &2528 c9 90 CMP #&90 &252a b0 1e BCS &254a ; remove_plane &252c 9d cf 05 STA &05cf,X ; planes_x - 1 &252f bd d3 05 LDA &05d3,X ; planes_y - 1 &2532 85 77 STA &77 ; sprite_y &2534 18 CLC &2535 7d 11 05 ADC &0511,X ; planes_y_velocity_plus - 1 &2538 38 SEC &2539 fd 0d 05 SBC &050d,X ; planes_y_velocity_minus - 1 &253c c9 08 CMP #&08 &253e 90 0a BCC &254a ; remove_plane # Remove plane at top of screen &2540 c9 f6 CMP #&f6 &2542 b0 06 BCS &254a ; remove_plane # Remove plane at bottom of screen &2544 9d d3 05 STA &05d3,X ; planes_y - 1 &2547 4c 63 25 JMP &2563 ; skip_removing_plane ; remove_plane &254a a5 ba LDA &ba ; x_scrolling &254c 85 8b STA &8b ; previous_x_scrolling &254e a9 00 LDA #&00 &2550 9d cb 05 STA &05cb,X ; planes_state - 1 # Set to zero to indicate no plane in slot &2553 85 ba STA &ba ; x_scrolling # Set to zero temporarily to use previous position &2555 a4 86 LDY &86 ; plane_slot &2557 20 31 12 JSR &1231 ; plot_sprite &255a a5 8b LDA &8b ; previous_x_scrolling &255c 85 ba STA &ba ; x_scrolling &255e a6 86 LDX &86 ; plane_slot &2560 4c c2 24 JMP &24c2 ; consider_next_plane ; skip_removing_plane &2563 bd d7 05 LDA &05d7,X ; planes_firing_cooldown - 1 &2566 38 SEC &2567 e9 01 SBC #&01 &2569 b0 02 BCS &256d ; skip_resetting_cooldown &256b a9 02 LDA #&02 ; skip_resetting_cooldown &256d 9d d7 05 STA &05d7,X ; planes_firing_cooldown - 1 &2570 b0 38 BCS &25aa ; skip_firing &2572 24 b2 BIT &b2 ; suppress_game_features_flags &2574 30 34 BMI &25aa ; skip_firing # Branch if SUPPRESS_ENEMY_FIRING set &2576 20 00 12 JSR &1200 ; rnd &2579 29 01 AND #&01 &257b d0 2d BNE &25aa ; skip_firing # 1 in 2 chance of enemy plane firing &257d a0 00 LDY #&00 ; find_free_enemy_projectile_slot_loop &257f b9 00 06 LDA &0600,Y ; enemy_projectiles_state &2582 f0 07 BEQ &258b ; found_free_enemy_projectile_slot &2584 c8 INY &2585 c0 0a CPY #&0a &2587 d0 f6 BNE &257f ; find_free_enemy_projectile_slot_loop &2589 f0 1f BEQ &25aa ; skip_firing # Always branches ; found_free_enemy_projectile_slot &258b a9 7f LDA #&7f &258d 99 00 06 STA &0600,Y ; enemy_projectiles_state # Set to positive non-zero to indicate regular projectile &2590 a6 86 LDX &86 ; plane_slot &2592 bd 15 05 LDA &0515,X ; planes_projectile_angle - 1 &2595 99 0a 06 STA &060a,Y ; enemy_projectiles_angle &2598 bd 18 05 LDA &0518,X ; planes_projectile_x_offset - 1 &259b 18 CLC &259c 65 76 ADC &76 ; sprite_x &259e 99 14 06 STA &0614,Y ; enemy_projectiles_x &25a1 bd 1b 05 LDA &051b,X ; planes_projectile_y_offset - 1 &25a4 18 CLC &25a5 65 77 ADC &77 ; sprite_y &25a7 99 1e 06 STA &061e,Y ; enemy_projectiles_y ; skip_firing &25aa a6 86 LDX &86 ; plane_slot &25ac 4c c2 24 JMP &24c2 ; consider_next_plane ; check_tape_block_spare_bytes &25af a2 00 LDX #&00 ; check_tape_block_spare_bytes_loop &25b1 bd cb 03 LDA &03cb,X ; tape_block_spare_bytes &25b4 dd c3 25 CMP &25c3,X ; expected_tape_block_spare_bytes &25b7 d0 07 BNE &25c0 ; to_os_reset_handler # Reset system if last tape block wasn't as expected &25b9 e8 INX &25ba e0 04 CPX #&04 &25bc d0 f3 BNE &25b1 ; check_tape_block_spare_bytes_loop &25be f0 07 BEQ &25c7 ; update_landscape # Always branches ; to_os_reset_handler &25c0 20 cd d9 JSR &d9cd ; os_reset_handler ; expected_tape_block_spare_bytes &25c3 44 44 48 2e ; "DDH." ; update_landscape &25c7 18 CLC &25c8 a5 b0 LDA &b0 ; player_world_x &25c9 65 ba ADC &ba ; x_scrolling &25cc 85 b0 STA &b0 ; player_world_x &25ce 90 0e BCC &25de ; skip_overflow &25d0 e6 b1 INC &b1 ; player_world_x_high &25d2 c6 c6 DEC &c6 ; minimum_canyon_width &25d4 a5 c6 LDA &c6 ; minimum_canyon_width &25d6 c9 28 CMP #&28 &25d8 d0 04 BNE &25de ; skip_wraparound &25da a9 3c LDA #&3c &25dc 85 c6 STA &c6 ; minimum_canyon_width ; skip_wraparound &25de a5 c7 LDA &c7 ; canyon_update_cooldown &25e0 38 SEC &25e1 e5 ba SBC &ba ; x_scrolling &25e3 b0 02 BCS &25e7 ; skip_resetting_canyon_update_cooldown &25e5 a9 01 LDA #&01 ; skip_resetting_canyon_update_cooldown &25e7 85 c7 STA &c7 ; canyon_update_cooldown &25e9 90 03 BCC &25ee ; widen_or_narrow_rock &25eb 4c a6 26 JMP &26a6 ; skip_updating_canyon ; widen_or_narrow_rock &25ee 20 00 12 JSR &1200 ; rnd &25f1 0a ASL A &25f2 90 06 BCC &25fa ; widen_rock ; narrow_rock &25f4 e6 74 INC &74 ; landscape_top_rock_end &25f6 c6 75 DEC &75 ; landscape_bottom_rock_start &25f8 d0 08 BNE &2602 ; widen_or_narrow_grass # Always branches ; widen_rock &25fa c6 74 DEC &74 ; landscape_top_rock_end &25fc c6 74 DEC &74 ; landscape_top_rock_end &25fe e6 75 INC &75 ; landscape_bottom_rock_start &2600 e6 75 INC &75 ; landscape_bottom_rock_start ; widen_or_narrow_grass &2602 0a ASL A &2603 90 06 BCC &260b ; widen_grass ; narrow_grass &2605 e6 8c INC &8c ; landscape_top_grass_end &2607 c6 8d DEC &8d ; landscape_bottom_grass_start &2609 d0 04 BNE &260f ; consider_changing_canyon_slope # Always branches ; widen_grass &260b c6 8c DEC &8c ; landscape_top_grass_end &260d e6 8d INC &8d ; landscape_bottom_grass_start ; consider_changing_canyon_slope &260f c6 8e DEC &8e ; canyon_slope_change_cooldown &2611 d0 29 BNE &263c ; skip_changing_canyon_slope &2613 a2 01 LDX #&01 &2615 86 8e STX &8e ; canyon_slope_change_cooldown &2617 ca DEX &2618 86 8f STX &8f ; canyon_slope &261a 20 00 12 JSR &1200 ; rnd &261d 29 07 AND #&07 &261f d0 1b BNE &263c ; skip_changing_canyon_slope &2621 20 00 12 JSR &1200 ; rnd &2624 18 CLC &2625 10 06 BPL &262d ; slope_downwards ; slope_upwards &2627 29 01 AND #&01 &2629 69 fe ADC #&fe &262b d0 04 BNE &2631 ; slope_downwards # Always branches ; slope_downwards &262d 29 01 AND #&01 &262f 69 01 ADC #&01 ; set_canyon_slope &2631 85 8f STA &8f ; canyon_slope &2633 ad 2c 12 LDA &122c ; rnd_state + 2 &2636 29 07 AND #&07 &2638 69 0a ADC #&0a &263a 85 8e STA &8e ; canyon_slope_change_cooldown ; skip_changing_canyon_slope &263c a5 75 LDA &75 ; landscape_bottom_rock_start &263e e5 74 SBC &74 ; landscape_top_rock_end &2640 c9 8c CMP #&8c &2642 90 08 BCC &264c ; is_too_wide ; is_too_wide &2644 e6 74 INC &74 ; landscape_top_rock_end &2646 e6 74 INC &74 ; landscape_top_rock_end &2648 c6 75 DEC &75 ; landscape_bottom_rock_start &264a c6 75 DEC &75 ; landscape_bottom_rock_start ; not_too_wide &264c 18 CLC &264d a5 74 LDA &74 ; landscape_top_rock_end &264f 65 8f ADC &8f ; canyon_slope &2651 c9 14 CMP #&14 &2653 b0 02 BCS &2657 ; skip_floor &2655 a9 14 LDA #&14 ; skip_floor &2657 85 74 STA &74 ; landscape_top_rock_end &2659 18 CLC &265a a5 75 LDA &75 ; landscape_bottom_rock_start &265c 65 8f ADC &8f ; canyon_slope &265e c9 eb CMP #&eb &2660 90 02 BCC &2664 ; skip_ceiling &2662 a9 eb LDA #&eb ; skip_ceiling &2664 85 75 STA &75 ; landscape_bottom_rock_start &2666 e5 74 SBC &74 ; landscape_top_rock_end &2668 c5 c6 CMP &c6 ; minimum_canyon_width &266a b0 08 BCS &2674 ; not_too_narrow ; is_too_narrow &266c c6 74 DEC &74 ; landscape_top_rock_end &266e c6 74 DEC &74 ; landscape_top_rock_end &2670 e6 75 INC &75 ; landscape_bottom_rock_start &2672 e6 75 INC &75 ; landscape_bottom_rock_start ; not_too_narrow &2674 a5 8d LDA &8d ; landscape_bottom_grass_start &2676 e5 8c SBC &8c ; landscape_top_grass_end &2678 c9 3c CMP #&3c &267a b0 08 BCS &2684 ; river_not_too_narrow ; river_is_too_narrow &267c c6 8c DEC &8c ; landscape_top_grass_end &267e c6 8c DEC &8c ; landscape_top_grass_end &2680 e6 8d INC &8d ; landscape_bottom_grass_start &2682 e6 8d INC &8d ; landscape_bottom_grass_start ; river_not_too_narrow &2684 c9 50 CMP #&50 &2686 90 04 BCC &268c ; river_not_too_wide ; river_is_too_wide &2688 e6 8c INC &8c ; landscape_top_grass_end &268a c6 8d DEC &8d ; landscape_bottom_grass_start ; river_not_too_wide &268c 18 CLC &268d a5 8c LDA &8c ; landscape_top_grass_end &268f 65 8f ADC &8f ; canyon_slope &2691 c5 74 CMP &74 ; landscape_top_rock_end &2693 b0 02 BCS &2697 ; skip_removing_top_grass ; remove_top_grass &2695 a5 74 LDA &74 ; landscape_top_rock_end ; skip_removing_top_grass &2697 85 8c STA &8c ; landscape_top_grass_end &2699 18 CLC &269a a5 8d LDA &8d ; landscape_bottom_grass_start &269c 65 8f ADC &8f ; canyon_slope &269e c5 75 CMP &75 ; landscape_bottom_rock_start &26a0 90 02 BCC &26a4 ; skip_removing_bottom_grass ; remove_bottom_grass &26a2 a5 75 LDA &75 ; landscape_bottom_rock_start ; skip_removing_bottom_grass &26a4 85 8d STA &8d ; landscape_bottom_grass_start ; skip_updating_canyon &26a6 24 b2 BIT &b2 ; suppress_game_features_flags &26a8 70 04 BVS &26ae ; to_skip_updating_enemies # Branch if SUPPRESS_WAITING_FOR_CLOCK set (game over) &26aa a5 ba LDA &ba ; x_scrolling &26ac d0 03 BNE &26b1 ; update_enemies ; to_skip_updating_enemies &26ae 4c 79 28 JMP &2879 ; skip_updating_enemies ; update_enemies &26b1 8d dd 26 STA &26dd ; x_scrolling_for_updating_enemy &26b4 0a ASL A &26b5 8d cb 26 STA &26cb ; x_scrolling_times_two_for_updating_enemy &26b8 a0 00 LDY #&00 ; update_enemies_loop &26ba b9 00 07 LDA &0700,Y ; enemies_state # Non-zero if enemy in slot &26bd d0 07 BNE &26c6 ; update_enemy ; consider_next_enemy &26bf c8 INY &26c0 c0 14 CPY #&14 &26c2 d0 f6 BNE &26ba ; update_enemies_loop &26c4 f0 1e BEQ &26e4 ; consider_adding_enemies # Always branches ; update_enemy &26c6 b9 14 07 LDA &0714,Y ; enemies_x &26c9 38 SEC &26ca e9 ff SBC #&ff # actually SBC x_scrolling_times_two_for_updating_enemy &26cc b0 07 BCS &26d5 ; skip_removing_enemy ; remove_enemy &26ce a9 00 LDA #&00 &26d0 99 00 07 STA &0700,Y ; enemies_state # Set to zero to indicate no enemy in slot &26d3 f0 ea BEQ &26bf ; consider_next_enemy # Always branches ; skip_removing_enemy &26d5 99 14 07 STA &0714,Y ; enemies_x &26d8 b9 50 07 LDA &0750,Y ; enemies_secondary_x &26db 38 SEC &26dc e9 ff SBC #&ff # actually SBC x_scrolling_for_updating_enemy &26de 99 50 07 STA &0750,Y ; enemies_secondary_x &26e1 4c bf 26 JMP &26bf ; consider_next_enemy ; consider_adding_enemies &26e4 a5 b1 LDA &b1 ; player_world_x_high &26e6 c9 08 CMP #&08 &26e8 b0 02 BCS &26ec ; not_start_of_game # Before 8km, game doesn't use bridges or ships &26ea a9 28 LDA #&28 # Make pillboxes and SAMs more frequent to compensate ; not_start_of_game # Otherwise, enemies become more frequent later in game &26ec 8d 0f 27 STA &270f ; probability_of_adding_top_enemy &26ef 8d 59 27 STA &2759 ; probability_of_adding_river_enemy &26f2 8d ea 27 STA &27ea ; probability_of_adding_bottom_enemy ; consider_adding_top_enemy &26f5 a5 c3 LDA &c3 ; new_top_enemy_cooldown &26f7 38 SEC &26f8 e5 ba SBC &ba ; x_scrolling &26fa b0 02 BCS &26fe ; not_time_to_add_top_enemy &26fc a9 00 LDA #&00 ; not_time_to_add_top_enemy &26fe 85 c3 STA &c3 ; new_top_enemy_cooldown &2700 d0 46 BNE &2748 ; skip_adding_top_enemy &2702 38 SEC &2703 a5 8c LDA &8c ; landscape_top_grass_end &2705 e5 74 SBC &74 ; landscape_top_rock_end &2707 c9 0a CMP #&0a &2709 90 3d BCC &2748 ; skip_adding_top_enemy # Don't add top enemy if not enough top grass &270b 20 00 12 JSR &1200 ; rnd &270e c9 ff CMP #&ff # actually CMP probability_of_adding_top_enemy &2710 b0 36 BCS &2748 ; skip_adding_top_enemy ; consider_adding_top_sam &2712 20 00 12 JSR &1200 ; rnd &2715 c9 1e CMP #&1e ; 30 # 30 in 256 chance of SAM &2717 b0 1d BCS &2736 ; consider_adding_top_pillbox &2719 a0 06 LDY #&06 &271b a2 02 LDX #&02 ; ENEMY_TYPE_SAM_LEFT &271d a5 b1 LDA &b1 ; player_world_x_high &271f dd 8b 04 CMP &048b,X ; starting_world_x_for_features_table - 1 &2722 90 24 BCC &2748 ; skip_adding_top_enemy &2724 a5 74 LDA &74 ; landscape_top_rock_end &2726 69 02 ADC #&02 &2728 a6 b3 LDX &b3 ; player_y &272a e0 32 CPX #&32 &272c b0 04 BCS &2732 ; add_top_sam_down ; add_top_sam_left &272e a2 02 LDX #&02 ; ENEMY_TYPE_SAM_LEFT &2730 d0 10 BNE &2742 ; add_top_enemy # Always branches ; add_top_sam_down &2732 a2 01 LDX #&01 ; ENEMY_TYPE_SAM_DOWN &2734 d0 0c BNE &2742 ; add_top_enemy # Always branches ; consider_adding_top_pillbox &2736 c9 46 CMP #&46 ; 70 &2738 b0 0e BCS &2748 ; skip_adding_top_enemy # 40 in 256 chance of pillbox &273a a0 07 LDY #&07 &273c a5 8c LDA &8c ; landscape_top_grass_end &273e e9 09 SBC #&09 &2740 a2 06 LDX #&06 ; ENEMY_TYPE_PILLBOX ; add_top_enemy &2742 84 c3 STY &c3 ; new_top_enemy_cooldown &2744 a8 TAY ; feature_y &2745 20 fe 20 JSR &20fe ; add_feature ; skip_adding_top_enemy ; consider_adding_river_enemy &2748 a5 c4 LDA &c4 ; new_river_enemy_cooldown &274a 38 SEC &274b e5 ba SBC &ba ; x_scrolling &274d b0 02 BCS &2751 ; not_time_to_add_river_enemy &274f a9 00 LDA #&00 ; not_time_to_add_river_enemy &2751 85 c4 STA &c4 ; new_river_enemy_cooldown &2753 d0 7b BNE &27d0 ; skip_adding_river_enemy &2755 20 00 12 JSR &1200 ; rnd &2758 c9 ff CMP #&ff # actually CMP probability_of_adding_river_enemy &275a b0 74 BCS &27d0 ; skip_adding_river_enemy ; consider_adding_horizontal_ship &275c 20 00 12 JSR &1200 ; rnd &275f c9 50 CMP #&50 ; 80 # 80 in 256 chance of horizontal ship &2761 b0 14 BCS &2777 ; consider_adding_vertical_ship &2763 a2 04 LDX #&04 ; ENEMY_TYPE_SHIP_HORIZONTAL &2765 a5 b1 LDA &b1 ; player_world_x_high &2767 dd 8b 04 CMP &048b,X ; starting_world_x_for_features_table - 1 &276a 90 64 BCC &27d0 ; skip_adding_river_enemy &276c a5 8d LDA &8d ; landscape_bottom_grass_start &276e e5 8c SBC &8c ; landscape_top_grass_end &2770 4a LSR A &2771 65 8c ADC &8c ; landscape_top_grass_end &2773 a0 32 LDY #&32 ; cooldown &2775 d0 53 BNE &27ca ; add_river_enemy # Always branches ; consider_adding_vertical_ship &2777 c9 78 CMP #&78 ; 120 # 40 in 256 chance of vertical ship &2779 b0 18 BCS &2793 ; consider_adding_silo &277b a2 05 LDX #&05 ; ENEMY_TYPE_SHIP_VERTICAL &277d a5 b1 LDA &b1 ; player_world_x_high &277f dd 8b 04 CMP &048b,X ; starting_world_x_for_features_table - 1 &2782 90 4c BCC &27d0 ; skip_adding_river_enemy &2784 a5 8d LDA &8d ; landscape_bottom_grass_start &2786 e5 8c SBC &8c ; landscape_top_grass_end &2788 e9 46 SBC #&46 &278a 90 44 BCC &27d0 ; skip_adding_river_enemy &278c 4a LSR A &278d 65 8c ADC &8c ; landscape_top_grass_end &278f a0 14 LDY #&14 ; cooldown &2791 d0 37 BNE &27ca ; add_river_enemy # Always branches ; consider_adding_silo &2793 c9 8c CMP #&8c ; 140 # 20 in 256 chance of silo &2795 b0 16 BCS &27ad ; consider_adding_command_centre &2797 a2 09 LDX #&09 ; ENEMY_TYPE_SILO &2799 a5 b1 LDA &b1 ; player_world_x_high &279b dd 8b 04 CMP &048b,X ; starting_world_x_for_features_table - 1 &279e 90 30 BCC &27d0 ; skip_adding_river_enemy &27a0 a5 8d LDA &8d ; landscape_bottom_grass_start &27a2 e5 8c SBC &8c ; landscape_top_grass_end &27a4 4a LSR A &27a5 65 8c ADC &8c ; landscape_top_grass_end &27a7 e9 05 SBC #&05 &27a9 a0 0a LDY #&0a ; cooldown &27ab d0 1d BNE &27ca ; add_river_enemy # Always branches ; consider_adding_command_centre &27ad c9 91 CMP #&91 ; 145 # 5 in 256 chance of command centre &27af b0 1f BCS &27d0 ; skip_adding_river_enemy &27b1 a2 0a LDX #&0a ; ENEMY_TYPE_COMMAND_CENTRE &27b3 a5 b1 LDA &b1 ; player_world_x_high &27b5 dd 8b 04 CMP &048b,X ; starting_world_x_for_features_table - 1 &27b8 90 16 BCC &27d0 ; skip_adding_river_enemy &27ba 20 e9 16 JSR &16e9 ; play_sound_for_command_centre &27bd a2 0a LDX #&0a ; ENEMY_TYPE_COMMAND_CENTRE &27bf a5 8d LDA &8d ; landscape_bottom_grass_start &27c1 e5 8c SBC &8c ; landscape_top_grass_end &27c3 4a LSR A &27c4 65 8c ADC &8c ; landscape_top_grass_end &27c6 e9 05 SBC #&05 &27c8 a0 0a LDY #&0a ; cooldown ; add_river_enemy &27ca 84 c4 STY &c4 ; new_river_enemy_cooldown &27cc a8 TAY ; feature_y &27cd 20 fe 20 JSR &20fe ; add_feature ; skip_adding_river_enemy ; consider_adding_bottom_enemy &27d0 a5 c5 LDA &c5 ; new_bottom_enemy_cooldown &27d2 38 SEC &27d3 e5 ba SBC &ba ; x_scrolling &27d5 b0 02 BCS &27d9 ; not_time_to_add_bottom_enemy &27d7 a9 00 LDA #&00 ; not_time_to_add_bottom_enemy &27d9 85 c5 STA &c5 ; new_bottom_enemy_cooldown &27db d0 46 BNE &2823 ; skip_adding_bottom_enemy &27dd 38 SEC &27de a5 75 LDA &75 ; landscape_bottom_rock_start &27e0 e5 8d SBC &8d ; landscape_bottom_grass_start &27e2 c9 0a CMP #&0a &27e4 90 3d BCC &2823 ; skip_adding_bottom_enemy # Don't add bottom enemy if not enough bottom grass &27e6 20 00 12 JSR &1200 ; rnd &27e9 c9 ff CMP #&ff # actually CMP probability_of_adding_bottom_enemy &27eb b0 36 BCS &2823 ; skip_adding_bottom_enemy &27ed 20 00 12 JSR &1200 ; rnd &27f0 c9 1e CMP #&1e ; 30 # 30 in 256 chance of SAM &27f2 b0 1d BCS &2811 ; consider_adding_bottom_pillbox ; consider_adding_bottom_sam &27f4 a2 02 LDX #&02 ; ENEMY_TYPE_SAM_LEFT &27f6 a5 b1 LDA &b1 ; player_world_x_high &27f8 dd 8b 04 CMP &048b,X ; starting_world_x_for_features_table - 1 &27fb 90 26 BCC &2823 ; skip_adding_bottom_enemy &27fd a0 06 LDY #&06 &27ff a5 75 LDA &75 ; landscape_bottom_rock_start &2801 e9 0a SBC #&0a &2803 a6 b3 LDX &b3 ; player_y &2805 e0 c8 CPX #&c8 &2807 90 04 BCC &280d ; add_bottom_sam_up ; add_bottom_sam_left &2809 a2 02 LDX #&02 ; ENEMY_TYPE_SAM_LEFT &280b d0 10 BNE &281d ; add_bottom_enemy # Always branches ; add_bottom_sam_up &280d a2 03 LDX #&03 ; ENEMY_TYPE_SAM_UP &280f d0 0c BNE &281d ; add_bottom_enemy # Always branches ; consider_adding_bottom_pillbox &2811 c9 46 CMP #&46 ; 70 # 40 in 256 chance of pillbox &2813 b0 0e BCS &2823 ; skip_adding_bottom_enemy &2815 a0 07 LDY #&07 &2817 a5 8d LDA &8d ; landscape_bottom_grass_start &2819 69 02 ADC #&02 &281b a2 06 LDX #&06 ; ENEMY_TYPE_PILLBOX ; add_bottom_enemy &281d 84 c5 STY &c5 ; new_bottom_enemy_cooldown &281f a8 TAY ; feature_y &2820 20 fe 20 JSR &20fe ; add_feature ; skip_adding_bottom_enemy &2823 a2 07 LDX #&07 ; ENEMY_TYPE_BRIDGE_MIDDLE &2825 a5 b1 LDA &b1 ; player_world_x_high &2827 dd 8b 04 CMP &048b,X ; starting_world_x_for_features_table - 1 &282a 90 4d BCC &2879 ; skip_adding_bridge &282c a5 c3 LDA &c3 ; new_top_enemy_cooldown &282e 05 c4 ORA &c4 ; new_river_enemy_cooldown &2830 05 c5 ORA &c5 ; new_bottom_enemy_cooldown &2832 d0 45 BNE &2879 ; skip_adding_bridge ; consider_adding_bridge &2834 20 00 12 JSR &1200 ; rnd &2837 29 03 AND #&03 &2839 d0 3e BNE &2879 ; skip_adding_bridge &283b 18 CLC &283c a5 8d LDA &8d ; landscape_bottom_grass_start &283e e5 8c SBC &8c ; landscape_top_grass_end &2840 a8 TAY &2841 29 0f AND #&0f &2843 d0 34 BNE &2879 ; skip_adding_bridge # Don't add bridge if exact multiple won't fit &2845 98 TYA &2846 4a LSR A &2847 4a LSR A &2848 4a LSR A &2849 4a LSR A &284a 85 77 STA &77 ; bridge_length &284c a5 8c LDA &8c ; landscape_top_grass_end &284e 38 SEC &284f e9 0a SBC #&0a &2851 a8 TAY ; feature_y &2852 a2 08 LDX #&08 ; ENEMY_TYPE_BRIDGE_END &2854 20 fe 20 JSR &20fe ; add_feature # Add top of bridge &2857 a5 8c LDA &8c ; landscape_top_grass_end ; add_bridge_loop &2859 85 76 STA &76 ; bridge_y &285b a8 TAY ; feature_y &285c a2 07 LDX #&07 ; ENEMY_TYPE_BRIDGE_MIDDLE &285e 20 fe 20 JSR &20fe ; add_feature &2861 a5 76 LDA &76 ; bridge_y &2863 18 CLC &2864 69 10 ADC #&10 &2866 c6 77 DEC &77 ; bridge_length &2868 d0 ef BNE &2859 ; add_bridge_loop &286a a8 TAY ; feature_y &286b a2 08 LDX #&08 ; ENEMY_TYPE_BRIDGE_END &286d 20 fe 20 JSR &20fe ; add_feature # Add bottom of bridge &2870 a9 06 LDA #&06 &2872 85 c3 STA &c3 ; new_top_enemy_cooldown &2874 85 c5 STA &c5 ; new_bottom_enemy_cooldown &2876 0a ASL A &2877 85 c4 STA &c4 ; new_river_enemy_cooldown ; skip_adding_bridge ; skip_updating_enemies &2879 24 b2 BIT &b2 ; suppress_game_features_flags &287b 30 1e BMI &289b ; to_leave # Branch if SUPPRESS_ENEMY_FIRING set &287d a5 ba LDA &ba ; x_scrolling &287f 0a ASL A &2880 0a ASL A &2881 0a ASL A &2882 69 2d ADC #&2d &2884 85 81 STA &81 ; enemy_target_x &2886 a2 00 LDX #&00 ; consider_enemies_firing_loop &2888 bd 00 07 LDA &0700,X ; enemies_state # Non-zero if enemy in slot, negative if exploding &288b f0 09 BEQ &2896 ; consider_next_enemy &288d 30 07 BMI &2896 ; consider_next_enemy ; is_present &288f a8 TAY ; enemy_state &2890 29 0f AND #&0f # Low nibble of enemy_state is enemy type &2892 c9 07 CMP #&07 ; ENEMY_TYPE_BRIDGE_MIDDLE &2894 90 08 BCC &289e ; consider_enemy_firing # Bridges, silos and command centres don't fire ; consider_next_enemy &2896 e8 INX &2897 e0 14 CPX #&14 &2899 d0 ed BNE &2888 ; consider_enemies_firing_loop ; to_leave &289b 4c 56 29 JMP &2956 ; leave ; consider_enemy_firing &289e 98 TYA ; enemy_state &289f 38 SEC &28a0 e9 10 SBC #&10 # High nibble of enemy_state is firing cooldown &28a2 90 05 BCC &28a9 ; time_to_fire ; not_time_to_fire &28a4 9d 00 07 STA &0700,X ; enemies_state &28a7 b0 ed BCS &2896 ; consider_next_enemy # Always branches ; time_to_fire &28a9 29 0f AND #&0f &28ab 85 82 STA &82 ; enemy_type &28ad a0 00 LDY #&00 ; find_free_slot_for_enemy_projectile_loop &28af b9 00 06 LDA &0600,Y ; enemy_projectiles_state &28b2 f0 08 BEQ &28bc ; found_free_slot_for_enemy_projectile &28b4 c8 INY &28b5 c0 0a CPY #&0a &28b7 d0 f6 BNE &28af ; find_free_slot_for_enemy_projectile_loop &28b9 4c 56 29 JMP &2956 ; leave ; found_free_slot_for_enemy_projectile &28bc 84 84 STY &84 ; enemy_projectile_slot &28be bd 14 07 LDA &0714,X ; enemies_x &28c1 85 88 STA &88 ; enemy_x &28c3 bd 28 07 LDA &0728,X ; enemies_y &28c6 85 89 STA &89 ; enemy_y &28c8 86 83 STX &83 ; enemy_slot &28ca a6 82 LDX &82 ; enemy_type &28cc bd 9f 04 LDA &049f,X ; enemy_types_number_of_ranges_table - 1 &28cf 85 85 STA &85 ; ranges_remaining &28d1 bd a5 04 LDA &04a5,X ; enemy_types_maximum_firing_distance_table - 1 &28d4 85 86 STA &86 ; maximum_distance &28d6 bd ab 04 LDA &04ab,X ; enemy_types_initial_projectile_state_table - 1 &28d9 85 87 STA &87 ; enemy_projectile_state &28db bd b1 04 LDA &04b1,X ; enemy_types_first_firing_offset_table - 1 &28de aa TAX ; firing_offset ; consider_firing_ranges_loop &28df bd b8 04 LDA &04b8,X ; firing_offsets_table # First byte is x offset &28e2 18 CLC &28e3 65 88 ADC &88 ; enemy_x &28e5 85 76 STA &76 ; enemy_projectile_x &28e7 e8 INX ; firing_offset &28e8 bd b8 04 LDA &04b8,X ; firing_offsets_table # Second byte is y offset &28eb 18 CLC &28ec 65 89 ADC &89 ; enemy_y &28ee 85 77 STA &77 ; enemy_projectile_y &28f0 86 8a STX &8a ; firing_offset &28f2 a5 81 LDA &81 ; enemy_target_x &28f4 85 78 STA &78 ; target_x &28f6 a5 b3 LDA &b3 ; player_y &28f8 85 79 STA &79 ; target_y &28fa 20 0f 14 JSR &140f ; calculate_angle_and_distance_to_target &28fd a6 8a LDX &8a ; firing_offset &28ff a5 7d LDA &7d ; distance &2901 c5 86 CMP &86 ; maximum_distance &2903 b0 24 BCS &2929 ; consider_next_firing_range_skipping_angles &2905 e8 INX &2906 bd b8 04 LDA &04b8,X ; firing_offsets_table # Third byte is minimum or maximum angle &2909 e8 INX &290a dd b8 04 CMP &04b8,X ; firing_offsets_table # Fourth byte is maximum or minimum angle &290d 90 0d BCC &291c ; is_maximum_minimum ; is_minimum_maximum # A = third byte = minimum angle &290f c5 78 CMP &78 ; angle &2911 90 1f BCC &2932 ; add_enemy_projectile &2913 bd b8 04 LDA &04b8,X ; firing_offsets_table # Fourth byte is maximum angle &2916 c5 78 CMP &78 ; angle &2918 90 11 BCC &292b ; consider_next_firing_range &291a b0 16 BCS &2932 ; add_enemy_projectile # Always branches ; is_maximum_minimum # A = third byte = maximum angle &291c c5 78 CMP &78 ; angle &291e b0 0b BCS &292b ; consider_next_firing_range &2920 bd b8 04 LDA &04b8,X ; firing_offsets_table # Fourth byte is minimum angle &2923 c5 78 CMP &78 ; angle &2925 90 04 BCC &292b ; consider_next_firing_range &2927 b0 09 BCS &2932 ; add_enemy_projectile # Always branches ; consider_next_firing_range_skipping_angles &2929 e8 INX &292a e8 INX ; consider_next_firing_range &292b e8 INX &292c c6 85 DEC &85 ; ranges_remaining &292e d0 af BNE &28df ; consider_firing_ranges_loop &2930 f0 1f BEQ &2951 ; to_consider_next_enemy # Always branches ; add_enemy_projectile &2932 a4 84 LDY &84 ; enemy_projectile_slot &2934 a5 87 LDA &87 ; enemy_projectile_state # Negative if homing projectile &2936 99 00 06 STA &0600,Y ; enemy_projectiles_state &2939 a5 78 LDA &78 ; angle &293b 99 0a 06 STA &060a,Y ; enemy_projectiles_angle &293e a5 76 LDA &76 ; enemy_projectile_x &2940 99 14 06 STA &0614,Y ; enemy_projectiles_x &2943 a5 77 LDA &77 ; enemy_projectile_y &2945 99 1e 06 STA &061e,Y ; enemy_projectiles_y &2948 a6 83 LDX &83 ; enemy_slot &294a a9 40 LDA #&40 # Set firing cooldown &294c 05 82 ORA &82 ; enemy_type &294e 9d 00 07 STA &0700,X ; enemies_state ; to_consider_next_enemy &2951 a6 83 LDX &83 ; enemy_slot &2953 4c 96 28 JMP &2896 ; consider_next_enemy ; leave &2956 60 RTS ; main_game_loop &2957 20 d1 21 JSR &21d1 ; reset_clock_and_consider_checking_for_player_firing &295a 20 07 20 JSR &2007 ; plot_landscape_after_vsync &295d a5 bf LDA &bf ; player_damage &295f c9 99 CMP #&99 &2961 f0 06 BEQ &2969 ; to_game_over &2963 a5 bc LDA &bc ; fuel_high &2965 05 bb ORA &bb ; fuel_low &2967 d0 03 BNE &296c ; not_game_over ; to_game_over &2969 4c fc 29 JMP &29fc ; game_over ; not_game_over &296c 20 3a 21 JSR &213a ; check_for_movement_keypresses &296f a5 b9 LDA &b9 ; player_x_velocity &2971 4a LSR A &2972 4a LSR A &2973 4a LSR A &2974 85 76 STA &76 ; fuel_usage &2976 f8 SED &2977 38 SEC &2978 a5 bb LDA &bb ; fuel_low &297a e5 76 SBC &76 ; fuel_usage &297c 85 bb STA &bb ; fuel_low &297e a5 bc LDA &bc ; fuel_high &2980 e9 00 SBC #&00 &2982 85 bc STA &bc ; fuel_high &2984 b0 09 BCS &298f ; not_out_of_fuel &2986 a9 00 LDA #&00 &2988 85 bb STA &bb ; fuel_low &298a 85 bc STA &bc ; fuel_high &298c d8 CLD &298d f0 0e BEQ &299d ; skip_warning # Always branches ; not_out_of_fuel &298f d8 CLD &2990 c9 05 CMP #&05 &2992 90 06 BCC &299a ; play_warning # Play warning if less than 500 fuel &2994 a5 bf LDA &bf ; player_damage &2996 c9 80 CMP #&80 # Play warning if 80 or more damage &2998 90 03 BCC &299d ; skip_warning ; play_warning &299a 20 be 16 JSR &16be ; play_sound_for_warning ; skip_warning ; start_game ; calculate_x_scrolling &299d a5 b9 LDA &b9 ; player_x_velocity &299f 4a LSR A # Scroll once per update for every &10 velocity &29a0 4a LSR A &29a1 4a LSR A &29a2 4a LSR A &29a3 85 ba STA &ba ; x_scrolling &29a5 a5 b9 LDA &b9 ; player_x_velocity &29a7 c5 ca CMP &ca ; previous_player_x_velocity &29a9 f0 12 BEQ &29bd ; skip_starting_scrolling_cycle ; start_scrolling_cycle &29ab 85 ca STA &ca ; previous_player_x_velocity &29ad 29 0f AND #&0f &29af 85 cb STA &cb ; extra_scrolling_remaining &29b1 38 SEC &29b2 a9 10 LDA #&10 &29b4 e5 cb SBC &cb ; extra_scrolling_remaining &29b6 85 cc STA &cc ; extra_scrolling_timer &29b8 a6 b9 LDX &b9 ; player_x_velocity &29ba 20 36 16 JSR &1636 ; set_velocity_pitch ; skip_starting_scrolling_cycle &29bd a5 c9 LDA &c9 ; extra_scrolling_state &29bf 49 80 EOR #&80 &29c1 85 c9 STA &c9 ; extra_scrolling_state &29c3 30 0f BMI &29d4 ; update_extra_scrolling_timer # Every other update, consider adding extra scrolling ; consider_adding_extra_scrolling # to make up for velocities that aren't multiples of &10 &29c5 a6 cb LDX &cb ; extra_scrolling_remaining &29c7 f0 07 BEQ &29d0 ; skip_adding_extra_scrolling ; add_extra_scrolling &29c9 ca DEX &29ca 86 cb STX &cb ; extra_scrolling_remaining &29cc e6 ba INC &ba ; x_scrolling &29ce d0 18 BNE &29e8 ; check_for_escape # Always branches ; skip_adding_extra_scrolling &29d0 a5 cc LDA &cc ; extra_scrolling_timer &29d2 f0 0d BEQ &29e1 ; end_of_scrolling_cycle ; update_extra_scrolling_timer &29d4 a6 cc LDX &cc ; extra_scrolling_timer &29d6 f0 05 BEQ &29dd ; consider_end_of_scrolling_cycle &29d8 ca DEX &29d9 86 cc STX &cc ; extra_scrolling_timer &29db 10 0b BPL &29e8 ; check_for_escape ; consider_end_of_scrolling_cycle &29dd a5 cb LDA &cb ; extra_scrolling_remaining &29df d0 e4 BNE &29c5 ; consider_adding_extra_scrolling ; end_of_scrolling_cycle &29e1 a9 ff LDA #&ff &29e3 85 ca STA &ca ; previous_player_x_velocity # Set to &ff to force start of new scrolling cycle &29e5 4c 9d 29 JMP &299d ; calculate_x_scrolling ; check_for_escape &29e8 a9 81 LDA #&81 ; Scan for a particular key &29ea a0 ff LDY #&ff &29ec a2 8f LDX #&8f ; ESCAPE &29ee 20 f4 ff JSR &fff4 ; OSBYTE &29f1 90 03 BCC &29f6 ; escape_not_pressed &29f3 4c d7 2a JMP &2ad7 ; skip_plotting_game_over ; escape_not_pressed &29f6 20 3a 21 JSR &213a ; check_for_movement_keypresses &29f9 4c 57 29 JMP &2957 ; main_game_loop ; game_over &29fc a9 12 LDA #&12 &29fe 85 76 STA &76 ; sprite_x &2a00 a5 b3 LDA &b3 ; player_y &2a02 38 SEC &2a03 e9 05 SBC #&05 &2a05 85 77 STA &77 ; sprite_y &2a07 a9 00 LDA #&00 ; plot without buffering, use KK as mask &2a09 85 78 STA &78 ; plotting_mode &2a0b a0 0a LDY #&0a ; SPRITE_EXPLOSION_THREE &2a0d 20 31 12 JSR &1231 ; plot_sprite # Plot explosion in place of player &2a10 20 90 16 JSR &1690 ; play_sound_for_explosion &2a13 a9 01 LDA #&01 &2a15 85 ba STA &ba ; x_scrolling &2a17 a9 1e LDA #&1e &2a19 85 6f STA &6f ; count &2a1b a9 b0 LDA #&b0 ; SUPPRESS_ENEMY_FIRING | SUPPRESS_PLOTTING_PLAYER | SUPPRESS_PLAYER_FIRING &2a1d 85 b2 STA &b2 ; suppress_game_features_flags ; pre_game_over_column_loop &2a1f 20 d1 21 JSR &21d1 ; reset_clock_and_consider_checking_for_player_firing &2a22 20 07 20 JSR &2007 ; plot_landscape_after_vsync # Scroll before game over text &2a25 c6 6f DEC &6f ; count &2a27 d0 f6 BNE &2a1f ; pre_game_over_column_loop &2a29 a0 06 LDY #&06 ; write_move_for_game_over_loop &2a2b b9 ea 2a LDA &2aea,Y ; move_for_game_over_string - 1 &2a2e 20 ee ff JSR &ffee ; OSWRCH &2a31 88 DEY &2a32 d0 f7 BNE &2a2b ; write_move_for_game_over_loop &2a34 a9 f0 LDA #&f0 ; SUPPRESS_ENEMY_FIRING | SUPPRESS_WAITING_FOR_CLOCK | SUPPRESS_PLOTTING_PLAYER | SUPPRESS_PLAYER_FIRING &2a36 85 b2 STA &b2 ; suppress_game_features_flags &2a38 a9 12 LDA #&12 &2a3a 85 6f STA &6f ; offset ; game_over_character_loop &2a3c a9 04 LDA #&04 &2a3e 85 6e STA &6e ; count ; game_over_column_loop &2a40 20 d1 21 JSR &21d1 ; reset_clock_and_consider_checking_for_player_firing &2a43 20 07 20 JSR &2007 ; plot_landscape_after_vsync &2a46 c6 6e DEC &6e ; count &2a48 d0 f6 BNE &2a40 ; game_over_column_loop &2a4a a4 6f LDY &6f ; offset &2a4c b9 f0 2a LDA &2af0,Y ; game_over_string - 1 &2a4f 20 ee ff JSR &ffee ; OSWRCH # Plot part of " GAME OVER AFTER" &2a52 a9 08 LDA #&08 ; move cursor left one character &2a54 20 ee ff JSR &ffee ; OSWRCH &2a57 88 DEY &2a58 84 6f STY &6f ; offset &2a5a d0 e0 BNE &2a3c ; game_over_loop ; calculate_kilometres &2a5c a9 00 LDA #&00 &2a5e 85 60 STA &60 ; kilometres &2a60 85 61 STA &61 ; kilometres + 1 &2a62 46 b1 LSR &b1 ; player_world_x_high ; calculate_kilometres_loop &2a64 38 SEC &2a65 a5 b1 LDA &b1 ; player_world_x_high &2a67 e9 01 SBC #&01 &2a69 85 b1 STA &b1 ; player_world_x_high &2a6b 90 10 BCC &2a7d ; plot_kilometres &2a6d f8 SED &2a6e a5 60 LDA &60 ; kilometres &2a70 69 00 ADC #&00 &2a72 85 60 STA &60 ; kilometres &2a74 a5 61 LDA &61 ; kilometres + 1 &2a76 69 00 ADC #&00 &2a78 85 61 STA &61 ; kilometres + 1 &2a7a d8 CLD &2a7b 90 e7 BCC &2a64 ; calculate_kilometres_loop ; plot_kilometres &2a7d a9 02 LDA #&02 &2a7f 85 6f STA &6f ; offset ; plot_kilometres_character_loop &2a81 a9 04 LDA #&04 &2a83 85 6e STA &6e ; count ; plot_kilometres_column_loop &2a85 20 d1 21 JSR &21d1 ; reset_clock_and_consider_checking_for_player_firing &2a88 20 07 20 JSR &2007 ; plot_landscape_after_vsync &2a8b c6 6e DEC &6e ; count &2a8d d0 f6 BNE &2a85 ; plot_kilometers_column_loop &2a8f a5 6f LDA &6f ; offset &2a91 4a LSR A &2a92 a8 TAY &2a93 b9 60 00 LDA &0060,Y ; kilometres &2a96 90 06 BCC &2a9e ; use_tens ; use_tens &2a98 4a LSR A &2a99 4a LSR A &2a9a 4a LSR A &2a9b 4a LSR A &2a9c 10 02 BPL &2aa0 ; plot_digit # Always branches ; use_ones &2a9e 29 0f AND #&0f ; plot_digit &2aa0 18 CLC &2aa1 69 30 ADC #&30 ; "0" &2aa3 20 ee ff JSR &ffee ; OSWRCH # Plot part of distance &2aa6 a9 08 LDA #&08 ; move cursor left one character &2aa8 20 ee ff JSR &ffee ; OSWRCH &2aab c6 6f DEC &6f ; offset &2aad 10 d2 BPL &2a81 ; plot_kilometres_character_loop ; plot_km &2aaf a9 02 LDA #&02 &2ab1 85 6f STA &6f ; offset ; plot_km_character_loop &2ab3 a9 04 LDA #&04 &2ab5 85 6e STA &6e ; count ; plot_km_column_loop &2ab7 20 d1 21 JSR &21d1 ; reset_clock_and_consider_checking_for_player_firing &2aba 20 07 20 JSR &2007 ; plot_landscape_after_vsync &2abd c6 6e DEC &6e ; count &2abf d0 f6 BNE &2ab7 ; plot_km_column_loop &2ac1 a4 6f LDY &6f ; offset &2ac3 b9 02 2b LDA &2b02,Y ; km_string - 1 &2ac6 20 ee ff JSR &ffee ; OSWRCH # Plot part of "km" &2ac9 a9 08 LDA #&08 ; move cursor left one character &2acb 20 ee ff JSR &ffee ; OSWRCH &2ace 88 DEY &2acf 84 6f STY &6f ; offset &2ad1 d0 e0 BNE &2ab3 ; plot_km_character_loop &2ad3 a9 00 LDA #&00 &2ad5 85 68 STA &68 ; suppress_checking_for_high_score # Set to zero to check for high score ; skip_plotting_game_over &2ad7 a9 ff LDA #&ff ; SUPPRESS_ENEMY_FIRING | SUPPRESS_WAITING_FOR_CLOCK | SUPPRESS_PLOTTING_PLAYER | SUPPRESS_PLAYER_FIRING | &0f &2ad9 85 b2 STA &b2 ; suppress_game_features_flags &2adb a9 3c LDA #&3c &2add 85 6f STA &6f ; count ; post_game_over_column_loop &2adf 20 d1 21 JSR &21d1 ; reset_clock_and_consider_checking_for_player_firing &2ae2 20 07 20 JSR &2007 ; plot_landscape_after_vsync # Scroll after game over text &2ae5 c6 6f DEC &6f ; count &2ae7 d0 f6 BNE &2adf ; post_game_over_column_loop &2ae9 f0 1a BEQ &2b05 ; title_screen_after_reset # Always branches ; move_for_game_over_string # Stored backwards &2aeb 02 00 04 c0 04 19 ; MODE &04c0, &0200 ; game_over_string # Stored backwards &2af1 20 52 45 54 46 41 20 52 45 56 4f 20 45 4d 41 47 ; " GAME OVER AFTER " &2b01 20 20 ; km_string # Stored backwards &2b03 6d 6b ; "km" ; title_screen_after_reset &2b05 a9 01 LDA #&01 &2b07 85 ba STA &ba ; x_scrolling &2b09 a9 10 LDA #&10 &2b0b 85 b9 STA &b9 ; player_x_velocity &2b0d a9 0f LDA #&0f ; Flush all buffers &2b0f a2 00 LDX #&00 ; all buffers &2b11 a0 00 LDY #&00 &2b13 20 f4 ff JSR &fff4 ; OSBYTE &2b16 a0 d0 LDY #&d0 &2b18 a9 00 LDA #&00 ; reset_planes_loop &2b1a 99 00 05 STA &0500,Y ; planes_x - &d0 # Set &05d0 - &05ff to zero &2b1d c8 INY &2b1e d0 fa BNE &2b1a ; reset_planes_loop ; reset_projectiles_loop &2b20 99 00 06 STA &0600,Y ; enemy_projectiles_state # Set &0600 - &06ff to zero &2b23 c8 INY &2b24 d0 fa BNE &2b20 ; reset_projectiles_loop ; reset_enemies_loop &2b26 99 00 07 STA &0700,Y ; enemies_state # Set &0700 - &07ff to zero &2b29 c8 INY &2b2a d0 fa BNE &2b26 ; reset_enemies_loop &2b2c 20 7f 2c JSR &2c7f ; check_for_high_score ; title_screen &2b2f a9 c8 LDA #&c8 ; Read/Write BREAK/ESCAPE effect &2b31 a2 03 LDX #&03 ; Clear memory on next RESET &2b33 20 f4 ff JSR &fff4 ; OSBYTE &2b36 a2 00 LDX #&00 &2b38 a0 00 LDY #&00 ; reset_variables_for_title_screen_loop &2b3a bd c0 11 LDA &11c0,X ; initial_variables_for_game &2b3d 8d 45 2b STA &2b45 ; variable_address &2b40 e8 INX &2b41 bd c0 11 LDA &11c0,X ; initial_variables_for_game &2b44 85 ff STA &ff # actually STA variable_address &2b46 e8 INX &2b47 e0 3e CPX #&3e &2b49 d0 ef BNE &2b3a ; reset_variables_for_title_screen_loop &2b4b a0 06 LDY #&06 ; SPRITE_AIMING_SIGHT &2b4d a9 80 LDA #&80 ; buffer and plot, use KK as mask &2b4f 85 78 STA &78 ; plotting_mode &2b51 a9 31 LDA #&31 &2b53 85 76 STA &76 ; sprite_x &2b55 a5 b3 LDA &b3 ; player_y &2b57 e9 03 SBC #&03 &2b59 85 77 STA &77 ; sprite_y &2b5b 20 31 12 JSR &1231 ; plot_sprite # Plot aiming sight &2b5e a0 05 LDY #&05 ; SPRITE_PLAYER &2b60 a9 14 LDA #&14 &2b62 85 76 STA &76 ; sprite_x &2b64 a9 7a LDA #&7a &2b66 85 77 STA &77 ; sprite_y &2b68 20 31 12 JSR &1231 ; plot_sprite # Plot player &2b6b a2 01 LDX #&01 &2b6d 86 ba STX &ba ; x_scrolling &2b6f a9 14 LDA #&14 &2b71 85 6f STA &6f ; offset &2b73 a0 06 LDY #&06 ; write_move_for_title_screen_text_loop &2b75 b9 48 2c LDA &2c48,Y ; move_for_title_screen_text_string - 1 &2b78 20 ee ff JSR &ffee ; OSWRCH &2b7b 88 DEY &2b7c d0 f7 BNE &2b75 ; write_move_for_title_screen_text_loop ; title_screen_text_character_loop &2b7e a9 04 LDA #&04 &2b80 85 6e STA &6e ; count ; title_screen_text_column_loop &2b82 20 07 20 JSR &2007 ; plot_landscape_after_vsync &2b85 c6 6e DEC &6e ; count &2b87 d0 f9 BNE &2b82 ; title_screen_text_column_loop &2b89 a4 6f LDY &6f ; offset &2b8b b9 4e 2c LDA &2c4e,Y ; press_space_to_start_string - 1 &2b8e 20 ee ff JSR &ffee ; OSWRCH # Plot part of "PRESS SPACE TO START" &2b91 a2 04 LDX #&04 ; write_backspace_and_down_three_lines_loop &2b93 bd 76 2c LDA &2c76,X ; backspace_and_down_three_lines_string - 1 &2b96 20 ee ff JSR &ffee ; OSWRCH &2b99 ca DEX &2b9a d0 f7 BNE &2b93 ; write_backspace_and_down_three_lines_loop &2b9c b9 62 2c LDA &2c62,Y ; or_wait_for_a_demo_string - 1 &2b9f 20 ee ff JSR &ffee ; OSWRCH # Plot part of " OR WAIT FOR A DEMO " &2ba2 a2 04 LDX #&04 ; write_backspace_and_up_three_lines_loop &2ba4 bd 7a 2c LDA &2c7a,X ; backspace_and_up_three_lines_string - 1 &2ba7 20 ee ff JSR &ffee ; OSWRCH &2baa ca DEX &2bab d0 f7 BNE &2ba4 ; write_backspace_and_up_three_lines_loop &2bad 88 DEY &2bae 84 6f STY &6f ; offset &2bb0 d0 cc BNE &2b7e ; title_screen_text_character_loop &2bb2 a9 01 LDA #&01 &2bb4 85 5d STA &5d ; tune_state # Set to non-zero to stop tune &2bb6 a9 4f LDA #&4f ; &184f = title_screen_tune_data &2bb8 85 5e STA &5e ; tune_data_address_low &2bba a9 18 LDA #&18 &2bbc 85 5f STA &5f ; tune_data_address_high &2bbe a9 00 LDA #&00 &2bc0 85 5d STA &5d ; tune_state # Set to zero to start tune &2bc2 85 b2 STA &b2 ; suppress_game_features_flags # Set to zero to allow all features &2bc4 a9 02 LDA #&02 &2bc6 85 ba STA &ba ; x_scrolling &2bc8 a9 20 LDA #&20 &2bca 85 b9 STA &b9 ; player_x_velocity ; title_screen_loop &2bcc a9 81 LDA #&81 ; Wait for input character &2bce a2 00 LDX #&00 &2bd0 a0 03 LDY #&03 # Wait 7.68s before starting demo &2bd2 20 f4 ff JSR &fff4 ; OSBYTE # Returns carry set if timed out &2bd5 b0 26 BCS &2bfd ; start_demo &2bd7 e0 51 CPX #&51 ; Q &2bd9 d0 0a BNE &2be5 ; q_not_pressed &2bdb a9 d2 LDA #&d2 ; Read/Write sound suppression flag &2bdd a2 80 LDX #&80 &2bdf 20 f4 ff JSR &fff4 ; OSBYTE &2be2 4c cc 2b JMP &2bcc ; title_screen_loop ; q_not_pressed &2be5 e0 53 CPX #&53 ; S &2be7 d0 0a BNE &2bf3 ; s_not_pressed &2be9 a9 d2 LDA #&d2 ; Read/Write sound suppression flag &2beb a2 00 LDX #&00 &2bed 20 f4 ff JSR &fff4 ; OSBYTE &2bf0 4c cc 2b JMP &2bcc ; title_screen_loop ; s_not_pressed &2bf3 e0 20 CPX #&20 ; SPACE &2bf5 d0 d5 BNE &2bcc ; title_screen_loop &2bf7 20 f9 16 JSR &16f9 ; play_sound_for_velocity &2bfa 4c 9d 29 JMP &299d ; start_game ; start_demo &2bfd 20 f9 16 JSR &16f9 ; play_sound_for_velocity &2c00 a2 20 LDX #&20 &2c02 20 36 16 JSR &1636 ; set_velocity_pitch &2c05 a9 90 LDA #&90 ; SUPPRESS_ENEMY_FIRING | SUPPRESS_PLAYER_FIRING &2c07 85 b2 STA &b2 ; suppress_game_features_flags ; demo_mode_loop &2c09 a5 75 LDA &75 ; landscape_bottom_rock_start &2c0b e5 74 SBC &74 ; landscape_top_rock_end &2c0d 4a LSR A &2c0e 65 74 ADC &74 ; landscape_top_rock_end &2c10 c5 b3 CMP &b3 ; player_y # Demo player moves towards middle of canyon &2c12 b0 05 BCS &2c19 ; move_demo_player_up ; move_demo_player_down &2c14 c6 b3 DEC &b3 ; player_y &2c16 4c 1b 2c JMP &2c1b ; update_demo ; move_demo_player_up &2c19 e6 b3 INC &b3 ; player_y ; update_demo &2c1b 20 d1 21 JSR &21d1 ; reset_clock_and_consider_checking_for_player_firing &2c1e 20 07 20 JSR &2007 ; plot_landscape_after_vsync &2c21 a9 81 LDA #&81 ; Wait for input character &2c23 a2 01 LDX #&01 &2c25 a0 00 LDY #&00 &2c27 20 f4 ff JSR &fff4 ; OSBYTE &2c2a e0 1b CPX #&1b ; ESCAPE &2c2c f0 06 BEQ &2c34 ; end_demo &2c2e a5 bf LDA &bf ; player_damage &2c30 c9 99 CMP #&99 &2c32 d0 d5 BNE &2c09 ; demo_mode_loop ; end_demo &2c34 a9 f0 LDA #&f0 ; SUPPRESS_ENEMY_FIRING | SUPPRESS_WAITING_FOR_CLOCK | SUPPRESS_PLOTTING_PLAYER | SUPPRESS_PLAYER_FIRING &2c36 85 b2 STA &b2 ; suppress_game_features_flags &2c38 a9 32 LDA #&32 &2c3a 85 6f STA &6f ; count ; end_demo_column_loop &2c3c 20 d1 21 JSR &21d1 ; reset_clock_and_consider_checking_for_player_firing &2c3f 20 07 20 JSR &2007 ; plot_landscape_after_vsync &2c42 c6 6f DEC &6f ; count &2c44 d0 f6 BNE &2c3c ; end_demo_column_loop &2c46 4c 05 2b JMP &2b05 ; title_screen_after_reset ; move_for_title_screen_text_string # Stored backwards &2c49 02 3a 04 c0 04 19 ; MOVE &04c0, &023a ; press_space_to_start_string # Stored backwards &2c4f 54 52 41 54 53 20 4f 54 20 45 43 41 50 53 20 53 ; "PRESS SPACE TO START" &2c5f 53 45 52 50 ; or_wait_for_a_demo_string # Stored backwards &2c63 20 4f 4d 45 44 20 41 20 52 4f 46 20 54 49 41 57 ; " OR WAIT FOR A DEMO " &2c73 20 52 4f 20 ; backspace_and_down_three_lines_string &2c77 08 0a 0a 0a ; backspace_and_up_three_lines_string &2c7b 08 0b 0b 0b ; check_for_high_score &2c7f a9 14 LDA #&14 ; &1814 = high_score_tune_data &2c81 85 5e STA &5e ; tune_data_address_low &2c83 a9 18 LDA #&18 &2c85 85 5f STA &5f ; tune_data_address_high &2c87 a9 00 LDA #&00 &2c89 85 5d STA &5d ; tune_state # Set to zero to start tune &2c8b a2 00 LDX #&00 ; check_for_top_secret_loop &2c8d bd 03 11 LDA &1103,X ; high_scores + 3 &2c90 dd 7b 2e CMP &2e7b,X ; top_secret_string &2c93 d0 12 BNE &2ca7 ; not_top_secret # Is the top scorer "TOP-SECRET"? &2c95 e8 INX &2c96 e0 0a CPX #&0a &2c98 d0 f3 BNE &2c8d ; check_for_top_secret_loop &2c9a a2 00 LDX #&00 ; copy_top_secret_high_scores_loop &2c9c bd 85 2e LDA &2e85,X ; top_secret_high_scores # If so, replace top two scores with name of author &2c9f 9d 00 11 STA &1100,X ; high_scores &2ca2 e8 INX &2ca3 e0 20 CPX #&20 &2ca5 d0 f5 BNE &2c9c ; copy_top_secret_high_scores_loop ; not_top_secret &2ca7 a2 00 LDX #&00 &2ca9 e4 68 CPX &68 ; suppress_checking_for_high_score # Non-zero if demo mode or game was quit &2cab f0 04 BEQ &2cb1 ; check_for_high_score_rank_loop &2cad a2 a0 LDX #&a0 # Not a new high score &2caf d0 24 BNE &2cd5 ; set_new_high_score_offset # Always branches ; check_for_high_score_rank_loop &2cb1 bd 02 11 LDA &1102,X ; high_scores + 2 &2cb4 c5 c2 CMP &c2 ; score + 2 &2cb6 90 22 BCC &2cda ; new_high_score &2cb8 d0 12 BNE &2ccc ; consider_next_rank &2cba bd 01 11 LDA &1101,X ; high_scores + 1 &2cbd c5 c1 CMP &c1 ; score + 1 &2cbf 90 19 BCC &2cda ; new_high_score &2cc1 d0 09 BNE &2ccc ; consider_next_rank &2cc3 bd 00 11 LDA &1100,X ; high_scores &2cc6 c5 c0 CMP &c0 ; score &2cc8 90 10 BCC &2cda ; new_high_score &2cca f0 0e BEQ &2cda ; consider_next_rank ; consider_next_rank &2ccc 18 CLC &2ccd 8a TXA &2cce 69 10 ADC #&10 &2cd0 aa TAX &2cd1 e0 a0 CPX #&a0 &2cd3 d0 dc BNE &2cb1 ; check_for_high_score_rank_loop ; set_new_high_score_offset &2cd5 86 6b STX &6b ; new_high_score_offset &2cd7 4c 0d 2d JMP &2d0d ; not_new_high_score ; new_high_score &2cda 86 6b STX &6b ; new_high_score_offset &2cdc e0 90 CPX #&90 &2cde f0 10 BEQ &2cf0 ; skip_shuffling_high_scores ; shuffle_high_scores &2ce0 a0 9f LDY #&9f &2ce2 a2 8f LDX #&8f ; shuffle_high_scores_loop &2ce4 bd 00 11 LDA &1100,X ; high_scores &2ce7 99 00 11 STA &1100,Y ; high_scores &2cea ca DEX &2ceb 88 DEY &2cec e4 6b CPX &6b ; new_high_score_offset &2cee d0 f4 BNE &2ce4 ; shuffle_high_scores_loop ; skip_shuffling_high_scores &2cf0 a5 c0 LDA &c0 ; score &2cf2 9d 00 11 STA &1100,X ; high_scores # Copy score into high score slot &2cf5 e8 INX &2cf6 a5 c1 LDA &c1 ; score + 1 &2cf8 9d 00 11 STA &1100,X ; high_scores &2cfb e8 INX &2cfc a5 c2 LDA &c2 ; score + 2 &2cfe 9d 00 11 STA &1100,X ; high_scores &2d01 e8 INX &2d02 a0 0a LDY #&0a &2d04 a9 20 LDA #&20 ; " " ; blank_new_high_score_name_loop &2d06 9d 00 11 STA &1100,X ; high_scores # Blank name in high score slot &2d09 e8 INX &2d0a 88 DEY &2d0b d0 f9 BNE &2d06 ; blank_new_high_score_name_loop ; not_new_high_score &2d0d a9 ff LDA #&ff &2d0f 85 6c STA &6c ; high_score_text_offset &2d11 20 40 2e JSR &2e40 ; scroll_high_scores &2d14 a0 07 LDY #&07 ; write_move_for_high_scores_loop &2d16 b9 67 2e LDA &2e67,Y ; move_for_high_scores_string - 1 &2d19 20 ee ff JSR &ffee ; OSWRCH &2d1c 88 DEY &2d1d d0 f7 BNE &2d16 ; write_move_for_high_scores_loop &2d1f 20 40 2e JSR &2e40 ; scroll_high_scores &2d22 a9 31 LDA #&31 ; "1" ; write_rank_loop &2d24 20 2d 2e JSR &2e2d ; write_character_and_move_down # Write rank &2d27 18 CLC &2d28 69 01 ADC #&01 &2d2a c9 3a CMP #&3a ; "9" + 1 &2d2c d0 f6 BNE &2d24 ; write_rank_loop &2d2e a9 30 LDA #&30 ; "0" &2d30 20 2d 2e JSR &2e2d ; write_character_and_move_down # Write 0 for rank ten &2d33 20 40 2e JSR &2e40 ; scroll_high_scores &2d36 20 40 2e JSR &2e40 ; scroll_high_scores &2d39 a9 00 LDA #&00 &2d3b 85 6d STA &6d ; offset ; write_name_character_loop &2d3d a2 00 LDX #&00 ; write_name_rank_loop &2d3f 8a TXA &2d40 0a ASL A &2d41 0a ASL A &2d42 0a ASL A &2d43 0a ASL A &2d44 18 CLC &2d45 65 6d ADC &6d ; offset &2d47 a8 TAY &2d48 b9 03 11 LDA &1103,Y ; high_scores + 3 &2d4b 20 2d 2e JSR &2e2d ; write_character_and_move_down # Write high score name &2d4e e8 INX &2d4f e0 0a CPX #&0a &2d51 d0 ec BNE &2d3f ; write_name_rank_loop &2d53 20 40 2e JSR &2e40 ; scroll_high_scores &2d56 e6 6d INC &6d ; offset &2d58 a5 6d LDA &6d ; offset &2d5a c9 0a CMP #&0a &2d5c d0 df BNE &2d3d ; write_name_character_loop &2d5e a9 02 LDA #&02 &2d60 8d 6c 2d STA &2d6c ; high_scores_tens_address_low &2d63 8d 87 2d STA &2d87 ; high_scores_ones_address_low ; write_high_scores_loop &2d66 20 40 2e JSR &2e40 ; scroll_high_scores &2d69 a2 00 LDX #&00 ; write_tens_loop &2d6b bd 02 11 LDA &1102,X ; high_scores + 2 # actually LDA high_scores_tens_address &2d6e 4a LSR A &2d6f 4a LSR A &2d70 4a LSR A &2d71 4a LSR A &2d72 18 CLC &2d73 69 30 ADC #&30 ; "0" &2d75 20 2d 2e JSR &2e2d ; write_character_and_move_down # Write score tens &2d78 8a TXA &2d79 18 CLC &2d7a 69 10 ADC #&10 &2d7c aa TAX &2d7d e0 a0 CPX #&a0 &2d7f d0 ea BNE &2d6b ; write_tens_loop &2d81 20 40 2e JSR &2e40 ; scroll_high_scores &2d84 a2 00 LDX #&00 ; write_ones_loop &2d86 bd 02 11 LDA &1102,X ; high_scores + 2 # actually LDA high_scores_ones_address &2d89 29 0f AND #&0f &2d8b 18 CLC &2d8c 69 30 ADC #&30 ; "0" &2d8e 20 2d 2e JSR &2e2d ; write_character_and_move_down # Write score ones &2d91 8a TXA &2d92 18 CLC &2d93 69 10 ADC #&10 &2d95 aa TAX &2d96 e0 a0 CPX #&a0 &2d98 d0 ec BNE &2d86 ; write_ones_loop &2d9a ce 6c 2d DEC &2d6c ; high_scores_tens_address_low &2d9d ce 87 2d DEC &2d87 ; high_scores_ones_address_low &2da0 ad 87 2d LDA &2d87 ; high_scores_ones_address_low &2da3 c9 ff CMP #&ff &2da5 d0 bf BNE &2d66 ; write_high_scores_loop &2da7 a5 6b LDA &6b ; new_high_score_offset &2da9 c9 a0 CMP #&a0 &2dab d0 09 BNE &2db6 ; prompt_for_name # Was there a new high score? &2dad a9 81 LDA #&81 ; Wait for input character &2daf a2 00 LDX #&00 &2db1 a0 03 LDY #&03 &2db3 4c f4 ff JMP &fff4 ; OSBYTE # If not, wait 7.68s or until key is pressed ; prompt_for_name &2db6 a0 06 LDY #&06 ; write_move_for_new_high_score_name_loop &2db8 b9 6e 2e LDA &2e6e,Y ; move_for_new_high_score_name_string - 1 &2dbb 20 ee ff JSR &ffee ; OSWRCH &2dbe 88 DEY &2dbf d0 f7 BNE &2db8 ; write_move_for_new_high_score_name_loop &2dc1 a5 6b LDA &6b ; new_high_score_offset ; move_down_to_rank_loop &2dc3 c9 00 CMP #&00 &2dc5 f0 10 BEQ &2dd7 ; write_deletes &2dc7 48 PHA ; offset &2dc8 a9 0a LDA #&0a ; move cursor down one line &2dca 20 ee ff JSR &ffee ; OSWRCH # Move down to rank for new high score &2dcd 20 ee ff JSR &ffee ; OSWRCH &2dd0 68 PLA ; offset &2dd1 38 SEC &2dd2 e9 10 SBC #&10 &2dd4 4c c3 2d JMP &2dc3 ; move_down_to_rank_loop ; write_deletes &2dd7 a9 7f LDA #&7f ; DELETE &2dd9 a2 0a LDX #&0a ; write_deletes_loop &2ddb 20 ee ff JSR &ffee ; OSWRCH # Move back to start of name &2dde ca DEX &2ddf d0 fa BNE &2ddb ; write_deletes_loop &2de1 a5 6b LDA &6b ; new_high_score_offset &2de3 18 CLC &2de4 69 03 ADC #&03 ; &1103 = high_scores + 3 &2de6 8d 0d 2e STA &2e0d ; name_address_for_reading_low &2de9 8d 1a 2e STA &2e1a ; name_address_for_padding_low &2dec a9 11 LDA #&11 &2dee 69 00 ADC #&00 &2df0 8d 0e 2e STA &2e0e ; name_address_for_reading_high &2df3 8d 1b 2e STA &2e1b ; name_address_for_padding_high ; get_character &2df6 20 e0 ff JSR &ffe0 ; OSRDCH &2df9 c9 0d CMP #&0d ; CR &2dfb f0 16 BEQ &2e13 ; pad_name &2dfd c9 20 CMP #&20 ; " " &2dff 90 f5 BCC &2df6 ; get_character &2e01 c9 7f CMP #&7f ; DELETE &2e03 f0 1b BEQ &2e20 ; delete_character &2e05 e0 0a CPX #&0a ; NL &2e07 f0 ed BEQ &2df6 ; get_character &2e09 20 ee ff JSR &ffee ; OSWRCH # Write entered character of name &2e0c 9d ff ff STA &ffff,X # actually STA name_address_for_reading,X &2e0f e8 INX &2e10 4c f6 2d JMP &2df6 ; get_character ; pad_name &2e13 a9 20 LDA #&20 ; " " ; pad_name_loop &2e15 e0 0a CPX #&0a &2e17 f0 06 BEQ &2e1f ; leave &2e19 9d ff ff STA &ffff,X # actually STA name_address_for_padding,X &2e1c e8 INX &2e1d d0 f6 BNE &2e15 ; pad_name_loop ; leave &2e1f 60 RTS ; delete_character &2e20 e0 00 CPX #&00 &2e22 f0 d2 BEQ &2df6 ; get_character &2e24 ca DEX &2e25 a9 7f LDA #&7f ; DELETE &2e27 20 ee ff JSR &ffee ; OSWRCH &2e2a 4c f6 2d JMP &2df6 ; get_character ; write_character_and_move_down &2e2d 48 PHA ; tmp_a &2e2e 20 ee ff JSR &ffee ; OSWRCH &2e31 a9 08 LDA #&08 ; move cursor left one character &2e33 20 ee ff JSR &ffee ; OSWRCH &2e36 a9 0a LDA #&0a ; move cursor down one line &2e38 20 ee ff JSR &ffee ; OSWRCH &2e3b 20 ee ff JSR &ffee ; OSWRCH &2e3e 68 PLA ; tmp_a &2e3f 60 RTS ; scroll_high_scores &2e40 a9 04 LDA #&04 &2e42 85 6f STA &6f ; count ; scroll_high_scores_loop &2e44 20 d1 21 JSR &21d1 ; reset_clock_and_consider_checking_for_player_firing &2e47 20 07 20 JSR &2007 ; plot_landscape_after_vsync &2e4a c6 6f DEC &6f ; count &2e4c d0 f6 BNE &2e44 ; scroll_high_scores_loop &2e4e a0 06 LDY #&06 ; write_move_for_eagle_high_scores_loop &2e50 b9 74 2e LDA &2e74,Y ; move_for_eagle_high_scores_string - 1 &2e53 20 ee ff JSR &ffee ; OSWRCH &2e56 88 DEY &2e57 d0 f7 BNE &2e50 ; write_move_for_eagle_high_scores_loop &2e59 e6 6c INC &6c ; high_score_text_offset &2e5b a6 6c LDX &6c ; high_score_text_offset &2e5d bd a0 11 LDA &11a0,X ; eagle_high_scores_string &2e60 20 2d 2e JSR &2e2d ; write_character_and_move_down &2e63 a9 09 LDA #&09 ; move cursor right one character &2e65 4c 2d 2e JMP &2e2d ; write_character_and_move_down ; move_for_high_scores_string # Stored backwards &2e68 31 ; "1" &2e69 00 e0 04 c0 04 19 ; MOVE &04c0, &00e0 ; move_for_new_high_score_name_string # Stored backwards &2e6f 03 20 03 40 04 19 ; MOVE &0340, &0320 ; move_for_eagle_high_scores_string # Stored backwards &2e75 03 a0 04 c0 04 19 ; MOVE &04c0, &03a0 ; top_secret_string &2e7b 54 4f 50 2d 53 45 43 52 45 54 ; "TOP-SECRET" ; top_secret_high_scores &2e85 00 00 02 ; 20000 &2e88 4d 2e 42 6f 74 74 2d 4f 62 69 ; "M.Bott-Obi" &2e92 00 00 00 &2e95 00 00 02 ; 20000 &2e98 20 28 43 29 20 31 39 38 34 20 ; " (C) 1984 " &2ea2 00 00 00 ; unused &2ea5 00 00 01 ; 10000 &2ea8 20 28 43 29 20 31 39 38 34 20 ; " (C) 1984 " ; unused # &2eb2 - &2f56 is similar to &2dc3 - &2e67 &2eb2 c9 00 CMP #&00 &2eb4 f0 10 BEQ &2ec6 &2eb6 48 PHA &2eb7 a9 0a LDA #&0a &2eb9 20 ee ff JSR &ffee ; OSWRCH &2ebc 20 ee ff JSR &ffee ; OSWRCH &2ebf 68 PLA &2ec0 38 SEC &2ec1 e9 10 SBC #&10 &2ec3 4c b2 2e JMP &2eb2 &2ec6 a9 7f LDA #&7f &2ec8 a2 0a LDX #&0a &2eca 20 ee ff JSR &ffee ; OSWRCH &2ecd ca DEX &2ece d0 fa BNE &2eca &2ed0 a5 6b LDA &6b &2ed2 18 CLC &2ed3 69 03 ADC #&03 &2ed5 8d fc 2e STA &2efc &2ed8 8d 09 2f STA &2f09 &2edb a9 11 LDA #&11 &2edd 69 00 ADC #&00 &2edf 8d fd 2e STA &2efd &2ee2 8d 0a 2f STA &2f0a &2ee5 20 e0 ff JSR &ffe0 ; OSRDCH &2ee8 c9 0d CMP #&0d &2eea f0 16 BEQ &2f02 &2eec c9 20 CMP #&20 &2eee 90 f5 BCC &2ee5 &2ef0 c9 7f CMP #&7f &2ef2 f0 1b BEQ &2f0f &2ef4 e0 0a CPX #&0a &2ef6 f0 ed BEQ &2ee5 &2ef8 20 ee ff JSR &ffee ; OSWRCH &2efb 9d ff ff STA &ffff,X &2efe e8 INX &2eff 4c e5 2e JMP &2ee5 &2f02 a9 20 LDA #&20 &2f04 e0 0a CPX #&0a &2f06 f0 06 BEQ &2f0e &2f08 9d ff ff STA &ffff,X &2f0b e8 INX &2f0c d0 f6 BNE &2f04 &2f0e 60 RTS &2f0f e0 00 CPX #&00 &2f11 f0 d2 BEQ &2ee5 &2f13 ca DEX &2f14 a9 7f LDA #&7f &2f16 20 ee ff JSR &ffee ; OSWRCH &2f19 4c e5 2e JMP &2ee5 # &2e2a 4c f6 2d JMP &2df6 ; get_character &2f1c 48 PHA &2f1d 20 ee ff JSR &ffee ; OSWRCH &2f20 a9 08 LDA #&08 &2f22 20 ee ff JSR &ffee ; OSWRCH &2f25 a9 0a LDA #&0a &2f27 20 ee ff JSR &ffee ; OSWRCH &2f2a 20 ee ff JSR &ffee ; OSWRCH &2f2d 68 PLA &2f2e 60 RTS &2f2f a9 04 LDA #&04 &2f31 85 6f STA &6f &2f33 20 09 23 JSR &2309 # &2e44 20 d1 21 JSR &21d1 ; reset_clock_and_consider_checking_for_player_firing &2f36 20 40 21 JSR &2140 # &2e47 20 07 20 JSR &2007 ; plot_landscape_after_vsync &2f39 c6 6f DEC &6f &2f3b d0 f6 BNE &2f33 &2f3d a0 06 LDY #&06 &2f3f b9 63 2f LDA &2f63,Y # &2e50 b9 74 2e LDA &2e74,Y ; move_for_eagle_high_scores_string - 1 &2f42 20 ee ff JSR &ffee ; OSWRCH &2f45 88 DEY &2f46 d0 f7 BNE &2f3f &2f48 e6 6c INC &6c ; high_score_text_offset &2f4a a6 6c LDX &6c ; high_score_text_offset &2f4c bd a0 11 LDA &11a0,X ; eagle_high_scores_string &2f4f 20 1c 2f JSR &2f1c # &2e60 20 2d 2e JSR &2e2d ; write_character_and_move_down &2f52 a9 09 LDA #&09 &2f54 4c 1c 2f JMP &2f1c # &2e65 4c 2d 2e JMP &2e2d ; write_character_and_move_down ; unused # &2f57 - &2fa0 is similar to &2e68 - &2eb1 &2f57 31 ; "1" &2f58 00 e0 04 c0 04 19 ; MOVE &04c0, &00e0 &2f5e 03 20 03 40 04 19 ; MOVE &0340, &0320 &2f64 03 a0 04 c0 04 19 ; MOVE &04c0, &03a0 &2f6a 54 4f 50 2d 53 45 43 52 45 54 ; "TOP-SECRET" &2f74 00 00 01 ; 10000 # &2e85 00 00 02 ; 20000 &2f77 4d 2e 42 6f 74 74 2d 4f 62 69 ; "M.Bott-Obi" &2f81 00 00 00 &2f84 00 00 01 ; 10000 # &2e95 00 00 02 ; 20000 &2f87 53 2e 43 68 65 73 68 69 72 65 ; "S.Cheshire"# &2e98 20 28 43 29 20 31 39 38 34 20 ; " (C) 1984 " &2f91 00 00 00 &2f94 00 00 01 ; 10000 &2f97 20 28 43 29 20 31 39 38 34 20 ; " (C) 1984 " ; unused # Unused code &2fa1 89 ... &89 ; target_y &2fa2 86 83 STX &83 ; target_slot &2fa4 a6 82 LDX &82 ; target_type &2fa6 a5 88 LDA &88 ; target_x &2fa8 38 SEC &2fa9 e9 03 SBC #&03 &2fab 85 76 STA &76 ; target_min_x &2fad a5 89 LDA &89 ; target_y &2faf 38 SEC &2fb0 e9 03 SBC #&03 &2fb2 85 77 STA &77 ; target_min_y &2fb4 bd 08 04 LDA &0408,X ; sprite_widths_table + 8 &2fb7 0a ASL A &2fb8 65 88 ADC &88 ; target_x &2fba 69 03 ADC #&03 &2fbc 85 78 STA &78 ; target_max_x &2fbe bd 1c 04 LDA &041c,X ; sprite_heights_table + 8 &2fc1 65 89 ADC &89 ; target_y &2fc3 69 03 ADC #&03 &2fc5 85 79 STA &79 ; target_max_y &2fc7 a2 00 LDX #&00 ; check_for_collision_with_enemy_projectiles_loop &2fc9 bd 00 06 LDA &0600,X ; enemy_projectiles_state # Non-zero if projectile in slot &2fcc d0 07 BNE &2fd5 ; check_for_collision_with_enemy_projectile &2fce e8 INX &2fcf e0 0a CPX #&0a &2fd1 d0 f6 BNE &2fc9 ; check_for_collision_with_enemy_projectiles_loop &2fd3 f0 1e BEQ &2ff3 ; unclear_partial_unused_code # Always branches ; check_for_collision_with_enemy_projectile &2fd5 bd 14 06 LDA &0614,X ; enemy_projectiles_x &2fd8 c5 76 CMP &76 ; target_min_x &2fda 90 14 BCC &2ff0 ; no_collision &2fdc c5 78 CMP &78 ; target_max_x &2fde b0 10 BCS &2ff0 ; no_collision &2fe0 bd 1e 06 LDA &061e,X ; enemy_projectiles_y &2fe3 c5 77 CMP &77 ; target_min_y &2fe5 90 09 BCC &2ff0 ; no_collision &2fe7 c5 79 CMP &79 ; target_max_y &2fe9 b0 05 BCS &2ff0 ; no_collision ; collision &2feb a6 83 LDX &83 ; target_slot &2fed 4c 70 28 JMP &2870 ; no_collision &2ff0 4c ce 28 JMP &28ce ; unclear_partial_unused_code &2ff3 a6 82 LDX &82 ; target_slot &2ff5 bd 26 05 LDA &0526,X &2ff8 85 85 STA &85 &2ffa bd 2b 05 LDA &052b,X &2ffd 85 86 STA &86 &2fff bd LDA &....,X # &3000 - &3dff is moved to &0400 - &11ff at &32b0 ; sprite_widths_table ; 1 2 3 4 5 6 7 8 9 a b c d e f 10 11 12 13 14 &0400 04 04 05 05 05 02 01 03 05 07 04 04 04 12 05 05 05 05 06 06 ; sprite_heights_table ; 1 2 3 4 5 6 7 8 9 a b c d e f 10 11 12 13 14 &0414 09 09 09 0b 0b 07 03 07 0b 0f 08 08 08 0c 3c 09 10 0a 0f 0f ; sprite_addresses_low_table ; 1 2 3 4 5 6 7 8 9 a b c d e f 10 11 12 13 14 &0428 00 48 90 ea ea 8f ab ae c3 fa 63 83 a3 c3 9b c7 f4 44 76 d0 ; sprite_addresses_high_table ; 1 2 3 4 5 6 7 8 9 a b c d e f 10 11 12 13 14 &043c 09 09 09 09 09 0a 0a 0a 0a 0a 0b 0b 0b 0b 0c 0d 0d 0e 0e 0e ; buffer_addresses_low_table ; 1 2 3 4 5 6 &0450 24 6c bd 21 58 9d ; buffer_addresses_high_table ; 1 2 3 4 5 6 &0456 09 09 09 0a 0a 0a ; sprites_previous_x &045c 00 00 00 00 00 00 ; sprites_previous_y &0462 99 05 00 00 00 00 # Plane scoring # ============= # &01 (PLANE_TYPE_UP) scores 500 # &02 (PLANE_TYPE_DOWN) scores 500 # &03 (PLANE_TYPE_RIGHT) scores 1000 # &04 (PLANE_TYPE_SISTER) scores 0 ; planes_scoring_low_table &0468 00 00 00 00 ; planes_scoring_high_table &046c 05 05 10 00 # Ground enemy scoring # ==================== # &01 (ENEMY_TYPE_SAM_DOWN) scores 250 # &02 (ENEMY_TYPE_SAM_LEFT) scores 250 # &03 (ENEMY_TYPE_SAM_UP) scores 250 # &04 (ENEMY_TYPE_SHIP_HORIZONTAL) scores 1500 # &05 (ENEMY_TYPE_SHIP_VERTICAL) scores 2500 # &06 (ENEMY_TYPE_PILLBOX) scores 750 # &07 (ENEMY_TYPE_BRIDGE_MIDDLE) scores 200 # &08 (ENEMY_TYPE_BRIDGE_END) scores 200 # &09 (ENEMY_TYPE_SILO) scores 2000 # &0a (ENEMY_TYPE_COMMAND_CENTRE) scores 8000 ; enemy_types_scoring_low_table ; 1 2 3 4 5 6 7 8 9 a &0470 50 50 50 00 00 50 00 00 00 00 ; enemy_types_scoring_high_table &047a 02 02 02 15 25 07 02 02 20 80 ; minimum_world_x_high_for_planes_table ; 1 2 3 4 &0484 0a 0a 14 00 ; unused &0488 01 ; plane_destruction_probability_table # If &1d42 were AND &0487,X, this would be ; 1 2 3 4 # 1 2 3 4 &0489 01 07 07 # &0488 01 01 07 07 ; starting_world_x_for_features_table &048c 04 ; &01 (ENEMY_TYPE_SAM_DOWN) after 4 km (unused) &048d 04 ; &02 (ENEMY_TYPE_SAM_LEFT) after 4 km &048e 04 ; &03 (ENEMY_TYPE_SAM_UP) after 4 km (unused) &048f 0a ; &04 (ENEMY_TYPE_SHIP_HORIZONTAL) after 10 km &0490 12 ; &05 (ENEMY_TYPE_SHIP_VERTICAL) after 18 km &0491 00 ; &06 (ENEMY_TYPE_PILLBOX) from start &0492 08 ; &07 (ENEMY_TYPE_BRIDGE_MIDDLE) after 8 km &0493 08 ; &08 (ENEMY_TYPE_BRIDGE_END) after 8 km &0494 28 ; &09 (ENEMY_TYPE_SILO) after 40 km &0495 50 ; &0a (ENEMY_TYPE_COMMAND_CENTRE) after 80 km ; enemy_types_destruction_probability_table &0496 00 ; &01 (ENEMY_TYPE_SAM_DOWN) always destroyed &0497 00 ; &02 (ENEMY_TYPE_SAM_LEFT) always destroyed &0498 00 ; &03 (ENEMY_TYPE_SAM_UP) always destroyed &0499 07 ; &04 (ENEMY_TYPE_SHIP_HORIZONTAL) 1 in 8 hits &049a 0f ; &05 (ENEMY_TYPE_SHIP_VERTICAL) 1 in 16 hits &049b 01 ; &06 (ENEMY_TYPE_PILLBOX) 1 in 2 hits &049c 00 ; &07 (ENEMY_TYPE_BRIDGE_MIDDLE) always destroyed &049d 00 ; &08 (ENEMY_TYPE_BRIDGE_END) always destroyed &049e 1f ; &09 (ENEMY_TYPE_SILO) 1 in 32 hits &049f 1f ; &0a (ENEMY_TYPE_COMMAND_CENTRE) 1 in 32 hits ; enemy_types_number_of_ranges_table &04a0 01 ; &01 (ENEMY_TYPE_SAM_DOWN) &04a1 01 ; &02 (ENEMY_TYPE_SAM_LEFT) &04a2 01 ; &03 (ENEMY_TYPE_SAM_UP) &04a3 02 ; &04 (ENEMY_TYPE_SHIP_HORIZONTAL) &04a4 02 ; &05 (ENEMY_TYPE_SHIP_VERTICAL) &04a5 04 ; &06 (ENEMY_TYPE_PILLBOX) ; enemy_types_maximum_firing_distance_table &04a6 32 ; &01 (ENEMY_TYPE_SAM_DOWN) &04a7 32 ; &02 (ENEMY_TYPE_SAM_LEFT) &04a8 32 ; &03 (ENEMY_TYPE_SAM_UP) &04a9 64 ; &04 (ENEMY_TYPE_SHIP_HORIZONTAL) &04aa 64 ; &05 (ENEMY_TYPE_SHIP_VERTICAL) &04ab 4b ; &06 (ENEMY_TYPE_PILLBOX) ; enemy_types_initial_projectile_state_table # Top bit set if homing projectile &04ac 8d ; &01 (ENEMY_TYPE_SAM_DOWN) # Homing, time to live = &0d &04ad 8d ; &02 (ENEMY_TYPE_SAM_LEFT) # Homing, time to live = &0d &04ae 8d ; &03 (ENEMY_TYPE_SAM_UP) # Homing, time to live = &0d &04af 9d ; &04 (ENEMY_TYPE_SHIP_HORIZONTAL) # Homing, time to live = &1d &04b0 9d ; &05 (ENEMY_TYPE_SHIP_VERTICAL) # Homing, time to live = &1d &04b1 50 ; &06 (ENEMY_TYPE_PILLBOX) # Regular, time to live = &10 ; enemy_types_first_firing_offset_table &04b2 00 ; &01 (ENEMY_TYPE_SAM_DOWN) &04b3 04 ; &02 (ENEMY_TYPE_SAM_LEFT) &04b4 08 ; &03 (ENEMY_TYPE_SAM_UP) &04b5 0c ; &04 (ENEMY_TYPE_SHIP_HORIZONTAL) &04b6 14 ; &05 (ENEMY_TYPE_SHIP_VERTICAL) &04b7 1c ; &06 (ENEMY_TYPE_PILLBOX) ; firing_offsets_table ; xo yo a- a+ &04b8 00 07 26 2a ; &00 (ENEMY_TYPE_SAM_DOWN) &04bc 00 03 2e 32 ; &04 (ENEMY_TYPE_SAM_LEFT) &04c0 00 00 36 3a ; &08 (ENEMY_TYPE_SAM_UP) &04c4 1d 00 3e 01 ; &0c (ENEMY_TYPE_SHIP_HORIZONTAL) # Two ranges &04c8 1d 0b 1e 21 ; &10 &04cc 00 11 2e 32 ; &14 (ENEMY_TYPE_SHIP_VERTICAL) # Two ranges &04d0 09 11 0e 12 ; &18 &04d4 00 04 2e 31 ; &1c (ENEMY_TYPE_PILLBOX) # Four ranges &04d8 04 08 1e 21 ; &20 &04dc 08 04 0e 11 ; &21 &04e0 04 00 3e 01 ; &22 ; enemy_types_explosion_state_table ; 1 2 3 4 5 6 7 8 9 a &04e4 90 90 90 b0 b0 b0 90 90 b0 b0 ; enemy_types_explosion_x_offset_table ; 1 2 3 4 5 6 7 8 9 a &04ee 01 01 01 0c 02 02 02 02 02 02 ; enemy_types_explosion_y_offset_table ; 1 2 3 4 5 6 7 8 9 a &04f8 02 02 02 05 11 03 07 03 06 06 ; planes_initial_x ; 1 2 3 4 &0502 82 82 08 90 ; planes_initial_y ; 1 2 3 4 &0506 f5 08 7c 7c ; planes_initial_x_velocity ; 1 2 3 4 &050a fe fe 02 fd ; planes_y_velocity_minus ; 1 2 3 4 &050e 03 00 00 00 ; planes_y_velocity_plus ; 1 2 3 4 &0512 00 03 00 00 ; planes_projectile_angle ; 1 2 3 &0516 00 20 10 ; planes_projectile_x_offset ; 1 2 3 &0519 03 03 0e ; planes_projectile_y_offset ; 1 2 3 &051c fa 0d 04 ; group_offsets_low_table &051f 00 80 00 80 00 80 00 80 00 80 00 80 00 80 00 80 00 80 00 80 00 80 00 80 00 80 00 80 00 80 00 80 ; group_offsets_high_table &053f 00 02 05 07 0a 0c 0f 11 14 16 19 1b 1e 20 23 25 28 2a 2d 2f 32 34 37 39 3c 3e 41 43 46 48 4b 4d ; pixel_offsets_table ; 0 1 2 3 4 5 6 7 8 9 a b c d e f 10 &055f 00 01 02 03 04 05 06 06 07 08 08 09 09 0a 0a 0a 0a &0570 00 01 02 03 03 04 05 06 06 07 07 08 08 09 09 09 09 &0581 00 01 02 02 03 04 04 05 06 06 07 07 07 08 08 08 08 &0592 00 01 01 02 03 03 04 04 05 05 06 06 06 07 07 07 07 ; tan_table # &100 * TAN(RAD((-0.5 + X) * 45 / 8)) ; 1 2 3 4 5 6 7 8 &05a3 0d 26 40 5c 79 99 be e8 ; sine_table # &100 * SIN(RAD(X * 45 / 8)) ; 1 2 3 4 5 6 7 8 9 a b c d e f &05ab 19 32 4a 62 79 8e a2 b5 c6 d5 e2 ed f5 fb ff ; unused &05ba 00 0f ; movement_keys &05bc a6 ; DELETE &05bd 96 ; COPY &05be be ; A &05bf 9e ; Z ; firing_keys &05c0 b6 ; RETURN &05c1 ff ; SHIFT &05c2 9f ; TAB ; unused &05c3 00 02 00 00 00 00 00 00 00 ; planes_state ; 1 2 3 4 &05cc 00 00 00 00 ; planes_x ; 1 2 3 4 &05d0 00 00 00 00 ; planes_y ; 1 2 3 4 &05d4 00 00 00 00 ; planes_firing_cooldown ; 1 2 3 4 &05d8 00 00 00 00 ; planes_x_velocity ; 1 2 3 4 &05dc 00 00 00 00 ; unused &05e0 00 ; variables_backup &05e1 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &05f1 00 00 00 00 00 00 00 00 00 00 00 ; unused &05fc 00 00 ; tmp_x_for_irq2_handler &05fe 00 ; tmp_y_for_irq2_handler &05ff 00 # &3200 - &32c3 is used unrelocated ; entry_point &3200 78 SEI &3201 a9 12 LDA #&12 ; &1200 &3203 85 73 STA &73 ; source_address_high &3205 a2 00 LDX #&00 &3207 86 72 STX &72 ; source_address_low ; decrypt_1200_to_2fff_page_loop # Decrypt &1200 - &2fff &3209 a0 00 LDY #&00 ; decrypt_1200_to_2fff_byte_loop &320b b1 72 LDA (&72),Y ; source_address &320d 4a LSR A &320e 90 02 BCC &3212 ; not_set &3210 09 80 ORA #&80 ; not_set &3212 5d f0 6f EOR &6ff0,X ; decryption_key # Set at line 15 of Eagle-Wing and &7540 of 1.EAGLE &3215 91 72 STA (&72),Y ; source_address &3217 e8 INX &3218 e0 07 CPX #&07 &321a d0 02 BNE &321e ; skip_wraparound &321c a2 00 LDX #&00 ; skip_wraparound &321e c8 INY &321f d0 ea BNE &320b ; decrypt_1200_to_2fff_byte_loop &3221 e6 73 INC &73 ; source_address_high &3223 a5 73 LDA &73 ; source_address_high &3225 c9 30 CMP #&30 &3227 d0 e0 BNE &3209 ; decrypt_1200_to_2fff_page_loop &3229 78 SEI &322a a9 68 LDA #&68 ; &1868 = event_handler &322c 8d 20 02 STA &0220 ; event_vector_low &322f a9 18 LDA #&18 &3231 8d 21 02 STA &0221 ; event_vector_high &3234 a9 55 LDA #&55 ; &2055 = irq2_handler &3236 8d 06 02 STA &0206 ; irq2_vector_low &3239 a9 20 LDA #&20 &323b 8d 07 02 STA &0207 ; irq2_vector_high &323e a9 00 LDA #&00 &3240 8d 6b fe STA &fe6b ; User VIA auxiliary control register # Set timer 2 to one-shot mode &3243 8d 6c fe STA &fe6c ; User VIA peripheral control register &3246 a9 ff LDA #&ff # Clear all interrupts &3248 8d 6d fe STA &fe6d ; User VIA interrupt flag register &324b a9 a0 LDA #&a0 # Enable User VIA timer 2 interrupts &324d 8d 6e fe STA &fe6e ; User VIA interrupt enable register &3250 a9 4c LDA #&4c ; &134c = irq1_handler &3252 8d 04 02 STA &0204 ; irq1_vector_low &3255 a9 13 LDA #&13 &3257 8d 05 02 STA &0205 ; irq1_vector_high &325a a9 77 LDA #&77 ; Close all Spool/Exec files &325c a2 00 LDX #&00 &325e a0 00 LDY #&00 &3260 20 f4 ff JSR &fff4 ; OSBYTE &3263 a9 8c LDA #&8c ; Select Tape FS &3265 a2 00 LDX #&00 ; default speed &3267 a0 00 LDY #&00 &3269 20 f4 ff JSR &fff4 ; OSBYTE &326c a9 90 LDA #&90 ; Set TV offset and interlacing &326e a2 ff LDX #&ff &3270 a0 00 LDY #&00 &3272 20 f4 ff JSR &fff4 ; OSBYTE &3275 a9 0b LDA #&0b ; Set auto-repeat delay &3277 a2 00 LDX #&00 ; disable auto-repeat &3279 a0 00 LDY #&00 &327b 20 f4 ff JSR &fff4 ; OSBYTE &327e a9 e5 LDA #&e5 ; Read/Write ESCAPE key status &3280 a2 01 LDX #&01 ; ESCAPE inserts ASCII value &3282 a0 00 LDY #&00 &3284 20 f4 ff JSR &fff4 ; OSBYTE &3287 a9 0f LDA #&0f ; Flush all buffers &3289 a2 00 LDX #&00 ; all buffers &328b a0 00 LDY #&00 &328d 20 f4 ff JSR &fff4 ; OSBYTE &3290 a9 04 LDA #&04 ; Define action of cursor editing keys &3292 a2 02 LDX #&02 ; Cursor keys become soft keys 11-15 &3294 a0 00 LDY #&00 &3296 20 f4 ff JSR &fff4 ; OSBYTE &3299 a9 e1 LDA #&e1 ; Read/Write Interpretation of F-Keys &329b a2 00 LDX #&00 ; ignore &329d a0 00 LDY #&00 &329f 20 f4 ff JSR &fff4 ; OSBYTE &32a2 a0 00 LDY #&00 &32a4 84 76 STY &76 ; source_address_low &32a6 84 78 STY &78 ; target_address_low &32a8 a9 30 LDA #&30 &32aa 85 77 STA &77 ; source_address_high &32ac a9 04 LDA #&04 &32ae 85 79 STA &79 ; target_address_high ; move_3000_to_3dff_loop # Move &3000 - &3dff to &0400 - &11ff &32b0 b1 76 LDA (&76),Y ; source_address &32b2 91 78 STA (&78),Y ; target_address &32b4 c8 INY &32b5 d0 f9 BNE &32b0 ; move_3000_to_3dff_loop &32b7 e6 77 INC &77 ; source_address_high &32b9 e6 79 INC &79 ; target_address_high &32bb a5 79 LDA &79 ; target_address_high &32bd c9 12 CMP #&12 &32bf d0 ef BNE &32b0 ; move_3000_to_3dff_loop &32c1 4c c4 06 JMP &06c4 ; initialise_screen # After relocation, &0600 - &0795 is used as follows: # # &0600 - &0609 ; enemy_projectiles_state # &060a - &0613 ; enemy_projectiles_angle # &0614 - &061d ; enemy_projectiles_x # &061e - &0627 ; enemy_projectiles_y # &0628 - &064f ; enemy_projectiles_screen_addresses_low # &0650 - &0677 ; enemy_projectiles_screen_addresses_high # &0678 - &069f ; enemy_projectiles_buffer # &06a0 - &06ab ; player_projectiles_state # &06ac - &06b7 ; player_projectiles_x # &06b8 - &06c3 ; player_projectiles_screen_x # &06c4 - &06cf ; player_projectiles_y # &06d0 - &06db ; player_projectiles_screen_address_low # &06dc - &06e7 ; player_projectiles_screen_address_high # &06e8 - &06f3 ; player_projectiles_left_buffer # &06f4 - &06ff ; player_projectiles_right_buffer # &0700 - &0713 ; enemies_state # &0714 - &0727 ; enemies_x # &0728 - &073b ; enemies_y # &073c - &074f ; enemies_type_for_explosion # &0750 - &0763 ; enemies_secondary_x # &0764 - &0777 ; enemies_secondary_y # &0778 - &0781 ; features_type # &0782 - &078b ; features_y # &078c - &0795 ; features_x_offset ; initialise_screen ; initialise_variables_for_screen_loop &06c4 b9 1d 07 LDA &071d,Y ; initial_variables_for_screen &06c7 8d cf 06 STA &06cf ; variable_address &06ca c8 INY &06cb b9 1d 07 LDA &071d,Y ; initial_variables_for_screen &06ce 85 ff STA &ff # actually STA variable_address &06d0 c8 INY &06d1 c0 0a CPY #&0a &06d3 d0 ef BNE &06c4 ; initialise_variables_for_screen_loop &06d5 58 CLI &06d6 a9 0e LDA #&0e ; Enable event &06d8 a2 04 LDX #&04 ; v-sync events &06da a0 00 LDY #&00 &06dc 20 f4 ff JSR &fff4 ; OSBYTE &06df a0 00 LDY #&00 ; write_initialise_screen_loop &06e1 b9 60 07 LDA &0760,Y ; initialise_screen_string # Plot red star &06e4 20 ee ff JSR &ffee ; OSWRCH &06e7 c8 INY &06e8 c0 9a CPY #&9a &06ea d0 f5 BNE &06e1 ; write_initialise_screen_loop &06ec a9 81 LDA #&81 ; Wait for input character &06ee a2 00 LDX #&00 &06f0 a0 02 LDY #&02 &06f2 20 f4 ff JSR &fff4 ; OSBYTE # Wait 5.12s &06f5 a9 03 LDA #&03 ; Read interval timer &06f7 a2 29 LDX #&29 &06f9 a0 12 LDY #&12 &06fb 20 f1 ff JSR &fff1 ; OSWORD &06fe a9 60 LDA #&60 ; RTS # Unnecessary code &0700 8d 29 12 STA &1229 ; rnd_leave # &0703 a9 0a LDA #&0a ; R10: Cursor start register &0705 a2 ff LDX #&ff # Disable cursor by setting start line to 15 &0707 8d 00 fe STA &fe00 ; video register number &070a 8e 01 fe STX &fe01 ; video register value &070d a0 00 LDY #&00 ; move_0727_to_0738_loop &070f b9 27 07 LDA &0727,Y ; unrelocated_wipe_0600_to_07ff # Move &0727 - &0738 to &0076 - &0087 &0712 99 76 00 STA &0076,Y ; wipe_0600_to_07ff &0715 c8 INY &0716 c0 12 CPY #&12 &0718 d0 f5 BNE &070f ; move_0727_to_0738_loop &071a 4c 76 00 JMP &0076 ; wipe_0600_to_07ff ; initial_variables_for_screen &071d 5d 01 ; &5d ; tune_state &071f 70 78 ; &70 ; landscape_screen_address_low &0721 71 32 ; &71 ; landscape_screen_address_high &0723 ce 00 ; &ce ; crtc_start_address_low &0725 cf 06 ; &cf ; crtc_start_address_high # &0727 - &0738 is moved to &0076 - &0087 at &070f ; wipe_0600_to_07ff &0076 a0 00 LDY #&00 &0078 98 TYA ; wipe_0600_to_06ff_loop &0079 99 00 06 STA &0600,Y # Wipe initialisation code &007c c8 INY &007d d0 fa BNE &0079 ; wipe_0600_to_06ff_loop ; wipe_0700_to_07ff_loop &007f 99 00 07 STA &0700,Y ; enemies_state &0082 c8 INY &0083 d0 fa BNE &007f ; wipe_0700_to_07ff_loop &0085 4c 2f 2b JMP &2b2f ; title_screen ; unused # &0739 - &075f is a copy of &0769 - &078f &0739 04 80 02 f4 03 &073e 19 04 a5 03 6b 00 &0744 19 55 c1 01 c2 01 &074a 19 04 5b 04 9a 02 &0750 19 04 5a 01 6b 00 &0756 19 55 0a 02 a1 02 &075c 19 04 a5 03 ; initialise_screen_string &0760 16 02 ; MODE 2 &0762 11 87 ; COLOUR 128 + 7 &0764 0c ; CLS &0765 12 00 01 ; GCOL 0, 1 &0768 19 04 80 02 f4 03 ; MOVE &0280, &03f4 &076e 19 04 a5 03 6b 00 ; MOVE &03a5, &006b &0774 19 55 c1 01 c2 01 ; FILL TRIANGLE &01c1, &01c2 &077a 19 04 5b 04 9a 02 ; MOVE &045b, &029a &0780 19 04 5a 01 6b 00 ; MOVE &015a, &006b &0786 19 55 0a 02 a1 02 ; FILL TRIANGLE &020a, &02a1 &078c 19 04 a5 03 6b 00 ; MOVE &03a5, &006b &0792 19 04 a4 00 9a 02 ; MOVE &00a4, &029a &0798 19 55 f5 02 a1 02 ; FILL TRIANGLE &02f5, &02a1 &079e 19 04 00 01 60 02 ; MOVE &0100, &0260 &07a4 05 ; write text at graphics cursor &07a5 12 00 00 ; GCOL 0, 0 &07a8 45 41 47 4c 45 27 53 20 57 49 4e 47 ; "EAGLE'S WING" &07b4 0a 0d &07b6 19 04 40 02 00 01 ; MOVE &0240, &0100 &07bc 42 59 ; "BY" &07be 0a 0d &07c0 19 04 94 00 c8 00 ; MOVE &0094, &00c8 &07c6 42 4f 52 49 53 20 4f 42 49 4e 53 4b 4f 46 48 ; "BORIS OBINSKOFH" &07d5 0a 0d &07d7 19 04 86 01 90 00 ; MOVE &0186, &0090 &07dd 28 43 29 20 31 39 38 34 0a 0d ; "(C) 1984" &07e7 13 08 00 00 00 00 ; set colour 8 to black &07ed 05 ; write text at graphics cursor &07ee 12 00 08 ; GCOL 0, 8 &07f1 12 00 81 ; GCOL 0, 128 + 1 &07f4 13 0e 01 00 00 00 ; set colour 14 to red ; unused &07fa 00 00 00 00 00 00 ; os_sound_workspace &0800 ff 00 00 00 00 00 00 00 c0 c0 c0 c0 04 04 04 04 &0810 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &0820 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &0830 00 00 00 00 00 00 00 00 ff 00 00 00 00 f0 00 0e &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 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; os_printer_buffer &0880 0d 0d 0d 00 00 00 00 00 00 00 00 00 00 00 00 00 &0890 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &08a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &08b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0d ; os_envelope_storage &08c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &08d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &08e0 02 00 00 00 00 00 00 fe 00 ff ff 00 00 00 00 00 &08f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; sprite_01_data # SPRITE_ENEMY_PLANE_UP &0900 00 40 00 00 00 15 00 00 00 c0 80 00 00 c0 80 00 &0910 40 c0 c0 00 c0 c0 c0 80 00 40 00 00 00 c0 80 00 &0920 40 c0 c0 00 ; sprite_01_buffer &0924 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &0934 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &0944 00 00 00 00 ; sprite_02_data # SPRITE_ENEMY_PLANE_DOWN &0948 40 c0 c0 00 00 c0 80 00 00 40 00 00 c0 c0 c0 80 &0958 40 c0 c0 00 00 c0 80 00 00 c0 80 00 00 15 00 00 &0968 00 40 00 00 ; sprite_02_buffer &096c 40 c0 c0 00 00 c0 80 00 00 40 00 00 c0 c0 c0 80 &097c 40 c0 c0 00 00 c0 80 00 00 c0 80 00 00 15 00 00 &098c 00 40 00 00 ; sprite_03_data # SPRITE_ENEMY_PLANE_RIGHT &0990 00 c0 00 00 00 80 40 80 00 00 c0 00 c0 00 00 40 &09a0 c0 c0 c0 00 c0 c0 c0 c0 6a 40 c0 c0 c0 00 c0 00 &09b0 c0 00 00 80 40 80 00 00 00 c0 00 00 00 ; sprite_03_buffer &09bd 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &09cd 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &09dd 00 00 00 00 00 00 00 00 00 00 00 00 00 ; sprite_04_data # SPRITE_SISTER_PLANE ; sprite_05_data # SPRITE_PLAYER &09ea 00 45 00 00 00 00 40 80 00 00 8a 40 c0 00 00 c0 &09fa 40 c0 80 00 c0 c0 c0 c0 80 c0 c0 c0 c0 6a c0 c0 &0a0a c0 c0 80 c0 40 c0 80 00 8a 40 c0 00 00 00 40 80 &0a1a 00 00 00 45 00 00 00 ; sprite_04_buffer &0a21 c0 c0 6a c0 c0 c0 c0 80 c0 40 c0 80 00 aa 40 c0 &0a31 00 00 00 40 80 00 00 00 55 00 00 00 00 00 00 00 &0a41 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &0a51 00 00 00 00 00 00 00 ; sprite_05_buffer &0a58 00 00 00 00 00 00 00 00 00 55 00 00 00 00 40 80 &0a68 00 00 aa 40 c0 00 00 c0 40 c0 80 00 03 03 03 00 &0a78 01 00 01 00 02 00 01 00 02 02 01 00 01 00 01 00 &0a88 02 00 02 00 00 00 02 ; sprite_06_data # SPRITE_AIMING_SIGHT &0a8f ff ff aa 55 00 00 00 00 00 00 aa 55 ff ff ; sprite_06_buffer &0a9d 00 02 00 01 00 01 00 01 02 01 00 01 00 00 ; sprite_07_data # SPRITE_EXPLOSION_ZERO &0aab 03 03 03 ; sprite_08_data # SPRITE_EXPLOSION_ONE &0aae 00 01 00 01 05 02 05 01 00 02 17 0b 00 0b 00 01 &0abe 00 02 00 02 00 ; sprite_09_data # SPRITE_EXPLOSION_TWO &0ac3 00 40 02 02 00 01 01 05 05 80 00 85 01 03 01 03 &0ad3 0b 15 07 02 01 00 2b 2a 01 02 0b 15 01 0a 40 07 &0ae3 0a 07 81 02 40 07 80 02 00 02 01 00 00 00 00 80 &0af3 01 00 00 01 01 00 00 ; sprite_0a_data # SPRITE_EXPLOSION_THREE &0afa 00 00 01 c0 80 00 00 00 40 c0 42 01 80 00 00 c0 &0b0a 42 01 03 c0 00 40 c0 40 01 02 40 80 80 05 03 2f &0b1a 40 40 c0 80 03 95 0b 1f 00 c0 02 80 05 3f 85 03 &0b2a 81 c0 15 0f 3f 0a 02 42 80 42 15 81 95 00 01 42 &0b3a 00 85 07 0b 42 c0 c0 02 6a 00 81 01 c0 40 c0 01 &0b4a 01 00 6a 80 00 c0 80 c0 c0 81 00 00 40 c0 81 81 &0b5a 80 00 00 00 40 42 02 00 00 ; sprite_0b_data # SPRITE_SAM_DOWN &0b63 0c 48 81 84 0c c0 03 c0 0c 95 03 03 0c 2b 03 42 &0b73 1d 03 17 c0 09 03 6a 84 03 17 0c 0c 03 0c 0c 0c ; sprite_0c_data # SPRITE_SAM_LEFT &0b83 0c 0c c0 84 0c 48 c0 42 0c 3f 2b 42 03 03 03 c0 &0b93 03 03 03 c0 0c 3f 2b 42 0c 48 c0 42 0c 0c c0 84 ; sprite_0d_data # SPRITE_SAM_UP &0ba3 03 0c 0c 0c 03 17 0c 0c 09 03 6a 84 1d 03 17 c0 &0bb3 0c 2b 03 42 0c 95 03 03 0c c0 03 c0 0c 48 81 84 ; sprite_0e_data # SPRITE_SHIP_HORIZONTAL &0bc3 3c 3c 3c 68 c0 c0 c0 c0 c0 c0 c0 c0 c0 c0 c0 c0 &0bd3 3c 3c 3c 3c 68 c0 90 30 c0 c0 c0 c0 c0 c0 c0 c0 &0be3 c0 c0 c0 3c 3c 68 c0 c0 30 3a c0 c0 c0 c0 c0 c0 &0bf3 81 42 c0 c0 c0 94 68 c0 c0 c0 35 30 30 30 30 30 &0c03 60 c0 21 12 c0 c0 c0 c0 c0 c0 30 c0 35 30 30 30 &0c13 30 30 30 90 2b 17 60 90 60 c0 c0 30 30 c0 35 30 &0c23 30 30 60 c0 30 90 2b 17 60 90 30 60 c0 30 30 c0 &0c33 35 30 30 30 60 c0 30 90 2b 17 60 90 30 60 c0 c0 &0c43 30 c0 35 30 30 30 30 30 30 90 2b 17 60 90 60 c0 &0c53 68 c0 c0 c0 35 30 30 30 30 30 60 c0 21 12 c0 c0 &0c63 c0 c0 3c 68 c0 c0 30 3a c0 c0 c0 c0 c0 c0 81 42 &0c73 c0 c0 c0 94 3c 3c 68 c0 90 30 c0 c0 c0 c0 c0 c0 &0c83 c0 c0 c0 c0 c0 3c 3c 3c 3c 68 c0 c0 c0 c0 c0 c0 &0c93 c0 c0 c0 c0 c0 c0 3c 3c ; sprite_0f_data # SPRITE_SHIP_VERTICAL &0c9b 3c 68 c0 94 3c 3c c0 c0 c0 3c 68 c0 30 c0 94 68 &0cab 30 30 c0 94 c0 30 30 c0 c0 c0 c0 30 c0 c0 c0 c0 &0cbb c0 c0 c0 c0 81 42 c0 c0 c0 03 42 c0 c0 81 03 c0 &0ccb c0 c0 81 42 81 42 c0 c0 c0 81 03 c0 c0 c0 c0 03 &0cdb 42 c0 c0 30 81 42 c0 90 30 60 c0 c0 95 3f 6a c0 &0ceb c0 03 03 03 c0 c0 03 03 03 c0 c0 03 03 03 c0 c0 &0cfb 95 3f 6a c0 c0 90 30 60 c0 c0 c0 30 c0 c0 c0 c0 &0d0b c0 c0 c0 c0 c0 30 c0 c0 c0 90 30 60 c0 c0 90 c0 &0d1b 60 c0 c0 90 c0 60 c0 c0 90 c0 60 c0 c0 90 c0 60 &0d2b c0 c0 90 30 60 c0 c0 90 30 60 c0 c0 90 30 60 c0 &0d3b c0 90 30 60 c0 c0 90 30 60 c0 c0 90 30 60 c0 c0 &0d4b 90 30 60 c0 c0 90 30 60 c0 c0 90 30 60 c0 c0 90 &0d5b 30 60 c0 c0 90 30 60 c0 c0 90 30 60 c0 90 30 30 &0d6b 30 60 90 3a 30 35 60 90 3a 30 35 60 90 35 3f 3a &0d7b 60 c0 30 30 30 c0 c0 c0 c0 c0 c0 c0 c0 c0 c0 c0 &0d8b 68 c0 30 c0 94 68 30 30 c0 94 68 30 30 c0 94 3c &0d9b c0 30 c0 3c 3c c0 c0 c0 3c 3c c0 c0 c0 3c 3c 68 &0dab c0 94 3c 3c 68 c0 94 3c 3c 68 c0 94 3c 3c 3c c0 &0dbb 3c 3c 3c 3c c0 3c 3c 3c 3c c0 3c 3c ; sprite_10_data # SPRITE_PILLBOX &0dc7 0c c0 c0 84 0c 0c 95 3f 84 0c c0 c0 c0 c0 84 95 &0dd7 c0 c0 95 84 95 c0 c0 95 84 95 c0 c0 95 84 c0 c0 &0de7 c0 c0 84 0c 95 3f 84 0c 0c c0 c0 84 0c ; sprite_11_data # SPRITE_BRIDGE_MIDDLE &0df4 95 3f 3f 3f 6a 3f c0 c0 c0 3f 6a 6a c0 95 95 6a &0e04 95 c0 6a 95 6a c0 3f c0 95 6a c0 3f c0 95 6a 95 &0e14 c0 6a 95 6a 6a c0 95 95 6a 6a c0 95 95 6a 95 c0 &0e24 6a 95 6a c0 3f c0 95 6a c0 3f c0 95 6a 95 c0 6a &0e34 95 6a 6a c0 95 95 3f c0 c0 c0 3f 95 3f 3f 3f 6a ; sprite_12_data # SPRITE_BRIDGE_END &0e44 95 c0 c0 c0 6a 6b c0 c0 c0 97 6a 6a c0 95 95 6a &0e54 95 c0 6a 95 6a c0 3f c0 95 6a c0 3f c0 95 6a 95 &0e64 c0 6a 95 6a 6a c0 95 95 6b c0 c0 c0 97 95 c0 c0 &0e74 c0 6a ; sprite_13_data # SPRITE_SILO &0e76 3c 2c 0c 0c 1c 3c 3c 0c 0c 0c 0c 3c 2c 0c 0c 0c &0e86 0c 1c 0c 0c 0c 0c 0c 0c 0c 58 e8 d4 a4 0c 0c 5c &0e96 c0 c0 ac 0c 0c 48 c0 c0 84 0c 0c 48 c0 c0 84 0c &0ea6 0c 48 c0 c0 84 0c 0c 5c c0 c0 ac 0c 0c 58 e8 d4 &0eb6 a4 0c 0c 0c 0c 0c 0c 0c 2c 0c 0c 0c 0c 1c 3c 0c &0ec6 0c 0c 0c 3c 3c 2c 0c 0c 1c 3c ; sprite_14_data # SPRITE_COMMAND_CENTRE &0ed0 3c 2c 0c 0c 1c 3c 3c 0c 0c 0c 0c 3c 2c 0c 0c 0c &0ee0 0c 1c 0c 0c 0c 0c 0c 0c 0c 58 e8 d4 a4 0c 0c 5c &0ef0 95 6a ac 0c 0c 48 95 c0 84 0c 0c 48 95 c0 84 0c &0f00 0c 48 95 c0 84 0c 0c 5c 95 6a ac 0c 0c 58 e8 d4 &0f10 a4 0c 0c 0c 0c 0c 0c 0c 2c 0c 0c 0c 0c 1c 3c 0c &0f20 0c 0c 0c 3c 3c 2c 0c 0c 1c 3c ; unused # &0f2a - &0f2f is a copy of &0eca - &03cf &0f2a 3c 2c 0c 0c 1c 3c ; unused # &0f30 - &0f3f is a copy of &0fb0 - &0fbf &0f30 3f 00 00 00 00 00 3f 00 3f 15 00 00 00 15 3f 00 ; unused &0f40 15 15 15 15 00 00 15 00 3f 00 00 3f 15 15 3f 00 ; "S" &0f50 15 15 15 15 15 15 15 00 3f 00 00 00 00 00 3f 00 ; "C" &0f60 15 15 15 15 15 15 15 00 3f 15 15 3f 15 15 15 00 ; "A" &0f70 15 15 15 15 00 00 15 00 3f 00 00 3f 15 15 3f 00 ; "S" &0f80 15 15 15 15 15 15 15 00 3f 15 15 3f 15 15 15 00 ; "A" &0f90 15 15 15 15 15 15 15 00 00 00 00 00 00 00 3f 00 ; "L" &0fa0 15 15 15 15 15 15 15 00 3f 00 00 3f 00 00 00 00 ; "F" ; outer_bar_sprite &0fb0 3f 00 00 00 00 00 3f 00 3f 15 00 00 00 15 3f 00 ; label_sprites &0fc0 15 15 15 15 15 15 15 00 3f 15 15 15 15 15 15 00 ; &00 : "MI" &0fd0 3f 15 15 15 15 15 15 00 15 15 15 15 15 15 15 00 &0fe0 15 15 15 15 00 00 15 00 3f 00 00 3f 15 15 3f 00 ; &20 : "SH" &0ff0 15 15 15 15 15 15 15 00 15 15 15 3f 15 15 15 00 &1000 15 15 15 15 15 15 15 00 3f 00 00 3f 00 00 00 00 ; &40 : "FU" &1010 15 15 15 15 15 15 15 00 15 15 15 15 15 15 3f 00 &1020 15 15 15 15 15 15 15 00 2a 15 15 15 15 15 2a 00 ; &60 : "DA" &1030 15 15 15 15 15 15 15 00 3f 15 15 3f 15 15 15 00 &1040 15 15 15 15 00 00 15 00 3f 00 00 3f 15 15 3f 00 ; &80 : "SC" &1050 15 15 15 15 15 15 15 00 3f 00 00 00 00 00 3f 00 ; digit_sprites &1060 15 15 15 15 15 15 15 00 3f 15 15 15 15 15 3f 00 ; "0" &1070 00 00 00 00 00 00 00 00 2a 2a 2a 2a 2a 2a 2a 00 ; "1" &1080 15 00 00 15 15 15 15 00 3f 15 15 3f 00 00 3f 00 ; "2" &1090 15 00 00 15 00 00 15 00 3f 15 15 3f 15 15 3f 00 ; "3" &10a0 15 15 15 15 00 00 00 00 15 15 15 3f 15 15 15 00 ; "4" &10b0 15 15 15 15 00 00 15 00 3f 00 00 3f 15 15 3f 00 ; "5" &10c0 15 15 15 15 15 15 15 00 00 00 00 3f 15 15 3f 00 ; "6" &10d0 15 00 00 00 00 00 00 00 3f 15 15 15 15 15 15 00 ; "7" &10e0 15 15 15 15 15 15 15 00 3f 15 15 3f 15 15 3f 00 ; "8" &10f0 15 15 15 15 00 00 00 00 3f 15 15 3f 15 15 15 00 ; "9" ; high_scores &1100 00 00 02 ; 20000 &1103 42 6f 72 69 73 20 20 20 20 20 ; "Boris " &110d 0d 67 0d &1110 00 90 01 ; 19000 &1113 45 61 67 6c 65 20 57 69 6e 67 ; "Eagle Wing" &111d 0d 67 0d &1120 00 80 01 ; 18000 &1123 45 61 67 6c 65 20 57 69 6e 67 ; "Eagle Wing" &112d 0d 67 0d &1130 00 70 01 ; 17000 &1133 45 61 67 6c 65 20 57 69 6e 67 ; "Eagle Wing" &113d 0d 67 0d &1140 00 60 01 ; 16000 &1143 45 61 67 6c 65 20 57 69 6e 67 ; "Eagle Wing" &114d 0d 67 0d &1150 00 50 01 ; 15000 &1153 45 61 67 6c 65 20 57 69 6e 67 ; "Eagle Wing" &115d 0d 67 0d &1160 00 40 01 ; 14000 &1163 45 61 67 6c 65 20 57 69 6e 67 ; "Eagle Wing" &116d 0d 67 0d &1170 00 30 01 ; 13000 &1173 45 61 67 6c 65 20 57 69 6e 67 ; "Eagle Wing" &117d 0d 67 0d &1180 00 20 01 ; 12000 &1183 45 61 67 6c 65 20 57 69 6e 67 ; "Eagle Wing" &118d 0d 67 0d &1190 00 10 01 ; 11000 &1193 45 61 67 6c 65 20 57 69 6e 67 ; "Eagle Wing" &119d 0d 67 0d ; eagle_high_scores_string &11a0 20 20 45 61 67 6c 65 20 20 48 69 2d 73 63 6f 72 ; " Eagle Hi-scores " &11b0 65 73 20 20 0d ; unused # &11b5 - &11be is a copy of &0dd8 - &0de2 &11b5 c0 95 84 95 c0 c0 95 84 c0 c0 ; unused &11bf c0 ; initial_variables_for_game # Entries marked *** are reset on docking with sister plane &11c0 b5 00 ; &b5 ; player_shots_low *** # 500 shots &11c2 b6 05 ; &b6 ; player_shots_high *** &11c4 b7 20 ; &b7 ; player_missiles *** # 20 missiles &11c6 bb 00 ; &bb ; fuel_low *** # 5000 fuel &11c8 bc 50 ; &bc ; fuel_high *** &11ca bf 00 ; &bf ; player_damage *** # 0 damage &11cc be 00 ; &be ; sister_plane_present *** # Set to zero to remove sister plane &11ce 51 00 ; &51 ; sister_plane_x *** &11d0 74 32 ; &74 ; landscape_top_rock_end &11d2 75 c8 ; &75 ; landscape_bottom_rock_start &11d4 8c 5a ; &8c ; landscape_top_grass_end &11d6 8d a0 ; &8d ; landscape_bottom_grass_start &11d8 8e 14 ; &8e ; canyon_slope_change_cooldown &11da 8f 00 ; &8f ; canyon_slope &11dc b0 00 ; &b0 ; player_world_x &11de b1 00 ; &b1 ; player_world_x_high &11e0 b2 40 ; &b2 ; suppress_game_features_flags &11e2 b3 80 ; &b3 ; player_y &11e4 b4 02 ; &b4 ; firing_cooldown &11e6 68 01 ; &68 ; suppress_checking_for_high_score # Set to non-zero to suppress checking for high score &11e8 c0 00 ; &c0 ; score &11ea c1 00 ; &c1 ; score + 1 &11ec c2 00 ; &c2 ; score + 2 &11ee c3 0a ; &c3 ; new_top_enemy_cooldown &11f0 c4 0a ; &c4 ; new_river_enemy_cooldown &11f2 c5 0a ; &c5 ; new_bottom_enemy_cooldown &11f4 c6 82 ; &c6 ; minimum_canyon_width &11f6 c7 00 ; &c7 ; canyon_update_cooldown &11f8 05 00 ; &05 # Unused variable &11fa c8 50 ; &c8 ; irq2_interrupt_occurred &11fc 50 01 ; &50 ; ten_thousands_required_for_sister_plane ; unused &11fe 66 66