Psycastria disassembly ====================== Psycastria was written by Gary Partis, and was published by Audiogenic Software for the BBC Micro in 1986. It is a clone of the horizontally scrolling shooter, Uridium. The following disassembly was created by reverse engineering binary images, without access to any source code. It is nevertheless reasonably complete, allowing the technical approaches used to be understood. The author of this disassembly imposes no additional copyright restrictions beyond those already present on the game itself. It is provided for educational purposes only, and it is hoped that the original authors will accept it in the good faith it was intended - as a tribute to their skills. Technical notes =============== A custom tape loader loads the main game binary from an encrypted stream. Copy protection code crashes the game if it detects it has been loaded differently. If the Doctor Who and the Mines of Terror ROM is present, a cheat mode may be activated by pressing the I, L, T, D, N, G and 9 keys on the title screen, and entering the password "SHOTOKAN" when prompted. This starts the game with ninety-nine lives. If the ROM is not present, this cheat resets the system. Interesting pokes ================= &128c = &a9 infinite lives &1779 = &a9, &18c4 = &a9 invulnerability Loader disassembly ================== ; Psycastria ; FFFF6000 FFFF6000 0E00 ; entry_point &6000 a9 0f LDA #&0f ; Flush all buffers &6002 a2 00 LDX #&00 &6004 20 f4 ff JSR &fff4 ; OSBYTE &6007 78 SEI &6008 a2 00 LDX #&00 ; write_wait_a_mo_loop &600a bd 15 60 LDA &6015,X ; wait_a_mo_string &600d f0 14 BEQ &6023 ; first_stage &600f 20 e3 ff JSR &ffe3 ; OSASCI &6012 e8 INX &6013 d0 f5 BNE &600a ; write_wait_a_mo_loop # Always branches ; wait_a_mo_string &6015 0d ; CR &6016 57 61 69 74 20 61 20 6d 6f 2e 2e 2e ; "Wait a mo..." &6021 00 ; first_stage &6023 a9 df LDA #&df &6025 2d 6b fe AND &fe6b ; User VIA auxiliary control register # Set User VIA timer 2 to one-shot &6028 8d 6b fe STA &fe6b ; User VIA auxiliary control register &602b a9 a0 LDA #&a0 # Enable User VIA timer 2 interrupts &602d 8d 6e fe STA &fe6e ; User VIA interrupt enable register &6030 a9 00 LDA #&00 &6032 8d 68 fe STA &fe68 ; User VIA timer 2 counter LSB &6035 8d 69 fe STA &fe69 ; User VIA timer 2 counter MSB &6038 38 SEC &6039 a2 00 LDX #&00 &603b a0 00 LDY #&00 ; first_stage_decryption_loop # Decrypt &6100 - &61ff &603d b9 00 61 LDA &6100,Y ; second_stage &6040 59 01 66 EOR &6601,Y &6043 4d 84 64 EOR &6484 # actually EOR &6400 + four_low &6046 4d 68 fe EOR &fe68 ; User VIA timer 2 counter LSB &6049 5d 01 62 EOR &6201,X &604c 48 PHA &604d a9 7f LDA #&7f # Disable all System VIA interrupts &604f 8d 4e fe STA &fe4e ; System VIA interrupt enable register &6052 68 PLA &6053 4d 69 fe EOR &fe69 ; User VIA timer 2 counter MSB &6056 4d a4 69 EOR &69a4 # actually EOR &6900 + nine_one_low &6059 5d 01 64 EOR &6401,X &605c 59 01 62 EOR &6201,Y &605f 49 38 EOR #&38 &6061 4d 68 fe EOR &fe68 ; User VIA timer 2 counter LSB &6064 5d 01 67 EOR &6701,X &6067 4d ea 66 EOR &66ea # actually EOR &6600 + six_low &606a 4d 69 fe EOR &fe69 ; User VIA timer 2 counter MSB &606d 59 01 65 EOR &6501,Y &6070 4d 68 fe EOR &fe68 ; User VIA timer 2 counter LSB &6073 4d 64 69 EOR &6964 # actually EOR &6900 + nine_two_low &6076 59 01 6a EOR &6a01,Y &6079 4d 69 fe EOR &fe69 ; User VIA timer 2 counter MSB &607c 4d 39 68 EOR &6839 # actually EOR &6800 + eight_low &607f 4d 68 fe EOR &fe68 ; User VIA timer 2 counter LSB &6082 4d 75 65 EOR &6575 # actually EOR &6500 + five_low &6085 59 01 64 EOR &6401,Y &6088 4d 69 fe EOR &fe69 ; User VIA timer 2 counter MSB &608b 5d 01 69 EOR &6901,X &608e 99 00 61 STA &6100,Y ; second_stage &6091 ad 74 60 LDA &6074 ; nine_two_low &6094 4d 68 fe EOR &fe68 ; User VIA timer 2 counter LSB &6097 4d 69 fe EOR &fe69 ; User VIA timer 2 counter MSB &609a 8d 74 60 STA &6074 ; nine_two_low &609d 4d 83 60 EOR &6083 ; five_low &60a0 49 38 EOR #&38 &60a2 4d 68 fe EOR &fe68 ; User VIA timer 2 counter LSB &60a5 8d 83 60 STA &6083 ; five_low &60a8 4d 57 60 EOR &6057 ; nine_one_low &60ab 4d 69 fe EOR &fe69 ; User VIA timer 2 counter MSB &60ae 4d 74 60 EOR &6074 ; nine_two_low &60b1 4d 7d 60 EOR &607d ; eight_low &60b4 8d 57 60 STA &6057 ; nine_one_low &60b7 4d 44 60 EOR &6044 ; four_low &60ba 4d 57 60 EOR &6057 ; nine_one_low &60bd 8d 44 60 STA &6044 ; four_low &60c0 4d 7d 60 EOR &607d ; eight_low &60c3 4d 68 fe EOR &fe68 ; User VIA timer 2 counter LSB &60c6 e9 c8 SBC #&c8 &60c8 4d 44 60 EOR &6044 ; four_low &60cb 8d 7d 60 STA &607d ; eight_low &60ce 4d 57 60 EOR &6057 ; nine_one_low &60d1 4d 68 60 EOR &6068 ; six_low &60d4 4d 69 fe EOR &fe69 ; User VIA timer 2 counter MSB &60d7 8d 68 60 STA &6068 ; six_low &60da c8 INY &60db f0 03 BEQ &60e0 ; next_round &60dd 4c 3d 60 JMP &603d ; first_stage_decryption_loop ; next_round &60e0 e8 INX &60e1 f0 03 BEQ &60e6 ; calculate_checksum &60e3 4c 3d 60 JMP &603d ; first_stage_decryption_loop ; calculate_checksum &60e6 a9 20 LDA #&20 &60e8 8d 6e fe STA &fe6e ; User VIA interrupt enable register # Disable User VIA timer 2 interrupts &60eb a2 00 LDX #&00 &60ed 8a TXA ; wipe_6000_to_60ea_loop &60ee 9d 00 60 STA &6000,X ; first_stage # Wipe &6000 - &60ea &60f1 e8 INX &60f2 e0 eb CPX #&eb &60f4 d0 f8 BNE &60ee ; wipe_6000_to_60ea_loop &60f6 a2 00 LDX #&00 &60f8 8a TXA ; calculate_checksum_loop # Checksum &6100 - &61ff &60f9 18 CLC &60fa 7d 00 61 ADC &6100,X ; second_stage &60fd e8 INX &60fe d0 f9 BNE &60f9 ; calculate_checksum_loop # &6100 - &61ff is decrypted by first stage ; second_stage &6100 cd 00 62 CMP &6200 ; expected_checksum &6103 f0 03 BEQ &6108 ; checksum_ok # Reset system if checksum is incorrect ; to_os_reset &6105 6c fc ff JMP (&fffc) ; os_reset_address_low ; checksum_ok &6108 2c e5 fe BIT &fee5 ; tube ULA data register 3 # Reset system if second processor present &610b 10 f8 BPL &6105 ; to_os_reset &610d ad b7 ff LDA &ffb7 ; os_rom_default_vector_table_address_low &6110 85 00 STA &00 ; default_vector_table_address_low &6112 ad b8 ff LDA &ffb8 ; os_rom_default_vector_table_address_high &6115 85 01 STA &01 ; default_vector_table_address_high &6117 ac b9 ff LDY &ffb9 ; OSRDRM # Bug: should be &ffb6, os_rom_vector_table_length ; reset_vector_table_loop &611a b1 00 LDA (&00),Y ; default_vector_table_address &611c 99 00 02 STA &0200,Y ; os_vector_table &611f 88 DEY &6120 10 f8 BPL &611a ; reset_vector_table_loop &6122 a2 00 LDX #&00 &6124 8e ff 02 STX &02ff ; os_block_length_high ; check_roms_loop # For each ROM, &6127 8e 30 fe STX &fe30 ; Paged ROM latch &612a ad 09 80 LDA &8009 ; rom_data + &09 &612d 29 df AND #&df &612f c9 52 CMP #&52 : "R" # Is this a Replay ROM? &6131 d0 12 BNE &6145 ; not_replay &6133 ad 0a 80 LDA &800a ; rom_data + &0a &6136 29 df AND #&df &6138 c9 45 CMP #&45 : "E" &613a d0 09 BNE &6145 ; not_replay &613c ad 0b 80 LDA &800b ; rom_data + &0b &613f 29 df AND #&df &6141 c9 50 CMP #&50 : "P" &6143 f0 c0 BEQ &6105 ; to_os_reset # If so, reset system ; not_replay &6145 ad 24 80 LDA &8024 ; rom_data + &24 &6148 29 df AND #&df &614a c9 57 CMP #&57 : "W" # Is this the Doctor Who and the Mines of Terror ROM? &614c d0 1a BNE &6168 ; consider_next_rom &614e ad 25 80 LDA &8025 ; rom_data + &25 &6151 29 df AND #&df &6153 c9 48 CMP #&48 : "H" &6155 d0 11 BNE &6168 ; consider_next_rom &6157 ad 26 80 LDA &8026 ; rom_data + &26 &615a 29 df AND #&df &615c c9 4f CMP #&4f : "O" &615e d0 08 BNE &6168 ; consider_next_rom &6160 ee 77 02 INC &0277 ; dr_who_rom_present # Set to positive to indicate ROM present &6163 a9 21 LDA #&21 ; "!" &6165 20 ee ff JSR &ffee ; OSWRCH ; consider_next_rom &6168 e8 INX &6169 d0 bc BNE &6127 ; check_rom_loop &616b a9 df LDA #&df &616d 2d 6b fe AND &fe6b ; User VIA auxiliary control register # Set User VIA timer 2 to one-shot &6170 8d 6b fe STA &fe6b ; User VIA auxiliary control register &6173 a9 a0 LDA #&a0 # Enable User VIA timer 2 interrupts &6175 8d 6e fe STA &fe6e ; User VIA interrupt enable register &6178 a9 00 LDA #&00 &617a 8d 68 fe STA &fe68 ; User VIA timer 2 counter LSB &617d 8d 69 fe STA &fe69 ; User VIA timer 2 counter MSB &6180 a2 00 LDX #&00 ; initialise_decryption_key_loop # Populate &0600 - &06ff with decryption key &6182 8a TXA &6183 49 ff EOR #&ff &6185 9d 00 06 STA &0600,X ; decryption_key &6188 e8 INX &6189 d0 f7 BNE &6182 ; initialise_decryption_key_loop &618b a2 00 LDX #&00 ; initialise_decryption_key_outer_loop &618d 86 70 STX &70 ; round &618f a0 00 LDY #&00 ; initialise_decryption_key_inner_loop &6191 84 71 STY &71 ; offset &6193 ae 68 fe LDX &fe68 ; User VIA timer 2 counter LSB &6196 bd 00 06 LDA &0600,X ; decryption_key &6199 85 72 STA &72 ; tmp &619b e8 INX &619c bd 00 06 LDA &0600,X ; decryption_key &619f ca DEX &61a0 9d 00 06 STA &0600,X ; decryption_key &61a3 e8 INX &61a4 a5 72 LDA &72 ; tmp &61a6 9d 00 06 STA &0600,X ; decryption_key &61a9 ac 68 fe LDY &fe68 ; User VIA timer 2 counter LSB &61ac ae 69 fe LDX &fe69 ; User VIA timer 2 counter MSB &61af bd 00 06 LDA &0600,X ; decryption_key &61b2 85 72 STA &72 ; tmp &61b4 b9 00 06 LDA &0600,Y ; decryption_key &61b7 9d 00 06 STA &0600,X ; decryption_key &61ba a5 72 LDA &72 ; tmp &61bc 99 00 06 STA &0600,Y ; decryption_key &61bf a4 71 LDY &71 ; offset &61c1 c8 INY &61c2 d0 cd BNE &6191 ; initialise_decryption_key_outer_loop &61c4 a6 70 LDX &70 ; round &61c6 e8 INX &61c7 d0 c4 BNE &618d ; initialise_decryption_key_inner_loop &61c9 a9 20 LDA #&20 # Disable User VIA timer 2 interrupts &61cb 8d 6e fe STA &fe6e ; User VIA interrupt enable register &61ce a0 00 LDY #&00 &61d0 84 00 STY &00 ; target_address_low &61d2 a9 20 LDA #&20 ; &2000 = third_stage &61d4 85 01 STA &01 ; target_address_high &61d6 a9 01 LDA #&01 &61d8 85 02 STA &02 ; source_address_low &61da a9 62 LDA #&62 ; &6201 = unrelocated_third_stage &61dc 85 03 STA &03 ; source_address_high ; second_stage_decryption_loop # Decrypt &6201 - &7fff to &2000 - &3dfe &61de b1 02 LDA (&02),Y ; source_address &61e0 59 00 06 EOR &0600,Y ; decryption_key &61e3 91 00 STA (&00),Y ; target_address &61e5 8a TXA &61e6 91 02 STA (&02),Y ; source_address &61e8 c8 INY &61e9 d0 f3 BNE &61de ; second_stage_decryption_loop &61eb e6 01 INC &01 ; target_address_high &61ed e6 03 INC &03 ; source_address_high &61ef 10 ed BPL &61de ; second_stage_decryption_loop &61f1 a9 c8 LDA #&c8 ; Read/Write BREAK/ESCAPE effect &61f3 a2 03 LDX #&03 ; Clear memory on next RESET &61f5 20 f4 ff JSR &fff4 ; OSBYTE &61f8 a9 ff LDA #&ff # Enable all System VIA interrupts &61fa 8d 4e fe STA &fe4e ; System VIA interrupt enable register &61fd 4c 00 20 JMP &2000 ; third_stage ; expected_checksum &6200 42 # &6201 - &6b6a is decrypted to &2000 - &2969 by second stage ; third_stage &2000 a9 72 LDA #&72 ; Specify video memory to use on next MODE change &2002 a2 01 LDX #&01 ; Only use shadow memory if MODE number is > 127 &2004 a0 00 LDY #&00 &2006 20 f4 ff JSR &fff4 ; OSBYTE ; initialise_font # Populate &0900 - &0bff with character definitions &2009 a9 14 LDA #&14 ; Implode user defined character font RAM &200b a2 00 LDX #&00 &200d 20 f4 ff JSR &fff4 ; OSBYTE &2010 a9 00 LDA #&00 &2012 85 00 STA &00 ; font_address_low &2014 a9 09 LDA #&09 ; &0900 = font_data &2016 85 01 STA &01 ; font_address_high &2018 a9 20 LDA #&20 ; " " &201a 85 02 STA &02 ; character_buffer ; initialise_font_character_loop &201c a2 02 LDX #&02 ; &0002 = character_buffer &201e a0 00 LDY #&00 &2020 a9 0a LDA #&0a ; Read character definition &2022 20 f1 ff JSR &fff1 ; OSWORD &2025 a0 07 LDY #&07 ; initialise_font_byte_loop &2027 b9 03 00 LDA &0003,Y ; character_buffer + 1 &202a 91 00 STA (&00),Y ; font_address &202c 88 DEY &202d 10 f8 BPL &2027 ; initialise_font_byte_loop &202f a5 00 LDA &00 ; font_address_low &2031 18 CLC &2032 69 08 ADC #&08 &2034 85 00 STA &00 ; font_address_low &2036 a5 01 LDA &01 ; font_address_high &2038 69 00 ADC #&00 &203a 85 01 STA &01 ; font_address_high &203c e6 02 INC &02 ; character_buffer &203e 10 dc BPL &201c ; initialise_font_character_loop ; initialise_screen &2040 a9 35 LDA #&35 ; &2535 = initialise_screen_string &2042 85 00 STA &00 ; string_address_low &2044 a9 25 LDA #&25 &2046 85 01 STA &01 ; string_address_high &2048 a0 00 LDY #&00 ; write_initialise_screen_loop &204a b1 00 LDA (&00),Y ; string_address &204c c9 fe CMP #&ff # &ff indicates end of string &204e f0 0a BEQ &205a ; end_of_string &2050 20 ee ff JSR &ffee ; OSWRCH &2053 c8 INY &2054 d0 f4 BNE &204a ; write_initialise_screen_loop &2056 e6 01 INC &01 ; string_address_high &2058 d0 f0 BNE &204a ; write_initialise_screen_loop ; end_of_string &205a 78 SEI &205b a2 ff LDX #&ff &205d 9a TXS ; move_20ae_to_24ad &205e a9 ae LDA #&ae ; &20ae = unrelocated_fourth_stage &2060 85 00 STA &00 ; source_address_low &2062 a9 20 LDA #&20 &2064 85 01 STA &01 ; source_address_high &2066 a9 04 LDA #&04 ; &0400 = fourth_stage &2068 85 03 STA &03 ; target_address_high &206a a0 00 LDY #&00 &206c 84 02 STY &02 ; target_address_low ; move_20ae_to_24ad_loop # Move &20ae - &24ad to &0400 - &08ff &206e b1 00 LDA (&00),Y ; source_address &2070 91 02 STA (&02),Y ; target_address &2072 c8 INY &2073 d0 f9 BNE &206e ; move_20ae_to_24ad_loop &2075 e6 01 INC &01 ; source_address_high &2077 e6 03 INC &03 ; target_address_high &2079 a5 03 LDA &03 ; target_address_high &207b c9 09 CMP #&09 &207d d0 ef BNE &206e ; move_20ae_to_24ad_loop ; move_6e80_to_7fff &207f a9 6e LDA #&6e ; &6e80 &2081 85 01 STA &01 ; source_address_high &2083 a9 0d LDA #&0d ; &0d00 &2085 85 03 STA &03 ; target_address_high &2087 84 02 STY &02 ; target_address_low &2089 a9 80 LDA #&80 &208b 85 00 STA &00 ; source_address_low ; move_6e80_to_7fff_loop # Move &6e80 - &7fff to &0d00 - &1e7f (screen memory) &208d b1 00 LDA (&00),Y ; source_address &208f 91 02 STA (&02),Y ; target_address &2091 c8 INY &2092 d0 f9 BNE &208d ; move_6e80_to_7fff_loop &2094 e6 03 INC &03 ; target_address_high &2096 e6 01 INC &01 ; source_address_high &2098 10 f3 BPL &208d ; move_6e80_to_7fff_loop &209a a9 c8 LDA #&c8 ; Read/Write BREAK/ESCAPE effect &209c a2 03 LDX #&03 ; Clear memory on next RESET &209e 20 f4 ff JSR &fff4 ; OSBYTE &20a1 a9 7f LDA #&7f # Disable all User VIA interrupts &20a3 8d 6e fe STA &fe6e ; User VIA interrupt enable register &20a6 a9 7d LDA #&7d # Disable all System VIA interrupts except v-sync &20a8 8d 4e fe STA &fe4e ; System VIA interrupt enable register &20ab 4c 00 04 JMP &0400 ; fourth_stage # &20ae - &2534 is moved to &0400 - &0886 at &206e ; fourth_stage &0400 a2 06 LDX #&06 ; R6: Vertical displayed register &0402 a9 07 LDA #&07 &0404 20 91 07 JSR &0791 ; set_video_register &0407 a2 07 LDX #&07 ; R7: Vertical sync position &0409 a9 16 LDA #&16 &040b 20 91 07 JSR &0791 ; set_video_register &040e a2 0c LDX #&0c ; R12: Displayed screen start address register (high) &0410 a9 01 LDA #&01 # Set screen start address to &0d00 &0412 20 91 07 JSR &0791 ; set_video_register &0415 a2 0d LDX #&0d ; R13: Displayed screen start address register (low) &0417 a9 a0 LDA #&a0 &0419 20 91 07 JSR &0791 ; set_video_register &041c a2 01 LDX #&01 ; R1: Number of characters per line &041e a9 50 LDA #&50 &0420 20 91 07 JSR &0791 ; set_video_register &0423 78 SEI &0424 a2 10 LDX #&10 &0426 a9 00 LDA #&00 ; wipe_osfile_control_block_loop &0428 9d ee 02 STA &02ee,X ; osfile_control_block # Wipe &02ee - &02fe with &00 &042b ca DEX # This will be check at &05b7 in game's irq1_handler &042c 10 fa BPL &0428 ; wipe_osfile_control_block_loop &042e a9 00 LDA #&00 ; &0800 = irq1_handler &0430 8d 04 02 STA &0204 ; irq1_vector_low &0433 a9 08 LDA #&08 &0435 8d 05 02 STA &0205 ; irq1_vector_high &0438 a0 00 LDY #&00 ; delay_loop &043a 98 TYA &043b 48 PHA ; count &043c a2 ff LDX #&ff &043e 86 60 STX &60 ; scrolltext_offset &0440 e8 INX ; 0 &0441 86 61 STX &61 ; scrolltext_nibble &0443 a2 08 LDX #&08 &0445 20 39 07 JSR &0739 ; calculate_screen_address &0448 a9 02 LDA #&02 &044a 8d 38 07 STA &0738 ; text_colour &044d 20 60 07 JSR &0760 ; plot_string &0450 53 65 61 72 63 68 69 6e 67 20 66 6f 72 20 50 73 ; "Searching for Ps" &0460 79 63 61 73 74 72 69 61 00 ; "ycastria" &0469 68 PLA ; count &046a a8 TAY &046b 88 DEY &046c d0 cc BNE &043a ; delay_loop &046e 58 CLI ; wait_for_start_of_data &046f a2 ff LDX #&ff &0471 9a TXS &0472 a2 0e LDX #&0e # Disable Cap Lock LED &0474 8e 40 fe STX &fe40 ; System VIA port B input/output register &0477 e8 INX ; &f # Disable Shift Lock LED &0478 8e 40 fe STX &fe40 ; System VIA port B input/output register &047b a9 85 LDA #&85 # Set to 2400 baud, switch on cassette motor &047d 8d 10 fe STA &fe10 ; Serial ULA control register &0480 a9 1f LDA #&1f ; 0001 1111 # Reset cassette system &0482 8d 08 fe STA &fe08 ; Cassette ACIA control register &0485 a9 1d LDA #&1d ; 0001 1101 # 8 bit word, 1 stop bit, even parity, 1200 baud &0487 8d 08 fe STA &fe08 ; Cassette ACIA control register &048a a0 00 LDY #&00 &048c 84 02 STY &02 ; suppress_errors # Set to zero to suppress errors &048e 84 00 STY &00 ; load_address_low &0490 a9 20 LDA #&20 ; &2000 = unrelocated_main_binary &0492 85 01 STA &01 ; load_address_high ; wait_for_start_of_data_loop &0494 20 98 07 JSR &0798 ; get_byte_from_tape &0497 c9 aa CMP #&aa &0499 d0 f9 BNE &0494 ; wait_for_start_of_data_loop &049b 20 98 07 JSR &0798 ; get_byte_from_tape &049e c9 54 CMP #&54 ; "T" &04a0 d0 f2 BNE &0494 ; wait_for_start_of_data_loop &04a2 20 98 07 JSR &0798 ; get_byte_from_tape &04a5 c9 44 CMP #&44 ; "D" &04a7 d0 eb BNE &0494 ; wait_for_start_of_data_loop &04a9 20 98 07 JSR &0798 ; get_byte_from_tape &04ac c9 4e CMP #&4e ; "N" &04ae d0 e4 BNE &0494 ; wait_for_start_of_data_loop &04b0 20 98 07 JSR &0798 ; get_byte_from_tape &04b3 c9 00 CMP #&00 &04b5 d0 dd BNE &0494 ; wait_for_start_of_data_loop &04b7 85 04 STA &04 ; fifth_stage_offset &04b9 a9 60 LDA #&60 &04bb 85 02 STA &02 ; suppress_errors # Set to non-zero to consider errors &04bd 85 05 STA &05 ; bytes_remaining &04bf a9 32 LDA #&32 ; "2" &04c1 85 1e STA &1e ; blocks_remaining # Start at 255 blocks remaining &04c3 a9 35 LDA #&35 ; "5" &04c5 85 1f STA &1f ; blocks_remaining + 1 &04c7 85 20 STA &20 ; blocks_remaining + 2 &04c9 20 81 07 JSR &0781 ; wipe_text_area &04cc 20 97 06 JSR &0697 ; write_blocks_remaining ; read_data_loop # Read &2000 - &7fff as 256 60 byte blocks &04cf 20 98 07 JSR &0798 ; get_byte_from_tape &04d2 84 03 STY &03 ; load_address_offset &04d4 45 03 EOR &03 ; load_address_offset &04d6 45 01 EOR &01 ; load_address_high &04d8 20 58 06 JSR &0658 ; shuffle_bits_in_byte &04db 91 00 STA (&00),Y ; load_address &04dd c6 05 DEC &05 ; bytes_remaining &04df d0 03 BNE &04e4 ; not_end_of_block &04e1 20 65 06 JSR &0665 ; next_block ; not_end_of_block &04e4 c8 INY &04e5 d0 e8 BNE &04cf ; read_data_loop &04e7 e6 01 INC &01 ; load_address_high &04e9 10 e4 BPL &04cf ; read_data_loop &04eb 8c 10 fe STY &fe10 ; Serial ULA control register # Switch off cassette motor &04ee 20 81 07 JSR &0781 ; wipe_text_area &04f1 a9 03 LDA #&03 &04f3 8d 38 07 STA &0738 ; text_colour &04f6 a2 00 LDX #&00 &04f8 20 39 07 JSR &0739 ; calculate_screen_address &04fb 20 60 07 JSR &0760 ; plot_string &04fe 50 6c 65 61 73 65 20 77 61 69 74 20 61 20 6d 6f ; "Please wait a mo" &050e 6d 65 6e 74 20 77 68 69 6c 73 74 20 49 20 64 65 ; "ment whilst I de" &051e 63 6f 64 65 2e 2e 2e 2e 00 ; "de...." &0527 20 00 0c JSR &0c00 ; fifth_stage &052a a9 ff LDA #&ff &052c 8d 4e fe STA &fe4e ; System VIA interrupt enable register # Enable all System VIA interrupts &052f a2 01 LDX #&01 ; R1: Number of characters per line &0531 a9 00 LDA #&00 &0533 20 91 07 JSR &0791 ; set_video_register # Blank screen &0536 a0 00 LDY #&00 &0538 84 00 STY &00 ; source_address_low &053a 84 02 STY &02 ; target_address_low &053c a9 20 LDA #&20 ; &2000 = unrelocated_main_binary &053e 85 01 STA &01 ; source_address_high &0540 a9 12 LDA #&12 ; &1200 = main_binary &0542 85 03 STA &03 ; target_address_high ; relocate_main_binary_loop # Move &2000 - &7fff to &1200 - &71ff &0544 b1 00 LDA (&00),Y ; source_address &0546 91 02 STA (&02),Y ; target_address &0548 a9 00 LDA #&00 &054a 91 00 STA (&00),Y ; source_address &054c c8 INY &054d d0 f5 BNE &0544 ; relocate_main_binary_loop &054f e6 03 INC &03 ; target_address_high &0551 e6 01 INC &01 ; source_address_high &0553 10 ef BPL &0544 ; relocate_main_binary_loop &0555 4c 00 6f JMP &6f00 ; main_binary_entry_point ; scrolltext_data &0558 50 73 79 63 61 73 74 72 69 61 20 2d 20 28 63 29 ; "Psycastria - (c)" &0568 20 41 75 64 69 6f 67 65 6e 69 63 20 53 6f 66 74 ; " Audiogenic Soft" &0578 77 61 72 65 20 4c 54 44 20 31 39 38 36 2e 20 57 ; "ware LTD 1986. W" &0588 72 69 74 74 65 6e 20 62 79 20 47 61 72 79 20 50 ; "ritten by Gary P" &0598 61 72 74 69 73 20 61 6e 64 20 64 65 64 69 63 61 ; "artis and dedica" &05a8 74 65 64 20 74 6f 20 54 72 61 63 65 79 20 44 69 ; "ted to Tracey Di" &05b8 61 6e 6e 65 20 4e 69 63 68 6f 6c 73 6f 6e 2e 20 ; "anne Nicholson. " &05c8 44 65 73 74 72 6f 79 20 74 68 65 20 66 6f 75 72 ; "Destroy the four" &05d8 20 63 6f 6d 6d 61 6e 64 20 62 61 73 65 73 20 6f ; " command bases o" &05e8 6e 20 6c 61 6e 64 2c 20 73 65 61 2c 20 74 68 65 ; "n land, sea, the" &05f8 20 6d 6f 6f 6e 2c 20 61 6e 64 20 69 6e 20 73 70 ; " moon, and in sp" &0608 61 63 65 2c 20 62 65 6c 6f 6e 67 69 6e 67 20 74 ; "ace, belonging t" &0618 6f 20 74 68 65 20 61 67 65 20 6c 6f 6e 67 20 65 ; "o the age long e" &0628 6e 65 6d 79 20 6f 66 20 74 68 65 20 50 61 6e 20 ; "nemy of the Pan " &0638 47 61 6c 61 63 74 69 63 20 53 70 61 63 65 20 46 ; "Galactic Space F" &0648 65 64 65 72 61 74 69 6f 6e 2e 2e 2e 2e 2e 2e 2e ; "ederation......." ; shuffle_bits_in_byte # 76543210 &0658 48 PHA ; byte &0659 29 55 AND #&55 ; .6.4.2.1 # .6.4.2.0 &065b 0a ASL A # 6.4.2.0. &065c 85 0a STA &0a ; tmp &065e 68 PLA ; byte &065f 29 aa AND #&aa # 7.5.3.1. &0661 4a LSR A # .7.5.3.1 &0662 05 0a ORA &0a ; tmp # 67452301 &0664 60 RTS ; next_block &0665 20 98 07 JSR &0798 ; get_byte_from_tape &0668 20 58 06 JSR &0658 ; shuffle_bits_in_byte &066b a6 04 LDX &04 ; fifth_stage_offset &066d 9d 00 0c STA &0c00,X ; fifth_stage # Read one byte of fifth stage per block &0670 e6 04 INC &04 ; fifth_stage_offset &0672 a9 60 LDA #&60 &0674 85 05 STA &05 ; bytes_remaining &0676 c6 20 DEC &20 ; blocks_remaining + 2 &0678 a5 20 LDA &20 ; blocks_remaining + 2 &067a c9 2f CMP #&2f ; "0" - 1 &067c d0 19 BNE &0697 ; write_blocks_remaining &067e a9 39 LDA #&39 ; "9" &0680 85 20 STA &20 ; blocks_remaining + 2 &0682 c6 1f DEC &1f ; blocks_remaining + 1 &0684 a5 1f LDA &1f ; blocks_remaining + 1 &0686 c9 2f CMP #&2f ; "0" - 1 &0688 d0 0d BNE &0697 ; write_blocks_remaining &068a a9 39 LDA #&39 ; "9" &068c 85 1f STA &1f ; blocks_remaining + 1 &068e c6 1e DEC &1e ; blocks_remaining &0690 a5 1e LDA &1e ; blocks_remaining &0692 c9 2f CMP #&2f ; "0" - 1 &0694 d0 01 BNE &0697 ; write_blocks_remaining &0696 60 RTS ; write_blocks_remaining &0697 98 TYA &0698 48 PHA ; tmp_y &0699 a2 08 LDX #&08 &069b 20 39 07 JSR &0739 ; calculate_screen_address &069e a9 03 LDA #&03 &06a0 8d 38 07 STA &0738 ; text_colour &06a3 20 60 07 JSR &0760 ; plot_string &06a6 42 6c 6f 63 6b 73 20 6c 65 66 74 20 74 6f 20 6c ; "Blocks left to l" &06b6 6f 61 64 20 3a 00 ; "oad :" &06bc a5 1e LDA &1e ; blocks_remaining &06be 20 ce 06 JSR &06ce ; plot_character &06c1 a5 1f LDA &1f ; blocks_remaining + 1 &06c3 20 ce 06 JSR &06ce ; plot_character &06c6 a5 20 LDA &20 ; blocks_remaining + 2 &06c8 20 ce 06 JSR &06ce ; plot_character &06cb 68 PLA ; tmp_y &06cc a8 TAY &06cd 60 RTS ; plot_character &06ce 38 SEC &06cf e9 20 SBC #&20 ; " " &06d1 85 28 STA &28 ; font_address_low &06d3 a9 00 LDA #&00 &06d5 06 28 ASL &28 ; font_address_low &06d7 2a ROL A &06d8 06 28 ASL &28 ; font_address_low &06da 2a ROL A &06db 06 28 ASL &28 ; font_address_low &06dd 2a ROL A &06de 69 09 ADC #&09 ; &0900 = font_data &06e0 85 29 STA &29 ; font_address_high &06e2 a5 2a LDA &2a ; screen_address_low &06e4 18 CLC &06e5 69 08 ADC #&08 &06e7 85 2c STA &2c ; right_screen_address_low &06e9 a5 2b LDA &2b ; screen_address_high &06eb 69 00 ADC #&00 &06ed 85 2d STA &2d ; right_screen_address_high &06ef 98 TYA &06f0 48 PHA ; tmp_y &06f1 a0 07 LDY #&07 ; plot_character_loop &06f3 b1 28 LDA (&28),Y ; font_address &06f5 4a LSR A &06f6 4a LSR A &06f7 4a LSR A &06f8 4a LSR A &06f9 20 1a 07 JSR &071a ; apply_text_colour &06fc 91 2a STA (&2a),Y ; screen_address &06fe b1 28 LDA (&28),Y ; font_address &0700 29 0f AND #&0f &0702 20 1a 07 JSR &071a ; apply_text_colour &0705 91 2c STA (&2c),Y ; right_screen_address &0707 88 DEY &0708 10 e9 BPL &06f3 ; plot_character_loop &070a a5 2a LDA &2a ; screen_address_low &070c 18 CLC &070d 69 10 ADC #&10 &070f 85 2a STA &2a ; screen_address_low &0711 a5 2b LDA &2b; screen_address_high &0713 69 00 ADC #&00 &0715 85 2b STA &2b; screen_address_high &0717 68 PLA ; tmp_y &0718 a8 TAY &0719 60 RTS ; apply_text_colour &071a ae 38 07 LDX &0738 ; text_colour &071d f0 17 BEQ &0736 ; leave_with_zero &071f e0 01 CPX #&01 &0721 d0 01 BNE &0724 ; not_colour_1 &0723 60 RTS ; not_colour_1 &0724 e0 02 CPX #&02 &0726 d0 05 BNE &072d ; not_colour_2 &0728 0a ASL A &0729 0a ASL A &072a 0a ASL A &072b 0a ASL A &072c 60 RTS ; not_colour_2 &072d 85 2e STA &2e ; tmp &072f 0a ASL A &0730 0a ASL A &0731 0a ASL A &0732 0a ASL A &0733 05 2e ORA &2e ; tmp &0735 60 RTS ; leave_with_zero &0736 8a TXA &0737 60 RTS ; text_colour &0738 00 ; calculate_screen_address &0739 86 2c STX &2c ; tmp_low &073b a9 00 LDA #&00 ; &1c00 &073d 85 2a STA &2a ; screen_address_low &073f a9 1c LDA #&1c &0741 85 2b STA &2b ; screen_address_high &0743 a9 00 LDA #&00 &0745 06 2c ASL &2c ; tmp_low &0747 2a ROL A &0748 06 2c ASL &2c ; tmp_low &074a 2a ROL A &074b 06 2c ASL &2c ; tmp_low &074d 2a ROL A &074e 85 2d STA &2d ; tmp_high &0750 06 2c ASL &2c ; tmp_low &0752 2a ROL A &0753 a5 2a LDA &2a ; screen_address_low &0755 65 2c ADC &2c ; tmp_low &0757 85 2a STA &2a ; screen_address_low &0759 a5 2b LDA &2b ; screen_address_high &075b 65 2d ADC &2d ; tmp_high &075d 85 2b STA &2b ; screen_address_high &075f 60 RTS ; plot_string &0760 68 PLA # String follows call &0761 85 32 STA &32 ; text_address_low &0763 68 PLA &0764 85 33 STA &33 ; text_address_high &0766 a0 00 LDY #&00 ; plot_string_loop &0768 e6 32 INC &32 ; text_address_low &076a d0 02 BNE &076e ; skip_page &076c e6 33 INC &33 ; text_address_high ; skip_page &076e b1 32 LDA (&32),Y ; text_address &0770 f0 06 BEQ &0778 ; end_of_string &0772 20 ce 06 JSR &06ce ; plot_character &0775 4c 68 07 JMP &0768 ; plot_string_loop ; end_of_string &0778 e6 32 INC &32 ; text_address_low &077a d0 02 BNE &077e ; skip_page &077c e6 33 INC &33 ; text_address_high ; skip_page &077e 6c 32 00 JMP (&0032) ; text_address # Continue execution after string ; wipe_text_area &0781 a2 00 LDX #&00 &0783 8a TXA ; wipe_text_area_loop &0784 9d 00 1c STA &1c00,X # Wipe &1c00 - &1e7f &0787 9d 00 1d STA &1d00,X &078a 9d 80 1d STA &1d80,X &078d e8 INX &078e d0 f4 BNE &0784 ; wipe_text_area_loop &0790 60 RTS ; set_video_register &0791 8e 00 fe STX &fe00 ; video register number &0794 8d 01 fe STA &fe01 ; video register value &0797 60 RTS ; get_byte_from_tape &0798 ad 08 fe LDA &fe08 ; Cassette ACIA status register # &70 clear if no error occurred &079b 29 70 AND #&70 &079d f0 04 BEQ &07a3 ; no_error &079f a5 02 LDA &02 ; suppress_errors # Non-zero after start of data &07a1 d0 0b BNE &07ae ; loading_error ; no_error &07a3 ad 08 fe LDA &fe08 ; Cassette ACIA status register # &01 set if receiver interrupt occurred &07a6 29 01 AND #&01 &07a8 f0 ee BEQ &0798 ; get_byte_from_tape &07aa ad 09 fe LDA &fe09 ; Cassette ACIA data register &07ad 60 RTS ; loading_error &07ae 20 81 07 JSR &0781 ; wipe_text_area &07b1 a9 00 LDA #&00 &07b3 8d 10 fe STA &fe10 ; Serial ULA control register # Switch off cassette motor &07b6 a9 01 LDA #&01 &07b8 8d 38 07 STA &0738 ; text_colour &07bb a2 02 LDX #&02 &07bd 20 39 07 JSR &0739 ; calculate_screen_address &07c0 20 60 07 JSR &0760 ; plot_string &07c3 4c 6f 61 64 69 6e 67 20 65 72 72 6f 72 20 2d 20 ; "Loading error - " &07d3 72 65 77 69 6e 64 20 74 61 70 65 20 74 6f 20 73 ; "rewind tape to s" &07e3 74 61 72 74 00 ; "tart" &07e8 a9 20 LDA #&20 ; &2000 &07ea 85 01 STA &01 ; wipe_address_high &07ec a9 00 LDA #&00 &07ee 85 00 STA &00 ; wipe_address_low &07f0 a8 TAY ; wipe_memory_loop &07f1 91 00 STA (&00),Y ; wipe_address # Wipe &2000 - &7fff &07f3 99 00 0c STA &0c00,Y ; fifth_stage # Wipe &0c00 - &0cff &07f6 c8 INY &07f7 d0 f8 BNE &07f1 ; wipe_memory_loop &07f9 e6 01 INC &01 ; wipe_address_high &07fb 10 f4 BPL &07f1 ; wipe_memory_loop &07fd 4c 6f 04 JMP &046f ; wait_for_start_of_data ; irq1_handler &0800 8a TXA &0801 48 PHA ; tmp_x &0802 98 TYA &0803 48 PHA ; tmp_y &0804 a9 08 LDA #&08 ; &1708 &0806 85 90 STA &90 ; source_address_low &0808 a9 00 LDA #&00 ; &1700 &080a 85 92 STA &92 ; target_address_low &080c a9 17 LDA #&17 &080e 85 91 STA &91 ; source_address_high &0810 85 93 STA &93 ; target_address_high &0812 a2 05 LDX #&05 ; scroll_text_outer_loop &0814 a0 00 LDY #&00 ; scroll_text_inner_loop &0816 b1 90 LDA (&90),Y ; source_address &0818 91 92 STA (&92),Y ; target_address &081a c8 INY &081b 10 f9 BPL &0816 ; scroll_text_inner_loop &081d a5 90 LDA &90 ; source_address_low &081f 18 CLC &0820 69 80 ADC #&80 &0822 85 90 STA &90 ; source_address_low &0824 a5 91 LDA &91 ; source_address_high &0826 69 00 ADC #&00 &0828 85 91 STA &91 ; source_address_high &082a a5 92 LDA &92 ; target_address_low &082c 18 CLC &082d 69 80 ADC #&80 &082f 85 92 STA &92 ; target_address_low &0831 a5 93 LDA &93 ; target_address_high &0833 69 00 ADC #&00 &0835 85 93 STA &93 ; target_address_high &0837 ca DEX &0838 d0 da BNE &0814 ; scroll_text_outer_loop &083a e6 61 INC &61 ; scrolltext_nibble &083c a5 61 LDA &61 ; scrolltext_nibble &083e 29 01 AND #&01 &0840 08 PHP ; nibble &0841 f0 02 BEQ &0845 ; not_next_character &0843 e6 60 INC &60 ; scrolltext_offset ; not_next_character &0845 a6 60 LDX &60 ; scrolltext_offset &0847 bd 58 05 LDA &0558,X ; scrolltext_data &084a 38 SEC &084b e9 20 SBC #&20 &084d 85 3c STA &3c ; font_address_low &084f a9 00 LDA #&00 &0851 06 3c ASL &3c ; font_address_low &0853 2a ROL A &0854 06 3c ASL &3c ; font_address_low &0856 2a ROL A &0857 06 3c ASL &3c ; font_address_low &0859 2a ROL A &085a 69 09 ADC #&09 ; &0900 = font_data &085c 85 3d STA &3d ; font_address_high &085e a9 0f LDA #&0f &0860 28 PLP ; nibble &0861 f0 02 BEQ &0865 ; set_nibble &0863 a9 f0 LDA #&f0 ; set_nibble &0865 85 3e STA &3e ; nibble &0867 a0 07 LDY #&07 ; add_column_to_scrolltext_loop &0869 b1 3c LDA (&3c),Y ; font_address &086b 25 3e AND &3e ; nibble &086d 24 3e BIT &3e ; nibble &086f 10 04 BPL &0875 ; skip_shift &0871 4a LSR A &0872 4a LSR A &0873 4a LSR A &0874 4a LSR A ; skip_shift &0875 99 78 19 STA &1978,Y &0878 88 DEY &0879 10 ee BPL &0869 ; add_column_to_scrolltext_loop &087b a9 ff LDA #&ff &087d 8d 4d fe STA &fe4d ; System VIA interrupt flag register # Clear all interrupts &0880 68 PLA ; tmp_y &0881 a8 TAY &0882 68 PLA ; tmp_x &0883 aa TAX &0884 a5 fc LDA &fc ; irq_accumulator &0886 40 RTI ; initialise_screen_string &2535 16 01 ; MODE 1 &2537 17 00 01 00 00 00 00 00 00 00 00 00 ; disable cursor &2543 13 02 04 00 00 00 ; set colour 2 to blue &2549 13 03 03 00 00 00 ; set colour 2 to yellow &254f 19 04 10 00 78 00 ; MOVE &0010, &0078 &2555 19 05 10 00 dc 00 ; DRAW &0010, &00dc &255b 19 05 60 00 dc 00 ; DRAW &0060, &00dc &2561 19 05 70 00 cc 00 ; DRAW &0070, &00cc &2567 19 05 70 00 b0 00 ; DRAW &0070, &00b0 &256d 19 05 60 00 a4 00 ; DRAW &0060, &00a4 &2573 19 05 30 00 a4 00 ; DRAW &0030, &00a4 &2579 19 05 30 00 78 00 ; DRAW &0030, &0078 &257f 19 05 10 00 78 00 ; DRAW &0010, &0078 &2585 19 04 30 00 cc 00 ; MOVE &0030, &00cc &258b 19 05 50 00 cc 00 ; DRAW &0050, &00cc &2591 19 05 50 00 b0 00 ; DRAW &0050, &00b0 &2597 19 05 30 00 b0 00 ; DRAW &0030, &00b0 &259d 19 05 30 00 cc 00 ; DRAW &0030, &00cc &25a3 19 04 90 00 78 00 ; MOVE &0090, &0078 &25a9 19 05 e0 00 78 00 ; DRAW &00e0, &0078 &25af 19 05 f0 00 88 00 ; DRAW &00f0, &0088 &25b5 19 05 f0 00 94 00 ; DRAW &00f0, &0094 &25bb 19 05 e0 00 a4 00 ; DRAW &00e0, &00a4 &25c1 19 05 b0 00 a4 00 ; DRAW &00b0, &00a4 &25c7 19 05 b0 00 b0 00 ; DRAW &00b0, &00b0 &25cd 19 05 f0 00 b0 00 ; DRAW &00f0, &00b0 &25d3 19 05 f0 00 c0 00 ; DRAW &00f0, &00c0 &25d9 19 05 a0 00 c0 00 ; DRAW &00a0, &00c0 &25df 19 05 90 00 b0 00 ; DRAW &0090, &00b0 &25e5 19 05 90 00 a4 00 ; DRAW &0090, &00a4 &25eb 19 05 a0 00 94 00 ; DRAW &00a0, &0094 &25f1 19 05 d0 00 94 00 ; DRAW &00d0, &0094 &25f7 19 05 d0 00 88 00 ; DRAW &00d0, &0088 &25fd 19 05 90 00 88 00 ; DRAW &0090, &0088 &2603 19 05 90 00 78 00 ; DRAW &0090, &0078 &2609 19 04 20 01 6c 00 ; MOVE &0120, &006c &260f 19 05 60 01 6c 00 ; DRAW &0160, &006c &2615 19 05 70 01 78 00 ; DRAW &0170, &0078 &261b 19 05 70 01 c0 00 ; DRAW &0170, &00c0 &2621 19 05 50 01 c0 00 ; DRAW &0150, &00c0 &2627 19 05 50 01 94 00 ; DRAW &0150, &0094 &262d 19 05 30 01 94 00 ; DRAW &0130, &0094 &2633 19 05 30 01 c0 00 ; DRAW &0130, &00c0 &2639 19 05 10 01 c0 00 ; DRAW &0110, &00c0 &263f 19 05 10 01 94 00 ; DRAW &0110, &0094 &2645 19 05 20 01 88 00 ; DRAW &0120, &0088 &264b 19 05 50 01 88 00 ; DRAW &0150, &0088 &2651 19 05 50 01 78 00 ; DRAW &0150, &0078 &2657 19 05 20 01 78 00 ; DRAW &0120, &0078 &265d 19 05 20 01 6c 00 ; DRAW &0120, &006c &2663 19 04 a0 01 78 00 ; MOVE &01a0, &0078 &2669 19 05 e0 01 78 00 ; DRAW &01e0, &0078 &266f 19 05 f0 01 88 00 ; DRAW &01f0, &0088 &2675 19 05 f0 01 94 00 ; DRAW &01f0, &0094 &267b 19 05 d0 01 94 00 ; DRAW &01d0, &0094 &2681 19 05 d0 01 88 00 ; DRAW &01d0, &0088 &2687 19 05 b0 01 88 00 ; DRAW &01b0, &0088 &268d 19 05 b0 01 b0 00 ; DRAW &01b0, &00b0 &2693 19 05 d0 01 b0 00 ; DRAW &01d0, &00b0 &2699 19 05 d0 01 a4 00 ; DRAW &01d0, &00a4 &269f 19 05 f0 01 a4 00 ; DRAW &01f0, &00a4 &26a5 19 05 f0 01 b0 00 ; DRAW &01f0, &00b0 &26ab 19 05 e0 01 c0 00 ; DRAW &01e0, &00c0 &26b1 19 05 d0 01 c0 00 ; DRAW &01d0, &00c0 &26b7 19 05 a0 01 c0 00 ; DRAW &01a0, &00c0 &26bd 19 05 90 01 b0 00 ; DRAW &0190, &00b0 &26c3 19 05 90 01 88 00 ; DRAW &0190, &0088 &26c9 19 05 a0 01 78 00 ; DRAW &01a0, &0078 &26cf 19 04 20 02 78 00 ; MOVE &0220, &0078 &26d5 19 05 70 02 78 00 ; DRAW &0270, &0078 &26db 19 05 70 02 b0 00 ; DRAW &0270, &00b0 &26e1 19 05 60 02 c0 00 ; DRAW &0260, &00c0 &26e7 19 05 20 02 c0 00 ; DRAW &0220, &00c0 &26ed 19 05 20 02 b0 00 ; DRAW &0220, &00b0 &26f3 19 05 50 02 b0 00 ; DRAW &0250, &00b0 &26f9 19 05 50 02 a4 00 ; DRAW &0250, &00a4 &26ff 19 05 20 02 a4 00 ; DRAW &0220, &00a4 &2705 19 05 10 02 94 00 ; DRAW &0210, &0094 &270b 19 05 10 02 88 00 ; DRAW &0210, &0088 &2711 19 05 20 02 78 00 ; DRAW &0220, &0078 &2717 19 04 30 02 88 00 ; MOVE &0230, &0088 &271d 19 05 50 02 88 00 ; DRAW &0250, &0088 &2723 19 05 50 02 94 00 ; DRAW &0250, &0094 &2729 19 05 30 02 94 00 ; DRAW &0230, &0094 &272f 19 05 30 02 88 00 ; DRAW &0230, &0088 &2735 19 04 90 02 78 00 ; MOVE &0290, &0078 &273b 19 05 e0 02 78 00 ; DRAW &02e0, &0078 &2741 19 05 f0 02 88 00 ; DRAW &02f0, &0088 &2747 19 05 f0 02 94 00 ; DRAW &02f0, &0094 &274d 19 05 e0 02 a4 00 ; DRAW &02e0, &00a4 &2753 19 05 b0 02 a4 00 ; DRAW &02b0, &00a4 &2759 19 05 b0 02 b0 00 ; DRAW &02b0, &00b0 &275f 19 05 f0 02 b0 00 ; DRAW &02f0, &00b0 &2765 19 05 f0 02 c0 00 ; DRAW &02f0, &00c0 &276b 19 05 a0 02 c0 00 ; DRAW &02a0, &00c0 &2771 19 05 90 02 b0 00 ; DRAW &0290, &00b0 &2777 19 05 90 02 a4 00 ; DRAW &0290, &00a4 &277d 19 05 a0 02 94 00 ; DRAW &02a0, &0094 &2783 19 05 d0 02 94 00 ; DRAW &02d0, &0094 &2789 19 05 d0 02 88 00 ; DRAW &02d0, &0088 &278f 19 05 90 02 88 00 ; DRAW &0290, &0088 &2795 19 05 90 02 78 00 ; DRAW &0290, &0078 &279b 19 04 20 03 dc 00 ; MOVE &0320, &00dc &27a1 19 05 40 03 dc 00 ; DRAW &0340, &00dc &27a7 19 05 40 03 c0 00 ; DRAW &0340, &00c0 &27ad 19 05 60 03 c0 00 ; DRAW &0360, &00c0 &27b3 19 05 60 03 b0 00 ; DRAW &0360, &00b0 &27b9 19 05 40 03 b0 00 ; DRAW &0340, &00b0 &27bf 19 05 40 03 88 00 ; DRAW &0340, &0088 &27c5 19 05 60 03 88 00 ; DRAW &0360, &0088 &27cb 19 05 60 03 78 00 ; DRAW &0360, &0078 &27d1 19 05 30 03 78 00 ; DRAW &0330, &0078 &27d7 19 05 20 03 88 00 ; DRAW &0320, &0088 &27dd 19 05 20 03 b0 00 ; DRAW &0320, &00b0 &27e3 19 05 10 03 b0 00 ; DRAW &0310, &00b0 &27e9 19 05 10 03 c0 00 ; DRAW &0310, &00c0 &27ef 19 05 20 03 c0 00 ; DRAW &0320, &00c0 &27f5 19 05 20 03 dc 00 ; DRAW &0320, &00dc &27fb 19 04 90 03 78 00 ; MOVE &0390, &0078 &2801 19 05 b0 03 78 00 ; DRAW &03b0, &0078 &2807 19 05 b0 03 a4 00 ; DRAW &03b0, &00a4 &280d 19 05 c0 03 a4 00 ; DRAW &03c0, &00a4 &2813 19 05 c0 03 b0 00 ; DRAW &03c0, &00b0 &2819 19 05 d0 03 b0 00 ; DRAW &03d0, &00b0 &281f 19 05 d0 03 a4 00 ; DRAW &03d0, &00a4 &2825 19 05 f0 03 a4 00 ; DRAW &03f0, &00a4 &282b 19 05 f0 03 b0 00 ; DRAW &03f0, &00b0 &2831 19 05 e0 03 c0 00 ; DRAW &03e0, &00c0 &2837 19 05 c0 03 c0 00 ; DRAW &03c0, &00c0 &283d 19 05 c0 03 b0 00 ; DRAW &03c0, &00b0 &2843 19 05 b0 03 b0 00 ; DRAW &03b0, &00b0 &2849 19 05 b0 03 c0 00 ; DRAW &03b0, &00c0 &284f 19 05 90 03 c0 00 ; DRAW &0390, &00c0 &2855 19 05 90 03 78 00 ; DRAW &0390, &0078 &285b 19 04 20 04 78 00 ; MOVE &0420, &0078 &2861 19 05 60 04 78 00 ; DRAW &0460, &0078 &2867 19 05 60 04 88 00 ; DRAW &0460, &0088 &286d 19 05 50 04 88 00 ; DRAW &0450, &0088 &2873 19 05 50 04 b0 00 ; DRAW &0450, &00b0 &2879 19 05 60 04 b0 00 ; DRAW &0460, &00b0 &287f 19 05 60 04 c0 00 ; DRAW &0460, &00c0 &2885 19 05 20 04 c0 00 ; DRAW &0420, &00c0 &288b 19 05 20 04 b0 00 ; DRAW &0420, &00b0 &2891 19 05 30 04 b0 00 ; DRAW &0430, &00b0 &2897 19 05 30 04 88 00 ; DRAW &0430, &0088 &289d 19 05 20 04 88 00 ; DRAW &0420, &0088 &28a3 19 05 20 04 78 00 ; DRAW &0420, &0078 &28a9 19 04 30 04 cc 00 ; MOVE &0430, &00cc &28af 19 05 50 04 cc 00 ; DRAW &0450, &00cc &28b5 19 05 50 04 dc 00 ; DRAW &0450, &00dc &28bb 19 05 30 04 dc 00 ; DRAW &0430, &00dc &28c1 19 05 30 04 cc 00 ; DRAW &0430, &00cc &28c7 19 04 a0 04 78 00 ; MOVE &04a0, &0078 &28cd 19 05 f0 04 78 00 ; DRAW &04f0, &0078 &28d3 19 05 f0 04 b0 00 ; DRAW &04f0, &00b0 &28d9 19 05 e0 04 c0 00 ; DRAW &04e0, &00c0 &28df 19 05 a0 04 c0 00 ; DRAW &04a0, &00c0 &28e5 19 05 a0 04 b0 00 ; DRAW &04a0, &00b0 &28eb 19 05 d0 04 b0 00 ; DRAW &04d0, &00b0 &28f1 19 05 d0 04 a4 00 ; DRAW &04d0, &00a4 &28f7 19 05 a0 04 a4 00 ; DRAW &04a0, &00a4 &28fd 19 05 90 04 94 00 ; DRAW &0490, &0094 &2903 19 05 90 04 88 00 ; DRAW &0490, &0088 &2909 19 05 a0 04 78 00 ; DRAW &04a0, &0078 &290f 19 04 b0 04 88 00 ; MOVE &04b0, &0088 &2915 19 05 d0 04 88 00 ; DRAW &04d0, &0088 &291b 19 05 d0 04 94 00 ; DRAW &04d0, &0094 &2921 19 05 b0 04 94 00 ; DRAW &04b0, &0094 &2927 19 05 b0 04 88 00 ; DRAW &04b0, &0088 &292d 12 00 02 ; GCOL 0, 2 &2930 19 04 00 00 28 00 ; MOVE &0000, &0028 &2936 19 05 fc 04 28 00 ; DRAW &04fc, &0028 &293c 11 01 ; COLOUR 1 &293e 1f 00 1d ; TAB(&00, &1d) &2941 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 49 4c 54 44 4e 20 ; "..........ILTDN " &2951 74 68 65 20 4d 65 67 61 20 42 65 69 6e 67 2e 2e ; "the Mega Being.." &2961 2e 2e 2e 2e 2e 2e 2e 2e ; "........" &2969 ff ; end of string ; unused &6b6b 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &6b7b 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &6b8b 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &6b9b 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &6bab 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &6bbb 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &6bcb 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &6bdb 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &6beb 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &6bfb 00 00 00 00 00 # &0c00 - &0cff is read one byte per block ; fifth_stage &0c00 78 SEI &0c01 d8 CLD &0c02 a9 df LDA #&df &0c04 2d 6b fe AND &fe6b ; User VIA auxiliary control register # Set User VIA timer 2 to one-shot &0c07 8d 6b fe STA &fe6b ; User VIA auxiliary control register &0c0a a9 a0 LDA #&a0 # Enable User VIA timer 2 interrupts &0c0c 8d 6e fe STA &fe6e ; User VIA interrupt enable register &0c0f a9 00 LDA #&00 &0c11 8d 68 fe STA &fe68 ; User VIA timer 2 counter LSB &0c14 8d 69 fe STA &fe69 ; User VIA timer 2 counter MSB &0c17 a2 04 LDX #&04 ; fifth_stage_decryption_loop # Decrypt &2000 - &7fff &0c19 86 60 STX &60 ; round &0c1b ad 69 fe LDA &fe69 ; User VIA timer 2 counter MSB &0c1e 48 PHA ; tmp &0c1f ad 68 fe LDA &fe68 ; User VIA timer 2 counter LSB &0c22 8d 69 fe STA &fe69 ; User VIA timer 2 counter MSB &0c25 68 PLA ; tmp &0c26 8d 68 fe STA &fe68 ; User VIA timer 2 counter LSB &0c29 8a TXA &0c2a 18 CLC &0c2b 6d 68 fe ADC &fe68 ; User VIA timer 2 counter LSB &0c2e a8 TAY &0c2f ad 00 20 LDA &2000 # actually LDA decryption_source_address &0c32 4d 68 fe EOR &fe68 ; User VIA timer 2 counter LSB &0c35 5d 00 0c EOR &0c00,X ; fifth_stage &0c38 4d 69 fe EOR &fe69 ; User VIA timer 2 counter MSB &0c3b 49 ff EOR #&ff # actually EOR fifth_stage_eor_one &0c3d 45 60 EOR &60 ; round &0c3f 48 PHA ; tmp &0c40 ad 68 fe LDA &fe68 ; User VIA timer 2 counter LSB &0c43 38 SEC &0c44 6d 69 fe ADC &fe69 ; User VIA timer 2 counter MSB &0c47 49 55 EOR #&55 &0c49 8d 68 fe STA &fe68 ; User VIA timer 2 counter LSB &0c4c 68 PLA ; tmp &0c4d 59 00 0c EOR &0c00,Y ; fifth_stage &0c50 ac 30 0c LDY &0c30 ; decryption_source_address_low &0c53 59 00 0c EOR &0c00,Y ; fifth_stage &0c56 49 00 EOR #&00 # actually EOR fifth_stage_eor_two &0c58 4d 69 fe EOR &fe69 ; User VIA timer 2 counter MSB &0c5b 4d 80 0c EOR &0c80 # actually EOR &0c00 + fifth_stage_offset_one &0c5e ee 5c 0c INC &0c5c ; fifth_stage_offset_one &0c61 ac 68 fe LDY &fe68 ; User VIA timer 2 counter LSB &0c64 59 00 0c EOR &0c00,Y ; fifth_stage &0c67 49 ff EOR #&ff # actually EOR fifth_stage_eor_three &0c69 ac 69 fe LDY &fe69 ; User VIA timer 2 counter MSB &0c6c 59 00 0c EOR &0c00,Y ; fifth_stage &0c6f c8 INY &0c70 4d 00 0c EOR &0c00 # actually EOR &0c00 + fifth_stage_offset_two &0c73 48 PHA ; tmp &0c74 ad 71 0c LDA &0c71 ; fifth_stage_offset_two &0c77 6d 68 fe ADC &fe68 ; User VIA timer 2 counter LSB &0c7a 8d 71 0c STA &0c71 ; fifth_stage_offset_two &0c7d 68 PLA ; tmp &0c7e 48 PHA ; tmp &0c7f b9 00 0c LDA &0c00,Y ; fifth_stage &0c82 5d 00 0c EOR &0c00,X ; fifth_stage &0c85 4d 68 fe EOR &fe68 ; User VIA timer 2 counter LSB &0c88 4d 69 fe EOR &fe69 ; User VIA timer 2 counter MSB &0c8b 8d 90 0c STA &0c90 ; fifth_stage_eor_four &0c8e 68 PLA ; tmp &0c8f 49 00 EOR #&00 # actually EOR fifth_stage_eor_four &0c91 ee 95 0c INC &0c95 ; fifth_stage_eor_five &0c94 49 5d EOR #&5d # actually EOR fifth_stage_eor_five &0c96 5d 00 0c EOR &0c00,X ; fifth_stage &0c99 49 26 EOR #&26 # actually EOR fifth_stage_eor_six &0c9b 8d 00 20 STA &2000 # actually STA decryption_target_address &0c9e ad 68 0c LDA &0c68 ; fifth_stage_eor_three &0ca1 18 CLC &0ca2 6d 68 fe ADC &fe68 ; User VIA timer 2 counter LSB &0ca5 49 55 EOR #&55 &0ca7 8d 68 0c STA &0c68 ; fifth_stage_eor_three &0caa ad 3c 0c LDA &0c3c ; fifth_stage_eor_one &0cad ed 69 fe SBC &fe69 ; User VIA timer 2 counter MSB &0cb0 49 aa EOR #&aa &0cb2 8d 3c 0c STA &0c3c ; fifth_stage_eor_one &0cb5 ad 57 0c LDA &0c57 ; fifth_stage_eor_two &0cb8 ed 68 fe SBC &fe68 ; User VIA timer 2 counter LSB &0cbb 6d 69 fe ADC &fe69 ; User VIA timer 2 counter MSB &0cbe 4d 68 fe EOR &fe68 ; User VIA timer 2 counter LSB &0cc1 0d 69 fe ORA &fe69 ; User VIA timer 2 counter MSB &0cc4 8d 57 0c STA &0c57 ; fifth_stage_eor_two &0cc7 ad 9a 0c LDA &0c9a ; fifth_stage_eor_six &0cca 6d 68 fe ADC &fe68 ; User VIA timer 2 counter LSB &0ccd f9 00 0c SBC &0c00,Y ; fifth_stage &0cd0 5d 00 0c EOR &0c00,X ; fifth_stage &0cd3 8d 9a 0c STA &0c9a ; fifth_stage_eor_six &0cd6 ee 31 0c INC &0c31 ; decryption_source_address_high &0cd9 ee 9d 0c INC &0c9d ; decryption_target_address_high &0cdc 30 03 BMI &0ce1 ; next_byte_in_pages &0cde 4c 19 0c JMP &0c19 ; fifth_stage_decryption_loop ; next_byte_in_pages &0ce1 a9 20 LDA #&20 ; &2000 = main_binary &0ce3 8d 31 0c STA &0c31 ; decryption_source_address_high &0ce6 8d 9d 0c STA &0c9d ; decryption_target_address_high &0ce9 ee 30 0c INC &0c30 ; decryption_source_address_low &0cec ee 9c 0c INC &0c9c ; decryption_target_address_low &0cef f0 03 BEQ &0cf4 ; next_round &0cf1 4c 19 0c JMP &0c19 ; fifth_stage_decryption_loop ; next_round &0cf4 ca DEX &0cf5 f0 03 BEQ &0cfa ; end_of_decryption &0cf7 4c 19 0c JMP &0c19 ; fifth_stage_decryption_loop ; end_of_decryption &0cfa a9 20 LDA #&20 # Disable User VIA timer 2 interrupts &0cfc 8d 6e fe STA &fe6e ; User VIA interrupt enable register &0cff 60 RTS Game disassembly ================ ; (no filename) ; 00001200 00006f00 6e00 # &1200 - &6eff is decrypted and moved to &0300 - &5fff at &6f2d ; double_bits_in_nibble # Called with A = ....3210 &0300 85 d8 STA &d8 ; tmp # ....3210 c &0302 a9 00 LDA #&00 # ........ &0304 66 d8 ROR &d8 ; tmp # .....321 0 &0306 08 PHP ; tmp_0 &0307 6a ROR A # 0....... &0308 28 PLP ; tmp_0 &0309 6a ROR A # 00...... &030a 66 d8 ROR &d8 ; tmp # ......32 1 &030c 08 PHP ; tmp_1 &030d 6a ROR A # 100..... &030e 28 PLP ; tmp_1 &030f 6a ROR A # 1100.... &0310 66 d8 ROR &d8 ; tmp # .......3 2 &0312 08 PHP ; tmp_2 &0313 6a ROR A # 21100... &0314 28 PLP ; tmp_2 &0315 6a ROR A # 221100.. &0316 66 d8 ROR &d8 ; tmp # ........ 3 &0318 08 PHP ; tmp_3 &0319 6a ROR A # 3221100. &031a 28 PLP ; tmp_3 &031b 6a ROR A # 33221100 &031c 60 RTS # Leave with A = 33221100 ; plot_double_size_character &031d a5 d8 LDA &d8 ; font_address_low &031f 85 02 STA &02 ; double_font_address_low &0321 a5 d9 LDA &d9 ; font_address_high &0323 85 03 STA &03 ; double_font_address_high &0325 85 d5 STA &d5 ; text_double_size # Set to positive to use single size subcharacters &0327 a5 e0 LDA &e0 ; text_x &0329 85 04 STA &04 ; double_x &032b a5 e1 LDA &e1 ; text_y &032d 85 05 STA &05 ; double_y &032f f0 2c BEQ &035d ; skip_wipe &0331 24 bc BIT &bc ; text_inverted # Negative if text inverted &0333 30 28 BMI &035d ; skip_wipe ; wipe_bottom_of_double_size_character &0335 a2 03 LDX #&03 &0337 a5 da LDA &da ; text_screen_address_low &0339 85 d8 STA &d8 ; wipe_address_low &033b 38 SEC &033c a5 db LDA &db ; text_screen_address_high &033e e9 02 SBC #&02 ; wipe_bottom_of_double_size_character_loop &0340 29 1f AND #&1f # Keep address within screen memory &0342 09 60 ORA #&60 &0344 85 d9 STA &d9 ; wipe_address_high &0346 a9 00 LDA #&00 &0348 a0 06 LDY #&06 &034a 91 d8 STA (&d8),Y ; wipe_address # Clear bottom two rows of group &034c c8 INY &034d 91 d8 STA (&d8),Y ; wipe_address &034f a5 d8 LDA &d8 ; wipe_address_low &0351 18 CLC &0352 69 08 ADC #&08 # Move right four pixels &0354 85 d8 STA &d8 ; wipe_address_low &0356 a5 d9 LDA &d9 ; wipe_address_high &0358 69 00 ADC #&00 &035a ca DEX &035b 10 e3 BPL &0340 ; wipe_bottom_of_double_size_character_loop ; skip_wipe &035d a0 03 LDY #&03 &035f 20 7f 03 JSR &037f ; plot_half_of_double_size_character # Plot top half of character &0362 a6 04 LDX &04 ; double_x &0364 a4 05 LDY &05 ; double_y &0366 c8 INY &0367 20 c5 07 JSR &07c5 ; calculate_text_screen_address_from_X_Y &036a a0 07 LDY #&07 &036c 20 7f 03 JSR &037f ; plot_half_of_double_size_character # Plot bottom half of character &036f a5 04 LDA &04 ; double_x &0371 18 CLC &0372 69 04 ADC #&04 &0374 aa TAX &0375 a4 05 LDY &05 ; double_y &0377 20 c5 07 JSR &07c5 ; calculate_text_screen_address_from_X_Y &037a a9 ff LDA #&ff &037c 85 d5 STA &d5 ; text_double_size # Set to negative to use double size characters &037e 60 RTS ; plot_half_of_double_size_character &037f 98 TYA &0380 48 PHA ; offset &0381 a2 06 LDX #&06 ; copy_left_of_character_loop &0383 b1 02 LDA (&02),Y ; double_font_address &0385 4a LSR A # Use top nibble for left of character &0386 4a LSR A &0387 4a LSR A &0388 4a LSR A &0389 20 00 03 JSR &0300 ; double_bits_in_nibble &038c 9d da 22 STA &22da,X ; font_data # Store doubled character in "%" &038f 9d db 22 STA &22db,X ; font_data + 1 &0392 88 DEY &0393 ca DEX &0394 ca DEX &0395 10 ec BPL &0383 ; copy_left_of_character_loop &0397 a9 25 LDA #&25 ; "%" &0399 20 b4 03 JSR &03b4 ; plot_character # Plot left of character &039c 68 PLA ; offset &039d a8 TAY &039e a2 06 LDX #&06 ; copy_right_of_character_loop &03a0 b1 02 LDA (&02),Y ; double_font_address &03a2 29 0f AND #&0f # Use bottom nibble for right of character &03a4 20 00 03 JSR &0300 ; double_bits_in_nibble &03a7 9d da 22 STA &22da,X ; font_data # Store doubled character in "%" &03aa 9d db 22 STA &22db,X ; font_data + 1 &03ad 88 DEY &03ae ca DEX &03af ca DEX &03b0 10 ee BPL &03a0 ; copy_right_of_character_loop &03b2 a9 25 LDA #&25 ; "%" # Plot right of character ; plot_character &03b4 48 PHA ; tmp_a &03b5 8a TXA &03b6 48 PHA ; tmp_x &03b7 98 TYA &03b8 48 PHA ; tmp_y &03b9 ba TSX &03ba bd 03 01 LDA &0103,X ; stack + 3 # Get tmp_a from stack &03bd c9 7e CMP #&7e ; "~" # &7e ("~") moves right half a character &03bf f0 71 BEQ &0432 ; move_right_half_a_character &03c1 20 45 04 JSR &0445 ; find_character_in_font &03c4 84 d8 STY &d8 ; font_address_low &03c6 a9 00 LDA #&00 &03c8 06 d8 ASL &d8 ; font_address_low &03ca 2a ROL A &03cb 06 d8 ASL &d8 ; font_address_low &03cd 2a ROL A &03ce 06 d8 ASL &d8 ; font_address_low &03d0 2a ROL A &03d1 85 d9 STA &d9 ; font_address_high &03d3 a5 d8 LDA &d8 ; font_address_low &03d5 69 da ADC #&da ; &22da = font_data &03d7 85 d8 STA &d8 ; font_address_low &03d9 a5 d9 LDA &d9 ; font_address_high &03db 69 22 ADC #&22 &03dd 85 d9 STA &d9 ; font_address_high &03df 24 d5 BIT &d5 ; text_double_size # Negative if text is double size &03e1 10 06 BPL &03e9 ; not_double_size_character &03e3 20 1d 03 JSR &031d ; plot_double_size_character &03e6 4c 2c 04 JMP &042c ; leave_after_restoring_registers ; not_double_size_character &03e9 24 bb BIT &bb ; text_as_sprites # Negative if plotting text as sprites &03eb 10 0a BPL &03f7 ; plot_regular_character &03ed ba TSX &03ee bd 03 01 LDA &0103,X ; stack + 3 # Get tmp_a from stack &03f1 20 06 15 JSR &1506 ; plot_character_as_sprite &03f4 4c 2c 04 JMP &042c ; leave_after_restoring_registers ; plot_regular_character &03f7 a5 da LDA &da ; text_screen_address_low &03f9 18 CLC &03fa 69 08 ADC #&08 &03fc 85 d6 STA &d6 ; right_text_screen_address_low &03fe a5 db LDA &db ; text_screen_address_high &0400 69 00 ADC #&00 &0402 85 d7 STA &d7 ; right_text_screen_address_high &0404 a0 07 LDY #&07 ; plot_regular_character_loop &0406 b1 d8 LDA (&d8),Y ; font_address &0408 4a LSR A # Use top nibble for left of character &0409 4a LSR A &040a 4a LSR A &040b 4a LSR A &040c 20 7f 04 JSR &047f ; apply_text_colour &040f 91 da STA (&da),Y ; text_screen_address &0411 b1 d8 LDA (&d8),Y ; font_address # Use bottom nibble for right of character &0413 20 7f 04 JSR &047f ; apply_text_colour &0416 91 d6 STA (&d6),Y ; right_text_screen_address &0418 88 DEY &0419 10 eb BPL &0406 ; plot_regular_character_loop ; move_right_one_character &041b a5 da LDA &da ; text_screen_address_low &041d 18 CLC &041e 69 10 ADC #&10 # Move right eight pixels &0420 85 da STA &da ; text_screen_address_low &0422 a5 db LDA &db ; text_screen_address_high &0424 69 00 ADC #&00 &0426 85 db STA &db ; text_screen_address_high &0428 e6 e0 INC &e0 ; text_x ; leave_after_moving_right &042a e6 e0 INC &e0 ; text_x ; leave_after_restoring_registers &042c 68 PLA ; tmp_y &042d a8 TAY &042e 68 PLA ; tmp_x &042f aa TAX &0430 68 PLA ; tmp_a &0431 60 RTS ; move_right_half_a_character &0432 24 d5 BIT &d5 ; text_double_size # Negative if text is double size &0434 30 e5 BMI &041b ; move_right_one_character &0436 a5 da LDA &da ; text_screen_address_low &0438 18 CLC &0439 69 08 ADC #&08 # Move right four pixels &043b 85 da STA &da ; text_screen_address_low &043d a5 db LDA &db ; text_screen_address_high &043f 69 00 ADC #&00 &0441 85 db STA &db ; text_screen_address_high &0443 d0 e5 BNE &042a ; leave_after_moving_right # Always branches ; find_character_in_font &0445 a0 2e LDY #&2e ; find_character_in_font_loop &0447 d9 50 04 CMP &0450,Y ; font_characters &044a f0 03 BEQ &044f ; found_character &044c 88 DEY &044d 10 f8 BPL &0447 ; find_character_in_font_loop ; found_character &044f 60 RTS ; font_characters &0450 25 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f ;"%ABCDEFGHIJKLMNO" &0460 50 51 52 53 54 55 56 57 58 59 5a 21 2a 5e 5f 2d ; "PQRSTUVWXYZ!*^_-" &0470 24 30 31 32 33 34 35 36 37 38 39 2e 20 2c 27 ; "$0123456789. ,'" ; apply_text_colour &047f 45 bc EOR &bc ; text_inverted # Negative if text inverted &0481 29 0f AND #&0f # Use bottom nibble of byte to set pixels &0483 a6 fd LDX &fd ; text_colour &0485 f0 17 BEQ &049e ; leave_with_zero &0487 e0 01 CPX #&01 &0489 d0 01 BNE &048c ; not_colour_1 &048b 60 RTS ; not_colour_1 &048c e0 02 CPX #&02 &048e d0 05 BNE &0495 ; not_colour_2 &0490 0a ASL A &0491 0a ASL A &0492 0a ASL A &0493 0a ASL A &0494 60 RTS ; not_colour_2 &0495 85 ff STA &ff ; tmp &0497 0a ASL A &0498 0a ASL A &0499 0a ASL A &049a 0a ASL A &049b 05 ff ORA &ff ; tmp &049d 60 RTS ; leave_with_zero &049e 8a TXA &049f 60 RTS ; unused # Individual pixels in colours 0 - 3 &04a0 00 00 00 00 &04a4 08 04 02 01 &04a8 80 40 20 10 &04ac 88 44 22 11 ; initialise_screen &04b0 20 3a 06 JSR &063a ; initialise_sound &04b3 20 4b 07 JSR &074b ; wait_for_vsync &04b6 a9 00 LDA #&00 # Hide screen &04b8 20 ec 07 JSR &07ec ; set_screen_width &04bb a2 0d LDX #&0d ; R13: Displayed screen start address register (low) &04bd a9 00 LDA #&00 &04bf 85 a0 STA &a0 ; crtc_start_address_low &04c1 85 a2 STA &a2 ; screen_start_address_low &04c3 20 ee 07 JSR &07ee ; write_video_register &04c6 ca DEX &04c7 a9 0c LDA #&0c ; R12: Displayed screen start address register (high) &04c9 85 a1 STA &a1 ; crtc_start_address_high &04cb 20 ee 07 JSR &07ee ; write_video_register &04ce a9 60 LDA #&60 # Set screen start address to &6000 &04d0 85 a3 STA &a3 ; screen_start_address_high &04d2 a9 03 LDA #&03 &04d4 85 fd STA &fd ; text_colour &04d6 a9 60 LDA #&60 &04d8 85 01 STA &01 ; wipe_address_high &04da a9 00 LDA #&00 &04dc 85 00 STA &00 ; wipe_address_low &04de a8 TAY ; wipe_6000_to_7fff_loop # Wipe screen memory &04df 91 00 STA (&00),Y ; wipe_address &04e1 c8 INY &04e2 d0 fb BNE &04df ; wipe_6000_to_7fff_loop &04e4 e6 01 INC &01 ; wipe_address_high &04e6 10 f7 BPL &04df ; wipe_6000_to_7fff_loop &04e8 85 d5 STA &d5 ; text_double_size # Set to positive to use regular size characters &04ea 85 bb STA &bb ; text_as_sprites # Set to positive to plot text, not sprites &04ec 85 bc STA &bc ; text_inverted # Set to positive to use uninverted text &04ee aa TAX &04ef 20 c5 07 JSR &07c5 ; calculate_text_screen_address_from_X_Y &04f2 a2 07 LDX #&07 ; set_initial_palette_loop &04f4 bd 00 05 LDA &0500,X ; initial_palette &04f7 20 08 05 JSR &0508 ; set_palette &04fa ca DEX &04fb 10 f7 BPL &04f4 ; set_initial_palette_loop &04fd 86 fe STX &fe ; colour_to_rotate # Set to negative to indicate no colour rotating &04ff 60 RTS ; initial_palette &0500 03 04 01 00 ; Y B R K # Top palette &0504 07 06 05 00 ; W C M K # Bottom palette ; set_palette # Called with X = logical colour, A = physical colour &0508 29 07 AND #&07 &050a 85 d3 STA &d3 ; physical_colour &050c 98 TYA &050d 48 PHA ; tmp_y &050e a9 07 LDA #&07 &0510 38 SEC &0511 e5 d3 SBC &d3 ; physical_colour &0513 85 d3 STA &d3 ; physical_colour &0515 86 d4 STX &d4 ; logical_colour &0517 8a TXA &0518 0a ASL A # X = logical_colour * 4 &0519 0a ASL A &051a aa TAX &051b a0 03 LDY #&03 # Y = location (0 - 3) ; set_palette_values_loop &051d a5 d4 LDA &d4 ; logical_colour &051f 49 03 EOR #&03 &0521 85 d1 STA &d1 ; colour &0523 84 d2 STY &d2 ; location &0525 a9 00 LDA #&00 &0527 46 d2 LSR &d2 ; location &0529 6a ROR A &052a 46 d1 LSR &d1 ; colour &052c 6a ROR A &052d 46 d2 LSR &d2 ; location &052f 6a ROR A &0530 46 d1 LSR &d1 ; colour &0532 6a ROR A &0533 05 d3 ORA &d3 ; physical_colour &0535 9d 00 01 STA &0100,X ; palette_values # Store at ((logical_colour * 4) + location) &0538 e8 INX &0539 88 DEY &053a 10 e1 BPL &051d ; set_palette_values_loop &053c 68 PLA ; tmp_y &053d a8 TAY &053e a6 d4 LDX &d4 ; logical_colour # Restore initial X &0540 60 RTS ; is_timer_interrupt &0541 a2 0f LDX #&0f &0543 86 bf STX &bf ; palette_section # Set to positive to indicate in bottom section &0545 bd 00 01 LDA &0100,X ; palette_values ; use_bottom_palette &0548 8d 21 fe STA &fe21 ; video ULA palette register &054b ca DEX &054c 10 f7 BPL &0545 ; use_bottom_palette &054e 8e 4d fe STX &fe4d ; System VIA interrupt flag register # Clear all interrupts &0551 a6 8d LDX &8d ; tmp_x &0553 a5 fc LDA &fc ; irq_accumulator &0555 40 RTI ; irq1_handler &0556 d8 CLD &0557 86 8d STX &8d ; tmp_x &0559 ad 4d fe LDA &fe4d ; System VIA interrupt flag register &055c 29 02 AND #&02 # &02 set if interrupt caused by a v-sync &055e f0 e1 BEQ &0541 ; is_timer_interrupt ; is_vsync_interrupt &0560 e6 ff INC &ff ; frame_counter &0562 a2 0f LDX #&0f ; use_top_palette_loop &0564 bd 10 01 LDA &0110,X ; palette_values + 16 &0567 8d 21 fe STA &fe21 ; video ULA palette register &056a ca DEX &056b 10 f7 BPL &0564 ; use_top_palette_loop &056d 86 bf STX &bf ; palette_section # Set to negative to indicate in top section &056f a9 56 LDA #&56 &0571 8d 48 fe STA &fe48 ; System VIA timer 2 counter LSB &0574 a9 1a LDA #&1a &0576 8d 49 fe STA &fe49 ; System VIA timer 2 counter MSB &0579 ad c0 fe LDA &fec0 ; ADC conversion status &057c 29 01 AND #&01 &057e aa TAX &057f ad c1 fe LDA &fec1 ; ADC data high &0582 95 ac STA &ac,X ; joystick_values &0584 ad c0 fe LDA &fec0 ; ADC conversion status &0587 29 01 AND #&01 # Get previous channel &0589 49 01 EOR #&01 # Use other channel (first joystick), 8 bit conversion &058b 8d c0 fe STA &fec0 ; ADC start conversion &058e 20 b9 06 JSR &06b9 ; update_sounds &0591 a9 ff LDA #&ff # Set all bits to output &0593 8d 43 fe STA &fe43 ; System VIA data direction register A &0596 84 8e STY &8e ; tmp_y &0598 a9 0b LDA #&0b # Enable keyboard auto scan &059a 8d 40 fe STA &fe40 ; System VIA port B input/output register ; check_01f0_to_01ff # Copy protection &059d a9 00 LDA #&00 # crashes game if any byte in &01f0 - &01ff is non-zero &059f a2 0f LDX #&0f # i.e. end of stack has been used since entry_point ; check_01f0_to_01ff_loop &05a1 1d f0 01 ORA &01f0,X ; stack + &f0 # Always zero in game &05a4 ca DEX &05a5 10 fa BPL &05a1 ; check_01f0_to_01ff_loop &05a7 29 ff AND #&ff &05a9 d0 7b BNE &0626 ; leave_without_restoring_registers # Never branches; would crash game &05ab ad 7a 02 LDA &027a ; os_tube_presence_flag # Negative if tube present &05ae f0 05 BEQ &05b5 ; check_02ee_to_02fe &05b0 ad 80 02 LDA &0280 ; os_country_code # &00 = UK, &01 = US &05b3 d0 0c BNE &05c1 ; skip_check ; check_02ee_to_02fe # Copy protection &05b5 a2 10 LDX #&10 # crashes game if any byte in &02ee - &02fe is non-zero ; check_02ee_to_02fe_loop # i.e. anything has been *LOADed since loader &05b7 1d ee 02 ORA &02ee,X ; os_osfile_control_block # Always zero in game &05ba ca DEX &05bb 10 fa BPL &05b7 ; check_02ee_to_02fe_loop &05bd c9 00 CMP #&00 &05bf d0 65 BNE &0626 ; leave_without_restoring_registers # Never branches; would crash game ; skip_check &05c1 24 e2 BIT &e2 ; sound_muted # Negative if sound muted &05c3 30 3f BMI &0604 ; skip_updating_sounds &05c5 a5 1d LDA &1d ; channels_volume_byte_to_write &05c7 f0 08 BEQ &05d1 ; skip_channel_zero &05c9 20 27 06 JSR &0627 ; write_byte_to_sound_chip &05cc a5 1e LDA &1e ; channels_frequency_low_byte_to_write &05ce 20 27 06 JSR &0627 ; write_byte_to_sound_chip ; skip_channel_zero &05d1 a5 2d LDA &2d ; channels_volume_byte_to_write + &10 &05d3 f0 0d BEQ &05e2 ; skip_channel_one &05d5 20 27 06 JSR &0627 ; write_byte_to_sound_chip &05d8 a5 2e LDA &2e ; channels_frequency_low_byte_to_write + &10 &05da 20 27 06 JSR &0627 ; write_byte_to_sound_chip &05dd a5 2f LDA &2f ; channels_frequency_high_byte_to_write + &10 &05df 20 27 06 JSR &0627 ; write_byte_to_sound_chip ; skip_channel_one &05e2 a5 3d LDA &3d ; channels_volume_byte_to_write + &20 &05e4 f0 0d BEQ &05f3 ; skip_channel_two &05e6 20 27 06 JSR &0627 ; write_byte_to_sound_chip &05e9 a5 3e LDA &3e ; channels_frequency_low_byte_to_write + &20 &05eb 20 27 06 JSR &0627 ; write_byte_to_sound_chip &05ee a5 3f LDA &3f ; channels_frequency_high_byte_to_write + &20 &05f0 20 27 06 JSR &0627 ; write_byte_to_sound_chip ; skip_channel_two &05f3 a5 4d LDA &4d ; channels_volume_byte_to_write + &30 &05f5 f0 0d BEQ &0604 ; skip_channel_three &05f7 20 27 06 JSR &0627 ; write_byte_to_sound_chip &05fa a5 4e LDA &4e ; channels_frequency_low_byte_to_write + &30 &05fc 20 27 06 JSR &0627 ; write_byte_to_sound_chip &05ff a5 4f LDA &4f ; channels_frequency_high_byte_to_write + &30 &0601 20 27 06 JSR &0627 ; write_byte_to_sound_chip ; skip_channel_three ; skip_updating_sounds &0604 a6 fe LDX &fe ; colour_to_rotate # Positive if rotating a colour &0606 30 09 BMI &0611 ; skip_rotating_palette &0608 a5 ff LDA &ff ; frame_counter &060a 4a LSR A # Change colour every four frames &060b 4a LSR A &060c 29 07 AND #&07 &060e 20 08 05 JSR &0508 ; set_palette ; skip_rotating_palette &0611 a9 03 LDA #&03 # Disable keyboard auto scan &0613 8d 40 fe STA &fe40 ; System VIA port B input/output register &0616 a9 7f LDA #&7f # Set top bit as input, low seven bits as output &0618 8d 43 fe STA &fe43 ; System VIA data direction register A &061b a9 ff LDA #&ff # Clear all interrupts &061d 8d 4d fe STA &fe4d ; System VIA interrupt flag register &0620 a6 8d LDX &8d ; tmp_x &0622 a4 8e LDY &8e ; tmp_y &0624 a5 fc LDA &fc ; irq_accumulator ; leave_without_restoring_registers &0626 40 RTI ; write_byte_to_sound_chip &0627 8d 4f fe STA &fe4f ; System VIA input/output register A &062a a9 00 LDA #&00 # Set sound chip write pin low &062c 8d 40 fe STA &fe40 ; System VIA port B input/output register &062f a2 03 LDX #&03 ; delay_loop &0631 ca DEX &0632 d0 fd BNE &0631 ; delay_loop &0634 a9 08 LDA #&08 # Set sound chip write pin high &0636 8d 40 fe STA &fe40 ; System VIA port B input/output register &0639 60 RTS ; initialise_sound &063a 08 PHP ; processor status &063b 78 SEI &063c a2 00 LDX #&00 &063e 8a TXA ; initialise_channels_loop &063f 95 10 STA &10,X ; channels_data # Wipe &0010 - &004f &0641 e8 INX &0642 e0 40 CPX #&40 &0644 d0 f9 BNE &063f ; initialise_channels_loop &0646 a9 0b LDA #&0b # Enable keyboard auto scan &0648 8d 40 fe STA &fe40 ; System VIA port B input/output register &064b a9 ff LDA #&ff # Set all bits to output &064d 8d 43 fe STA &fe43 ; System VIA data direction register A &0650 20 27 06 JSR &0627 ; write_byte_to_sound_chip # Set channel 0 volume to 0 (silence) &0653 a9 9f LDA #&9f # Set channel 3 volume to 0 (silence) &0655 20 27 06 JSR &0627 ; write_byte_to_sound_chip &0658 a9 bf LDA #&bf # Set channel 2 volume to 0 (silence) &065a 20 27 06 JSR &0627 ; write_byte_to_sound_chip &065d a9 df LDA #&df # Set channel 1 volume to 0 (silence) &065f 20 27 06 JSR &0627 ; write_byte_to_sound_chip &0662 a9 7f LDA #&7f # Set top bit as input, low seven bits as output &0664 8d 43 fe STA &fe43 ; System VIA data direction register A &0667 a9 03 LDA #&03 # Disable keyboard auto scan &0669 8d 40 fe STA &fe40 ; System VIA port B input/output register &066c 28 PLP ; processor status &066d 60 RTS ; play_sound # Called with A = channel, XY = frequency &066e 85 02 STA &02 ; channel &0670 68 PLA # Parameters for sound follow call &0671 85 00 STA &00 ; parameters_address_low &0673 68 PLA &0674 85 01 STA &01 ; parameters_address_high &0676 08 PHP ; processor status &0677 86 03 STX &03 ; frequency_low &0679 84 04 STY &04 ; frequency_high &067b a5 02 LDA &02 ; channel &067d 0a ASL A &067e 0a ASL A &067f 0a ASL A &0680 0a ASL A &0681 48 PHA ; channel * 16 &0682 aa TAX &0683 a0 01 LDY #&01 &0685 78 SEI ; copy_sound_parameters_loop &0686 b1 00 LDA (&00),Y ; parameters_address &0688 95 12 STA &12,X ; channels_parameters &068a c8 INY &068b e8 INX &068c c0 09 CPY #&09 &068e d0 f6 BNE &0686 ; copy_sound_parameters_loop &0690 68 PLA ; channel * 16 &0691 aa TAX &0692 a5 03 LDA &03 ; frequency_low &0694 95 10 STA &10,X ; channels_frequency_low &0696 a5 04 LDA &04 ; frequency_high &0698 95 11 STA &11,X ; channels_frequency_high &069a 94 1a STY &1a,X ; channels_active # Set to non-zero to indicate channel active &069c b5 14 LDA &14,X ; channels_volume_cooldown &069e 95 1b STA &1b,X ; channels_volume_maximum_cooldown &06a0 b5 18 LDA &18,X ; channels_frequency_cooldown &06a2 95 1c STA &1c,X ; channels_frequency_maximum_cooldown &06a4 a5 00 LDA &00 ; parameters_address_low &06a6 18 CLC &06a7 69 09 ADC #&09 # Return after eight bytes of parameters &06a9 85 00 STA &00 ; parameters_address_low &06ab a5 01 LDA &01 ; parameters_address_high &06ad 69 00 ADC #&00 &06af 85 01 STA &01 ; parameters_address_high &06b1 a9 01 LDA #&01 &06b3 95 14 STA &14,X ; channels_volume_cooldown &06b5 28 PLP ; processor status &06b6 6c 00 00 JMP (&0000) ; parameters_address # Continue execution after parameters ; update_sounds &06b9 a2 00 LDX #&00 &06bb 86 16 STX &16 ; channels_updated # Set to zero to indicate channel not updated &06bd a9 e0 LDA #&e0 ; channel 0 control &06bf 20 da 06 JSR &06da ; update_channel &06c2 a5 16 LDA &16 ; channels_updated # Non-zero if channel was updated &06c4 d0 02 BNE &06c8 ; still_active &06c6 85 1d STA &1d; channels_volume_byte_to_write # Set to zero to suppress sending bytes for channel zero ; still_active &06c8 a2 10 LDX #&10 &06ca a9 c0 LDA #&c0 ; channel 1 frequency &06cc 20 da 06 JSR &06da ; update_channel &06cf a2 20 LDX #&20 &06d1 a9 a0 LDA #&a0 ; channel 2 frequency &06d3 20 da 06 JSR &06da ; update_channel &06d6 a2 30 LDX #&30 &06d8 a9 80 LDA #&80 ; channel 3 frequency ; update_channel &06da 85 9f STA &9f ; channel_register &06dc b5 1a LDA &1a,X ; channels_active # Zero if channel not active &06de f0 6a BEQ &074a ; leave &06e0 b5 15 LDA &15,X ; channels_volume_steps_remaining &06e2 15 19 ORA &19,X ; channels_frequency_steps_remaining &06e4 d0 0a BNE &06f0 ; not_end_of_sound &06e6 95 1a STA &1a,X ; channels_active # Set to zero to indicate channel no longer active &06e8 a9 0f LDA #&0f # Silence channel &06ea 95 12 STA &12,X ; channels_volume &06ec 85 16 STA &16 ; channels_updated # Set to non-zero to indicate channel updated &06ee d0 36 BNE &0726 ; skip_changing_frequency # Always branches ; not_end_of_sound &06f0 b5 15 LDA &15,X ; channels_volume_steps_remaining &06f2 f0 15 BEQ &0709 ; skip_changing_volume &06f4 d6 14 DEC &14,X ; channels_volume_cooldown &06f6 d0 11 BNE &0709 ; skip_changing_volume &06f8 e6 16 INC &16 ; channels_updated # Set to non-zero to indicate channel updated &06fa b5 1b LDA &1b,X ; channels_volume_maximum_cooldown &06fc 95 14 STA &14,X ; channels_volume_cooldown &06fe d6 15 DEC &15,X ; channels_volume_steps_remaining &0700 b5 12 LDA &12,X ; channels_volume &0702 18 CLC &0703 75 13 ADC &13,X ; channels_volume_delta &0705 29 0f AND #&0f &0707 95 12 STA &12,X ; channels_volume ; skip_changing_volume &0709 b5 19 LDA &19,X ; channels_frequency_steps_remaining &070b f0 19 BEQ &0726 ; skip_changing_frequency &070d d6 18 DEC &18,X ; channels_frequency_cooldown &070f d0 15 BNE &0726 ; skip_changing_frequency &0711 b5 1c LDA &1c,X ; channels_frequency_maximum_cooldown &0713 95 18 STA &18,X ; channels_frequency_cooldown &0715 d6 19 DEC &19,X ; channels_frequency_steps_remaining &0717 b5 10 LDA &10,X ; channels_frequency_low &0719 18 CLC &071a 75 16 ADC &16,X ; channels_pitch_delta_low &071c 95 10 STA &10,X ; channels_frequency_low &071e b5 11 LDA &11,X ; channels_frequency_high &0720 75 17 ADC &17,X ; channels_pitch_delta_high &0722 29 03 AND #&03 &0724 95 11 STA &11,X ; channels_frequency_high ; skip_changing_frequency &0726 a5 9f LDA &9f ; channel_register &0728 09 10 ORA #&10 # Use channel volume &072a 15 12 ORA &12,X ; channels_volume &072c 95 1d STA &1d,X ; channels_volume_byte_to_write &072e b5 10 LDA &10,X ; channels_frequency_low &0730 29 0f AND #&0f &0732 05 9f ORA &9f ; channel_register &0734 95 1e STA &1e,X ; channels_frequency_low_byte_to_write &0736 b5 10 LDA &10,X ; channels_frequency_low &0738 85 e4 STA &e4 ; frequency_low &073a b5 11 LDA &11,X ; channels_frequency_high &073c 06 e4 ASL &e4 ; frequency_low &073e 2a ROL A &073f 06 e4 ASL &e4 ; frequency_low &0741 2a ROL A &0742 06 e4 ASL &e4 ; frequency_low &0744 2a ROL A &0745 06 e4 ASL &e4 ; frequency_low &0747 2a ROL A &0748 95 1f STA &1f,X ; channels_frequency_high_byte_to_write ; leave &074a 60 RTS ; wait_for_vsync &074b a5 ff LDA &ff ; frame_counter ; wait_for_vsync_loop &074d c5 ff CMP &ff ; frame_counter &074f f0 fc BEQ &074d ; wait_for_vsync_loop &0751 60 RTS ; plot_text &0752 68 PLA # Text follows call &0753 85 00 STA &00 ; text_address_low &0755 68 PLA &0756 85 01 STA &01 ; text_address_high &0758 a0 00 LDY #&00 &075a e6 00 INC &00 ; text_address_low &075c d0 02 BNE &0760 ; skip_page ; plot_text_loop &075e e6 01 INC &01 ; text_address_high ; skip_page &0760 b1 00 LDA (&00),Y ; text_address &0762 f0 33 BEQ &0797 ; end_of_text # &00 indicates end of text &0764 c9 40 CMP #&40 ; "@" # &40 ("@") sets text position &0766 f0 16 BEQ &077e ; set_text_position &0768 c9 23 CMP #&23 ; "#" # &23 ("#") sets text colour &076a f0 34 BEQ &07a0 ; set_text_colour &076c c9 25 CMP #&25 ; "%" # &25 ("#") toggles double size text &076e f0 38 BEQ &07a8 ; toggle_text_double_size &0770 c9 26 CMP #&26 ; "&" # &26 ("&") toggles using sprites for text &0772 f0 3d BEQ &07b1 ; toggle_text_as_sprites &0774 c9 27 CMP #&27 ; "'" # &27 ("'") toggles inverted text &0776 f0 42 BEQ &07ba ; toggle_text_inverted &0778 20 b4 03 JSR &03b4 ; plot_character &077b 4c 5a 07 JMP &075a ; plot_text_loop ; set_text_position &077e 20 8e 07 JSR &078e ; get_next_byte_of_text &0781 85 e0 STA &e0 ; text_x &0783 20 8e 07 JSR &078e ; get_next_byte_of_text &0786 85 e1 STA &e1 ; text_y &0788 20 c9 07 JSR &07c9 ; calculate_text_screen_address &078b 4c 5a 07 JMP &075a ; plot_text_loop ; get_next_byte_of_text &078e e6 00 INC &00 ; text_address_low &0790 d0 02 BNE &0794 ; skip_page &0792 e6 01 INC &01 ; text_address_high ; skip_page &0794 b1 00 LDA (&00),Y ; text_address &0796 60 RTS ; end_of_text &0797 e6 00 INC &00 ; text_address_low &0799 d0 02 BNE &079d ; skip_page &079b e6 01 INC &01 ; text_address_high ; skip_page &079d 6c 00 00 JMP (&0000) ; text_address # Continue execution after text ; set_text_colour &07a0 20 8e 07 JSR &078e ; get_next_byte_of_text &07a3 85 fd STA &fd ; text_colour &07a5 4c 5a 07 JMP &075a ; plot_text_loop ; toggle_text_double_size &07a8 a5 d5 LDA &d5 ; text_double_size &07aa 49 ff EOR #&ff &07ac 85 d5 STA &d5 ; text_double_size &07ae 4c 5a 07 JMP &075a ; plot_text_loop ; toggle_text_as_sprites &07b1 a5 bb LDA &bb ; text_as_sprites &07b3 49 ff EOR #&ff &07b5 85 bb STA &bb ; text_as_sprites &07b7 4c 5a 07 JMP &075a ; plot_text_loop ; toggle_text_inverted &07ba a5 bc LDA &bc ; text_inverted &07bc 49 ff EOR #&ff &07be 85 bc STA &bc ; text_inverted &07c0 4c 5a 07 JMP &075a ; plot_text_loop ; calculate_text_screen_address_from_X &07c3 a4 e1 LDY &e1 ; text_y ; calculate_text_screen_address_from_X_Y &07c5 86 e0 STX &e0 ; text_x &07c7 84 e1 STY &e1 ; text_y ; calculate_text_screen_address &07c9 a5 e1 LDA &e1 ; text_y &07cb 0a ASL A &07cc 85 db STA &db ; text_screen_address_high &07ce a5 e0 LDA &e0 ; text_x &07d0 0a ASL A &07d1 0a ASL A &07d2 0a ASL A &07d3 90 02 BCC &07d7 ; skip_overflow &07d5 e6 db INC &db ; text_screen_address_high ; skip_overflow &07d7 18 CLC &07d8 65 a2 ADC &a2 ; screen_start_address_low &07da 85 da STA &da ; text_screen_address_low &07dc a5 db LDA &db ; text_screen_address_high &07de 65 a3 ADC &a3 ; screen_start_address_high &07e0 29 1f AND #&1f # Keep address within screen memory &07e2 09 60 ORA #&60 ; &6000 = screen memory &07e4 85 db STA &db ; text_screen_address_high &07e6 60 RTS ; wait_for_vsync_and_display_screen &07e7 20 4b 07 JSR &074b ; wait_for_vsync &07ea a9 40 LDA #&40 # Display screen ; set_screen_width &07ec a2 01 LDX #&01 ; R1: Number of characters per line ; write_video_register &07ee 8e 00 fe STX &fe00 ; video register number &07f1 8d 01 fe STA &fe01 ; video register value &07f4 60 RTS ; convert_number_in_XY_to_digits &07f5 86 f8 STX &f8 ; number &07f7 84 f9 STY &f9 ; number + 1 &07f9 a9 00 LDA #&00 &07fb 85 fa STA &fa ; number + 2 &07fd 85 fb STA &fb ; number + 3 ; convert_number_to_digits &07ff a9 30 LDA #&30 ; "0" &0801 a2 08 LDX #&08 ; initialise_digits_loop &0803 95 ef STA &ef,X ; digits &0805 ca DEX &0806 10 fb BPL &0803 ; initialise_digits_loop &0808 e8 INX ; 0 ; convert_number_to_digits_digit_loop &0809 a0 20 LDY #&20 &080b a9 00 LDA #&00 ; convert_number_to_digits_count_loop &080d 06 f8 ASL &f8 ; number &080f 26 f9 ROL &f9 ; number + 1 &0811 26 fa ROL &fa ; number + 2 &0813 26 fb ROL &fb ; number + 3 &0815 2a ROL A &0816 c9 0a CMP #&0a &0818 90 04 BCC &081e ; skip_overflow &081a e9 0a SBC #&0a &081c e6 f8 INC &f8 ; number ; skip_overflow &081e 88 DEY &081f d0 ec BNE &080d ; convert_number_to_digits_count_loop &0821 18 CLC &0822 69 30 ADC #&30 ; "0" &0824 e0 09 CPX #&09 &0826 b0 02 BCS &082a ; skip_digit_overflow &0828 95 ef STA &ef,X ; digits ; skip_digit_overflow &082a e8 INX &082b a5 f8 LDA &f8 ; number &082d 05 f9 ORA &f9 ; number + 1 &082f 05 fa ORA &fa ; number + 2 &0831 05 fb ORA &fb ; number + 3 &0833 d0 d4 BNE &0809 ; convert_number_to_digits_digit_loop &0835 60 RTS ; plot_number &0836 20 ff 07 JSR &07ff ; convert_number_to_digits &0839 a2 08 LDX #&08 ; plot_number_loop &083b b5 ef LDA &ef,X ; digits &083d 20 b4 03 JSR &03b4 ; plot_character &0840 ca DEX &0841 10 f8 BPL &083b ; plot_number_loop &0843 60 RTS ; plot_spaced_hyphen &0844 a9 20 LDA #&20 ; " " &0846 20 b4 03 JSR &03b4 ; plot_character &0849 a9 2d LDA #&2d ; "-" &084b 20 b4 03 JSR &03b4 ; plot_character &084e a9 20 LDA #&20 ; " " &0850 4c b4 03 JMP &03b4 ; plot_character ; get_status_from_score &0853 a2 00 LDX #&00 ; get_status_from_score_loop &0855 8a TXA &0856 0a ASL A &0857 0a ASL A &0858 a8 TAY &0859 38 SEC &085a a5 90 LDA &90 ; score &085c f9 ef 08 SBC &08ef,Y ; status_requirements &085f a5 91 LDA &91 ; score + 1 &0861 f9 f0 08 SBC &08f0,Y ; status_requirements + 1 &0864 a5 92 LDA &92 ; score + 2 &0866 f9 f1 08 SBC &08f1,Y ; status_requirements + 2 &0869 a5 93 LDA &93 ; score + 3 &086b f9 f2 08 SBC &08f2,Y ; status_requirements + 3 &086e 90 08 BCC &0878 ; leave_with_status &0870 e8 INX &0871 e0 0a CPX #&0a &0873 d0 e0 BNE &0855 ; get_status_from_score_loop &0875 a9 09 LDA #&09 &0877 60 RTS ; leave_with_status &0878 ca DEX &0879 8a TXA &087a 60 RTS ; unused &087b 60 RTS ; plot_status &087c aa TAX &087d a0 ff LDY #&ff ; find_status_loop &087f c8 INY &0880 b9 95 08 LDA &0895,Y ; status_strings &0883 d0 fa BNE &087f ; find_status_loop &0885 ca DEX &0886 10 f7 BPL &087f ; find_status_loop ; plot_status_loop &0888 c8 INY &0889 b9 95 08 LDA &0895,Y ; status_strings &088c d0 01 BNE &088f ; not_end_of_status &088e 60 RTS ; not_end_of_status &088f 20 b4 03 JSR &03b4 ; plot_character &0892 4c 88 08 JMP &0888 ; plot_status_loop ; status_strings &0895 00 &0896 7e 20 4e 4f 56 49 43 45 00 ; &00 : "~ NOVICE" &089f 20 4e 4f 54 20 42 41 44 00 ; &01 : " NOT BAD" &08a8 7e 20 20 4f 4b 41 59 00 ; &02 : "~ OKAY" &08b0 20 41 56 45 52 41 47 45 00 ; &03 : " AVERAGE" &08b9 43 4f 4d 50 45 54 45 4e 54 00 ; &04 : "COMPETENT" &08c3 7e 20 20 47 4f 4f 44 00 ; &05 : "~ GOOD" &08cb 20 20 47 52 45 41 54 00 ; &06 : " GREAT" &08d3 20 45 4c 49 54 45 53 54 00 ; &07 : " ELITEST" &08dc 7e 20 4d 41 53 54 45 52 00 ; &08 : "~ MASTER" &08e5 2a 2a 2a 47 4f 44 2a 2a 2a 00 ; &09 : "***GOD***" &08ee 00 ; status_requirements &08ef 00 00 00 00 ; 0 (NOVICE) &08f3 98 3a 00 00 ; 15000 (NOT BAD) &08f7 30 75 00 00 ; 30000 (OKAY) &08fb a0 86 01 00 ; 100000 (AVERAGE) &08ff 80 1a 06 00 ; 400000 (COMPETENT) &0903 40 42 0f 00 ; 1000000 (GOOD) &0907 c0 c6 2d 00 ; 3000000 (GREAT) &090b 80 96 98 00 ; 10000000 (ELITEST) &090f 00 b4 c4 04 ; 80000000 (MASTER) &0913 00 27 b9 29 ; 700000000 (***GOD***) ; high_scores &0917 47 41 52 59 20 4f 4b 21 ; "GARY OK!" &091f 10 27 00 00 ; 10000 &0923 54 52 41 43 45 59 20 20 ; "TRACEY " &092b 40 1f 00 00 ; 8000 &092f 44 49 47 49 53 4f 46 54 ; "DIGISOFT" &0937 70 17 00 00 ; 6000 &093b 4c 45 41 4e 4e 45 20 20 ; "LEANNE " &0943 a0 0f 00 00 ; 4000 &0947 55 4c 54 52 41 56 4f 58 ; "ULTRAVOX" &094f d0 07 00 00 ; 2000 ; high_scores_status &0953 00 &0954 00 &0955 00 &0956 00 &0957 00 ; title_screen &0958 a9 03 LDA #&03 # Player starts with three lives &095a 8d eb 10 STA &10eb ; initial_lives ; title_screen_keeping_initial_lives &095d a2 ef LDX #&ef # Don't use &01f0 - &01ff (see &05a1) &095f 9a TXS &0960 86 ae STX &ae ; input_type # Set to negative to indicate demo mode &0962 58 CLI &0963 20 b0 04 JSR &04b0 ; initialise_screen &0966 20 52 07 JSR &0752 ; plot_text &0969 40 00 00 ; move to (&00, &00) &096c 25 ; enable double size text &096d 2a 2a 20 ; "** " &0970 23 02 ; colour 2 &0972 50 53 59 43 41 53 54 52 49 41 20 ; "PSYCASTRIA" &097d 23 03 ; colour 3 &097f 2a 2a ; "**" &0981 25 ; disable double size text &0982 40 07 0f ; move to (&07, &0f) &0985 50 52 45 53 53 20 31 2d 34 20 4f 52 20 46 49 52 ; "PRESS 1-4 OR FIRE TO PLAY" &0995 45 20 54 4f 20 50 4c 41 59 &099e 23 02 ; colour 2 &09a0 00 ; end of text &09a1 a2 05 LDX #&05 # Rotate colour 1 of top palette &09a3 86 fe STX &fe ; colour_to_rotate &09a5 ca DEX ; 4 ; plot_high_scores_loop # For each high score, &09a6 8a TXA &09a7 48 PHA ; rank &09a8 0a ASL A &09a9 0a ASL A &09aa 85 08 STA &08 ; high_score_offset &09ac 0a ASL A &09ad 65 08 ADC &08 ; high_score_offset &09af 85 08 STA &08 ; high_score_offset &09b1 8a TXA &09b2 0a ASL A &09b3 69 03 ADC #&03 &09b5 a8 TAY &09b6 a2 00 LDX #&00 &09b8 20 c5 07 JSR &07c5 ; calculate_text_screen_address_from_X_Y &09bb a6 08 LDX &08 ; high_score_offset &09bd bd 1f 09 LDA &091f,X ; high_scores + 8 &09c0 85 f8 STA &f8 ; number &09c2 bd 20 09 LDA &0920,X ; high_scores + 9 &09c5 85 f9 STA &f9 ; number + 1 &09c7 bd 21 09 LDA &0921,X ; high_scores + 10 &09ca 85 fa STA &fa ; number + 2 &09cc bd 22 09 LDA &0922,X ; high_scores + 11 &09cf 85 fb STA &fb ; number + 3 &09d1 20 36 08 JSR &0836 ; plot_number # Plot high score &09d4 20 44 08 JSR &0844 ; plot_spaced_hyphen &09d7 68 PLA ; rank &09d8 48 PHA ; rank &09d9 aa TAX &09da bd 53 09 LDA &0953,X ; high_scores_status &09dd 20 7c 08 JSR &087c ; plot_status # Plot status &09e0 a2 2a LDX #&2a &09e2 20 c3 07 JSR &07c3 ; calculate_text_screen_address_from_X &09e5 20 44 08 JSR &0844 ; plot_spaced_hyphen &09e8 a6 08 LDX &08 ; high_score_offset &09ea a0 08 LDY #&08 ; plot_high_score_name_loop &09ec bd 17 09 LDA &0917,X ; high_scores &09ef 20 b4 03 JSR &03b4 ; plot_character # Plot name &09f2 e8 INX &09f3 88 DEY &09f4 d0 f6 BNE &09ec ; plot_high_score_name_loop &09f6 68 PLA ; rank &09f7 aa TAX &09f8 ca DEX &09f9 10 ab BPL &09a6 ; plot_high_scores_loop &09fb 86 93 STX &93 ; scrolltext_nibble &09fd e8 INX ; 0 &09fe 86 92 STX &92 ; scrolltext_offset &0a00 20 e7 07 JSR &07e7 ; wait_for_vsync_and_display_screen &0a03 a9 9a LDA #&9a ; &259a = tune_data &0a05 85 90 STA &90 ; tune_address_low &0a07 a9 25 LDA #&25 &0a09 85 91 STA &91 ; tune_address_high ; start_tune &0a0b a0 00 LDY #&00 &0a0d b1 90 LDA (&90),Y ; tune_address &0a0f 85 08 STA &08 ; tune_byte_one &0a11 c8 INY &0a12 b1 90 LDA (&90),Y ; tune_address &0a14 85 09 STA &09 ; tune_byte_two &0a16 a5 08 LDA &08 ; tune_byte_one &0a18 a2 01 LDX #&01 # Use channel 1 &0a1a 20 01 0c JSR &0c01 ; play_part_of_chord_from_note_value # ...18421 ........ &0a1d a5 09 LDA &09 ; tune_byte_two &0a1f a2 02 LDX #&02 # Use channel 2 &0a21 20 01 0c JSR &0c01 ; play_part_of_chord_from_note_value # ........ ...18421 &0a24 a5 08 LDA &08 ; tune_byte_one &0a26 4a LSR A &0a27 4a LSR A &0a28 4a LSR A &0a29 4a LSR A &0a2a 4a LSR A &0a2b 85 08 STA &08 ; tune_byte_one &0a2d a5 09 LDA &09 ; tune_byte_two &0a2f 29 e0 AND #&e0 &0a31 4a LSR A &0a32 4a LSR A &0a33 05 08 ORA &08 ; tune_byte_two &0a35 a2 03 LDX #&03 # Use channel 3 &0a37 20 01 0c JSR &0c01 ; play_part_of_chord_from_note_value # 842.... 842.... &0a3a a5 90 LDA &90 ; tune_address_low &0a3c 18 CLC &0a3d 69 02 ADC #&02 &0a3f 85 90 STA &90 ; tune_address_low &0a41 a5 91 LDA &91 ; tune_address_high &0a43 69 00 ADC #&00 &0a45 85 91 STA &91 ; tune_address_high &0a47 c9 29 CMP #&29 ; &299a = end_of_tune_data # Bug: should be &2998 &0a49 d0 06 BNE &0a51 ; not_end_of_tune &0a4b a5 90 LDA &90 ; tune_address_low &0a4d c9 9a CMP #&9a &0a4f f0 1b BEQ &0a6c ; end_of_tune ; not_end_of_tune &0a51 a0 07 LDY #&07 ; title_screen_loop &0a53 98 TYA &0a54 48 PHA ; count &0a55 20 4b 07 JSR &074b ; wait_for_vsync &0a58 20 ab 0a JSR &0aab ; update_scrolltext &0a5b 20 8b 0a JSR &0a8b ; check_for_title_screen_keys &0a5e a9 27 LDA #&27 ; 0 &0a60 20 a0 0c JSR &0ca0 ; check_for_keypress &0a63 30 0c BMI &0a71 ; start_demo &0a65 68 PLA ; count &0a66 a8 TAY &0a67 88 DEY &0a68 d0 e9 BNE &0a53 ; title_screen_loop &0a6a f0 9f BEQ &0a0b ; start_tune # Always branches ; end_of_tune &0a6c a0 4b LDY #&4b &0a6e 20 15 0c JSR &0c15 ; wait_for_Y_while_checking_keys ; start_demo &0a71 a9 ff LDA #&ff # Negative to indicate demo mode &0a73 30 09 BMI &0a7e ; set_game_mode # Always branches ; start_game &0a75 a9 00 LDA #&00 # Zero to indicate keyboard input &0a77 f0 05 BEQ &0a7e ; set_game_mode # Always branches ; fire_pressed &0a79 20 8f 0f JSR &0f8f ; select_players_screen &0a7c a9 01 LDA #&01 # Positive non-zero to indicate joystick input ; set_game_mode &0a7e 85 ae STA &ae ; input_type &0a80 86 aa STX &aa ; number_of_players &0a82 a2 ef LDX #&ef &0a84 9a TXS &0a85 20 dc 10 JSR &10dc ; play_game &0a88 4c 58 09 JMP &0958 ; title_screen ; check_for_title_screen_keys &0a8b a2 03 LDX #&03 ; check_for_number_of_players_loop &0a8d bd 11 0c LDA &0c11,X ; number_keycodes &0a90 20 a0 0c JSR &0ca0 ; check_for_keypress &0a93 30 e0 BMI &0a75 ; start_game &0a95 ca DEX &0a96 10 f5 BPL &0a8d ; check_for_number_of_players_loop &0a98 20 1f 0c JSR &0c1f ; check_for_escape_and_cursor_down_and_up &0a9b 20 a9 0c JSR &0ca9 ; check_for_enabling_cheat # Returns carry set if cheat was enabled &0a9e 90 03 BCC &0aa3 ; check_for_fire &0aa0 4c 5d 09 JMP &095d ; title_screen_keeping_initial_lives ; check_for_fire &0aa3 ad 40 fe LDA &fe40 ; System VIA port B input/output register &0aa6 29 10 AND #&10 # &10 clear if first joystick button pressed &0aa8 f0 cf BEQ &0a79 ; fire_pressed &0aaa 60 RTS ; update_scrolltext &0aab a0 00 LDY #&00 ; scroll_left_of_text_loop &0aad b9 08 7a LDA &7a08,Y ; &6000 + &200 * 13 + 8 # Scroll left of line &0ab0 99 00 7a STA &7a00,Y ; &6000 + &200 * 13 &0ab3 c8 INY &0ab4 d0 f7 BNE &0aad ; scroll_left_of_text_loop ; scroll_right_of_text_loop &0ab6 b9 08 7b LDA &7b08,Y ; &6000 + &200 * 13 + &108 # Scroll right of line &0ab9 99 00 7b STA &7b00,Y ; &6000 + &200 * 13 + &100 &0abc c8 INY &0abd d0 f7 BNE &0ab6 ; scroll_right_of_text_loop &0abf a4 92 LDY &92 ; scrolltext_offset &0ac1 b9 01 0b LDA &0b01,Y ; scrolltext_data &0ac4 20 45 04 JSR &0445 ; find_character_in_font &0ac7 84 00 STY &00 ; font_address_low &0ac9 a9 00 LDA #&00 &0acb 06 00 ASL &00 ; font_address_low &0acd 2a ROL A &0ace 06 00 ASL &00 ; font_address_low &0ad0 2a ROL A &0ad1 06 00 ASL &00 ; font_address_low &0ad3 2a ROL A &0ad4 85 01 STA &01 ; font_address_high &0ad6 a5 00 LDA &00 ; font_address_low &0ad8 69 da ADC #&da ; &22da = font_data &0ada 85 00 STA &00 ; font_address_low &0adc a5 01 LDA &01 ; font_address_high &0ade 69 22 ADC #&22 &0ae0 85 01 STA &01 ; font_address_high &0ae2 a0 07 LDY #&07 ; plot_scrolltext_loop &0ae4 b1 00 LDA (&00),Y ; font_address &0ae6 24 93 BIT &93 ; scrolltext_nibble &0ae8 10 04 BPL &0aee ; skip_shift &0aea 4a LSR A &0aeb 4a LSR A &0aec 4a LSR A &0aed 4a LSR A ; skip_shift &0aee 29 0f AND #&0f &0af0 99 f8 7b STA &7bf8,Y ; ; &6000 + &200 * 13 + &1f8 # Plot half a character at right of text &0af3 88 DEY &0af4 10 ee BPL &0ae4 ; plot_scrolltext_loop &0af6 a5 93 LDA &93 ; scrolltext_nibble &0af8 49 ff EOR #&ff &0afa 85 93 STA &93 ; scrolltext_nibble &0afc 10 02 BPL &0b00 ; leave &0afe e6 92 INC &92 ; scrolltext_offset ; leave &0b00 60 RTS ; scrolltext_data &0b01 20 24 20 41 55 44 49 4f 47 45 4e 49 43 20 53 4f ; " $ AUDIOGENIC SO" &0b11 46 54 57 41 52 45 20 4c 54 44 20 31 39 38 36 2e ; "FTWARE LTD 1986." &0b21 20 57 52 49 54 54 45 4e 20 42 59 20 47 41 52 59 ; " WRITTEN BY GARY" &0b31 20 50 41 52 54 49 53 20 41 4e 44 20 44 45 44 49 ; " PARTIS AND DEDI" &0b41 43 41 54 45 44 20 54 4f 20 54 52 41 43 45 59 20 ; "CATED TO TRACEY " &0b51 44 49 41 4e 4e 45 20 4e 49 43 48 4f 4c 53 4f 4e ; "DIANNE NICHOLSON" &0b61 2e 20 47 41 4d 45 20 44 45 53 49 47 4e 2c 20 47 ; ". GAME DESIGN, G" &0b71 52 41 50 48 49 43 53 2c 20 53 4f 55 4e 44 53 20 ; "RAPHICS, SOUNDS " &0b81 41 4e 44 20 50 52 4f 47 52 41 4d 4d 49 4e 47 20 ; "AND PROGRAMMING " &0b91 42 59 20 47 41 52 59 20 50 41 52 54 49 53 2e 20 ; "BY GARY PARTIS. " &0ba1 54 48 45 20 54 49 54 4c 45 20 54 55 4e 45 20 57 ; "THE TITLE TUNE W" &0bb1 41 53 20 41 52 52 41 4e 47 45 44 20 42 59 20 47 ; "AS ARRANGED BY G" &0bc1 41 52 59 27 53 20 42 42 43 20 43 4f 4d 50 55 54 ; "ARY'S BBC COMPUT" &0bd1 45 52 2e 20 54 48 45 20 53 55 50 52 45 4d 45 20 ; "ER. THE SUPREME " &0be1 42 42 43 20 4d 45 47 41 2d 42 4c 41 53 54 49 4e ; "BBC MEGA-BLASTIN" &0bf1 47 20 47 41 4d 45 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e ; "G GAME.........." ; play_part_of_chord_from_note_value &0c01 29 1f AND #&1f &0c03 86 0a STX &0a ; channel &0c05 aa TAX &0c06 bd 98 29 LDA &2998,X ; note_pitches &0c09 20 2e 0f JSR &0f2e ; convert_pitch_to_frequency &0c0c a5 0a LDA &0a ; channel &0c0e 4c 95 11 JMP &1195 ; play_part_of_chord ; number_keycodes &0c11 30 ; 1 &0c12 31 ; 2 &0c13 11 ; 3 &0c14 12 ; 4 ; wait_for_Y_while_checking_keys &0c15 20 1f 0c JSR &0c1f ; check_for_escape_and_cursor_down_and_up &0c18 20 e7 07 JSR &07e7 ; wait_for_vsync_and_display_screen &0c1b 88 DEY &0c1c d0 f7 BNE &0c15 ; wait_for_Y_while_checking_keys &0c1e 60 RTS ; check_for_escape_and_cursor_down_and_up &0c1f a5 ae LDA &ae ; input_type # Negative if demo mode &0c21 30 0a BMI &0c2d ; escape_not_pressed &0c23 a9 70 LDA #&70 ; ESCAPE &0c25 20 a0 0c JSR &0ca0 ; check_for_keypress &0c28 10 03 BPL &0c2d ; escape_not_pressed &0c2a 4c 58 09 JMP &0958 ; title_screen ; escape_not_pressed &0c2d a9 29 LDA #&29 ; DOWN &0c2f 20 a0 0c JSR &0ca0 ; check_for_keypress &0c32 30 01 BMI &0c35 ; pause_game_loop &0c34 60 RTS ; pause_game_loop &0c35 a9 39 LDA #&39 ; UP &0c37 20 a0 0c JSR &0ca0 ; check_for_keypress &0c3a 10 1a BPL &0c56 ; check_for_keys_while_paused &0c3c a9 08 LDA #&08 # Disable LEDs and motor ; set_leds_and_motor_state &0c3e 48 PHA ; state &0c3f 09 06 ORA #&06 # Set Caps Lock LED &0c41 8d 40 fe STA &fe40 ; System VIA port B input/output register &0c44 68 PLA ; state &0c45 48 PHA ; state &0c46 09 07 ORA #&07 # Set Shift Lock LED &0c48 8d 40 fe STA &fe40 ; System VIA port B input/output register &0c4b 68 PLA ; state &0c4c 49 08 EOR #&08 &0c4e 0a ASL A &0c4f 0a ASL A &0c50 0a ASL A &0c51 0a ASL A &0c52 8d 10 fe STA &fe10 ; Serial ULA control register # Enable or disable cassette motor &0c55 60 RTS ; check_for_keys_while_paused &0c56 a9 00 LDA #&00 # Enable LEDs and motor &0c58 20 3e 0c JSR &0c3e ; set_leds_and_motor_state &0c5b 20 4b 07 JSR &074b ; wait_for_vsync &0c5e a9 51 LDA #&51 ; S &0c60 a2 e2 LDX #&e2 ; sound_muted &0c62 20 6c 0c JSR &0c6c ; check_for_key_suppressing_autorepeat &0c65 a9 0a LDA #&0a &0c67 85 14 STA &14 ; channels_volume_cooldown # Maintain background sound while paused &0c69 4c 35 0c JMP &0c35 ; pause_game_loop ; check_for_key_suppressing_autorepeat &0c6c 20 a0 0c JSR &0ca0 ; check_for_keypress &0c6f 10 2a BPL &0c9b ; clear_sound_muted_suppress_autorepeat &0c71 b5 01 LDA &01,X ; sound_muted_suppress_autorepeat - &e2 &0c73 d0 25 BNE &0c9a ; leave &0c75 a9 01 LDA #&01 &0c77 95 01 STA &01,X ; sound_muted_suppress_autorepeat - &e2 # Set to non-zero to suppress subsequent keypresses &0c79 b5 00 LDA &00,X ; sound_muted - &e2 &0c7b 49 80 EOR #&80 # Toggle sound muted &0c7d 95 00 STA &00,X ; sound_muted - &e2 &0c7f 10 07 BPL &0c88 ; skip_initialising_sound &0c81 e0 e2 CPX #&e2 &0c83 d0 03 BNE &0c88 ; skip_initialising_sound &0c85 20 3a 06 JSR &063a ; initialise_sound ; skip_initialising_sound &0c88 b5 00 LDA &00,X ; sound_muted - &e2 &0c8a aa TAX &0c8b a0 01 LDY #&01 &0c8d a9 01 LDA #&01 # Use channel 1 &0c8f 20 6e 06 JSR &066e ; play_sound # Play sound for unmuting sound ; v vd vc vs pd pc ps &0c92 00 00 00 00 00 00 01 02 ; leave &0c9a 60 RTS ; clear_sound_muted_suppress_autorepeat &0c9b a9 00 LDA #&00 &0c9d 95 01 STA &01,X ; sound_muted_suppress_autorepeat - &e2 # Set to zero to allow subsequent keypresses &0c9f 60 RTS ; check_for_keypress &0ca0 78 SEI &0ca1 8d 4f fe STA &fe4f ; System VIA input/output register A &0ca4 ad 4f fe LDA &fe4f ; System VIA input/output register A &0ca7 58 CLI &0ca8 60 RTS ; check_for_enabling_cheat &0ca9 20 f7 0c JSR &0cf7 ; check_for_key_combination # Returns number of keys in combination pressed &0cac c9 07 CMP #&07 &0cae f0 02 BEQ &0cb2 ; key_combination_pressed &0cb0 18 CLC # Leave with carry clear to indicate cheat not enabled &0cb1 60 RTS ; key_combination_pressed &0cb2 20 f7 0c JSR &0cf7 ; check_for_key_combination # Returns number of keys in combination pressed &0cb5 d0 fb BNE &0cb2 ; reset_system &0cb7 2c 77 02 BIT &0277 ; dr_who_rom_present # Positive if Doctor Who and the Mines of Terror ROM present &0cba 30 26 BMI &0ce2 ; reset_system &0cbc 20 3d 15 JSR &153d ; initialise_screen_with_box &0cbf 20 52 07 JSR &0752 ; plot_text &0cc2 40 04 03 ; move to (&04, &03) &0cc5 25 ; enable double size text &0cc6 45 4e 54 45 52 20 43 4f 44 45 20 4e 4f 57 ; "ENTER CODE NOW" &0cd4 25 ; disable double size text &0cd5 00 ; end of text &0cd6 20 65 0e JSR &0e65 ; get_name &0cd9 a2 07 LDX #&07 ; check_code_loop &0cdb b5 e7 LDA &e7,X ; input_buffer &0cdd dd ef 0c CMP &0cef,X ; shotokan_string &0ce0 f0 03 BEQ &0ce5 ; consider_next_character ; reset_system &0ce2 6c fc ff JMP (&fffc) ; os_reset_address_low ; consider_next_character &0ce5 ca DEX &0ce6 10 f3 BPL &0cdb ; check_code_loop &0ce8 a9 63 LDA #&63 # Player starts game with 99 lives &0cea 8d eb 10 STA &10eb ; initial_lives &0ced 38 SEC # Leave with carry set to indicate cheat enabled &0cee 60 RTS ; shotokan_string &0cef 53 48 4f 54 4f 4b 41 4e ; "SHOTOKAN" ; check_for_key_combination &0cf7 a2 10 LDX #&10 ; Q &0cf9 86 00 STX &00 ; count ; check_for_keys_loop # For each possible key, &0cfb 8a TXA &0cfc 20 a0 0c JSR &0ca0 ; check_for_keypress # Returns negative if key pressed &0cff 10 0f BPL &0d10 ; consider_next_key &0d01 8a TXA &0d02 a0 06 LDY #&06 ; check_codes_loop &0d04 d9 1c 0d CMP &0d1c,Y ; combination_keycodes &0d07 f0 05 BEQ &0d0e ; is_part_of_combination # Is it one of the required combination of keys? &0d09 88 DEY &0d0a 10 f8 BPL &0d04 ; check_codes_loop &0d0c 30 0b BMI &0d19 ; leave_with_zero # Always branches ; is_part_of_combination &0d0e e6 00 INC &00 ; count ; consider_next_key &0d10 e8 INX &0d11 10 e8 BPL &0cfb ; check_for_keys_loop &0d13 a5 00 LDA &00 ; count &0d15 38 SEC &0d16 e9 10 SBC #&10 # Leave with A = number of keys in combination pressed &0d18 60 RTS ; leave_with_zero &0d19 a9 00 LDA #&00 # Leave with A = 0 if any non-combination key pressed &0d1b 60 RTS ; combination_keycodes &0d1c 25 ; I &0d1d 56 ; L &0d1e 23 ; T &0d1f 32 ; D &0d20 55 ; N &0d21 26 ; 9 &0d22 53 ; G # "9g" = ninety-nine ? ; check_for_high_score &0d23 38 SEC &0d24 a5 90 LDA &90 ; score &0d26 ed 4f 09 SBC &094f ; high_scores + 12 * 4 + 8 &0d29 a5 91 LDA &91 ; score + 1 &0d2b ed 50 09 SBC &0950 ; high_scores + 12 * 4 + 9 &0d2e a5 92 LDA &92 ; score + 2 &0d30 ed 51 09 SBC &0951 ; high_scores + 12 * 4 + 10 &0d33 a5 93 LDA &93 ; score + 3 &0d35 ed 52 09 SBC &0952 ; high_scores + 12 * 4 + 11 &0d38 b0 01 BCS &0d3b ; new_high_score &0d3a 60 RTS ; new_high_score &0d3b 20 3d 15 JSR &153d ; initialise_screen_with_box &0d3e 20 52 07 JSR &0752 ; plot_text &0d41 25 ; enable double size text &0d42 40 03 02 ; move to (&03, &02) &0d45 47 52 45 41 54 20 50 4c 41 59 45 52 20 ; "GREAT PLAYER " &0d52 00 ; end of text &0d53 20 7a 10 JSR &107a ; plot_player_number &0d56 10 52 07 JSR &0752 ; plot_text &0d59 21 ; "!" &0d5a 40 02 06 ; move to (&02, &06) &0d5d 45 4e 54 45 52 20 59 4f 55 52 20 4e 41 4d 45 ; "ENTER YOUR NAME" &0d6c 25 ; disable double size text &0d6d 00 ; end of text &0d6e 20 a7 10 JSR &10a7 ; play_high_score_sound &0d71 20 65 0e JSR &0e65 ; get_name &0d74 a2 07 LDX #&07 ; copy_name_into_high_scores_loop &0d76 b5 e7 LDA &e7,X ; input_buffer &0d78 9d 47 09 STA &0947,X ; high_scores + 12 * 4 &0d7b ca DEX &0d7c 10 f8 BPL &0d76 ; copy_name_into_high_scores_loop &0d7e a2 03 LDX #&03 ; copy_score_into_high_scores_loop &0d80 b5 90 LDA &90,X ; score &0d82 9d 4f 09 STA &094f,X ; high_scores + 12 * 4 + 8 &0d85 ca DEX &0d86 10 f8 BPL &0d80 ; copy_score_into_high_scores_loop &0d88 a5 9a LDA &9a ; player_status &0d8a 8d 57 09 STA &0957 ; high_scores_status + 4 ; sort_high_scores_loop &0d8d a2 00 LDX #&00 &0d8f 86 00 STX &00 ; count ; sort_high_scores_rank_loop &0d91 86 01 STX &01 ; rank &0d93 8a TXA &0d94 0a ASL A &0d95 0a ASL A &0d96 85 02 STA &02 ; offset &0d98 0a ASL A &0d99 65 02 ADC &02 ; offset &0d9b 85 02 STA &02 ; offset &0d9d aa TAX &0d9e 38 SEC &0d9f bd 1f 09 LDA &091f,X ; high_scores + 8 &0da2 fd 2b 09 SBC &092b,X ; high_scores + 12 + 8 &0da5 bd 20 09 LDA &0920,X ; high_scores + 9 &0da8 fd 2c 09 SBC &092c,X ; high_scores + 12 + 9 &0dab bd 21 09 LDA &0921,X ; high_scores + 10 &0dae fd 2d 09 SBC &092d,X ; high_scores + 12 + 10 &0db1 bd 22 09 LDA &0922,X ; high_scores + 11 &0db4 fd 2e 09 SBC &092e,X ; high_scores + 12 + 11 &0db7 b0 40 BCS &0df9 ; consider_next_rank &0db9 a4 01 LDY &01 ; rank &0dbb b9 54 09 LDA &0954,Y ; high_scores_status + 1 &0dbe 48 PHA ; status &0dbf b9 53 09 LDA &0953,Y ; high_scores_status &0dc2 99 54 09 STA &0954,Y ; high_scores_status + 1 &0dc5 68 PLA ; status &0dc6 99 53 09 STA &0953,Y ; high_scores_status &0dc9 a0 00 LDY #&00 ; copy_name_and_score_into_buffer_loop &0dcb bd 17 09 LDA &0917,X ; high_scores &0dce 99 04 00 STA &0004,Y ; buffer &0dd1 e8 INX &0dd2 c8 INY &0dd3 c0 0c CPY #&0c &0dd5 d0 f4 BNE &0dcb ; copy_name_and_score_into_buffer_loop &0dd7 a0 00 LDY #&00 &0dd9 a6 02 LDX &02 ; offset ; copy_name_and_score_loop &0ddb bd 23 09 LDA &0923,X ; high_scores + 12 &0dde 9d 17 09 STA &0917,X ; high_scores &0de1 e8 INX &0de2 c8 INY &0de3 c0 0c CPY #&0c &0de5 d0 f4 BNE &0ddb ; copy_name_and_score_loop &0de7 a0 00 LDY #&00 &0de9 a6 02 LDX &02 ; offset ; copy_name_and_score_from_buffer_loop &0deb b9 04 00 LDA &0004,Y ; buffer &0dee 9d 23 09 STA &0923,X ; high_scores + 12 &0df1 e8 INX &0df2 c8 INY &0df3 c0 0c CPY #&0c &0df5 d0 f4 BNE &0deb ; copy_name_and_score_from_buffer_loop &0df7 e6 00 INC &00 ; count ; consider_next_rank &0df9 a6 01 LDX &01 ; rank &0dfb e8 INX &0dfc e0 04 CPX #&04 &0dfe d0 91 BNE &0d91 ; sort_high_scores_rank_loop &0e00 a5 00 LDA &00 ; count &0e02 d0 89 BNE &0d8d ; sort_high_scores_loop &0e04 60 RTS ; check_for_god_status &0e05 a5 9a LDA &9a ; player_status &0e07 c9 09 CMP #&09 ; STATUS_GOD &0e09 f0 01 BEQ &0e0c ; god_code_screen &0e0b 60 RTS ; god_code_screen &0e0c 20 3d 15 JSR &153d ; initialise_screen_with_box &0e0f 20 52 07 JSR &0752 ; plot_text &0e12 25 ; enable double size text &0e13 40 10 0c ; move to (&10, &0c) &0e16 48 49 54 20 46 49 52 45 ; "HIT FIRE" &0e1e 40 08 02 ; move to (&08, &02) &0e21 59 4f 55 52 20 43 4f 44 45 20 49 53 ; "YOUR CODE IS" &0e2d 40 18 06 ; move to (&18, &06) &0e30 00 ; end of text &0e31 a5 90 LDA &90 ; score &0e33 45 92 EOR &92 ; score + 2 &0e35 20 48 0e JSR &0e48 ; plot_two_code_letters &0e38 a5 91 LDA &91 ; score + 1 &0e3a 45 93 EOR &93 ; score + 3 &0e3c 20 48 0e JSR &0e48 ; plot_two_code_letters &0e3f 20 e7 07 JSR &07e7 ; wait_for_vsync_and_display_screen ; god_code_screen_loop &0e42 20 1d 16 JSR &161d ; check_for_firing_suppressing_autorepeat &0e45 10 fb BPL &0e42 ; god_code_screen_loop &0e47 60 RTS ; plot_two_code_letters &0e48 48 PHA ; byte # 76543210 &0e49 29 55 AND #&55 # .6.4.2.0 &0e4b 0a ASL A # 6.4.2.0. &0e4c 85 00 STA &00 ; tmp &0e4e 68 PLA ; byte &0e4f 29 aa AND #&aa # 7.5.3.1. &0e51 4a LSR A # .7.5.3.1 &0e52 05 00 ORA &00 ; tmp # 67452301 &0e54 48 PHA ; byte &0e55 29 0f AND #&0f &0e57 20 5f 0e JSR &0e5f ; plot_code_letter # First letter uses bottom nibble &0e5a 68 PLA ; byte &0e5b 4a LSR A &0e5c 4a LSR A &0e5d 4a LSR A &0e5e 4a LSR A ; plot_code_letter # Second letter uses top nibble &0e5f 18 CLC &0e60 69 41 ADC #&41 ; "A" &0e62 4c b4 03 JMP &03b4 ; plot_character ; get_name &0e65 20 52 07 JSR &0752 ; plot_text &0e68 40 10 0c ; move to (&10, &0c) &0e6b 25 ; disable double size text &0e6c 5f 5f 5f 5f 5f 5f 5f 5f ; "________" &0e74 40 10 0a ; move to (&10, &0a) &0e77 00 ; end of text &0e78 20 e7 07 JSR &07e7 ; wait_for_vsync_and_display_screen &0e7b a9 1b LDA #&1b ; ENTER &0e7d 85 e5 STA &e5 ; previous_key &0e7f a2 00 LDX #&00 ; wait_for_keypress &0e81 86 e6 STX &e6 ; offset &0e83 20 eb 0e JSR &0eeb ; get_key # Returns negative if no key pressed &0e86 c5 e5 CMP &e5 ; previous_key &0e88 f0 f7 BEQ &0e81 ; wait_for_keypress &0e8a 85 e5 STA &e5 ; previous_key &0e8c c9 1a CMP #&1a ; DELETE &0e8e f0 17 BEQ &0ea7 ; delete_pressed &0e90 c9 1b CMP #&1b ; ENTER &0e92 f0 36 BEQ &0eca ; enter_pressed &0e94 c9 ff CMP #&ff # Negative if no key pressed &0e96 f0 e9 BEQ &0e81 ; wait_for_keypress &0e98 e0 08 CPX #&08 &0e9a f0 e5 BEQ &0e81 ; wait_for_keypress &0e9c 18 CLC &0e9d 69 41 ADC #&41 ; "A" &0e9f 20 b4 03 JSR &03b4 ; plot_character &0ea2 95 e7 STA &e7,X ; input_buffer &0ea4 e8 INX &0ea5 d0 da BNE &0e81 ; wait_for_keypress # Always branches ; delete_pressed &0ea7 e0 00 CPX #&00 &0ea9 f0 d6 BEQ &0e81 ; wait_for_keypress &0eab 20 bf 0e JSR &0ebf ; move_left_a_character &0eae a9 20 LDA #&20 ; " " &0eb0 20 b4 03 JSR &03b4 ; plot_character &0eb3 20 bf 0e JSR &0ebf ; move_left_a_character &0eb6 a6 e6 LDX &e6 ; offset &0eb8 ca DEX &0eb9 a9 20 LDA #&20 ; " " &0ebb 95 e7 STA &e7,X ; input_buffer &0ebd d0 c2 BNE &0e81 ; wait_for_keypress # Always branches ; move_left_a_character &0ebf a6 e0 LDX &e0 ; text_x &0ec1 ca DEX &0ec2 ca DEX &0ec3 ca DEX &0ec4 ca DEX &0ec5 a4 e1 LDY &e1 ; text_y &0ec7 4c c5 07 JMP &07c5 ; calculate_text_screen_address_from_X_Y ; enter_pressed &0eca e0 00 CPX #&00 &0ecc f0 0a BEQ &0ed8 ; use_iltdn_ok &0ece a9 20 LDA #&20 ; " " ; pad_buffer_loop &0ed0 95 e7 STA &e7,X ; input_buffer &0ed2 e8 INX &0ed3 e0 09 CPX #&09 &0ed5 d0 f9 BNE &0ed0 ; pad_buffer_loop &0ed7 60 RTS ; use_iltdn_ok # If no name entered, use "ILTDN OK" &0ed8 a2 07 LDX #&07 ; copy_iltdn_ok_loop &0eda bd e3 0e LDA &0ee3,X ; iltdn_ok_string &0edd 95 e7 STA &e7,X ; input_buffer &0edf ca DEX &0ee0 10 f8 BPL &0eda ; copy_iltdn_ok_loop &0ee2 60 RTS ; iltdn_ok_string &0ee3 49 4c 54 44 4e 20 4f 4b ; "ILTDN OK" ; get_key &0eeb a0 1b LDY #&1b ; check_for_keys_loop &0eed b9 fa 0e LDA &0efa,Y ; letter_keycodes &0ef0 20 a0 0c JSR &0ca0 ; check_for_keypress &0ef3 30 03 BMI &0ef8 ; leave_with_key &0ef5 88 DEY &0ef6 10 f5 BPL &0eed ; check_for_keys_loop ; leave_with_key &0ef8 98 TYA &0ef9 60 RTS ; letter_keycodes &0efa 41 ; A &0efb 64 ; B &0efc 52 ; C &0efd 32 ; D &0efe 22 ; E &0eff 43 ; F &0f00 53 ; G &0f01 54 ; H &0f02 25 ; I &0f03 45 ; J &0f04 46 ; K &0f05 56 ; L &0f06 65 ; M &0f07 55 ; N &0f08 36 ; O &0f09 37 ; P &0f0a 10 ; Q &0f0b 33 ; R &0f0c 51 ; S &0f0d 23 ; T &0f0e 35 ; U &0f0f 63 ; V &0f10 21 ; W &0f11 42 ; X &0f12 44 ; Y &0f13 61 ; Z &0f14 59 ; DELETE &0f15 49 ; ENTER ; frequencies_low_table &0f16 f0 b7 82 4f 20 f3 c8 a0 7b 57 35 16 ; frequencies_high_table &0f22 03 03 03 03 03 02 02 02 02 02 02 02 ; convert_pitch_to_frequency # Called with A = pitch &0f2e a2 00 LDX #&00 ; divide_by_forty_eight_loop &0f30 c9 30 CMP #&30 &0f32 90 06 BCC &0f3a ; finished_division &0f34 e8 INX # X = pitch DIV 48 &0f35 e9 30 SBC #&30 &0f37 4c 30 0f JMP &0f30 ; divide_by_forty_eight_loop ; finished_division &0f3a 4a LSR A &0f3b 4a LSR A &0f3c a8 TAY # Y = (pitch MOD 48) / 4 &0f3d b9 16 0f LDA &0f16,Y ; frequencies_low_table &0f40 85 fb STA &fb ; frequency_low &0f42 b9 22 0f LDA &0f22,Y ; frequencies_high_table # Use Y to lookup frequency in table ; divide_by_power_of_two_loop &0f45 ca DEX &0f46 30 06 BMI &0f4e ; leave_with_frequency &0f48 4a LSR A &0f49 66 fb ROR &fb ; frequency_low # frequency = frequency / 2 ^ (pitch DIV 48) &0f4b 4c 45 0f JMP &0f45 ; divide_by_power_of_two_loop &0f4e a6 fb LDX &fb ; frequency_low &0f50 a8 TAY # Leave with XY = frequency &0f51 60 RTS ; number_x_positions &0f52 07 17 27 37 ; wait_for_fire_release &0f56 ad 40 fe LDA &fe40 ; System VIA port B input/output register &0f59 29 10 AND #&10 # &10 clear if first joystick button pressed &0f5b f0 f9 BEQ &0f56 ; wait_for_fire_release &0f5d a9 49 LDA #&49 ; ENTER &0f5f 20 a0 0c JSR &0ca0 ; check_for_keypress &0f62 30 f2 BMI &0f56 ; wait_for_fire_release &0f64 60 RTS ; plot_number_of_players_options &0f65 a0 03 LDY #&03 &0f67 84 02 STY &02 ; valid_cursor_position ; plot_number_of_players_options_loop &0f69 98 TYA &0f6a 48 PHA ; count &0f6b a2 03 LDX #&03 &0f6d b9 52 0f LDA &0f52,Y ; number_x_positions &0f70 c5 00 CMP &00 ; cursor_x &0f72 f0 04 BEQ &0f78 ; set_text_colour &0f74 c6 02 DEC &02 ; valid_cursor_position &0f76 a2 02 LDX #&02 ; set_text_colour &0f78 86 fd STX &fd ; text_colour &0f7a b9 52 0f LDA &0f52,Y ; number_x_positions &0f7d aa TAX &0f7e a0 0b LDY #&0b &0f80 20 c5 07 JSR &07c5 ; calculate_text_screen_address_from_X_Y &0f83 68 PLA ; count &0f84 a8 TAY &0f85 18 CLC &0f86 69 31 ADC #&31 ; "1" &0f88 20 b4 03 JSR &03b4 ; plot_character &0f8b 88 DEY &0f8c 10 db BPL &0f69 ; plot_number_of_players_options_loop &0f8e 60 RTS ; select_players_screen &0f8f 20 b0 04 JSR &04b0 ; initialise_screen &0f92 20 52 07 JSR &0752 ; plot_text &0f95 23 01 ; colour 1 &0f97 25 ; enable double size text &0f98 40 03 03 ; move to (&03, &03) &0f9b 53 45 4c 45 43 54 20 50 4c 41 59 45 52 53 2e ; "SELECT PLAYERS." &0faa 40 04 06 ; move to (&04, &06) &0fad 46 49 52 45 20 57 48 45 4e 20 4f 4b 41 59 ; "FIRE WHEN OKAY" &0fbb 25 ; disable double size text &0fbc 40 07 0d ; move to (&07, &0d) &0fbf 23 02 ; colour 2 &0fc1 00 ; end of text &0fc2 a9 5f LDA #&5f ; "_" &0fc4 a2 18 LDX #&18 ; plot_cursor_track_loop &0fc6 20 b4 03 JSR &03b4 ; plot_character &0fc9 ca DEX &0fca 10 fa BPL &0fc6 ; plot_cursor_track_loop &0fcc e8 INX ; 0 &0fcd 86 00 STX &00 ; cursor_x &0fcf a9 07 LDA #&07 &0fd1 85 01 STA &01 ; cursor_direction # Jump to "1" on first update &0fd3 20 65 0f JSR &0f65 ; plot_number_of_players_options &0fd6 20 e7 07 JSR &07e7 ; wait_for_vsync_and_display_screen &0fd9 20 56 0f JSR &0f56 ; wait_for_fire_release ; select_players_screen_loop &0fdc 20 1f 0c JSR &0c1f ; check_for_escape_and_cursor_down_and_up &0fdf 20 65 0f JSR &0f65 ; plot_number_of_players_options &0fe2 a6 00 LDX &00 ; cursor_x &0fe4 a0 0c LDY #&0c &0fe6 20 c5 07 JSR &07c5 ; calculate_text_screen_address_from_X_Y &0fe9 20 4b 07 JSR &074b ; wait_for_vsync &0fec a9 20 LDA #&20 ; " " &0fee 20 b4 03 JSR &03b4 ; plot_character # Unplot cursor &0ff1 a5 02 LDA &02 ; valid_cursor_position &0ff3 30 17 BMI &100c ; skip_checking_for_movement &0ff5 a9 00 LDA #&00 &0ff7 85 01 STA &01 ; cursor_direction &0ff9 a2 00 LDX #&00 &0ffb a9 ff LDA #&ff &0ffd 38 SEC &0ffe e5 ac SBC &ac ; joystick_values &1000 c9 40 CMP #&40 &1002 b0 01 BCS &1005 ; not_left &1004 ca DEX ; not_left &1005 c9 c0 CMP #&c0 &1007 90 01 BCC &100a ; not_right &1009 e8 INX ; not_right &100a 86 01 STX &01 ; cursor_direction ; skip_checking_for_movement &100c a5 00 LDA &00 ; cursor_x &100e 18 CLC &100f 65 01 ADC &01 ; cursor_direction &1011 85 00 STA &00 ; cursor_x &1013 a5 00 LDA &00 ; cursor_x &1015 c9 06 CMP #&06 &1017 d0 02 BNE &101b ; skip_floor &1019 e6 00 INC &00 ; cursor_x ; skip_floor &101b c9 38 CMP #&38 &101d d0 02 BNE &1021 ; skip_ceiling &101f c6 00 DEC &00 ; cursor_x ; skip_ceiling &1021 a2 03 LDX #&03 &1023 a5 02 LDA &02 ; valid_cursor_position # Positive if cursor is at a number &1025 10 01 BPL &1028 ; set_text_colour &1027 ca DEX ; set_text_colour &1028 86 fd STX &fd ; text_colour &102a a6 00 LDX &00 ; cursor_x &102c a0 0c LDY #&0c &102e 20 c5 07 JSR &07c5 ; calculate_text_screen_address_from_X_Y &1031 a9 5e LDA #&5e ; "^" &1033 20 b4 03 JSR &03b4 ; plot_character # Plot cursor &1036 ad 40 fe LDA &fe40 ; System VIA port B input/output register &1039 29 10 AND #&10 # &10 clear if first joystick button pressed &103b d0 9f BNE &0fdc ; select_players_screen_loop &103d a5 02 LDA &02 ; valid_cursor_position # Negative if cursor is not at a number &103f 30 9b BMI &0fdc ; select_players_screen_loop &1041 a5 00 LDA &00 ; cursor_x &1043 38 SEC &1044 e9 07 SBC #&07 &1046 4a LSR A &1047 4a LSR A &1048 4a LSR A &1049 4a LSR A &104a aa TAX # Leave with X = number of players &104b 60 RTS ; backup_player_variables &104c 8a TXA &104d 48 PHA ; tmp_x &104e 0a ASL A &104f 0a ASL A &1050 0a ASL A &1051 0a ASL A &1052 aa TAX &1053 a0 00 LDY #&00 ; backup_player_variables_loop &1055 b9 90 00 LDA &0090,Y ; player_variables &1058 95 50 STA &50,X ; saved_player_variables &105a e8 INX &105b c8 INY &105c c0 10 CPY #&10 &105e d0 f5 BNE &1055 ; backup_player_variables_loop &1060 68 PLA ; tmp_x &1061 aa TAX &1062 60 RTS ; restore_player_variables &1063 8a TXA &1064 48 PHA ; tmp_x &1065 0a ASL A &1066 0a ASL A &1067 0a ASL A &1068 0a ASL A &1069 aa TAX &106a a0 00 LDY #&00 ; restore_player_variables_loop &106c b5 50 LDA &50,X ; saved_player_variables &106e 99 90 00 STA &0090,Y ; player_variables &1071 e8 INX &1072 c8 INY &1073 c0 10 CPY #&10 &1075 d0 f5 BNE &106c ; restore_player_variables_loop &1077 68 PLA ; tmp_x &1078 aa TAX &1079 60 RTS ; plot_player_number &107a a5 a8 LDA &a8 ; current_player &107c 18 CLC &107d 69 31 ADC #&31 ; "1" &107f 4c b4 03 JMP &03b4 ; plot_character ; reset_level_data &1082 a0 00 LDY #&00 &1084 84 00 STY &00 ; level_data_address_low &1086 a9 2a LDA #&2a ; &2a00 = level_data &1088 85 01 STA &01 ; level_data_address_high ; reset_level_data_loop &108a b1 00 LDA (&00),Y ; level_data_address &108c 29 7f AND #&7f # Clear top bit to indicate tile not destroyed &108e 91 00 STA (&00),Y ; level_data_address &1090 c8 INY &1091 d0 f7 BNE &108a ; reset_level_data &1093 e6 01 INC &01 ; level_data_address_high &1095 a5 01 LDA &01 ; level_data_address_high &1097 c9 46 CMP #&46 ; &4600 = end_of_level_data &1099 d0 ef BNE &108a ; reset_level_data_loop &109b 60 RTS ; high_score_sound_bar_pitches &109c 00 14 1c 00 14 00 00 ; high_score_sound_note_pitches &10a3 10 1c 10 00 ; play_high_score_sound &10a7 24 e2 BIT &e2 ; sound_muted # Negative if sound muted &10a9 10 01 BPL &10ac ; not_muted &10ab 60 RTS ; not_muted &10ac a2 06 LDX #&06 ; play_high_score_sound_bar_loop &10ae a0 03 LDY #&03 ; play_high_score_sound_note_loop &10b0 8a TXA &10b1 48 PHA ; bar &10b2 98 TYA &10b3 48 PHA ; note &10b4 bd 9c 10 LDA &109c,X ; high_score_sound_bar_pitches &10b7 18 CLC &10b8 79 a3 10 ADC &10a3,Y ; high_score_sound_note_pitches &10bb 48 PHA &10bc 20 71 11 JSR &1171 ; play_chord &10bf a0 06 LDY #&06 &10c1 20 15 0c JSR &0c15 ; wait_for_Y_while_checking_keys &10c4 68 PLA &10c5 20 71 11 JSR &1171 ; play_chord &10c8 a0 06 LDY #&06 &10ca 20 15 0c JSR &0c15 ; wait_for_Y_while_checking_keys &10cd 68 PLA ; note &10ce a8 TAY &10cf 68 PLA ; bar &10d0 aa TAX &10d1 88 DEY &10d2 10 dc BPL &10b0 ; play_high_score_sound_note_loop &10d4 ca DEX &10d5 10 d7 BPL &10ae ; play_high_score_sound_bar_loop &10d7 a9 00 LDA #&00 &10d9 4c 71 11 JMP &1171 ; play_chord ; play_game &10dc a9 00 LDA #&00 &10de 85 90 STA &90 ; score &10e0 85 91 STA &91 ; score + 1 &10e2 85 92 STA &92 ; score + 2 &10e4 85 93 STA &93 ; score + 3 &10e6 85 95 STA &95 ; level &10e8 85 9a STA &9a ; player_status &10ea a9 03 LDA #&03 # actually LDA initial_lives &10ec 85 94 STA &94 ; lives &10ee a9 30 LDA #&30 ; &7530 = 30000 # Extra life every 30,000 points &10f0 85 9b STA &9b ; score_for_extra_life &10f2 a9 75 LDA #&75 &10f4 85 9c STA &9c ; score_for_extra_life + 1 &10f6 a2 03 LDX #&03 ; initialise_players_loop &10f8 20 4c 10 JSR &104c ; backup_player_variables &10fb ca DEX &10fc 10 fa BPL &10f8 ; initialise_players_loop &10fe 24 ae BIT &ae ; input_type # Negative if demo mode &1100 10 0c BPL &110e ; not_demo &1102 20 31 1b JSR &1b31 ; rnd # Choose a random level for the demo &1105 85 95 STA &95 ; level &1107 a9 00 LDA #&00 &1109 85 a8 STA &a8 ; current_player &110b 4c 2c 12 JMP &122c ; play_level_without_introduction ; not_demo &110e a5 aa LDA &aa ; number_of_players &1110 85 ab STA &ab ; players_remaining ; first_player &1112 a2 00 LDX #&00 ; next_player &1114 86 a8 STX &a8 ; current_player &1116 20 63 10 JSR &1063 ; restore_player_variables &1119 a5 94 LDA &94 ; lives &111b f0 43 BEQ &1160 ; backup_player_and_consider_next_player &111d 20 c6 11 JSR &11c6 ; play_level_with_introduction &1120 a5 94 LDA &94 ; lives &1122 d0 3c BNE &1160 ; backup_player_and_consider_next_player &1124 c6 ab DEC &ab ; players_remaining &1126 20 52 07 JSR &0752 ; plot_text &1129 23 02 ; colour 2 &112b 25 ; enable double size text &112c 40 00 05 ; move to (&00, &05) &112f 50 4c 41 59 45 52 20 ; "PLAYER " &1136 00 ; end of text &1137 20 7a 10 JSR &107a ; plot_player_number &113a 20 52 07 JSR &0752 ; plot_text &113d 20 44 45 46 55 4e 43 54 ; " DEFUNCT" &1145 40 0c 09 ; move to (&0c, &09) &1148 23 03 ; colour 3 &114a 47 41 4d 45 20 4f 56 45 52 21 ; "GAME OVER!" &1154 00 ; end of text &1155 a0 64 LDY #&64 &1157 20 15 0c JSR &0c15 ; wait_for_Y_while_checking_keys &115a 20 05 0e JSR &0e05 ; check_for_god_status &115d 20 23 0d JSR &0d23 ; check_for_high_score ; backup_player_and_consider_next_player &1160 a6 a8 LDX &a8 ; current_player &1162 20 4c 10 JSR &104c ; backup_player_variables &1165 e8 INX &1166 e4 aa CPX &aa ; number_of_players &1168 90 aa BCC &1114 ; next_player &116a f0 a8 BEQ &1114 ; next_player &116c a5 ab LDA &ab ; players_remaining &116e 10 a2 BPL &1112 ; first_player &1170 60 RTS ; play_chord # Called with A = pitch &1171 85 09 STA &09 ; pitch_base &1173 a9 00 LDA #&00 &1175 85 08 STA &08 ; pitch_delta &1177 a2 03 LDX #&03 ; play_chord_loop &1179 8a TXA &117a 48 PHA ; channel &117b a5 09 LDA &09 ; pitch_base &117d 18 CLC &117e 65 08 ADC &08 ; pitch_delta &1180 20 2e 0f JSR &0f2e ; convert_pitch_to_frequency &1183 68 PLA &1184 48 PHA &1185 20 95 11 JSR &1195 ; play_part_of_chord &1188 a5 08 LDA &08 ; pitch_delta &118a 18 CLC &118b 69 30 ADC #&30 &118d 85 08 STA &08 ; pitch_delta &118f 68 PLA ; channel &1190 aa TAX &1191 ca DEX &1192 d0 e5 BNE &1179 ; play_chord_loop &1194 60 RTS ; play_part_of_chord &1195 85 0b STA &0b ; channel &1197 8a TXA &1198 18 CLC &1199 65 0b ADC &0b ; channel &119b aa TAX &119c 90 01 BCC &119f ; skip_overflow &119e c8 INY ; skip_overflow &119f a5 0b LDA &0b ; channel &11a1 20 6e 06 JSR &066e ; play_sound # Play part of chord ; v vd vc vs pd pc ps &11a4 00 01 02 0f 00 00 00 00 &11ac 60 RTS ; level_titles &11ad 4c 41 4e 44 20 ; "LAND " &11b2 53 45 41 20 20 ; "SEA " &11b7 4d 4f 4f 4e 20 ; "MOON " &11bc 53 50 41 43 45 20 ; "SPACE " ; level_titles_x &11c2 04 06 04 02 ; play_level_with_introduction &11c6 20 3d 15 JSR &153d ; initialise_screen_with_box &11c9 a5 95 LDA &95 ; level &11cb 29 03 AND #&03 &11cd 85 a6 STA &a6 ; level_type &11cf aa TAX &11d0 bd c2 11 LDA &11c2,X ; level_titles_x &11d3 8d 00 12 STA &1200 ; prepare_for_text + &27 # Set x position of level title &11d6 20 52 07 JSR &0752 ; plot_text ; prepare_for_text &11d9 25 ; enable double size text &11da 40 04 03 ; move to (&04, &03) &11dd 50 4c 41 59 20 50 4c 41 59 45 52 20 ; "PLAY PLAYER " &11e9 00 ; end of text &11ea 20 7a 10 JSR &107a ; plot_player_number &11ed 20 52 07 JSR &0752 ; plot_text &11f0 21 ; "!" &11f1 40 0a 07 ; move to (&0a, &07) &11f4 50 52 45 50 41 52 45 20 46 4f 52 ; "PREPARE FOR" &11ff 40 01 0b ; move to (&01, &0b) &1202 00 ; end of text &1203 a5 a6 LDA &a6 ; level_type &1205 0a ASL A &1206 0a ASL A &1207 65 a6 ADC &a6 ; level_type &1209 aa TAX ; plot_level_title_loop &120a bd ad 11 LDA &11ad,X ; level_titles &120d 20 b4 03 JSR &03b4 ; plot_character &1210 e8 INX &1211 c9 20 CMP #&20 ; " " &1213 d0 f5 BNE &120a ; plot_level_title_loop &1215 20 52 07 JSR &0752 ; plot_text &1218 42 41 54 54 4c 45 2e 2e 2e ; "BATTLE..." &1221 00 ; end of text &1222 20 e7 07 JSR &07e7 ; wait_for_vsync_and_display_screen &1225 a9 18 LDA #&18 &1227 a0 23 LDY #&23 &1229 20 03 20 JSR &2003 ; play_prepare_for_battle_sound ; play_level_without_introduction &122c a9 00 LDA #&00 &122e 85 a7 STA &a7 ; player_killed # Set to zero to indicate not killed or completed &1230 85 96 STA &96 ; player_x_fraction &1232 85 98 STA &98 ; player_x &1234 a9 30 LDA #&30 &1236 85 97 STA &97 ; player_y &1238 20 60 1b JSR &1b60 ; initialise_level &123b 20 a5 1f JSR &1fa5 ; materialise_player &123e a9 09 LDA #&09 &1240 20 d7 12 JSR &12d7 ; play_background_noise # Start background noise at half volume &1243 a9 70 LDA #&70 ; &1770 = 6000 &1245 85 bd STA &bd ; time_low &1247 a9 17 LDA #&17 &1249 85 be STA &be ; time_high ; main_game_loop &124b 20 f5 12 JSR &12f5 ; set_background_noise_frequency &124e a5 c9 LDA &c9 ; previous_frame_counter ; wait_for_frame &1250 c5 ff CMP &ff ; frame_counter &1252 f0 fc BEQ &1250 ; wait_for_frame &1254 a5 ff LDA &ff ; frame_counter &1256 85 c9 STA &c9 ; previous_frame_counter &1258 20 a5 16 JSR &16a5 ; update_player &125b 20 02 18 JSR &1802 ; update_missiles &125e 20 86 21 JSR &2186 ; update_enemies &1261 20 1f 0c JSR &0c1f ; check_for_escape_and_cursor_down_and_up &1264 a5 ae LDA &ae ; input_type # Negative if demo mode &1266 10 03 BPL &126b ; not_demo &1268 20 8b 0a JSR &0a8b ; check_for_title_screen_keys ; not_demo &126b a5 bd LDA &bd ; time_low &126d 38 SEC &126e e9 01 SBC #&01 &1270 85 bd STA &bd ; time_low &1272 a5 be LDA &be ; time_high &1274 e9 00 SBC #&00 &1276 85 be STA &be ; time_high &1278 10 06 BPL &1280 ; skip_floor &127a a9 00 LDA #&00 &127c 85 bd STA &bd ; time_low &127e 85 be STA &be ; time_high ; skip_floor &1280 a5 a7 LDA &a7 ; player_killed # Positive if player killed, negative if level completed &1282 f0 c7 BEQ &124b ; main_game_loop &1284 10 06 BPL &128c ; kill_player &1286 20 24 13 JSR &1324 ; level_completed &1289 4c c6 11 JMP &11c6 ; play_level_with_introduction ; kill_player &128c c6 94 DEC &94 ; lives &128e a9 01 LDA #&01 # Use channel 1 &1290 a2 00 LDX #&00 &1292 a0 00 LDY #&00 &1294 20 6e 06 JSR &066e ; play_sound # to set frequency of background noise ; v vd vc vs pd pc ps &1297 0f 00 00 00 04 00 01 c8 &129f a9 00 LDA #&00 &12a1 20 d7 12 JSR &12d7 ; play_background_noise # Start background noise at full volume &12a4 20 42 1a JSR &1a42 ; plot_player &12a7 a2 16 LDX #&16 ; animate_player_explosion_loop &12a9 8a TXA &12aa 48 PHA ; count ; get_random_explosion_sprite &12ab 20 31 1b JSR &1b31 ; rnd &12ae 29 03 AND #&03 # Pick a random explosion sprite &12b0 18 CLC &12b1 69 43 ADC #&43 ; SPRITE_EXPLOSION_ZERO &12b3 c5 b4 CMP &b4 ; player_sprite &12b5 f0 f4 BEQ &12ab ; get_random_explosion_sprite # that is different to the current one &12b7 85 b4 STA &b4 ; player_sprite &12b9 20 42 1a JSR &1a42 ; plot_player &12bc a0 06 LDY #&06 &12be 20 15 0c JSR &0c15 ; wait_for_Y_while_checking_keys &12c1 20 42 1a JSR &1a42 ; plot_player &12c4 20 1f 0c JSR &0c1f ; check_for_escape_and_cursor_down_and_up &12c7 68 PLA ; count &12c8 aa TAX &12c9 ca DEX &12ca d0 dd BNE &12a9 ; animate_player_explosion_loop &12cc 20 37 21 JSR &2137 ; remove_enemies_and_unplot_missiles &12cf 20 3a 06 JSR &063a ; initialise_sound &12d2 a0 28 LDY #&28 &12d4 4c 15 0c JMP &0c15 ; wait_for_Y_while_checking_keys ; play_background_noise &12d7 8d e2 12 STA &12e2 ; sound_block + 0 (volume) &12da a9 00 LDA #&00 # Use channel 0 &12dc a8 TAY &12dd a2 07 LDX #&07 # Use pitch of channel 1 to determine frequency &12df 20 6e 06 JSR &066e ; play_sound # Play background noise ; sound_block ; v vd vc vs pd pc ps &12e2 00 01 01 0a 00 00 00 00 ; wait_for_sound_loop &12ea a5 15 LDA &15 ; channels_volume_steps_remaining &12ec c9 09 CMP #&09 &12ee d0 fa BNE &12ea ; wait_for_sound_loop &12f0 a9 ff LDA #&ff &12f2 85 14 STA &14 ; channels_volume_cooldown &12f4 60 RTS ; set_background_noise_frequency &12f5 a9 0a LDA #&0a &12f7 85 14 STA &14 ; channels_volume_cooldown &12f9 a5 b4 LDA &b4 ; player_sprite &12fb 38 SEC &12fc e9 57 SBC #&57 ; SPRITE_PLAYER_LEFT &12fe c9 04 CMP #&04 &1300 90 08 BCC &130a ; set_frequency_low &1302 e9 04 SBC #&04 &1304 85 00 STA &00 ; frequency_low &1306 a9 04 LDA #&04 &1308 e5 00 SBC &00 ; frequency_low ; set_frequency_low &130a 85 00 STA &00 ; frequency_low &130c 38 SEC &130d a9 04 LDA #&04 &130f e5 00 SBC &00 ; frequency_low &1311 0a ASL A &1312 0a ASL A &1313 aa TAX &1314 a0 00 LDY #&00 &1316 a9 01 LDA #&01 # Use channel 1 &1318 20 6e 06 JSR &066e ; play_sound # to set frequency of background noise ; v vd vc vs pd pc ps &131b 0f 00 01 01 00 00 00 00 &1323 60 RTS ; level_completed &1324 20 37 21 JSR &2137 ; remove_enemies_and_unplot_missiles &1327 e6 ba INC &ba ; suppress_player_input # Set to non-zero positive to suppress all input &1329 a2 03 LDX #&03 ; play_level_completed_chord_loop &132b 8a TXA &132c 48 PHA ; channel &132d 0a ASL A &132e 0a ASL A &132f 0a ASL A &1330 69 14 ADC #&14 &1332 aa TAX &1333 68 PLA &1334 48 PHA &1335 a0 00 LDY #&00 &1337 20 6e 06 JSR &066e ; play_chord ; v vd vc vs pd pc ps &133a 00 00 00 00 02 00 01 c8 &1342 68 PLA ; channel &1343 aa TAX &1344 ca DEX &1345 d0 e4 BNE &132b ; play_level_completed_chord_loop &1347 a9 00 LDA #&00 &1349 20 d7 12 JSR &12d7 ; play_background_noise # Start background noise at full volume &134c a2 00 LDX #&00 ; level_completed_loop # Animate player decelerating on runway &134e 8a TXA &134f 48 PHA ; count &1350 4a LSR A &1351 4a LSR A &1352 aa TAX ; delay_loop &1353 20 4b 07 JSR &074b ; wait_for_vsync &1356 ca DEX &1357 10 fa BPL &1353 ; delay_loop &1359 20 a5 16 JSR &16a5 ; update_player &135c 20 f5 12 JSR &12f5 ; set_background_noise_frequency &135f 20 1f 0c JSR &0c1f ; check_for_escape_and_cursor_down_and_up &1362 68 PLA ; count &1363 aa TAX &1364 e8 INX &1365 e0 18 CPX #&18 &1367 d0 e5 BNE &134e ; level_completed_loop &1369 a0 32 LDY #&32 &136b 20 15 0c JSR &0c15 ; wait_for_Y_while_checking_keys &136e 20 3d 15 JSR &153d ; initialise_screen_with_box &1371 20 52 07 JSR &0752 ; plot_text &1374 25 ; enable double size text &1375 40 08 04 ; move to (&08, &04) &1378 42 4f 4e 55 53 20 2d 20 32 30 30 30 ; "BONUS - 2000" &1384 25 ; disable double size text &1385 40 18 0c ; move to (&18, &0c) &1388 5e 20 53 48 4f 54 20 5e ; "^ SHOT ^" &1390 25 ; enable double size text &1391 00 ; end of text &1392 20 e7 07 JSR &07e7 ; wait_for_vsync_and_display_screen &1395 a2 00 LDX #&00 &1397 86 a4 STX &a4 ; screen_left_x &1399 86 a5 STX &a5 ; screen_left_x_fraction ; bonus_shot_screen_enemy_loop &139b 86 b2 STX &b2 ; bonus_enemy_count &139d 20 31 1b JSR &1b31 ; rnd # Pick random sprite for bonus enemy &13a0 29 07 AND #&07 &13a2 85 cb STA &cb ; bonus_enemy_type &13a4 a2 28 LDX #&28 &13a6 a0 04 LDY #&04 &13a8 20 c5 07 JSR &07c5 ; calculate_text_screen_address_from_X_Y &13ab a5 b2 LDA &b2 ; bonus_enemy_count &13ad 18 CLC &13ae 69 32 ADC #&32 ; "2" &13b0 20 b4 03 JSR &03b4 ; plot_character &13b3 20 3a 06 JSR &063a ; initialise_sound &13b6 20 56 0f JSR &0f56 ; wait_for_fire_release &13b9 20 31 1b JSR &1b31 ; rnd # Pick random direction for bonus enemy &13bc 29 01 AND #&01 &13be 4a LSR A # Carry set if moving from right to left &13bf a2 01 LDX #&01 &13c1 8a TXA &13c2 90 04 BCC &13c8 ; set_bonus_enemy_x_and_direction &13c4 a2 0e LDX #&0e &13c6 a9 ff LDA #&ff ; set_bonus_enemy_x_and_direction &13c8 85 c7 STA &c7 ; bonus_enemy_direction &13ca 86 c6 STX &c6 ; bonus_enemy_x &13cc a9 00 LDA #&00 &13ce 85 c8 STA &c8 ; bonus_enemy_x_fraction &13d0 20 31 1b JSR &1b31 ; rnd # Pick random delay for bonus enemy &13d3 29 7f AND #&7f &13d5 85 00 STA &00 ; frames ; initial_delay_loop &13d7 20 4b 07 JSR &074b ; wait_for_vsync &13da 20 1d 16 JSR &161d ; check_for_firing_suppressing_autorepeat &13dd 30 3f BMI &141e ; skip_hit_check &13df c6 00 DEC &00 ; frames &13e1 d0 f4 BNE &13d7 ; initial_delay_loop &13e3 20 ed 14 JSR &14ed ; plot_or_unplot_bonus_enemy # Plot enemy ; bonus_shot_screen_loop &13e6 20 4b 07 JSR &074b ; wait_for_vsync &13e9 20 ed 14 JSR &14ed ; plot_or_unplot_bonus_enemy # Unplot enemy &13ec a5 b2 LDA &b2 ; bonus_enemy_count &13ee 4a LSR A &13ef aa TAX ; move_bonus_enemy_loop &13f0 a5 c8 LDA &c8 ; bonus_enemy_x_fraction &13f2 18 CLC &13f3 65 c7 ADC &c7 ; bonus_enemy_direction &13f5 30 04 BMI &13fb ; next_tile &13f7 c9 04 CMP #&04 &13f9 90 09 BCC &1404 ; not_next_tile ; next_tile &13fb 48 PHA ; x_fraction &13fc a5 c6 LDA &c6 ; bonus_enemy_x &13fe 18 CLC &13ff 65 c7 ADC &c7 ; bonus_enemy_direction &1401 85 c6 STA &c6 ; bonus_enemy_x &1403 68 PLA ; x_fraction ; not_next_tile &1404 29 03 AND #&03 &1406 85 c8 STA &c8 ; bonus_enemy_x_fraction &1408 ca DEX &1409 10 e5 BPL &13f0 ; move_bonus_enemy_loop &140b 20 ed 14 JSR &14ed ; plot_or_unplot_bonus_enemy # Plot enemy &140e 20 1d 16 JSR &161d ; check_for_firing_suppressing_autorepeat &1411 30 08 BMI &141b ; check_for_hitting_enemy # If the player fired, &1413 a5 c6 LDA &c6 ; bonus_enemy_x &1415 f0 04 BEQ &141b ; check_for_hitting_enemy # or the enemy has reached the left &1417 c9 0e CMP #&0e &1419 d0 cb BNE &13e6 ; bonus_shot_screen_loop # or the right of the screen, ; check_for_hitting_enemy &141b 20 ed 14 JSR &14ed ; plot_or_unplot_bonus_enemy # Unplot enemy ; skip_hit_check &141e a5 c6 LDA &c6 ; bonus_enemy_x &1420 c9 06 CMP #&06 &1422 90 2a BCC &144e ; time_bonus_screen # If the enemy is within the target area, &1424 c9 09 CMP #&09 &1426 b0 26 BCS &144e ; time_bonus_screen &1428 a9 01 LDA #&01 # Use channel 1 &142a aa TAX &142b a8 TAY &142c 20 6e 06 JSR &066e ; play_sound # Play sound for hitting bonus enemy ; v vd vc vs pd pc ps &142f 00 00 00 00 f8 fd 01 64 &1437 a2 d0 LDX #&d0 ; &0d70 = 2000 # Score 2000 for hitting bonus enemy &1439 a0 07 LDY #&07 &143b 20 d7 1e JSR &1ed7 ; add_to_score &143e a0 32 LDY #&32 &1440 20 15 0c JSR &0c15 ; wait_for_Y_while_checking_keys &1443 a6 b2 LDX &b2 ; bonus_enemy_count &1445 e8 INX &1446 e8 INX &1447 e0 08 CPX #&08 &1449 f0 03 BEQ &144e ; time_bonus_screen &144b 4c 9b 13 JMP &139b ; bonus_shot_screen_enemy_loop ; time_bonus_screen &144e 20 3d 15 JSR &153d ; initialise_screen_with_box &1451 20 52 07 JSR &0752 ; plot_text &1454 25 ; enable double size text &1455 40 0c 05 ; move to (&0c, &05) &1458 54 49 4d 45 20 42 4f 4e 55 53 ; "TIME BONUS" &1462 40 10 09 ; move to (&10, &09) &1465 00 ; end of text &1466 a5 a6 LDA &a6 ; level_type &1468 18 CLC &1469 69 31 ADC #&31 ; "1" &146b 20 b4 03 JSR &03b4 ; plot_character &146e 20 52 07 JSR &0752 ; plot_text &1471 20 58 20 ; " X " &1474 00 ; end of text ; add_time_bonus_loop &1475 a6 bd LDX &bd ; time_low &1477 a4 be LDY &be ; time_high &1479 20 d7 1e JSR &1ed7 ; add_to_score # Score 1x time bonus &147c c6 a6 DEC &a6 ; level_type &147e 10 f5 BPL &1475 ; add_time_bonus_loop &1480 a6 bd LDX &bd ; time_low &1482 a4 be LDY &be ; time_high &1484 20 f5 07 JSR &07f5 ; convert_number_in_XY_to_digits &1487 a2 03 LDX #&03 ; plot_time_bonus_loop &1489 b5 ef LDA &ef,X ; digits &148b 20 b4 03 JSR &03b4 ; plot_character &148e ca DEX &148f 10 f8 BPL &1489 ; plot_time_bonus_loop &1491 a9 01 LDA #&01 # Use channel 1 &1493 aa TAX &1494 a8 TAY &1495 20 6e 06 JSR &066e ; play_sound # Play sound for time bonus ; v vd vc vs pd pc ps &1498 00 00 00 00 0c fe 01 ff &14a0 a0 96 LDY #&96 &14a2 20 15 0c JSR &0c15 ; wait_for_Y_while_checking_keys &14a5 20 53 08 JSR &0853 ; get_status_from_score &14a8 c5 9a CMP &9a ; player_status &14aa f0 05 BEQ &14b1 ; skip_status_screen # Has the player's status changed? &14ac 85 9a STA &9a ; player_status &14ae 20 ad 15 JSR &15ad ; status_screen &14b1 20 63 1b JSR &1b63 ; initialise_level_without_resetting_data ; skip_status_screen &14b4 a9 ff LDA #&ff &14b6 85 ba STA &ba ; suppress_player_input # Set to negative to suppress turning &14b8 85 a9 STA &a9 ; player_direction &14ba a9 57 LDA #&57 ; SPRITE_PLAYER_LEFT &14bc 85 b4 STA &b4 ; player_sprite &14be 20 42 1a JSR &1a42 ; plot_player &14c1 a9 12 LDA #&12 &14c3 85 ef STA &ef ; count &14c5 4a LSR A &14c6 20 d7 12 JSR &12d7 ; play_background_noise # Start background noise at half volume ; victory_lap_loop # Victory lap without enemies &14c9 20 f5 12 JSR &12f5 ; set_background_noise_frequency &14cc 20 4b 07 JSR &074b ; wait_for_vsync &14cf 20 a5 16 JSR &16a5 ; update_player &14d2 20 02 18 JSR &1802 ; update_missiles &14d5 20 1f 0c JSR &0c1f ; check_for_escape_and_cursor_down_and_up &14d8 a5 a4 LDA &a4 ; screen_left_x &14da d0 ed BNE &14c9 ; victory_lap_loop &14dc a9 01 LDA #&01 &14de 85 a4 STA &a4 ; screen_left_x &14e0 85 ba STA &ba ; suppress_player_input # Set to non-zero positive to suppress all input &14e2 a9 09 LDA #&09 &14e4 85 98 STA &98 ; player_x &14e6 c6 ef DEC &ef ; count &14e8 d0 df BNE &14c9 ; victory_lap_loop &14ea e6 95 INC &95 ; level &14ec 60 RTS ; plot_or_unplot_bonus_enemy &14ed a5 cb LDA &cb ; bonus_enemy_type &14ef 18 CLC &14f0 69 47 ADC #&47 ; SPRITE_ENEMY_ZERO &14f2 85 0e STA &0e ; sprite &14f4 a5 c6 LDA &c6 ; bonus_enemy_x &14f6 85 0a STA &0a ; sprite_x &14f8 a5 c8 LDA &c8 ; bonus_enemy_x_fraction &14fa 85 0b STA &0b ; sprite_x_fraction &14fc a9 3c LDA #&3c &14fe 85 0c STA &0c ; sprite_y &1500 20 6c 19 JSR &196c ; calculate_sprite_screen_address &1503 4c 55 1a JMP &1a55 ; plot_sprite ; plot_character_as_sprite &1506 a0 00 LDY #&00 &1508 20 a7 1d JSR &1da7 ; calculate_tile_sprite_address &150b a5 da LDA &da ; text_screen_address_low &150d 85 04 STA &04 ; bottom_screen_address_low &150f 18 CLC &1510 a5 db LDA &db ; text_screen_address_high &1512 69 02 ADC #&02 # Move down a group &1514 85 05 STA &05 ; bottom_screen_address_high &1516 a5 02 LDA &02 ; sprite_address_low &1518 69 20 ADC #&20 &151a 85 06 STA &06 ; bottom_sprite_address_low &151c a5 03 LDA &03 ; sprite_address_high &151e 69 00 ADC #&00 &1520 85 07 STA &07 ; bottom_sprite_address_high &1522 a0 1f LDY #&1f ; plot_character_as_sprite_loop &1524 b1 02 LDA (&02),Y ; sprite_address &1526 91 da STA (&da),Y ; text_screen_address &1528 b1 06 LDA (&06),Y ; bottom_sprite_address &152a 91 04 STA (&04),Y ; bottom_screen_address &152c 88 DEY &152d 10 f5 BPL &1524 ; plot_character_as_sprite_loop &152f a5 da LDA &da ; text_screen_address_low &1531 18 CLC &1532 69 20 ADC #&20 &1534 85 da STA &da ; text_screen_address_low &1536 a5 db LDA &db ; text_screen_address_high &1538 69 00 ADC #&00 &153a 85 db STA &db ; text_screen_address_high &153c 60 RTS ; initialise_screen_with_box &153d 20 b0 04 JSR &04b0 ; initialise_screen &1540 20 52 07 JSR &0752 ; plot_text # Plot top row of box &1543 26 ; start using sprites &1544 2e 06 06 06 06 06 06 06 06 06 06 06 06 06 06 31 &1554 00 ; end of text &1555 a2 05 LDX #&05 ; plot_box_middle_loop &1557 8a TXA &1558 48 PHA ; count &1559 0a ASL A &155a 69 02 ADC #&02 &155c a8 TAY &155d a2 00 LDX #&00 &155f 20 c5 07 JSR &07c5 ; calculate_text_screen_address_from_X_Y &1562 20 52 07 JSR &0752 ; plot_text # Plot middle row of box &1565 08 03 03 03 03 03 03 03 03 03 03 03 03 03 03 19 &1575 00 ; end of text &1576 68 PLA ; count &1577 aa TAX &1578 ca DEX &1579 10 dc BPL &1557 ; plot_box_middle_loop &157b 20 52 07 JSR &0752 ; plot_text # Plot bottom row of box &157e 40 00 0e ; move to (&00, &0e) &1581 34 07 07 07 07 07 07 07 07 07 07 07 07 07 07 30 &1591 26 ; stop using sprites &1592 27 ; enable inverted text &1593 23 02 ; colour 2 &1595 00 ; end of text &1596 a2 07 LDX #&07 &1598 a0 00 LDY #&00 ; use_box_palette_loop &159a 98 TYA &159b 29 03 AND #&03 &159d a8 TAY &159e b9 a9 15 LDA &15a9,Y ; box_palette &15a1 20 08 05 JSR &0508 ; set_palette &15a4 c8 INY &15a5 ca DEX &15a6 10 f2 BPL &159a ; use_box_palette_loop &15a8 60 RTS ; box_palette &15a9 04 01 06 03 ; B R C Y ; status_screen &15ad 20 3d 15 JSR &153d ; initialise_screen_with_box &15b0 20 52 07 JSR &0752 ; plot_text &15b3 40 0a 03 ; move to (&0a, &03) &15b6 25 ; enable double size text &15b7 59 4f 55 52 20 53 54 41 54 55 53 ; "YOUR STATUS" &15c2 40 14 07 ; move to (&14, &07) &15c5 49 53 20 4e 4f 57 ; "IS NOW" &15cb 40 0e 0b ; move to (&0e, &0b) &15ce 00 ; end of text &15cf a5 9a LDA &9a ; player_status &15d1 20 7c 08 JSR &087c ; plot_status &15d4 a9 01 LDA #&01 # Use channel 1 &15d6 aa TAX &15d7 a8 TAY &15d8 20 6e 06 JSR &066e ; play_sound # Play sound for status screen ; v vd vc vs pd pc ps &15db 00 00 00 00 fc fe 01 ff &15e3 a0 96 LDY #&96 &15e5 4c 15 0c JMP &0c15 ; wait_for_Y_while_checking_keys ; move_player_horizontally &15e8 a5 96 LDA &96 ; player_x_fraction &15ea 18 CLC &15eb 65 a9 ADC &a9 ; player_direction &15ed 10 02 BPL &15f1 ; skip_underflow &15ef c6 98 DEC &98 ; player_x ; skip_underflow &15f1 c9 04 CMP #&04 &15f3 d0 02 BNE &15f7 ; skip_overflow &15f5 e6 98 INC &98 ; player_x ; skip_overflow &15f7 29 03 AND #&03 &15f9 85 96 STA &96 ; player_x_fraction &15fb a5 a9 LDA &a9 ; player_direction &15fd d0 03 BNE &1602 ; scroll_left_or_right &15ff 4c ed 1c JMP &1ced ; plot_score_and_lives_or_demo ; scroll_left_or_right &1602 10 03 BPL &1607 ; to_scroll_right &1604 4c fc 1b JMP &1bfc ; scroll_left ; to_scroll_right &1607 4c 23 1c JMP &1c23 ; scroll_right ; consider_taking_demo_action &160a 29 80 AND #&80 # Negative if demo &160c 30 01 BMI &160f ; is_demo &160e 60 RTS ; is_demo &160f 86 00 STX &00 ; threshold &1611 68 PLA # Leave parent function on next return &1612 68 PLA &1613 20 31 1b JSR &1b31 ; rnd &1616 c5 00 CMP &00 ; threshold &1618 a9 00 LDA #&00 &161a 6a ROR A # Take action if rnd > threshold &161b 60 RTS ; suppress_fire &161c 00 ; check_for_firing_suppressing_autorepeat &161d 20 35 16 JSR &1635 ; check_for_firing &1620 30 06 BMI &1628 ; consider_firing &1622 a9 00 LDA #&00 # Set to zero to permit firing &1624 8d 1c 16 STA &161c ; suppress_fire # Leave with positive to indicate not firing &1627 60 RTS ; consider_firing &1628 ad 1c 16 LDA &161c ; suppress_fire &162b d0 07 BNE &1634 ; leave &162d a9 01 LDA #&01 &162f 8d 1c 16 STA &161c ; suppress_fire # Set to non-zero to suppress subsequent firing ; leave &1632 a9 ff LDA #&ff # Leave with negative to indicate firing &1634 60 RTS ; check_for_firing &1635 a5 ae LDA &ae ; input_type # Zero if keyboard &1637 d0 05 BNE &163e ; not_keyboard &1639 a9 49 LDA #&49 ; ENTER &163b 4c a0 0c JMP &0ca0 ; check_for_keypress ; not_keyboard &163e a2 e6 LDX #&e6 # 26 in 256 chance of firing in demo mode &1640 20 0a 16 JSR &160a ; consider_taking_demo_action # Leaves check_for_firing if demo mode &1643 ad 40 fe LDA &fe40 ; System VIA port B input/output register &1646 69 10 ADC #&10 &1648 0a ASL A &1649 0a ASL A &164a 0a ASL A &164b 60 RTS ; check_for_moving_right &164c a5 ae LDA &ae ; input_type # Zero if keyboard &164e d0 05 BNE &1655 ; not_keyboard &1650 a9 42 LDA #&42 ; X &1652 4c a0 0c JMP &0ca0 ; check_for_keypress ; not_keyboard &1655 a2 fa LDX #&fa # 6 in 256 chance of moving right in demo mode &1657 20 0a 16 JSR &160a ; consider_taking_demo_action # Leaves check_for_moving_right if demo mode &165a a5 ac LDA &ac ; joystick_values &165c 4c 95 16 JMP &1695 ; check_joystick_negative ; check_for_moving_left &165f a5 ae LDA &ae ; input_type # Zero if keyboard &1661 d0 05 BNE &1668 ; not_keyboard &1663 a9 61 LDA #&61 ; Z &1665 4c a0 0c JMP &0ca0 ; check_for_keypress ; not_keyboard &1668 a2 fa LDX #&fa # 6 in 256 chance of moving left in demo mode &166a 20 0a 16 JSR &160a ; consider_taking_demo_action # Leaves check_for_moving_left if demo mode &166d a5 ac LDA &ac ; joystick_values &166f 4c 9d 16 JMP &169d ; check_joystick_positive ; check_for_moving_up &1672 a5 ae LDA &ae ; input_type # Zero if keyboard &1674 d0 05 BNE &167b ; not_keyboard &1676 a9 48 LDA #&48 ; ' &1678 4c a0 0c JMP &0ca0 ; check_for_keypress ; not_keyboard &167b a2 f3 LDX #&f3 # 13 in 256 chance of moving up in demo mode &167d 20 0a 16 JSR &160a ; consider_taking_demo_action # Leaves check_for_moving_up if demo mode &1680 a5 ad LDA &ad ; joystick_values + 1 &1682 4c 9d 16 JMP &169d ; check_joystick_positive ; check_for_moving_down &1685 a5 ae LDA &ae ; input_type # Zero if keyboard &1687 d0 05 BNE &168e ; not_keyboard &1689 a9 68 LDA #&68 ; / &168b 4c a0 0c JMP &0ca0 ; check_for_keypress ; not_keyboard &168e a2 f3 LDX #&f3 # 13 in 256 chance of moving down in demo mode &1690 20 0a 16 JSR &160a ; consider_taking_demo_action # Leaves check_for_moving_down if demo mode &1693 a5 ad LDA &ad ; joystick_values + 1 ; check_joystick_negative &1695 c9 40 CMP #&40 &1697 a2 00 LDX #&00 &1699 b0 01 BCS &169c ; leave &169b ca DEX # Set to negative to indicate moving down or right ; leave &169c 60 RTS ; check_joystick_positive &169d c9 c0 CMP #&c0 &169f a2 00 LDX #&00 &16a1 90 01 BCC &16a4 ; leave &16a3 ca DEX # Set to negative to indicate moving up or left ; leave &16a4 60 RTS ; update_player &16a5 20 42 1a JSR &1a42 ; plot_player &16a8 20 e8 15 JSR &15e8 ; move_player_horizontally &16ab a5 ba LDA &ba ; suppress_player_input &16ad 10 03 BPL &16b2 ; not_suppressing_input # Negative to suppress turning &16af 4c e3 16 JMP &16e3 ; check_for_moving_up_and_down ; not_suppressing_input &16b2 f0 03 BEQ &16b7 ; consider_checking_for_turning # Non-zero positive to suppress all input &16b4 4c 36 17 JMP &1736 ; update_player_sprite_and_position ; consider_checking_for_turning &16b7 a5 b3 LDA &b3 ; turn_direction # Non-zero if already turning &16b9 d0 28 BNE &16e3 ; check_for_moving_up_and_down &16bb a5 98 LDA &98 ; player_x &16bd c9 05 CMP #&05 &16bf 90 09 BCC &16ca ; turn_right # Force a turn at the left of the level &16c1 c9 fa CMP #&fa &16c3 b0 14 BCS &16d9 ; turn_left # Force a turn at the right of the level &16c5 20 4c 16 JSR &164c ; check_for_moving_right &16c8 10 0a BPL &16d4 ; not_turning_right ; turn_right &16ca a5 b4 LDA &b4 ; player_sprite &16cc c9 5f CMP #&5f ; SPRITE_PLAYER_RIGHT &16ce f0 13 BEQ &16e3 ; check_for_moving_up_and_down # If the player isn't already facing right, &16d0 a9 01 LDA #&01 &16d2 85 b3 STA &b3 ; turn_direction # Set the player turning right ; not_turning_right &16d4 20 5f 16 JSR &165f ; check_for_moving_left &16d7 10 0a BPL &16e3 ; check_for_moving_up_and_down ; turn_left &16d9 a5 b4 LDA &b4 ; player_sprite &16db c9 57 CMP #&57 ; SPRITE_PLAYER_LEFT &16dd f0 04 BEQ &16e3 ; check_for_moving_up_and_down # If the player isn't already facing left, &16df a9 ff LDA #&ff &16e1 85 b3 STA &b3 ; turn_direction # Set the player turning left ; check_for_moving_up_and_down &16e3 20 72 16 JSR &1672 ; check_for_moving_up &16e6 10 08 BPL &16f0 ; not_moving_up &16e8 a5 97 LDA &97 ; player_y &16ea f0 04 BEQ &16f0 ; not_moving_up &16ec c6 97 DEC &97 ; player_y &16ee c6 97 DEC &97 ; player_y ; not_moving_up &16f0 20 85 16 JSR &1685 ; check_for_moving_down &16f3 10 0a BPL &16ff ; not_moving_down &16f5 a5 97 LDA &97 ; player_y &16f7 c9 5f CMP #&5f &16f9 b0 04 BCS &16ff ; not_moving_down &16fb e6 97 INC &97 ; player_y &16fd e6 97 INC &97 ; player_y ; not_moving_down &16ff 20 1d 16 JSR &161d ; check_for_firing_suppressing_autorepeat &1702 10 32 BPL &1736 ; skip_firing &1704 a5 b3 LDA &b3 ; turn_direction &1706 d0 2e BNE &1736 ; skip_firing # Can't fire if turning &1708 a5 b5 LDA &b5 ; number_of_player_missiles_present &170a c9 04 CMP #&04 &170c f0 28 BEQ &1736 ; skip_firing # Can't fire if too many player missiles present &170e e6 b5 INC &b5 ; number_of_player_missiles_present &1710 a5 98 LDA &98 ; player_x &1712 85 0a STA &0a ; sprite_x &1714 a5 96 LDA &96 ; player_x_fraction &1716 85 0b STA &0b ; sprite_x_fraction &1718 a5 97 LDA &97 ; player_y &171a 85 0c STA &0c ; sprite_y &171c a9 80 LDA #&80 # Set top bit to indicate player missile &171e 85 0d STA &0d ; missile_type &1720 a4 a9 LDY &a9 ; player_direction &1722 20 87 17 JSR &1787 ; add_missile &1725 a2 00 LDX #&00 &1727 a0 01 LDY #&01 &1729 a9 03 LDA #&03 # Use channel 3 &172b 20 6e 06 JSR &066e ; play_sound # Play sound for player firing ; v vd vc vs pd pc ps &172e 00 00 00 00 3c 00 01 0c ; skip_firing ; update_player_sprite_and_position &1736 a5 ff LDA &ff ; frame_counter &1738 29 01 AND #&01 &173a f0 19 BEQ &1755 ; skip_updating_turn &173c a5 b3 LDA &b3 ; turn_direction &173e f0 15 BEQ &1755 ; skip_updating_turn &1740 18 CLC &1741 65 b4 ADC &b4 ; player_sprite &1743 85 b4 STA &b4 ; player_sprite &1745 c9 5f CMP #&5f ; SPRITE_PLAYER_RIGHT &1747 f0 04 BEQ &174d ; end_turn &1749 c9 57 CMP #&57 ; SPRITE_PLAYER_LEFT &174b d0 08 BNE &1755 ; skip_updating_turn ; end_turn &174d a5 b3 LDA &b3 ; turn_direction &174f 85 a9 STA &a9 ; player_direction &1751 a9 00 LDA #&00 &1753 85 b3 STA &b3 ; turn_direction ; skip_updating_turn &1755 20 42 1a JSR &1a42 ; plot_player &1758 a5 98 LDA &98 ; player_x &175a 85 00 STA &00 ; tile_x &175c a5 96 LDA &96 ; player_x_fraction &175e 85 01 STA &01 ; tile_x_fraction &1760 a5 97 LDA &97 ; player_y &1762 85 02 STA &02 ; tile_y &1764 20 bf 19 JSR &19bf ; check_for_collision_with_tile # Returns carry set if collision occurred &1767 b0 01 BCS &176a ; player_hit_tile &1769 60 RTS ; player_hit_tile &176a 10 01 BPL &176d ; player_hit_obstacle # Positive if tile is obstacle, negative if target &176c 60 RTS ; player_hit_obstacle &176d a0 00 LDY #&00 &176f b1 00 LDA (&00),Y ; tile_address &1771 c9 2b CMP #&2b ; TILE_RUNWAY_TOP &1773 f0 07 BEQ &177c ; is_runway &1775 c9 2c CMP #&2c ; TILE_RUNWAY_BOTTOM &1777 f0 03 BEQ &177c ; is_runway &1779 e6 a7 INC &a7 ; player_killed # Set to non-zero to indicate player killed (obstacle) ; leave &177b 60 RTS ; is_runway &177c a5 a9 LDA &a9 ; player_direction &177e 30 fb BMI &177b ; leave &1780 a5 b9 LDA &b9 ; pods_remaining &1782 d0 f7 BNE &177b ; leave &1784 c6 a7 DEC &a7 ; player_killed # Set to negative to indicate level completed &1786 60 RTS ; add_missile # Called with Y = missile direction &1787 a2 07 LDX #&07 ; find_free_slot_loop &1789 bd 30 01 LDA &0130,X ; missiles_screen_address_high # Zero if no missile in slot &178c f0 03 BEQ &1791 ; found_free_slot &178e ca DEX &178f 10 f8 BPL &1789 ; find_free_slot_loop ; found_free_slot &1791 a5 0b LDA &0b ; sprite_x_fraction &1793 18 CLC &1794 69 01 ADC #&01 &1796 c9 04 CMP #&04 &1798 90 02 BCC &179c ; skip_overflow &179a e6 0a INC &0a ; sprite_x ; skip_overflow &179c 29 03 AND #&03 &179e 85 0b STA &0b ; sprite_x_fraction &17a0 20 6c 19 JSR &196c ; calculate_sprite_screen_address &17a3 a5 0a LDA &0a ; sprite_x &17a5 9d 20 01 STA &0120,X ; missiles_x &17a8 a5 0b LDA &0b ; sprite_x_fraction &17aa 9d 40 01 STA &0140,X ; missiles_x_fraction &17ad a5 0c LDA &0c ; sprite_y &17af 05 0d ORA &0d ; missile_type &17b1 9d 48 01 STA &0148,X ; missiles_y_and_type &17b4 a5 00 LDA &00 ; screen_address_low &17b6 9d 28 01 STA &0128,X ; missiles_screen_address_low &17b9 a5 01 LDA &01 ; screen_address_high &17bb 9d 30 01 STA &0130,X ; missiles_screen_address_high &17be 98 TYA &17bf 9d 38 01 STA &0138,X ; missiles_direction &17c2 a9 11 LDA #&11 &17c4 c0 ff CPY #&ff &17c6 f0 02 BEQ &17ca ; set_ttl &17c8 a9 14 LDA #&14 ; set_ttl &17ca 9d 50 01 STA &0150,X ; missiles_ttl ; plot_or_unplot_missile &17cd bd 28 01 LDA &0128,X ; missiles_screen_address_low &17d0 29 f8 AND #&f8 &17d2 85 00 STA &00 ; screen_address_low &17d4 bd 30 01 LDA &0130,X ; missiles_screen_address_high &17d7 85 01 STA &01 ; screen_address_high &17d9 bd 28 01 LDA &0128,X ; missiles_screen_address_low &17dc 29 07 AND #&07 &17de a8 TAY &17df a2 01 LDX #&01 # Plot two bytes for each missile ; plot_or_unplot_missile_loop &17e1 98 TYA &17e2 18 CLC &17e3 69 05 ADC #&05 # separated by five rows &17e5 a8 TAY &17e6 c9 08 CMP #&08 &17e8 90 0e BCC &17f8 ; not_next_group &17ea 29 07 AND #&07 &17ec a8 TAY &17ed a5 01 LDA &01 ; screen_address_high &17ef 18 CLC &17f0 69 02 ADC #&02 # Move down a group &17f2 29 1f AND #&1f # Keep address within screen memory &17f4 09 60 ORA #&60 &17f6 85 01 STA &01 ; screen_address_high ; not_next_group &17f8 b1 00 LDA (&00),Y ; screen_address &17fa 49 ff EOR #&ff &17fc 91 00 STA (&00),Y ; screen_address &17fe ca DEX &17ff 10 e0 BPL &17e1 ; plot_or_unplot_missile_loop &1801 60 RTS ; update_missiles &1802 a2 07 LDX #&07 ; update_missiles_loop &1804 86 b8 STX &b8 ; missile_to_update &1806 bd 30 01 LDA &0130,X ; missiles_screen_address_high # Zero if no missile in slot &1809 f0 35 BEQ &1840 ; consider_next_missile &180b 20 cd 17 JSR &17cd ; plot_or_unplot_missile # Unplot missile &180e a6 b8 LDX &b8 ; missile_to_update &1810 20 07 19 JSR &1907 ; update_missile &1813 de 50 01 DEC &0150,X ; missiles_ttl &1816 30 34 BMI &184c ; explode_missile &1818 bd 20 01 LDA &0120,X ; missiles_x &181b 85 00 STA &00 ; tile_x &181d bd 40 01 LDA &0140,X ; missiles_x_fraction &1820 85 01 STA &01 ; tile_x_fraction &1822 bd 48 01 LDA &0148,X ; missiles_y_and_type # Top bit set if player missile, clear if enemy missile &1825 10 0d BPL &1834 ; skip_tile_collision_check &1827 29 7f AND #&7f &1829 85 02 STA &02 ; tile_y &182b 20 bf 19 JSR &19bf ; check_for_collision_with_tile # Returns carry set if collision occurred &182e 90 04 BCC &1834 ; skip_tile_collision_check &1830 30 14 BMI &1846 ; missile_hit_tile # Positive if tile is obstacle, negative if target &1832 b0 18 BCS &184c ; explode_missile # Always branches ; skip_tile_collision_check &1834 20 76 18 JSR &1876 ; check_for_missile_collision_with_enemies_or_player &1837 a5 d7 LDA &d7 ; missile_collision # Non-zero if collision occurred &1839 d0 11 BNE &184c ; explode_missile &183b a6 b8 LDX &b8 ; missile_to_update &183d 20 cd 17 JSR &17cd ; plot_or_unplot_missile # Plot missile ; consider_next_missile &1840 a6 b8 LDX &b8 ; missile_to_update &1842 ca DEX &1843 10 bf BPL &1804 ; update_missiles_loop &1845 60 RTS ; missile_hit_tile &1846 20 57 1e JSR &1e57 ; destroy_tile &1849 20 60 18 JSR &1860 ; play_sound_for_explosion ; explode_missile &184c a6 b8 LDX &b8 ; missile_to_update &184e bd 48 01 LDA &0148,X ; missiles_y_and_type # Top bit set if player missile, clear if enemy missile &1851 10 04 BPL &1857 ; is_enemy_missile &1853 c6 b5 DEC &b5 ; number_of_player_missiles_present &1855 10 02 BPL &1859 ; not_enemy_missile ; is_enemy_missile &1857 c6 b1 DEC &b1 ; number_of_enemy_missiles_present ; not_enemy_missile &1859 a9 00 LDA #&00 &185b 9d 30 01 STA &0130,X ; missiles_screen_address_high &185e f0 e0 BEQ &1840 ; consider_next_missile # Always branches ; play_sound_for_explosion &1860 a5 3a LDA &3a ; channels_active + &20 # Non-zero if explosion already being played &1862 d0 11 BNE &1875 ; leave &1864 a2 00 LDX #&00 &1866 a0 00 LDY #&00 &1868 a9 02 LDA #&02 # Use channel 2 &186a 20 6e 06 JSR &066e ; play_sound # Play sound for explosion ; v vd vc vs pd pc ps &186d 00 00 00 00 c8 00 01 0a ; leave &1875 60 RTS ; check_for_missile_collision_with_enemies_or_player &1876 a9 00 LDA #&00 &1878 85 d7 STA &d7 ; missile_collision &187a a6 b8 LDX &b8 ; missile_to_update &187c bd 48 01 LDA &0148,X ; missiles_y_and_type # Top bit set if player missile, clear if enemy missile &187f 10 33 BPL &18b4 ; check_for_missile_collision_with_player ; check_for_missile_collision_with_enemies &1881 a2 02 LDX #&02 ; check_for_missile_collision_with_enemies_loop &1883 8a TXA &1884 48 PHA ; enemy &1885 bd 61 01 LDA &0161,X ; enemies_type_and_flags # Zero if not enemy in slot &1888 f0 24 BEQ &18ae ; consider_next_enemy &188a bd 5b 01 LDA &015b,X ; enemies_x &188d 85 00 STA &00 ; x &188f bd 58 01 LDA &0158,X ; enemies_x_fraction &1892 85 01 STA &01 ; x_fraction &1894 bd 5e 01 LDA &015e,X ; enemies_y &1897 85 02 STA &02 ; y &1899 20 c6 18 JSR &18c6 ; check_for_missile_collision &189c 90 10 BCC &18ae ; consider_next_enemy &189e a2 c8 LDX #&c8 ; &00c8 = 200 &18a0 a0 00 LDY #&00 &18a2 20 d7 1e JSR &1ed7 ; add_to_score # Score 200 for destroying enemy &18a5 20 60 18 JSR &1860 ; play_sound_for_explosion &18a8 68 PLA ; enemy &18a9 48 PHA ; enemy &18aa aa TAX &18ab 20 51 21 JSR &2151 ; remove_enemy ; consider_next_enemy &18ae 68 PLA &18af aa TAX &18b0 ca DEX &18b1 10 d0 BPL &1883 ; check_for_missile_collision_with_enemies_loop &18b3 60 RTS ; check_for_missile_collision_with_player &18b4 a5 98 LDA &98 ; player_x &18b6 85 00 STA &00 ; x &18b8 a5 96 LDA &96 ; player_x_fraction &18ba 85 01 STA &01 ; x_fraction &18bc a5 97 LDA &97 ; player_y &18be 20 c8 18 JSR &18c8 ; check_for_missile_X_collision &18c1 90 02 BCC &18c5 ; leave &18c3 e6 a7 INC &a7 ; player_killed # Set to non-zero to indicate player killed (enemy missile) ; leave &18c5 60 RTS ; check_for_missile_collision &18c6 a6 b8 LDX &b8 ; missile_to_update ; check_for_missile_X_collision &18c8 85 02 STA &02 ; y &18ca 18 CLC &18cb 69 0e ADC #&0e &18cd 85 03 STA &03 ; y_plus &18cf bd 48 01 LDA &0148,X ; missiles_y_and_type &18d2 29 7f AND #&7f &18d4 69 0a ADC #&0a &18d6 c5 02 CMP &02 ; y &18d8 90 2b BCC &1905 ; leave_with_carry_clear &18da e9 05 SBC #&05 &18dc c5 03 CMP &03 ; y_plus &18de b0 25 BCS &1905 ; leave_with_carry_clear &18e0 bd 20 01 LDA &0120,X ; missiles_x &18e3 c5 00 CMP &00 ; x &18e5 90 1e BCC &1905 ; leave_with_carry_clear &18e7 d0 0b BNE &18f4 ; skip_x_fraction_check &18e9 a4 01 LDY &01 ; x_fraction &18eb f0 14 BEQ &1901 ; leave_with_carry_set &18ed bc 40 01 LDY &0140,X ; missiles_x_fraction &18f0 c4 01 CPY &01 ; x_fraction &18f2 90 11 BCC &1905 ; leave_with_carry_clear ; skip_x_fraction_check &18f4 e9 00 SBC #&00 &18f6 c5 00 CMP &00 ; x &18f8 d0 0b BNE &1905 ; leave_with_carry_clear &18fa bd 40 01 LDA &0140,X ; missiles_x_fraction &18fd c5 01 CMP &01 ; x_fraction &18ff b0 04 BCS &1905 ; leave_with_carry_clear ; leave_with_carry_set &1901 e6 d7 INC &d7 ; missile_collision &1903 38 SEC # Leave with carry set to indicate collision &1904 60 RTS ; leave_with_carry_clear &1905 18 CLC # Leave with carry clear to indicate no collision &1906 60 RTS ; update_missile &1907 a0 10 LDY #&10 # Move missile by eight pixels &1909 bd 38 01 LDA &0138,X ; missiles_direction &190c 45 a9 EOR &a9 ; player_direction &190e f0 02 BEQ &1912 ; same_direction &1910 a0 00 LDY #&00 # unless moving in opposite direction to player ; same_direction &1912 84 0a STY &0a ; screen_address_delta_low # If the missile is moving right, use +delta &1914 a9 00 LDA #&00 &1916 85 0b STA &0b ; screen_address_delta_high &1918 38 SEC &1919 e5 0a SBC &0a ; screen_address_delta_low &191b 85 00 STA &00 ; minus_screen_address_delta_low &191d a9 00 LDA #&00 &191f e9 00 SBC #&00 &1921 85 01 STA &01 ; minus_screen_address_delta_high &1923 a9 02 LDA #&02 &1925 85 0c STA &0c ; missile_x_fraction_delta &1927 bd 38 01 LDA &0138,X ; missiles_direction &192a 10 0c BPL &1938 ; not_moving_left # If the missile is moving left, use -delta &192c a5 00 LDA &00 ; minus_screen_address_delta_low &192e 85 0a STA &0a ; screen_address_delta_low &1930 a5 01 LDA &01 ; minus_screen_address_delta_high &1932 85 0b STA &0b ; screen_address_delta_high &1934 a9 fe LDA #&fe &1936 85 0c STA &0c ; missile_x_fraction_delta ; not_moving_left &1938 bd 28 01 LDA &0128,X ; missiles_screen_address_low &193b 18 CLC &193c 65 0a ADC &0a ; screen_address_delta_low &193e 9d 28 01 STA &0128,X ; missiles_screen_address_low &1941 bd 30 01 LDA &0130,X ; missiles_screen_address_high &1944 65 0b ADC &0b ; screen_address_delta_high &1946 29 1f AND #&1f # Keep address within screen memory &1948 09 60 ORA #&60 &194a 9d 30 01 STA &0130,X ; missiles_screen_address_high &194d bd 40 01 LDA &0140,X ; missiles_x_fraction &1950 18 CLC &1951 65 0c ADC &0c ; missile_x_fraction_delta # Move missile in world regardless &1953 9d 40 01 STA &0140,X ; missiles_x_fraction &1956 30 04 BMI &195c ; next_tile &1958 c9 04 CMP #&04 &195a 90 0f BCC &196b ; leave ; next_tile &195c 29 03 AND #&03 &195e 9d 40 01 STA &0140,X ; missiles_x_fraction &1961 bd 20 01 LDA &0120,X ; missiles_x &1964 18 CLC &1965 7d 38 01 ADC &0138,X ; missiles_direction &1968 9d 20 01 STA &0120,X ; missiles_x ; leave &196b 60 RTS ; calculate_sprite_screen_address &196c a5 0b LDA &0b ; sprite_x_fraction &196e 38 SEC &196f e9 03 SBC #&03 &1971 10 02 BPL &1975 ; skip_underflow &1973 c6 0a DEC &0a ; sprite_x ; skip_underflow &1975 29 03 AND #&03 &1977 85 0b STA &0b ; sprite_x_fraction &1979 a5 0c LDA &0c ; sprite_y &197b 4a LSR A &197c 4a LSR A &197d 29 1e AND #&1e &197f 85 01 STA &01 ; screen_address_high &1981 a5 0a LDA &0a ; sprite_x &1983 38 SEC &1984 e5 a4 SBC &a4 ; screen_left_x &1986 0a ASL A &1987 0a ASL A &1988 0a ASL A &1989 0a ASL A &198a 0a ASL A &198b 85 00 STA &00 ; screen_address_low &198d 90 02 BCC &1991 ; skip_page &198f e6 01 INC &01 ; screen_address_high ; skip_page &1991 a5 a5 LDA &a5 ; screen_left_x_fraction &1993 49 03 EOR #&03 &1995 18 CLC &1996 65 0b ADC &0b ; sprite_x_fraction &1998 0a ASL A &1999 0a ASL A &199a 0a ASL A &199b 65 00 ADC &00 ; screen_address_low &199d 85 00 STA &00 ; screen_address_low &199f 90 02 BCC &19a3 ; skip_page &19a1 e6 01 INC &01 ; screen_address_high ; skip_page &19a3 a5 0c LDA &0c ; sprite_y &19a5 29 07 AND #&07 &19a7 18 CLC &19a8 65 00 ADC &00 ; screen_address_low &19aa 85 00 STA &00 ; screen_address_low &19ac a5 00 LDA &00 ; screen_address_low &19ae 65 a2 ADC &a2 ; screen_start_address_low &19b0 85 00 STA &00 ; screen_address_low &19b2 a5 01 LDA &01 ; screen_address_high &19b4 65 a3 ADC &a3 ; screen_start_address_high &19b6 69 04 ADC #&04 # Move down two groups, i.e. past score area &19b8 29 1f AND #&1f # Keep address within screen memory &19ba 09 60 ORA #&60 &19bc 85 01 STA &01 ; screen_address_high &19be 60 RTS ; check_for_collision_with_tile &19bf 20 d4 19 JSR &19d4 ; check_for_collision_with_four_tiles # Returns carry set if collision &19c2 a5 09 LDA &09 ; collision_check_tile_address_low &19c4 85 00 STA &00 ; tile_address_low &19c6 ad 33 1a LDA &1a33 ; collision_check_tile_address_high &19c9 85 01 STA &01 ; tile_address_high &19cb a0 00 LDY #&00 &19cd b1 00 LDA (&00),Y ; tile_address &19cf aa TAX &19d0 bd 32 25 LDA &2532,X ; tile_properties_table &19d3 60 RTS # Leave with negative if tile can be destroyed ; check_for_collision_with_four_tiles &19d4 a2 00 LDX #&00 ; 1010 # Bug; should be LDX #&0a to separate left and right &19d6 a5 01 LDA &01 ; tile_x_fraction &19d8 c9 02 CMP #&02 &19da b0 02 BCS &19de ; not_left_half &19dc a2 05 LDX #&05 ; 0101 ; not_left_half &19de 86 07 STX &07 ; initial_horizontal_mask # Should be &05 in left of tile, &0a in right of tile &19e0 a5 02 LDA &02 ; tile_y # actually &00 in left of tile, &0f in right of tile &19e2 29 0f AND #&0f &19e4 85 08 STA &08 ; check_y_fraction &19e6 a2 03 LDX #&03 ; 0011 &19e8 c9 08 CMP #&08 &19ea b0 02 BCS &19ee ; not_bottom_edge &19ec a2 0c LDX #&0c ; 1100 ; not_bottom_edge &19ee 86 05 STX &05 ; vertical_mask # &03 in top half of tile, &0c in bottom half of tile &19f0 a5 02 LDA &02 ; tile_y &19f2 29 f0 AND #&f0 &19f4 4a LSR A &19f5 4a LSR A &19f6 65 a6 ADC &a6 ; level_type &19f8 69 2a ADC #&2a ; &2a00 = level_data &19fa 8d 33 1a STA &1a33 ; collision_check_tile_address_high &19fd 20 0e 1a JSR &1a0e ; check_pair_of_tiles_for_collision # Check tiles for top of missile or player &1a00 b0 24 BCS &1a26 ; leave # Leave with carry set if collision &1a02 a5 08 LDA &08 ; check_y_fraction &1a04 f0 20 BEQ &1a26 ; leave # Is there vertical alignment? If so, skip bottom check &1a06 ad 33 1a LDA &1a33 ; collision_check_tile_address_high &1a09 69 04 ADC #&04 &1a0b 8d 33 1a STA &1a33 ; collision_check_tile_address_high ; check_pair_of_tiles_for_collision # Check tiles for bottom of missile or player &1a0e a5 05 LDA &05 ; vertical_mask &1a10 49 0f EOR #&0f # &0c in top half of tile, &03 in bottom half of tile &1a12 85 05 STA &05 ; vertical_mask &1a14 a5 00 LDA &00 ; tile_x &1a16 85 09 STA &09 ; collision_check_tile_address_low &1a18 a5 07 LDA &07 ; initial_horizontal_mask &1a1a 20 2b 1a JSR &1a2b ; check_single_tile_for_collision &1a1d b0 07 BCS &1a26 ; leave # Leave with carry set if collision &1a1f a5 06 LDA &06 ; horizontal_mask &1a21 c9 0f CMP #&0f &1a23 d0 02 BNE &1a27 ; check_right_tile_for_collision # Is there horizontal alignment? If so, skip right check &1a25 18 CLC # Leave with carry clear to indicate no collision ; leave &1a26 60 RTS ; check_right_tile_for_collision &1a27 e6 09 INC &09 ; collision_check_tile_address_low &1a29 a5 06 LDA &06 ; horizontal_mask ; check_single_tile_for_collision &1a2b 49 0f EOR #&0f # Should be &0a in left of tile, &05 in right of tile &1a2d 85 06 STA &06 ; horizontal_mask # actually &0f in left of tile, &00 in right of tile &1a2f a6 09 LDX &09 ; collision_check_tile_address_low &1a31 bc 00 0f LDY &0f00,X # actually LDY collision_check_tile_address_high,X &1a34 30 0a BMI &1a40 ; leave_with_carry_clear # No collision if tile has been destroyed &1a36 b9 32 25 LDA &2532,Y ; tile_properties_table &1a39 25 05 AND &05 ; vertical_mask &1a3b 25 06 AND &06 ; horizontal_mask &1a3d 38 SEC # Leave with carry set to indicate collision &1a3e d0 01 BNE &1a41 ; leave # Non-zero only if bit set for specified quarter of tile ; leave_with_carry_clear &1a40 18 CLC # Leave with carry clear to indicate no collision ; leave &1a41 60 RTS ; plot_player &1a42 a6 b4 LDX &b4 ; player_sprite &1a44 86 0e STX &0e ; sprite &1a46 a5 98 LDA &98 ; player_x &1a48 85 0a STA &0a ; sprite_x &1a4a a5 96 LDA &96 ; player_x_fraction &1a4c 85 0b STA &0b ; sprite_x_fraction &1a4e a5 97 LDA &97 ; player_y &1a50 85 0c STA &0c ; sprite_y &1a52 20 6c 19 JSR &196c ; calculate_sprite_screen_address ; plot_sprite &1a55 a5 0e LDA &0e ; sprite &1a57 85 e7 STA &e7 ; sprite_address_low &1a59 a9 00 LDA #&00 &1a5b 06 e7 ASL &e7 ; sprite_address_low # 64 bytes per sprite &1a5d 2a ROL A &1a5e 06 e7 ASL &e7 ; sprite_address_low &1a60 2a ROL A &1a61 06 e7 ASL &e7 ; sprite_address_low &1a63 2a ROL A &1a64 06 e7 ASL &e7 ; sprite_address_low &1a66 2a ROL A &1a67 06 e7 ASL &e7 ; sprite_address_low &1a69 2a ROL A &1a6a 06 e7 ASL &e7 ; sprite_address_low &1a6c 2a ROL A &1a6d 69 46 ADC #&46 ; &4600 = sprite_data &1a6f 85 e8 STA &e8 ; sprite_address_high &1a71 a5 e7 LDA &e7 ; sprite_address_low &1a73 8d d3 1a STA &1ad3 ; sprite_address_top_one_low &1a76 8d f4 1a STA &1af4 ; sprite_address_top_two_low &1a79 18 CLC &1a7a 69 20 ADC #&20 &1a7c 8d da 1a STA &1ada ; sprite_address_bottom_one_low &1a7f 8d ed 1a STA &1aed ; sprite_address_bottom_two_low &1a82 a5 e8 LDA &e8 ; sprite_address_high &1a84 8d d4 1a STA &1ad4 ; sprite_address_top_one_high &1a87 8d f5 1a STA &1af5 ; sprite_address_top_one_high &1a8a 69 00 ADC #&00 &1a8c 8d db 1a STA &1adb ; sprite_address_bottom_one_high &1a8f 8d ee 1a STA &1aee ; sprite_address_bottom_two_high &1a92 a5 00 LDA &00 ; screen_address_low &1a94 29 07 AND #&07 &1a96 85 04 STA &04 ; first_row_in_group &1a98 aa TAX &1a99 ca DEX &1a9a 86 05 STX &05 ; last_row_in_group &1a9c a5 00 LDA &00 ; screen_address_low &1a9e 29 f8 AND #&f8 &1aa0 85 00 STA &00 ; screen_address_low &1aa2 a9 07 LDA #&07 &1aa4 85 0b STA &0b ; bottom_sprite_offset &1aa6 38 SEC &1aa7 e5 04 SBC &04 ; first_row_in_group &1aa9 85 0a STA &0a ; top_sprite_offset &1aab a2 03 LDX #&03 ; plot_sprite_column_loop &1aad 86 0f STX &0f ; columns &1aaf a5 00 LDA &00 ; screen_address_low &1ab1 85 02 STA &02 ; middle_screen_address_low &1ab3 85 06 STA &06 ; bottom_screen_address_low &1ab5 a5 01 LDA &01 ; screen_address_high &1ab7 29 1f AND #&1f # Keep address within screen memory &1ab9 09 60 ORA #&60 &1abb 85 01 STA &01 ; screen_address_high &1abd 18 CLC &1abe 69 02 ADC #&02 # Move down a group &1ac0 29 1f AND #&1f # Keep address within screen memory &1ac2 09 60 ORA #&60 &1ac4 85 03 STA &03 ; middle_screen_address_high &1ac6 69 02 ADC #&02 # Move down a group &1ac8 29 1f AND #&1f # Keep address within screen memory &1aca 09 60 ORA #&60 &1acc 85 07 STA &07 ; bottom_screen_address_high &1ace a6 0a LDX &0a ; top_sprite_offset &1ad0 a0 07 LDY #&07 ; plot_sprite_top_byte_loop &1ad2 bd ff ff LDA &ffff,X # actually LDA sprite_address_middle_one,X &1ad5 51 00 EOR (&00),Y ; screen_address &1ad7 91 00 STA (&00),Y ; screen_address &1ad9 bd ff ff LDA &ffff,X # actually LDA sprite_address_bottom_one_low,X &1adc 51 02 EOR (&02),Y ; middle_screen_address &1ade 91 02 STA (&02),Y ; middle_screen_address &1ae0 ca DEX &1ae1 88 DEY &1ae2 c4 05 CPY &05 ; last_row_in_group &1ae4 d0 ec BNE &1ad2 ; plot_sprite_top_byte_loop &1ae6 a4 05 LDY &05 ; last_row_in_group &1ae8 30 14 BMI &1afe ; skip_bottom_group &1aea a6 0b LDX &0b ; bottom_sprite_offset ; plot_sprite_bottom_byte_loop &1aec bd ff ff LDA &ffff,X # actually sprite_address_bottom_two_low,X &1aef 51 06 EOR (&06),Y ; bottom_screen_address &1af1 91 06 STA (&06),Y ; bottom_screen_address &1af3 bd ff ff LDA &ffff,X # actually LDA sprite_address_middle_two,X &1af6 51 02 EOR (&02),Y ; middle_screen_address &1af8 91 02 STA (&02),Y ; middle_screen_address &1afa ca DEX &1afb 88 DEY &1afc 10 ee BPL &1aec ; plot_sprite_bottom_byte_loop ; skip_bottom_group &1afe a5 00 LDA &00 ; screen_address_low &1b00 18 CLC &1b01 69 08 ADC #&08 # Move right four pixels &1b03 85 00 STA &00 ; screen_address_low &1b05 a5 01 LDA &01 ; screen_address_high &1b07 69 00 ADC #&00 &1b09 85 01 STA &01 ; screen_address_high &1b0b a5 0a LDA &0a ; top_sprite_offset &1b0d 69 08 ADC #&08 &1b0f 85 0a STA &0a ; top_sprite_offset &1b11 a5 0b LDA &0b ; bottom_sprite_offset &1b13 69 08 ADC #&08 &1b15 85 0b STA &0b ; bottom_sprite_offset &1b17 a6 0f LDX &0f ; columns &1b19 ca DEX &1b1a 10 91 BPL &1aad ; plot_sprite_column_loop &1b1c 60 RTS ; level_palettes &1b1d 02 04 00 07 ; G B K W &1b21 04 05 06 03 ; B M C Y &1b25 06 00 04 03 ; C K B Y &1b29 00 01 06 07 ; K R C W ; colour_3_pixel_values &1b2d 11 22 44 88 ; rnd &1b31 a4 ff LDY &ff ; frame_counter &1b33 4d 48 fe EOR &fe48 ; System VIA timer 2 counter LSB &1b36 4d 49 fe EOR &fe49 ; System VIA timer 2 counter MSB &1b39 45 ff EOR &ff ; frame_counter &1b3b 59 00 c0 EOR &c000,Y &1b3e 59 00 00 EOR &0000,Y &1b41 ee 4e 1b INC &1b4e ; rnd_state &1b44 ac 4e 1b LDY &1b4e ; rnd_state &1b47 4d 4e 1b EOR &1b4e ; rnd_state &1b4a 59 00 d0 EOR &d000,Y &1b4d 60 RTS ; rnd_state &1b4e 00 ; convert_lives_to_sprite_offset &1b4f a5 94 LDA &94 ; lives # lives is one greater than number displayed &1b51 c9 0b CMP #&0b &1b53 90 02 BCC &1b57 ; skip_ceiling &1b55 a9 0a LDA #&0a ; 9 + 1 ; skip_ceiling &1b57 0a ASL A &1b58 0a ASL A &1b59 0a ASL A &1b5a 0a ASL A &1b5b e9 09 SBC #&09 ; 16 - 6 # Offset is last row, use previous number &1b5d 85 b6 STA &b6 ; lives_as_sprite_offset &1b5f 60 RTS ; initialise_level &1b60 20 82 10 JSR &1082 ; reset_level_data ; initialise_level_without_resetting_data &1b63 20 b0 04 JSR &04b0 ; initialise_screen &1b66 20 ad 1e JSR &1ead ; update_score_variables &1b69 20 4f 1b JSR &1b4f ; convert_lives_to_sprite_offset &1b6c a9 5f LDA #&5f ; SPRITE_PLAYER_RIGHT &1b6e 85 b4 STA &b4 ; player_sprite &1b70 a9 01 LDA #&01 # Player starts facing right &1b72 85 a9 STA &a9 ; player_direction &1b74 a5 95 LDA &95 ; level &1b76 29 03 AND #&03 &1b78 85 a6 STA &a6 ; level_type &1b7a 0a ASL A &1b7b 0a ASL A &1b7c a8 TAY &1b7d a2 04 LDX #&04 # Rotate colour 0 of top palette &1b7f 86 fe STX &fe ; colour_to_rotate &1b81 ca DEX ; use_level_palette_loop &1b82 b9 1d 1b LDA &1b1d,Y ; level_palettes &1b85 20 08 05 JSR &0508 ; set_palette &1b88 c8 INY &1b89 ca DEX &1b8a 10 f6 BPL &1b82 ; use_level_palette_loop &1b8c a9 00 LDA #&00 &1b8e 85 b0 STA &b0 ; unused # Unused variable &1b90 85 b1 STA &b1 ; number_of_enemy_missiles_present &1b92 85 b3 STA &b3 ; turn_direction # Set to zero to indicate player not turning &1b94 85 b5 STA &b5 ; number_of_player_missiles_present &1b96 85 ba STA &ba ; suppress_player_input # Set to zero to allow input &1b98 a2 02 LDX #&02 ; initialise_enemies_loop &1b9a 9d 61 01 STA &0161,X ; enemies_type_and_flags # Set to zero to indicate no enemy in slot &1b9d ca DEX &1b9e 10 fa BPL &1b9a ; initialise_enemies_loop &1ba0 a2 07 LDX #&07 ; initialise_missiles_loop &1ba2 9d 30 01 STA &0130,X ; missiles_screen_address_high # Set to zero to indicate no missile in slot &1ba5 ca DEX &1ba6 10 fa BPL &1ba2 ; initialise_missiles_loop &1ba8 a5 98 LDA &98 ; player_x &1baa 38 SEC &1bab e9 18 SBC #&18 &1bad 85 a4 STA &a4 ; screen_left_x &1baf a5 96 LDA &96 ; player_x_fraction &1bb1 85 a5 STA &a5 ; screen_left_x_fraction &1bb3 a2 3f LDX #&3f ; scroll_onto_screen_loop &1bb5 8a TXA &1bb6 48 PHA ; count &1bb7 20 23 1c JSR &1c23 ; scroll_right # Plot initial screen by scrolling &1bba 68 PLA ; count &1bbb aa TAX &1bbc ca DEX &1bbd 10 f6 BPL &1bb5 ; scroll_onto_screen_loop &1bbf a9 0a LDA #&0a # Ten pods per level &1bc1 85 b9 STA &b9 ; pods_remaining &1bc3 a5 95 LDA &95 ; level &1bc5 c9 80 CMP #&80 &1bc7 90 02 BCC &1bcb ; skip_ceiling &1bc9 a9 80 LDA #&80 ; skip_ceiling &1bcb 18 CLC &1bcc 69 02 ADC #&02 &1bce 85 d0 STA &d0 ; probability_of_adding_enemy # (level + 2) / 256 chance of adding enemy per frame &1bd0 4c e7 07 JMP &07e7 ; wait_for_vsync_and_display_screen ; add_XA_and_YA_to_crtc_and_screen_start_addresses &1bd3 86 0b STX &0b ; crtc_delta_low &1bd5 84 0c STY &0c ; screen_delta_low &1bd7 85 0d STA &0d ; screen_and_crtc_delta_high &1bd9 a5 a0 LDA &a0 ; crtc_start_address_low &1bdb 18 CLC &1bdc 65 0b ADC &0b ; crtc_delta_low &1bde 85 a0 STA &a0 ; crtc_start_address_low &1be0 a5 a1 LDA &a1 ; crtc_start_address_high &1be2 65 0d ADC &0d ; screen_and_crtc_delta_high &1be4 29 03 AND #&03 # Keep address within screen memory &1be6 09 0c ORA #&0c &1be8 85 a1 STA &a1 ; crtc_start_address_high &1bea a5 a2 LDA &a2 ; screen_start_address_low &1bec 18 CLC &1bed 65 0c ADC &0c ; screen_delta_low &1bef 85 a2 STA &a2 ; screen_start_address_low &1bf1 a5 a3 LDA &a3 ; screen_start_address_high &1bf3 65 0d ADC &0d ; screen_and_crtc_delta_high &1bf5 29 1f AND #&1f # Keep address within screen memory &1bf7 09 60 ORA #&60 &1bf9 85 a3 STA &a3 ; screen_start_address_high &1bfb 60 RTS ; scroll_left &1bfc a6 a5 LDX &a5 ; screen_left_x_fraction &1bfe ca DEX &1bff 10 04 BPL &1c05 ; skip_underflow &1c01 a2 03 LDX #&03 &1c03 c6 a4 DEC &a4 ; screen_left_x ; skip_underflow &1c05 86 a5 STX &a5 ; screen_left_x_fraction &1c07 a2 ff LDX #&ff ; &ffff &1c09 a0 f8 LDY #&f8 ; &fff8 &1c0b a9 ff LDA #&ff &1c0d 20 d3 1b JSR &1bd3 ; add_XA_and_YA_to_crtc_and_screen_start_addresses &1c10 a5 a2 LDA &a2 ; screen_start_address_low &1c12 85 00 STA &00 ; screen_address_low &1c14 a5 a3 LDA &a3 ; screen_start_address_high &1c16 85 01 STA &01 ; screen_address_high &1c18 a5 a4 LDA &a4 ; screen_left_x &1c1a 85 02 STA &02 ; tile_address_low &1c1c a5 a5 LDA &a5 ; screen_left_x_fraction &1c1e 85 06 STA &06 ; tile_x_fraction &1c20 4c 5c 1c JMP &1c5c ; plot_column_of_tiles ; scroll_right &1c23 a6 a5 LDX &a5 ; screen_left_x_fraction &1c25 e8 INX &1c26 e0 04 CPX #&04 &1c28 d0 04 BNE &1c2e ; skip_overflow &1c2a a2 00 LDX #&00 &1c2c e6 a4 INC &a4 ; screen_left_x ; skip_overflow &1c2e 86 a5 STX &a5 ; screen_left_x_fraction &1c30 a2 01 LDX #&01 ; &0001 &1c32 a0 08 LDY #&08 ; &0008 &1c34 a9 00 LDA #&00 &1c36 20 d3 1b JSR &1bd3 ; add_XA_and_YA_to_crtc_and_screen_start_addresses &1c39 a5 a2 LDA &a2 ; screen_start_address_low &1c3b 18 CLC &1c3c 69 f8 ADC #&f8 &1c3e 85 00 STA &00 ; screen_address_low &1c40 a5 a3 LDA &a3 ; screen_start_address_high &1c42 69 01 ADC #&01 &1c44 29 1f AND #&1f # Keep address within screen memory &1c46 09 60 ORA #&60 &1c48 85 01 STA &01 ; screen_address_high &1c4a a5 a4 LDA &a4 ; screen_left_x &1c4c 18 CLC &1c4d 69 10 ADC #&10 &1c4f a8 TAY &1c50 a6 a5 LDX &a5 ; screen_left_x_fraction &1c52 ca DEX &1c53 10 03 BPL &1c58 ; skip_underflow &1c55 88 DEY &1c56 a2 03 LDX #&03 ; skip_underflow &1c58 84 02 STY &02 ; tile_address_low &1c5a 86 06 STX &06 ; tile_x_fraction ; plot_column_of_tiles &1c5c a5 00 LDA &00 ; screen_address_low &1c5e 8d 4a 1f STA &1f4a ; tile_screen_address_low &1c61 a5 01 LDA &01 ; screen_address_high &1c63 18 CLC &1c64 69 04 ADC #&04 &1c66 29 1f AND #&1f # Keep address within screen memory &1c68 09 60 ORA #&60 &1c6a 8d 4b 1f STA &1f4b ; tile_screen_address_high &1c6d 20 5d 1f JSR &1f5d ; wipe_column # Wipe group containing score &1c70 e6 01 INC &01 ; screen_address_high # Move down a group &1c72 e6 01 INC &01 ; screen_address_high &1c74 20 5d 1f JSR &1f5d ; wipe_column # Wipe group below score &1c77 a5 a6 LDA &a6 ; level_type &1c79 18 CLC &1c7a 69 2a ADC #&2a ; &2a00 = level_data &1c7c 85 03 STA &03 ; tile_address_high &1c7e a5 06 LDA &06 ; tile_x_fraction &1c80 0a ASL A &1c81 0a ASL A &1c82 0a ASL A &1c83 69 07 ADC #&07 &1c85 85 06 STA &06 ; tile_sprite_offset &1c87 a9 0c LDA #&0c ; R12: Displayed screen start address register (high) &1c89 8d 00 fe STA &fe00 ; video register number &1c8c a5 a1 LDA &a1 ; crtc_start_address_high &1c8e 8d 01 fe STA &fe01 ; video register value &1c91 a9 0d LDA #&0d ; R13: Displayed screen start address register (low) &1c93 8d 00 fe STA &fe00 ; video register number &1c96 a5 a0 LDA &a0 ; crtc_start_address_low &1c98 8d 01 fe STA &fe01 ; video register value &1c9b 20 ed 1c JSR &1ced ; plot_score_and_lives_or_demo &1c9e a2 06 LDX #&06 ; plot_column_of_tiles_loop &1ca0 86 07 STX &07 ; tiles_remaining &1ca2 a0 00 LDY #&00 &1ca4 b1 02 LDA (&02),Y ; tile_address # Top bit set if tile destroyed &1ca6 10 0c BPL &1cb4 ; not_destroyed &1ca8 aa TAX &1ca9 bd b2 24 LDA &24b2,X ; tile_properties_table - &80 &1cac 29 70 AND #&70 ; TILE_FLAGS_DESTROYED_TYPE &1cae 4a LSR A &1caf 4a LSR A &1cb0 4a LSR A &1cb1 4a LSR A &1cb2 69 4f ADC #&4f ; TILE_DESTROYED_ZERO ; not_destroyed &1cb4 85 04 STA &04 ; sprite_address_low &1cb6 98 TYA &1cb7 06 04 ASL &04 ; sprite_address_low &1cb9 2a ROL A &1cba 06 04 ASL &04 ; sprite_address_low &1cbc 2a ROL A &1cbd 06 04 ASL &04 ; sprite_address_low &1cbf 2a ROL A &1cc0 06 04 ASL &04 ; sprite_address_low &1cc2 2a ROL A &1cc3 06 04 ASL &04 ; sprite_address_low &1cc5 2a ROL A &1cc6 06 04 ASL &04 ; sprite_address_low &1cc8 2a ROL A &1cc9 69 46 ADC #&46 ; &4600 = sprite_data &1ccb 8d 48 1f STA &1f48 ; tile_sprite_address_high &1cce a5 04 LDA &04 ; sprite_address_low &1cd0 8d 47 1f STA &1f47 ; tile_sprite_address_low &1cd3 20 42 1f JSR &1f42 ; plot_column_of_tile &1cd6 a5 04 LDA &04 ; sprite_address_low &1cd8 69 20 ADC #&20 &1cda 8d 47 1f STA &1f47 ; tile_sprite_address_low &1cdd 20 42 1f JSR &1f42 ; plot_column_of_tile &1ce0 a5 03 LDA &03 ; tile_address_high &1ce2 18 CLC &1ce3 69 04 ADC #&04 # Move down two groups &1ce5 85 03 STA &03 ; tile_address_high &1ce7 a6 07 LDX &07 ; tiles_remaining &1ce9 ca DEX &1cea 10 b4 BPL &1ca0 ; plot_column_of_tiles_loop &1cec 60 RTS ; plot_score_and_lives_or_demo &1ced a5 ae LDA &ae ; input_type # Negative if demo mode &1cef 10 40 BPL &1d31 ; plot_score_and_lives ; plot_demo &1cf1 a5 a2 LDA &a2 ; screen_start_address_low &1cf3 18 CLC &1cf4 69 e0 ADC #&e0 &1cf6 85 0a STA &0a ; demo_screen_address_low &1cf8 a5 a3 LDA &a3 ; screen_start_address_high &1cfa 69 00 ADC #&00 &1cfc 29 1f AND #&1f # Keep address within screen memory &1cfe 09 60 ORA #&60 &1d00 85 0b STA &0b ; demo_screen_address_high &1d02 20 8b 1d JSR &1d8b ; plot_space &1d05 a2 00 LDX #&00 ; plot_demo_character_loop &1d07 20 95 1d JSR &1d95 ; move_right_a_column &1d0a a0 00 LDY #&00 ; plot_demo_left_column_loop &1d0c bd f2 24 LDA &24f2,X ; demo_sprites &1d0f 91 0a STA (&0a),Y ; demo_screen_address &1d11 e8 INX &1d12 c8 INY &1d13 c0 08 CPY #&08 &1d15 d0 f5 BNE &1d0c ; plot_demo_left_column_loop &1d17 20 95 1d JSR &1d95 ; move_right_a_column &1d1a a0 00 LDY #&00 ; plot_demo_right_column_loop &1d1c bd f2 24 LDA &24f2,X ; demo_sprites &1d1f 91 0a STA (&0a),Y ; demo_screen_address &1d21 e8 INX &1d22 c8 INY &1d23 c0 08 CPY #&08 &1d25 d0 f5 BNE &1d1c ; plot_demo_right_column_loop &1d27 e0 40 CPX #&40 &1d29 d0 dc BNE &1d07 ; plot_demo_character_loop &1d2b 20 95 1d JSR &1d95 ; move_right_a_column &1d2e 4c 8b 1d JMP &1d8b ; plot_space ; plot_score_and_lives &1d31 a5 a2 LDA &a2 ; screen_start_address_low &1d33 85 0a STA &0a ; right_screen_address_low &1d35 a5 a3 LDA &a3 ; screen_start_address_high &1d37 85 0b STA &0b ; right_screen_address_high &1d39 a2 00 LDX #&00 ; plot_score_digit_loop &1d3b 86 0f STX &0f ; digit_offset &1d3d b5 c0 LDA &c0,X ; score_as_sprite_offsets &1d3f aa TAX &1d40 a5 0a LDA &0a ; right_screen_address_low &1d42 85 0c STA &0c ; left_screen_address_low &1d44 a5 0b LDA &0b ; right_screen_address_high &1d46 85 0d STA &0d ; left_screen_address_high &1d48 20 95 1d JSR &1d95 ; move_right_a_column &1d4b a0 06 LDY #&06 ; plot_score_byte_loop &1d4d bd 52 24 LDA &2452,X ; number_sprites &1d50 91 0c STA (&0c),Y ; left_screen_address &1d52 bd 5a 24 LDA &245a,X ; number_sprites + 8 &1d55 91 0a STA (&0a),Y ; right_screen_address &1d57 ca DEX &1d58 88 DEY &1d59 10 f2 BPL &1d4d ; plot_score_byte_loop &1d5b 20 95 1d JSR &1d95 ; move_right_a_column &1d5e a6 0f LDX &0f ; digit_offset &1d60 e8 INX &1d61 e0 09 CPX #&09 &1d63 d0 d6 BNE &1d3b ; plot_score_digit_loop &1d65 20 8b 1d JSR &1d8b ; plot_space &1d68 20 95 1d JSR &1d95 ; move_right_a_column &1d6b a6 b6 LDX &b6 ; lives_as_sprite_offset &1d6d a5 0a LDA &0a ; right_screen_address_low &1d6f 85 0c STA &0c ; left_screen_address_low &1d71 a5 0b LDA &0b ; right_screen_address_high &1d73 85 0d STA &0d ; left_screen_address_high &1d75 20 95 1d JSR &1d95 ; move_right_a_column &1d78 a0 06 LDY #&06 ; plot_lives_byte_loop &1d7a bd 52 24 LDA &2452,X ; number_sprites &1d7d 91 0c STA (&0c),Y ; left_screen_address &1d7f bd 5a 24 LDA &245a,X ; number_sprites + 8 &1d82 91 0a STA (&0a),Y ; right_screen_address &1d84 ca DEX &1d85 88 DEY &1d86 10 f2 BPL &1d7a ; plot_lives_byte_loop &1d88 20 95 1d JSR &1d95 ; move_right_a_column ; plot_space &1d8b a0 07 LDY #&07 &1d8d a9 00 LDA #&00 ; plot_space_loop &1d8f 91 0a STA (&0a),Y ; right_screen_address &1d91 88 DEY &1d92 10 fb BPL &1d8f ; plot_space_loop &1d94 60 RTS ; move_right_a_column &1d95 a5 0a LDA &0a ; right_screen_address_low &1d97 18 CLC &1d98 69 08 ADC #&08 &1d9a 85 0a STA &0a ; right_screen_address_low &1d9c a5 0b LDA &0b ; right_screen_address_high &1d9e 69 00 ADC #&00 &1da0 29 1f AND #&1f # Keep address within screen memory &1da2 09 60 ORA #&60 &1da4 85 0b STA &0b ; right_screen_address_high &1da6 60 RTS ; calculate_tile_sprite_address &1da7 10 0c BPL &1db5 ; not_destroyed &1da9 aa TAX &1daa bd b2 24 LDA &24b2,X ; tile_properties_table - &80 &1dad 29 70 AND #&70 ; TILE_FLAGS_DESTROYED_TYPE &1daf 4a LSR A &1db0 4a LSR A &1db1 4a LSR A &1db2 4a LSR A &1db3 69 4f ADC #&4f ; TILE_DESTROYED_ZERO ; not_destroyed &1db5 85 02 STA &02 ; sprite_address_low &1db7 98 TYA &1db8 06 02 ASL &02 ; sprite_address_low &1dba 2a ROL A &1dbb 06 02 ASL &02 ; sprite_address_low &1dbd 2a ROL A &1dbe 06 02 ASL &02 ; sprite_address_low &1dc0 2a ROL A &1dc1 06 02 ASL &02 ; sprite_address_low &1dc3 2a ROL A &1dc4 06 02 ASL &02 ; sprite_address_low &1dc6 2a ROL A &1dc7 06 02 ASL &02 ; sprite_address_low &1dc9 2a ROL A &1dca 69 46 ADC #&46 ; &4600 = sprite_data &1dcc 85 03 STA &03 ; sprite_address_high &1dce 60 RTS ; replot_destroyed_tile &1dcf a0 00 LDY #&00 &1dd1 b1 00 LDA (&00),Y ; tile_address &1dd3 20 a7 1d JSR &1da7 ; calculate_tile_sprite_address &1dd6 a5 02 LDA &02 ; sprite_address_low &1dd8 85 04 STA &04 ; previous_sprite_address_low &1dda a5 03 LDA &03 ; sprite_address_high &1ddc 85 05 STA &05 ; previous_sprite_address_high &1dde b1 00 LDA (&00),Y ; tile_address &1de0 09 80 ORA #&80 # Set top bit to indicate tile destroyed &1de2 91 00 STA (&00),Y ; tile_address &1de4 20 a7 1d JSR &1da7 ; calculate_tile_sprite_address &1de7 a5 00 LDA &00 ; tile_address_low &1de9 48 PHA ; tile_address_low &1dea 85 0a STA &0a ; sprite_x &1dec a5 01 LDA &01 ; tile_address_high &1dee 48 PHA ; tile_address_high &1def 38 SEC &1df0 e9 2a SBC #&2a ; &2a00 = level_data &1df2 29 fc AND #&fc &1df4 0a ASL A &1df5 0a ASL A &1df6 85 0c STA &0c ; sprite_y &1df8 84 0b STY &0b ; sprite_x_fraction &1dfa 20 6c 19 JSR &196c ; calculate_sprite_screen_address &1dfd 20 1d 1e JSR &1e1d ; replot_part_of_destroyed_tile # Replot top of destroyed tile &1e00 a5 00 LDA &00 ; screen_address_low &1e02 18 CLC &1e03 69 e0 ADC #&e0 # Move down a group &1e05 85 00 STA &00 ; screen_address_low &1e07 a5 01 LDA &01 ; screen_address_high &1e09 69 01 ADC #&01 &1e0b 29 1f AND #&1f # Keep address within screen memory &1e0d 09 60 ORA #&60 &1e0f 85 01 STA &01 ; screen_address_high &1e11 20 1d 1e JSR &1e1d ; replot_part_of_destroyed_tile # Replot bottom of destroyed tile &1e14 68 PLA ; tile_address_high &1e15 85 01 STA &01 ; tile_address_high &1e17 68 PLA ; tile_address_low &1e18 85 00 STA &00 ; tile_address_low &1e1a a0 00 LDY #&00 &1e1c 60 RTS ; replot_part_of_destroyed_tile &1e1d a2 03 LDX #&03 ; replot_part_of_destroyed_tile_column_loop &1e1f a0 07 LDY #&07 ; replot_part_of_destroyed_tile_byte_loop &1e21 b1 02 LDA (&02),Y ; sprite_address # Plot new tile &1e23 51 04 EOR (&04),Y ; previous_sprite_address # Unplot previous tile &1e25 51 00 EOR (&00),Y ; screen_address &1e27 91 00 STA (&00),Y ; screen_address &1e29 88 DEY &1e2a 10 f5 BPL &1e21 ; replot_part_of_destroyed_tile_byte_loop &1e2c a5 02 LDA &02 ; sprite_address_low &1e2e 18 CLC &1e2f 69 08 ADC #&08 &1e31 85 02 STA &02 ; sprite_address_low &1e33 90 02 BCC &1e37 ; skip_page &1e35 e6 03 INC &03 ; sprite_address_high ; skip_page &1e37 a5 04 LDA &04 ; previous_sprite_address_low &1e39 18 CLC &1e3a 69 08 ADC #&08 &1e3c 85 04 STA &04 ; previous_sprite_address_low &1e3e 90 02 BCC &1e42 ; skip_page &1e40 e6 05 INC &05 ; previous_sprite_address_high ; skip_page &1e42 a5 00 LDA &00 ; screen_address_low &1e44 18 CLC &1e45 69 08 ADC #&08 # Move right four pixels &1e47 85 00 STA &00 ; screen_address_low &1e49 a5 01 LDA &01 ; screen_address_high &1e4b 69 00 ADC #&00 &1e4d 29 1f AND #&1f # Keep address within screen memory &1e4f 09 60 ORA #&60 &1e51 85 01 STA &01 ; screen_address_high &1e53 ca DEX &1e54 10 c9 BPL &1e1f ; replot_part_of_destroyed_tile_column_loop &1e56 60 RTS ; destroy_tile &1e57 b1 00 LDA (&00),Y ; tile_address &1e59 48 PHA ; tile &1e5a c9 3d CMP #&3d ; TILE_POD &1e5c d0 02 BNE &1e60 ; not_pod &1e5e c6 b9 DEC &b9 ; pods_remaining ; not_pod &1e60 c9 24 CMP #&24 ; TILE_TANK_TOP_RIGHT &1e62 f0 04 BEQ &1e68 ; is_right_of_tank &1e64 c9 25 CMP #&25 ; TILE_TANK_BOTTOM_RIGHT &1e66 d0 02 BNE &1e6a ; not_right_of_tank ; is_right_of_tank &1e68 c6 00 DEC &00 ; tile_address_low # Move to left of tank ; not_right_of_tank &1e6a c9 23 CMP #&23 ; TILE_TANK_BOTTOM_LEFT &1e6c f0 04 BEQ &1e72 ; is_bottom_of_tank &1e6e c9 25 CMP #&25 ; TILE_TANK_BOTTOM_RIGHT &1e70 d0 08 BNE &1e7a ; not_bottom_of_tank ; is_bottom_of_tank &1e72 a6 01 LDX &01 ; tile_address_high &1e74 ca DEX # Move to top of tank &1e75 ca DEX &1e76 ca DEX &1e77 ca DEX &1e78 86 01 STX &01 ; tile_address_high ; not_bottom_of_tank &1e7a 20 cf 1d JSR &1dcf ; replot_destroyed_tile # Replot tile / top left of tank &1e7d b1 00 LDA (&00),Y ; tile_address &1e7f 29 7f AND #&7f &1e81 c9 22 CMP #&22 ; TILE_TANK_TOP_LEFT &1e83 d0 19 BNE &1e9e ; not_tank &1e85 a2 e1 LDX #&e1 ; &00e1 = 225 # Score 225 additional points for destroying tank &1e87 20 d7 1e JSR &1ed7 ; add_to_score &1e8a e6 00 INC &00 ; tile_address_low &1e8c 20 cf 1d JSR &1dcf ; replot_destroyed_tile # Replot top right of tank &1e8f a5 01 LDA &01 ; tile_address_high &1e91 18 CLC &1e92 69 04 ADC #&04 &1e94 85 01 STA &01 ; tile_address_high &1e96 20 cf 1d JSR &1dcf ; replot_destroyed_tile # Replot bottom right of tank &1e99 c6 00 DEC &00 ; tile_address_low &1e9b 20 cf 1d JSR &1dcf ; replot_destroyed_tile # Replot bottom left of tank ; not_tank &1e9e a2 4b LDX #&4b ; &004b = 75 # Score 75 points for destroying other tiles &1ea0 a0 00 LDY #&00 &1ea2 68 PLA ; tile &1ea3 c9 33 CMP #&33 ; TILE_BASE &1ea5 d0 03 BNE &1eaa ; not_base &1ea7 a2 90 LDX #&90 ; &0190 = 400 # Score 400 points for destroying base &1ea9 c8 INY ; not_base &1eaa 20 d7 1e JSR &1ed7 ; add_to_score ; update_score_variables &1ead a5 90 LDA &90 ; score &1eaf 85 f8 STA &f8 ; number &1eb1 a5 91 LDA &91 ; score + 1 &1eb3 85 f9 STA &f9 ; number + 1 &1eb5 a5 92 LDA &92 ; score + 2 &1eb7 85 fa STA &fa ; number + 2 &1eb9 a5 93 LDA &93 ; score + 3 &1ebb 85 fb STA &fb ; number + 3 &1ebd 20 ff 07 JSR &07ff ; convert_number_to_digits &1ec0 a0 00 LDY #&00 &1ec2 a2 08 LDX #&08 ; convert_score_to_sprite_offsets_loop &1ec4 b9 ef 00 LDA &00ef,Y ; digits &1ec7 38 SEC &1ec8 e9 30 SBC #&30 ; "0" &1eca 0a ASL A &1ecb 0a ASL A &1ecc 0a ASL A &1ecd 0a ASL A &1ece 69 06 ADC #&06 # Offset is last row &1ed0 95 c0 STA &c0,X ; score_as_sprite_offsets &1ed2 c8 INY &1ed3 ca DEX &1ed4 10 ee BPL &1ec4 ; convert_score_to_sprite_offsets_loop &1ed6 60 RTS ; add_to_score &1ed7 8a TXA &1ed8 18 CLC &1ed9 65 90 ADC &90 ; score &1edb 85 90 STA &90 ; score &1edd 98 TYA &1ede 65 91 ADC &91 ; score + 1 &1ee0 85 91 STA &91 ; score + 1 &1ee2 a5 92 LDA &92 ; score + 2 &1ee4 69 00 ADC #&00 &1ee6 85 92 STA &92 ; score + 2 &1ee8 a5 93 LDA &93 ; score + 3 &1eea 69 00 ADC #&00 &1eec 85 93 STA &93 ; score + 3 &1eee 86 ef STX &ef ; delta &1ef0 84 f0 STY &f0 ; delta + 1 &1ef2 a5 9b LDA &9b ; score_for_extra_life &1ef4 38 SEC &1ef5 e5 ef SBC &ef ; delta &1ef7 85 9b STA &9b ; score_for_extra_life &1ef9 a5 9c LDA &9c ; score_for_extra_life + 1 &1efb e5 f0 SBC &f0 ; delta + 1 &1efd 85 9c STA &9c ; score_for_extra_life + 1 &1eff 10 2d BPL &1f2e ; skip_extra_life &1f01 a5 9b LDA &9b ; score_for_extra_life &1f03 18 CLC &1f04 69 30 ADC #&30 ; &7530 = 30000 &1f06 85 9b STA &9b ; score_for_extra_life &1f08 a5 9c LDA &9c ; score_for_extra_life + 1 &1f0a 69 75 ADC #&75 &1f0c 85 9c STA &9c ; score_for_extra_life + 1 &1f0e e6 94 INC &94 ; lives &1f10 20 4f 1b JSR &1b4f ; convert_lives_to_sprite_offset &1f13 a5 00 LDA &00 ; tile_address_low &1f15 48 PHA ; tile_address_low &1f16 a5 01 LDA &01 ; tile_address_high &1f18 48 PHA ; tile_address_high &1f19 a9 02 LDA #&02 # Use channel 2 &1f1b aa TAX &1f1c a8 TAY &1f1d 20 6e 06 JSR &066e ; play_sound # Play sound for extra life ; v vd vc vs pd pc ps &1f20 00 00 00 00 89 fe 01 3c &1f28 68 PLA ; tile_address_high &1f29 85 01 STA &01 ; tile_address_high &1f2b 68 PLA ; tile_address_low &1f2c 85 00 STA &00 ; tile_address_low ; skip_extra_life &1f2e a4 f0 LDY &f0 ; delta + 1 # Restore Y &1f30 a5 ae LDA &ae ; input_type # Negative if demo mode &1f32 30 0d BMI &1f41 ; skip_resetting_palette &1f34 a6 fe LDX &fe ; colour_to_rotate # Positive if a colour was rotating &1f36 30 09 BMI &1f41 ; skip_resetting_palette &1f38 a9 ff LDA #&ff &1f3a 85 fe STA &fe ; colour_to_rotate # Set to negative to stop rotating colour &1f3c a9 03 LDA #&03 ; Y &1f3e 20 08 05 JSR &0508 ; set_palette # Set rotating colour to yellow ; skip_resetting_palette &1f41 60 RTS ; plot_column_of_tile &1f42 a4 06 LDY &06 ; tile_sprite_offset &1f44 a2 07 LDX #&07 ; plot_column_of_tile_loop &1f46 b9 ff 0f LDA &0fff,Y # actually LDA tile_sprite_address,X &1f49 9d ff 0f STA &0fff,X # actually STA tile_screen_address,X &1f4c 88 DEY &1f4d ca DEX &1f4e 10 f6 BPL &1f46 ; plot_column_of_tile_loop &1f50 ad 4b 1f LDA &1f4b ; tile_screen_address_high &1f53 69 02 ADC #&02 # Move down a group &1f55 29 1f AND #&1f # Keep address within screen memory &1f57 09 60 ORA #&60 &1f59 8d 4b 1f STA &1f4b ; tile_screen_address_high &1f5c 60 RTS ; wipe_column &1f5d a5 01 LDA &01 ; screen_address_high &1f5f 29 1f AND #&1f # Keep address within screen memory &1f61 09 60 ORA #&60 &1f63 85 01 STA &01 ; screen_address_high &1f65 a0 07 LDY #&07 &1f67 a9 00 LDA #&00 ; wipe_column_loop &1f69 91 00 STA (&00),Y ; screen_address &1f6b 88 DEY &1f6c 10 fb BPL &1f69 ; wipe_column_loop &1f6e 60 RTS ; apply_random_masked_noise &1f6f 85 00 STA &00 ; sprite_byte &1f71 a9 00 LDA #&00 &1f73 85 01 STA &01 ; pixel_colour_one &1f75 85 02 STA &02 ; pixel_colour_two &1f77 98 TYA &1f78 48 PHA ; tmp_y &1f79 a2 03 LDX #&03 ; apply_random_masked_noise_loop # For each pixel in the byte, &1f7b 20 31 1b JSR &1b31 ; rnd &1f7e c5 09 CMP &09 ; probability &1f80 b0 02 BCS &1f84 ; set_pixel_colour # Is rnd > probability of appearing &1f82 a9 00 LDA #&00 # If not, use background colour ; set_pixel_colour &1f84 85 03 STA &03 ; pixel_colour # otherwise use random colour &1f86 a5 00 LDA &00 ; sprite_byte &1f88 3d 2d 1b AND &1b2d,X ; colour_3_pixel_values &1f8b d0 02 BNE &1f8f ; not_background # Is the pixel set in the sprite? &1f8d 85 03 STA &03 ; pixel_colour # If not, use background colour ; not_background &1f8f a5 03 LDA &03 ; pixel_colour # Use low two bits of pixel colour &1f91 4a LSR A &1f92 26 01 ROL &01 ; pixel_colour_one &1f94 4a LSR A &1f95 26 02 ROL &02 ; pixel_colour_two &1f97 ca DEX &1f98 10 e1 BPL &1f7b ; apply_random_masked_noise_loop &1f9a 68 PLA ; tmp_y &1f9b a8 TAY &1f9c a5 01 LDA &01 ; pixel_colour_one # to determine pixel value &1f9e 0a ASL A &1f9f 0a ASL A &1fa0 0a ASL A &1fa1 0a ASL A &1fa2 05 02 ORA &02 ; pixel_colour_two &1fa4 60 RTS # Leave with pixel value ; materialise_player &1fa5 a9 00 LDA #&00 &1fa7 20 d7 12 JSR &12d7 ; play_background_noise # Start background noise at full volume &1faa a2 fc LDX #&fc ; materialise_player_frame_loop &1fac 86 09 STX &09 ; probability &1fae a9 0a LDA #&0a &1fb0 85 14 STA &14 ; channels_volume_cooldown &1fb2 a6 09 LDX &09 ; probability &1fb4 a0 00 LDY #&00 &1fb6 a9 01 LDA #&01 # Use channel 1 &1fb8 20 6e 06 JSR &066e ; play_sound # to set frequency of background noise ; v vd vc vs pd pc ps &1fbb 0f 00 00 00 04 00 01 64 &1fc3 a0 01 LDY #&01 &1fc5 20 15 0c JSR &0c15 ; wait_for_Y_while_checking_keys ; wait_for_plot &1fc8 24 bf BIT &bf ; palette_section &1fca 30 fc BMI &1fc8 ; wait_for_plot ; materialise_player_byte_loop &1fcc a0 1f LDY #&1f &1fce b9 c0 5d LDA &5dc0,Y ; sprite_5f (SPRITE_PLAYER_RIGHT) &1fd1 a6 09 LDX &09 ; probability &1fd3 d0 01 BNE &1fd6 ; not_zero &1fd5 8a TXA ; 0 ; not_zero &1fd6 20 6f 1f JSR &1f6f ; apply_random_masked_noise &1fd9 59 00 6f EOR &6f00,Y ; &6000 + &200 * 7 + &100 # Use row above player as background &1fdc 99 00 73 STA &7300,Y ; &6000 + &200 * 9 + &100 # Plot top of materialising player &1fdf b9 e0 5d LDA &5de0,Y ; sprite_5f (SPRITE_PLAYER_RIGHT) + &20 &1fe2 a6 09 LDX &09 ; probability &1fe4 d0 01 BNE &1fe7 ; not_zero &1fe6 8a TXA ; 0 ; not_zero &1fe7 20 6f 1f JSR &1f6f ; apply_random_masked_noise &1fea 59 00 71 EOR &7100,Y ; &6000 + &200 * 8 + &100 # Use row above player as background &1fed 99 00 75 STA &7500,Y ; &6000 + &200 * 10 + &100 # Plot bottom of materialising player &1ff0 88 DEY &1ff1 10 db BPL &1fce ; materialise_player_byte_loop &1ff3 20 1f 0c JSR &0c1f ; check_for_escape_and_cursor_down_and_up &1ff6 a5 09 LDA &09 ; probability &1ff8 38 SEC &1ff9 e9 04 SBC #&04 &1ffb aa TAX &1ffc e0 fc CPX #&fc &1ffe d0 ac BNE &1fac ; materialise_player_frame_loop &2000 4c 42 1a JMP &1a42 ; plot_player ; play_prepare_for_battle_sound &2003 85 02 STA &02 ; maximum_frequency_high &2005 78 SEI &2006 a9 0b LDA #&0b # Enable keyboard auto scan &2008 8d 40 fe STA &fe40 ; System VIA port B input/output register &200b a9 ff LDA #&ff # Set all bits to output &200d 8d 43 fe STA &fe43 ; System VIA data direction register A &2010 a9 00 LDA #&00 &2012 85 00 STA &00 ; frequency_low &2014 85 01 STA &01 ; frequency_high &2016 a9 00 LDA #&00 &2018 24 e2 BIT &e2 ; sound_muted # Negative if sound muted &201a 10 02 BPL &201e ; set_volume &201c a9 0f LDA #&0f # Silence if muted ; set_volume &201e 85 0a STA &0a ; volume ; play_prepare_for_battle_sound_loop &2020 a9 80 LDA #&80 ; channel 3 frequency &2022 05 00 ORA &00 ; frequency_low &2024 20 27 06 JSR &0627 ; write_byte_to_sound_chip &2027 a5 01 LDA &01 ; frequency_high &2029 20 27 06 JSR &0627 ; write_byte_to_sound_chip &202c a9 90 LDA #&90 ; channel 3 volume &202e 05 0a ORA &0a ; volume &2030 20 27 06 JSR &0627 ; write_byte_to_sound_chip &2033 a9 a0 LDA #&a0 ; channel 2 frequency &2035 05 00 ORA &00 ; frequency_low &2037 20 27 06 JSR &0627 ; write_byte_to_sound_chip &203a a5 01 LDA &01 ; frequency_high &203c 20 27 06 JSR &0627 ; write_byte_to_sound_chip &203f a9 b0 LDA #&b0 ; channel 2 volume &2041 05 0a ORA &0a ; volume &2043 20 27 06 JSR &0627 ; write_byte_to_sound_chip &2046 a9 c0 LDA #&c0 ; channel 1 frequency &2048 05 00 ORA &00 ; frequency_low &204a 20 27 06 JSR &0627 ; write_byte_to_sound_chip &204d a5 01 LDA &01 ; frequency_high &204f 20 27 06 JSR &0627 ; write_byte_to_sound_chip &2052 a9 d0 LDA #&d0 ; channel 1 volume &2054 05 0a ORA &0a ; volume &2056 20 27 06 JSR &0627 ; write_byte_to_sound_chip &2059 e6 00 INC &00 ; frequency_low &205b a5 00 LDA &00 ; frequency_low &205d c9 10 CMP #&10 &205f d0 bf BNE &2020 ; play_prepare_for_battle_sound_loop &2061 a9 00 LDA #&00 &2063 85 00 STA &00 ; frequency_low &2065 e6 01 INC &01 ; frequency_high &2067 a5 01 LDA &01 ; frequency_high &2069 c5 02 CMP &02 ; maximum_frequency_high &206b d0 b3 BNE &2020 ; play_prepare_for_battle_sound_loop &206d a9 00 LDA #&00 &206f 85 01 STA &01 ; frequency_high &2071 88 DEY &2072 10 ac BPL &2020 ; play_prepare_for_battle_sound_loop &2074 a9 7f LDA #&7f # Set top bit as input, low seven bits as output &2076 8d 43 fe STA &fe43 ; System VIA data direction register A &2079 a9 03 LDA #&03 # Disable keyboard auto scan &207b 8d 40 fe STA &fe40 ; System VIA port B input/output register &207e 58 CLI &207f 4c 3a 06 JMP &063a ; initialise_sound ; update_enemy &2082 a5 ca LDA &ca ; enemy_type_and_flags &2084 29 07 AND #&07 ; ENEMY_FLAG_TYPE_MASK &2086 4a LSR A &2087 85 ce STA &ce ; enemy_type &2089 a5 ca LDA &ca ; enemy_type_and_flags &208b 29 08 AND #&08 ; ENEMY_FLAG_MOVING_RIGHT &208d f0 15 BEQ &20a4 ; move_enemy_left ; move_enemy_right &208f bd 58 01 LDA &0158,X ; enemies_x_fraction &2092 18 CLC &2093 69 01 ADC #&01 &2095 c9 04 CMP #&04 &2097 90 05 BCC &209e ; skip_overflow &2099 fe 5b 01 INC &015b,X ; enemies_x &209c 29 03 AND #&03 ; skip_overflow &209e 9d 58 01 STA &0158,X ; enemies_x_fraction &20a1 4c b4 20 JMP &20b4 ; consider_moving_enemy_vertically ; move_enemy_left &20a4 bd 58 01 LDA &0158,X ; enemies_x_fraction &20a7 38 SEC &20a8 e9 01 SBC #&01 &20aa 10 05 BPL &20b1 ; skip_underflow &20ac de 5b 01 DEC &015b,X ; enemies_x &20af 29 03 AND #&03 &20b1 9d 58 01 STA &0158,X ; enemies_x_fraction ; skip_underflow ; consider_moving_enemy_vertically &20b4 a5 ca LDA &ca ; enemy_type_and_flags &20b6 29 30 AND #&30 ; ENEMY_FLAG_MOVING_DOWN | ENEMY_FLAG_MOVING_UP &20b8 f0 2b BEQ &20e5 ; skip_moving_enemy_vertically &20ba 85 00 STA &00 ; vertical_direction &20bc 29 10 AND #&10 ; ENEMY_FLAG_MOVING_DOWN &20be d0 0d BNE &20cd ; move_enemy_down ; move_enemy_up &20c0 bd 5e 01 LDA &015e,X ; enemies_y &20c3 f0 17 BEQ &20dc ; flip_enemy_vertical_direction # Bounce enemy off top of screen &20c5 38 SEC &20c6 e9 02 SBC #&02 &20c8 9d 5e 01 STA &015e,X ; enemies_y &20cb 10 18 BPL &20e5 ; skip_moving_enemy_vertically # Always branches ; move_enemy_down &20cd bd 5e 01 LDA &015e,X ; enemies_y &20d0 c9 5f CMP #&5f &20d2 b0 08 BCS &20dc ; flip_enemy_vertical_direction # Bounce enemy off bottom of screen &20d4 18 CLC &20d5 69 02 ADC #&02 &20d7 9d 5e 01 STA &015e,X ; enemies_y &20da 10 09 BPL &20e5 ; skip_moving_enemy_vertically # Always branches ; flip_enemy_vertical_direction &20dc a5 ca LDA &ca ; enemy_type_and_flags &20de 09 30 ORA #&30 ; ENEMY_FLAG_MOVING_DOWN | ENEMY_FLAG_MOVING_UP &20e0 45 00 EOR &00 ; vertical_direction # Flip vertical direction &20e2 9d 61 01 STA &0161,X ; enemies_type_and_flags ; skip_moving_enemy_vertically &20e5 a5 ce LDA &ce ; enemy_type &20e7 c9 02 CMP #&02 ; ENEMY_TYPE_TWO &20e9 d0 19 BNE &2104 ; skip_changing_direction &20eb 20 31 1b JSR &1b31 ; rnd &20ee 29 1f AND #&1f # 1 in 32 chance of type two enemies changing direction &20f0 d0 12 BNE &2104 ; skip_changing_direction &20f2 20 31 1b JSR &1b31 ; rnd &20f5 29 08 AND #&08 ; ENEMY_FLAG_MOVING_RIGHT # Set random horizontal direction &20f7 85 03 STA &03 ; horizontal_direction &20f9 a5 ca LDA &ca ; enemy_type_and_flags &20fb 09 30 ORA #&30 ; ENEMY_FLAG_MOVING_DOWN | ENEMY_FLAG_MOVING_UP &20fd 45 00 EOR &00 ; vertical_direction # Flip vertical direction &20ff 45 03 EOR &03 ; horizontal_direction &2101 9d 61 01 STA &0161,X ; enemies_type_and_flags ; skip_changing_direction &2104 a5 ce LDA &ce ; enemy_type &2106 c9 03 CMP #&03 ; ENEMY_TYPE_THREE &2108 f0 01 BEQ &210b ; move_enemy_towards_player # Type three enemies move towards player &210a 60 RTS ; move_enemy_towards_player &210b a0 10 LDY #&10 ; ENEMY_FLAG_MOVING_DOWN &210d bd 5e 01 LDA &015e,X ; enemies_y &2110 c5 97 CMP &97 ; player_y &2112 d0 04 BNE &2118 ; not_vertically_aligned_with_player &2114 a0 30 LDY #&30 ; ENEMY_FLAG_MOVING_DOWN | ENEMY_FLAG_MOVING_UP &2116 d0 04 BNE &211c ; set_vertical_direction # Always branches ; not_vertically_aligned_with_player &2118 b0 02 BCS &211c ; set_vertical_direction &211a a0 20 LDY #&20 ; ENEMY_FLAG_MOVING_UP ; set_vertical_direction &211c 84 03 STY &03 ; vertical_direction &211e a0 00 LDY #&00 &2120 bd 5b 01 LDA &015b,X ; enemies_x &2123 c5 98 CMP &98 ; player_x &2125 90 02 BCC &2129 ; set_horizontal_direction &2127 a0 08 LDY #&08 ; ENEMY_FLAG_MOVING_RIGHT ; set_horizontal_direction &2129 84 04 STY &04 ; horizontal_direction &212b a5 ca LDA &ca ; enemy_type_and_flags &212d 09 38 ORA #&38 ; ENEMY_FLAG_MOVING_DOWN | ENEMY_FLAG_MOVING_UP | ENEMY_FLAG_MOVING_DOWN | ENEMY_FLAG_MOVING_RIGHT &212f 45 03 EOR &03 ; vertical_direction &2131 45 04 EOR &04 ; horizontal_direction &2133 9d 61 01 STA &0161,X ; enemies_type_and_flags &2136 60 RTS ; remove_enemies_and_unplot_missiles &2137 a2 02 LDX #&02 ; remove_enemies_loop &2139 20 51 21 JSR &2151 ; remove_enemy &213c ca DEX &213d 10 fa BPL &2139 ; remove_enemies_loop &213f a2 07 LDX #&07 ; unplot_missiles_loop &2141 bd 30 01 LDA &0130,X ; missiles_screen_address_high # Zero if no missile in slot &2144 f0 07 BEQ &214d ; consider_next_missile &2146 8a TXA &2147 48 PHA ; missile &2148 20 cd 17 JSR &17cd ; plot_or_unplot_missile &214b 68 PLA ; missile &214c aa TAX ; consider_next_missile &214d ca DEX &214e 10 f1 BPL &2141 ; unplot_missiles_loop &2150 60 RTS ; remove_enemy &2151 bd 61 01 LDA &0161,X ; enemies_type_and_flags # Zero if no enemy in slot &2154 f0 11 BEQ &2167 ; leave &2156 85 ca STA &ca ; enemy_type_and_flags &2158 20 68 21 JSR &2168 ; calculate_screen_edges_for_x_comparisons &215b a5 a9 LDA &a9 ; player_direction &215d 85 cd STA &cd ; player_direction_for_x_comparisons &215f 20 73 22 JSR &2273 ; plot_or_unplot_enemy &2162 a9 00 LDA #&00 &2164 9d 61 01 STA &0161,X ; enemies_type_and_flags # Set to zero to indicate no missile in slot ; leave &2167 60 RTS ; calculate_screen_edges_for_x_comparisons &2168 a4 a4 LDY &a4 ; screen_left_x &216a c8 INY &216b 84 cb STY &cb ; screen_left_for_x_comparisons &216d 98 TYA &216e 18 CLC &216f 69 0e ADC #&0e &2171 85 cc STA &cc ; screen_right_for_x_comparisons &2173 a9 00 LDA #&00 &2175 90 02 BCC &2179 ; skip_inversion &2177 a9 80 LDA #&80 # Allow comparison around edges of level ; skip_inversion &2179 85 cf STA &cf ; sign_for_x_comparisons &217b 45 cb EOR &cb ; screen_left_for_x_comparisons &217d 85 cb STA &cb ; screen_left_for_x_comparisons &217f a5 cc LDA &cc ; screen_right_for_x_comparisons &2181 45 cf EOR &cf ; sign_for_x_comparisons &2183 85 cc STA &cc ; screen_right_for_x_comparisons &2185 60 RTS ; update_enemies &2186 20 68 21 JSR &2168 ; calculate_screen_edges_for_x_comparisons &2189 a9 e4 LDA #&e4 ; wait_to_plot &218b 24 bf BIT &bf ; palette_section # Negative if in top section &218d 30 fc BMI &218b ; wait_to_plot &218f cd 49 fe CMP &fe49 ; System VIA timer 2 counter MSB &2192 90 f7 BCC &218b ; wait_to_plot &2194 a2 02 LDX #&02 ; update_enemies_loop &2196 bd 61 01 LDA &0161,X ; enemies_type_and_flags # Zero if no enemy in slot &2199 f0 1a BEQ &21b5 ; consider_next_enemy &219b 85 ca STA &ca ; enemy_type_and_flags &219d a5 a9 LDA &a9 ; player_direction &219f 85 cd STA &cd ; player_direction_for_x_comparisons &21a1 20 73 22 JSR &2273 ; plot_or_unplot_enemy # Unplot enemy &21a4 20 82 20 JSR &2082 ; update_enemy &21a7 a5 cd LDA &cd ; player_direction_for_x_comparisons &21a9 49 ff EOR #&ff &21ab 85 cd STA &cd ; player_direction_for_x_comparisons &21ad 20 73 22 JSR &2273 ; plot_or_unplot_enemy # Plot enemy; returns carry set if enemy is off screen &21b0 b0 03 BCS &21b5 ; consider_next_enemy &21b2 20 26 22 JSR &2226 ; consider_firing_enemy_missile ; consider_next_enemy &21b5 ca DEX &21b6 10 de BPL &2196 ; update_enemies_loop ; consider_adding_new_enemy &21b8 20 31 1b JSR &1b31 ; rnd &21bb c5 d0 CMP &d0 ; probability_of_adding_enemy &21bd 90 01 BCC &21c0 ; add_new_enemy &21bf 60 RTS ; add_new_enemy &21c0 a2 02 LDX #&02 ; find_free_slot_loop &21c2 bd 61 01 LDA &0161,X ; enemies_type_and_flags # Zero if no enemy in slot &21c5 f0 04 BEQ &21cb ; found_free_slot &21c7 ca DEX &21c8 10 f8 BPL &21c2 ; find_free_slot_loop &21ca 60 RTS ; found_free_slot ; get_random_enemy_type &21cb 20 31 1b JSR &1b31 ; rnd &21ce 29 07 AND #&07 ; ENEMY_TYPE_MASK &21d0 85 00 STA &00 ; enemy_type &21d2 4a LSR A &21d3 c5 95 CMP &95 ; level # Each level introduces a new type of enemy behaviour &21d5 f0 02 BEQ &21d9 ; get_enemy_direction # corresponding to two enemy sprites &21d7 b0 f2 BCS &21cb ; get_random_enemy_type ; get_enemy_direction &21d9 a9 00 LDA #&00 # Zero to indicate enemy is not moving vertically &21db a4 00 LDY &00 ; enemy_type &21dd c0 02 CPY #&02 ; ENEMY_TYPE_TWO &21df 90 0b BCC &21ec ; set_enemy_vertical_direction &21e1 20 31 1b JSR &1b31 ; rnd &21e4 29 01 AND #&01 &21e6 69 00 ADC #&00 &21e8 0a ASL A # &10 = ENEMY_FLAG_MOVING_DOWN &21e9 0a ASL A # &20 = ENEMY_FLAG_MOVING_UP &21ea 0a ASL A &21eb 0a ASL A ; set_enemy_vertical_direction &21ec 85 02 STA &02 ; enemy_vertical_direction &21ee a5 a9 LDA &a9 ; player_direction &21f0 30 06 BMI &21f8 ; is_moving_right ; is_moving_left &21f2 a0 10 LDY #&10 &21f4 a9 00 LDA #&00 # Zero to indicate enemy is moving left &21f6 f0 04 BEQ &21fc ; set_enemy_offset # Always branches ; is_moving_right &21f8 a0 f0 LDY #&f0 &21fa a9 08 LDA #&08 ; ENEMY_FLAG_MOVING_RIGHT ; set_enemy_offset &21fc 84 01 STY &01 ; enemy_x_offset_from_player &21fe 05 00 ORA &00 ; enemy_type &2200 05 02 ORA &02 ; enemy_vertical_direction &2202 09 80 ORA #&80 ; ENEMY_FLAG_PRESENT # Set to non-zero to indicate enemy in slot &2204 9d 61 01 STA &0161,X ; enemies_type_and_flags &2207 a5 96 LDA &96 ; player_x_fraction &2209 9d 58 01 STA &0158,X ; enemies_x_fraction &220c a5 98 LDA &98 ; player_x &220e 18 CLC &220f 65 01 ADC &01 ; enemy_x_offset_from_player &2211 9d 5b 01 STA &015b,X ; enemies_x ; get_random_y &2214 20 31 1b JSR &1b31 ; rnd &2217 29 fe AND #&fe &2219 c9 5f CMP #&5f &221b b0 f7 BCS &2214 ; get_random_y &221d 9d 5e 01 STA &015e,X ; enemies_y &2220 a9 78 LDA #&78 # Enemies linger for 120 frames if not on screen &2222 9d 64 01 STA &0164,X ; enemies_ttl_if_offscreen &2225 60 RTS ; consider_firing_enemy_missile &2226 a5 b1 LDA &b1 ; number_of_enemy_missiles_present &2228 c9 04 CMP #&04 &222a d0 01 BNE &222d ; not_too_many_missiles # Can't fire if too many enemy missiles present &222c 60 RTS ; not_too_many_missiles &222d 20 31 1b JSR &1b31 ; rnd &2230 29 1f AND #&1f # 1 in 32 chance of enemies firing &2232 f0 01 BEQ &2235 ; fire_enemy_missile &2234 60 RTS ; fire_enemy_missile &2235 e6 b1 INC &b1 ; number_of_enemy_missiles_present &2237 bd 5b 01 LDA &015b,X ; enemies_x &223a 85 0a STA &0a ; sprite_x &223c 45 cf EOR &cf ; sign_for_x_comparisons &223e 85 0f STA &0f ; enemy_x_for_x_comparisons &2240 bd 58 01 LDA &0158,X ; enemies_x_fraction &2243 85 0b STA &0b ; sprite_x_fraction &2245 bd 5e 01 LDA &015e,X ; enemies_y &2248 85 0c STA &0c ; sprite_y &224a a9 00 LDA #&00 # Positive to indicate enemy missile &224c 85 0d STA &0d ; missile_type &224e a0 01 LDY #&01 &2250 a5 98 LDA &98 ; player_x &2252 45 cf EOR &cf ; sign_for_x_comparisons &2254 c5 0f CMP &0f ; enemy_x_for_x_comparisons &2256 b0 02 BCS &225a ; set_missile_direction # Enemies fire towards player &2258 a0 ff LDY #&ff ; set_missile_direction &225a 8a TXA &225b 48 PHA ; enemy &225c 20 87 17 JSR &1787 ; add_missile &225f a9 02 LDA #&02 # Use channel 2 &2261 a2 64 LDX #&64 &2263 a0 00 LDY #&00 &2265 20 6e 06 JSR &066e ; play_sound # Play sound for enemy firing missile ; v vd vc vs pd pc ps &2268 00 00 00 00 05 00 01 08 &2270 68 PLA ; enemy &2271 aa TAX &2272 60 RTS ; plot_or_unplot_enemy &2273 8a TXA &2274 48 PHA ; enemy_to_plot_or_unplot &2275 bd 58 01 LDA &0158,X ; enemies_x_fraction &2278 85 0b STA &0b ; sprite_x_fraction &227a bd 5e 01 LDA &015e,X ; enemies_y &227d 85 0c STA &0c ; sprite_y &227f bd 5b 01 LDA &015b,X ; enemies_x &2282 85 0a STA &0a ; sprite_x &2284 a5 ca LDA &ca ; enemy_type_and_flags &2286 29 07 AND #&07 ; ENEMY_TYPE_MASK &2288 18 CLC &2289 69 47 ADC #&47 ; SPRITE_ENEMY_ZERO &228b 85 0e STA &0e ; sprite &228d a5 0a LDA &0a ; sprite_x &228f 45 cf EOR &cf ; sign_for_x_comparisons &2291 c5 cb CMP &cb ; screen_left_for_x_comparisons &2293 90 37 BCC &22cc ; is_not_on_screen &2295 d0 08 BNE &229f ; check_right_edge &2297 a5 0b LDA &0b ; sprite_x_fraction &2299 c5 a5 CMP &a5 ; screen_left_x_fraction &229b f0 2b BEQ &22c8 ; check_left_edge &229d 90 2d BCC &22cc ; is_not_on_screen ; check_right &229f a5 0a LDA &0a ; sprite_x &22a1 45 cf EOR &cf ; sign_for_x_comparisons &22a3 c5 cc CMP &cc ; screen_right_for_x_comparisons &22a5 90 0c BCC &22b3 ; is_on_screen &22a7 f0 02 BEQ &22ab ; check_x_fraction &22a9 b0 21 BCS &22cc ; is_not_on_screen ; check_x_fraction &22ab a5 0b LDA &0b ; sprite_x_fraction &22ad c5 a5 CMP &a5 ; screen_left_x_fraction &22af f0 11 BEQ &22c2 ; check_right_edge &22b1 b0 19 BCS &22cc ; is_not_on_screen ; is_on_screen &22b3 20 6c 19 JSR &196c ; calculate_sprite_screen_address &22b6 20 55 1a JSR &1a55 ; plot_sprite &22b9 68 PLA ; enemy_to_plot_or_unplot &22ba aa TAX &22bb a9 78 LDA #&78 # Enemies linger for 120 frames if not on screen &22bd 9d 64 01 STA &0164,X ; enemies_ttl_if_offscreen &22c0 18 CLC # Leave with carry clear to indicate enemy on screen &22c1 60 RTS ; check_right_edge &22c2 a5 cd LDA &cd ; player_direction_for_x_comparisons &22c4 30 ed BMI &22b3 ; is_on_screen &22c6 10 04 BPL &22cc ; is_not_on_screen # Always branches ; check_left_edge &22c8 a5 cd LDA &cd ; player_direction_for_x_comparisons &22ca 10 e7 BPL &22b3 ; is_on_screen ; is_not_on_screen &22cc 68 PLA ; enemy_to_plot_or_unplot &22cd aa TAX &22ce de 64 01 DEC &0164,X ; enemies_ttl_if_offscreen &22d1 10 05 BPL &22d8 ; leave_with_carry_set &22d3 a9 00 LDA #&00 &22d5 9d 61 01 STA &0161,X ; enemies_type_and_flags # Set to zero to indicate no enemy in slot ; leave_with_carry_set &22d8 38 SEC # Leave with carry set to indicate enemy not on screen &22d9 60 RTS ; font_data &22da 00 00 00 00 00 00 00 00 ; "%" # Used as buffer for double size characters &22e2 3e 77 77 7f 77 77 77 00 ; "A" &22ea 7e 77 77 7e 77 77 7e 00 ; "B" &22f2 3e 77 70 70 70 77 3e 00 ; "C" &22fa 7c 7e 77 77 77 7e 7c 00 ; "D" &2302 7f 70 70 7e 70 70 7f 00 ; "E" &230a 7f 70 70 7e 70 70 70 00 ; "F" &2312 3e 77 70 77 73 73 3e 00 ; "G" &231a 77 77 77 7f 77 77 77 00 ; "H" &2322 7f 1c 1c 1c 1c 1c 7f 00 ; "I" &232a 3f 0e 0e 0e 0e 6e 3c 00 ; "J" &2332 77 7e 7c 78 7c 7e 77 00 ; "K" &233a 70 70 70 70 70 70 7f 00 ; "L" &2342 63 77 7f 7f 6b 6b 63 00 ; "M" &234a 73 73 7b 7f 77 73 73 00 ; "N" &2352 3e 77 77 77 77 77 3e 00 ; "O" &235a 7e 77 77 7e 70 70 70 00 ; "P" &2362 3e 77 77 73 75 76 3b 00 ; "Q" &236a 7e 77 77 7e 76 77 77 00 ; "R" &2372 3e 77 70 3e 07 77 3e 00 ; "S" &237a 7f 1c 1c 1c 1c 1c 1c 00 ; "T" &2382 77 77 77 77 77 77 3e 00 ; "U" &238a 77 77 77 77 77 3e 1c 00 ; "V" &2392 63 6b 6b 7f 7f 77 63 00 ; "W" &239a 77 77 3e 1c 3e 77 77 00 ; "X" &23a2 77 77 77 3e 1c 1c 1c 00 ; "Y" &23aa 7f 07 0e 1c 38 70 7f 00 ; "Z" &23b2 38 38 38 38 00 38 38 00 ; "!" &23ba 00 56 58 3e 7c 1a 6a 00 ; "*" &23c2 18 3c 7e ff 18 18 3c 7e ; "^" &23ca ff ff 00 00 00 00 00 00 ; "_" &23d2 00 00 00 fe fe 00 00 00 ; "-" &23da 7e c3 db df db c3 7e 00 ; "$" (actually "(c)") &23e2 7c ee ee ee ee ee 7c 00 ; "0" &23ea 3c 7c 1c 1c 1c 1c 7e 00 ; "1" &23f2 7c ee 1c 38 70 e6 fe 00 ; "2" &23fa 7c ee 0e 3c 0e ee 7c 00 ; "3" &2402 3e 7e ee ee fe 0e 0e 00 ; "4" &240a fe e0 fc 0e 0e ee 7c 00 ; "5" &2412 7c ee e0 fc ee ee 7c 00 ; "6" &241a fe ee 0e 0e 1c 38 70 00 ; "7" &2422 7c ee ee 7c ee ee 7c 00 ; "8" &242a 7c ee ee 7e 0e ee 7c 00 ; "9" &2432 00 00 00 00 00 18 18 00 ; "." &243a 00 00 00 00 00 00 00 00 ; " " &2442 00 00 00 00 00 18 18 30 ; "," &244a 18 18 30 00 00 00 00 00 ; "'" ; number_sprites &2452 77 ee ee ee ee ee 77 00 cc ee ee ee ee ee cc 00 ; "0" &2462 33 77 11 11 11 11 77 00 cc cc cc cc cc cc ee 00 ; "1" &2472 77 ee 11 33 77 ee ff 00 cc ee cc 88 00 66 ee 00 ; "2" &2482 77 ee 00 33 00 ee 77 00 cc ee ee cc ee ee cc 00 ; "3" &2492 33 77 ee ee ff 00 00 00 ee ee ee ee ee ee ee 00 ; "4" &24a2 ff ee ff 00 00 ee 77 00 ee 00 cc ee ee ee cc 00 ; "5" &24b2 77 ee ee ff ee ee 77 00 cc ee 00 cc ee ee cc 00 ; "6" &24c2 ff ee 00 00 11 33 77 00 ee ee ee ee cc 88 00 00 ; "7" &24d2 77 ee ee 77 ee ee 77 00 cc ee ee cc ee ee cc 00 ; "8" &24e2 77 ee ee 77 00 ee 77 00 cc ee ee ee ee ee cc 00 ; "9" ; demo_sprites &24f2 77 77 77 77 77 77 77 00 cc ee 77 77 77 ee cc 00 ; "D" &2502 77 77 77 77 77 77 77 00 ff 00 00 ee 00 00 ff 00 ; "E" &2512 66 77 77 77 66 66 66 00 33 77 ff ff bb bb 33 00 ; "M" &2522 33 77 77 77 77 77 33 00 ee 77 77 77 77 77 ee 00 ; "O" ; tile_properties_table # 8....... set if tile can be destroyed ; 0 1 2 3 4 5 6 7 8 9 a b c d e f # .421.... destroyed tile type &2532 00 00 00 00 00 00 00 00 00 8f 00 00 00 00 00 00 ; &00 # ....8... collision in top left of tile &2542 00 00 00 00 0f 03 00 00 00 00 00 0f 8f 03 00 00 ; &10 # .....4.. collision in top right of tile &2552 00 00 af bf c9 d9 0f 03 03 03 9f 0f 0f 0f 00 00 ; &20 # ......2. collision in bottom left of tile &2562 00 00 00 7f 00 0f 00 00 03 00 00 00 00 ef 00 00 ; &30 # .......1 collision in bottom right of tile &2572 8f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; &40 &2582 00 00 00 00 00 00 0f 00 00 00 00 00 00 00 00 00 ; &50 &2592 00 0f 0e 0d 07 0b 0f 0f ; &60 ; tune_data &259a f1 26 &259c f1 26 &259e f1 26 &25a0 f1 26 &25a2 f1 26 &25a4 f1 26 &25a6 f1 26 &25a8 f1 26 &25aa f1 26 &25ac f3 26 &25ae 36 46 &25b0 77 46 &25b2 d6 46 &25b4 73 46 &25b6 31 46 &25b8 e5 26 &25ba 47 21 &25bc ca 21 &25be 07 41 &25c0 65 41 &25c2 01 41 &25c4 c1 21 &25c6 41 21 &25c8 26 01 &25ca 47 21 &25cc ea 21 &25ce 07 41 &25d0 66 41 &25d2 01 41 &25d4 e1 21 &25d6 41 21 &25d8 2b 01 &25da 72 22 &25dc 0b 42 &25de 72 22 &25e0 0b 42 &25e2 73 22 &25e4 33 42 &25e6 2b 42 &25e8 73 22 &25ea 32 42 &25ec 0b 42 &25ee 72 22 &25f0 0b 42 &25f2 73 22 &25f4 2b 42 &25f6 73 22 &25f8 2d 42 &25fa b2 24 &25fc 0d 44 &25fe b2 24 &2600 0d 44 &2602 b2 24 &2604 32 44 &2606 2d 44 &2608 b2 24 &260a 32 44 &260c 0d 44 &260e b2 24 &2610 0d 44 &2612 b2 24 &2614 2d 44 &2616 b2 24 &2618 2a 44 &261a 52 26 &261c 0a 46 &261e 52 26 &2620 0a 46 &2622 53 26 &2624 33 46 &2626 2a 46 &2628 53 26 &262a 32 46 &262c 0a 46 &262e 52 26 &2630 0a 46 &2632 53 26 &2634 2a 46 &2636 53 26 &2638 25 46 &263a 47 21 &263c ca 21 &263e 07 41 &2640 65 41 &2642 01 41 &2644 c1 21 &2646 41 21 &2648 26 01 &264a 47 21 &264c ea 21 &264e 07 41 &2650 66 41 &2652 01 41 &2654 e1 21 &2656 41 21 &2658 2b 01 &265a 72 22 &265c 0b 42 &265e 72 22 &2660 0b 42 &2662 73 22 &2664 33 42 &2666 2b 42 &2668 73 22 &266a 32 42 &266c 0b 42 &266e 72 22 &2670 0b 42 &2672 73 22 &2674 2b 42 &2676 73 22 &2678 2c 42 &267a 92 23 &267c 0c 43 &267e 92 23 &2680 0c 43 &2682 93 23 &2684 33 43 &2686 2c 43 &2688 93 23 &268a 32 43 &268c 0c 43 &268e 92 23 &2690 0c 43 &2692 93 23 &2694 2c 43 &2696 93 23 &2698 2a 43 &269a 52 24 &269c 0a 44 &269e 52 24 &26a0 0a 44 &26a2 53 24 &26a4 33 44 &26a6 2a 44 &26a8 53 24 &26aa 32 44 &26ac 0a 44 &26ae 52 24 &26b0 0a 44 &26b2 53 24 &26b4 2a 44 &26b6 53 24 &26b8 2a 44 &26ba 52 25 &26bc 0a 45 &26be 52 25 &26c0 0a 45 &26c2 53 25 &26c4 33 45 &26c6 2a 45 &26c8 53 25 &26ca 32 45 &26cc 0a 45 &26ce 52 25 &26d0 0a 45 &26d2 53 25 &26d4 2a 45 &26d6 53 25 &26d8 2a 45 &26da 52 26 &26dc 0a 46 &26de 52 26 &26e0 0a 46 &26e2 53 26 &26e4 33 46 &26e6 2a 46 &26e8 53 26 &26ea 32 46 &26ec 0a 46 &26ee 52 26 &26f0 0a 46 &26f2 53 26 &26f4 2a 46 &26f6 53 26 &26f8 30 46 &26fa 11 4d &26fc 12 4d &26fe 32 44 &2700 30 44 &2702 4d 4d &2704 10 4d &2706 ab 24 &2708 0f 44 &270a 71 2b &270c f4 2b &270e 31 42 &2710 8f 42 &2712 2b 4b &2714 ef 2b &2716 6f 22 &2718 f0 22 &271a 10 4d &271c 11 4d &271e 32 44 &2720 53 44 &2722 73 4d &2724 72 4d &2726 52 44 &2728 4d 44 &272a 09 4d &272c ad 2d &272e 30 24 &2730 b0 24 &2732 b2 2d &2734 15 4d &2736 55 44 &2738 b1 44 &273a 31 51 &273c 32 51 &273e 53 48 &2740 74 48 &2742 94 51 &2744 91 51 &2746 71 48 &2748 6d 48 &274a 2a 51 &274c ad 31 &274e 51 28 &2750 b1 28 &2752 b3 31 &2754 33 51 &2756 73 48 &2758 6a 48 &275a 4a 31 &275c 4d 31 &275e ad 28 &2760 b3 28 &2762 33 51 &2764 31 51 &2766 71 48 &2768 6d 48 &276a 2a 51 &276c ad 31 &276e 51 28 &2770 b1 28 &2772 b3 31 &2774 33 51 &2776 73 48 &2778 70 48 &277a 11 4d &277c 12 4d &277e 32 44 &2780 30 44 &2782 4d 4d &2784 10 4d &2786 ab 24 &2788 0f 44 &278a 71 2b &278c f4 2b &278e 31 42 &2790 8f 42 &2792 2b 4b &2794 ef 2b &2796 6f 22 &2798 f0 22 &279a 10 4d &279c 11 4d &279e 32 44 &27a0 53 44 &27a2 73 4d &27a4 72 4d &27a6 52 44 &27a8 4d 44 &27aa 09 4d &27ac ad 2d &27ae 30 24 &27b0 b0 24 &27b2 b2 2d &27b4 12 4d &27b6 52 44 &27b8 51 44 &27ba 31 51 &27bc 32 51 &27be 53 48 &27c0 74 48 &27c2 94 51 &27c4 91 51 &27c6 71 48 &27c8 6d 48 &27ca 2a 51 &27cc ad 31 &27ce 51 28 &27d0 b1 28 &27d2 b3 31 &27d4 33 51 &27d6 73 48 &27d8 6a 48 &27da 52 2d &27dc 0a 4d &27de 52 2a &27e0 0a 4a &27e2 53 2f &27e4 33 4f &27e6 2a 46 &27e8 53 26 &27ea 32 4d &27ec 0a 4d &27ee 52 2a &27f0 0a 4a &27f2 53 2f &27f4 2a 4f &27f6 53 26 &27f8 2a 46 &27fa 52 2d &27fc 0a 4d &27fe 52 2a &2800 0a 4a &2802 53 2f &2804 33 4f &2806 2a 46 &2808 53 26 &280a 32 4d &280c 0a 4d &280e 52 2a &2810 0a 4a &2812 53 2f &2814 2a 4f &2816 53 26 &2818 29 46 &281a 2d 2d &281c a9 2d &281e 2f 29 &2820 f0 29 &2822 0f 4d &2824 e9 2d &2826 30 24 &2828 0b 44 &282a 72 2b &282c 4f 4b &282e eb 28 &2830 73 28 &2832 6f 4b &2834 eb 2b &2836 6f 22 &2838 ea 22 &283a 4e 29 &283c ca 29 &283e 4f 27 &2840 f0 27 &2842 0f 4a &2844 ea 2a &2846 50 21 &2848 0b 41 &284a 71 28 &284c 2f 48 &284e eb 26 &2850 72 26 &2852 4f 49 &2854 eb 29 &2856 6f 20 &2858 e9 20 &285a 2d 2d &285c a9 2d &285e 2f 29 &2860 f0 29 &2862 0f 4d &2864 e9 2d &2866 30 24 &2868 0b 44 &286a 72 2b &286c 4f 4b &286e eb 28 &2870 73 28 &2872 6f 4b &2874 eb 2b &2876 6f 22 &2878 ea 22 &287a 4e 29 &287c ca 29 &287e 4f 27 &2880 f0 27 &2882 0f 4a &2884 ea 2a &2886 50 21 &2888 0b 41 &288a 71 28 &288c 2f 48 &288e eb 26 &2890 72 26 &2892 4f 49 &2894 eb 29 &2896 6f 20 &2898 ea 20 &289a 52 2d &289c 0a 4d &289e 52 2a &28a0 0a 4a &28a2 53 2f &28a4 33 4f &28a6 2a 46 &28a8 53 26 &28aa 32 4d &28ac 0a 4d &28ae 52 2a &28b0 0a 4a &28b2 53 2f &28b4 2a 4f &28b6 53 26 &28b8 2a 46 &28ba 52 2d &28bc 0a 4d &28be 52 2a &28c0 0a 4a &28c2 53 2f &28c4 33 4f &28c6 2a 46 &28c8 53 26 &28ca 32 4d &28cc 0a 4d &28ce 52 2a &28d0 0a 4a &28d2 53 2f &28d4 2a 4f &28d6 53 26 &28d8 29 46 &28da 2d 2d &28dc a9 2d &28de 2f 29 &28e0 f0 29 &28e2 0f 4d &28e4 e9 2d &28e6 30 24 &28e8 0b 44 &28ea 72 2b &28ec 4f 4b &28ee eb 28 &28f0 73 28 &28f2 6f 4b &28f4 eb 2b &28f6 6f 22 &28f8 ea 22 &28fa 4e 29 &28fc ca 29 &28fe 4f 27 &2900 f0 27 &2902 0f 4a &2904 ea 2a &2906 50 21 &2908 0b 41 &290a 71 28 &290c 2f 48 &290e eb 26 &2910 72 26 &2912 4f 49 &2914 eb 29 &2916 6f 20 &2918 e9 20 &291a 2d 2d &291c a9 2d &291e 2f 29 &2920 f0 29 &2922 0f 4d &2924 e9 2d &2926 30 24 &2928 0b 44 &292a 72 2b &292c 4f 4b &292e eb 28 &2930 73 28 &2932 6f 4b &2934 eb 2b &2936 6f 22 &2938 ea 22 &293a 4e 29 &293c ca 29 &293e 4f 27 &2940 f0 27 &2942 0f 4a &2944 ea 2a &2946 50 21 &2948 0b 41 &294a 71 28 &294c 2f 48 &294e eb 26 &2950 72 26 &2952 4f 49 &2954 eb 29 &2956 6f 20 &2958 ea 20 &295a 52 2d &295c 0a 4d &295e 52 2a &2960 0a 4a &2962 53 2f &2964 33 4f &2966 2a 46 &2968 53 26 &296a 32 4d &296c 0a 4d &296e 52 2a &2970 0a 4a &2972 53 2f &2974 2a 4f &2976 53 26 &2978 2a 46 &297a 52 2d &297c 0a 4d &297e 52 2a &2980 0a 4a &2982 53 2f &2984 33 4f &2986 2a 46 &2988 53 26 &298a 32 4d &298c 0a 4d &298e 52 2a &2990 0a 4a &2992 53 2f &2994 2a 4f &2996 53 26 ; end_of_tune_data ; note_pitches ; 0 1 2 3 4 5 6 7 8 9 a b c d e f &2998 00 08 0c 10 14 18 1c 24 28 30 38 3c 40 44 48 4c ; &00 &29a8 54 58 60 68 6c 74 7c 88 ; &10 ; unused &29b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &29c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &29d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &29e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &29f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; level_data # + &400 for every row, +1 for horizontal, + &100 per level ; level_0_row_0 &2a00 00 00 00 00 00 00 00 00 60 00 00 00 00 00 00 00 &2a10 00 00 00 00 00 00 60 00 2e 06 06 06 06 06 06 06 &2a20 06 06 06 06 06 06 06 06 06 06 0c 0d 00 00 00 01 &2a30 02 06 06 06 06 06 06 06 06 06 0c 0d 00 00 00 00 &2a40 00 00 60 00 00 00 00 00 00 01 02 06 06 06 06 26 &2a50 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06 &2a60 06 06 06 06 06 0c 0d 00 00 00 00 00 60 00 00 00 &2a70 00 00 00 00 00 00 00 00 00 00 60 00 00 00 00 00 &2a80 00 00 00 00 00 00 00 60 00 00 00 00 00 00 00 00 &2a90 00 00 00 00 00 01 02 06 06 06 06 06 06 06 06 06 &2aa0 06 06 06 06 06 06 06 0c 0d 00 00 00 60 00 01 02 &2ab0 06 06 06 06 06 06 0c 0d 00 00 00 00 01 02 06 06 &2ac0 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06 &2ad0 0c 0d 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &2ae0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &2af0 00 00 00 00 00 01 02 06 06 0c 0d 00 00 00 00 00 ; level_1_row_0 &2b00 00 00 00 00 01 02 06 06 06 06 06 2e 06 06 06 06 &2b10 06 06 06 06 06 06 06 31 06 06 06 06 06 06 0c 0d &2b20 00 00 00 00 00 01 02 06 06 06 06 06 06 06 06 06 &2b30 06 06 06 06 06 06 06 06 06 06 06 06 0c 0d 00 00 &2b40 00 00 00 00 00 01 02 06 06 06 06 06 06 06 06 06 &2b50 06 06 06 06 06 06 06 06 06 06 06 06 06 06 0c 0d &2b60 00 00 00 00 00 00 00 00 00 00 1f 1f 1f 1f 1f 1f &2b70 1f 1f 1f 1f 1f 1f 1f 1f 1f 1f 00 00 00 00 01 02 &2b80 06 06 06 06 06 06 0c 0d 00 00 00 00 00 00 00 01 &2b90 02 06 06 06 06 06 06 26 06 06 06 06 06 06 06 06 &2ba0 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06 0c &2bb0 0d 00 00 00 00 00 01 02 06 06 06 06 06 06 06 06 &2bc0 06 06 06 06 06 06 06 06 06 06 06 06 06 0c 0d 00 &2bd0 00 00 00 00 00 00 00 00 00 00 00 01 02 06 06 06 &2be0 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06 &2bf0 06 06 06 06 06 06 06 06 06 0c 0d 00 00 00 00 00 ; level_2_row_0 &2c00 63 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 &2c10 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 &2c20 60 60 60 60 60 60 64 65 60 60 60 60 60 60 60 60 &2c30 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 &2c40 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 &2c50 60 60 64 65 60 60 60 60 2e 06 06 06 06 06 06 06 &2c60 06 06 26 06 06 06 06 06 06 06 06 06 06 06 31 60 &2c70 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 &2c80 60 62 63 2e 06 06 06 06 06 06 06 06 06 06 06 06 &2c90 06 06 06 06 06 06 06 06 06 26 06 06 06 06 06 06 &2ca0 06 06 06 06 06 06 06 06 06 06 31 60 62 63 60 60 &2cb0 60 60 60 60 60 60 2e 06 06 06 06 06 06 06 06 06 &2cc0 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06 &2cd0 06 31 60 60 60 60 60 60 60 60 60 60 60 60 62 63 &2ce0 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 2e &2cf0 06 06 06 06 06 06 06 06 06 06 31 60 60 60 60 62 ; level_3_row_0 &2d00 00 00 00 00 00 01 02 06 06 06 06 06 06 06 06 06 &2d10 06 06 0c 0d 00 00 00 2e 06 06 06 06 0c 0d 00 00 &2d20 00 00 00 00 00 01 02 06 06 06 06 06 06 06 06 06 &2d30 06 06 06 06 06 26 06 0c 0d 00 00 00 01 02 26 06 &2d40 0c 0d 00 00 01 02 06 06 0c 0d 00 00 01 02 06 06 &2d50 06 06 06 06 06 06 06 06 06 06 0c 0d 00 00 00 00 &2d60 00 00 00 00 00 00 00 00 00 01 02 06 06 06 06 06 &2d70 06 06 06 06 06 06 06 06 06 06 31 00 00 00 00 00 &2d80 00 00 00 01 02 26 06 06 06 06 06 06 06 06 06 06 &2d90 06 06 06 06 06 06 06 06 06 0c 0d 1f 1f 1f 1f 1f &2da0 1f 1f 1f 1f 1f 1f 1f 1f 1f 00 00 00 00 00 00 00 &2db0 00 00 01 02 06 06 06 06 06 06 0c 0d 1f 1f 1f 1f &2dc0 1f 1f 1f 1f 00 00 00 00 00 00 00 00 01 02 26 0c &2dd0 0d 00 00 00 00 00 00 00 00 00 01 02 06 26 06 06 &2de0 06 06 06 06 06 06 06 06 06 06 06 0c 0d 00 00 01 &2df0 02 06 06 06 06 06 06 06 06 0c 0d 00 00 00 00 00 ; level_0_row_1 &2e00 00 00 00 00 00 00 00 00 00 00 00 00 00 60 00 00 &2e10 00 00 00 00 00 00 00 00 08 03 14 03 16 22 24 16 &2e20 22 24 16 16 22 24 16 16 22 24 41 19 00 00 00 08 &2e30 03 40 03 40 03 40 03 40 03 40 03 66 06 06 06 06 &2e40 06 06 06 06 06 06 06 06 06 03 38 39 03 3d 03 1b &2e50 03 03 33 35 03 16 22 24 16 16 22 24 16 22 24 16 &2e60 22 24 16 41 03 2f 19 00 00 00 00 00 00 00 00 00 &2e70 00 00 60 00 00 00 00 60 00 00 00 00 00 00 00 00 &2e80 00 00 00 00 00 00 00 00 00 00 00 00 00 60 00 00 &2e90 00 00 00 01 02 03 03 33 35 03 33 35 03 0a 0b 03 &2ea0 3d 1c 03 03 14 03 38 39 03 0c 0d 00 00 00 08 33 &2eb0 35 03 33 35 03 33 35 03 06 06 06 06 03 16 22 24 &2ec0 16 22 24 16 16 22 24 16 16 22 24 41 03 03 03 03 &2ed0 03 03 06 06 06 0c 0d 00 00 00 00 00 00 00 00 00 &2ee0 60 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &2ef0 00 00 00 01 02 27 28 28 28 29 19 00 00 60 00 00 ; level_1_row_1 &2f00 00 00 00 00 08 20 20 20 03 14 03 08 03 09 03 18 &2f10 03 09 03 18 03 09 03 19 03 20 20 20 20 20 20 03 &2f20 06 06 06 06 06 03 20 20 14 03 2e 06 06 06 06 06 &2f30 06 06 06 06 06 06 06 31 03 14 03 20 20 03 06 06 &2f40 06 06 06 06 06 03 20 3d 03 20 20 20 20 20 14 03 &2f50 16 22 24 16 16 22 24 16 16 16 22 24 41 03 03 03 &2f60 13 11 11 11 11 11 11 11 11 11 03 0a 0b 03 16 16 &2f70 22 24 16 22 24 16 22 24 16 41 0c 0d 00 00 08 14 &2f80 3a 3b 2a 2a 2a 2a 2a 2a 0c 0d 00 00 00 01 02 03 &2f90 2f 03 38 39 38 39 03 1b 03 22 24 16 16 16 22 24 &2fa0 22 24 16 16 22 24 41 03 67 03 20 20 20 20 20 20 &2fb0 19 00 00 00 00 00 08 18 67 03 18 18 18 18 18 18 &2fc0 09 09 18 18 18 09 09 18 18 18 03 14 03 18 03 0c &2fd0 0d 00 00 00 00 00 00 00 00 01 02 38 39 66 67 66 &2fe0 67 66 2e 06 06 06 06 06 06 06 06 06 06 06 06 06 &2ff0 06 06 06 06 06 06 06 06 31 03 03 0c 0d 00 00 00 ; level_2_row_1 &3000 65 60 60 60 60 60 61 60 60 60 60 61 60 60 60 60 &3010 61 60 60 60 60 61 60 60 60 60 60 60 60 60 60 60 &3020 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 &3030 60 60 60 62 63 60 60 2e 06 06 06 06 06 06 06 06 &3040 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06 &3050 06 06 26 06 31 60 61 60 08 2a 2a 2a 2a 2a 2a 2a &3060 2a 3d 1b 40 1c 40 1c 40 1c 40 1c 14 03 33 35 06 &3070 06 06 06 06 06 06 06 06 06 06 06 06 31 60 60 60 &3080 60 64 65 08 03 27 28 28 28 28 28 28 28 28 28 28 &3090 28 28 28 29 14 03 03 03 03 15 03 16 22 24 16 16 &30a0 22 24 16 16 16 16 22 24 41 03 19 60 64 65 60 60 &30b0 60 60 60 60 60 60 08 16 22 24 16 22 24 16 16 16 &30c0 22 24 16 16 22 24 16 16 22 24 16 16 22 24 16 41 &30d0 03 19 60 60 60 60 60 60 60 60 60 60 60 60 64 65 &30e0 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 08 &30f0 2b 16 16 16 16 16 16 16 16 41 19 60 60 60 60 64 ; level_3_row_1 &3100 00 00 00 00 00 08 09 03 2f 18 18 18 18 18 18 20 &3110 18 18 14 19 00 00 00 08 1c 1c 1c 1c 1c 03 36 36 &3120 36 36 36 36 36 03 16 16 22 24 16 16 22 24 16 22 &3130 24 16 16 16 41 1b 20 20 19 00 00 00 08 03 1b 3d &3140 03 19 00 00 08 09 09 09 09 19 00 00 08 38 39 16 &3150 22 24 16 16 22 24 16 22 24 41 14 03 0c 0d 00 00 &3160 00 00 00 00 01 02 06 06 06 16 16 22 24 22 24 16 &3170 22 24 16 22 24 16 41 03 2a 2a 2a 0c 0d 00 00 00 &3180 00 00 00 08 14 15 16 22 24 16 16 22 24 16 16 16 &3190 22 24 16 41 03 14 03 1c 20 20 20 03 03 03 03 03 &31a0 03 03 03 03 03 03 03 03 03 0c 0d 00 00 00 00 00 &31b0 00 00 08 40 03 16 16 22 24 16 16 22 24 16 16 16 &31c0 22 24 16 41 0c 0d 00 00 00 00 01 02 66 20 15 20 &31d0 20 0c 0d 00 00 00 00 00 01 02 07 07 1c 15 03 16 &31e0 16 22 24 16 16 16 22 24 16 41 03 03 14 0c 0d 08 &31f0 03 27 28 28 28 28 28 28 28 29 19 00 00 00 00 00 ; level_0_row_2 &3200 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &3210 00 00 00 00 00 00 00 00 08 03 15 03 17 23 25 17 &3220 23 25 17 17 23 25 17 17 23 25 42 19 00 00 00 04 &3230 05 07 07 07 07 07 07 07 07 07 03 03 16 16 22 24 &3240 16 22 24 16 16 22 24 16 41 03 32 32 32 32 32 15 &3250 03 03 56 2d 03 17 23 25 17 17 23 25 17 23 25 17 &3260 23 25 17 42 03 2f 19 00 00 00 00 00 00 00 00 00 &3270 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 &3280 02 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06 &3290 06 06 06 03 3d 03 03 56 2d 03 56 2d 03 0a 0b 03 &32a0 1c 3d 03 03 1b 03 38 39 03 0e 0f 00 00 00 08 56 &32b0 2d 03 56 2d 03 56 2d 03 07 07 07 07 03 17 23 25 &32c0 17 23 25 17 17 23 25 17 17 23 25 42 03 09 03 09 &32d0 03 09 03 09 03 09 19 00 00 00 00 00 00 00 00 00 &32e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 60 00 &32f0 00 01 02 2b 22 24 22 24 41 3d 19 00 00 00 00 00 ; level_1_row_2 &3300 00 00 00 00 08 20 20 20 03 15 03 34 07 07 07 07 &3310 07 07 07 07 07 07 07 30 03 20 20 20 20 20 20 03 &3320 33 35 03 09 03 03 21 20 1b 3d 08 16 22 24 16 22 &3330 24 16 16 22 24 41 03 19 03 1b 03 20 20 20 20 20 &3340 20 20 20 20 20 20 20 38 39 20 20 20 20 20 15 03 &3350 17 23 25 17 17 23 25 17 17 17 23 25 42 03 67 03 &3360 3f 3e 3e 3e 3e 3e 3e 3e 3e 3e 03 66 20 03 17 17 &3370 23 25 17 23 25 17 23 25 17 42 03 03 06 06 03 1b &3380 2a 2a 2a 2a 2a 2a 14 2a 2a 2a 06 06 06 03 03 03 &3390 2f 32 32 32 32 32 32 15 03 23 25 17 17 17 23 25 &33a0 23 25 17 17 23 25 42 03 67 3d 20 20 20 20 09 09 &33b0 19 13 11 11 11 11 03 3d 67 03 16 22 24 16 16 22 &33c0 24 16 16 16 16 22 24 16 16 41 03 1b 03 18 18 03 &33d0 03 13 11 11 11 11 11 11 11 03 03 38 39 3d 03 03 &33e0 03 03 08 2a 03 2b 22 24 16 16 16 22 24 16 16 16 &33f0 16 16 22 24 16 41 03 14 19 03 21 20 19 00 00 00 ; level_2_row_2 &3400 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 &3410 60 60 60 60 60 60 60 2e 06 06 06 06 06 06 06 06 &3420 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06 &3430 06 31 60 64 65 60 60 08 33 35 03 67 67 03 33 35 &3440 03 03 38 39 03 38 39 03 38 39 03 38 39 03 38 39 &3450 03 03 1b 3d 19 60 60 60 34 07 07 07 07 07 07 07 &3460 07 03 15 27 29 1c 40 1c 40 1c 67 1b 03 56 2d 03 &3470 16 22 24 22 24 16 22 24 16 22 24 41 19 60 61 60 &3480 60 60 60 08 03 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a &3490 2a 2a 2a 3d 1b 03 03 03 03 03 03 17 23 25 17 17 &34a0 23 25 17 17 17 17 23 25 42 03 19 60 60 60 60 60 &34b0 60 60 60 60 60 60 08 17 23 25 17 23 25 17 17 17 &34c0 23 25 17 17 23 25 17 17 23 25 17 17 23 25 17 42 &34d0 03 03 06 06 06 06 06 06 06 06 06 06 31 60 60 60 &34e0 60 60 2e 06 06 06 06 06 06 06 06 06 26 31 60 08 &34f0 2c 17 17 17 17 17 17 17 17 42 19 60 60 60 60 60 ; level_3_row_2 &3500 00 00 00 00 00 08 09 03 2f 18 18 21 18 3d 18 18 &3510 18 18 1b 03 13 11 11 08 1c 2a 2a 2a 1c 03 37 37 &3520 37 37 37 37 37 03 17 17 23 25 17 17 23 25 17 23 &3530 25 17 17 17 42 15 20 21 19 00 00 00 08 03 15 27 &3540 28 29 13 11 08 09 09 09 14 19 00 00 04 05 03 17 &3550 23 25 17 17 23 25 17 23 25 42 15 67 67 19 1f 1f &3560 1f 1f 01 02 03 3a 3b 2a 03 17 17 23 25 23 25 17 &3570 23 25 17 23 25 17 42 03 2a 2a 2a 2a 2a 13 11 11 &3580 11 11 11 08 15 03 17 23 25 17 17 23 25 17 17 17 &3590 23 25 17 42 03 1b 03 1c 20 20 20 03 2e 06 06 06 &35a0 06 06 06 06 06 06 06 31 03 03 03 0c 0d 1f 1f 1f &35b0 01 02 03 03 03 17 17 23 25 17 17 23 25 17 17 17 &35c0 23 25 17 42 03 03 06 06 06 06 14 20 20 20 20 20 &35d0 20 20 03 13 11 11 11 11 0e 0f 00 00 04 05 03 17 &35e0 17 23 25 17 17 17 23 25 17 42 03 03 1b 03 03 03 &35f0 03 3c 3c 3c 3c 03 3a 3b 03 66 19 00 00 00 00 00 ; level_0_row_3 &3600 00 00 00 00 01 02 06 06 06 06 06 06 06 06 06 06 &3610 06 06 06 06 06 06 06 06 03 03 03 03 03 03 03 03 &3620 03 07 07 07 07 07 07 07 07 07 0e 0f 00 00 00 00 &3630 00 00 00 00 00 00 00 00 00 00 08 03 17 17 23 25 &3640 17 23 25 17 17 23 25 17 42 03 03 03 03 03 03 03 &3650 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 &3660 03 03 03 03 03 2f 19 00 00 60 00 00 00 01 02 06 &3670 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06 03 &3680 03 03 16 22 24 22 24 16 16 16 22 24 22 24 16 22 &3690 24 16 41 03 03 03 07 07 07 07 07 07 07 07 07 07 &36a0 07 07 07 07 1d 07 07 0e 0f 00 00 00 00 00 08 03 &36b0 03 03 03 03 03 03 03 19 00 00 00 00 04 05 07 07 &36c0 07 07 32 32 32 32 32 14 32 32 32 32 32 32 32 32 &36d0 07 07 07 07 07 0e 0f 00 00 01 02 06 06 06 06 06 &36e0 06 06 06 06 06 06 06 06 06 06 06 0c 0d 00 00 01 &36f0 02 03 03 2c 23 25 23 25 42 3d 19 00 00 00 00 00 ; level_1_row_3 &3700 00 00 00 00 08 20 3d 20 20 20 20 03 16 16 22 24 &3710 16 16 16 22 24 41 03 14 03 20 20 20 20 3d 20 03 &3720 56 2d 03 09 03 03 20 20 1b 03 08 17 23 25 17 23 &3730 25 17 17 23 25 42 03 19 03 1b 03 20 20 66 20 20 &3740 66 20 20 66 20 20 20 38 39 20 20 20 20 20 20 20 &3750 20 20 20 14 18 18 18 20 18 18 18 20 03 03 03 03 &3760 3f 3e 3e 3e 3e 3e 3e 3e 3e 3e 03 20 20 19 1a 1a &3770 1a 1a 1a 1a 1a 1a 1a 1a 1a 1a 08 67 67 03 03 1b &3780 3d 2a 2a 2a 2a 2a 1b 2a 2a 2a 2a 2a 2a 2a 2a 03 &3790 2f 03 03 03 3d 03 03 03 03 03 03 03 03 03 03 03 &37a0 03 03 03 03 03 20 20 20 20 20 20 20 67 09 09 09 &37b0 19 3f 3e 3e 3e 3e 03 18 67 03 17 23 25 17 17 23 &37c0 25 17 17 17 17 23 25 17 17 42 03 1b 03 18 18 03 &37d0 03 3f 3e 3e 3e 3e 3e 3e 3e 03 03 38 39 20 20 20 &37e0 20 03 08 2a 03 2c 23 25 17 17 17 23 25 17 17 17 &37f0 17 17 23 25 17 42 03 15 19 03 20 20 19 00 00 00 ; level_2_row_3 &3800 60 60 60 60 60 2e 06 06 06 06 06 06 06 06 06 06 &3810 06 06 06 06 06 06 06 03 03 0a 0b 03 0a 0b 03 0a &3820 0b 03 16 22 24 16 16 22 24 22 24 16 22 24 22 24 &3830 41 19 60 60 60 60 60 08 56 2d 03 3a 3b 03 56 2d &3840 03 16 22 24 16 22 24 16 16 16 22 24 16 22 24 16 &3850 41 03 1b 03 19 60 61 60 60 60 60 60 60 60 60 60 &3860 60 08 03 40 1c 40 1c 40 1c 40 1c 1b 03 03 03 03 &3870 17 23 25 23 25 17 23 25 17 23 25 42 19 60 60 60 &3880 60 60 60 08 03 03 03 03 27 28 28 28 28 28 28 28 &3890 28 28 28 29 1b 03 03 03 67 27 28 28 28 28 28 28 &38a0 28 28 28 28 28 28 28 28 28 29 19 60 60 60 60 60 &38b0 62 63 60 60 60 60 34 07 07 07 07 07 07 07 07 07 &38c0 07 07 07 07 07 07 07 07 07 07 07 07 07 07 07 07 &38d0 07 07 3d 03 0a 0b 03 0a 0b 03 0a 0b 03 06 06 06 &38e0 06 06 03 16 22 24 16 16 22 24 16 41 1b 19 60 34 &38f0 07 03 03 07 07 07 07 07 07 07 30 60 60 62 63 60 ; level_3_row_3 &3900 00 00 00 00 00 08 09 03 2f 32 67 27 28 28 28 28 &3910 28 29 1b 03 3f 3e 3e 08 1c 2a 3d 2a 1c 19 00 00 &3920 00 00 00 00 00 27 28 28 28 28 28 28 28 28 28 28 &3930 28 29 03 3d 03 03 20 20 19 00 00 00 08 03 03 03 &3940 03 03 3f 3e 08 09 09 09 1b 19 00 00 00 00 1a 1a &3950 1a 1a 1a 1a 1a 1a 1a 1a 1a 1a 08 3d 38 39 03 03 &3960 03 03 03 38 39 2a 2a 2a 03 27 28 28 29 03 27 28 &3970 28 29 32 32 32 32 32 03 2a 2a 2a 2a 2a 3f 3e 3e &3980 3e 3e 3e 08 03 03 19 1a 1a 1a 1a 1a 1a 1a 1a 1a &3990 1a 1a 1a 08 03 1b 03 1c 20 21 20 03 08 1c 40 1c &39a0 67 1c 40 1c 40 1c 3d 19 03 3a 3b 03 03 03 03 03 &39b0 03 27 28 28 28 28 28 28 29 19 1a 1a 1a 1a 1a 1a &39c0 1a 1a 1a 1a 08 09 09 09 09 3d 15 20 20 20 20 20 &39d0 20 20 14 3f 3e 3e 3e 3e 00 00 00 00 00 00 1a 1a &39e0 1a 1a 1a 1a 1a 1a 1a 1a 1a 1a 1a 08 1b 03 03 2f &39f0 2b 22 24 16 22 24 16 41 03 66 19 00 00 00 00 00 ; level_0_row_4 &3a00 00 00 00 00 08 16 16 22 24 16 16 16 22 24 16 16 &3a10 22 24 41 03 67 03 03 03 0a 0b 03 03 03 03 14 03 &3a20 19 00 00 00 00 00 00 00 00 00 00 00 60 00 00 01 &3a30 02 06 06 06 06 06 06 06 06 06 03 03 03 03 03 03 &3a40 03 03 03 03 03 03 03 03 03 03 32 32 32 32 32 14 &3a50 03 16 22 24 16 22 24 16 16 16 22 24 16 16 22 24 &3a60 16 22 24 41 03 2f 19 00 00 00 00 01 02 38 39 16 &3a70 16 22 24 16 16 22 24 16 22 24 16 16 22 24 41 03 &3a80 03 03 17 23 25 23 25 17 17 17 23 25 23 25 17 23 &3a90 25 17 42 03 0e 0f 00 00 00 00 00 00 00 00 00 00 &3aa0 00 00 00 00 00 00 00 00 00 00 60 00 00 00 08 22 &3ab0 24 16 16 22 24 16 41 19 00 00 60 00 00 00 00 00 &3ac0 00 00 04 05 03 03 3d 1b 03 40 1c 40 1c 40 0e 0f &3ad0 00 00 00 00 00 00 00 01 02 03 16 22 24 16 22 24 &3ae0 16 22 24 16 16 22 24 22 24 22 24 41 14 06 06 03 &3af0 03 0e 0f 04 05 27 28 28 28 29 19 00 00 00 00 00 ; level_1_row_4 &3b00 00 00 00 00 08 20 20 20 20 20 20 03 17 17 23 25 &3b10 17 17 17 23 25 42 03 15 03 20 21 20 20 20 20 03 &3b20 03 03 03 09 03 03 20 20 15 03 08 0a 0b 03 0a 0b &3b30 03 0a 0b 03 0a 0b 03 19 03 1b 03 20 20 20 20 20 &3b40 20 20 20 20 20 20 20 38 39 20 0a 0b 20 0a 0b 20 &3b50 0a 0b 20 15 18 20 18 18 18 21 18 18 03 3d 67 03 &3b60 3f 3e 3e 3e 3e 3e 3e 3e 3e 3e 03 66 20 03 16 22 &3b70 24 16 16 16 22 24 16 22 24 41 03 03 07 07 03 1b &3b80 2a 2a 2a 2a 2a 2a 15 2a 2a 2a 07 07 07 03 03 03 &3b90 2f 32 32 32 32 32 32 14 03 16 22 24 22 24 16 16 &3ba0 22 24 16 41 03 20 20 20 20 20 20 20 67 09 09 09 &3bb0 19 12 10 10 10 10 03 18 67 03 16 16 16 16 22 24 &3bc0 16 16 16 16 16 16 16 22 24 41 03 1b 03 18 03 03 &3bd0 03 12 10 10 10 10 10 10 10 03 03 38 39 20 21 20 &3be0 20 03 34 07 07 07 07 07 07 07 07 07 07 07 07 07 &3bf0 07 07 07 07 07 07 07 07 30 03 20 20 19 00 00 00 ; level_2_row_4 &3c00 60 60 60 60 60 08 16 22 24 16 22 24 16 16 16 22 &3c10 24 22 24 16 22 24 16 41 03 03 03 07 07 07 07 03 &3c20 03 03 17 23 25 17 17 23 25 23 25 17 23 25 23 25 &3c30 42 19 60 60 61 60 60 08 03 03 03 03 03 3d 03 03 &3c40 03 17 23 25 17 23 25 17 17 17 23 25 17 23 25 17 &3c50 42 03 1b 3d 19 60 60 60 2e 06 06 06 06 06 06 06 &3c60 06 03 14 27 29 1c 40 1c 40 1c 67 1b 03 33 35 03 &3c70 20 20 20 20 20 20 20 20 03 07 07 07 30 60 60 62 &3c80 63 60 60 08 03 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a &3c90 2a 2a 2a 3d 1b 03 03 03 03 03 03 16 16 22 24 16 &3ca0 16 22 24 16 22 24 16 16 41 03 19 60 60 60 60 60 &3cb0 64 65 60 60 60 60 60 60 60 60 60 60 60 60 60 60 &3cc0 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 &3cd0 60 60 08 16 22 24 16 22 24 16 16 16 16 22 24 16 &3ce0 16 41 03 17 23 25 17 17 23 25 17 42 1b 19 60 60 &3cf0 60 08 19 60 60 60 60 60 60 60 60 60 60 64 65 60 ; level_3_row_4 &3d00 00 00 00 00 00 08 09 03 2f 16 22 24 16 16 41 03 &3d10 03 3d 1b 03 12 10 10 08 1c 2a 2a 2a 1c 03 36 36 &3d20 36 36 36 36 36 03 16 22 24 16 16 16 22 24 16 22 &3d30 24 16 22 24 41 14 20 20 19 00 00 00 08 03 14 27 &3d40 28 29 12 10 08 09 09 09 15 19 00 00 01 02 03 22 &3d50 24 16 22 24 22 24 16 22 24 41 14 67 67 19 1e 1e &3d60 1e 1e 04 05 03 3a 3b 2a 03 16 22 24 16 22 24 16 &3d70 22 24 22 24 22 24 41 03 2a 2a 2a 2a 2a 12 10 10 &3d80 10 10 10 08 14 03 16 16 22 24 16 16 16 16 22 24 &3d90 16 22 24 41 03 1b 03 1c 20 20 20 03 34 07 07 07 &3da0 07 07 07 07 07 07 07 30 03 03 03 0e 0f 1e 1e 1e &3db0 04 05 03 03 03 16 16 16 16 22 24 16 16 16 16 22 &3dc0 24 16 16 41 03 03 07 07 07 07 03 20 20 20 20 20 &3dd0 20 20 15 12 10 10 10 10 0c 0d 00 00 01 02 03 16 &3de0 22 24 16 16 22 24 16 22 24 41 03 03 1b 3d 03 2f &3df0 2c 23 25 17 23 25 17 42 03 66 19 00 00 00 00 00 ; level_0_row_5 &3e00 00 00 60 00 08 17 17 23 25 17 17 17 23 25 17 17 &3e10 23 25 42 03 67 03 3d 03 03 03 03 0a 0b 03 15 03 &3e20 19 00 00 60 00 00 00 00 00 00 00 00 00 00 00 08 &3e30 03 40 03 40 03 40 03 40 03 40 03 66 07 07 07 07 &3e40 07 07 07 07 07 07 07 07 07 03 38 39 03 3d 03 1b &3e50 03 17 23 25 17 23 25 17 17 17 23 25 17 17 23 25 &3e60 17 23 25 42 03 2f 19 00 00 01 02 38 39 03 03 17 &3e70 17 23 25 17 17 23 25 17 23 25 17 17 23 25 42 03 &3e80 03 07 07 07 07 07 07 07 07 07 07 07 07 07 07 07 &3e90 07 07 0e 0f 00 00 00 00 00 00 00 60 00 00 00 00 &3ea0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 08 23 &3eb0 25 17 17 23 25 17 42 19 00 00 00 00 00 00 00 00 &3ec0 60 00 00 00 04 05 07 1d 07 07 07 07 0e 0f 00 00 &3ed0 00 00 00 60 00 00 00 08 3d 03 17 23 25 17 23 25 &3ee0 17 23 25 17 17 23 25 23 25 23 25 42 15 07 07 0e &3ef0 0f 00 00 60 00 04 05 07 07 0e 0f 00 00 00 00 00 ; level_1_row_5 &3f00 00 00 00 00 08 03 03 03 1c 03 03 1c 03 03 1c 03 &3f10 03 1c 03 03 1c 03 03 1c 03 20 1c 20 20 1c 20 03 &3f20 07 07 07 07 07 03 03 03 03 03 34 07 07 07 07 07 &3f30 07 07 07 07 07 07 07 30 03 15 03 20 20 03 07 07 &3f40 07 07 07 07 07 03 20 09 03 20 20 20 20 20 20 20 &3f50 20 20 20 03 03 03 03 03 03 03 03 03 03 03 03 03 &3f60 12 10 10 10 10 10 10 10 10 10 03 0a 0b 03 17 23 &3f70 25 17 17 17 23 25 17 23 25 42 0e 0f 00 00 08 15 &3f80 3a 3b 2a 2a 2a 2a 2a 2a 0e 0f 00 00 00 04 05 03 &3f90 2f 03 38 39 38 39 03 1b 03 17 23 25 23 25 17 17 &3fa0 23 25 17 42 03 20 20 20 20 20 20 20 67 09 09 09 &3fb0 19 00 00 00 00 00 08 03 67 03 17 17 17 17 23 25 &3fc0 17 17 17 17 17 17 17 23 25 42 03 15 03 03 03 0e &3fd0 0f 00 00 00 00 00 00 00 00 04 05 32 32 32 32 32 &3fe0 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 &3ff0 32 32 32 32 32 32 32 32 32 32 32 0e 0f 00 00 00 ; level_2_row_5 &4000 60 60 60 60 60 08 17 23 25 17 23 25 17 17 17 23 &4010 25 23 25 17 23 25 17 42 03 3d 19 60 60 60 60 34 &4020 07 07 07 07 07 07 07 07 07 07 07 07 07 07 07 07 &4030 07 30 60 60 60 60 60 34 07 07 07 07 07 07 07 07 &4040 07 07 07 07 07 07 07 07 07 07 07 07 07 07 07 07 &4050 07 07 1d 07 30 60 61 60 08 2a 2a 2a 2a 2a 2a 2a &4060 2a 3d 1b 40 1c 40 1c 40 1c 40 1c 15 03 56 2d 07 &4070 07 07 07 07 07 07 07 07 30 60 60 60 60 60 60 64 &4080 65 60 60 08 03 27 28 28 28 28 28 28 28 28 28 28 &4090 28 28 28 29 15 03 03 03 03 14 03 17 17 23 25 17 &40a0 17 23 25 17 23 25 17 17 42 03 19 60 60 62 63 60 &40b0 60 60 60 60 60 60 60 60 61 60 60 60 61 60 60 60 &40c0 61 60 60 60 61 60 60 60 61 60 60 60 61 60 60 60 &40d0 61 60 08 17 23 25 17 23 25 17 17 17 17 23 25 17 &40e0 17 42 03 0a 0b 03 0a 0b 03 0a 0b 03 15 3d 06 06 &40f0 06 03 19 60 60 62 63 60 60 60 60 60 60 60 60 60 ; level_3_row_5 &4100 00 00 00 00 00 08 09 03 2f 17 23 25 17 17 42 03 &4110 03 03 15 19 00 00 00 08 1c 1c 1c 1c 1c 03 37 37 &4120 37 37 37 37 37 03 17 23 25 17 17 17 23 25 17 23 &4130 25 17 23 25 42 1b 20 20 19 00 00 00 08 03 1b 3d &4140 03 19 00 00 08 09 09 09 09 19 00 00 08 38 39 23 &4150 25 17 23 25 23 25 17 23 25 42 15 03 0e 0f 00 00 &4160 00 00 00 00 04 05 07 07 07 17 23 25 17 23 25 17 &4170 23 25 23 25 23 25 42 03 2a 2a 2a 0e 0f 00 00 00 &4180 00 00 00 08 15 14 17 17 23 25 17 17 17 17 23 25 &4190 17 23 25 42 03 15 03 1c 20 20 20 03 03 03 03 03 &41a0 03 03 03 03 03 03 03 03 03 0e 0f 00 00 00 00 00 &41b0 00 00 08 40 03 17 17 17 17 23 25 17 17 17 17 23 &41c0 25 17 17 42 0e 0f 00 00 00 00 04 05 20 20 14 20 &41d0 66 0e 0f 00 00 00 00 00 04 05 06 06 1c 14 03 17 &41e0 23 25 17 17 23 25 17 23 25 42 03 03 15 0e 0f 08 &41f0 03 27 28 28 28 28 28 28 28 29 19 00 00 00 00 00 ; level_0_row_6 &4200 00 00 00 00 04 05 07 07 07 07 07 07 07 07 07 07 &4210 07 07 07 07 07 07 07 07 07 07 07 07 07 07 07 07 &4220 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04 &4230 05 07 07 07 07 07 07 07 07 07 0e 0f 00 00 00 00 &4240 00 00 00 00 00 00 00 00 00 04 05 07 07 07 07 1d &4250 07 07 07 07 07 07 07 07 07 07 07 07 07 07 07 07 &4260 07 07 07 07 07 0e 0f 00 00 34 07 07 07 07 07 07 &4270 07 07 07 07 07 07 07 07 07 07 07 07 07 07 07 0e &4280 0f 00 00 00 00 00 00 00 00 60 00 00 00 00 00 00 &4290 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &42a0 00 00 60 00 00 00 00 00 00 00 00 00 00 00 04 05 &42b0 07 07 07 07 07 07 0e 0f 00 00 00 00 00 00 00 00 &42c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &42d0 00 00 00 00 00 00 00 04 05 07 07 07 07 07 07 07 &42e0 07 07 07 07 07 07 07 07 07 07 07 0e 0f 00 00 00 &42f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; level_1_row_6 &4300 00 00 00 00 04 05 07 07 07 07 07 07 07 07 07 07 &4310 07 07 07 07 07 07 07 07 07 07 07 07 07 07 0e 0f &4320 00 00 00 00 00 04 05 07 07 07 07 07 07 07 07 07 &4330 07 07 07 07 07 07 07 07 07 07 07 07 0e 0f 00 00 &4340 00 00 00 00 00 04 05 07 07 07 07 07 07 07 07 07 &4350 07 07 07 07 07 07 07 07 07 07 07 07 07 07 0e 0f &4360 00 00 00 00 00 00 00 00 00 00 1e 1e 1e 1e 1e 1e &4370 1e 1e 1e 1e 1e 1e 1e 1e 1e 1e 00 00 00 00 04 05 &4380 07 07 07 07 07 07 0e 0f 00 00 00 00 00 00 00 04 &4390 05 07 07 07 07 07 07 1d 07 07 07 07 07 07 07 07 &43a0 07 07 07 07 07 07 07 07 07 07 07 07 07 07 07 0e &43b0 0f 00 00 00 00 00 04 05 07 07 07 07 07 07 07 07 &43c0 07 07 07 07 07 07 07 07 07 07 07 07 07 0e 0f 00 &43d0 00 00 00 00 00 00 00 00 00 00 00 04 05 07 07 07 &43e0 07 07 07 07 07 07 07 07 07 07 07 07 07 07 07 07 &43f0 07 07 07 07 07 07 07 07 07 0e 0f 00 00 00 00 00 ; level_2_row_6 &4400 60 60 60 60 60 34 07 07 07 07 07 07 07 07 07 07 &4410 07 07 07 07 07 07 07 07 07 07 30 60 62 63 60 60 &4420 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 &4430 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 &4440 60 60 60 60 60 60 60 60 62 63 60 60 60 60 60 60 &4450 60 60 60 60 60 60 60 60 34 07 07 07 07 07 07 07 &4460 07 07 1d 07 07 07 07 07 07 07 07 07 07 07 30 60 &4470 60 60 60 60 60 60 60 60 60 60 60 61 60 60 60 60 &4480 60 60 60 34 07 07 07 07 07 07 07 07 07 07 07 07 &4490 07 07 07 07 07 07 07 07 07 1d 07 07 07 07 07 07 &44a0 07 07 07 07 07 07 07 07 07 07 30 60 60 64 65 60 &44b0 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 &44c0 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 &44d0 60 60 34 07 07 07 07 07 07 07 07 07 07 07 07 07 &44e0 07 07 07 07 07 07 07 07 07 07 07 07 07 07 07 07 &44f0 07 07 30 60 60 64 65 60 60 60 60 60 60 60 60 60 ; level_3_row_6 &4500 00 00 00 00 00 04 05 07 07 07 07 07 07 07 07 07 &4510 07 07 0e 0f 00 00 00 34 07 07 07 07 0e 0f 00 00 &4520 00 00 00 00 00 04 05 07 07 07 07 07 07 07 07 07 &4530 07 07 07 07 07 1d 07 0e 0f 00 00 00 04 05 1d 07 &4540 0e 0f 00 00 04 05 07 07 0e 0f 00 00 04 05 07 07 &4550 07 07 07 07 07 07 07 07 07 07 0e 0f 00 00 00 00 &4560 00 00 00 00 00 00 00 00 00 04 05 07 07 07 07 07 &4570 07 07 07 07 07 07 07 07 07 07 30 00 00 00 00 00 &4580 00 00 00 04 05 1d 07 07 07 07 07 07 07 07 07 07 &4590 07 07 07 07 07 07 07 07 07 0e 0f 1e 1e 1e 1e 1e &45a0 1e 1e 1e 1e 1e 1e 1e 1e 1e 00 00 00 00 00 00 00 &45b0 00 00 04 05 07 07 07 07 07 07 0e 0f 1e 1e 1e 1e &45c0 1e 1e 1e 1e 00 00 00 00 00 00 00 00 04 05 1d 0e &45d0 0f 00 00 00 00 00 00 00 00 00 04 05 07 1d 07 07 &45e0 07 07 07 07 07 07 07 07 07 07 07 0e 0f 00 00 04 &45f0 05 07 07 07 07 07 07 07 07 0e 0f 00 00 00 00 00 ; end_of_level_data ; sprite_data ; sprite_00 (TILE_00) &4600 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &4610 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &4620 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &4630 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; sprite_01 (TILE_01) &4640 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &4650 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &4660 00 00 00 00 00 00 31 f4 00 00 00 00 31 f4 f0 f0 &4670 00 00 31 f4 f0 f0 f0 f0 31 f4 f0 f0 f0 f0 f0 f0 ; sprite_02 (TILE_02) &4680 00 00 00 00 00 00 31 f4 00 00 00 00 31 f4 f0 f0 &4690 00 00 31 f4 f0 f0 f0 f0 31 f4 f0 f0 f0 f0 f0 f0 &46a0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 &46b0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 ; sprite_03 (TILE_03) &46c0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 &46d0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 &46e0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 &46f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 ; sprite_04 (TILE_04) &4700 b0 20 00 00 00 00 00 00 f0 f0 b0 20 00 00 00 00 &4710 f0 f0 f0 f0 b0 20 00 00 f0 f0 f0 f0 f0 f0 b0 20 &4720 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &4730 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; sprite_05 (TILE_05) &4740 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 &4750 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 &4760 b0 20 00 00 00 00 00 00 f0 f0 b0 20 00 00 00 00 &4770 f0 f0 f0 f0 b0 20 00 00 f0 f0 f0 f0 f0 f0 b0 20 ; sprite_06 (TILE_06) &4780 fa f5 f0 f0 f0 f0 f0 f0 fa f5 f0 f0 f0 f0 f0 f0 &4790 fa f5 f0 f0 f0 f0 f0 f0 fa f5 f0 f0 f0 f0 f0 f0 &47a0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 &47b0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 ; sprite_07 (TILE_07) &47c0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 &47d0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 &47e0 f0 f0 f0 f0 f0 f0 a0 50 f0 f0 f0 f0 f0 f0 a0 50 &47f0 f0 f0 f0 f0 f0 f0 a0 50 f0 f0 f0 f0 f0 f0 a0 50 ; sprite_08 (TILE_08) &4800 f4 f8 f4 f8 f4 f8 f4 f8 f0 f0 f0 f0 f0 f0 f0 f0 &4810 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 &4820 f4 f8 f4 f8 f4 f8 f4 f8 f0 f0 f0 f0 f0 f0 f0 f0 &4830 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 ; sprite_09 (TILE_09) &4840 f0 f0 f0 f0 f0 f0 f0 f3 f0 f0 f0 f1 f3 f6 fc f8 &4850 f0 f0 f8 b8 d0 e0 f0 f0 f0 f0 f0 f0 f0 f0 70 b0 &4860 f3 f0 f0 f0 f0 f0 f0 f0 fc fe f7 f3 f1 f0 f0 f0 &4870 f0 e0 c0 88 98 b8 f0 f0 10 30 70 f0 f0 f0 f0 f0 ; sprite_0a (TILE_0a) &4880 00 00 20 30 20 30 20 30 00 00 e0 b0 e0 b0 e0 b0 &4890 00 00 e0 b0 e0 b0 e0 b0 00 00 e0 b0 e0 b0 e0 b0 &48a0 20 30 20 30 20 30 20 77 e0 b0 e0 b0 e0 b0 e0 ff &48b0 e0 b0 e0 b0 e0 b0 e0 ff e0 b0 e0 b0 e0 b0 e0 ff ; sprite_0b (TILE_0b) &48c0 00 00 e0 b0 e0 b0 e0 b0 00 00 e0 b0 e0 b0 e0 b0 &48d0 00 00 e0 b0 e0 b0 e0 b0 11 11 f1 b1 f1 b1 f1 b1 &48e0 e0 b0 e0 b0 e0 b0 e0 ff e0 b0 e0 b0 e0 b0 e0 ff &48f0 e0 b0 e0 b0 e0 b0 e0 ff f1 b1 f1 b1 f1 b1 f1 ff ; sprite_0c (TILE_0c) &4900 40 d0 f0 f0 f0 f0 f0 f0 00 00 40 d0 f0 f0 f0 f0 &4910 00 00 00 00 40 d0 f0 f0 00 00 00 00 00 00 40 d0 &4920 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 &4930 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 ; sprite_0d (TILE_0d) &4940 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &4950 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &4960 40 d0 f0 f0 f0 f0 f0 f0 00 00 40 d0 f0 f0 f0 f0 &4970 00 00 00 00 40 d0 f0 f0 00 00 00 00 00 00 40 d0 ; sprite_0e (TILE_0e) &4980 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 &4990 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 &49a0 f0 f0 f0 f0 f0 f0 d0 40 f0 f0 f0 f0 d0 40 00 00 &49b0 f0 f0 d0 40 00 00 00 00 d0 40 00 00 00 00 00 00 ; sprite_0f (TILE_0f) &49c0 f0 f0 f0 f0 f0 f0 d0 40 f0 f0 f0 f0 d0 40 00 00 &49d0 f0 f0 d0 40 00 00 00 00 d0 40 00 00 00 00 00 00 &49e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &49f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; sprite_10 (TILE_10) &4a00 fc fc fc fc fc fc fc fc f0 f0 f0 f0 f0 f0 f0 f0 &4a10 f0 f0 f0 f0 f0 f0 f0 f0 c0 c0 c0 c0 c0 c0 c0 c0 &4a20 fc fc fc fc fc fc a0 50 f0 f0 f0 f0 f0 f0 a0 50 &4a30 f0 f0 f0 f0 f0 f0 a0 50 c0 c0 c0 c0 c0 c0 a0 50 ; sprite_11 (TILE_11) &4a40 fa f5 fc fc fc fc fc fc fa f5 f0 f0 f0 f0 f0 f0 &4a50 fa f5 f0 f0 f0 f0 f0 f0 fa f5 c0 c0 c0 c0 c0 c0 &4a60 fc fc fc fc fc fc fc fc f0 f0 f0 f0 f0 f0 f0 f0 &4a70 f0 f0 f0 f0 f0 f0 f0 f0 c0 c0 c0 c0 c0 c0 c0 c0 ; sprite_12 (TILE_12) &4a80 00 10 00 10 00 10 00 10 f0 70 f0 70 f0 70 f0 70 &4a90 f0 f0 f0 f0 f0 f0 f0 f0 c0 c0 c0 c0 c0 c0 c0 c0 &4aa0 00 10 00 10 00 10 20 50 f0 70 f0 70 f0 70 a0 50 &4ab0 f0 f0 f0 f0 f0 f0 a0 50 c0 c0 c0 c0 c0 c0 a0 50 ; sprite_13 (TILE_13) &4ac0 fa 75 00 10 00 10 00 10 fa f5 f0 70 f0 70 f0 70 &4ad0 fa f5 f0 f0 f0 f0 f0 f0 fa f5 c0 c0 c0 c0 c0 c0 &4ae0 00 10 00 10 00 10 00 10 f0 70 f0 70 f0 70 f0 70 &4af0 f0 f0 f0 f0 f0 f0 f0 f0 c0 c0 c0 c0 c0 c0 c0 c0 ; sprite_14 (TILE_14) &4b00 ff cf cd cf cd cf cd cf ff 07 0d 07 0d 07 0d 07 &4b10 ff 07 0d 07 0d 07 0d 07 f0 f0 70 f0 70 b0 70 b0 &4b20 cd cf cd cf cd cf cd cf 0d 07 0d 07 0d 07 0d 07 &4b30 0d 07 0d 07 0d 07 0d 07 50 b0 50 b0 50 a0 50 a0 ; sprite_15 (TILE_15) &4b40 cd cf cd cf cd cf cd cf 0d 07 0d 07 0d 07 0d 07 &4b50 0d 07 0d 07 0d 07 0d 07 50 a0 50 a0 50 a0 50 a0 &4b60 d0 e0 f0 f0 f0 f0 f0 f0 50 a0 50 a0 d0 f0 f0 f0 &4b70 50 a0 50 a0 50 f0 f0 f0 50 a0 50 a0 50 f0 f0 f0 ; sprite_16 (TILE_16) &4b80 f0 f0 f0 f0 f0 f0 f7 f7 f0 f0 f0 f0 f0 f0 fe fe &4b90 f0 f0 f0 f0 f0 f0 f7 f7 f0 f0 f0 f0 f0 f0 fe fe &4ba0 f0 f0 f0 f0 f0 f0 f1 f1 f0 f0 f0 f0 f0 f0 f8 fe &4bb0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 ; sprite_17 (TILE_17) &4bc0 ff f1 f1 f0 f0 f0 f0 f0 ff fe f8 f0 f0 f0 f0 f0 &4bd0 ff f0 f0 f0 f0 f0 f0 f0 f3 f0 f0 f0 f0 f0 f0 f0 &4be0 f0 f0 f7 f7 f0 f0 f0 f0 f0 f0 fe fe f0 f0 f0 f0 &4bf0 f0 f0 f7 f7 f0 f0 f0 f0 f0 f0 fe fe f0 f0 f0 f0 ; sprite_18 (TILE_18) &4c00 ff f8 f8 f8 f8 f8 f8 f8 ff f0 f0 f0 f0 f0 f0 f0 &4c10 ff f0 f0 f0 f0 f0 f0 f0 fe e0 e0 e0 e0 e0 e0 e0 &4c20 f8 f8 f8 f8 f8 f8 f8 80 f0 f0 f0 f0 f0 f0 f0 00 &4c30 f0 f0 f0 f0 f0 f0 f0 00 e0 e0 e0 e0 e0 e0 e0 00 ; sprite_19 (TILE_19) &4c40 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 &4c50 f0 f0 f0 f0 f0 f0 f0 f0 e0 d0 e0 d0 e0 d0 e0 d0 &4c60 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 &4c70 f0 f0 f0 f0 f0 f0 f0 f0 e0 d0 e0 d0 e0 d0 e0 d0 ; sprite_1a (TILE_1a) &4c80 a0 50 00 00 00 00 00 00 a0 50 00 00 00 00 00 00 &4c90 a0 50 00 00 00 00 00 00 a0 50 00 00 00 00 00 00 &4ca0 00 00 00 00 00 00 ff ff 00 00 00 00 00 00 ff ff &4cb0 00 00 00 00 00 00 ff ff 00 00 00 00 00 00 ff ff ; sprite_1b (TILE_1b) &4cc0 cd cf cd cf cd cf cd cf 0d 07 0d 07 0d 07 0d 07 &4cd0 0d 07 0d 07 0d 07 0d 07 50 a0 50 a0 50 a0 50 a0 &4ce0 cd cf cd cf cd cf cd cf 0d 07 0d 07 0d 07 0d 07 &4cf0 0d 07 0d 07 0d 07 0d 07 50 a0 50 a0 50 a0 50 a0 ; sprite_1c (TILE_1c) &4d00 f0 f7 f7 f6 f6 f6 f6 f6 f0 ff ff f0 ff ff fc fd &4d10 f0 ff ff f0 ff ff f0 fe f0 fe dc d0 d8 50 50 50 &4d20 f6 f6 f6 f6 f6 f6 c4 f0 fd fd fd fc 88 f0 00 f0 &4d30 dc d8 10 f0 00 f0 00 f0 50 50 50 50 50 d0 10 f0 ; sprite_1d (TILE_1d) &4d40 cd cf cd cf cd cf cd cf 0d 07 0d 07 0d 07 0d 07 &4d50 0d 07 0d 07 0d 07 0d 07 50 a0 50 a0 50 a0 50 a0 &4d60 d0 e0 f0 f0 f0 f0 a0 50 50 a0 50 a0 d0 f0 a0 50 &4d70 50 a0 50 a0 50 f0 a0 50 50 a0 50 a0 50 f0 a0 50 ; sprite_1e (TILE_1e) &4d80 a0 50 00 00 00 00 00 00 a0 50 00 00 00 00 00 00 &4d90 a0 50 00 00 00 00 00 00 a0 50 00 00 00 00 00 00 &4da0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &4db0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; sprite_1f (TILE_1f) &4dc0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &4dd0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &4de0 00 00 00 00 00 00 fa f5 00 00 00 00 00 00 fa f5 &4df0 00 00 00 00 00 00 fa f5 00 00 00 00 00 00 fa f5 ; sprite_20 (TILE_20) &4e00 f0 80 b0 b0 b0 b0 b0 b0 f0 00 f0 f0 f0 f0 f0 f0 &4e10 f0 00 f0 f0 f0 f0 f0 f0 f0 32 f6 f6 f6 f6 f6 f6 &4e20 b0 b0 b0 b0 b0 b3 f7 f0 f0 f0 f0 f0 f0 ff ff f0 &4e30 f0 f0 f0 f0 f0 ff ff f0 f6 f6 f6 f6 f6 fe fe f0 ; sprite_21 (TILE_21) &4e40 f0 80 80 81 81 81 81 81 f0 00 00 0f 0f 0f 0f 0f &4e50 f0 00 00 0f 0f 0f 0f 0f f0 32 76 f6 f6 f6 f6 f6 &4e60 81 81 81 81 90 b3 f7 f0 0f 0f 0f 0f f0 ff ff f0 &4e70 0f 0f 0f 0f f0 ff ff f0 f6 f6 f6 f6 f6 fe fe f0 ; sprite_22 (TILE_TANK_TOP_LEFT) &4e80 f0 f0 f0 f0 f0 f0 f7 f7 f0 f0 f0 f0 f0 f0 fe fe &4e90 f0 f0 f0 f0 f0 f0 f7 f7 f0 f0 f0 f0 f0 f0 fe fe &4ea0 f2 f2 ff 00 f2 f3 f2 f2 f6 f1 ff 00 f0 ff f0 ff &4eb0 f0 f8 ff 00 f0 fe f1 f8 f0 f0 ff 00 f6 f1 f0 f8 ; sprite_23 (TILE_TANK_BOTTOM_LEFT) &4ec0 f2 f2 f2 f2 f2 e2 f2 ff ee 88 f8 00 f0 00 f0 ff &4ed0 b0 b0 b0 70 e0 10 f0 ff f4 d0 b0 70 f0 e0 90 ff &4ee0 00 f2 f6 c4 f0 f0 f0 f0 00 e0 90 76 f0 f0 f0 f0 &4ef0 00 70 f7 f7 f0 f0 f0 f0 00 f0 fe fe f0 f0 f0 f0 ; sprite_24 (TILE_TANK_TOP_RIGHT) &4f00 f0 f0 f0 f0 f0 f0 f7 f7 f0 f0 f0 f0 f0 f0 fe fe &4f10 f0 f0 f0 f0 f0 f0 f7 f7 f0 f0 f0 f0 f0 f0 fe fe &4f20 f0 f0 ff 00 f0 f8 f7 f1 f0 f0 f8 70 f0 f0 f0 fc &4f30 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 ; sprite_25 (TILE_TANK_BOTTOM_RIGHT) &4f40 fc fa 30 e0 90 70 f0 ff f7 f1 90 70 f0 f0 f0 f8 &4f50 fe f8 f0 f0 f0 f0 f0 f0 f7 f0 f0 f0 f0 f0 f0 f0 &4f60 00 f0 f7 f7 f0 f0 f0 f0 70 f0 fe fe f0 f0 f0 f0 &4f70 f0 f0 f7 f7 f0 f0 f0 f0 f0 f0 fe fe f0 f0 f0 f0 ; sprite_26 (TILE_26) &4f80 fa f5 f0 ff cd cf cd cf fa f5 f0 ff 0d 07 0d 07 &4f90 fa f5 f0 ff 0d 07 0d 07 fa f5 f0 f0 70 f0 70 b0 &4fa0 cd cf cd cf cd cf cd cf 0d 07 0d 07 0d 07 0d 07 &4fb0 0d 07 0d 07 0d 07 0d 07 70 b0 70 b0 50 b0 50 b0 ; sprite_27 (TILE_27) &4fc0 ff cd cf cd cf cd cf cd ff 0d 07 0d 07 0d 07 0d &4fd0 ff 0d 07 0d 07 0d 07 0d ff 0d 07 0d 07 0d 07 0d &4fe0 cf d0 e0 f0 f0 f0 f0 f0 07 50 a0 50 a0 f0 f0 f0 &4ff0 07 50 a0 50 a0 f0 f0 f0 07 50 a0 50 a0 f0 f0 f0 ; sprite_28 (TILE_28) &5000 ff 0d 07 0d 07 0d 07 0d ff 0d 07 0d 07 0d 07 0d &5010 ff 0d 07 0d 07 0d 07 0d ff 0d 07 0d 07 0d 07 0d &5020 07 50 a0 50 a0 f0 f0 f0 07 50 a0 50 a0 f0 f0 f0 &5030 07 50 a0 50 a0 f0 f0 f0 07 50 a0 50 a0 f0 f0 f0 ; sprite_29 (TILE_29) &5040 ff 0d 07 0d 07 0d 07 0d ff 0d 07 0d 07 0d 07 0d &5050 ee 1c 06 1c 06 1c 06 1c f0 f0 f0 70 f0 70 b0 70 &5060 07 50 a0 50 a0 f0 f0 f0 07 50 a0 50 a0 f0 f0 f0 &5070 06 50 a0 50 a0 f0 f0 f0 b0 50 b0 50 a0 f0 f0 f0 ; sprite_2a (TILE_2a) &5080 ff ff fc fc fc fc 88 00 ee cc c0 c0 c0 c0 00 00 &5090 ff ff fc fc fc fc 88 00 ee cc c0 c0 c0 c0 00 00 &50a0 ff ff fc fc fc fc 88 00 ee cc c0 c0 c0 c0 00 00 &50b0 ff ff fc fc fc fc 88 00 ee cc c0 c0 c0 c0 00 00 ; sprite_2b (TILE_RUNWAY_TOP) &50c0 f0 f0 f0 f0 f0 f0 fc ff f0 f0 f0 f0 f0 f0 f0 f0 &50d0 f0 f0 f0 f0 f0 f0 f7 f7 f0 f0 f0 f0 f0 f0 fe fe &50e0 ff ff fc f0 f0 f0 fc ff fc f0 f0 f0 f0 f0 f0 f0 &50f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 ; sprite_2c (TILE_RUNWAY_BOTTOM) &5100 ff ff fc f0 f0 f0 f0 fc fc f0 f0 f0 f0 f0 f0 f0 &5110 f7 f0 f0 f0 f0 f0 f0 f0 f3 f0 f0 f0 f0 f0 f0 f0 &5120 ff ff ff fc f0 f0 f0 f0 f0 fc f0 f0 f0 f0 f0 f0 &5130 f0 f0 f7 f7 f0 f0 f0 f0 f0 f0 fe fe f0 f0 f0 f0 ; sprite_2d (TILE_2d) &5140 0f 0f 0f f0 0f 0f ff 8f 87 97 97 97 1f 1f ff 0f &5150 0f ff 0f 0f 0f 0f 0f 0f 1e 9e 96 96 96 96 96 96 &5160 8f 8f 8f 8f 8f f8 0f f0 0f 0f 0f 0f 0f f0 0f f0 &5170 0f 78 4b 4b 4b c3 0f f0 96 96 1e 1e 1e 1e 1e f0 ; sprite_2e (TILE_2e) &5180 f6 f9 f4 f8 f4 f8 f4 f8 fa f5 f0 f0 f0 f0 f0 f0 &5190 fa f5 f0 f0 f0 f0 f0 f0 fa f5 f0 f0 f0 f0 f0 f0 &51a0 f4 f8 f4 f8 f4 f8 f4 f8 f0 f0 f0 f0 f0 f0 f0 f0 &51b0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 ; sprite_2f (TILE_2f) &51c0 f0 f0 f0 f0 f0 f0 f0 f0 f0 e1 f0 f0 f0 e1 f0 f0 &51d0 78 3c 38 d0 78 3c 38 d0 f0 f0 f0 f0 f0 f0 f0 f0 &51e0 f0 f0 f0 f0 f0 f0 f0 f0 f0 e1 f0 f0 f0 e1 f0 f0 &51f0 78 3c 38 d0 78 3c 38 d0 f0 f0 f0 f0 f0 f0 f0 f0 ; sprite_30 (TILE_30) &5200 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 &5210 f0 f0 f0 f0 f0 f0 f0 f0 e0 d0 e0 d0 e0 d0 e0 d0 &5220 f0 f0 f0 f0 f0 f0 a0 50 f0 f0 f0 f0 f0 f0 a0 50 &5230 f0 f0 f0 f0 f0 f0 a0 50 e0 d0 e0 d0 e0 d0 a0 50 ; sprite_31 (TILE_31) &5240 fa f5 f0 f0 f0 f0 f0 f0 fa f5 f0 f0 f0 f0 f0 f0 &5250 fa f5 f0 f0 f0 f0 f0 f0 ea d4 e0 d0 e0 d0 e0 d0 &5260 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 &5270 f0 f0 f0 f0 f0 f0 f0 f0 e0 d0 e0 d0 e0 d0 e0 d0 ; sprite_32 (TILE_32) &5280 f0 f0 f0 f0 f0 f0 b4 1e f0 f0 f0 f0 f0 f0 b4 1e &5290 f0 f0 f0 f0 f0 f0 b4 1e f0 f0 f0 f0 f0 f0 b4 1e &52a0 94 e0 f0 f0 f0 f0 f0 f0 94 e0 f0 f0 f0 f0 f0 f0 &52b0 94 e0 f0 f0 f0 f0 f0 f0 94 e0 f0 f0 f0 f0 f0 f0 ; sprite_33 (TILE_BASE) &52c0 ff 8f 8f 8f 8f 8f 8f 8f ff 0f 0f 0f 0f 0f 0f 0f &52d0 ff 0f 0f 0f ff 8f 8f 8f ff 0f 0f 0f ff 0f 0f ff &52e0 8f 8f 8f 8f 8f 8f 8f 8f 7f 4f 4f 4f 4f 4f 7f 0f &52f0 8f 0f 0f 0f 0f 0f ff 1f 8f 8f 8f f8 0f 0f 0f 0f ; sprite_34 (TILE_34) &5300 f4 f8 f4 f8 f4 f8 f4 f8 f0 f0 f0 f0 f0 f0 f0 f0 &5310 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 &5320 f4 f8 f4 f8 f4 f8 e4 d8 f0 f0 f0 f0 f0 f0 a0 50 &5330 f0 f0 f0 f0 f0 f0 a0 50 f0 f0 f0 f0 f0 f0 a0 50 ; sprite_35 (TILE_35) &5340 ff 0f 0f 0f ff 0f 0f ef ff 0f 1f 1f 9f 97 97 87 &5350 ff 0f ff 0f 0f 0f e1 2f ff 1e de 5a 5a 5a 5a 5a &5360 2d 2d 2d e1 0f 1e 1e 1e f7 1e 1e 1e 1e f0 0f 0f &5370 2f 2f 2f 2f 2f 3e 0f 0f 5a 5a 5a 5a 5a d2 1e 1e ; sprite_36 (TILE_36) &5380 00 00 f0 f0 80 c0 c0 80 00 00 c0 c0 80 f0 f0 80 &5390 00 00 f0 f0 40 c0 c0 40 00 00 c0 c0 40 f0 f0 40 &53a0 f0 f0 00 00 00 00 70 80 c0 c0 00 00 00 00 70 80 &53b0 f0 f0 00 00 00 00 70 80 c0 c0 00 00 00 00 70 80 ; sprite_37 (TILE_37) &53c0 80 70 00 00 00 00 f0 f0 80 70 00 00 00 00 c0 c0 &53d0 80 70 00 00 00 00 f0 f0 80 70 00 00 00 00 c0 c0 &53e0 80 c0 c0 80 f0 f0 00 00 80 f0 f0 80 c0 c0 00 00 &53f0 80 c0 c0 80 f0 f0 00 00 80 f0 f0 80 c0 c0 00 00 ; sprite_38 (TILE_38) &5400 0f 0f 78 f0 f0 f0 f0 f0 0f 0f 96 96 96 0f 0f 96 &5410 0f 0f e1 f0 f0 30 00 c0 f0 f0 f0 f0 f0 f0 30 00 &5420 78 0f 0f f0 f0 f0 f0 f0 96 0f 0f f0 f0 f0 f0 f0 &5430 e1 0f 0f f0 f0 f0 f0 f0 c0 f0 f0 f0 f0 f0 f0 f0 ; sprite_39 (TILE_39) &5440 f0 f0 f0 80 80 f0 f0 30 f0 f0 f0 00 00 30 30 30 &5450 f0 f0 f0 70 70 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 &5460 00 c0 f0 f0 f0 80 80 f0 30 30 30 30 30 00 00 f0 &5470 f0 f0 f0 f0 f0 70 70 f0 f0 f0 f0 f0 f0 f0 f0 f0 ; sprite_3a (TILE_3a) &5480 00 00 20 10 20 10 20 10 00 00 a0 50 a0 50 a0 50 &5490 00 00 a0 50 a0 50 a0 50 00 00 a0 50 a0 50 a0 50 &54a0 20 10 20 10 20 10 33 ff a0 50 a0 50 a0 50 ff ff &54b0 a0 50 a0 50 a0 50 ff ff a0 50 a0 50 a0 50 ff ff ; sprite_3b (TILE_3b) &54c0 00 00 a0 50 a0 50 a0 50 00 00 a0 50 a0 50 a0 50 &54d0 00 00 a0 50 a0 50 a0 50 00 00 b3 73 b3 73 b3 73 &54e0 a0 50 a0 50 a0 50 ff ff a0 50 a0 50 a0 50 ff ff &54f0 a0 50 a0 50 a0 50 ff ff b3 73 b3 73 b3 73 ff ff ; sprite_3c (TILE_3c) &5500 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &5510 00 00 00 00 00 00 00 00 11 33 33 33 33 33 33 33 &5520 00 00 00 00 00 00 77 ff 00 00 00 00 00 00 ff ff &5530 00 00 00 00 00 00 ff ff 33 33 33 33 33 33 ff ff ; sprite_3d (TILE_POD) &5540 f0 f0 f0 f0 f0 f1 f1 f1 f0 f0 f0 f7 8f 0f 0f 0f &5550 f0 f0 f0 f8 7c 3c 1e 0d f0 f0 f0 f0 f0 f0 f0 f0 &5560 f1 f0 f0 f0 f0 f0 f0 f0 0f 8f c2 e1 f0 f0 f0 f0 &5570 0e 0d 0a 05 0a 85 f0 f0 78 34 38 34 38 70 f0 f0 ; sprite_3e (TILE_3e) &5580 fc fc fc fc fc fc fc fc f0 f0 f0 f0 f0 f0 f0 f0 &5590 f0 f0 f0 f0 f0 f0 f0 f0 c0 c0 c0 c0 c0 c0 c0 c0 &55a0 fc fc fc fc fc fc fc fc f0 f0 f0 f0 f0 f0 f0 f0 &55b0 f0 f0 f0 f0 f0 f0 f0 f0 c0 c0 c0 c0 c0 c0 c0 c0 ; sprite_3f (TILE_3f) &55c0 00 10 00 10 00 10 00 10 f0 70 f0 70 f0 70 f0 70 &55d0 f0 f0 f0 f0 f0 f0 f0 f0 c0 c0 c0 c0 c0 c0 c0 c0 &55e0 00 10 00 10 00 10 00 10 f0 70 f0 70 f0 70 f0 70 &55f0 f0 f0 f0 f0 f0 f0 f0 f0 c0 c0 c0 c0 c0 c0 c0 c0 ; sprite_40 (TILE_40) &5600 f0 f0 f1 f3 f6 f4 f5 f5 f0 ff f8 f3 f6 fc f9 f3 &5610 f0 ff f0 dc c0 e8 b8 90 f0 70 30 90 c0 60 20 a0 &5620 f5 f4 d4 c0 e0 f0 f0 f0 60 30 90 c0 70 00 f0 f0 &5630 30 60 c0 10 f0 00 f0 f0 20 60 e0 c0 90 30 f0 f0 ; sprite_41 (TILE_41) &5640 f0 f0 f0 f0 f0 fc ff ff f0 f0 f0 f0 f0 f6 f7 ff &5650 f0 f0 f0 f0 f0 f3 fb ff f0 f0 f0 f0 f0 f0 fc fe &5660 ff fc f0 f0 f0 f0 fc ff f7 f6 f0 f0 f0 f0 f6 f7 &5670 fb f3 f0 f0 f0 f0 f3 fb fc f0 f0 f0 f0 f0 f0 fc ; sprite_42 (TILE_42) &5680 ff ff fc f0 f0 f0 f0 f0 ff f7 f6 f0 f0 f0 f0 f0 &5690 ff fb f3 f0 f0 f0 f0 f0 fe fc f0 f0 f0 f0 f0 f0 &56a0 fc ff ff ff fc f0 f0 f0 f6 f7 ff f7 f6 f0 f0 f0 &56b0 f3 fb ff fb f3 f0 f0 f0 f0 fc fe fc f0 f0 f0 f0 ; sprite_43 (SPRITE_EXPLOSION_ZERO) &56c0 11 33 66 cc cc 66 33 22 00 88 dd 77 00 07 03 03 &56d0 77 ff 99 00 00 11 3b 19 33 66 cc ee ff aa 88 ee &56e0 66 22 33 ee cc 77 33 22 07 07 02 00 ee bb 11 00 &56f0 0c 1d 00 44 ff cc 88 00 ff bb 88 cc ff ff 22 00 ; sprite_44 (SPRITE_EXPLOSION_ONE) &5700 33 66 44 cc ee 77 66 44 88 cc 77 11 00 07 07 0f &5710 22 77 44 cc 00 08 3b 19 77 ff 33 66 44 cc ee cc &5720 45 cc ee 77 77 ff 88 00 0f 0f 07 07 00 bb ee 66 &5730 0c 0f 0e 08 33 ff dd 44 77 33 33 ee 88 cc ee 66 ; sprite_45 (SPRITE_EXPLOSION_TWO) &5740 11 77 33 33 66 66 ff ff 88 cc 66 33 00 03 89 03 &5750 77 77 ee 88 02 0c 19 0c 11 bb ff 77 cc ee cc ff &5760 ee 77 77 33 11 77 ff 99 07 07 00 77 ff cc 88 00 &5770 0e 08 15 11 cc ee ff 22 77 66 cc ee ff ee ee 88 ; sprite_46 (SPRITE_EXPLOSION_THREE) &5780 00 33 99 88 ff 77 11 33 44 ee bb 99 88 01 03 03 &5790 44 66 77 cc 00 0c 0c 19 33 33 ee 88 ee 77 cc 88 &57a0 ff 11 00 ff 11 33 66 00 01 89 89 88 00 ff dd cc &57b0 19 19 08 00 33 ee aa 88 00 ee 77 44 ee ff 77 55 ; sprite_47 (SPRITE_ENEMY_ZERO) &57c0 03 07 1f 2f 2f 0e 07 03 0c 0e 8f 0b 0b 07 1f 2f &57d0 03 07 1f 2f 2f 0e 8f 0b 0c 0e 8f 0b 0b 07 0e 0c &57e0 03 07 1f 2f 2f 0e 07 03 2f 0e 8f 0b 0b 07 0e 0c &57f0 0b 07 1f 2f 2f 0e 07 03 0c 0e 8f 0b 0b 07 0e 0c ; sprite_48 (SPRITE_ENEMY_ONE) &5800 00 30 71 73 e3 e7 c7 c6 f0 f7 cf 0e 08 03 04 05 &5810 f0 fe 3f 07 01 0c 20 a0 00 c0 e8 ec f4 f6 f2 72 &5820 c6 c7 e7 e3 73 71 30 00 14 04 30 80 e0 fc f7 f0 &5830 20 20 c0 10 70 f3 fe f0 72 f2 f6 f4 ec e8 c0 00 ; sprite_49 (SPRITE_ENEMY_TWO) &5840 00 00 00 00 00 77 cf bf 33 67 57 57 32 33 ef d7 &5850 cc 6e ea ea c4 cc 7f eb 00 00 00 00 00 ee 3f fd &5860 bf fc 77 00 00 00 00 00 d7 fe 33 23 57 57 76 33 &5870 eb f7 cc 4c ea ea e6 cc fd f3 ee 00 00 00 00 00 ; sprite_4a (SPRITE_ENEMY_THREE) &5880 11 11 00 cc cc ee 77 33 cc ee 77 33 33 33 ef df &5890 33 77 ee cc cc cc 7f fb 88 88 00 33 33 77 ee cc &58a0 33 77 ee cc cc 00 11 11 df fe 33 33 33 77 ee cc &58b0 fb f7 cc cc cc ee 77 33 cc ee 77 33 33 00 88 88 ; sprite_4b (SPRITE_ENEMY_FOUR) &58c0 0f 6f 4f 0f 0d 04 00 00 08 0c 00 08 0e 4f 1f 27 &58d0 01 03 00 01 07 2f 8f 4a 0f 6f 2f 0f 0b 02 00 00 &58e0 00 00 04 0d 0f 4f 6f 0f 27 1e 4f 0e 08 00 0c 08 &58f0 4a 87 2f 07 01 00 03 01 00 00 02 0b 0f 2f 6f 0f ; sprite_4c (SPRITE_ENEMY_FIVE) &5900 ee fb fd 76 33 00 66 ff 11 33 bb 99 ff cf bf af &5910 88 cc dd 99 ff 3f fd 7d 77 fd fb e6 cc 00 66 ff &5920 ff 66 00 33 76 fd fb ee af bf fc ff 99 bb 33 11 &5930 f5 fd f3 ff 99 dd cc 88 ff 66 00 cc e6 fb fd 77 ; sprite_4d (SPRITE_ENEMY_SIX) &5940 00 33 77 77 ee ee cc ff ff ff dd 11 11 01 03 9e &5950 ff ff bb 88 88 08 0c 97 00 cc ee ee 77 77 33 ff &5960 ff cc ee ee 77 77 33 00 9e 03 01 11 11 dd ff ff &5970 97 0c 08 88 88 bb ff ff ff 33 77 77 ee ee cc 00 ; sprite_4e (SPRITE_ENEMY_SEVEN) &5980 ee ff ff 77 37 16 16 1e 01 0f 8f f8 fc cf a7 97 &5990 08 0f 1f f1 f3 3f 5e 9e 77 ff ff ee ce 86 86 87 &59a0 1e 16 16 37 77 ff ff ee 97 a7 cf fc f8 8f 0f 01 &59b0 9e 5e 3f f3 f1 1f 0f 08 87 86 86 ce ee ff ff 77 ; sprite_4f (TILE_DESTROYED_ZERO) &59c0 f0 f0 e0 c0 e0 f0 f0 f0 f0 f0 e0 40 00 00 00 80 &59d0 f0 70 50 40 00 00 00 00 f0 f0 f0 70 70 30 30 70 &59e0 e0 c0 e0 e0 c0 e0 f0 f0 00 00 00 00 00 b0 f0 f0 &59f0 00 00 00 00 80 c0 f0 f0 f0 30 30 70 70 f0 f0 f0 ; sprite_50 (TILE_DESTROYED_ONE) &5a00 ff ee cc 88 88 ec 88 00 ee cc 40 00 00 00 00 00 &5a10 ff ee cc cc 88 88 00 00 66 00 00 00 00 00 00 00 &5a20 ff ee 88 00 88 cc 88 00 ee cc 40 00 40 40 00 00 &5a30 ff cc 88 cc 88 ec 88 00 ee 88 00 40 00 00 00 00 ; sprite_51 (TILE_DESTROYED_TWO) &5a40 f0 f0 f0 f0 f0 f0 f7 f7 f0 f0 f0 f0 f0 f0 fe fe &5a50 f0 f0 f0 f0 f0 f0 f7 f7 f0 f0 f0 f0 f0 f0 fe fe &5a60 d0 c0 80 00 80 e0 c0 80 10 00 00 00 00 00 00 00 &5a70 60 00 00 00 00 00 00 00 f0 10 10 00 00 00 00 00 ; sprite_52 (TILE_DESTROYED_THREE) &5a80 c0 80 00 c0 00 80 c0 e0 00 00 00 00 00 00 00 00 &5a90 00 00 00 00 00 00 00 00 00 00 00 00 00 00 10 10 &5aa0 f0 f0 f7 f7 f0 f0 f0 f0 80 a0 fe fe f0 f0 f0 f0 &5ab0 80 80 f7 f7 f0 f0 f0 f0 70 f0 fe fe f0 f0 f0 f0 ; sprite_53 (TILE_DESTROYED_FOUR) &5ac0 f0 f0 f0 f0 f0 f0 f7 f7 f0 f0 f0 f0 f0 f0 fe fe &5ad0 f0 f0 f0 f0 f0 f0 f7 f7 f0 f0 f0 f0 f0 f0 fe fe &5ae0 f0 f0 20 00 10 10 00 00 f0 f0 70 70 80 50 40 00 &5af0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 ; sprite_54 (TILE_DESTROYED_FIVE) &5b00 00 00 00 00 00 00 00 20 00 00 10 10 30 10 00 10 &5b10 fe 70 f0 f0 f0 f0 f0 f0 f7 f0 f0 f0 f0 f0 f0 f0 &5b20 30 f0 f7 f7 f0 f0 f0 f0 30 f0 fe fe f0 f0 f0 f0 &5b30 f0 f0 f7 f7 f0 f0 f0 f0 f0 f0 fe fe f0 f0 f0 f0 ; sprite_55 (TILE_DESTROYED_SIX) &5b40 f0 f0 f0 f0 f0 e0 e0 e0 f0 f0 f0 80 07 0f 0f 0f &5b50 f0 f0 f0 70 7c 7c 7c 7c f0 f0 f0 f0 f0 f0 f0 f0 &5b60 e0 f0 f0 f0 f0 f0 f0 f0 0f ff f0 f0 f0 f0 f0 f0 &5b70 f8 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 f0 ; sprite_56 (TILE_DESTROYED_SEVEN) &5b80 8f 9f 9f 9f 9f 9f 9f 9f 0f ff 0f 0f 0f 0f 0f f0 &5b90 1f 9f 97 97 87 f7 0f 0f 0f 0f 0f f0 0f ef 2d 2d &5ba0 8f 8f 8f 8f 8f 8f 8f f8 1f 1f 1f ff 8f f8 0f f0 &5bb0 0f 0f 0f 0f 0f f0 0f f0 2d 2d 2d 2d 2d e1 0f f0 ; sprite_57 (SPRITE_PLAYER_LEFT) &5bc0 00 00 01 13 ff 77 00 00 07 0f 0f cf cf cf 3c 37 &5bd0 0e 0f 6b 6d 0f f0 f1 ff 00 0c 0e 0f 0f 87 c3 c3 &5be0 00 00 77 ff 13 01 00 00 37 3c cf cf cf 0f 0f 07 &5bf0 ff f1 f0 0f 6d 6b 0f 0e c3 c3 87 0f 0f 0e 0c 00 ; sprite_58 (SPRITE_PLAYER_TURNING_ONE) &5c00 00 00 00 01 77 33 00 00 03 07 0f ef ef ef 16 13 &5c10 0c 0f 2f 4f 0f f0 f2 fe 00 08 0c 0e 0e 0e 86 86 &5c20 00 00 33 77 01 00 00 00 13 16 ef ef ef 0f 07 03 &5c30 fe f2 f0 0f 4f 2f 0f 0c 86 86 0e 0e 0e 0c 08 00 ; sprite_59 (SPRITE_PLAYER_TURNING_TWO) &5c40 00 00 00 00 11 00 00 00 01 03 03 77 ff ff 12 11 &5c50 08 0c 4f 8f 0f f0 f2 fe 00 00 00 08 08 08 08 08 &5c60 00 00 00 11 00 00 00 00 11 12 ff ff 77 03 03 01 &5c70 fe f2 f0 0f 8f 4f 0c 08 08 08 08 08 08 00 00 00 ; sprite_5a (SPRITE_PLAYER_TURNING_THREE) &5c80 00 00 00 00 00 00 00 00 01 03 03 33 ff 77 12 11 &5c90 08 0c 0e 8f cf 8f e5 ed 00 00 00 00 00 00 00 00 &5ca0 00 00 00 00 00 00 00 00 11 12 77 ff 33 03 03 01 &5cb0 ed e5 8f cf 8f 0e 0c 08 00 00 00 00 00 00 00 00 ; sprite_5b (SPRITE_PLAYER_TURNING_FOUR) &5cc0 00 00 00 00 00 00 00 00 01 03 07 17 17 07 63 72 &5cd0 08 0c 0e ce ce 0e 6c e4 00 00 00 00 00 00 00 00 &5ce0 00 00 00 00 00 00 00 00 72 63 07 17 17 07 03 01 &5cf0 e4 6c 0e ce ce 0e 0c 08 00 00 00 00 00 00 00 00 ; sprite_5c (SPRITE_PLAYER_TURNING_FIVE) &5d00 00 00 00 00 00 00 00 00 01 03 07 1f 3f 1f 7a 7b &5d10 08 0c 0c cc ff ee 84 88 00 00 00 00 00 00 00 00 &5d20 00 00 00 00 00 00 00 00 7b 7a 1f 3f 1f 07 03 01 &5d30 88 84 ee ff cc 0c 0c 08 00 00 00 00 00 00 00 00 ; sprite_5d (SPRITE_PLAYER_TURNING_SIX) &5d40 00 00 00 01 01 01 01 01 01 03 2f 1f 0f f0 f4 f7 &5d50 08 0c 0c ee ff ff 84 88 00 00 00 00 88 00 00 00 &5d60 01 01 01 01 01 00 00 00 f7 f4 f0 0f 1f 2f 03 01 &5d70 88 84 ff ff ee 0c 0c 08 00 00 00 88 00 00 00 00 ; sprite_5e (SPRITE_PLAYER_TURNING_SEVEN) &5d80 00 01 03 07 07 07 16 16 03 0f 4f 2f 0f f0 f4 f7 &5d90 0c 0e 0f 7f 7f 7f 86 8c 00 00 00 08 ee cc 00 00 &5da0 16 16 07 07 07 03 01 00 f7 f4 f0 0f 2f 4f 0f 03 &5db0 8c 86 7f 7f 7f 0f 0e 0c 00 00 cc ee 08 00 00 00 ; sprite_5f (SPRITE_PLAYER_RIGHT) &5dc0 00 03 07 0f 0f 1e 3c 3c 07 0f 6d 6b 0f f0 f8 ff &5dd0 0e 0f 0f 3f 3f 3f c3 ce 00 00 08 8c ff ee 00 00 &5de0 3c 3c 1e 0f 0f 07 03 00 ff f8 f0 0f 6b 6d 0f 07 &5df0 ce c3 3f 3f 3f 0f 0f 0e 00 00 ee ff 8c 08 00 00 ; sprite_60 (TILE_60) &5e00 00 00 66 46 00 00 cc 8c 00 00 00 00 00 00 00 00 &5e10 00 00 00 cc 8c 00 00 33 00 cc 8c 00 33 23 00 00 &5e20 00 00 00 00 00 33 23 00 00 cc 8c 00 00 00 11 11 &5e30 23 00 00 00 00 00 88 08 00 00 00 cc 8c 00 00 00 ; sprite_61 (TILE_61) &5e40 ff ef cf 8f 56 56 46 46 00 ff 0f c0 e0 e0 f1 23 &5e50 ff ef cf 8f 56 56 46 46 00 33 a3 c0 e0 e0 e0 00 &5e60 ff ef cf 8f 30 76 46 00 00 ff 0f c0 e0 e0 f1 23 &5e70 ff ef cf 8f 30 32 23 00 33 23 80 c0 e0 e0 e0 00 ; sprite_62 (TILE_62) &5e80 00 66 46 11 01 cc 8c 33 00 00 22 13 01 44 26 02 &5e90 00 23 00 23 ab 3b 4f 8c 00 23 46 46 77 8f 08 02 &5ea0 03 00 00 22 13 01 00 00 99 5d 27 23 ce 4e 8d 8c &5eb0 08 09 00 00 04 03 00 0c 02 02 08 04 00 08 04 00 ; sprite_63 (TILE_63) &5ec0 00 02 04 04 8a 7f 07 99 00 00 00 03 04 04 00 0c &5ed0 00 00 08 00 02 00 04 08 00 cc 8c 00 00 00 00 33 &5ee0 8c 11 23 46 04 00 11 67 ce ef 67 77 33 ff 3f 11 &5ef0 00 00 03 08 0a 09 8d 8d 23 08 00 00 11 02 0c 00 ; sprite_64 (TILE_64) &5f00 33 47 04 00 33 cf 8c 11 8c 0a 02 46 8d 2b 46 8c &5f10 00 11 ef 0e 00 88 6e 37 00 88 08 22 46 8c 08 88 &5f20 01 00 00 00 00 00 66 46 2b 03 88 08 11 01 00 00 &5f30 37 03 8c 9d 19 01 00 00 ee ff 1f 2b 2b 23 00 00 ; sprite_65 (TILE_65) &5f40 55 05 00 00 11 01 00 57 33 ff 1f 11 33 bb 7f ff &5f50 08 8c 8d 8c 08 08 0b 08 00 02 02 0c 33 23 04 04 &5f60 77 ff cf 0c 00 00 08 00 ef 8e 08 01 08 08 04 00 &5f70 04 04 02 08 04 66 46 00 00 00 00 08 33 23 00 00 ; sprite_66 (TILE_66) &5f80 f0 f7 c7 c7 e2 e2 e2 e2 f0 f0 ff 00 10 00 00 80 &5f90 f0 fe 8e 8e c4 c4 c4 d4 f0 f0 f0 70 30 10 10 10 &5fa0 f7 c7 c7 c0 e0 f0 f0 f0 f0 ff 00 10 00 00 80 f0 &5fb0 fe 8e 8e 80 c0 e0 f0 f0 f0 f0 70 30 10 10 10 f0 ; sprite_67 (TILE_67) &5fc0 f0 f1 e3 d7 d7 c7 d7 d7 f0 ff 0f bf 26 0f bf 26 &5fd0 f0 fc 0e 7e 4c 1e 6e 5c f0 f0 f0 70 b0 70 b0 70 &5fe0 c7 d7 d7 e1 e0 f0 f0 f0 0f bf 26 0f a0 50 a0 f0 &5ff0 0e 7e 4c 1c a0 50 a0 f0 b0 70 b0 70 b0 70 f0 f0 ; entry_point &6f00 a9 c8 LDA #&c8 ; Read/Write BREAK/ESCAPE effect &6f02 a2 03 LDX #&03 ; Clear memory on next RESET &6f04 a0 00 LDY #&00 &6f06 20 f4 ff JSR &fff4 ; OSBYTE &6f09 78 SEI &6f0a a2 ff LDX #&ff &6f0c 9a TXS ; set_all_vectors_to_reset_loop &6f0d a2 24 LDX #&24 &6f0f ad fc ff LDA &fffc ; os_reset_address_low &6f12 9d 00 02 STA &0200,X ; os_vector_table &6f15 ad fd ff LDA &fffd ; os_reset_address_high &6f18 9d 01 02 STA &0201,X ; os_vector_table + 1 &6f1b ca DEX &6f1c ca DEX &6f1d 10 f0 BPL &6f0f ; set_all_vectors_to_reset_loop ; decrypt_and_move_1200_to_6eff &6f1f a0 00 LDY #&00 &6f21 84 00 STY &00 ; target_address_low &6f23 84 02 STY &02 ; source_address_low &6f25 a9 03 LDA #&03 ; &0300 &6f27 85 01 STA &01 ; target_address_high &6f29 a9 12 LDA #&12 ; &1200 &6f2b 85 03 STA &03 ; source_address_high ; decrypt_and_move_1200_to_6eff_loop # Decrypt and move &1200 - &6eff to &0300 - &5fff &6f2d b1 02 LDA (&02),Y ; source_address &6f2f 20 a1 6f JSR &6fa1 ; decrypt_byte &6f32 91 00 STA (&00),Y ; target_address &6f34 a9 00 LDA #&00 &6f36 91 02 STA (&02),Y ; source_address &6f38 c8 INY &6f39 d0 f2 BNE &6f2d ; decrypt_and_move_1200_to_6eff_loop &6f3b e6 01 INC &01 ; target_address_high &6f3d e6 03 INC &03 ; source_address_high &6f3f a5 03 LDA &03 ; source_address_high &6f41 c9 6f CMP #&6f &6f43 d0 e8 BNE &6f2d ; decrypt_and_move_1200_to_6eff_loop &6f45 a2 0d LDX #&0d ; write_video_registers_loop &6f47 bd ab 6f LDA &6fab,X ; video_register_data &6f4a 8e 00 fe STX &fe00 ; video register number &6f4d 8d 01 fe STA &fe01 ; video register value &6f50 ca DEX &6f51 10 f4 BPL &6f47 ; write_video_registers_loop &6f53 a9 d8 LDA #&d8 # Change to MODE 1 &6f55 8d 20 fe STA &fe20 ; video ULA control register &6f58 a2 0f LDX #&0f # Set PB0-3 as outputs, PB4-7 as input (OS defaults) &6f5a 8e 42 fe STX &fe42 ; System VIA data direction register B &6f5d 8e 40 fe STX &fe40 ; System VIA port B input/output register # Disable Shift Lock LED &6f60 ca DEX ; &e &6f61 8e 40 fe STX &fe40 ; System VIA port B input/output register # Disable Caps Lock LED &6f64 a9 03 LDA #&03 &6f66 8d 40 fe STA &fe40 ; System VIA port B input/output register # Disable keyboard auto-scan &6f69 a9 0c LDA #&0c &6f6b 8d 40 fe STA &fe40 ; System VIA port B input/output register # Set addressable latch B4 to 1 &6f6e a9 05 LDA #&05 &6f70 8d 40 fe STA &fe40 ; System VIA port B input/output register # Set addressable latch B5 to 0, i.e. scroll from &6000 &6f73 a9 56 LDA #&56 ; &0556 = irq1_handler &6f75 8d 04 02 STA &0204 ; irq1_vector_low &6f78 a9 05 LDA #&05 &6f7a 8d 05 02 STA &0205 ; irq1_vector_high &6f7d a9 5d LDA #&5d ; 0101 1101 # Disable all interrupts except Timer 2 and CA1 (v-sync) &6f7f 8d 4e fe STA &fe4e ; System VIA interrupt enable register &6f82 a9 7f LDA #&7f # Disable all interrupts &6f84 8d 6e fe STA &fe6e ; User VIA interrupt enable register &6f87 8d 43 fe STA &fe43 ; System VIA data direction register A # Set top bit as input, low seven bits as output &6f8a a9 00 LDA #&00 &6f8c 8d 4b fe STA &fe4b ; System VIA auxiliary control register # Set timers to generate interrupts &6f8f 8d 08 fe STA &fe08 ; Cassette ACIA control register # Disable interrupts &6f92 2c 18 fe BIT &fe18 ; ADC conversion status on Master &6f95 aa TAX ; wipe_0000_to_01ff_loop # Wipe &0000 - &01ff &6f96 95 00 STA &00,X &6f98 9d 00 01 STA &0100,X &6f9b e8 INX &6f9c d0 f8 BNE &6f96 ; wipe_0000_to_01ff_loop &6f9e 4c 58 09 JMP &0958 ; title_screen ; decrypt_byte &6fa1 84 82 STY &82 ; eor &6fa3 59 bb 6f EOR &6fbb,Y ; decryption_key &6fa6 49 ff EOR #&ff &6fa8 45 82 EOR &82 ; eor &6faa 60 RTS ; video_register_data &6fab 7f ; R0: Horizontal total register &6fac 00 ; R1: Number of characters per line &6fad 5a ; R2: Horizontal sync position register &6fae 28 ; R3: Sync width register &6faf 26 ; R4: Vertical total register &6fb0 60 ; R5: Vertical total adjust register &6fb1 10 ; R6: Vertical displayed register &6fb2 1b ; R7: Vertical sync position &6fb3 01 ; R8: Interlace and delay register &6fb4 07 ; R9: Scan lines per character register &6fb5 20 ; R10: Cursor start register &6fb6 00 ; R11: Cursor end register &6fb7 0c ; R12: Displayed screen start address register (high) # Screen starts at &6000 &6fb8 00 ; R13: Displayed screen start address register (low) ; unused &6fb9 0c 00 ; decryption_key &6fbb 57 68 61 74 20 6f 6e 20 45 61 72 74 68 20 61 72 ; "What on Earth ar" &6fcb 65 20 79 6f 75 20 64 6f 69 6e 67 20 72 65 61 64 ; "e you doing read" &6fdb 69 6e 67 20 74 68 69 73 2e 20 49 20 62 65 74 20 ; "ing this. I bet " &6feb 79 6f 75 20 74 68 69 6e 6b 20 79 6f 75 20 61 72 ; "you think you ar" &6ffb 65 20 61 20 73 6d 61 72 74 20 61 72 73 65 20 66 ; "e a smart arse f" &700b 6f 72 20 62 72 65 61 6b 69 6e 67 20 74 68 65 20 ; "or breaking the " &701b 70 72 6f 74 65 63 74 69 6f 6e 20 74 68 69 73 20 ; "protection this " &702b 66 61 72 2e 20 42 75 74 20 79 6f 75 20 68 61 76 ; "far. But you hav" &703b 65 20 61 63 68 69 65 76 65 64 20 6e 6f 74 68 69 ; "e achieved nothi" &704b 6e 67 2c 20 61 73 20 74 68 65 20 70 72 6f 74 65 ; "ng, as the prote" &705b 63 74 69 6f 6e 20 77 61 73 20 72 61 74 68 65 72 ; "ction was rather" &706b 20 74 72 69 76 69 61 6c 20 74 6f 20 73 74 61 72 ; " trivial to star" &707b 74 20 77 69 74 68 2e 2e 2e 20 4a 75 73 74 20 66 ; "t with... Just f" &708b 75 63 6b 20 6f 66 66 20 61 6e 64 20 64 6f 20 6e ; "uck off and do n" &709b 6f 74 20 63 6f 6d 65 20 62 61 63 6b 2e 2e 2e 20 ; "ot come back... " &70ab 42 79 20 74 68 65 20 77 61 79 2c 20 79 6f 75 20 ; "By the way, you " ; unused &70bb 6d 61 6b 65 20 6d 61 6b 65 20 6d 65 20 70 75 6b ; "make make me puk" &70cb 65 2c 20 70 75 6b 65 2c 20 70 75 6b 65 2c 20 76 ; "e, puke, puke, v" &70db 6f 6d 69 74 2c 20 73 70 65 77 2c 20 70 75 6b 65 ; "omit, spew, puke" &70eb 2e 2e 2e 2e 20 42 79 20 74 68 65 20 77 61 79 2c ; ".... By the way," &70fb 20 69 66 20 49 20 65 76 65 72 20 66 69 6e 64 20 ; " if I ever find " &710b 6f 75 74 20 77 68 6f 20 70 75 74 20 61 20 62 72 ; "out who put a br" &711b 69 63 6b 20 74 68 72 6f 75 67 68 20 74 68 65 20 ; "ick through the " &712b 77 69 6e 64 6f 77 20 6f 66 20 6d 79 20 33 20 64 ; "window of my 3 d" &713b 61 79 20 6f 6c 64 20 54 61 6c 62 6f 74 20 53 75 ; "ay old Talbot Su" &714b 6e 62 65 61 6d 20 31 2e 33 4c 53 20 61 6e 64 20 ; "nbeam 1.3LS and " &715b 73 74 6f 6c 65 20 6d 79 20 63 61 72 20 73 74 65 ; "stole my car ste" &716b 72 65 6f 2c 20 49 20 73 68 61 6c 6c 20 70 65 72 ; "reo, I shall per" &717b 73 6f 6e 61 6c 6c 79 20 72 69 70 20 74 68 65 6d ; "sonally rip them" &718b 20 61 70 61 72 74 20 61 6e 64 20 49 20 61 6d 20 ; " apart and I am " &719b 6e 6f 74 20 6a 6f 6b 69 6e 67 2e 2e 2e ; "not joking..." ; unused &71a8 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &71b8 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &71c8 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &71d8 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &71e8 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &71f8 00 00 00 00 00 00 00 00