Cybertron Mission disassembly ============================= Cybertron Mission was written by Matthew Bates, and was published by Micro Power Ltd Software for the BBC Micro in 1983. It is an arcade adventure in which the player must collect objects in an electrified maze, while avoiding killer robots. The following disassembly was created by reverse engineering binary images, without access to any source code. It is nevertheless reasonably complete, allowing the technical approaches used to be understood. The author of this disassembly imposes no additional copyright restrictions beyond those already present on the game itself. It is provided for educational purposes only, and it is hoped that the original authors will accept it in the good faith it was intended - as a tribute to their skills. Interesting pokes ================= &1a9e = &ad infinite lives &1029 = &6f complete level without collecting all objects Game disassembly ================ # &08c0 - &095f and &0b00 - &0baf are initialised by BASIC loader ; os_envelope_data &08c0 81 ff ff ff 1e 1e 1e 64 ff ff ff 64 00 00 00 00 ; 1 # Player firing, enemy firing &08d0 01 00 00 00 00 00 00 7f ff 00 00 7e 00 00 00 00 ; 2 # Player dying &08e0 01 ce 64 ce 01 01 01 7e 00 00 82 7f 00 00 00 00 ; 3 # Touching wall &08f0 01 04 04 fc 05 05 0a 7e 00 00 82 7f 00 00 00 00 ; 4 # Collecting object &0900 01 01 fe 01 0a 0a 0a 7e 00 00 00 14 00 00 00 00 ; 5 # Background siren &0910 01 00 00 00 00 00 00 7e 00 00 fc 7f 00 00 00 00 ; 6 # Plotting item on level introduction &0920 81 0d 0d 0d 64 64 64 7f 00 00 fe 7e 00 00 00 00 ; 7 # Completing level &0930 81 2d 55 3f 46 46 46 7f 00 00 fe 7e 00 00 00 00 ; 8 # End of game &0940 81 10 10 10 64 64 64 06 00 00 ff 7e 00 00 00 00 ; 9 # Stunning spook &0950 81 00 00 00 00 00 00 7f ff ff ff 7e 00 00 00 00 ; a # Extra life ; sound_data ; chan vol pitch dur &0b00 12 00 01 00 c8 00 19 00 ; &00 # Player firing &0b08 13 00 01 00 96 00 19 00 ; &01 # Player firing &0b10 11 00 00 00 64 00 0e 00 ; &02 # Player dying, enemy dying &0b18 10 00 02 00 07 00 19 00 ; &03 # Player dying, enemy dying &0b20 12 00 03 00 c8 00 1e 00 ; &04 # Touching wall &0b28 12 00 04 00 64 00 04 00 ; &05 # Collecting object &0b30 12 00 04 00 8c 00 14 00 ; &06 # (unused, high siren on channel 2) &0b38 10 00 f9 ff 05 00 01 00 ; &07 # Walking &0b40 10 00 f9 ff 06 00 01 00 ; &08 # Walking &0b48 02 00 05 00 32 00 ff ff ; &09 # Background siren &0b50 03 00 05 00 3c 00 ff ff ; &0a # Background siren &0b58 12 00 01 00 64 00 0a 00 ; &0b # Enemy firing &0b60 13 00 00 00 00 00 00 00 ; &0c # Silence channel 3 &0b68 10 00 06 00 05 00 01 00 ; &0d # Plotting item on level introduction &0b70 12 00 02 00 1e 00 28 00 ; &0e # (unused, low bong on channel 2) &0b78 13 00 02 00 1e 00 28 00 ; &0f # (unused, low bong on channel 3) &0b80 12 00 00 00 00 00 00 00 ; &10 # Silence channel 2 &0b88 01 00 00 00 00 00 00 00 ; &11 # Silence channel 1 &0b90 12 00 07 00 00 00 2d 00 ; &12 # Completing level &0b98 11 00 08 00 00 00 1e 00 ; &13 # End of game &0ba0 11 00 09 00 00 00 06 00 ; &14 # Stunning spook &0ba8 12 00 0a 00 c8 00 19 00 ; &15 # Extra life ; CYBER ; 00001900 00004F80 3880 # &1900 - &3b7f is moved to &0d80 - &2fff at &4f92 ; check_for_high_score &0d80 a2 04 LDX #&04 ; check_for_high_score_loop &0d82 ca DEX &0d83 30 0b BMI &0d90 ; set_high_score &0d85 bd ec 0c LDA &0cec,X ; score &0d88 dd b0 0b CMP &0bb0,X ; high_score &0d8b f0 f5 BEQ &0d82 ; check_for_high_score_loop &0d8d 10 01 BPL &0d90 ; set_high_score &0d8f 60 RTS ; set_high_score &0d90 a2 03 LDX #&03 ; set_high_score_loop &0d92 bd ec 0c LDA &0cec,X ; score &0d95 9d b0 0b STA &0bb0,X ; high_score &0d98 ca DEX &0d99 10 f7 BPL &0d92 ; set_high_score_loop &0d9b 60 RTS ; push_high_score_and_score_into_scrolltext &0d9c a2 03 LDX #&03 &0d9e a0 00 LDY #&00 ; push_high_score_and_score_into_scrolltext_loop &0da0 bd b0 0b LDA &0bb0,X ; high_score &0da3 38 SEC &0da4 e9 10 SBC #&10 &0da6 99 99 26 STA &2699,Y ; scrolltext + &21 &0da9 bd ec 0c LDA &0cec,X ; score &0dac 38 SEC &0dad e9 10 SBC #&10 &0daf 99 86 26 STA &2686,Y ; scrolltext + &0e &0db2 c8 INY &0db3 ca DEX &0db4 10 ea BPL &0da0 ; push_high_score_and_score_into_scrolltext_loop &0db6 60 RTS ; clear_screen &0db7 20 ba 1f JSR &1fba ; set_all_colours_to_black &0dba a9 0c LDA #&0c ; CLS &0dbc 4c ee ff JMP &ffee ; OSWRCH ; plot_filled_wall &0dbf ad b6 0b LDA &0bb6 ; level_ones &0dc2 29 03 AND #&03 &0dc4 85 76 STA &76 ; offset &0dc6 18 CLC &0dc7 65 76 ADC &76 ; offset &0dc9 65 76 ADC &76 ; offset &0dcb 0a ASL A &0dcc 0a ASL A &0dcd 0a ASL A &0dce aa TAX # X = (level_ones & 3) * 24 &0dcf a0 00 LDY #&00 &0dd1 bd a0 07 LDA &07a0,X ; wall_sprites ; plot_filled_wall_loop &0dd4 91 70 STA (&70),Y ; screen_address &0dd6 c8 INY &0dd7 e8 INX &0dd8 c0 18 CPY #&18 &0dda d0 f5 BNE &0dd1 ; plot_filled_wall_loop &0ddc 60 RTS ; wait_for_vsync &0ddd ad 03 0c LDA &0c03 ; os_version # Zero if OS 0.10 &0de0 f0 05 BEQ &0de7 ; is_os_0.10 &0de2 a9 13 LDA #&13 ; Wait for vertical retrace &0de4 4c f4 ff JMP &fff4 ; OSBYTE ; is_os_0.10 &0de7 ad 24 02 LDA &0224 ; os_0.10_flashing_colours_counter ; wait_for_counter &0dea cd 24 02 CMP &0224 ; os_0.10_flashing_colours_counter &0ded f0 fb BEQ &0dea ; wait_for_counter &0def 60 RTS ; unused &0df0 00 55 66 6c 64 00 8d b2 0c 00 8c 5e 70 00 00 00 ; unused &0e00 ea &0e01 ea ; initialise_screen_then_title_screen &0e02 20 b4 13 JSR &13b4 ; initialise_screen ; title_screen &0e05 a9 0c LDA #&0c &0e07 20 4d 22 JSR &224d ; play_sound # Silence channel 3 &0e0a a9 10 LDA #&10 &0e0c 20 4d 22 JSR &224d ; play_sound # Silence channel 2 &0e0f 20 b7 0d JSR &0db7 ; clear_screen &0e12 20 45 11 JSR &1145 ; keys_screen &0e15 20 c5 1f JSR &1fc5 ; use_game_colours &0e18 20 2e 0e JSR &0e2e ; check_for_title_screen_keypresses # Returns carry set if SPACE/fire pressed &0e1b b0 68 BCS &0e85 ; start_game &0e1d 20 b7 0d JSR &0db7 ; clear_screen &0e20 20 75 11 JSR &1175 ; information_screen &0e23 20 c5 1f JSR &1fc5 ; use_game_colours &0e26 20 2e 0e JSR &0e2e ; check_for_title_screen_keypresses # Returns carry set if SPACE/fire pressed &0e29 b0 5a BCS &0e85 ; start_game &0e2b 4c 05 0e JMP &0e05 ; title_screen ; check_for_title_screen_keypresses &0e2e a9 04 LDA #&04 ; G &0e30 8d 06 27 STA &2706 ; text_colour &0e33 a9 00 LDA #&00 &0e35 85 76 STA &76 ; title_screen_cooldown_low &0e37 85 79 STA &79 ; item_offset # Unnecessary code &0e39 85 78 STA &78 ; scrolltext_x_fraction &0e3b 85 77 STA &77 ; scrolltext_text_offset &0e3d a9 02 LDA #&02 &0e3f 85 75 STA &75 ; title_screen_cooldown_high &0e41 ad 03 0c LDA &0c03 ; os_version # Zero if OS 0.10 &0e44 f0 01 BEQ &0e47 ; skip_disabling_interrupts &0e46 78 SEI ; skip_disabling_interrupts ; title_screen_loop &0e47 a9 02 LDA #&02 &0e49 20 07 13 JSR &1307 ; wait_for_A_vsyncs &0e4c 20 41 13 JSR &1341 ; update_scrolltext &0e4f a2 9d LDX #&9d ; SPACE &0e51 20 aa 13 JSR &13aa ; check_for_keypress &0e54 f0 08 BEQ &0e5e ; space_not_pressed &0e56 a9 00 LDA #&00 &0e58 8d eb 0c STA &0ceb ; input_method # Set to zero to use keyboard &0e5b 58 CLI &0e5c 38 SEC # Leave with carry set to start game &0e5d 60 RTS ; space_not_pressed &0e5e a2 8f LDX #&8f ; ESCAPE &0e60 20 aa 13 JSR &13aa ; check_for_keypress &0e63 f0 02 BEQ &0e67 ; escape_not_pressed &0e65 18 CLC # Leave with carry clear to change screen &0e66 60 RTS ; escape_not_pressed &0e67 a9 80 LDA #&80 ; Read ADC channel &0e69 a2 00 LDX #&00 ; joystick buttons &0e6b 20 f4 ff JSR &fff4 ; OSBYTE &0e6e 8a TXA &0e6f 29 01 AND #&01 &0e71 f0 08 BEQ &0e7b ; fire_not_pressed &0e73 a9 01 LDA #&01 &0e75 8d eb 0c STA &0ceb ; input_method # Set to non-zero to use joystick &0e78 58 CLI &0e79 38 SEC # Leave with carry set to start game &0e7a 60 RTS ; fire_not_pressed &0e7b c6 76 DEC &76 ; title_screen_cooldown_low &0e7d d0 c8 BNE &0e47 ; title_screen_loop &0e7f c6 75 DEC &75 ; title_screen_cooldown_high &0e81 d0 c4 BNE &0e47 ; title_screen_loop &0e83 18 CLC # Leave with carry clear to change screen &0e84 60 RTS ; start_game &0e85 a9 04 LDA #&04 &0e87 8d b4 0b STA &0bb4 ; player_lives # Start game with four lives &0e8a a9 00 LDA #&00 &0e8c 85 32 STA &32 ; player_room # Start game in room one, floor one &0e8e a9 00 LDA #&00 &0e90 85 b8 STA &b8 ; difficulty &0e92 8d b7 0b STA &0bb7 ; level_tens &0e95 a9 01 LDA #&01 &0e97 8d b6 0b STA &0bb6 ; level_ones # Start game on level one &0e9a a9 20 LDA #&20 ; SPRITE_ZERO &0e9c a2 03 LDX #&03 ; initialise_score_loop &0e9e 9d ec 0c STA &0cec,X ; score &0ea1 ca DEX &0ea2 10 fa BPL &0e9e ; initialise_score_loop ; start_level &0ea4 20 b7 0d JSR &0db7 ; clear_screen &0ea7 a9 00 LDA #&00 ; DIRECTION_DOWN &0ea9 8d b5 0b STA &0bb5 ; previous_player_direction_entered_room # Unnecessary code &0eac 85 cf STA &cf ; rooms_visited &0eae 20 fe 11 JSR &11fe ; level_introduction_screen &0eb1 ad b7 0b LDA &0bb7 ; level_tens &0eb4 d0 0b BNE &0ec1 ; skip_setting_difficulty &0eb6 ad b6 0b LDA &0bb6 ; level_ones &0eb9 c9 06 CMP #&06 &0ebb 10 04 BPL &0ec1 ; skip_setting_difficulty &0ebd 85 b8 STA &b8 ; difficulty &0ebf c6 b8 DEC &b8 ; difficulty # Difficult is 0 to 5 for levels 1 to 6, then 5 thereafter ; skip_setting_difficulty ; start_life &0ec1 ad b5 0b LDA &0bb5 ; previous_player_direction_entered_room &0ec4 85 37 STA &37 ; player_direction_entered_room &0ec6 a9 01 LDA #&01 &0ec8 85 80 STA &80 ; enemies_remaining &0eca 20 35 17 JSR &1735 ; initialise_room &0ecd a9 00 LDA #&00 &0ecf 85 82 STA &82 ; player_death_timer # Set to zero to indicate player not dead &0ed1 85 3e STA &3e ; player_wants_to_fire # Set to zero to indicate player doesn't want to fire &0ed3 85 3f STA &3f ; player_x_velocity &0ed5 85 40 STA &40 ; player_y_velocity &0ed7 85 43 STA &43 ; spook_was_hit_by_bullet # Set to zero to indicate spook not hit by bullet &0ed9 20 4e 18 JSR &184e ; play_game &0edc 20 b7 0d JSR &0db7 ; clear_screen &0edf ad b4 0b LDA &0bb4 ; player_lives &0ee2 10 dd BPL &0ec1 ; start_life &0ee4 20 c5 1f JSR &1fc5 ; use_game_colours &0ee7 a2 e5 LDX #&e5 ; "END OF GAME" &0ee9 a9 00 LDA #&00 ; &5300 = screen_memory + &280 * 14 &0eeb a0 53 LDY #&53 &0eed 20 38 11 JSR &1138 ; plot_game_text &0ef0 a9 13 LDA #&13 &0ef2 20 4d 22 JSR &224d ; play_sound # Play sound for end of game &0ef5 a9 50 LDA #&50 &0ef7 20 07 13 JSR &1307 ; wait_for_A_vsyncs &0efa 4c 05 0e JMP &0e05 ; title_screen &0efd 60 RTS ; plot_wall # Called with X = x, Y = y &0efe a9 00 LDA #&00 # wall_type has &01 set if wall continues up &0f00 85 71 STA &71 ; screen_address_high # &02 set if wall continues down &0f02 86 70 STX &70 ; screen_address_low # &04 set if wall continues left &0f04 8a TXA ; x # &08 set if wall continues right &0f05 20 c0 13 JSR &13c0 ; add_to_screen_address # * 2 &0f08 8a TXA &0f09 20 c0 13 JSR &13c0 ; add_to_screen_address # * 3 &0f0c e6 70 INC &70 ; screen_address_low &0f0e a2 03 LDX #&03 ; 8 &0f10 20 b3 0f JSR &0fb3 ; multiply_screen_address_by_power_of_two # screen_address = x * &18 &0f13 a9 00 LDA #&00 &0f15 85 73 STA &73 ; offset_high &0f17 84 72 STY &72 ; offset_low &0f19 98 TYA &0f1a 20 a7 0f JSR &0fa7 ; add_to_offset # * 2 &0f1d 98 TYA &0f1e 20 a7 0f JSR &0fa7 ; add_to_offset # * 3 &0f21 98 TYA &0f22 20 a7 0f JSR &0fa7 ; add_to_offset # * 4 &0f25 98 TYA &0f26 20 a7 0f JSR &0fa7 ; add_to_offset # * 5 &0f29 a2 07 LDX #&07 ; 128 &0f2b 20 e0 13 JSR &13e0 ; multiply_offset_by_power_of_two # offset = y * &280 &0f2e 18 CLC &0f2f a5 70 LDA &70 ; screen_address_low &0f31 65 72 ADC &72 ; offset_low &0f33 85 70 STA &70 ; screen_address_low &0f35 a5 71 LDA &71 ; screen_address_high &0f37 65 73 ADC &73 ; offset_high &0f39 85 71 STA &71 ; screen_address_high &0f3b 18 CLC &0f3c a5 71 LDA &71 ; screen_address_high # screen_address = &3000 + y * &280 + x * &18 &0f3e 69 30 ADC #&30 ; &3000 = screen_memory &0f40 85 71 STA &71 ; screen_address_high &0f42 a9 00 LDA #&00 &0f44 85 74 STA &74 ; column &0f46 85 77 STA &77 ; screen_offset &0f48 a0 17 LDY #&17 &0f4a a5 47 LDA &47 ; wall_type &0f4c f0 53 BEQ &0fa1 ; plot_space ; not_space ; plot_wall_column_loop ; plot_outer_top_row_of_wall &0f4e a5 47 LDA &47 ; wall_type &0f50 4a LSR A # ....8421 -> .....842 1 &0f51 08 PHP &0f52 4a LSR A # -> ......84 2 &0f53 28 PLP # -> ......84 1 &0f54 2a ROL A # -> .....841, i.e. lose WALL_CONTINUES_DOWN &0f55 85 78 STA &78 ; unused # Unused &0f57 aa TAX &0f58 bd d7 2f LDA &2fd7,X ; wall_outer_rows_table &0f5b a8 TAY &0f5c 20 bb 0f JSR &0fbb ; plot_byte_of_wall ; plot_inner_top_row_of_wall &0f5f a5 47 LDA &47 ; wall_type &0f61 4a LSR A # ....8421 -> .....842 1 &0f62 08 PHP &0f63 4a LSR A # -> ......84 2 &0f64 28 PLP # -> ......84 1 &0f65 2a ROL A # -> .....841, i.e. lose WALL_CONTINUES_DOWN &0f66 aa TAX &0f67 bd cf 2f LDA &2fcf,X ; wall_inner_rows_table &0f6a a8 TAY &0f6b 20 bb 0f JSR &0fbb ; plot_byte_of_wall ; plot_middle_rows_of_wall ; plot_middle_rows_of_wall_loop &0f6e a5 47 LDA &47 ; wall_type &0f70 4a LSR A # ....8421 -> .....842 &0f71 4a LSR A # -> ......84 &0f72 aa TAX # i.e. lose WALL_CONTINUES_DOWN and WALL_CONTINUES_UP &0f73 bd cb 2f LDA &2fcb,X ; wall_middle_table &0f76 a8 TAY &0f77 20 bb 0f JSR &0fbb ; plot_byte_of_wall &0f7a a5 77 LDA &77 ; screen_offset &0f7c 29 07 AND #&07 &0f7e c9 06 CMP #&06 &0f80 30 ec BMI &0f6e ; plot_middle_rows_of_wall_loop ; plot_inner_bottom_row_of_wall &0f82 a5 47 LDA &47 ; wall_type &0f84 4a LSR A # ....8421 -> .....842, i.e. lose WALL_CONTINUES_UP &0f85 aa TAX &0f86 bd cf 2f LDA &2fcf,X ; wall_inner_rows_table &0f89 a8 TAY &0f8a 20 bb 0f JSR &0fbb ; plot_byte_of_wall ; plot_outer_bottom_row_of_wall &0f8d a5 47 LDA &47 ; wall_type &0f8f 4a LSR A # ....8421 -> .....842, i.e. lose WALL_CONTINUES_UP &0f90 aa TAX &0f91 bd d7 2f LDA &2fd7,X ; wall_outer_rows_table &0f94 a8 TAY &0f95 20 bb 0f JSR &0fbb ; plot_byte_of_wall &0f98 e6 74 INC &74 ; column &0f9a a5 74 LDA &74 ; column &0f9c c9 03 CMP #&03 &0f9e d0 ae BNE &0f4e ; plot_wall_column_loop &0fa0 60 RTS ; plot_space ; plot_space_loop &0fa1 91 70 STA (&70),Y ; screen_address &0fa3 88 DEY &0fa4 10 fb BPL &0fa1 ; plot_space_loop &0fa6 60 RTS ; add_to_offset &0fa7 18 CLC &0fa8 65 72 ADC &72 ; offset_low &0faa 85 72 STA &72 ; offset_low &0fac a5 73 LDA &73 ; offset_high &0fae 69 00 ADC #&00 &0fb0 85 73 STA &73 ; offset_high &0fb2 60 RTS ; multiply_screen_address_by_power_of_two ; multiply_screen_address_by_power_of_two_loop &0fb3 06 70 ASL &70 ; screen_address_low &0fb5 26 71 ROL &71 ; screen_address_high &0fb7 ca DEX &0fb8 d0 f9 BNE &0fb3 ; multiply_screen_address_by_power_of_two_loop &0fba 60 RTS ; plot_byte_of_wall &0fbb a9 2f LDA #&2f ; &2fxx = wall_sprites_column_*_data &0fbd 85 76 STA &76 ; wall_sprite_address_high &0fbf a6 74 LDX &74 ; column &0fc1 bd c8 2f LDA &2fc8,X ; wall_sprite_column_addresses_low_table &0fc4 85 75 STA &75 ; wall_sprite_address_low &0fc6 b1 75 LDA (&75),Y ; wall_sprite_address &0fc8 a4 77 LDY &77 ; screen_offset &0fca 91 70 STA (&70),Y ; screen_address &0fcc e6 77 INC &77 ; screen_offset &0fce 60 RTS ; unplot_object &0fcf a9 00 LDA #&00 ; PLOT_MODE_EOR &0fd1 85 31 STA &31 ; plot_mode &0fd3 4c fb 13 JMP &13fb ; plot_sprite ; check_for_collecting_objects &0fd6 a9 00 LDA #&00 &0fd8 85 30 STA &30 ; collision &0fda a2 ff LDX #&ff ; check_for_collecting_objects_loop &0fdc e8 INX &0fdd a5 32 LDA &32 ; player_room &0fdf 29 0f AND #&0f &0fe1 dd 14 0c CMP &0c14,X ; objects_room &0fe4 d0 f6 BNE &0fdc ; check_for_collecting_objects_loop &0fe6 e0 00 CPX #&00 ; OBJECT_SAFE &0fe8 f0 29 BEQ &1013 ; is_safe ; is_object &0fea a9 01 LDA #&01 &0fec 9d 0d 0c STA &0c0d,X ; objects_collected # Set to non-zero to indicate object collected &0fef 86 77 STX &77 ; collected_object_slot &0ff1 8a TXA &0ff2 18 CLC &0ff3 69 36 ADC #&36 ; SLOT_FIRST_OBJECT &0ff5 aa TAX &0ff6 20 cf 0f JSR &0fcf ; unplot_object &0ff9 a9 05 LDA #&05 &0ffb 20 4d 22 JSR &224d ; play_sound # Play sound for collecting object &0ffe a6 77 LDX &77 ; collected_object_slot &1000 e0 06 CPX #&06 ; OBJECT_MAGIC_POTION &1002 f0 06 BEQ &100a ; is_magic_potion &1004 bd 37 27 LDA &2737,X ; object_types_score &1007 4c 49 23 JMP &2349 ; add_to_score # Score for collecting object ; is_magic_potion &100a 20 d8 12 JSR &12d8 ; initialise_magic_potion # Put magic potion somewhere else on level &100d ee b4 0b INC &0bb4 ; player_lives # Gain life for collecting magic potion &1010 4c a8 23 JMP &23a8 ; plot_lives ; is_safe &1013 a2 00 LDX #&00 ; check_if_all_objects_collected_loop &1015 e8 INX &1016 bd 0d 0c LDA &0c0d,X ; objects_collected &1019 c9 01 CMP #&01 # One if object collected, but not yet in safe &101b d0 07 BNE &1024 ; skip_counting &101d a9 ff LDA #&ff &101f 9d 0d 0c STA &0c0d,X ; objects_collected # Set to &ff to indicate object in safe &1022 e6 4e INC &4e ; number_of_objects_in_safe ; skip_counting &1024 e4 6f CPX &6f ; number_of_objects_in_level &1026 d0 ed BNE &1015 ; check_if_all_objects_collected_loop &1028 e4 4e CPX &4e ; number_of_objects_in_safe &102a f0 16 BEQ &1042 ; level_complete ; not_complete &102c a5 3f LDA &3f ; player_x_velocity &102e 49 ff EOR #&ff # Invert velocity to move player away from safe &1030 85 3f STA &3f ; player_x_velocity &1032 e6 3f INC &3f ; player_x_velocity &1034 a5 40 LDA &40 ; player_y_velocity &1036 49 ff EOR #&ff &1038 85 40 STA &40 ; player_y_velocity &103a e6 40 INC &40 ; player_y_velocity &103c 20 18 17 JSR &1718 ; apply_player_velocities &103f 4c bb 19 JMP &19bb ; set_player_velocities_to_zero ; level_complete &1042 ee b4 0b INC &0bb4 ; player_lives &1045 ee b6 0b INC &0bb6 ; level_ones &1048 ad b6 0b LDA &0bb6 ; level_ones &104b c9 0a CMP #&0a &104d d0 08 BNE &1057 ; skip_overflow &104f a9 00 LDA #&00 &1051 8d b6 0b STA &0bb6 ; level_ones &1054 ee b7 0b INC &0bb7 ; level_tens ; skip_overflow &1057 a5 32 LDA &32 ; player_room &1059 18 CLC &105a 69 10 ADC #&10 # Move to next floor plan &105c 29 30 AND #&30 &105e 85 32 STA &32 ; player_room &1060 a9 12 LDA #&12 &1062 20 4d 22 JSR &224d ; play_sound # Play sound for completing level &1065 a9 32 LDA #&32 ; 50 &1067 20 07 13 JSR &1307 ; wait_for_A_vsyncs &106a 68 PLA # Remove call to check_for_collecting_objects from stack &106b 68 PLA &106c 68 PLA # Remove call to play_game from stack &106d 68 PLA &106e 4c a4 0e JMP &0ea4 ; start_level ; plot_half_of_double_height_text &1071 a9 00 LDA #&00 &1073 8d 00 0a STA &0a00 ; text_offset ; plot_half_of_double_height_text_loop &1076 ae 00 0a LDX &0a00 ; text_offset &1079 bd ca 0c LDA &0cca,X ; text_buffer &107c 85 72 STA &72 ; font_address_low &107e a9 00 LDA #&00 &1080 85 73 STA &73 ; font_address_high &1082 a2 03 LDX #&03 ; 8 &1084 20 e0 13 JSR &13e0 ; multiply_font_address_by_power_of_two &1087 a5 73 LDA &73 ; font_address_high &1089 18 CLC &108a 69 c0 ADC #&c0 ; &c000 = os_font_data &108c 85 73 STA &73 ; font_address_high &108e ac 40 0a LDY &0a40 ; text_half ; copy_character_data_loop &1091 98 TYA &1092 29 03 AND #&03 &1094 aa TAX &1095 b1 72 LDA (&72),Y ; font_address &1097 9d e6 0c STA &0ce6,X ; character_data &109a c8 INY &109b 98 TYA &109c 29 03 AND #&03 &109e d0 f1 BNE &1091 ; copy_character_data_loop &10a0 a9 00 LDA #&00 &10a2 85 33 STA &33 ; column ; plot_double_height_character_column_loop &10a4 a9 00 LDA #&00 &10a6 85 40 STA &40 ; row &10a8 a0 00 LDY #&00 ; plot_double_height_character_row_loop &10aa a9 00 LDA #&00 ; PLOT_MODE_EOR &10ac 85 31 STA &31 ; plot_mode &10ae a6 40 LDX &40 ; row_in_character &10b0 bd e6 0c LDA &0ce6,X ; character_data &10b3 29 80 AND #&80 &10b5 f0 06 BEQ &10bd ; skip_adding_left_pixel &10b7 ad 06 27 LDA &2706 ; text_colour &10ba 0a ASL A &10bb 85 31 STA &31 ; pixel_pair ; skip_adding_left_pixel &10bd bd e6 0c LDA &0ce6,X ; character_data &10c0 29 40 AND #&40 &10c2 f0 07 BEQ &10cb ; skip_adding_right_pixel &10c4 ad 06 27 LDA &2706 ; text_colour &10c7 05 31 ORA &31 ; pixel_pair &10c9 85 31 STA &31 ; pixel_pair ; skip_adding_right_pixel &10cb 1e e6 0c ASL &0ce6,X ; character_data &10ce 1e e6 0c ASL &0ce6,X ; character_data &10d1 a5 31 LDA &31 ; pixel_pair &10d3 91 70 STA (&70),Y ; screen_address &10d5 c8 INY &10d6 91 70 STA (&70),Y ; screen_address &10d8 e6 40 INC &40 ; row &10da c8 INY &10db c0 08 CPY #&08 &10dd d0 cb BNE &10aa ; plot_double_height_character_row_loop &10df a9 08 LDA #&08 # Move right two pixels &10e1 20 c0 13 JSR &13c0 ; add_to_screen_address &10e4 e6 33 INC &33 ; column &10e6 a5 33 LDA &33 ; column &10e8 c9 04 CMP #&04 &10ea d0 b8 BNE &10a4 ; plot_double_height_character_column_loop &10ec ee 00 0a INC &0a00 ; text_offset &10ef ad 00 0a LDA &0a00 ; text_offset &10f2 c5 8f CMP &8f ; text_length &10f4 d0 01 BNE &10f7 ; to_plot_half_of_double_height_text_loop &10f6 60 RTS ; to_plot_half_of_double_height_text_loop &10f7 4c 76 10 JMP &1076 ; plot_half_of_double_height_text_loop ; plot_double_height_text &10fa a9 14 LDA #&14 ; 20 &10fc 85 8f STA &8f ; text_length &10fe a9 00 LDA #&00 &1100 8d 40 0a STA &0a40 ; text_half &1103 20 71 10 JSR &1071 ; plot_half_of_double_height_text # Plot top half of double height text &1106 a9 04 LDA #&04 &1108 8d 40 0a STA &0a40 ; text_half &110b 4c 71 10 JMP &1071 ; plot_half_of_double_height_text # Plot bottom half of double height text ; write_string ; write_string_loop &110e bd 00 26 LDA &2600,X ; strings &1111 f0 07 BEQ &111a ; leave # Zero indicates end of string &1113 20 ee ff JSR &ffee ; OSWRCH &1116 e8 INX &1117 4c 0e 11 JMP &110e ; write_string_loop ; leave &111a 60 RTS ; copy_game_text &111b bd 00 25 LDA &2500,X ; game_text - &7c # First byte of text is offset into buffer, i.e. padding &111e a8 TAY &111f e8 INX ; copy_game_text_loop &1120 bd 00 25 LDA &2500,X ; game_text - &7c &1123 30 f5 BMI &111a ; leave &1125 99 ca 0c STA &0cca,Y ; text_buffer &1128 c8 INY &1129 e8 INX &112a 4c 20 11 JMP &1120 ; copy_game_text_loop ; clear_text_buffer &112d a0 13 LDY #&13 ; 19 &112f a9 00 LDA #&00 ; " " - &20 ; clear_text_buffer_loop &1131 99 ca 0c STA &0cca,Y ; text_buffer &1134 88 DEY &1135 10 fa BPL &1131 ; clear_text_buffer_loop &1137 60 RTS ; plot_game_text # Called with AY = screen address, X = text offset &1138 85 70 STA &70 ; screen_address_low &113a 84 71 STY &71 ; screen_address_high &113c 20 2d 11 JSR &112d ; clear_text_buffer &113f 20 1b 11 JSR &111b ; copy_game_text &1142 4c fa 10 JMP &10fa ; plot_double_height_text ; keys_screen &1145 a9 04 LDA #&04 ; G &1147 8d 06 27 STA &2706 ; text_colour &114a a2 00 LDX #&00 # Write list of keys &114c 20 0e 11 JSR &110e ; write_string &114f 20 80 0d JSR &0d80 ; check_for_high_score &1152 20 9c 0d JSR &0d9c ; push_high_score_and_score_into_scrolltext &1155 a9 10 LDA #&10 ; &3010 = screen_memory + 8 * 2 &1157 a0 30 LDY #&30 &1159 a2 7c LDX #&7c ; "CYBERTRON" &115b 20 38 11 JSR &1138 ; plot_game_text &115e a9 80 LDA #&80 ; &3780 = screen_memory + &280 * 3 &1160 a0 37 LDY #&37 &1162 a2 f2 LDX #&f2 ; "KEYS" &1164 20 38 11 JSR &1138 ; plot_game_text &1167 a9 04 LDA #&04 ; G &1169 8d 06 27 STA &2706 ; text_colour &116c a2 87 LDX #&87 ; "PRESS SPACE TO START" &116e a0 6e LDY #&6e ; &6e80 = screen_memory + &280 * 25 &1170 a9 80 LDA #&80 &1172 4c 38 11 JMP &1138 ; plot_game_text ; information_screen &1175 a9 04 LDA #&04 ; G &1177 8d 06 27 STA &2706 ; text_colour &117a a2 00 LDX #&00 ; plot_information_screen_text_loop &117c 86 79 STX &79 ; item_offset &117e bc 68 25 LDY &2568,X ; information_screen_text_screen_addresses_high_table &1181 bd 5e 25 LDA &255e,X ; information_screen_text_offsets_table &1184 85 78 STA &78 ; text_offset &1186 bd 72 25 LDA &2572,X ; information_screen_screen_addresses_low_table &1189 a6 78 LDX &78 ; text_offset &118b 20 38 11 JSR &1138 ; plot_game_text # Plot item name &118e a6 79 LDX &79 ; item_offset &1190 e8 INX &1191 a9 10 LDA #&10 ; B &1193 8d 06 27 STA &2706 ; text_colour &1196 e0 09 CPX #&09 &1198 d0 e2 BNE &117c ; plot_information_screen_text_loop &119a a9 44 LDA #&44 ; &4490 = screen_memory + &280 * 8 + 8 * 18 &119c 8d c0 0a STA &0ac0 ; sprites_screen_address_high + 0 (SLOT_TRANSIENT_SPRITE) &119f a9 90 LDA #&90 &11a1 8d 80 0a STA &0a80 ; sprites_screen_address_low + 0 (SLOT_TRANSIENT_SPRITE) &11a4 a9 01 LDA #&01 &11a6 8d 40 0a STA &0a40 ; sprites_y + 0 (SLOT_TRANSIENT_SPRITE) &11a9 a2 00 LDX #&00 ; PLOT_MODE_EOR &11ab 86 31 STX &31 ; plot_mode ; plot_information_screen_sprites_loop &11ad 86 79 STX &79 ; item_offset &11af bd 57 25 LDA &2557,X ; information_screen_sprites &11b2 8d 00 2f STA &2f00 ; sprites_sprite + 0 (SLOT_TRANSIENT_SPRITE) &11b5 a2 00 LDX #&00 ; SLOT_TRANSIENT_SPRITE &11b7 20 fb 13 JSR &13fb ; plot_sprite # Plot item sprite &11ba ad 80 0a LDA &0a80 ; sprites_screen_address_low + 0 (SLOT_TRANSIENT_SPRITE) &11bd 18 CLC &11be 69 80 ADC #&80 ; &780 = &280 * 3 # Move down three groups &11c0 8d 80 0a STA &0a80 ; sprites_screen_address_low + 0 (SLOT_TRANSIENT_SPRITE) &11c3 ad c0 0a LDA &0ac0 ; sprites_screen_address_high + 0 (SLOT_TRANSIENT_SPRITE) &11c6 69 07 ADC #&07 &11c8 8d c0 0a STA &0ac0 ; sprites_screen_address_high + 0 (SLOT_TRANSIENT_SPRITE) &11cb a6 79 LDX &79 ; item_offset &11cd e8 INX &11ce e0 07 CPX #&07 &11d0 d0 db BNE &11ad ; plot_information_screen_sprites_loop &11d2 a9 00 LDA #&00 &11d4 8d 40 0a STA &0a40 ; sprites_y + 0 (SLOT_TRANSIENT_SPRITE) &11d7 a9 3d LDA #&3d ; &3d10 = screen_memory + &280 * 5 + 8 * 18 &11d9 8d c0 0a STA &0ac0 ; sprites_screen_address_high + 0 (SLOT_TRANSIENT_SPRITE) &11dc a9 10 LDA #&10 &11de 8d 80 0a STA &0a80 ; sprites_screen_address_low + 0 (SLOT_TRANSIENT_SPRITE) &11e1 a9 2e LDA #&2e ; SPRITE_SPOOK_TOP &11e3 8d 00 2f STA &2f00 ; sprites_sprite + 0 (SLOT_TRANSIENT_SPRITE) &11e6 a2 00 LDX #&00 ; SLOT_TRANSIENT_SPRITE &11e8 20 fb 13 JSR &13fb ; plot_sprite # Plot top of spook &11eb a9 3f LDA #&3f ; &3f90 = screen_memory + &280 * 6 + 8 * 18 &11ed 8d c0 0a STA &0ac0 ; sprites_screen_address_high + 0 (SLOT_TRANSIENT_SPRITE) &11f0 a9 90 LDA #&90 &11f2 8d 80 0a STA &0a80 ; sprites_screen_address_low + 0 (SLOT_TRANSIENT_SPRITE) &11f5 ee 00 2f INC &2f00 ; sprites_sprite + 0 (SLOT_TRANSIENT_SPRITE) &11f8 a2 00 LDX #&00 ; SLOT_TRANSIENT_SPRITE &11fa 20 fb 13 JSR &13fb ; plot_sprite # Plot bottom of spook &11fd 60 RTS ; level_introduction_screen &11fe a9 01 LDA #&01 ; R &1200 8d 06 27 STA &2706 ; text_colour &1203 20 bf 12 JSR &12bf ; initialise_objects &1206 20 c5 1f JSR &1fc5 ; use_game_colours &1209 a9 00 LDA #&00 ; PLOT_MODE_EOR &120b 85 4e STA &4e ; number_of_objects_in_safe &120d 85 31 STA &31 ; plot_mode &120f a2 b8 LDX #&b8 ; "ENTERING" &1211 20 0e 11 JSR &110e ; write_string &1214 20 2d 11 JSR &112d ; clear_text_buffer &1217 a2 de LDX #&de ; "LEVEL" &1219 20 1b 11 JSR &111b ; copy_game_text &121c ad b7 0b LDA &0bb7 ; level_tens &121f f0 06 BEQ &1227 ; skip_tens &1221 18 CLC &1222 69 10 ADC #&10 ; "0" - &20 &1224 8d d6 0c STA &0cd6 ; text_buffer + &c ; skip_tens &1227 ad b6 0b LDA &0bb6 ; level_ones &122a 18 CLC &122b 69 10 ADC #&10 ; "0" - &20 &122d 8d d7 0c STA &0cd7 ; text_buffer + &d &1230 a9 00 LDA #&00 ; &4900 = screen_memory + &280 * 10 &1232 85 70 STA &70 ; screen_address_low &1234 a9 49 LDA #&49 &1236 85 71 STA &71 ; screen_address_high &1238 20 fa 10 JSR &10fa ; plot_double_height_text # Plot LEVEL and level number &123b a2 c6 LDX #&c6 ; "FIND THE FOLLOWING" &123d 20 0e 11 JSR &110e ; write_string &1240 a9 b0 LDA #&b0 ; &60b0 = screen_memory + &280 * 19 + 8 * 38 &1242 8d 80 0a STA &0a80 ; sprites_screen_address_low + 0 (SLOT_TRANSIENT_SPRITE) &1245 a9 60 LDA #&60 &1247 8d c0 0a STA &0ac0 ; sprites_screen_address_high + 0 (SLOT_TRANSIENT_SPRITE) &124a ad b7 0b LDA &0bb7 ; level_tens &124d d0 07 BNE &1256 ; use_ceiling &124f ad b6 0b LDA &0bb6 ; level_ones &1252 c9 06 CMP #&06 &1254 30 02 BMI &1258 ; skip_ceiling ; use_ceiling &1256 a9 05 LDA #&05 # Maximum number of items to find is five ; skip_ceiling &1258 aa TAX &1259 ca DEX ; plot_items_to_find_loop &125a 86 79 STX &79 ; item_offset &125c bd 00 27 LDA &2700,X ; items_to_find_sprites_table &125f 8d 00 2f STA &2f00 ; sprites_sprite + 0 (SLOT_TRANSIENT_SPRITE) &1262 a9 14 LDA #&14 ; 20 &1264 20 07 13 JSR &1307 ; wait_for_A_vsyncs &1267 a2 00 LDX #&00 &1269 20 fb 13 JSR &13fb ; plot_sprite &126c ad c0 0a LDA &0ac0 ; sprites_screen_address_high + 0 (SLOT_TRANSIENT_SPRITE) &126f 18 CLC &1270 69 05 ADC #&05 ; &500 = &280 * 2 # Move down two groups &1272 8d c0 0a STA &0ac0 ; sprites_screen_address_high + 0 (SLOT_TRANSIENT_SPRITE) &1275 a9 0d LDA #&0d &1277 20 4d 22 JSR &224d ; play_sound # Play sound for plotting item on level introduction &127a a6 79 LDX &79 ; item_offset &127c ca DEX &127d 10 db BPL &125a ; plot_items_to_find_loop &127f a9 64 LDA #&64 ; 100 &1281 20 07 13 JSR &1307 ; wait_for_A_vsyncs &1284 4c b7 0d JMP &0db7 ; clear_screen ; check_for_player_joystick_input &1287 a9 80 LDA #&80 ; Read ADC channel &1289 a2 01 LDX #&01 ; first joystick x &128b 20 f4 ff JSR &fff4 ; OSBYTE &128e c0 40 CPY #&40 &1290 90 09 BCC &129b ; is_right &1292 c0 c0 CPY #&c0 &1294 90 07 BCC &129d ; consider_y ; is_left &1296 c6 3f DEC &3f ; player_x_velocity &1298 4c 9d 12 JMP &129d ; consider_y ; is_right &129b e6 3f INC &3f ; player_x_velocity ; consider_y &129d a9 80 LDA #&80 ; Read ADC channel &129f a2 02 LDX #&02 ; first joystick y &12a1 20 f4 ff JSR &fff4 ; OSBYTE &12a4 c0 40 CPY #&40 &12a6 90 09 BCC &12b1 ; is_down &12a8 c0 c0 CPY #&c0 &12aa 90 07 BCC &12b3 ; consider_fire ; is_up &12ac c6 40 DEC &40 ; player_y_velocity &12ae 4c b3 12 JMP &12b3 ; consider_fire ; is_down &12b1 e6 40 INC &40 ; player_y_velocity ; consider_fire &12b3 a9 80 LDA #&80 ; Read ADC channel &12b5 a2 00 LDX #&00 ; joystick buttons &12b7 20 f4 ff JSR &fff4 ; OSBYTE &12ba 8a TXA &12bb 29 01 AND #&01 &12bd aa TAX &12be 60 RTS # Leave with X = &01 if fire button pressed ; initialise_objects &12bf ad b7 0b LDA &0bb7 ; level_tens &12c2 d0 07 BNE &12cb ; use_ceiling &12c4 ae b6 0b LDX &0bb6 ; level_ones &12c7 e0 06 CPX #&06 &12c9 30 02 BMI &12cd ; skip_ceiling ; use_ceiling &12cb a2 05 LDX #&05 # Maximum number of items to find is five ; skip_ceiling &12cd 86 6f STX &6f ; number_of_objects_in_level &12cf a2 ff LDX #&ff # Will become zero on first pass ; initialise_objects_loop &12d1 20 dd 12 JSR &12dd ; initialise_object &12d4 e4 6f CPX &6f ; number_of_objects_in_level &12d6 30 f9 BMI &12d1 ; initialise_objects_loop ; initialise_magic_potion &12d8 a2 05 LDX #&05 ; OBJECT_MAGIC_POTION - 1 # Will become six (OBJECT_MAGIC_POTION) &12da 4c dd 12 JMP &12dd ; initialise_object # Unnecessary code ; initialise_object &12dd e8 INX &12de 8e 00 0a STX &0a00 ; object_to_initialise ; find_room_for_object_loop &12e1 20 b5 1d JSR &1db5 ; rnd &12e4 a5 44 LDA &44 ; rnd_output &12e6 29 0f AND #&0f # Pick a random room for this object &12e8 ae 00 0a LDX &0a00 ; object_to_initialise &12eb 9d 14 0c STA &0c14,X ; objects_room &12ee a9 00 LDA #&00 &12f0 9d 0d 0c STA &0c0d,X ; objects_collected # Set to zero to indicate object not collected &12f3 a0 ff LDY #&ff # Will become zero on first pass ; check_no_other_object_in_room_loop &12f5 c8 INY &12f6 cc 00 0a CPY &0a00 ; object_to_initialise # For each of the previously placed objects, &12f9 f0 0b BEQ &1306 ; leave &12fb b9 14 0c LDA &0c14,Y ; objects_room &12fe dd 14 0c CMP &0c14,X ; objects_room # check that they aren't in the same room &1301 f0 de BEQ &12e1 ; find_room_for_object_loop &1303 4c f5 12 JMP &12f5 ; check_no_other_object_in_room_loop # If they are, find another room for this object ; leave &1306 60 RTS ; wait_for_A_vsyncs &1307 85 4c STA &4c ; count ; wait_for_A_vsyncs_loop &1309 20 dd 0d JSR &0ddd ; wait_for_vsync &130c c6 4c DEC &4c ; count &130e d0 f9 BNE &1309 ; wait_for_A_vsyncs_loop &1310 60 RTS ; check_for_spook_touching_player &1311 ad 66 0c LDA &0c66 ; spook_appearance_cooldown # Non-zero if spook not present &1314 d0 2a BNE &1340 ; no_collision &1316 a9 00 LDA #&00 &1318 85 30 STA &30 ; collision # Set to zero to indicate spook not touching player &131a ad 10 0a LDA &0a10 ; sprites_x + &10 (SLOT_PLAYER_HEAD) &131d 38 SEC &131e ed 0e 0a SBC &0a0e ; sprites_x + &0e (SLOT_SPOOK_TOP) &1321 10 05 BPL &1328 ; skip_x_inversion &1323 49 ff EOR #&ff &1325 18 CLC &1326 69 01 ADC #&01 ; skip_x_inversion &1328 c9 03 CMP #&03 # Is spook close to player horizontally? &132a 10 14 BPL &1340 ; no_collision &132c ad 50 0a LDA &0a50 ; sprites_y + &10 (SLOT_PLAYER_HEAD) &132f 38 SEC &1330 ed 4e 0a SBC &0a4e ; sprites_y + &0e (SLOT_SPOOK_TOP) &1333 10 05 BPL &133a ; skip_y_inversion &1335 49 ff EOR #&ff &1337 18 CLC &1338 69 01 ADC #&01 ; skip_y_inversion &133a c9 04 CMP #&04 # and vertically? &133c 10 02 BPL &1340 ; no_collision &133e e6 30 INC &30 ; collision # Set to non-zero to indicate spook touching player ; no_collision &1340 60 RTS ; update_scrolltext &1341 a5 78 LDA &78 ; scrolltext_x_fraction &1343 c9 18 CMP #&18 &1345 d0 0d BNE &1354 ; skip_wiping_left_of_scrolltext &1347 a2 17 LDX #&17 ; wipe_left_of_scrolltext_loop &1349 a9 00 LDA #&00 &134b 9d 90 7b STA &7b90,X ; screen_memory + &280 * 30 + 8 * 18 # Wipe top group &134e 9d 10 7e STA &7e10,X ; screen_memory + &280 * 31 + 8 * 18 # Wipe bottom group &1351 ca DEX &1352 10 f5 BPL &1349 ; wipe_left_of_scrolltext_loop ; skip_wiping_left_of_scrolltext &1354 a0 7b LDY #&7b ; &7b90 = screen_memory + &280 * 30 + 8 * 18 &1356 84 71 STY &71 ; screen_address_high &1358 a5 78 LDA &78 ; scrolltext_x_fraction &135a 18 CLC &135b 69 90 ADC #&90 &135d 85 70 STA &70 ; screen_address_high &135f 20 2d 11 JSR &112d ; clear_text_buffer &1362 a0 00 LDY #&00 &1364 a6 77 LDX &77 ; scrolltext_text_offset ; copy_scrolltext_into_text_buffer_loop &1366 bd 78 26 LDA &2678,X ; scrolltext &1369 99 ca 0c STA &0cca,Y ; text_buffer &136c e8 INX &136d 8a TXA &136e 29 3f AND #&3f # Wrap around scrolltext &1370 aa TAX &1371 c8 INY &1372 c0 0a CPY #&0a ; 10 &1374 d0 f0 BNE &1366 ; copy_scrolltext_into_text_buffer_loop &1376 20 dd 0d JSR &0ddd ; wait_for_vsync &1379 a9 00 LDA #&00 &137b 8d 40 0a STA &0a40 ; text_half &137e a9 0b LDA #&0b &1380 85 8f STA &8f ; text_length &1382 20 71 10 JSR &1071 ; plot_half_of_double_height_text # Plot top half of scrolltext &1385 e6 71 INC &71 ; screen_address_high &1387 a9 20 LDA #&20 &1389 20 c0 13 JSR &13c0 ; add_to_screen_address &138c a9 04 LDA #&04 &138e 8d 40 0a STA &0a40 ; text_half &1391 20 71 10 JSR &1071 ; plot_half_of_double_height_text # Plot bottom half of scrolltext &1394 a5 78 LDA &78 ; scrolltext_x_fraction &1396 38 SEC &1397 e9 08 SBC #&08 # Scroll left two pixels &1399 29 1f AND #&1f &139b 85 78 STA &78 ; scrolltext_x_fraction &139d c9 18 CMP #&18 &139f d0 08 BNE &13a9 ; leave &13a1 e6 77 INC &77 ; scrolltext_text_offset # Move to next character &13a3 a5 77 LDA &77 ; scrolltext_text_offset &13a5 29 3f AND #&3f # Wrap around scrolltext &13a7 85 77 STA &77 ; scrolltext_text_offset ; leave &13a9 60 RTS ; check_for_keypress &13aa a9 81 LDA #&81 ; Scan for a particular key &13ac a0 ff LDY #&ff &13ae 20 f4 ff JSR &fff4 ; OSBYTE &13b1 e0 00 CPX #&00 &13b3 60 RTS # Leave with not equal if key pressed ; initialise_screen &13b4 a2 0b LDX #&0b ; write_initialise_screen_string_loop &13b6 bd 27 27 LDA &2727,X ; initialise_screen_string &13b9 20 ee ff JSR &ffee ; OSWRCH &13bc ca DEX &13bd 10 f7 BPL &13b6 ; write_initialise_screen_string_loop &13bf 60 RTS ; add_to_screen_address ; add_to_room_data_address &13c0 18 CLC &13c1 65 70 ADC &70 ; screen_address_low, room_data_address_low &13c3 85 70 STA &70 ; screen_address_low, room_data_address_low &13c5 a5 71 LDA &71 ; screen_address_high, room_data_address_high &13c7 69 00 ADC #&00 &13c9 85 71 STA &71 ; screen_address_high, room_data_address_high &13cb 60 RTS ; add_to_offset # Unused code &13cc 18 CLC &13cd 65 72 ADC &72 ; offset_low &13cf 85 72 STA &72 ; offset_low &13d1 a5 73 LDA &73 ; offset_high &13d3 69 00 ADC #&00 &13d5 85 73 STA &73 ; offset_high &13d7 60 RTS ; multiply_screen_address_by_power_of_two ; multiply_room_data_address_by_power_of_two ; multiply_sound_address_by_power_of_two &13d8 06 70 ASL &70 ; screen_address_low, room_data_address_low, sound_data_address_low &13da 26 71 ROL &71 ; screen_address_high, room_data_address_high, sound_data_address_high &13dc ca DEX &13dd d0 f9 BNE &13d8 ; multiply_screen_address_by_power_of_two &13df 60 RTS ; multiply_offset_by_power_of_two ; multiply_font_address_by_power_of_two &13e0 06 72 ASL &72 ; offset_low, font_address_low &13e2 26 73 ROL &73 ; offset_high, font_address_high &13e4 ca DEX &13e5 d0 f9 BNE &13e0 ; multiply_offset_by_power_of_two &13e7 60 RTS ; plot_sprite_at_previous_position &13e8 bd 00 0d LDA &0d00,X ; sprites_previous_screen_address_low &13eb 85 70 STA &70 ; screen_address_low &13ed bd 40 0d LDA &0d40,X ; sprites_previous_screen_address_high &13f0 85 71 STA &71 ; screen_address_high &13f2 bd c0 0b LDA &0bc0,X ; sprites_previous_y &13f5 8d 1b 0c STA &0c1b ; sprite_y &13f8 4c 04 14 JMP &1404 ; plot_sprite_using_address ; plot_sprite &13fb 20 9d 23 JSR &239d ; use_screen_address_for_sprite_X &13fe bd 40 0a LDA &0a40,X ; sprites_y &1401 8d 1b 0c STA &0c1b ; sprite_y ; plot_sprite_using_address &1404 a4 31 LDY &31 ; plot_mode &1406 b9 f0 0c LDA &0cf0,Y ; plot_routine_addresses_low_table &1409 85 74 STA &74 ; plot_sprite_byte_routine_address_low &140b b9 f8 0c LDA &0cf8,Y ; plot_routine_addresses_high_table &140e 85 75 STA &75 ; plot_sprite_byte_routine_address_high &1410 bc 00 2f LDY &2f00,X ; sprites_sprite &1413 b9 80 2f LDA &2f80,Y ; sprite_addresses_low_table &1416 8d 35 14 STA &1435 ; sprite_address_low &1419 b9 40 2f LDA &2f40,Y ; sprite_addresses_high_table &141c 8d 36 14 STA &1436 ; sprite_address_high &141f ad 1b 0c LDA &0c1b ; sprite_y &1422 29 01 AND #&01 &1424 d0 14 BNE &143a ; plot_odd_y_sprite ; plot_even_y_sprite # Sprite is contained in one group &1426 a2 00 LDX #&00 &1428 a0 00 LDY #&00 ; plot_sprite_byte_loop &142a 20 34 14 JSR &1434 ; call_plot_sprite_byte_routine &142d c8 INY &142e e8 INX &142f c0 18 CPY #&18 &1431 d0 f7 BNE &142a ; plot_sprite_byte_loop &1433 60 RTS ; call_plot_sprite_byte_routine &1434 bd ff ff LDA &ffff,X # actually LDA sprite_address,X &1437 6c 74 00 JMP (&0074) ; plot_sprite_byte_routine_address ; plot_odd_y_sprite # Sprite straddles two groups &143a a2 00 LDX #&00 ; sprite offset # Top half of sprite &143c a0 04 LDY #&04 ; screen offset # Bottom half of group ; plot_odd_y_sprite_loop &143e 20 34 14 JSR &1434 ; call_plot_sprite_byte_routine &1441 c8 INY ; screen offset &1442 e8 INX ; sprite offset &1443 8a TXA &1444 29 03 AND #&03 &1446 d0 09 BNE &1451 ; not_other_half_of_sprite &1448 8a TXA ; sprite offset &1449 18 CLC &144a 69 04 ADC #&04 # Skip four rows of sprite that are in other group &144c aa TAX ; sprite offset &144d 98 TYA ; screen offset &144e 69 04 ADC #&04 # Move to next column of screen &1450 a8 TAY ; screen offset ; not_other_half_of_sprite &1451 c0 98 CPY #&98 ; &80 + &18 &1453 f0 0f BEQ &1464 ; leave # Leave if second half of sprite has been plotted &1455 e0 18 CPX #&18 &1457 d0 e5 BNE &143e ; plot_odd_y_sprite_loop &1459 a2 04 LDX #&04 ; sprite offset # Bottom half of sprite &145b a0 80 LDY #&80 ; screen offset # Move down two groups, top half of group &145d e6 71 INC &71 ; screen_address_high &145f e6 71 INC &71 ; screen_address_high &1461 4c 3e 14 JMP &143e ; plot_odd_y_sprite_loop ; leave &1464 60 RTS ; plot_routine_0 # PLOT_MODE_EOR &1465 51 70 EOR (&70),Y ; screen_address &1467 91 70 STA (&70),Y ; screen_address &1469 60 RTS ; plot_routine_1 # PLOT_MODE_EOR_AND_COLLISION_CHECK &146a 85 72 STA &72 ; sprite_byte &146c b1 70 LDA (&70),Y ; screen_address &146e 05 30 ORA &30 ; collision &1470 85 30 STA &30 ; collision &1472 a5 72 LDA &72 ; sprite_byte &1474 51 70 EOR (&70),Y ; screen_address &1476 91 70 STA (&70),Y ; screen_address &1478 60 RTS ; plot_routine_2 # PLOT_MODE_WIPE &1479 a9 00 LDA #&00 &147b 91 70 STA (&70),Y ; screen_address &147d 60 RTS ; plot_routine_3 # PLOT_MODE_WALL_AND_OBJECT_COLLISION_CHECK &147e b1 70 LDA (&70),Y ; screen_address &1480 05 30 ORA &30 ; collision &1482 85 30 STA &30 ; collision &1484 b1 70 LDA (&70),Y ; screen_address &1486 29 55 AND #&55 ; right pixel &1488 c9 40 CMP #&40 ; colour 8 right pixel &148a f0 11 BEQ &149d ; is_touching_wall &148c c9 45 CMP #&45 ; colour 11 right pixel &148e f0 13 BEQ &14a3 ; is_touching_object &1490 b1 70 LDA (&70),Y ; screen_address &1492 29 aa AND #&aa ; left pixel &1494 c9 80 CMP #&80 ; colour 8 left pixel &1496 f0 05 BEQ &149d ; is_touching_wall &1498 c9 8a CMP #&8a ; colour 11 left pixel &149a f0 07 BEQ &14a3 ; is_touching_object &149c 60 RTS ; is_touching_wall &149d a9 01 LDA #&01 &149f 8d 07 0c STA &0c07 ; player_touched_wall # Set to non-zero to indicate player touched wall &14a2 60 RTS ; is_touching_object &14a3 a9 01 LDA #&01 &14a5 85 4a STA &4a ; player_touched_object &14a7 60 RTS ; plot_routine_5 # PLOT_MODE_COLLISION_CHECK &14a8 b1 70 LDA (&70),Y ; screen_address &14aa 05 30 ORA &30 ; collision &14ac 85 30 STA &30 ; collision &14ae 60 RTS ; plot_routine_4 # PLOT_MODE_CHECK_MATCH &14af d1 70 CMP (&70),Y ; screen_address &14b1 d0 01 BNE &14b4 ; not_match &14b3 60 RTS ; not_match &14b4 a9 01 LDA #&01 &14b6 85 30 STA &30 ; collision &14b8 60 RTS ; get_wall_type_from_room_data &14b9 a5 46 LDA &46 ; wall_tile_y &14bb 0a ASL A &14bc 65 46 ADC &46 ; wall_tile_y &14be 85 47 STA &47 ; tmp &14c0 a5 45 LDA &45 ; wall_tile_x &14c2 4a LSR A &14c3 18 CLC &14c4 65 47 ADC &47 ; tmp &14c6 a8 TAY # Y = wall_tile_y * 3 + (wall_tile_x / 2) &14c7 a9 00 LDA #&00 &14c9 85 71 STA &71 ; room_data_address_high &14cb a5 32 LDA &32 ; player_room &14cd 85 70 STA &70 ; room_data_address_low &14cf a2 04 LDX #&04 ; 16 &14d1 20 d8 13 JSR &13d8 ; multiply_room_data_address_by_power_of_two &14d4 a5 32 LDA &32 ; player_room &14d6 20 c0 13 JSR &13c0 ; add_to_room_data_address &14d9 a5 32 LDA &32 ; player_room &14db 20 c0 13 JSR &13c0 ; add_to_room_data_address # room_data_address = player_room * 18 &14de a9 e0 LDA #&e0 &14e0 20 c0 13 JSR &13c0 ; add_to_room_data_address &14e3 a5 32 LDA &32 ; player_room &14e5 c9 10 CMP #&10 &14e7 10 0a BPL &14f3 ; use_room_data_one ; use_room_data_one &14e9 a9 27 LDA #&27 ; &27e0 = room_data_one &14eb 18 CLC &14ec 65 71 ADC &71 ; room_data_address_high &14ee 85 71 STA &71 ; room_data_address_high &14f0 4c fa 14 JMP &14fa ; get_byte_of_room_data ; use_room_data_two &14f3 a9 02 LDA #&02 ; &02e0 = &0400 (room_data_two) - &12 * &10 &14f5 18 CLC &14f6 65 71 ADC &71 ; room_data_address_high &14f8 85 71 STA &71 ; room_data_address_high ; get_byte_of_room_data &14fa b1 70 LDA (&70),Y ; room_data_address &14fc 85 47 STA &47 ; wall_type &14fe 85 72 STA &72 ; offset_low # Unnecessary code; unused &1500 a5 45 LDA &45 ; wall_tile_x &1502 29 01 AND #&01 &1504 d0 07 BNE &150d ; use_top_nibble ; use_bottom_nibble &1506 a5 47 LDA &47 ; wall_type &1508 29 0f AND #&0f &150a 85 47 STA &47 ; wall_type &150c 60 RTS ; use_top_nibble &150d a5 47 LDA &47 ; wall_type &150f 4a LSR A &1510 4a LSR A &1511 4a LSR A &1512 4a LSR A &1513 85 47 STA &47 ; wall_type &1515 60 RTS ; plot_room &1516 a9 00 LDA #&00 &1518 85 3b STA &3b ; wall_subtile_x &151a a9 00 LDA #&00 &151c 85 45 STA &45 ; wall_tile_x ; plot_walls_tile_x_loop &151e a9 00 LDA #&00 &1520 85 46 STA &46 ; wall_tile_y &1522 a9 03 LDA #&03 &1524 85 3c STA &3c ; wall_subtile_y ; plot_vertical_walls_tile_y_loop &1526 20 b9 14 JSR &14b9 ; get_wall_type_from_room_data # Returns A = wall_type &1529 29 08 AND #&08 ; WALL_CONTINUES_RIGHT # &08 set if wall continues right &152b a4 46 LDY &46 ; wall_tile_y &152d 99 07 0c STA &0c07,Y ; horizontal_walls # Set to non-zero if tile has horizontal wall &1530 a4 3c LDY &3c ; wall_subtile_y &1532 a6 3b LDX &3b ; wall_subtile_x &1534 20 fe 0e JSR &0efe ; plot_wall # Plot subtile at top left of tile &1537 a5 46 LDA &46 ; wall_tile_y &1539 c9 05 CMP #&05 &153b f0 28 BEQ &1565 ; plot_fill_and_horizontal_wall_sections # If bottom edge of room, plot only top row of tile ; not_bottom_edge_of_room &153d a9 04 LDA #&04 &153f 85 3d STA &3d ; count &1541 a5 47 LDA &47 ; wall_type &1543 29 02 AND #&02 ; WALL_CONTINUES_DOWN # &02 set if wall continues down &1545 08 PHP ; continues down &1546 a9 00 LDA #&00 ; WALL_SPACE &1548 85 47 STA &47 ; wall_type &154a 28 PLP ; continues down &154b f0 04 BEQ &1551 ; not_wall ; is_wall &154d a9 03 LDA #&03 ; WALL_CONTINUES_UP | WALL_CONTINUES_DOWN &154f 85 47 STA &47 ; wall_type ; not_wall ; plot_vertical_wall_section_loop &1551 e6 3c INC &3c ; wall_subtile_y &1553 a4 3c LDY &3c ; wall_subtile_y &1555 a6 3b LDX &3b ; wall_subtile_x &1557 20 fe 0e JSR &0efe ; plot_wall # Plot subtile for vertical wall &155a c6 3d DEC &3d ; count &155c d0 f3 BNE &1551 ; plot_vertical_wall_section_loop &155e e6 3c INC &3c ; wall_subtile_y &1560 e6 46 INC &46 ; wall_tile_y &1562 4c 26 15 JMP &1526 ; plot_vertical_walls_tile_y_loop # Repeat for next tile down ; plot_fill_and_horizontal_wall_sections &1565 20 6d 1f JSR &1f6d ; consider_filling_left_column_of_wall_tile &1568 a5 45 LDA &45 ; wall_tile_x &156a c9 05 CMP #&05 &156c d0 01 BNE &156f ; not_right_edge_of_room # Stop at right edge of room, &156e 60 RTS ; not_right_edge_of_room &156f a9 04 LDA #&04 &1571 85 4b STA &4b ; horizontal_wall_length &1573 e6 3b INC &3b ; wall_subtile_x ; plot_horizontal_walls_subtile_x_loop &1575 a9 00 LDA #&00 &1577 85 46 STA &46 ; wall_tile_y &1579 a9 03 LDA #&03 &157b 85 3c STA &3c ; wall_subtile_y ; plot_horizontal_walls_tile_y_loop &157d a9 00 LDA #&00 ; WALL_SPACE &157f 85 47 STA &47 ; wall_type &1581 a4 46 LDY &46 ; wall_tile_y &1583 b9 07 0c LDA &0c07,Y ; horizontal_walls # Non-zero if tile has horizontal wall at top &1586 f0 04 BEQ &158c ; not_wall ; is_wall &1588 a9 0c LDA #&0c ; WALL_CONTINUES_LEFT | WALL_CONTINUES_RIGHT &158a 85 47 STA &47 ; wall_type ; not_wall &158c a4 3c LDY &3c ; wall_subtile_y &158e a6 3b LDX &3b ; wall_subtile_x &1590 20 fe 0e JSR &0efe ; plot_wall # Plot subtile for horizontal wall &1593 a5 46 LDA &46 ; wall_tile_y &1595 c9 05 CMP #&05 &1597 f0 1c BEQ &15b5 ; plot_other_fill_and_next_column # If not bottom edge of room, &1599 a9 04 LDA #&04 &159b 85 3d STA &3d ; count &159d a9 00 LDA #&00 ; WALL_SPACE &159f 85 47 STA &47 ; wall_type ; plot_tile_middle_loop &15a1 e6 3c INC &3c ; wall_subtile_y &15a3 a4 3c LDY &3c ; wall_subtile_y &15a5 a6 3b LDX &3b ; wall_subtile_x &15a7 20 fe 0e JSR &0efe ; plot_wall # Plot subtile for tile middle &15aa c6 3d DEC &3d ; count &15ac d0 f3 BNE &15a1 ; plot_horizontal_wall_section_loop &15ae e6 3c INC &3c ; wall_subtile_y &15b0 e6 46 INC &46 ; wall_tile_y &15b2 4c 7d 15 JMP &157d ; plot_tile_middle_loop ; plot_other_fill_and_next_column &15b5 20 1c 1f JSR &1f1c ; consider_filling_other_column_of_wall_tile &15b8 e6 3b INC &3b ; wall_subtile_x &15ba c6 4b DEC &4b ; horizontal_wall_length &15bc d0 b7 BNE &1575 ; plot_horizontal_walls_subtile_x_loop # Continue for remainder of horizontal wall &15be e6 45 INC &45 ; wall_tile_x &15c0 4c 1e 15 JMP &151e ; plot_walls_tile_x_loop # Continue for next column of tiles ; check_for_player_input &15c3 20 d3 24 JSR &24d3 ; check_for_sound_keypresses &15c6 a9 00 LDA #&00 &15c8 85 3f STA &3f ; player_x_velocity &15ca 85 40 STA &40 ; player_y_velocity &15cc 8d 01 0c STA &0c01 ; direction_to_check &15cf ad eb 0c LDA &0ceb ; input_method # Zero for keyboard, non-zero for joystick &15d2 d0 06 BNE &15da ; is_joystick ; is_keyboard &15d4 20 09 16 JSR &1609 ; check_for_player_keyboard_input # Returns X = &ff if fire key pressed &15d7 4c dd 15 JMP &15dd ; consider_firing ; is_joystick &15da 20 87 12 JSR &1287 ; check_for_player_joystick_input # Returns X = &01 if fire button pressed ; consider_firing &15dd ad 98 0c LDA &0c98 ; suppress_fire_autorepeat # Non-zero if player wanted to fire previously &15e0 d0 08 BNE &15ea ; skip_firing &15e2 e0 00 CPX #&00 &15e4 f0 04 BEQ &15ea ; skip_firing &15e6 a9 01 LDA #&01 &15e8 85 3e STA &3e ; player_wants_to_fire # Set to non-zero to indicate player wants to fire ; skip_firing &15ea 8e 98 0c STX &0c98 ; suppress_fire_autorepeat # Set to non-zero if player wants to fire &15ed 20 c7 24 JSR &24c7 ; check_for_escape &15f0 f0 07 BEQ &15f9 ; check_for_pause ; escape_pressed &15f2 68 PLA # Remove call to check_for_player_input from stack &15f3 68 PLA &15f4 68 PLA # Remove call to play_game from stack &15f5 68 PLA &15f6 4c 05 0e JMP &0e05 ; title_screen ; check_for_pause &15f9 a2 c8 LDX #&c8 ; P &15fb 20 c9 24 JSR &24c9 ; check_for_game_keypress &15fe d0 01 BNE &1601 ; wait_for_unpause &1600 60 RTS ; wait_for_unpause &1601 a2 cc LDX #&cc ; R &1603 20 c9 24 JSR &24c9 ; check_for_game_keypress &1606 f0 f9 BEQ &1601 ; wait_for_unpause &1608 60 RTS ; check_for_player_keyboard_input ; check_for_direction_keys_loop &1609 ac 01 0c LDY &0c01 ; direction_to_check &160c b9 dc 27 LDA &27dc,Y ; direction_keycodes &160f aa TAX &1610 20 c9 24 JSR &24c9 ; check_for_game_keypress &1613 f0 13 BEQ &1628 ; consider_next_direction ; direction_key_pressed &1615 ac 01 0c LDY &0c01 ; direction_to_check &1618 a5 3f LDA &3f ; player_x_velocity &161a 18 CLC &161b 79 d8 27 ADC &27d8,Y ; directions_y_velocity_table &161e 85 3f STA &3f ; player_x_velocity &1620 a5 40 LDA &40 ; player_y_velocity &1622 18 CLC &1623 79 d4 27 ADC &27d4,Y ; directions_x_velocity_table &1626 85 40 STA &40 ; player_y_velocity ; consider_next_direction &1628 ee 01 0c INC &0c01 ; direction_to_check &162b ad 01 0c LDA &0c01 ; direction_to_check &162e c9 04 CMP #&04 &1630 d0 d7 BNE &1609 ; check_for_direction_keys_loop &1632 a2 9a LDX #&9a ; M &1634 4c c9 24 JMP &24c9 ; check_for_game_keypress # Leave with X = &ff if fire key pressed ; unused_wipe_column_of_screen # Unused code &1637 a9 00 LDA #&00 &1639 85 71 STA &71 ; screen_address_high &163b a5 3d LDA &3d ; x &163d 85 70 STA &70 ; screen_address_low &163f a2 03 LDX #&03 ; 8 &1641 20 d8 13 JSR &13d8 ; multiply_screen_address_by_power_of_two &1644 a5 71 LDA &71 ; screen_address_high &1646 18 CLC &1647 69 30 ADC #&30 ; &3000 = screen_memory &1649 85 71 STA &71 ; screen_address_high &164b a9 00 LDA #&00 &164d 85 3c STA &3c ; y ; unused_wipe_column_of_screen_group_loop &164f a0 07 LDY #&07 ; unused_wipe_column_of_screen_byte_loop &1651 a9 00 LDA #&00 &1653 91 70 STA (&70),Y ; screen_address &1655 88 DEY &1656 10 f9 BPL &1651 ; unused_wipe_column_of_screen_byte_loop &1658 a9 80 LDA #&80 # Move down a group &165a 20 c0 13 JSR &13c0 ; add_to_screen_address &165d e6 71 INC &71 ; screen_address_high &165f e6 71 INC &71 ; screen_address_high &1661 e6 3c INC &3c ; y &1663 a5 3c LDA &3c ; y &1665 c9 20 CMP #&20 &1667 d0 e6 BNE &164f ; unused_wipe_column_of_screen_group_loop &1669 60 RTS ; apply_velocities_to_sprite_screen_address &166a 20 9d 23 JSR &239d ; use_screen_address_for_sprite_X &166d a5 70 LDA &70 ; screen_address_low &166f 9d 00 0d STA &0d00,X ; sprites_previous_screen_address_low &1672 a5 71 LDA &71 ; screen_address_high &1674 9d 40 0d STA &0d40,X ; sprites_previous_screen_address_high &1677 a5 33 LDA &33 ; x_velocity &1679 30 0a BMI &1685 ; is_moving_left &167b f0 15 BEQ &1692 ; consider_y_velocity ; is_moving_right &167d a9 08 LDA #&08 # Move right two pixels &167f 20 c0 13 JSR &13c0 ; add_to_screen_address &1682 4c 92 16 JMP &1692 ; consider_y_velocity ; is_moving_left &1685 38 SEC &1686 a5 70 LDA &70 ; screen_address_low &1688 e9 08 SBC #&08 # Move left two pixels &168a 85 70 STA &70 ; screen_address_low &168c a5 71 LDA &71 ; screen_address_high &168e e9 00 SBC #&00 &1690 85 71 STA &71 ; screen_address_high ; consider_y_velocity &1692 a5 34 LDA &34 ; y_velocity &1694 30 13 BMI &16a9 ; is_moving_up &1696 f0 25 BEQ &16bd ; leave ; is_moving_down &1698 bd 40 0a LDA &0a40,X ; sprites_y # Only change screen address on change of group &169b 29 01 AND #&01 &169d d0 1e BNE &16bd ; leave &169f a9 80 LDA #&80 # Move down a group &16a1 20 c0 13 JSR &13c0 ; add_to_screen_address &16a4 e6 71 INC &71 ; screen_address_high &16a6 e6 71 INC &71 ; screen_address_high &16a8 60 RTS ; is_moving_up &16a9 bd 40 0a LDA &0a40,X ; sprites_y # Only change screen address on change of group &16ac 29 01 AND #&01 &16ae f0 0d BEQ &16bd ; leave &16b0 38 SEC &16b1 a5 70 LDA &70 ; screen_address_low &16b3 e9 80 SBC #&80 # Move up a group &16b5 85 70 STA &70 ; screen_address_low &16b7 a5 71 LDA &71 ; screen_address_high &16b9 e9 02 SBC #&02 &16bb 85 71 STA &71 ; screen_address_high ; leave &16bd 60 RTS ; apply_velocities_to_sprite &16be a5 33 LDA &33 ; x_velocity &16c0 18 CLC &16c1 7d 00 0a ADC &0a00,X ; sprites_x &16c4 9d 00 0a STA &0a00,X ; sprites_x &16c7 bd 40 0a LDA &0a40,X ; sprites_y &16ca 9d c0 0b STA &0bc0,X ; sprites_previous_y &16cd 18 CLC &16ce 65 34 ADC &34 ; y_velocity &16d0 9d 40 0a STA &0a40,X ; sprites_y &16d3 20 6a 16 JSR &166a ; apply_velocities_to_sprite_screen_address &16d6 a5 70 LDA &70 ; screen_address_low &16d8 9d 80 0a STA &0a80,X ; sprites_screen_address_low &16db a5 71 LDA &71 ; screen_address_high &16dd 9d c0 0a STA &0ac0,X ; sprites_screen_address_high &16e0 60 RTS ; set_player_sprites_and_apply_player_velocities &16e1 a5 3f LDA &3f ; player_x_velocity &16e3 d0 11 BNE &16f6 ; is_moving &16e5 a5 40 LDA &40 ; player_y_velocity &16e7 d0 0d BNE &16f6 ; is_moving &16e9 a5 35 LDA &35 ; player_direction &16eb 0a ASL A &16ec 0a ASL A &16ed 18 CLC &16ee 69 02 ADC #&02 ; SPRITE_PLAYER_FEET_*_TWO &16f0 8d 11 2f STA &2f11 ; sprites_sprite + &11 (SLOT_PLAYER_FEET) &16f3 4c 18 17 JMP &1718 ; apply_player_velocities ; is_moving &16f6 a6 3f LDX &3f ; player_x_velocity &16f8 a4 40 LDY &40 ; player_y_velocity &16fa 20 6a 22 JSR &226a ; get_direction_from_velocities # Returns A = direction &16fd 85 35 STA &35 ; player_direction &16ff 0a ASL A &1700 0a ASL A &1701 8d 10 2f STA &2f10 ; sprites_sprite + &10 (SLOT_PLAYER_HEAD) # SPRITE_PLAYER_HEAD_* &1704 85 3d STA &3d ; player_sprite_base &1706 a5 36 LDA &36 ; frame_counter &1708 4a LSR A &1709 4a LSR A &170a c9 03 CMP #&03 &170c d0 02 BNE &1710 ; not_final_frame &170e a9 01 LDA #&01 ; SPRITE_PLAYER_FEET_*_TWO - 1 # Animate ONE, TWO, THREE, TWO ; not_final_frme &1710 18 CLC &1711 e6 3d INC &3d ; player_sprite_base &1713 65 3d ADC &3d ; player_sprite_base &1715 8d 11 2f STA &2f11 ; sprites_sprite + &11 (SLOT_PLAYER_FEET) ; apply_player_velocities &1718 a5 3f LDA &3f ; player_x_velocity &171a 85 33 STA &33 ; x_velocity &171c a5 40 LDA &40 ; player_y_velocity &171e 85 34 STA &34 ; y_velocity &1720 a2 10 LDX #&10 ; SLOT_PLAYER_HEAD &1722 20 be 16 JSR &16be ; apply_velocities_to_sprite &1725 a2 11 LDX #&11 ; SLOT_PLAYER_FEET &1727 4c be 16 JMP &16be ; apply_velocities_to_sprite ; add_delta_to_player_room &172a 86 37 STX &37 ; player_direction_entered_room &172c bd d0 27 LDA &27d0,X ; directions_room_delta_table &172f 18 CLC &1730 65 32 ADC &32 ; player_room &1732 85 32 STA &32 ; player_room &1734 60 RTS ; initialise_room &1735 e6 cf INC &cf ; rooms_visited &1737 a5 cf LDA &cf ; rooms_visited &1739 c9 18 CMP #&18 ; 24 &173b d0 08 BNE &1745 ; skip_increasing_difficulty # Visiting 24 or more rooms on a level increases difficulty &173d a5 b8 LDA &b8 ; difficulty &173f c9 05 CMP #&05 &1741 f0 02 BEQ &1745 ; skip_increasing_difficulty &1743 e6 b8 INC &b8 ; difficulty ; skip_increasing_difficulty &1745 20 ba 1f JSR &1fba ; set_all_colours_to_black &1748 a5 80 LDA &80 ; enemies_remaining &174a d0 05 BNE &1751 ; skip_scoring_for_clearing_room &174c a9 19 LDA #&19 ; 25 &174e 20 49 23 JSR &2349 ; add_to_score # Score 250 for destroying all enemies in previous room ; skip_scoring_for_clearing_room &1751 20 16 15 JSR &1516 ; plot_room &1754 a6 37 LDX &37 ; player_direction_entered_room &1756 8e b5 0b STX &0bb5 ; previous_player_direction_entered_room &1759 bd bc 27 LDA &27bc,X ; directions_player_initial_x_table &175c 8d 10 0a STA &0a10 ; sprites_x + &10 (SLOT_PLAYER_HEAD) &175f 8d 11 0a STA &0a11 ; sprites_x + &11 (SLOT_PLAYER_FEET) &1762 bd 53 25 LDA &2553,X ; directions_player_initial_direction_table &1765 85 35 STA &35 ; player_direction &1767 bd 4f 25 LDA &254f,X ; directions_player_initial_head_sprite_table &176a 8d 10 2f STA &2f10 ; sprites_sprite + &10 (SLOT_PLAYER_HEAD) &176d bd 4b 25 LDA &254b,X ; directions_player_initial_feet_sprite_table &1770 8d 11 2f STA &2f11 ; sprites_sprite + &11 (SLOT_PLAYER_FEET) &1773 a9 03 LDA #&03 &1775 85 36 STA &36 ; frame_counter # Set to &03 to plot player and enemies on first update &1777 bd b8 27 LDA &27b8,X ; directions_player_initial_y_table &177a 8d 50 0a STA &0a50 ; sprites_y + &10 (SLOT_PLAYER_HEAD) &177d 18 CLC &177e 69 02 ADC #&02 ; SPRITE_PLAYER_FEET_*_TWO &1780 8d 51 0a STA &0a51 ; sprites_y + &11 (SLOT_PLAYER_FEET) &1783 bd cc 27 LDA &27cc,X ; directions_player_initial_head_screen_address_low_table &1786 8d 90 0a STA &0a90 ; sprites_screen_address_low + &10 (SLOT_PLAYER_HEAD) &1789 bd c8 27 LDA &27c8,X ; directions_player_initial_head_screen_address_high_table &178c 8d d0 0a STA &0ad0 ; sprites_screen_address_high + &10 (SLOT_PLAYER_HEAD) &178f bd c4 27 LDA &27c4,X ; directions_player_initial_feet_screen_address_low_table &1792 8d 91 0a STA &0a91 ; sprites_screen_address_low + &11 (SLOT_PLAYER_FEET) &1795 bd c0 27 LDA &27c0,X ; directions_player_initial_feet_screen_address_high_table &1798 8d d1 0a STA &0ad1 ; sprites_screen_address_high + &11 (SLOT_PLAYER_FEET) &179b a2 07 LDX #&07 ; initialise_bullets_loop &179d a9 00 LDA #&00 &179f 9d 56 0c STA &0c56,X ; bullets_state # Set to zero to indicate bullet not plotted &17a2 a9 ff LDA #&ff &17a4 9d 4e 0c STA &0c4e,X ; bullets_direction # Set to &ff to indicate no bullet in slot &17a7 ca DEX &17a8 10 f3 BPL &179d ; initialise_bullets_loop &17aa a9 00 LDA #&00 &17ac 85 42 STA &42 ; number_of_player_bullets &17ae 8d b8 0b STA &0bb8 ; number_of_enemy_bullets &17b1 20 ff 1c JSR &1cff ; plot_status &17b4 20 8e 1e JSR &1e8e ; initialise_enemies &17b7 20 a1 24 JSR &24a1 ; initialise_room_objects &17ba a9 01 LDA #&01 &17bc 85 41 STA &41 ; leaving_room # Set to non-zero to indicate player left previous room &17be 4c c5 1f JMP &1fc5 ; use_game_colours ; main_game_loop &17c1 a5 82 LDA &82 ; player_death_timer # Zero if player not dead, non-zero if player dead &17c3 c9 01 CMP #&01 &17c5 d0 01 BNE &17c8 ; not_end_of_death &17c7 60 RTS ; not_end_of_death &17c8 a5 82 LDA &82 ; player_death_timer &17ca f0 02 BEQ &17ce ; not_dead &17cc c6 82 DEC &82 ; player_death_timer ; not_dead &17ce 20 dd 0d JSR &0ddd ; wait_for_vsync &17d1 e6 36 INC &36 ; frame_counter &17d3 a5 36 LDA &36 ; frame_counter &17d5 29 0f AND #&0f &17d7 85 36 STA &36 ; frame_counter &17d9 d0 08 BNE &17e3 ; skip_considering_manifesting_spook &17db ad 66 0c LDA &0c66 ; spook_appearance_cooldown &17de f0 03 BEQ &17e3 ; skip_considering_manifesting_spook &17e0 20 32 24 JSR &2432 ; consider_manifesting_spook ; skip_considering_manifesting_spook &17e3 a5 36 LDA &36 ; frame_counter &17e5 29 03 AND #&03 &17e7 d0 28 BNE &1811 ; skip_animating_palette &17e9 ac 96 0c LDY &0c96 ; palette_state # Animate spinner arms and magic potion bubbles &17ec b9 14 27 LDA &2714,Y ; colour_13_table &17ef a2 0d LDX #&0d ; 13 &17f1 20 23 25 JSR &2523 ; set_colour &17f4 b9 11 27 LDA &2711,Y ; colour_14_table &17f7 e8 INX ; 14 &17f8 20 23 25 JSR &2523 ; set_colour &17fb b9 0e 27 LDA &270e,Y ; colour_15_table &17fe e8 INX ; 15 &17ff 20 23 25 JSR &2523 ; set_colour &1802 ee 96 0c INC &0c96 ; palette_state &1805 ad 96 0c LDA &0c96 ; palette_state &1808 c9 03 CMP #&03 &180a d0 05 BNE &1811 ; skip_wraparound &180c a9 00 LDA #&00 &180e 8d 96 0c STA &0c96 ; palette_state ; skip_wraparound ; skip_animating_palette &1811 a5 36 LDA &36 ; frame_counter &1813 29 03 AND #&03 &1815 d0 25 BNE &183c ; skip_unplotting_enemies ; unplot_enemies &1817 a2 14 LDX #&14 ; SLOT_FIRST_ENEMY &1819 a9 00 LDA #&00 ; PLOT_MODE_EOR &181b 85 31 STA &31 ; plot_mode ; unplot_enemies_loop &181d 86 39 STX &39 ; enemy_to_update &181f bd 53 0c LDA &0c53,X ; enemies_state - &14 (SLOT_FIRST_ENEMY) # Two or greater if exploding &1822 c9 02 CMP #&02 &1824 30 0f BMI &1835 ; consider_next_enemy ; is_exploding &1826 bd 53 0c LDA &0c53,X ; enemies_state - &14 (SLOT_FIRST_ENEMY) &1829 c9 05 CMP #&05 &182b d0 05 BNE &1832 ; not_end_of_explosion &182d a9 00 LDA #&00 &182f 9d 53 0c STA &0c53,X ; enemies_state - &14 (SLOT_FIRST_ENEMY) # Set to zero to indicate no enemy in slot ; not_end_of_explosion &1832 20 fb 13 JSR &13fb ; plot_sprite # Plot explosion ; consider_next_enemy &1835 a6 39 LDX &39 ; enemy_to_update &1837 e8 INX &1838 e0 2c CPX #&2c ; SLOT_LAST_ENEMY + 1 &183a d0 e1 BNE &181d ; unplot_enemies_loop ; skip_unplotting_enemies &183c 20 d1 19 JSR &19d1 ; move_enemies &183f a5 36 LDA &36 ; frame_counter &1841 29 03 AND #&03 &1843 c9 03 CMP #&03 &1845 d0 07 BNE &184e ; skip_unplotting_player &1847 a5 82 LDA &82 ; player_death_timer # Zero if player not dead &1849 d0 03 BNE &184e ; skip_unplotting_player &184b 20 f6 24 JSR &24f6 ; unplot_player_at_previous_position ; skip_unplotting_player ; play_game &184e a5 36 LDA &36 ; frame_counter &1850 29 03 AND #&03 &1852 c9 03 CMP #&03 &1854 d0 44 BNE &189a ; skip_plotting_player &1856 a5 82 LDA &82 ; player_death_timer # Zero if player not dead &1858 d0 40 BNE &189a ; skip_plotting_player ; plot_player &185a a9 80 LDA #&80 ; Read buffer status &185c a2 fa LDX #&fa ; Sound output buffer 1 &185e 20 f4 ff JSR &fff4 ; OSBYTE &1861 e0 0f CPX #&0f &1863 d0 1d BNE &1882 ; skip_playing_sound_for_walking &1865 ad 11 2f LDA &2f11 ; sprites_sprite + &11 (SLOT_PLAYER_FEET) &1868 29 03 AND #&03 &186a c9 01 CMP #&01 &186c f0 07 BEQ &1875 ; play_walking_sound_one &186e c9 03 CMP #&03 &1870 f0 0b BEQ &187d ; play_walking_sound_two &1872 4c 82 18 JMP &1882 ; skip_playing_sound_for_walking ; play_walking_sound_one &1875 a9 07 LDA #&07 &1877 20 4d 22 JSR &224d ; play_sound # Play sound for walking &187a 4c 82 18 JMP &1882 ; skip_playing_sound_for_walking ; play_walking_sound_two &187d a9 08 LDA #&08 &187f 20 4d 22 JSR &224d ; play_sound # Play sound for walking ; skip_playing_sound_for_walking &1882 a9 01 LDA #&01 ; PLOT_MODE_EOR_AND_COLLISION_CHECK # Collision check not needed &1884 85 31 STA &31 ; plot_mode &1886 a2 10 LDX #&10 ; SLOT_PLAYER_HEAD &1888 20 fb 13 JSR &13fb ; plot_sprite &188b a2 11 LDX #&11 ; SLOT_PLAYER_FEET &188d 20 fb 13 JSR &13fb ; plot_sprite &1890 ad 10 2f LDA &2f10 ; sprites_sprite + &10 (SLOT_PLAYER_HEAD) &1893 85 8e STA &8e ; previous_player_head_sprite &1895 ad 11 2f LDA &2f11 ; sprites_sprite + &11 (SLOT_PLAYER_FEET) &1898 85 8d STA &8d ; previous_player_feet_sprite ; skip_plotting_player &189a 20 73 24 JSR &2473 ; update_spook &189d a5 36 LDA &36 ; frame_counter &189f 29 03 AND #&03 &18a1 d0 26 BNE &18c9 ; skip_plotting_enemies ; plot_enemies &18a3 a2 14 LDX #&14 ; SLOT_FIRST_ENEMY &18a5 a9 00 LDA #&00 ; PLOT_MODE_EOR &18a7 85 31 STA &31 ; plot_mode ; plot_enemies_loop &18a9 86 39 STX &39 ; enemy_to_update &18ab bd 53 0c LDA &0c53,X ; enemies_state - &14 (SLOT_FIRST_ENEMY) # One if active, two or more if exploding &18ae c9 02 CMP #&02 &18b0 30 10 BMI &18c2 ; consider_next_enemy ; is_exploding &18b2 c9 05 CMP #&05 &18b4 10 0c BPL &18c2 ; consider_next_enemy &18b6 18 CLC &18b7 69 38 ADC #&38 ; SPRITE_EXPLOSION_ONE - 2 &18b9 9d 00 2f STA &2f00,X ; sprites_sprite &18bc fe 53 0c INC &0c53,X ; enemies_state - &14 (SLOT_FIRST_ENEMY) &18bf 20 fb 13 JSR &13fb ; plot_sprite ; consider_next_enemy &18c2 a6 39 LDX &39 ; enemy_to_update &18c4 e8 INX &18c5 e0 2c CPX #&2c ; SLOT_LAST_ENEMY + 1 &18c7 d0 e0 BNE &18a9 ; plot_enemies_loop ; skip_plotting_enemies ; unplot_bullets # Update bullets every frame &18c9 a2 07 LDX #&07 ; unplot_bullets_loop &18cb 86 39 STX &39 ; bullet_to_update &18cd 20 38 1b JSR &1b38 ; unplot_bullet &18d0 20 5d 1b JSR &1b5d ; plot_bullet_and_check_for_hitting_enemies &18d3 a6 39 LDX &39 ; bullet_to_update &18d5 ca DEX &18d6 10 f3 BPL &18cb ; unplot_bullets_loop &18d8 a5 43 LDA &43 ; spook_was_hit_by_bullet # Non-zero if spook was hit by bullet &18da f0 15 BEQ &18f1 ; skip_stunning_spook ; stun_spook &18dc a9 32 LDA #&32 ; 50 &18de 8d bc 0b STA &0bbc ; spook_stun_cooldown &18e1 a2 0c LDX #&0c &18e3 a9 04 LDA #&04 ; B &18e5 20 23 25 JSR &2523 ; set_colour # Set spook (colour 12) to blue &18e8 a9 00 LDA #&00 &18ea 85 43 STA &43 ; spook_was_hit_by_bullet # Set to zero to indicate bullet hit dealt with &18ec a9 14 LDA #&14 &18ee 20 4d 22 JSR &224d ; play_sound # Play sound for stunning spook ; skip_stunning_spook &18f1 a5 82 LDA &82 ; player_death_timer # Zero if player not dead &18f3 f0 03 BEQ &18f8 ; is_alive &18f5 4c 64 19 JMP &1964 ; move_bullets ; is_alive &18f8 20 c3 15 JSR &15c3 ; check_for_player_input # Update player every frame &18fb 20 fb 1a JSR &1afb ; check_for_player_leaving_room &18fe a5 41 LDA &41 ; leaving_room # Non-zero if player has just entered room &1900 d0 4d BNE &194f ; to_play_game ; not_changing_room &1902 85 30 STA &30 ; collision &1904 a5 36 LDA &36 ; frame_counter &1906 29 03 AND #&03 &1908 c9 03 CMP #&03 &190a d0 58 BNE &1964 ; skip_checking_for_player_collision ; check_for_player_collision &190c a9 04 LDA #&04 ; PLOT_MODE_CHECK_MATCH &190e 85 31 STA &31 ; plot_mode &1910 a2 10 LDX #&10 ; SLOT_PLAYER_HEAD &1912 20 fb 13 JSR &13fb ; plot_sprite &1915 a2 11 LDX #&11 ; SLOT_PLAYER_FEET &1917 20 fb 13 JSR &13fb ; plot_sprite &191a a5 30 LDA &30 ; collision &191c d0 43 BNE &1961 ; kill_player_because_of_collision &191e 20 11 13 JSR &1311 ; check_for_spook_touching_player &1921 a5 30 LDA &30 ; collision &1923 d0 3c BNE &1961 ; kill_player_because_of_collision &1925 20 e1 16 JSR &16e1 ; set_player_sprites_and_apply_player_velocities &1928 a9 00 LDA #&00 &192a 8d 07 0c STA &0c07 ; player_touched_wall # Set to zero to indicate player not touching wall &192d 85 4a STA &4a ; player_touched_object # Set to zero to indicate player not touching object &192f a2 10 LDX #&10 ; SLOT_PLAYER_HEAD &1931 a9 03 LDA #&03 ; PLOT_MODE_WALL_AND_OBJECT_COLLISION_CHECK &1933 85 31 STA &31 ; plot_mode &1935 20 fb 13 JSR &13fb ; plot_sprite &1938 a2 11 LDX #&11 ; SLOT_PLAYER_FEET &193a 20 fb 13 JSR &13fb ; plot_sprite &193d a5 4a LDA &4a ; player_touched_object # Non-zero if player touched object &193f f0 06 BEQ &1947 ; not_touching_object &1941 20 d6 0f JSR &0fd6 ; check_for_collecting_objects &1944 20 a8 23 JSR &23a8 ; plot_lives ; not_touching_object &1947 ad 07 0c LDA &0c07 ; player_touched_wall # Non-zero if player touched wall &194a f0 06 BEQ &1952 ; not_touching_wall &194c 4c 38 1a JMP &1a38 ; kill_player_because_of_touching_wall ; to_play_game &194f 4c 4e 18 JMP &184e ; play_game ; not_touching_wall &1952 a5 30 LDA &30 ; collision &1954 29 c0 AND #&c0 &1956 f0 0c BEQ &1964 ; skip_killing_player_because_of_collision # Branch if neither pixel is colour 8 - 15 &1958 20 f6 24 JSR &24f6 ; unplot_player_at_previous_position &195b 20 9e 1a JSR &1a9e ; kill_player &195e 4c 64 19 JMP &1964 ; skip_killing_player_because_of_collision ; kill_player_because_of_collision &1961 20 aa 19 JSR &19aa ; unplot_player_at_current_position_and_kill_player ; skip_killing_player_because_of_collision ; skip_checking_for_player_collision ; move_bullets &1964 a9 07 LDA #&07 &1966 85 39 STA &39 ; bullet_to_update ; move_bullets_loop &1968 a6 39 LDX &39 ; bullet_to_update &196a 20 d6 1b JSR &1bd6 ; move_bullet &196d c6 39 DEC &39 ; bullet_to_update &196f 10 f7 BPL &1968 ; move_bullets_loop &1971 a5 82 LDA &82 ; player_death_timer # Zero if player not dead &1973 d0 06 BNE &197b ; check_for_bullets_hitting_wall &1975 20 9c 1c JSR &1c9c ; consider_player_firing &1978 20 98 22 JSR &2298 ; consider_enemies_firing ; check_for_bullets_hitting_wall &197b a9 07 LDA #&07 &197d 85 39 STA &39 ; bullet_to_update ; check_for_bullets_hitting_wall_loop &197f a6 39 LDX &39 ; bullet_to_update &1981 20 90 1b JSR &1b90 ; check_for_bullet_hitting_wall_or_spook &1984 c6 39 DEC &39 ; bullet_to_update &1986 10 f7 BPL &197f ; check_for_bullets_hitting_wall_loop &1988 a9 80 LDA #&80 ; Read buffer status &198a a2 f9 LDX #&f9 ; Sound output buffer 2 &198c 20 f4 ff JSR &fff4 ; OSBYTE &198f e0 0f CPX #&0f &1991 f0 31 BEQ &19c4 ; play_background_siren &1993 4c c1 17 JMP &17c1 ; main_game_loop ; unused # Unused code &1996 20 9c 19 JSR &199c ; unplot_player_and_kill_player &1999 4c 64 19 JMP &1964 ; move_bullets ; unplot_player_and_kill_player &199c a5 36 LDA &36 ; frame_counter &199e 29 03 AND #&03 &19a0 c9 03 CMP #&03 &19a2 f0 06 BEQ &19aa ; unplot_player_at_current_position_and_kill_player &19a4 20 f6 24 JSR &24f6 ; unplot_player_at_previous_position &19a7 4c b8 19 JMP &19b8 ; to_kill_player ; unplot_player_at_current_position_and_kill_player &19aa a9 00 LDA #&00 ; PLOT_MODE_EOR &19ac 85 31 STA &31 ; plot_mode &19ae a2 10 LDX #&10 ; SLOT_PLAYER_HEAD &19b0 20 fb 13 JSR &13fb ; plot_sprite &19b3 a2 11 LDX #&11 ; SLOT_PLAYER_FEET &19b5 20 fb 13 JSR &13fb ; plot_sprite ; to_kill_player &19b8 4c 9e 1a JMP &1a9e ; kill_player ; set_player_velocities_to_zero &19bb a9 00 LDA #&00 &19bd 85 3f STA &3f ; player_x_velocity &19bf 85 40 STA &40 ; player_y_velocity &19c1 4c 18 17 JMP &1718 ; apply_player_velocities ; play_background_siren &19c4 a9 09 LDA #&09 &19c6 20 4d 22 JSR &224d ; play_sound # Play sound for background siren &19c9 a9 0a LDA #&0a &19cb 20 4d 22 JSR &224d ; play_sound # Play sound for background siren &19ce 4c c1 17 JMP &17c1 ; main_game_loop ; move_enemies &19d1 a2 14 LDX #&14 ; SLOT_FIRST_ENEMY ; move_enemies_loop &19d3 86 39 STX &39 ; enemy_to_update &19d5 bd 53 0c LDA &0c53,X ; enemies_state - &14 (SLOT_FIRST_ENEMY) # One if enemy is active, not exploding &19d8 c9 01 CMP #&01 &19da d0 54 BNE &1a30 ; consider_next_enemy ; is_active &19dc bd 00 2f LDA &2f00,X ; sprites_sprite &19df c9 2a CMP #&2a ; SPRITE_SPINNER &19e1 d0 13 BNE &19f6 ; not_spinner ; is_spinner &19e3 8a TXA &19e4 29 0f AND #&0f # Update each spinner 1 in 16 frames &19e6 c5 36 CMP &36 ; frame_counter &19e8 d0 0c BNE &19f6 ; not_spinner &19ea 20 2f 20 JSR &202f ; unplot_enemy &19ed 20 4b 20 JSR &204b ; move_spinner &19f0 20 41 20 JSR &2041 ; plot_enemy &19f3 4c 30 1a JMP &1a30 ; consider_next_enemy ; not_spinner &19f6 bd 00 2f LDA &2f00,X ; sprites_sprite &19f9 c9 2b CMP #&2b ; SPRITE_CLONE &19fb d0 19 BNE &1a16 ; not_clone ; is_clone &19fd 8a TXA &19fe 29 07 AND #&07 &1a00 85 74 STA &74 ; clone_number &1a02 a5 36 LDA &36 ; frame_counter &1a04 29 07 AND #&07 # Update each clone 1 in 8 frames &1a06 c5 74 CMP &74 ; clone_number &1a08 d0 0c BNE &1a16 ; not_clone &1a0a 20 2f 20 JSR &202f ; unplot_enemy &1a0d 20 d4 20 JSR &20d4 ; move_clone &1a10 20 41 20 JSR &2041 ; plot_enemy &1a13 4c 30 1a JMP &1a30 ; consider_next_enemy ; not_clone &1a16 bd 00 2f LDA &2f00,X ; sprites_sprite &1a19 c9 2c CMP #&2c ; SPRITE_CYBERDROID &1a1b d0 13 BNE &1a30 ; consider_next_enemy ; is_cyberdroid &1a1d 8a TXA &1a1e 29 0f AND #&0f # Update each cyberdroid 1 in 16 frames &1a20 c5 36 CMP &36 ; frame_counter &1a22 d0 0c BNE &1a30 ; consider_next_enemy &1a24 20 2f 20 JSR &202f ; unplot_enemy &1a27 20 34 21 JSR &2134 ; move_cyberdroid &1a2a 20 41 20 JSR &2041 ; plot_enemy &1a2d 4c 30 1a JMP &1a30 ; consider_next_enemy ; consider_next_enemy &1a30 a6 39 LDX &39 ; enemy_to_update &1a32 e8 INX &1a33 e0 2c CPX #&2c ; SLOT_LAST_ENEMY + 1 &1a35 d0 9c BNE &19d3 ; move_enemies_loop &1a37 60 RTS ; kill_player_because_of_touching_wall &1a38 a9 04 LDA #&04 &1a3a 20 4d 22 JSR &224d ; play_sound # Play sound for touching wall &1a3d ad 10 2f LDA &2f10 ; sprites_sprite + &10 (SLOT_PLAYER_HEAD) &1a40 85 33 STA &33 ; previous_player_head_sprite &1a42 ad 11 2f LDA &2f11 ; sprites_sprite + &11 (SLOT_PLAYER_FEET) &1a45 85 34 STA &34 ; previous_player_feet_sprite &1a47 a9 32 LDA #&32 ; 50 &1a49 85 36 STA &36 ; frame_counter ; animate_electrocution_loop &1a4b 20 dd 0d JSR &0ddd ; wait_for_vsync &1a4e a5 36 LDA &36 ; frame_counter &1a50 29 0f AND #&0f &1a52 a2 08 LDX #&08 &1a54 20 23 25 JSR &2523 ; set_colour # Cycle colour 8, wall edge and skeleton &1a57 a9 30 LDA #&30 ; SPRITE_SKELETON_HEAD &1a59 8d 10 2f STA &2f10 ; sprites_sprite + &10 (SLOT_PLAYER_HEAD) &1a5c a9 31 LDA #&31 ; SPRITE_SKELETON_FEET &1a5e 8d 11 2f STA &2f11 ; sprites_sprite + &11 (SLOT_PLAYER_FEET) &1a61 a9 01 LDA #&01 ; PLOT_MODE_EOR_AND_COLLISION_CHECK # Collision check not needed &1a63 85 31 STA &31 ; plot_mode &1a65 a2 10 LDX #&10 ; SLOT_PLAYER_HEAD &1a67 20 e8 13 JSR &13e8 ; plot_sprite_at_previous_position # Plot skeleton &1a6a a2 11 LDX #&11 ; SLOT_PLAYER_FEET &1a6c 20 e8 13 JSR &13e8 ; plot_sprite_at_previous_position &1a6f 20 dd 0d JSR &0ddd ; wait_for_vsync &1a72 a5 33 LDA &33 ; previous_player_head_sprite &1a74 8d 10 2f STA &2f10 ; sprites_sprite + &10 (SLOT_PLAYER_HEAD) &1a77 a5 34 LDA &34 ; previous_player_feet_sprite &1a79 8d 11 2f STA &2f11 ; sprites_sprite + &11 (SLOT_PLAYER_FEET) &1a7c a2 10 LDX #&10 ; SLOT_PLAYER_HEAD &1a7e 20 e8 13 JSR &13e8 ; plot_sprite_at_previous_position # Unplot skeleton &1a81 a2 11 LDX #&11 ; SLOT_PLAYER_FEET &1a83 20 e8 13 JSR &13e8 ; plot_sprite_at_previous_position &1a86 c6 36 DEC &36 ; frame_counter &1a88 10 c1 BPL &1a4b ; animate_electrocution_loop &1a8a a9 02 LDA #&02 ; PLOT_MODE_WIPE &1a8c 85 31 STA &31 ; plot_mode &1a8e a2 10 LDX #&10 ; SLOT_PLAYER_HEAD &1a90 20 e8 13 JSR &13e8 ; plot_sprite_at_previous_position &1a93 a2 11 LDX #&11 ; SLOT_PLAYER_FEET &1a95 20 e8 13 JSR &13e8 ; plot_sprite_at_previous_position &1a98 20 9e 1a JSR &1a9e ; kill_player &1a9b 4c 64 19 JMP &1964 ; move_bullets # Continue main game loop ; kill_player &1a9e ce b4 0b DEC &0bb4 ; player_lives &1aa1 20 a8 23 JSR &23a8 ; plot_lives &1aa4 a9 c8 LDA #&c8 &1aa6 8d 14 0b STA &0b14 ; sound_2_data + 4 (pitch) # Set pitch for player dying &1aa9 a9 02 LDA #&02 &1aab 20 4d 22 JSR &224d ; play_sound # Play sound for player dying &1aae a9 03 LDA #&03 &1ab0 20 4d 22 JSR &224d ; play_sound # Play sound for player dying &1ab3 a9 00 LDA #&00 ; PLOT_MODE_EOR &1ab5 85 31 STA &31 ; plot_mode &1ab7 ad 11 0d LDA &0d11 ; sprites_previous_screen_address_low + &11 (SLOT_PLAYER_FEET) &1aba 38 SEC &1abb e9 08 SBC #&08 &1abd 8d 90 0a STA &0a90 ; sprites_screen_address_low + &10 (SLOT_PLAYER_HEAD) &1ac0 ad 51 0d LDA &0d51 ; sprites_previous_screen_address_high + &11 (SLOT_PLAYER_FEET) &1ac3 e9 00 SBC #&00 &1ac5 8d d0 0a STA &0ad0 ; sprites_screen_address_high + &10 (SLOT_PLAYER_HEAD) &1ac8 ad d1 0b LDA &0bd1 ; sprites_previous_screen_address_high + &11 (SLOT_PLAYER_FEET) &1acb 8d 50 0a STA &0a50 ; sprites_y + &10 (SLOT_PLAYER_HEAD) &1ace 8d 51 0a STA &0a51 ; sprites_y + &10 (SLOT_PLAYER_FEET) &1ad1 ad 11 0d LDA &0d11 ; sprites_previous_screen_address_low + &11 (SLOT_PLAYER_FEET) &1ad4 18 CLC &1ad5 69 10 ADC #&10 &1ad7 8d 91 0a STA &0a91 ; sprites_screen_address_low + &11 (SLOT_PLAYER_FEET) &1ada ad 51 0d LDA &0d51 ; sprites_previous_screen_address_high + &11 (SLOT_PLAYER_FEET) &1add 69 00 ADC #&00 &1adf 8d d1 0a STA &0ad1 ; sprites_previous_screen_address_high + &11 (SLOT_PLAYER_FEET) &1ae2 a9 33 LDA #&33 ; SPRITE_DEAD_PLAYER_LEFT &1ae4 8d 10 2f STA &2f10 ; sprites_sprite + &10 (SLOT_PLAYER_HEAD) &1ae7 a9 34 LDA #&34 ; SPRITE_DEAD_PLAYER_RIGHT &1ae9 8d 11 2f STA &2f11 ; sprites_sprite + &11 (SLOT_PLAYER_FEET) &1aec a2 10 LDX #&10 ; SLOT_PLAYER_HEAD &1aee 20 fb 13 JSR &13fb ; plot_sprite # Plot dead player &1af1 a2 11 LDX #&11 ; SLOT_PLAYER_FEET &1af3 20 fb 13 JSR &13fb ; plot_sprite &1af6 a9 96 LDA #&96 ; 150 &1af8 85 82 STA &82 ; player_death_timer # Set to non-zero to indicate player is dead &1afa 60 RTS ; check_for_player_leaving_room &1afb a9 00 LDA #&00 &1afd 85 41 STA &41 ; leaving_room # Set to zero to indicate player is leaving room &1aff ad 10 0a LDA &0a10 ; sprites_x + &10 (SLOT_PLAYER_HEAD) &1b02 c9 02 CMP #&02 &1b04 10 05 BPL &1b0b ; not_leaving_room_at_top &1b06 a2 01 LDX #&01 ; DIRECTION_UP &1b08 4c 2a 1b JMP &1b2a ; change_room ; not_leaving_room_at_top &1b0b c9 4c CMP #&4c &1b0d 30 05 BMI &1b14 ; not_leaving_room_at_bottom &1b0f a2 00 LDX #&00 ; DIRECTION_DOWN &1b11 4c 2a 1b JMP &1b2a ; change_room ; not_leaving_room_at_bottom &1b14 ad 50 0a LDA &0a50 ; sprites_y + &10 (SLOT_PLAYER_HEAD) &1b17 c9 07 CMP #&07 &1b19 10 05 BPL &1b20 ; not_leaving_room_at_left &1b1b a2 02 LDX #&02 ; DIRECTION_LEFT &1b1d 4c 2a 1b JMP &1b2a ; change_room ; not_leaving_room_at_left &1b20 c9 36 CMP #&36 &1b22 30 05 BMI &1b29 ; not_leaving_room_at_right &1b24 a2 03 LDX #&03 ; DIRECTION_RIGHT &1b26 4c 2a 1b JMP &1b2a ; change_room ; not_leaving_room_at_right ; leave &1b29 60 RTS ; change_room &1b2a 20 2a 17 JSR &172a ; add_delta_to_player_room &1b2d 20 ba 1f JSR &1fba ; set_all_colours_to_black &1b30 a9 0c LDA #&0c ; CLS &1b32 20 ee ff JSR &ffee ; OSWRCH &1b35 4c 35 17 JMP &1735 ; initialise_room ; unplot_bullet &1b38 bd 56 0c LDA &0c56,X ; bullets_state # Zero if bullet not plotted &1b3b f0 ec BEQ &1b29 ; leave &1b3d bd 2e 0c LDA &0c2e,X ; bullets_previous_screen_address_low &1b40 85 70 STA &70 ; screen_address_low &1b42 bd 36 0c LDA &0c36,X ; bullets_previous_screen_address_high &1b45 85 71 STA &71 ; screen_address_high &1b47 a0 01 LDY #&01 ; unplot_bullet_loop &1b49 b1 70 LDA (&70),Y ; screen_address &1b4b 49 2a EOR #&2a ; WK # Unplot bullet &1b4d 91 70 STA (&70),Y ; screen_address &1b4f 88 DEY &1b50 10 f7 BPL &1b49 ; unplot_bullet_loop &1b52 bd 4e 0c LDA &0c4e,X ; bullets_direction &1b55 10 05 BPL &1b5c ; skip_marking_bullet_as_not_plotted &1b57 a9 00 LDA #&00 &1b59 9d 56 0c STA &0c56,X ; bullets_state # Set to zero to indicate bullet not plotted ; skip_marking_bullet_as_not_plotted &1b5c 60 RTS ; plot_bullet_and_check_for_hitting_enemies &1b5d a9 00 LDA #&00 &1b5f 85 30 STA &30 ; collision # Set to zero to indicate no collision &1b61 bd 4e 0c LDA &0c4e,X ; bullets_direction # Negative if no bullet in slot &1b64 30 c3 BMI &1b29 ; leave &1b66 a9 01 LDA #&01 &1b68 9d 56 0c STA &0c56,X ; bullets_state # Set to non-zero to indicate bullet plotted &1b6b bd 1e 0c LDA &0c1e,X ; bullets_screen_address_low &1b6e 85 70 STA &70 ; screen_address_low &1b70 bd 26 0c LDA &0c26,X ; bullets_screen_address_high &1b73 85 71 STA &71 ; screen_address_high &1b75 a0 01 LDY #&01 ; plot_bullet_loop &1b77 b1 70 LDA (&70),Y ; screen_address &1b79 29 aa AND #&aa ; left pixel &1b7b 05 30 ORA &30 ; collision &1b7d 85 30 STA &30 ; collision &1b7f b1 70 LDA (&70),Y ; screen_address_low &1b81 49 2a EOR #&2a ; WK # Plot bullet &1b83 91 70 STA (&70),Y ; screen_address_high &1b85 88 DEY &1b86 10 ef BPL &1b77 ; plot_bullet_loop &1b88 a5 30 LDA &30 ; collision # Non-zero if collision &1b8a d0 01 BNE &1b8d ; is_collision &1b8c 60 RTS ; is_collision &1b8d 4c b7 21 JMP &21b7 ; consider_bullet_collision ; check_for_bullet_hitting_wall_or_spook &1b90 bd 4e 0c LDA &0c4e,X ; bullets_direction # Negative if no bullet in slot &1b93 30 94 BMI &1b29 ; leave &1b95 a9 00 LDA #&00 &1b97 85 43 STA &43 ; spook_was_hit_by_bullet # Set to zero to indicate spook not hit by bullet &1b99 bd 1e 0c LDA &0c1e,X ; bullets_screen_address_low &1b9c 85 70 STA &70 ; screen_address_low &1b9e bd 26 0c LDA &0c26,X ; bullets_screen_address_high &1ba1 85 71 STA &71 ; screen_address_high &1ba3 a0 01 LDY #&01 ; check_for_bullet_hitting_wall_or_spook_loop &1ba5 b1 70 LDA (&70),Y ; screen_address &1ba7 29 aa AND #&aa ; left pixel &1ba9 c9 a0 CMP #&a0 ; colour 12 left pixel # Did the bullet hit spook? &1bab f0 17 BEQ &1bc4 ; hit_spook &1bad c9 80 CMP #&80 ; colour 8 left pixel # Did the bullet hit a wall edge? &1baf f0 15 BEQ &1bc6 ; remove_bullet &1bb1 c9 82 CMP #&82 ; colour 9 left pixel # Did the bullet hit a wall? &1bb3 f0 11 BEQ &1bc6 ; remove_bullet &1bb5 c9 8a CMP #&8a ; colour 11 left pixel # Did the bullet hit an object? &1bb7 f0 0d BEQ &1bc6 ; remove_bullet &1bb9 88 DEY &1bba 10 e9 BPL &1ba5 ; check_for_bullet_hitting_wall_or_spook_loop &1bbc 20 e1 1c JSR &1ce1 ; check_if_bullet_leaving_room &1bbf a5 41 LDA &41 ; leaving_room # Non-zero if bullet is leaving room &1bc1 d0 03 BNE &1bc6 ; remove_bullet &1bc3 60 RTS ; hit_spook &1bc4 e6 43 INC &43 ; spook_was_hit_by_bullet # Set to non-zero to indicate spook hit by bullet ; remove_bullet &1bc6 a9 ff LDA #&ff &1bc8 9d 4e 0c STA &0c4e,X ; bullets_direction # Set to &ff to indicate no bullet in slot &1bcb e0 04 CPX #&04 &1bcd 10 03 BPL &1bd2 ; is_enemy_bullet ; is_player_bullet &1bcf c6 42 DEC &42 ; number_of_player_bullets &1bd1 60 RTS ; is_enemy_bullet &1bd2 ce b8 0b DEC &0bb8 ; number_of_enemy_bullets &1bd5 60 RTS ; move_bullet &1bd6 bc 4e 0c LDY &0c4e,X ; bullets_direction # Negative if no bullet in slot &1bd9 30 56 BMI &1c31 ; leave &1bdb bd 1e 0c LDA &0c1e,X ; bullets_screen_address_low &1bde 9d 2e 0c STA &0c2e,X ; bullets_previous_screen_address_low &1be1 85 70 STA &70 ; screen_address_low &1be3 bd 26 0c LDA &0c26,X ; bullets_screen_address_high &1be6 9d 36 0c STA &0c36,X ; bullets_previous_screen_address_high &1be9 85 71 STA &71 ; screen_address_high &1beb bd 3e 0c LDA &0c3e,X ; bullets_x &1bee 18 CLC &1bef 79 a0 27 ADC &27a0,Y ; bullet_direction_x_deltas_table &1bf2 9d 3e 0c STA &0c3e,X ; bullets_x &1bf5 bd 46 0c LDA &0c46,X ; bullets_y &1bf8 18 CLC &1bf9 79 98 27 ADC &2798,Y ; bullet_direction_y_deltas_table &1bfc 9d 46 0c STA &0c46,X ; bullets_y &1bff 18 CLC &1c00 bd 1e 0c LDA &0c1e,X ; bullets_screen_address_low &1c03 79 b0 27 ADC &27b0,Y ; bullet_direction_screen_address_delta_low_table &1c06 9d 1e 0c STA &0c1e,X ; bullets_screen_address_low &1c09 bd 26 0c LDA &0c26,X ; bullets_screen_address_high &1c0c 79 a8 27 ADC &27a8,Y ; bullet_direction_screen_address_delta_high_table &1c0f 9d 26 0c STA &0c26,X ; bullets_screen_address_high &1c12 b9 98 27 LDA &2798,Y ; bullet_direction_y_deltas_table &1c15 f0 1a BEQ &1c31 ; leave &1c17 10 19 BPL &1c32 ; is_moving_down ; is_moving_up &1c19 bd 46 0c LDA &0c46,X ; bullets_y &1c1c 29 01 AND #&01 &1c1e f0 11 BEQ &1c31 ; leave # Only change screen address on change of group &1c20 bd 1e 0c LDA &0c1e,X ; bullets_screen_address_low &1c23 38 SEC &1c24 e9 78 SBC #&78 # Move up a group &1c26 9d 1e 0c STA &0c1e,X ; bullets_screen_address_low &1c29 bd 26 0c LDA &0c26,X ; bullets_screen_address_high &1c2c e9 02 SBC #&02 &1c2e 9d 26 0c STA &0c26,X ; bullets_screen_address_high ; leave &1c31 60 RTS ; is_moving_down &1c32 bd 46 0c LDA &0c46,X ; bullets_y &1c35 29 01 AND #&01 &1c37 d0 f8 BNE &1c31 ; leave # Only change screen address on change of group &1c39 bd 1e 0c LDA &0c1e,X ; bullets_screen_address_low &1c3c 18 CLC &1c3d 69 78 ADC #&78 # Move down a group &1c3f 9d 1e 0c STA &0c1e,X ; bullets_screen_address_low &1c42 bd 26 0c LDA &0c26,X ; bullets_screen_address_high &1c45 69 02 ADC #&02 &1c47 9d 26 0c STA &0c26,X ; bullets_screen_address_high &1c4a 60 RTS ; calculate_bullet_screen_address &1c4b 86 74 STX &74 ; bullet_to_update &1c4d bd 46 0c LDA &0c46,X ; bullets_y &1c50 29 fe AND #&fe &1c52 0a ASL A &1c53 0a ASL A &1c54 85 70 STA &70 ; screen_address_low # (bullets_y & &fe) * 4 &1c56 a9 00 LDA #&00 &1c58 85 71 STA &71 ; screen_address_high &1c5a bd 46 0c LDA &0c46,X ; bullets_y &1c5d 29 fe AND #&fe &1c5f 20 c0 13 JSR &13c0 ; add_to_screen_address # + (bullets_y & &fe) &1c62 a2 06 LDX #&06 ; 128 &1c64 20 d8 13 JSR &13d8 ; multiply_screen_address_by_power_of_two # = (bullets_y & &fe) * &280 &1c67 a6 74 LDX &74 ; bullet_to_update &1c69 bd 46 0c LDA &0c46,X ; bullets_y &1c6c 29 01 AND #&01 &1c6e f0 05 BEQ &1c75 ; is_even &1c70 a9 04 LDA #&04 # Move down four pixels if odd y ; is_even &1c72 20 c0 13 JSR &13c0 ; add_to_screen_address &1c75 bd 3e 0c LDA &0c3e,X ; bullets_x &1c78 85 72 STA &72 ; offset_low &1c7a a9 00 LDA #&00 &1c7c 85 73 STA &73 ; offset_high &1c7e a2 03 LDX #&03 ; 8 &1c80 20 e0 13 JSR &13e0 ; multiply_offset_by_power_of_two # bullets_x * 8 &1c83 a9 30 LDA #&30 ; &3000 = screen_memory &1c85 18 CLC &1c86 65 71 ADC &71 ; screen_address_high &1c88 85 71 STA &71 ; screen_address_high &1c8a a6 74 LDX &74 ; bullet_to_update &1c8c a5 70 LDA &70 ; screen_address_low &1c8e 18 CLC &1c8f 65 72 ADC &72 ; offset_low &1c91 9d 1e 0c STA &0c1e,X ; bullets_screen_address_low &1c94 a5 71 LDA &71 ; screen_address_high &1c96 65 73 ADC &73 ; offset_high &1c98 9d 26 0c STA &0c26,X ; bullets_screen_address_high &1c9b 60 RTS ; consider_player_firing &1c9c a5 3e LDA &3e ; player_wants_to_fire # Non-zero if player wants to fire &1c9e f0 40 BEQ &1ce0 ; leave &1ca0 a9 00 LDA #&00 &1ca2 85 3e STA &3e ; player_wants_to_fire # Set to zero to prevent auto-repeat &1ca4 a5 42 LDA &42 ; number_of_player_bullets &1ca6 c9 04 CMP #&04 &1ca8 f0 36 BEQ &1ce0 ; leave &1caa e6 42 INC &42 ; number_of_player_bullets &1cac a2 ff LDX #&ff # Will become zero on first pass ; find_free_bullet_slot &1cae e8 INX &1caf bd 4e 0c LDA &0c4e,X ; bullets_direction # Negative if no bullet in slot &1cb2 10 fa BPL &1cae ; find_free_bullet_slot ; found_free_bullet_slot &1cb4 a5 35 LDA &35 ; player_direction &1cb6 9d 4e 0c STA &0c4e,X ; bullets_direction # Set to positive to indicate bullet in slot &1cb9 a8 TAY &1cba a9 00 LDA #&00 &1cbc 9d 56 0c STA &0c56,X ; bullets_state # Set to zero to indicate bullet not plotted &1cbf ad 10 0a LDA &0a10 ; sprites_x + &10 (SLOT_PLAYER_HEAD) &1cc2 18 CLC &1cc3 79 90 27 ADC &2790,Y ; player_bullet_direction_x_offset_table &1cc6 9d 3e 0c STA &0c3e,X ; bullets_x &1cc9 ad 50 0a LDA &0a50 ; sprites_y + &10 (SLOT_PLAYER_HEAD) &1ccc 18 CLC &1ccd 79 88 27 ADC &2788,Y ; player_bullet_direction_y_offset_table &1cd0 9d 46 0c STA &0c46,X ; bullets_y &1cd3 20 4b 1c JSR &1c4b ; calculate_bullet_screen_address &1cd6 a9 00 LDA #&00 &1cd8 20 4d 22 JSR &224d ; play_sound # Play sound for player firing &1cdb a9 01 LDA #&01 &1cdd 20 4d 22 JSR &224d ; play_sound # Play sound for player firing ; leave &1ce0 60 RTS ; check_if_bullet_leaving_room &1ce1 a9 00 LDA #&00 &1ce3 85 41 STA &41 ; leaving_room # Set to zero to indicate bullet is not leaving room &1ce5 bd 3e 0c LDA &0c3e,X ; bullets_x &1ce8 c9 02 CMP #&02 &1cea 30 10 BMI &1cfc ; is_leaving_room &1cec c9 4e CMP #&4e &1cee 10 0c BPL &1cfc ; is_leaving_room &1cf0 bd 46 0c LDA &0c46,X ; bullets_y &1cf3 c9 07 CMP #&07 &1cf5 30 05 BMI &1cfc ; is_leaving_room &1cf7 c9 39 CMP #&39 &1cf9 10 01 BPL &1cfc ; is_leaving_room &1cfb 60 RTS ; is_leaving_room &1cfc e6 41 INC &41 ; leaving_room # Set to non-zero to indicate bullet is leaving room &1cfe 60 RTS ; plot_status &1cff a9 32 LDA #&32 ; &3288 = screen_memory + &280 * 1 + 8 * 1 &1d01 8d c0 0a STA &0ac0 ; sprites_screen_address_high + 0 (SLOT_TRANSIENT_SPRITE) &1d04 a9 88 LDA #&88 &1d06 8d 80 0a STA &0a80 ; sprites_screen_address_low + 0 (SLOT_TRANSIENT_SPRITE) &1d09 a9 00 LDA #&00 &1d0b 8d 40 0a STA &0a40 ; sprites_y + 0 (SLOT_TRANSIENT_SPRITE) &1d0e a9 25 LDA #&25 ; SPRITE_S # Plot SCORE &1d10 20 90 1d JSR &1d90 ; plot_transient_sprite &1d13 a9 35 LDA #&35 ; SPRITE_C &1d15 20 90 1d JSR &1d90 ; plot_transient_sprite &1d18 a9 20 LDA #&20 ; SPRITE_ZERO &1d1a 20 90 1d JSR &1d90 ; plot_transient_sprite &1d1d a9 36 LDA #&36 ; SPRITE_R &1d1f 20 90 1d JSR &1d90 ; plot_transient_sprite &1d22 a9 37 LDA #&37 ; SPRITE_E &1d24 20 90 1d JSR &1d90 ; plot_transient_sprite &1d27 20 7c 23 JSR &237c ; plot_score &1d2a 20 a8 23 JSR &23a8 ; plot_lives &1d2d a9 2a LDA #&2a ; WK # Plot colon in ROOM rr:ll &1d2f 8d ba 34 STA &34ba ; screen_memory + &280 * 1 + 8 * 71 + 2 &1d32 8d bd 34 STA &34bd ; screen_memory + &280 * 1 + 8 * 71 + 5 &1d35 a9 34 LDA #&34 ; &3408 = screen_memory + &280 * 1 + 8 * 49 &1d37 8d c0 0a STA &0ac0 ; sprites_screen_address_high + 0 (SLOT_TRANSIENT_SPRITE) &1d3a a9 08 LDA #&08 &1d3c 8d 80 0a STA &0a80 ; sprites_screen_address_low + 0 (SLOT_TRANSIENT_SPRITE) &1d3f a9 36 LDA #&36 ; SPRITE_R # Plot ROOM &1d41 20 90 1d JSR &1d90 ; plot_transient_sprite &1d44 a9 20 LDA #&20 : SPRITE_ZERO &1d46 20 90 1d JSR &1d90 ; plot_transient_sprite &1d49 a9 20 LDA #&20 ; SPRITE_ZERO &1d4b 20 90 1d JSR &1d90 ; plot_transient_sprite &1d4e a9 38 LDA #&38 ; SPRITE_M &1d50 20 90 1d JSR &1d90 ; plot_transient_sprite &1d53 20 a3 1d JSR &1da3 ; move_to_next_transient_sprite &1d56 a5 32 LDA &32 ; player_room &1d58 29 0f AND #&0f &1d5a c9 09 CMP #&09 &1d5c 30 12 BMI &1d70 ; is_room_one_to_nine ; is_room_ten_to_sixteen &1d5e a9 21 LDA #&21 ; SPRITE_ONE &1d60 20 90 1d JSR &1d90 ; plot_transient_sprite # Plot room tens &1d63 a5 32 LDA &32 ; player_room &1d65 29 0f AND #&0f &1d67 18 CLC &1d68 69 17 ADC #&17 ; SPRITE_ZERO - 9 &1d6a 20 90 1d JSR &1d90 ; plot_transient_sprite # Plot room ones &1d6d 4c 7d 1d JMP &1d7d ; plot_level ; is_room_one_to_nine &1d70 20 a3 1d JSR &1da3 ; move_to_next_transient_sprite &1d73 a5 32 LDA &32 ; player_room &1d75 29 0f AND #&0f &1d77 18 CLC &1d78 69 21 ADC #&21 ; SPRITE_ONE &1d7a 20 90 1d JSR &1d90 ; plot_transient_sprite # Plot room ones ; plot_level &1d7d 20 a3 1d JSR &1da3 ; move_to_next_transient_sprite &1d80 ad b7 0b LDA &0bb7 ; level_tens &1d83 69 20 ADC #&20 ; SPRITE_ZERO &1d85 20 90 1d JSR &1d90 ; plot_transient_sprite # Plot level tens &1d88 ad b6 0b LDA &0bb6 ; level_ones &1d8b 69 20 ADC #&20 ; SPRITE_ZERO &1d8d 4c 90 1d JMP &1d90 ; plot_transient_sprite # Plot level ones ; plot_transient_sprite # Called with A = sprite &1d90 8d 00 2f STA &2f00 ; sprites_sprite + 0 (SLOT_TRANSIENT_SPRITE) &1d93 a9 02 LDA #&02 ; PLOT_MODE_WIPE &1d95 85 31 STA &31 ; plot_mode &1d97 a2 00 LDX #&00 &1d99 20 fb 13 JSR &13fb ; plot_sprite # Wipe space &1d9c c6 31 DEC &31 ; plot_mode ; 1 (OBJECT_) : PLOT_MODE_EOR_AND_COLLISION_CHECK # Collision check not needed &1d9e a2 00 LDX #&00 &1da0 20 fb 13 JSR &13fb ; plot_sprite # Plot sprite in space ; move_to_next_transient_sprite &1da3 ad 80 0a LDA &0a80 ; sprites_screen_address_low + 0 (SLOT_TRANSIENT_SPRITE) &1da6 18 CLC &1da7 69 18 ADC #&18 # Move right six pixels &1da9 8d 80 0a STA &0a80 ; sprites_screen_address_low + 0 (SLOT_TRANSIENT_SPRITE) &1dac ad c0 0a LDA &0ac0 ; sprites_screen_address_high + 0 (SLOT_TRANSIENT_SPRITE) &1daf 69 00 ADC #&00 &1db1 8d c0 0a STA &0ac0 ; sprites_screen_address_high + 0 (SLOT_TRANSIENT_SPRITE) &1db4 60 RTS ; rnd &1db5 a0 08 LDY #&08 &1db7 a9 00 LDA #&00 &1db9 85 44 STA &44 ; rnd_output ; shuffle_rnd_loop &1dbb a5 7a LDA &7a ; rnd_state &1dbd 29 48 AND #&48 &1dbf 69 38 ADC #&38 &1dc1 0a ASL A &1dc2 0a ASL A &1dc3 26 7c ROL &7c ; rnd_state + 2 &1dc5 26 7b ROL &7b ; rnd_state + 1 &1dc7 26 7a ROL &7a ; rnd_state &1dc9 a5 7a LDA &7a ; rnd_state &1dcb 4a LSR A &1dcc 4a LSR A &1dcd 29 01 AND #&01 &1dcf 06 44 ASL &44 ; rnd_output &1dd1 05 44 ORA &44 ; rnd_output &1dd3 85 44 STA &44 ; rnd_output &1dd5 88 DEY &1dd6 d0 e3 BNE &1dbb ; shuffle_rnd_loop &1dd8 60 RTS ; calculate_sprite_screen_address # Called with X = sprite &1dd9 86 74 STX &74 ; sprite_slot &1ddb bd 40 0a LDA &0a40,X ; sprites_y &1dde 29 fe AND #&fe &1de0 0a ASL A &1de1 0a ASL A &1de2 85 70 STA &70 ; screen_address_low # (sprite_y & &fe) * 4 &1de4 a9 00 LDA #&00 &1de6 85 71 STA &71 ; screen_address_high &1de8 bd 40 0a LDA &0a40,X ; sprites_y &1deb 29 fe AND #&fe &1ded 20 c0 13 JSR &13c0 ; add_to_screen_address # + (sprite_y & &fe) &1df0 a2 06 LDX #&06 ; 128 &1df2 20 d8 13 JSR &13d8 ; multiply_screen_address_by_power_of_two # = (sprite_y & &fe) * &280 &1df5 a6 74 LDX &74 ; sprite_slot &1df7 bd 00 0a LDA &0a00,X ; sprites_x &1dfa 85 72 STA &72 ; offset_low &1dfc a9 00 LDA #&00 &1dfe 85 73 STA &73 ; offset_high &1e00 a2 03 LDX #&03 ; 8 &1e02 20 e0 13 JSR &13e0 ; multiply_offset_by_power_of_two # sprite_x * 8 &1e05 a9 30 LDA #&30 &1e07 18 CLC &1e08 65 71 ADC &71 ; screen_address_high &1e0a 85 71 STA &71 ; screen_address_high &1e0c a6 74 LDX &74 ; sprite_slot &1e0e a5 70 LDA &70 ; screen_address_low &1e10 18 CLC &1e11 65 72 ADC &72 ; offset_low &1e13 9d 80 0a STA &0a80,X ; sprites_screen_address_low &1e16 a5 71 LDA &71 ; screen_address_high &1e18 65 73 ADC &73 ; offset_high &1e1a 9d c0 0a STA &0ac0,X ; sprites_screen_address_high &1e1d a9 07 LDA #&07 # Unnecessary code &1e1f 60 RTS ; add_enemy &1e20 a6 3a LDX &3a ; sprite_slot &1e22 9d 14 2f STA &2f14,X ; sprites_sprite + &14 (SLOT_FIRST_ENEMY) ; find_position_for_new_sprite # Called for objects too &1e25 20 b5 1d JSR &1db5 ; rnd &1e28 a6 3a LDX &3a ; sprite_slot # &0f <= x <= &3d &1e2a 29 1f AND #&1f &1e2c 9d 14 0a STA &0a14,X ; sprites_x + &14 (SLOT_FIRST_ENEMY) &1e2f 20 b5 1d JSR &1db5 ; rnd &1e32 a6 3a LDX &3a ; sprite_slot &1e34 29 0f AND #&0f &1e36 18 CLC &1e37 7d 14 0a ADC &0a14,X ; sprites_x + &14 (SLOT_FIRST_ENEMY) &1e3a 69 0f ADC #&0f &1e3c 9d 14 0a STA &0a14,X ; sprites_x + &14 (SLOT_FIRST_ENEMY) &1e3f 20 b5 1d JSR &1db5 ; rnd &1e42 a6 3a LDX &3a ; sprite_slot # &0f <= y <= &2e &1e44 29 1f AND #&1f &1e46 18 CLC &1e47 69 0f ADC #&0f &1e49 9d 54 0a STA &0a54,X ; sprites_y + &14 (SLOT_FIRST_ENEMY) &1e4c ad 10 0a LDA &0a10 ; sprites_x + &10 (SLOT_PLAYER_HEAD) # Calculate horizontal distance to player &1e4f fd 14 0a SBC &0a14,X ; sprites_x + &14 (SLOT_FIRST_ENEMY) &1e52 10 02 BPL &1e56 ; skip_inverting_x_delta &1e54 49 ff EOR #&ff ; skip_inverting_x_delta &1e56 c9 08 CMP #&08 &1e58 10 0f BPL &1e69 ; not_too_near_player &1e5a ad 50 0a LDA &0a50 ; sprites_y + &10 (SLOT_PLAYER_HEAD) # Calculate vertical distance to player &1e5d 38 SEC &1e5e fd 54 0a SBC &0a54,X ; sprites_y + &14 (SLOT_FIRST_ENEMY) &1e61 10 02 BPL &1e65 ; skip_inverting_y_delta &1e63 49 ff EOR #&ff ; skip_inverting_y_delta &1e65 c9 05 CMP #&05 &1e67 30 bc BMI &1e25 ; find_position_for_new_sprite # Don't place enemies too near player ; not_too_near_player &1e69 8a TXA &1e6a 18 CLC &1e6b 69 14 ADC #&14 ; SLOT_FIRST_ENEMY &1e6d aa TAX &1e6e 86 77 STX &77 ; sprite_slot &1e70 20 d9 1d JSR &1dd9 ; calculate_sprite_screen_address &1e73 a9 00 LDA #&00 &1e75 85 30 STA &30 ; collision &1e77 a9 05 LDA #&05 ; PLOT_MODE_COLLISION_CHECK &1e79 85 31 STA &31 ; plot_mode &1e7b 20 fb 13 JSR &13fb ; plot_sprite # Check for collision &1e7e a5 30 LDA &30 ; collision # Non-zero if enemy or object would be on top of something &1e80 d0 a3 BNE &1e25 ; find_position_for_new_sprite &1e82 a9 00 LDA #&00 ; PLOT_MODE_EOR &1e84 85 31 STA &31 ; plot_mode &1e86 a6 77 LDX &77 ; sprite_slot &1e88 20 fb 13 JSR &13fb ; plot_sprite # Plot new enemy &1e8b e6 3a INC &3a ; sprite_slot &1e8d 60 RTS ; initialise_enemies &1e8e a9 2e LDA #&2e ; SPRITE_SPOOK_TOP &1e90 8d 0e 2f STA &2f0e ; sprites_sprite + &0e (SLOT_SPOOK_TOP) &1e93 a9 2f LDA #&2f ; SPRITE_SPOOK_BOTTOM &1e95 8d 0f 2f STA &2f0f ; sprites_sprite + &0f (SLOT_SPOOK_BOTTOM) &1e98 a6 b8 LDX &b8 ; difficulty &1e9a bd 70 27 LDA &2770,X ; difficulties_spook_appearance_cooldown_table &1e9d 8d 66 0c STA &0c66 ; spook_appearance_cooldown &1ea0 bd 82 27 LDA &2782,X ; difficulties_number_of_spinners_table &1ea3 8d 62 0c STA &0c62 ; number_of_spinners_to_add &1ea6 bd 7c 27 LDA &277c,X ; difficulties_number_of_clones_table &1ea9 8d 63 0c STA &0c63 ; number_of_clones_to_add &1eac bd 76 27 LDA &2776,X ; difficulties_number_of_cyberdroids_table &1eaf 8d 64 0c STA &0c64 ; number_of_cyberdroids_to_add &1eb2 a2 2b LDX #&2b ; SLOT_LAST_ENEMY &1eb4 a9 00 LDA #&00 ; initialise_enemies_velocities_loop &1eb6 9d 67 0c STA &0c67,X ; enemies_state # Set to zero to indicate no enemy in slot &1eb9 9d 86 0c STA &0c86,X ; enemies_velocity_x &1ebc 9d 9e 0c STA &0c9e,X ; enemies_velocity_y &1ebf ca DEX &1ec0 10 f4 BPL &1eb6 ; initialise_enemies_velocities_loop &1ec2 ad 62 0c LDA &0c62 ; number_of_spinners_to_add &1ec5 18 CLC &1ec6 6d 63 0c ADC &0c63 ; number_of_clones_to_add &1ec9 6d 64 0c ADC &0c64 ; number_of_cyberdroids_to_add &1ecc 85 3a STA &3a ; sprite_slot # Unnecessary code; overwritten at &1edc &1ece 85 80 STA &80 ; enemies_remaining &1ed0 aa TAX &1ed1 ca DEX ; last enemy slot &1ed2 a9 01 LDA #&01 ; initialise_enemises_used_loop &1ed4 9d 67 0c STA &0c67,X ; enemies_state # Set to one to indicate enemy is active &1ed7 ca DEX &1ed8 10 fa BPL &1ed4 ; initialise_enemises_used_loop &1eda a9 00 LDA #&00 &1edc 85 3a STA &3a ; sprite_slot ; add_spinners ; add_spinners_loop &1ede ce 62 0c DEC &0c62 ; number_of_spinners_to_add &1ee1 30 08 BMI &1eeb ; add_clones &1ee3 a9 2a LDA #&2a ; SPRITE_SPINNER &1ee5 20 20 1e JSR &1e20 ; add_enemy &1ee8 4c de 1e JMP &1ede ; add_spinners_loop ; add_clones ; add_clones_loop &1eeb ce 63 0c DEC &0c63 ; number_of_clones_to_add &1eee 30 08 BMI &1ef8 ; add_cyberdroids &1ef0 a9 2b LDA #&2b ; SPRITE_CLONE &1ef2 20 20 1e JSR &1e20 ; add_enemy &1ef5 4c eb 1e JMP &1eeb ; add_clones_loop ; add_cyberdroids ; add_cyberdroids_loop &1ef8 ce 64 0c DEC &0c64 ; number_of_cyberdroids_to_add &1efb 30 08 BMI &1f05 ; leave &1efd a9 2c LDA #&2c ; SPRITE_CYBERDROID &1eff 20 20 1e JSR &1e20 ; add_enemy &1f02 4c f8 1e JMP &1ef8 ; add_cyberdroids_loop ; leave &1f05 60 RTS ; check_transient_sprite_for_collision &1f06 a2 00 LDX #&00 ; SLOT_TRANSIENT_SPRITE &1f08 20 d9 1d JSR &1dd9 ; calculate_sprite_screen_address &1f0b ad 80 0a LDA &0a80 ; sprites_screen_address_low + 0 (SLOT_TRANSIENT_SPRITE) &1f0e 85 70 STA &70 ; screen_address_low &1f10 ad c0 0a LDA &0ac0 ; sprites_screen_address_high + 0 (SLOT_TRANSIENT_SPRITE) &1f13 85 71 STA &71 ; screen_address_high &1f15 a0 00 LDY #&00 &1f17 b1 70 LDA (&70),Y ; screen_address &1f19 85 30 STA &30 ; collision # Set to non-zero if anything on screen &1f1b 60 RTS ; consider_filling_other_column_of_wall_tile # Used to fill all but left column of wall tiles &1f1c a6 32 LDX &32 ; player_room &1f1e bd 60 07 LDA &0760,X ; rooms_filled_walls # Non-zero if room has filled walls &1f21 d0 01 BNE &1f24 ; has_filled_walls &1f23 60 RTS ; has_filled_walls &1f24 a5 3b LDA &3b ; wall_subtile_x &1f26 18 CLC &1f27 65 3b ADC &3b ; wall_subtile_x &1f29 65 3b ADC &3b ; wall_subtile_x &1f2b 69 01 ADC #&01 &1f2d 8d 00 0a STA &0a00 ; sprites_x + 0 (SLOT_TRANSIENT_SPRITE) &1f30 a9 2d LDA #&2d ; SPRITE_MAGIC_POTION # Unnecessary code &1f32 8d 00 2f STA &2f00 ; sprites_sprite + 0 (SLOT_TRANSIENT_SPRITE) # &1f35 a9 06 LDA #&06 &1f37 8d 40 0a STA &0a40 ; sprites_y + 0 (SLOT_TRANSIENT_SPRITE) &1f3a a9 00 LDA #&00 &1f3c 8d 93 0c STA &0c93 ; fill_area # Set to zero to not fill by default &1f3f 8d 94 0c STA &0c94 ; fill_collision # Unused variable ; fill_other_column_of_wall_loop &1f42 20 06 1f JSR &1f06 ; check_transient_sprite_for_collision # Returns zero if nothing on screen &1f45 f0 0b BEQ &1f52 ; not_end_of_run ; is_end_of_run &1f47 ad 93 0c LDA &0c93 ; fill_area &1f4a 49 01 EOR #&01 # Toggle between filling and not filling &1f4c 8d 93 0c STA &0c93 ; fill_area &1f4f 4c 5a 1f JMP &1f5a ; skip_plotting_filled_wall ; not_end_of_run &1f52 ad 93 0c LDA &0c93 ; fill_area # Non-zero if filling &1f55 f0 03 BEQ &1f5a ; skip_plotting_filled_wall &1f57 20 bf 0d JSR &0dbf ; plot_filled_wall ; skip_plotting_filled_wall &1f5a a5 30 LDA &30 ; collision &1f5c 8d 94 0c STA &0c94 ; fill_collision # Unused variable &1f5f ee 40 0a INC &0a40 ; sprites_y + 0 (SLOT_TRANSIENT_SPRITE) &1f62 ee 40 0a INC &0a40 ; sprites_y + 0 (SLOT_TRANSIENT_SPRITE) &1f65 ad 40 0a LDA &0a40 ; sprites_y + 0 (SLOT_TRANSIENT_SPRITE) &1f68 c9 3a CMP #&3a &1f6a 30 d6 BMI &1f42 ; fill_other_column_of_wall_loop ; leave &1f6c 60 RTS ; consider_filling_left_column_of_wall_tile # Used to fill only left column of wall tiles &1f6d a6 32 LDX &32 ; player_room &1f6f bd 60 07 LDA &0760,X ; rooms_filled_walls # Non-zero if room has filled walls &1f72 f0 f8 BEQ &1f6c ; leave ; has_filled_walls &1f74 a5 3b LDA &3b ; wall_subtile_x &1f76 f0 f4 BEQ &1f6c ; leave &1f78 a5 3b LDA &3b ; wall_subtile_x &1f7a 18 CLC &1f7b 65 3b ADC &3b ; wall_subtile_x &1f7d 65 3b ADC &3b ; wall_subtile_x &1f7f 38 SEC &1f80 e9 02 SBC #&02 &1f82 8d 00 0a STA &0a00 ; sprites_x + 0 (SLOT_TRANSIENT_SPRITE) &1f85 a9 2d LDA #&2d ; SPRITE_MAGIC_POTION # Unnecessary code &1f87 8d 00 2f STA &2f00 ; sprites_sprite + 0 (SLOT_TRANSIENT_SPRITE) # &1f8a a9 06 LDA #&06 &1f8c 8d 40 0a STA &0a40 ; sprites_y + 0 (SLOT_TRANSIENT_SPRITE) ; fill_left_column_of_wall_loop &1f8f 20 06 1f JSR &1f06 ; check_transient_sprite_for_collision # Returns zero if nothing on screen &1f92 f0 18 BEQ &1fac ; skip_plotting_filled_wall &1f94 a9 18 LDA #&18 &1f96 20 c0 13 JSR &13c0 ; add_to_screen_address &1f99 a5 70 LDA &70 ; screen_address_low &1f9b 8d 80 0a STA &0a80 ; sprites_screen_address_low + 0 (SLOT_TRANSIENT_SPRITE) &1f9e a5 71 LDA &71 ; screen_address_high &1fa0 8d c0 0a STA &0ac0 ; sprites_screen_address_high + 0 (SLOT_TRANSIENT_SPRITE) &1fa3 a0 00 LDY #&00 &1fa5 b1 70 LDA (&70),Y ; screen_address &1fa7 d0 03 BNE &1fac ; skip_plotting_filled_wall &1fa9 20 bf 0d JSR &0dbf ; plot_filled_wall ; skip_plotting_filled_wall &1fac ee 40 0a INC &0a40 ; sprites_y + 0 (SLOT_TRANSIENT_SPRITE) &1faf ee 40 0a INC &0a40 ; sprites_y + 0 (SLOT_TRANSIENT_SPRITE) &1fb2 ad 40 0a LDA &0a40 ; sprites_y + 0 (SLOT_TRANSIENT_SPRITE) &1fb5 c9 3a CMP #&3a &1fb7 30 d6 BMI &1f8f ; fill_left_column_of_wall_loop &1fb9 60 RTS ; set_all_colours_to_black &1fba a2 0f LDX #&0f &1fbc a9 00 LDA #&00 ; K ; set_all_colours_to_black_loop &1fbe 20 23 25 JSR &2523 ; set_colour &1fc1 ca DEX &1fc2 10 fa BPL &1fbe ; set_all_colours_to_black_loop &1fc4 60 RTS ; use_game_colours &1fc5 a2 0f LDX #&0f ; use_game_colours_loop &1fc7 bd f0 26 LDA &26f0,X ; game_colours &1fca 20 23 25 JSR &2523 ; set_colour &1fcd ca DEX &1fce 10 f7 BPL &1fc7 ; use_game_colours_loop &1fd0 ad b6 0b LDA &0bb6 ; level_ones &1fd3 29 07 AND #&07 &1fd5 a2 09 LDX #&09 &1fd7 20 23 25 JSR &2523 ; set_colour # Set colour 9 (wall) depending on level &1fda ad b6 0b LDA &0bb6 ; level_ones &1fdd 29 07 AND #&07 &1fdf aa TAX &1fe0 bd 50 27 LDA &2750,X ; level_colours &1fe3 a2 08 LDX #&08 &1fe5 4c 23 25 JMP &2523 ; set_colour # Set colour 8 (wall edge) depending on level ; unused_plot_enemy_and_set_position # Unused code &1fe8 a9 00 LDA #&00 ; PLOT_MODE_EOR &1fea 85 31 STA &31 ; plot_mode &1fec 20 fb 13 JSR &13fb ; plot_sprite &1fef a6 39 LDX &39 ; enemy_to_update &1ff1 a9 05 LDA #&05 ; PLOT_MODE_COLLISION_CHECK &1ff3 85 31 STA &31 ; plot_mode ; set_enemy_position &1ff5 bd c0 0b LDA &0bc0,X ; sprites_previous_y &1ff8 9d 40 0a STA &0a40,X ; sprites_y &1ffb bd 00 0d LDA &0d00,X ; sprites_previous_screen_address_low &1ffe 9d 80 0a STA &0a80,X ; sprites_screen_address_low &2001 bd 40 0d LDA &0d40,X ; sprites_previous_screen_address_high &2004 9d c0 0a STA &0ac0,X ; sprites_screen_address_high &2007 bd 00 0a LDA &0a00,X ; sprites_x &200a 38 SEC &200b e5 33 SBC &33 ; x_velocity &200d 9d 00 0a STA &0a00,X ; sprites_x &2010 60 RTS ; check_if_enemy_is_outside_room &2011 a9 00 LDA #&00 &2013 85 41 STA &41 ; outside_room # Set to zero to indicate not outside room &2015 bd 00 0a LDA &0a00,X ; sprites_x &2018 c9 04 CMP #&04 &201a 30 10 BMI &202c ; is_outside_room &201c c9 4a CMP #&4a &201e 10 0c BPL &202c ; is_outside_room &2020 bd 40 0a LDA &0a40,X ; sprites_y &2023 c9 08 CMP #&08 &2025 30 05 BMI &202c ; is_outside_room &2027 c9 37 CMP #&37 &2029 10 01 BPL &202c ; is_outside_room &202b 60 RTS ; is_outside_room &202c e6 41 INC &41 ; outside_room # Set to non-zero to indicate outside room &202e 60 RTS ; unplot_enemy &202f a9 00 LDA #&00 ; PLOT_MODE_EOR &2031 85 31 STA &31 ; plot_mode &2033 85 33 STA &33 ; x_velocity &2035 85 34 STA &34 ; y_velocity &2037 20 fb 13 JSR &13fb ; plot_sprite &203a a6 39 LDX &39 ; enemy_to_update &203c a9 05 LDA #&05 ; PLOT_MODE_COLLISION_CHECK &203e 85 31 STA &31 ; plot_mode &2040 60 RTS ; plot_enemy &2041 a6 39 LDX &39 ; enemy_to_update &2043 a9 00 LDA #&00 ; PLOT_MODE_EOR &2045 85 31 STA &31 ; plot_mode &2047 20 fb 13 JSR &13fb ; plot_sprite &204a 60 RTS ; move_spinner &204b 20 06 24 JSR &2406 ; move_towards_player # Try to move spinner towards player diagonally &204e 20 b1 20 JSR &20b1 ; check_if_enemy_can_move_after_applying_velocities &2051 ad 99 0c LDA &0c99 ; enemy_can_move # Zero if enemy cannot move &2054 f0 01 BEQ &2057 ; try_moving_spinner_towards_player_horizontally &2056 60 RTS ; try_moving_spinner_towards_player_horizontally # Try to move spinner towards player horizontally &2057 a6 39 LDX &39 ; enemy_to_update &2059 20 f5 1f JSR &1ff5 ; set_enemy_position &205c a9 00 LDA #&00 &205e 85 33 STA &33 ; x_velocity &2060 85 34 STA &34 ; y_velocity &2062 ad 10 0a LDA &0a10 ; sprites_x + &10 (SLOT_PLAYER_HEAD) &2065 dd 00 0a CMP &0a00,X ; sprites_x &2068 f0 0d BEQ &2077 ; skip_setting_x_velocity &206a 30 07 BMI &2073 ; is_right_of_player ; is_left_of_player &206c a9 01 LDA #&01 # Set spinner moving right &206e 85 33 STA &33 ; x_velocity &2070 4c 77 20 JMP &2077 ; skip_setting_x_velocity ; is_right_of_player &2073 a9 ff LDA #&ff # Set spinner moving left &2075 85 33 STA &33 ; x_velocity ; skip_setting_x_velocity &2077 20 b1 20 JSR &20b1 ; check_if_enemy_can_move_after_applying_velocities &207a ad 99 0c LDA &0c99 ; enemy_can_move # Zero if enemy cannot move &207d f0 01 BEQ &2080 ; try_moving_spinner_towards_player_vertically &207f 60 RTS ; try_moving_spinner_towards_player_vertically # Try to move spinner towards player vertically &2080 a6 39 LDX &39 ; enemy_to_update &2082 20 f5 1f JSR &1ff5 ; set_enemy_position &2085 a9 00 LDA #&00 &2087 85 33 STA &33 ; x_velocity &2089 85 34 STA &34 ; y_velocity &208b ad 50 0a LDA &0a50 ; sprites_y + &10 (SLOT_PLAYER_HEAD) &208e 18 CLC &208f 69 01 ADC #&01 &2091 dd 40 0a CMP &0a40,X ; sprites_y &2094 f0 0d BEQ &20a3 ; skip_setting_y_velocity &2096 30 07 BMI &209f ; is_below_player ; is_above_player &2098 a9 01 LDA #&01 # Set spinner moving down &209a 85 34 STA &34 ; y_velocity &209c 4c a3 20 JMP &20a3 ; skip_setting_y_velocity ; is_below_player &209f a9 ff LDA #&ff # Set spinner moving up &20a1 85 34 STA &34 ; y_velocity ; skip_setting_y_velocity &20a3 20 b1 20 JSR &20b1 ; check_if_enemy_can_move_after_applying_velocities &20a6 ad 99 0c LDA &0c99 ; enemy_can_move # Zero if enemy cannot move &20a9 f0 01 BEQ &20ac ; restore_previous_position &20ab 60 RTS ; restore_previous_position &20ac a6 39 LDX &39 ; enemy_to_update &20ae 4c f5 1f JMP &1ff5 ; set_enemy_position ; check_if_enemy_can_move_after_applying_velocities &20b1 a9 00 LDA #&00 &20b3 8d 99 0c STA &0c99 ; enemy_can_move # Set to zero to indicate enemy cannot move &20b6 85 30 STA &30 ; collision &20b8 20 be 16 JSR &16be ; apply_velocities_to_sprite # Provisionally apply velocities &20bb a6 39 LDX &39 ; enemy_to_update &20bd 20 fb 13 JSR &13fb ; plot_sprite # plot_mode is PLOT_MODE_COLLISION_CHECK here &20c0 a5 30 LDA &30 ; collision # Non-zero if collision &20c2 d0 0f BNE &20d3 ; cannot_move # Can't move into collision &20c4 a6 39 LDX &39 ; enemy_to_update &20c6 20 11 20 JSR &2011 ; check_if_enemy_is_outside_room &20c9 a5 41 LDA &41 ; outside_room # Non-zero if outside room &20cb d0 06 BNE &20d3 ; cannot_move # Can't move outside room ; can_move &20cd a9 01 LDA #&01 &20cf 8d 99 0c STA &0c99 ; enemy_can_move # Set to non-zero to indicate enemy can move &20d2 60 RTS ; cannot_move &20d3 60 RTS ; move_clone &20d4 20 b5 1d JSR &1db5 ; rnd &20d7 29 07 AND #&07 # 1 in 8 chance of clone changing direction &20d9 f0 1a BEQ &20f5 ; change_direction ; continue_moving_in_previous_direction &20db a6 39 LDX &39 ; enemy_to_update &20dd bd 86 0c LDA &0c86,X ; enemies_velocity_x &20e0 85 33 STA &33 ; x_velocity &20e2 bd 9e 0c LDA &0c9e,X ; enemies_velocity_y &20e5 85 34 STA &34 ; y_velocity &20e7 20 b1 20 JSR &20b1 ; check_if_enemy_can_move_after_applying_velocities &20ea ad 99 0c LDA &0c99 ; enemy_can_move # Zero if enemy cannot move &20ed f0 01 BEQ &20f0 ; restore_previous_position_and_change_direction &20ef 60 RTS ; restore_previous_position_and_change_direction &20f0 a6 39 LDX &39 ; enemy_to_update &20f2 20 f5 1f JSR &1ff5 ; set_enemy_position ; change_direction &20f5 20 07 21 JSR &2107 ; set_random_velocities &20f8 20 b1 20 JSR &20b1 ; check_if_enemy_can_move_after_applying_velocities &20fb ad 99 0c LDA &0c99 ; enemy_can_move # Zero if enemy cannot move &20fe f0 01 BEQ &2101 ; restore_previous_position &2100 60 RTS ; restore_previous_position &2101 a6 39 LDX &39 ; enemy_to_update &2103 20 f5 1f JSR &1ff5 ; set_enemy_position &2106 60 RTS ; set_random_velocities &2107 20 b5 1d JSR &1db5 ; rnd # &ff <= x_velocity <= &01 &210a 29 01 AND #&01 &210c 85 33 STA &33 ; x_velocity &210e 20 b5 1d JSR &1db5 ; rnd &2111 29 01 AND #&01 &2113 38 SEC &2114 e5 33 SBC &33 ; x_velocity &2116 85 33 STA &33 ; x_velocity &2118 a6 39 LDX &39 ; enemy_to_update &211a 9d 86 0c STA &0c86,X ; enemies_velocity_x &211d 20 b5 1d JSR &1db5 ; rnd # &ff <= y_velocity <= &01 &2120 29 01 AND #&01 &2122 85 34 STA &34 ; y_velocity &2124 20 b5 1d JSR &1db5 ; rnd &2127 29 01 AND #&01 &2129 38 SEC &212a e5 34 SBC &34 ; y_velocity &212c 85 34 STA &34 ; y_velocity &212e a6 39 LDX &39 ; enemy_to_update &2130 9d 9e 0c STA &0c9e,X ; enemies_velocity_y &2133 60 RTS ; move_cyberdroid &2134 bd 86 0c LDA &0c86,X ; enemies_velocity_x &2137 d0 1f BNE &2158 ; was_moving &2139 bd 9e 0c LDA &0c9e,X ; enemies_velocity_y &213c d0 1a BNE &2158 ; was_moving ; not_moving &213e 20 07 21 JSR &2107 ; set_random_velocities &2141 20 b1 20 JSR &20b1 ; check_if_enemy_can_move_after_applying_velocities &2144 ad 99 0c LDA &0c99 ; enemy_can_move # Zero if enemy cannot move &2147 f0 01 BEQ &214a ; restore_previous_position_and_make_stationary &2149 60 RTS ; restore_previous_position_and_make_stationary &214a a6 39 LDX &39 ; enemy_to_update &214c 20 f5 1f JSR &1ff5 ; set_enemy_position &214f a9 00 LDA #&00 &2151 9d 86 0c STA &0c86,X ; enemies_velocity_x &2154 9d 9e 0c STA &0c9e,X ; enemies_velocity_y &2157 60 RTS ; was_moving &2158 ad 10 0a LDA &0a10 ; sprites_x + &10 (SLOT_PLAYER_HEAD) &215b dd 00 0a CMP &0a00,X ; sprites_x &215e f0 0e BEQ &216e ; consider_y &2160 ad 50 0a LDA &0a50 ; sprites_y + &10 (SLOT_PLAYER_HEAD) &2163 18 CLC &2164 69 01 ADC #&01 &2166 dd 40 0a CMP &0a40,X ; sprites_y &2169 f0 1c BEQ &2187 ; consider_x &216b 4c a4 21 JMP &21a4 ; apply_velocities_to_cyberdroid ; consider_y &216e ad 50 0a LDA &0a50 ; sprites_y + &10 (SLOT_PLAYER_HEAD) &2171 18 CLC &2172 69 01 ADC #&01 &2174 dd 40 0a CMP &0a40,X ; sprites_y &2177 30 07 BMI &2180 ; set_cyberdroid_moving_left ; set_cyberdroid_moving_right &2179 a9 01 LDA #&01 # Set cyberdroid moving right &217b 85 34 STA &34 ; y_velocity &217d 4c 9a 21 JMP &219a ; skip_setting_x_velocity ; set_cyberdroid_moving_left &2180 a9 ff LDA #&ff # Set cyberdroid moving left &2182 85 34 STA &34 ; y_velocity &2184 4c 9a 21 JMP &219a ; skip_setting_x_velocity ; consider_x &2187 ad 10 0a LDA &0a10 ; sprites_x + &10 (SLOT_PLAYER_HEAD) &218a dd 00 0a CMP &0a00,X ; sprites_x &218d 30 07 BMI &2196 ; set_cyberdroid_moving_up ; set_cyberdroid_moving_down &218f a9 01 LDA #&01 # Set cyberdroid moving down &2191 85 33 STA &33 ; x_velocity &2193 4c 9a 21 JMP &219a ; skip_setting_x_velocity ; set_cyberdroid_moving_up &2196 a9 ff LDA #&ff # Set cyberdroid moving up &2198 85 33 STA &33 ; x_velocity ; skip_setting_x_velocity &219a a5 33 LDA &33 ; x_velocity &219c 9d 86 0c STA &0c86,X ; enemies_velocity_x &219f a5 34 LDA &34 ; y_velocity &21a1 9d 9e 0c STA &0c9e,X ; enemies_velocity_y ; apply_velocities_to_cyberdroid &21a4 bd 86 0c LDA &0c86,X ; enemies_velocity_x &21a7 85 33 STA &33 ; x_velocity &21a9 bd 9e 0c LDA &0c9e,X ; enemies_velocity_y &21ac 85 34 STA &34 ; y_velocity &21ae 20 b1 20 JSR &20b1 ; check_if_enemy_can_move_after_applying_velocities &21b1 ad 99 0c LDA &0c99 ; enemy_can_move # Zero if enemy cannot move &21b4 f0 94 BEQ &214a ; restore_previous_position_and_make_stationary &21b6 60 RTS ; consider_bullet_collision &21b7 a5 82 LDA &82 ; player_death_timer # Non-zero if player dead &21b9 d0 20 BNE &21db ; no_collision_with_player ; check_for_bullet_collision_with_player &21bb bd 3e 0c LDA &0c3e,X ; bullets_x &21be 38 SEC &21bf ed 10 0a SBC &0a10 ; sprites_x + &10 (SLOT_PLAYER_HEAD) &21c2 30 17 BMI &21db ; no_collision_with_player &21c4 c9 03 CMP #&03 &21c6 10 13 BPL &21db ; no_collision_with_player &21c8 bd 46 0c LDA &0c46,X ; bullets_y &21cb 38 SEC &21cc ed 50 0a SBC &0a50 ; sprites_y + &10 (SLOT_PLAYER_HEAD) &21cf 30 0a BMI &21db ; no_collision_with_player &21d1 c9 04 CMP #&04 &21d3 10 06 BPL &21db ; no_collision_with_player ; collision_with_player &21d5 20 3b 22 JSR &223b ; remove_and_unplot_bullet &21d8 4c 9c 19 JMP &199c ; unplot_player_and_kill_player ; no_collision_with_player ; check_for_bullet_collision_with_enemies &21db a0 14 LDY #&14 ; SLOT_FIRST_ENEMY ; check_for_bullet_collision_with_enemies_loop &21dd b9 53 0c LDA &0c53,Y ; enemies_state - &14 (SLOT_FIRST_ENEMY) # One if enemy is active, not exploding &21e0 c9 01 CMP #&01 &21e2 d0 51 BNE &2235 ; consider_next_enemy &21e4 bd 3e 0c LDA &0c3e,X ; bullets_x &21e7 38 SEC &21e8 f9 00 0a SBC &0a00,Y ; sprites_x &21eb 30 48 BMI &2235 ; consider_next_enemy &21ed c9 03 CMP #&03 &21ef 10 44 BPL &2235 ; consider_next_enemy &21f1 bd 46 0c LDA &0c46,X ; bullets_y &21f4 38 SEC &21f5 f9 40 0a SBC &0a40,Y ; sprites_y &21f8 30 3b BMI &2235 ; consider_next_enemy &21fa c9 02 CMP #&02 &21fc 10 37 BPL &2235 ; consider_next_enemy ; collision_with_enemy &21fe a9 02 LDA #&02 &2200 99 53 0c STA &0c53,Y ; enemies_state - &14 (SLOT_FIRST_ENEMY) # Set to two to indicate enemy is exploding &2203 e0 04 CPX #&04 &2205 10 0f BPL &2216 ; is_enemy_bullet ; is_player_bullet &2207 b9 00 2f LDA &2f00,Y ; sprites_sprite &220a 38 SEC &220b e9 29 SBC #&29 ; SPRITE_SPINNER - 1 # Score 20 for spinner, 40 for clone, 60 for cyberdroid &220d 0a ASL A # not 20, 60, 100 indicated in instructions &220e 20 49 23 JSR &2349 ; add_to_score &2211 c6 80 DEC &80 ; enemies_remaining &2213 4c 1c 22 JMP &221c ; remove_bullet_after_collision_with_enemy ; is_enemy_bullet &2216 b9 00 2f LDA &2f00,Y ; sprites_sprite &2219 20 33 23 JSR &2333 ; consider_enemy_bullet_hitting_enemy ; remove_bullet_after_collision_with_enemy &221c a6 39 LDX &39 ; bullet_to_update &221e 20 3b 22 JSR &223b ; remove_and_unplot_bullet &2221 a9 64 LDA #&64 &2223 8d 14 0b STA &0b14 ; sound_2_data + 4 (pitch) # Set pitch for enemy dying &2226 a9 02 LDA #&02 &2228 20 4d 22 JSR &224d ; play_sound # Play sound for enemy dying &222b a9 03 LDA #&03 &222d 20 4d 22 JSR &224d ; play_sound # Play sound for enemy dying &2230 a9 11 LDA #&11 &2232 4c 4d 22 JMP &224d ; play_sound # Silence channel 1 ; consider_next_enemy &2235 c8 INY &2236 c0 2c CPY #&2c ; SLOT_LAST_ENEMY + 1 &2238 d0 a3 BNE &21dd ; check_for_bullet_collision_with_enemies_loop &223a 60 RTS ; remove_and_unplot_bullet &223b bd 1e 0c LDA &0c1e,X ; bullets_screen_address_low &223e 9d 2e 0c STA &0c2e,X ; bullets_previous_screen_address_low &2241 bd 26 0c LDA &0c26,X ; bullets_screen_address_high &2244 9d 36 0c STA &0c36,X ; bullets_previous_screen_address_high &2247 20 c6 1b JSR &1bc6 ; remove_bullet &224a 4c 38 1b JMP &1b38 ; unplot_bullet ; play_sound # Called with A = sound to play &224d 85 70 STA &70 ; sound_address_low &224f ad ea 0c LDA &0cea ; suppress_sound &2252 f0 01 BEQ &2255 ; not_suppressed &2254 60 RTS ; not_suppressed &2255 a9 00 LDA #&00 &2257 85 71 STA &71 ; sound_address_high &2259 a2 03 LDX #&03 ; 8 &225b 20 d8 13 JSR &13d8 ; multiply_sound_address_by_power_of_two &225e a6 70 LDX &70 ; sound_address_low &2260 a9 0b LDA #&0b ; &0b00 = sound_data &2262 65 71 ADC &71 ; sound_address_high &2264 a8 TAY &2265 a9 07 LDA #&07 ; Generate a sound &2267 4c f1 ff JMP &fff1 ; OSWORD ; get_direction_from_velocities # Called with X = x velocity, Y = y velocity &226a e0 00 CPX #&00 &226c f0 20 BEQ &228e ; no_horizontal_component &226e 10 0f BPL &227f ; is_right ; is_left &2270 c0 00 CPY #&00 &2272 d0 03 BNE &2277 ; is_left_and_up_or_down ; is_only_left &2274 a9 03 LDA #&03 ; DIRECTION_LEFT &2276 60 RTS ; is_left_and_up_or_down &2277 10 03 BPL &227c ; is_down_and_left ; is_up_and_left &2279 a9 06 LDA #&06 ; DIRECTION_UP_AND_LEFT &227b 60 RTS ; is_down_and_left &227c a9 07 LDA #&07 ; DIRECTION_DOWN_AND_LEFT &227e 60 RTS ; is_right &227f c0 00 CPY #&00 &2281 d0 03 BNE &2286 ; is_right_and_up_or_down ; is_only_right &2283 a9 02 LDA #&02 ; DIRECTION_RIGHT &2285 60 RTS ; is_right_and_up_or_down &2286 10 03 BPL &228b ; is_down_and_right ; is_up_and_right &2288 a9 04 LDA #&04 ; DIRECTION_UP_AND_RIGHT &228a 60 RTS ; is_down_and_right &228b a9 05 LDA #&05 ; DIRECTION_DOWN_AND_RIGHT &228d 60 RTS ; no_horizontal_component &228e c0 00 CPY #&00 &2290 10 03 BPL &2295 ; is_down ; is_up &2292 a9 01 LDA #&01 ; DIRECTION_UP &2294 60 RTS ; is_down &2295 a9 00 LDA #&00 ; DIRECTION_DOWN &2297 60 RTS ; consider_enemies_firing &2298 ad b8 0b LDA &0bb8 ; number_of_enemy_bullets &229b c9 04 CMP #&04 &229d 10 26 BPL &22c5 ; leave &229f 20 b5 1d JSR &1db5 ; rnd &22a2 29 07 AND #&07 &22a4 c5 b8 CMP &b8 ; difficulty &22a6 10 1d BPL &22c5 ; leave &22a8 20 b5 1d JSR &1db5 ; rnd &22ab 29 0f AND #&0f &22ad 18 CLC &22ae 69 19 ADC #&19 ; SLOT_FIRST_ENEMY + 5 # First five enemies do not fire &22b0 8d b9 0b STA &0bb9 ; firing_enemy &22b3 aa TAX &22b4 bd 53 0c LDA &0c53,X ; enemies_state - &14 (SLOT_FIRST_ENEMY) # One if enemy is active, not exploding &22b7 c9 01 CMP #&01 &22b9 d0 0a BNE &22c5 ; leave &22bb bd 86 0c LDA &0c86,X ; enemies_velocity_x &22be d0 06 BNE &22c6 ; add_enemy_bullet &22c0 bc 9e 0c LDY &0c9e,X ; enemies_velocity_y &22c3 d0 01 BNE &22c6 ; add_enemy_bullet ; leave &22c5 60 RTS ; add_enemy_bullet &22c6 bc 9e 0c LDY &0c9e,X ; enemies_velocity_y &22c9 aa TAX &22ca 20 6a 22 JSR &226a ; get_direction_from_velocities # Returns A = direction &22cd 8d ba 0b STA &0bba ; enemy_bullet_direction &22d0 a0 03 LDY #&03 ; find_free_bullet_slot &22d2 c8 INY &22d3 b9 4e 0c LDA &0c4e,Y ; bullets_direction # Negative if no bullet in slot &22d6 10 fa BPL &22d2 ; find_free_bullet_slot &22d8 b9 56 0c LDA &0c56,Y ; bullets_state # Non-zero if bullet plotted &22db d0 e8 BNE &22c5 ; leave &22dd 8c bb 0b STY &0bbb ; new_enemy_bullet_slot &22e0 a9 00 LDA #&00 &22e2 99 56 0c STA &0c56,Y ; bullets_state # Set to zero to indicate bullet not plotted &22e5 ad ba 0b LDA &0bba ; enemy_bullet_direction &22e8 99 4e 0c STA &0c4e,Y ; bullets_direction &22eb ae b9 0b LDX &0bb9 ; firing_enemy &22ee a8 TAY ; direction &22ef b9 de 26 LDA &26de,Y ; enemy_bullet_direction_y_offset_table &22f2 18 CLC &22f3 7d 40 0a ADC &0a40,X ; sprites_y &22f6 ac bb 0b LDY &0bbb ; new_enemy_bullet_slot &22f9 99 46 0c STA &0c46,Y ; bullets_y &22fc ac ba 0b LDY &0bba ; enemy_bullet_direction &22ff b9 e6 26 LDA &26e6,Y ; enemy_bullet_direction_x_offset_table &2302 18 CLC &2303 7d 00 0a ADC &0a00,X ; sprites_x &2306 ac bb 0b LDY &0bbb ; new_enemy_bullet_slot &2309 99 3e 0c STA &0c3e,Y ; bullets_x &230c 98 TYA &230d aa TAX &230e 20 4b 1c JSR &1c4b ; calculate_bullet_screen_address &2311 ee b8 0b INC &0bb8 ; number_of_enemy_bullets &2314 ad 03 0c LDA &0c03 ; os_version # Zero if OS 0.10 &2317 d0 0a BNE &2323 ; not_os_0.10 ; is_os_0.10 &2319 a9 7d LDA #&7d ; Set ESCAPE condition # Unclear &231b 20 f4 ff JSR &fff4 ; OSBYTE # &231e a9 7e LDA #&7e ; Acknowledge ESCAPE condition # &2320 20 f4 ff JSR &fff4 ; OSBYTE # ; not_os_0.10 &2323 a9 0b LDA #&0b &2325 4c 4d 22 JMP &224d ; play_sound # Play sound for enemy firing ; find_free_enemy_slot &2328 a2 ff LDX #&ff ; find_free_enemy_slot_loop &232a e8 INX &232b bd 67 0c LDA &0c67,X ; enemies_state # Zero if no enemy in slot &232e d0 fa BNE &232a ; find_free_enemy_slot_loop &2330 86 3a STX &3a ; sprite_slot ; leave &2332 60 RTS ; consider_enemy_bullet_hitting_enemy # Called with A = enemy sprite &2333 a8 TAY ; enemy sprite &2334 20 28 23 JSR &2328 ; find_free_enemy_slot_loop # Returns X = enemy slot &2337 e0 18 CPX #&18 ; SLOT_FIRST_ENEMY + 4 &2339 10 f7 BPL &2332 ; leave # Only use first four enemy slots &233b 98 TYA ; enemy sprite &233c 9d 14 2f STA &2f14,X ; sprites_sprite + &14 (SLOT_FIRST_ENEMY) &233f a9 01 LDA #&01 &2341 9d 67 0c STA &0c67,X ; enemies_state # Set to one to indicate enemy is active &2344 86 3a STX &3a ; sprite_slot &2346 4c 25 1e JMP &1e25 ; find_position_for_new_sprite # Add new enemy in slot ; add_to_score # Called with A = score to add &2349 85 76 STA &76 ; delta ; add_to_score_loop &234b a2 00 LDX #&00 ; add_to_score_digit_loop &234d fe ec 0c INC &0cec,X ; score &2350 BD ec 0c LDA &0cec,X ; score &2353 c9 2a CMP #&2a ; SPRITE_NINE + 1 &2355 d0 0a BNE &2361 ; check_for_extra_life &2357 a9 20 LDA #&20 ; SPRITE_ZERO &2359 9d ec 0c STA &0cec,X ; score &235c e8 INX &235d e0 04 CPX #&04 &235f d0 ec BNE &234d ; add_to_score_digit_loop ; check_for_extra_life &2361 a0 02 LDY #&02 ; check_for_extra_life_loop &2363 b9 ec 0c LDA &0cec,Y ; score &2366 c9 20 CMP #&20 ; SPRITE_ZERO &2368 d0 0e BNE &2378 ; skip_extra_life # If score, score + 1 and score + 2 are all zero, &236a 88 DEY # i.e. every 10,000 points, gain extra life &236b 10 f6 BPL &2363 ; check_for_extra_life_loop &236d a9 15 LDA #&15 &236f 20 4d 22 JSR &224d ; play_sound # Play sound for extra life &2372 ee b4 0b INC &0bb4 ; player_lives &2375 20 a8 23 JSR &23a8 ; plot_lives ; skip_extra_life &2378 c6 76 DEC &76 ; delta &237a d0 cf BNE &234b ; add_to_score_loop ; plot_score &237c a9 33 LDA #&33 ; &3318 = screen_memory + &280 * 1 + 8 * 19 &237e 8d c0 0a STA &0ac0 ; sprites_screen_address_high + 0 (SLOT_TRANSIENT_SPRITE) &2381 a9 18 LDA #&18 &2383 8d 80 0a STA &0a80 ; sprites_screen_address_low + 0 (SLOT_TRANSIENT_SPRITE) &2386 8d 40 0a STA &0a40 ; sprites_y + 0 (SLOT_TRANSIENT_SPRITE) &2389 a2 03 LDX #&03 ; plot_score_loop &238b 86 76 STX &76 ; digit &238d bd ec 0c LDA &0cec,X ; score &2390 20 90 1d JSR &1d90 ; plot_transient_sprite &2393 a6 76 LDX &76 ; digit &2395 ca DEX &2396 10 f3 BPL &238b ; plot_score_loop &2398 a9 20 LDA #&20 ; SPRITE_ZERO &239a 4c 90 1d JMP &1d90 ; plot_transient_sprite ; use_screen_address_for_sprite_X &239d bd 80 0a LDA &0a80,X ; sprites_screen_address_low &23a0 85 70 STA &70 ; screen_address_low &23a2 bd c0 0a LDA &0ac0,X ; sprites_screen_address_high &23a5 85 71 STA &71 ; screen_address_high &23a7 60 RTS ; plot_lives &23a8 a9 7b LDA #&7b ; &7b08 = screen_memory + &280 * &280 * 30 + 8 * 1 &23aa 8d c0 0a STA &0ac0 ; sprites_screen_address_high + 0 (SLOT_TRANSIENT_SPRITE) &23ad a9 08 LDA #&08 &23af 8d 80 0a STA &0a80 ; sprites_screen_address_low + 0 (SLOT_TRANSIENT_SPRITE) &23b2 8d 40 0a STA &0a40 ; sprites_y + 0 (SLOT_TRANSIENT_SPRITE) &23b5 ae b4 0b LDX &0bb4 ; player_lives &23b8 f0 0e BEQ &23c8 ; skip_plotting_lives &23ba 30 18 BMI &23d4 ; skip_wiping_life ; plot_lives_loop &23bc 86 76 STX &76 ; count &23be a9 39 LDA #&39 ; SPRITE_LIFE &23c0 20 90 1d JSR &1d90 ; plot_transient_sprite &23c3 a6 76 LDX &76 ; count &23c5 ca DEX &23c6 d0 f4 BNE &23bc ; plot_lives_loop ; skip_plotting_lives &23c8 20 9d 23 JSR &239d ; use_screen_address_for_sprite_X &23cb a0 17 LDY #&17 &23cd a9 00 LDA #&00 ; wipe_life_loop &23cf 91 70 STA (&70),Y ; screen_address &23d1 88 DEY &23d2 10 fb BPL &23cf ; wipe_life_loop ; skip_wiping_life ; plot_collected_objects &23d4 a9 7d LDA #&7d ; &7d60 = screen_memory + &280 * &280 * 30 + 8 * 76 &23d6 8d c0 0a STA &0ac0 ; sprites_screen_address_high + 0 (SLOT_TRANSIENT_SPRITE) &23d9 a9 60 LDA #&60 &23db 8d 80 0a STA &0a80 ; sprites_screen_address_low + 0 (SLOT_TRANSIENT_SPRITE) &23de a2 00 LDX #&00 ; plot_collected_objects_loop &23e0 e8 INX &23e1 86 76 STX &76 ; offset &23e3 bd 0d 0c LDA &0c0d,X ; objects_collected # Non-zero if object collected &23e6 f0 17 BEQ &23ff ; skip &23e8 bd 36 2f LDA &2f36,X ; collected_objects_sprites &23eb 20 90 1d JSR &1d90 ; plot_transient_sprite &23ee 38 SEC &23ef ad 80 0a LDA &0a80 ; sprites_screen_address_low + 0 (SLOT_TRANSIENT_SPRITE) &23f2 e9 38 SBC #&38 &23f4 8d 80 0a STA &0a80 ; sprites_screen_address_low + 0 (SLOT_TRANSIENT_SPRITE) &23f7 ad c0 0a LDA &0ac0 ; sprites_screen_address_high + 0 (SLOT_TRANSIENT_SPRITE) &23fa e9 00 SBC #&00 &23fc 8d c0 0a STA &0ac0 ; sprites_screen_address_high + 0 (SLOT_TRANSIENT_SPRITE) ; skip &23ff a6 76 LDX &76 ; offset &2401 e4 6f CPX &6f ; number_of_objects_in_level &2403 30 db BMI &23e0 ; plot_collected_objects_loop &2405 60 RTS ; move_towards_player # Used for spinners and spook &2406 ad 10 0a LDA &0a10 ; sprites_x + &10 (SLOT_PLAYER_HEAD) &2409 dd 00 0a CMP &0a00,X ; sprites_x &240c f0 0d BEQ &241b ; consider_y &240e 30 07 BMI &2417 ; is_right_of_player ; is_left_of_player &2410 a9 01 LDA #&01 &2412 85 33 STA &33 ; x_velocity # Set moving right &2414 4c 1b 24 JMP &241b ; consider_y ; is_right_of_player &2417 a9 ff LDA #&ff &2419 85 33 STA &33 ; x_velocity # Set moving left ; consider_y &241b ad 50 0a LDA &0a50 ; sprites_y + &10 (SLOT_PLAYER_HEAD) &241e 18 CLC &241f 69 01 ADC #&01 &2421 dd 40 0a CMP &0a40,X ; sprites_y &2424 f0 0b BEQ &2431 ; leave &2426 30 05 BMI &242d ; is_below_player ; is_above_player &2428 a9 01 LDA #&01 &242a 85 34 STA &34 ; y_velocity # Set moving down &242c 60 RTS ; is_below_player &242d a9 ff LDA #&ff &242f 85 34 STA &34 ; y_velocity # Set moving up ; leave &2431 60 RTS ; consider_manifesting_spook &2432 ce 66 0c DEC &0c66 ; spook_appearance_cooldown &2435 d0 28 BNE &245f ; leave &2437 a9 00 LDA #&00 &2439 8d bc 0b STA &0bbc ; spook_stun_cooldown # Set to zero to indicate spook not stunned &243c 8d 0e 0a STA &0a0e ; sprites_x + &0e (SLOT_SPOOK_TOP) &243f 8d 4e 0a STA &0a4e ; sprites_y + &0e (SLOT_SPOOK_TOP) &2442 8d 8e 0a STA &0a8e ; sprites_screen_address_low + &0e (SLOT_SPOOK_TOP) &2445 8d 0f 0a STA &0a0f ; sprites_x + &0f (SLOT_SPOOK_BOTTOM) &2448 a9 30 LDA #&30 ; &3000 = screen_memory # Spook appears at top left of screen &244a 8d ce 0a STA &0ace ; sprites_screen_address_high + &0e (SLOT_SPOOK_TOP) &244d a9 32 LDA #&32 ; &3280 = screen_memory + &280 &244f 8d cf 0a STA &0acf ; sprites_screen_address_high + &0f (SLOT_SPOOK_BOTTOM) &2452 a9 80 LDA #&80 &2454 8d 8f 0a STA &0a8f ; sprites_screen_address_low + &0f (SLOT_SPOOK_BOTTOM) &2457 a9 02 LDA #&02 &2459 8d 4f 0a STA &0a4f ; sprites_y + &0f (SLOT_SPOOK_BOTTOM) &245c 20 60 24 JSR &2460 ; plot_or_unplot_spook # Plot spook ; leave &245f 60 RTS ; plot_or_unplot_spook &2460 ad 66 0c LDA &0c66 ; spook_appearance_cooldown &2463 d0 fa BNE &245f ; leave &2465 a9 00 LDA #&00 ; PLOT_MODE_EOR &2467 85 31 STA &31 ; plot_mode &2469 a2 0e LDX #&0e ; SLOT_SPOOK_TOP &246b 20 fb 13 JSR &13fb ; plot_sprite &246e a2 0f LDX #&0f ; SLOT_SPOOK_BOTTOM &2470 4c fb 13 JMP &13fb ; plot_sprite ; update_spook &2473 a5 36 LDA &36 ; frame_counter &2475 29 01 AND #&01 # Update spook 1 in 2 frames &2477 f0 e6 BEQ &245f ; leave &2479 ad 66 0c LDA &0c66 ; spook_appearance_cooldown &247c d0 e1 BNE &245f ; leave ; is_present &247e ad bc 0b LDA &0bbc ; spook_stun_cooldown # Non-zero if spook is stunned &2481 f0 04 BEQ &2487 ; is_active &2483 ce bc 0b DEC &0bbc ; spook_stun_cooldown &2486 60 RTS ; is_active &2487 a9 07 LDA #&07 ; W &2489 a2 0c LDX #&0c &248b 20 23 25 JSR &2523 ; set_colour # Set spook (colour 12) to white &248e 20 60 24 JSR &2460 ; plot_or_unplot_spook &2491 a2 0e LDX #&0e ; SLOT_SPOOK_TOP &2493 20 06 24 JSR &2406 ; move_towards_player &2496 20 be 16 JSR &16be ; apply_velocities_to_sprite &2499 a2 0f LDX #&0f ; SLOT_SPOOK_BOTTOM &249b 20 be 16 JSR &16be ; apply_velocities_to_sprite &249e 4c 60 24 JMP &2460 ; plot_or_unplot_spook ; initialise_room_objects &24a1 a6 6f LDX &6f ; number_of_objects_in_level ; initialise_room_objects_loop &24a3 20 ad 24 JSR &24ad ; initialise_room_object # Initialise objects to be collected &24a6 a6 39 LDX &39 ; object_to_update &24a8 ca DEX &24a9 10 f8 BPL &24a3 ; initialise_room_objects_loop &24ab a2 06 LDX #&06 ; OBJECT_MAGIC_POTION # Initialise magic potion ; initialise_room_object &24ad 86 39 STX &39 ; object_to_update &24af a5 32 LDA &32 ; player_room &24b1 29 0f AND #&0f &24b3 dd 14 0c CMP &0c14,X ; objects_room # Is the object in this room? &24b6 d0 0e BNE &24c6 ; leave &24b8 bd 0d 0c LDA &0c0d,X ; objects_collected # Non-zero if object collected &24bb d0 09 BNE &24c6 ; leave &24bd 8a TXA &24be 18 CLC &24bf 69 22 ADC #&22 ; SLOT_FIRST_OBJECT - SLOT_FIRST_ENEMY &24c1 85 3a STA &3a ; sprite_slot &24c3 4c 25 1e JMP &1e25 ; find_position_for_new_sprite ; leave &24c6 60 RTS ; check_for_escape &24c7 a2 8f LDX #&8f ; ESCAPE ; check_for_game_keypress &24c9 a9 81 LDA #&81 ; Scan for a particular key &24cb a0 ff LDY #&ff &24cd 20 f4 ff JSR &fff4 ; OSBYTE &24d0 e0 00 CPX #&00 &24d2 60 RTS # Leave with not equal if key pressed ; check_for_sound_keypresses &24d3 a2 ae LDX #&ae ; S &24d5 20 c9 24 JSR &24c9 ; check_for_game_keypress &24d8 f0 05 BEQ &24df ; s_not_pressed &24da a9 00 LDA #&00 &24dc 8d ea 0c STA &0cea ; suppress_sound # Set to zero to allow sound ; s_not_pressed &24df a2 ef LDX #&ef ; Q &24e1 20 c9 24 JSR &24c9 ; check_for_game_keypress &24e4 f0 0f BEQ &24f5 ; q_not_pressed &24e6 a9 0c LDA #&0c &24e8 20 4d 22 JSR &224d ; play_sound # Silence channel 3 &24eb a9 10 LDA #&10 &24ed 20 4d 22 JSR &224d ; play_sound # Silence channel 2 &24f0 a9 01 LDA #&01 &24f2 8d ea 0c STA &0cea ; suppress_sound # Set to non-zero to suppress sound ; q_not_pressed &24f5 60 RTS ; unplot_player_at_previous_position &24f6 ad 10 2f LDA &2f10 ; sprites_sprite + &10 (SLOT_PLAYER_HEAD) &24f9 85 8c STA &8c ; current_player_head_sprite &24fb ad 11 2f LDA &2f11 ; sprites_sprite + &11 (SLOT_PLAYER_FEET) &24fe 85 8b STA &8b ; current_player_feet_sprite &2500 a5 8d LDA &8d ; previous_player_feet_sprite &2502 8d 11 2f STA &2f11 ; sprites_sprite + &11 (SLOT_PLAYER_FEET) &2505 a5 8e LDA &8e ; previous_player_head_sprite &2507 8d 10 2f STA &2f10 ; sprites_sprite + &10 (SLOT_PLAYER_HEAD) &250a a9 00 LDA #&00 ; PLOT_MODE_EOR &250c 85 31 STA &31 ; plot_mode &250e a2 10 LDX #&10 SLOT_PLAYER_HEAD &2510 20 e8 13 JSR &13e8 ; plot_sprite_at_previous_position # Unplot player's head &2513 a2 11 LDX #&11 ; SLOT_PLAYER_FEET &2515 20 e8 13 JSR &13e8 ; plot_sprite_at_previous_position # Unplot player's feet &2518 a5 8c LDA &8c ; current_player_head_sprite &251a 8d 10 2f STA &2f10 ; sprites_sprite + &10 (SLOT_PLAYER_HEAD) &251d a5 8b LDA &8b ; current_player_feet_sprite &251f 8d 11 2f STA &2f11 ; sprites_sprite + &11 (SLOT_PLAYER_FEET) &2522 60 RTS ; set_colour # Called with X = logical colour, A = physical colour &2523 48 PHA ; colour &2524 a9 13 LDA #&13 &2526 20 ee ff JSR &ffee ; OSWRCH &2529 8a TXA &252a 20 ee ff JSR &ffee ; OSWRCH &252d 68 PLA ; colour &252e 20 ee ff JSR &ffee ; OSWRCH &2531 a9 00 LDA #&00 &2533 20 ee ff JSR &ffee ; OSWRCH &2536 20 ee ff JSR &ffee ; OSWRCH &2539 4c ee ff JMP &ffee ; OSWRCH ; unused &253c 1a 0e 00 00 ; unused # Source code fragment &2540 70 34 20 4c 44 58 73 78 3a 4c 44 ; ... p4 LDXsx:LD ... ; directions_player_initial_feet_sprite_table ; d u l r &254b 0a 0e 06 02 ; directions_player_initial_head_sprite_table ; d u l r &254f 08 0c 04 00 ; directions_player_initial_direction_table ; d u l r &2553 02 03 01 00 ; information_screen_sprites &2557 2a ; SPRITE_SPINNER &2558 2b ; SPRITE_CLONE &2559 2c ; SPRITE_CYBERDROID &255a 3d ; SPRITE_SAFE &255b 3f ; SPRITE_KEY &255c 32 ; SPRITE_POT_OF_GOLD &255d 3e ; SPRITE_RING ; information_screen_text_offsets_table &255e 7c 9d a4 ad b4 c0 d3 c6 d8 87 ; information_screen_text_screen_addresses_high_table &2568 30 3c 44 4b 53 5a 62 69 71 7b ; information_screen_screen_addresses_low_table &2572 00 80 00 80 00 80 00 80 00 00 ; game_text &257c 05 ; prefix with 5 spaces &257d 23 39 22 25 32 34 32 2f 2e ; "CYBERTRON" &2586 ff ; end of string &2587 00 ; prefix with 0 spaces &2588 30 32 25 33 33 00 33 30 21 23 25 00 34 2f 00 33 ; "PRESS SPACE TO START" &2598 34 21 32 34 &259c ff ; end of string &259d 06 ; prefix with 6 spaces &259e 33 30 2f 2f 2b ; "SPOOK" &25a3 ff ; end of string &25a4 06 ; prefix with 6 spaces &25a5 33 &25a6 30 29 2e 2e 25 32 ; "SPINNER" &25ac ff ; end of string &25ad 06 ; prefix with 6 spaces &25ae 23 2c 2f 2e 25 ; "CLONE" &25b3 ff ; end of string &25b4 06 ; prefix with 6 spaces &25b5 23 39 22 25 32 24 32 2f 29 24 ; "CYBERDROID" &25bf ff ; end of string &25c0 06 ; prefix with 6 spaces &25c1 33 21 26 25 ; "SAFE" &25c5 ff ; end of string &25c6 06 ; prefix with 6 spaces &25c7 30 2f 34 00 2f 26 00 27 2f 2c 24 ; "POT OF GOLD" &25d2 ff ; end of string &25d3 06 ; prefix with 6 spaces &25d4 2b 25 39 ; "KEY" &25d7 ff ; end of string &25d8 06 ; prefix with 6 spaces &25d9 32 29 2e 27 ; "RING" &25dd ff ; end of string &25de 06 ; prefix with 6 spaces &25df 2c 25 36 25 2c ; "LEVEL" &25e4 ff ; end of string &25e5 04 ; prefix with 4 spaces &25e6 25 2e 24 00 2f 26 00 27 21 2d 25 ; "END OF GAME" &25f1 ff ; end of string &25f2 08 ; prefix with 8 spaces &25f3 2b 25 39 33 ; "KEYS" &25f7 ff ; end of string &25f8 07 ; prefix with 7 spaces &25f9 33 34 21 34 35 33 ; "STATUS" &25ff ff ; end of string ; strings &2600 11 01 ; COLOUR 1 &2602 1f 03 06 ; TAB(&03, &06) &2605 41 09 09 55 50 ; "A..UP" &260a 1f 03 08 ; TAB(&03, &08) &260d 5a 09 09 44 4f 57 4e ; "Z..DOWN" &2614 1f 03 0a ; TAB(&03, &0a) &2617 3c 09 09 4c 45 46 54 ; "<..LEFT" &261e 1f 03 0c ; TAB(&03, &0c) &2621 3e 09 09 52 49 47 48 54 ; ">..RIGHT" &2629 1f 03 0e ; TAB(&03, &0e) &262c 4d 09 09 46 49 52 45 ; "M..FIRE" &2633 1f 03 10 ; TAB(&03, &10) &2636 53 09 09 53 4f 55 4e 44 09 4f 4e ; "S..SOUND.ON" &2641 1f 03 12 ; TAB(&03, &12) &2644 51 09 09 53 4f 55 4e 44 09 4f 46 46 ; "Q..SOUND.OFF" &2650 1f 03 14 ; TAB(&03, &14) &2653 50 09 09 50 41 55 53 45 ; "P..PAUSE" &265b 1f 03 16 ; TAB(&03, &16) &265e 52 09 09 52 45 53 55 4d 45 ; "R..RESUME" &2667 1f 03 1c ; TAB(&03, &1c) &266a 4f 52 20 46 49 52 45 20 42 55 54 54 4f 4e ; "OR FIRE BUTTON" ; scrolltext &2678 00 00 00 2c 21 33 34 00 33 23 2f 32 25 00 10 10 ; " LAST SCORE 00" &2688 10 10 10 00 00 00 28 29 27 28 00 33 23 2f 32 25 ; "000 HIGH SCORE" &2698 00 10 10 10 10 10 00 00 30 52 4f 47 52 41 4d 00 ; " 00000 Program " &26a8 30 4f 57 45 52 00 23 39 22 25 32 34 32 2f 2e 00 ; "Power CYBERTRON " &26b8 11 04 ; COLOUR 4 &26ba 1f 06 06 ; TAB(&06, &06) &26bd 45 4e 54 45 52 49 4e 47 ; "ENTERING" &26c5 00 ; end of string &26c6 11 04 ; COLOUR 4 &26c8 1f 01 11 ; TAB(&01, &11) &26cb 46 49 4e 44 20 54 48 45 20 46 4f 4c 4c 4f 57 49 ; "FIND THE FOLLOWING" &26db 4e 47 &26dd 00 ; end of string ; enemy_bullet_direction_y_offset_table ; d u l r ur dr ul dl &26de 03 fe 01 01 fe 03 fe 03 ; enemy_bullet_direction_x_offset_table ; d u l r ur dr ul dl &26e6 01 01 04 fe 04 04 fe fe ; unused &26ee 49 4e ; "IN" ; game_colours ; 0 1 2 3 4 5 6 7 8 9 a b c d e f ; K R G Y B M K W W K W Y W R K K &26f0 00 01 02 03 04 05 00 07 07 00 07 03 07 01 00 00 ; items_to_find_sprites_table &2700 3f ; SPRITE_KEY &2701 3e ; SPRITE_RING &2702 32 ; SPRITE_POT_OF_GOLD &2703 3e ; SPRITE_RING &2704 32 ; SPRITE_POT_OF_GOLD &2705 32 ; SPRITE_POT_OF_GOLD ; text_colour &2706 01 ; unused &2707 04 05 10 11 14 15 00 ; colour_15_table &270e 00 00 01 ; colour_14_table &2711 00 01 00 ; colour_13_table &2714 01 00 00 ; unused &2717 00 01 02 03 04 05 06 07 07 06 05 04 03 02 01 00 ; initialise_screen_string # Stored backwards &2727 00 00 00 00 00 00 20 0a 00 17 ; disable cursor &2731 02 16 ; change to MODE 2 ; unused &2733 00 00 00 00 ; object_types_score &2737 00 ; &00 (OBJECT_SAFE) : 0 &2738 0a ; &01 (OBJECT_KEY) : 100 # Score 100 for collecting key &2739 32 ; &02 (OBJECT_RING_ONE) : 500 # Score 500 for collecting ring &273a 64 ; &03 (OBJECT_GOLD_ONE) : 1000 # Score 1000 for collecting pot of gold &273b 32 ; &04 (OBJECT_RING_TWO) : 500 &273c 64 ; &05 (OBJECT_GOLD_TWO) : 1000 &273d 00 ; &06 (OBJECT_MAGIC_POTION) : 0 ; unused &273e 00 00 ; unused &2740 52 62 70 72 69 6e 74 ; "Rbprint" ; unused &2747 04 08 00 04 04 00 08 08 00 ; level_colours ; 0 1 2 3 4 5 6 7 &2750 07 07 04 05 01 02 01 04 ; unused &2758 1c 09 09 09 09 09 09 1c ff ff ff ff ff ff ff ff &2768 23 ff ff ff ff ff ff 23 ; difficulties_spook_appearance_cooldown_table ; 0 1 2 3 4 5 &2770 3c 50 64 64 78 78 ; difficulties_number_of_cyberdroids_table ; 0 1 2 3 4 5 &2776 00 00 02 02 03 04 ; difficulties_number_of_clones_table ; 0 1 2 3 4 5 &277c 00 03 03 04 04 04 ; difficulties_number_of_spinners_table ; 0 1 2 3 4 5 &2782 08 06 06 08 0a 0c ; player_bullet_direction_y_offset_table ; d u l r ur dr ul dl &2788 04 ff 02 02 01 03 01 03 ; player_bullet_direction_x_offset_table ; d u l r ur dr ul dl &2790 01 01 03 ff 03 04 ff fe ; bullet_direction_y_deltas_table ; d u l r ur dr ul dl &2798 01 ff 00 00 ff 01 ff 01 ; bullet_direction_x_deltas_table ; d u l r ur dr ul dl &27a0 00 00 01 ff 01 01 ff ff ; bullet_direction_screen_address_delta_high_table ; d u l r ur dr ul dl &27a8 00 ff 00 ff 00 00 ff ff ; bullet_direction_screen_address_delta_low_table ; d u l r ur dr ul dl &27b0 04 fc 08 f8 04 0c f4 fc ; directions_player_initial_y_table ; u d l r &27b8 1e 1e 32 0a ; directions_player_initial_x_table ; u d l r &27bc 07 45 27 27 ; directions_player_initial_feet_screen_address_high_table ; u d l r &27c0 58 5a 72 40 ; directions_player_initial_feet_screen_address_low_table ; u d l r &27c4 38 28 38 38 ; directions_player_initial_head_screen_address_high_table ; u d l r &27c8 55 57 6f 3d ; directions_player_initial_head_screen_address_low_table ; u d l r &27cc b8 a8 b8 b8 ; directions_room_delta_table ; u d l r &27d0 01 ff fc 04 ; directions_x_velocity_table ; u d l r &27d4 ff 01 00 00 ; directions_y_velocity_table ; u d l r &27d8 00 00 ff 01 ; direction_keycodes &27dc be ; A &27dd 9e ; Z &27de 99 ; < &27df 98 ; > # Rooms # ===== # level 1, room 1 level 1, room 2 level 1, room 3 level 1, room 4 # +--+--+--+--+--+ +--+--+--+--+--+ +--+--+--+--+--+ +--+--+--+ # | | | | | | | | # + +--+--+--+ + + +--+--+--+ + + +--+--+--+ + +--+ + + +--+ # | | | | | | | | | | | | | | | | # +--+ +--+ +--+ +--+ +--+ +--+ +--+ +--+ + +--+ +--+ + # | | | | | | # +--+ +--+ +--+ +--+--+ + + +--+ +--+ + +--+ +--+ + # | | | | | | | | | | | | | | | # + +--+ +--+ + + +--+ + + +--+--+--+ + +--+ + + +--+ # | | | | | | | | | | | # +--+--+ +--+--+ +--+--+ +--+--+ +--+--+--+--+--+ +--+ +--+ # # level 1, room 5 level 1, room 6 level 1, room 7 level 1, room 8 # +--+--+ +--+--+ +--+--+ +--+--+ +--+--+--+--+--+ +--+--+ +--+--+ # | | | | | | | | | | | | | # + +--+ + + + + +--+--+ + + + +--+ +--+ + +--+--+ +--+--+ # | | | | | | | | | | | | | | | # + + + + + + +--+ + + + +--+ + + + +--+--+ + + # | | | | | | | | | | | | # + +--+--+--+ + + + +--+ + + + +--+--+--+ + +--+ + + + # | | | | | | | | | | | | # +--+--+ + + +--+--+ + + + + +--+ + +--+--+--+ + # | | | | | | | | | | # +--+--+ +--+--+ +--+--+ +--+--+ +--+--+ +--+--+ +--+--+ +--+--+ # # level 1, room 9 level 1, room 10 level 1, room 11 level 1, room 12 # +--+--+ +--+--+ +--+--+ +--+--+ +--+--+ +--+--+ +--+--+ +--+--+ # | | | | | | | | | | | | # + + + + + +--+ +--+ + +--+--+ +--+--+ + +--+--+--+ + # | | | | | | | | | | | | | | | # + +--+ +--+--+ + +--+ +--+ + + + +--+ + + + + + + + # | | | | | | | | | | | | | | # + +--+ +--+--+ + +--+ +--+ + + +--+ + + + + + + + + + # | | | | | | | | | | | | | | | | | | | | # + + + + + +--+ +--+ + + +--+ +--+ + + + + + + + # | | | | | | | | | | | | # +--+--+ +--+--+ +--+--+ +--+--+ +--+--+--+--+--+ +--+--+ +--+--+ # # level 1, room 13 level 1, room 14 level 1, room 15 level 1, room 16 # +--+--+ +--+--+ +--+--+ +--+--+ +--+--+--+--+--+ +--+--+ +--+--+ # | | | | | | | | | | | | | # + +--+ + + +--+ +--+ + + +--+--+ + + + + + + # | | | | | | | | | | | | | | | | # + + +--+--+--+ +--+ + + + +--+ + + + +--+--+ + + # | | | | | | | | | | # + +--+ + + +--+ + + +--+--+--+ + + +--+--+--+ + # | | | | | | | | | | | | | # + + + + + +--+--+--+ + + +--+--+--+ + + + # | | | | | | | | # +--+--+--+--+--+ +--+--+--+--+--+ +--+--+--+--+--+ +--+--+--+--+--+ # # level 2, room 1 level 2, room 2 level 2, room 3 level 2, room 4 # +--+--+--+--+--+ +--+--+--+--+--+ +--+--+--+--+--+ +--+--+--+--+--+ # | | | | | | | | | | # + + + +--+--+--+ + +--+--+ +--+ + + + + +--+ + # | | | | | | | | | | | | | | | | | # +--+--+--+--+--+ +--+ + + +--+ + + + + + + + +--+--+ + + # | | | | | | | | | | # +--+--+ +--+ +--+ + + +--+ + +--+ + + + + + + + + + # | | | | | | | | | | | | | | | | | | | | # + + +--+ + + +--+--+--+ + + +--+ + + + + + + + + # | | | | | | | | | | | | | # +--+--+ +--+--+ +--+--+--+--+--+ +--+--+ +--+--+ +--+--+ +--+--+ # # level 2, room 5 level 2, room 6 level 2, room 7 level 2, room 8 # +--+--+ +--+--+ +--+--+--+--+--+ +--+--+ +--+--+ +--+--+ +--+--+ # | | | | | | | | | | | | | # + + + + + +--+--+--+ + + +--+ + + + + + + # | | | | | | | | | | | | | | | # + +--+--+ + + + + +--+--+--+ + + +--+--+--+ +--+--+ + + # | | | | | | | | | | # + +--+--+ + + +--+--+--+--+ + + + +--+ +--+ +--+--+ + + # | | | | | | | | | | | | | | # + + + + + +--+--+--+--+ + +--+--+--+ + + + + + # | | | | | | | | | | | # +--+--+ +--+--+ +--+--+ +--+--+ +--+--+--+--+--+ +--+--+ +--+--+ # # level 2, room 9 level 2, room 10 level 2, room 11 level 2, room 12 # +--+--+ +--+--+ +--+--+ +--+--+ +--+--+--+--+--+ +--+--+ +--+--+ # | | | | | | | | | | | | | | # + + + + + +--+ +--+ + + +--+--+--+ + + + +--+ + # | | | | | | | | | | | | | | | | # + +--+ +--+ + +--+ +--+ +--+ + + +--+ +--+--+--+ + + # | | | | | | | | | | | | | | # + +--+ +--+ + + +--+--+--+ + + + +--+ +--+ +--+ + + # | | | | | | | | | | | | | | | | | | # + + + + + +--+ +--+ + + +--+--+--+ + + +--+--+--+ + # | | | | | | | | | | # +--+--+ +--+--+ +--+--+ +--+--+ +--+--+--+--+--+ +--+--+--+--+--+ # # level 2, room 13 level 2, room 14 level 2, room 15 level 2, room 16 # +--+--+ +--+--+ +--+--+ +--+--+ +--+--+--+--+--+ +--+--+--+--+--+ # | | | | | | | | | | | | # + + + +--+ + + +--+ +--+ + + +--+--+--+ + + +--+--+ + + # | | | | | | | | | | | | | | | | # + + +--+ + +--+ +--+ +--+ + + +--+ +--+ + +--+ + # | | | | | | | # + +--+ +--+ + +--+--+ +--+--+ +--+ + + +--+ +--+ + +--+ + # | | | | | | | | | | | | | | | | # + + + +--+ + + +--+ + + +--+ +--+ + + +--+--+ + + # | | | | | | | | | # +--+--+--+--+--+ +--+--+--+--+--+ +--+--+--+--+--+ +--+--+--+--+--+ # # level 3, room 1 level 3, room 2 level 3, room 3 level 3, room 4 # +--+--+--+--+--+ +--+--+--+--+--+ +--+--+--+--+--+ +--+--+--+--+--+ # | | | | | | | | # + +--+--+--+--+ + +--+--+--+ + + +--+ +--+ + + +--+ + # | | | | | | | | | | | | | | | # +--+ + + + + + + +--+ +--+ + + +--+ +--+--+ + + # | | | | | | | | | | | | | # +--+ +--+--+ + + + +--+ + + + + + + + + + + # | | | | | | | | | | | | | | | | | | | # + +--+--+--+ + + +--+ +--+ + + + + + + + + +--+ +--+--+ # | | | | | | | | | | | | | # +--+--+ +--+--+ +--+--+ +--+--+ +--+--+ +--+--+ +--+--+--+--+--+ # # level 3, room 5 level 3, room 6 level 3, room 7 level 3, room 8 # +--+--+ +--+--+ +--+--+ +--+--+ +--+--+ +--+--+ +--+--+--+--+--+ # | | | | | | | | | | | | | # + +--+ +--+ + + +--+--+ + +--+ + +--+ + + +--+--+--+ + # | | | | | | | | | | | | | | | # + + +--+ +--+ + + +--+ +--+ +--+ +--+--+ + # | | | | | | | | # + + +--+ + + +--+ + +--+--+--+ + +--+ +--+ + # | | | | | | | | | | | | | | | # + +--+ +--+ + + +--+--+ + + +--+--+--+ + + +--+ + + # | | | | | | | | | | | | # +--+--+ +--+--+ +--+--+--+--+--+ +--+--+--+--+--+ +--+--+ +--+--+ # # level 3, room 9 level 3, room 10 level 3, room 11 level 3, room 12 # +--+--+ +--+--+ +--+--+--+--+--+ +--+--+--+--+--+ +--+--+ +--+--+ # | | | | | | | | | | # + +--+ + + + +--+--+--+ + + +--+ + +--+--+--+--+ + # | | | | | | | | | | | | | # +--+ +--+--+--+ +--+ +--+--+--+ +--+--+ +--+ + + +--+--+--+--+ # | | | | | | | | # + +--+--+ +--+ + +--+--+--+ + +--+--+ +--+ + +--+--+--+--+ + # | | | | | | | | | | | | | | | # + +--+ +--+ + + + + + + + + + + + + +--+--+--+--+ # | | | | | | | | | | | | | # +--+--+--+--+--+ +--+--+ +--+--+ +--+--+ +--+--+ +--+--+ +--+--+ # # level 3, room 13 level 3, room 14 level 3, room 15 level 3, room 16 # +--+ +--+ +--+ +--+--+ +--+--+ +--+--+ +--+--+ +--+--+ +--+--+ # | | | | | | | | | | | | | | # + +--+ +--+ + + + + + + +--+ +--+ + + +--+--+--+ + # | | | | | | | | | | | | | | # +--+ + +--+--+ +--+--+ +--+ +--+ +--+ + + + + # | | | | | | | | # +--+ + + + + +--+ +--+ + + + + + # | | | | | | | | | | | | # + +--+ +--+ + + +--+ + + +--+ +--+ + +--+ +--+ + # | | | | | | | | | | | | | | # +--+ +--+ +--+ +--+--+--+--+--+ +--+--+--+--+--+ +--+--+--+--+--+ # # level 4, room 1 level 4, room 2 level 4, room 3 level 4, room 4 # +--+--+--+--+--+ +--+--+--+--+--+ +--+--+--+--+--+ +--+--+--+--+--+ # | | | | | | | | | # +--+--+--+--+--+ + +--+ + + + + +--+--+ + + +--+--+--+--+ # | | | | | | | | | | | | | | # + +--+ + +--+ + + + + + + +--+--+ +--+ +--+--+ + # | | | | | | | | | | | | # + +--+ + + + +--+--+ + + +--+ +--+--+ +--+--+--+ + + # | | | | | | | | | | | | | | | # +--+--+--+--+--+ + + + + + + + + + + +--+ + # | | | | | | | | | | | | # +--+--+--+--+--+ +--+--+ +--+--+ +--+--+ +--+--+ +--+--+ +--+--+ # # level 4, room 5 level 4, room 6 level 4, room 7 level 4, room 8 # +--+--+--+--+--+ +--+--+ +--+--+ +--+--+ +--+--+ +--+--+ +--+--+ # | | | | | | | | | | | | | # + + + +--+ +--+ + + + + +--+--+ +--+--+ # | | | | | | | | | | | # + +--+--+--+ +--+ +--+ + +--+ + +--+--+--+--+--+ # | | | | | # + + +--+--+ +--+ +--+ + +--+ + +--+--+--+--+--+ # | | | | | | | | | | | | | # + + + + + +--+--+--+ + + + + +--+--+ +--+--+ # | | | | | | | | | | | | | # +--+--+ +--+--+ +--+--+--+--+--+ +--+--+ +--+--+ +--+--+ +--+--+ # # level 4, room 9 level 4, room 10 level 4, room 11 level 4, room 12 # +--+--+ +--+--+ +--+--+--+--+--+ +--+--+ +--+--+ +--+--+ +--+--+ # | | | | | | | | | | | | | | # + +--+--+ + + + + +--+--+ +--+ + +--+--+ + + # | | | | | | | | | | | # + +--+ +--+ + +--+ + + + + + + + +--+--+ + # | | | | | | | | | | | # + + +--+ + + +--+ + + + + + + +--+--+ + # | | | | | | | | | | | | | # + + + + +--+ + + +--+--+--+--+ + +--+--+ + + # | | | | | | | | | | | # +--+--+--+--+--+ +--+--+ +--+--+ +--+--+--+--+--+ +--+--+ +--+--+ # # level 4, room 13 level 4, room 14 level 4, room 15 level 4, room 16 # +--+--+--+--+--+ +--+--+ +--+--+ +--+--+--+--+--+ +--+--+ +--+--+ # | | | | | | | | | | # + +--+ + + +--+--+ + + + +--+--+--+ + + + +--+ + # | | | | | | | | | | | | | | | # + + +--+--+--+ +--+--+--+--+ + +--+--+--+ +--+ + + + +--+ + # | | | | | | | | # + + +--+--+--+ + +--+--+--+--+ + +--+--+ + +--+ + +--+ + # | | | | | | | | | | | | | # + +--+ + + +--+--+--+ + + +--+--+--+ + + + +--+ + # | | | | | | | | | | # +--+--+--+--+--+ +--+--+--+--+--+ +--+--+--+--+--+ +--+--+--+--+--+ ; room_data_one &27e0 ca cc 6c a3 cc 36 5b 6a 59 6b 59 6a 93 a6 35 c9 95 5c ; room &00 (level 1, room 1) &27f2 ca cc 6c a3 cc 36 59 6a 59 ca 35 20 03 5a 30 c9 85 5c ; room &01 (level 1, room 2) &2804 ca cc 6c a3 cc 36 59 00 59 6a 00 6a 93 cc 35 c9 cc 5c ; room &02 (level 1, room 3) &2816 a0 cc 06 5a 22 69 81 95 34 82 a6 34 69 11 5a 90 84 05 ; room &03 (level 1, room 4) &2828 ea a4 6c 93 34 32 03 10 33 83 cc 35 cb 04 30 c9 84 5c ; room &04 (level 1, room 5) &283a ca a4 6c a3 5c 32 33 68 13 33 58 23 93 6c 31 c9 94 5c ; room &05 (level 1, room 6) &284c ca cc 6c 83 a6 34 01 59 12 82 ce 25 03 a1 34 c9 94 5c ; room &06 (level 1, room 7) &285e ca a6 6c cb 95 7e a1 6c 33 5a 30 31 cb 5c 30 c9 84 5c ; room &07 (level 1, room 8) &2870 ca a6 6c 03 33 30 a3 95 5c 93 a6 6c 03 33 30 c9 95 5c ; room &08 (level 1, room 9) &2882 ca 84 6c a3 84 36 91 a6 15 a2 95 26 93 84 35 c9 84 5c ; room &09 (level 1, room 10) &2894 ca a6 6c cb 97 7c 01 a3 36 a2 37 33 93 95 35 c9 cc 5c ; room &0a (level 1, room 11) &28a6 ca 84 6c a3 cc 36 33 22 33 33 33 33 13 33 31 c9 95 5c ; room &0b (level 1, room 12) &28b8 ca 84 6c a3 04 30 33 e8 5c 93 36 20 03 11 30 c9 cc 5c ; room &0c (level 1, room 13) &28ca ca a6 6c a3 95 36 59 00 33 6a 00 33 93 cc 35 c9 cc 5c ; room &0d (level 1, room 14) &28dc ca cc 6e a3 6c 33 93 34 13 cb 5c 23 83 cc 35 c9 cc 5c ; room &0e (level 1, room 15) &28ee ca a6 6c 03 33 30 c9 35 30 ca 5c 30 03 00 30 c9 cc 5c ; room &0f (level 1, room 16) ; sprite_data &2900 00 11 05 05 00 24 24 30 33 0f 0f 0f 0f 0c 0c 03 00 22 0a 0a 00 18 18 30 ; &00 : SPRITE_PLAYER_HEAD_DOWN &2918 10 04 0c 0c 00 00 00 3c 03 03 03 03 00 00 00 00 20 08 08 08 08 08 0c 0c ; &01 : SPRITE_PLAYER_FEET_DOWN_ONE &2930 10 04 04 04 04 04 0c 0c 03 03 03 03 00 00 00 00 20 08 08 08 08 08 0c 0c ; &02 : SPRITE_PLAYER_FEET_DOWN_TWO &2948 10 04 04 04 04 04 0c 0c 03 03 03 03 00 00 00 00 20 08 0c 0c 00 00 00 3c ; &03 : SPRITE_PLAYER_FEET_DOWN_THREE &2960 00 11 11 05 00 24 24 24 33 33 33 0f 0f 0c 0c 0c 00 22 22 0a 00 18 18 18 ; &04 : SPRITE_PLAYER_HEAD_UP &2978 04 04 0c 0c 00 00 00 3c 0c 0c 00 00 00 00 00 00 08 08 08 08 08 08 0c 0c ; &05 : SPRITE_PLAYER_FEET_UP_ONE &2990 04 04 04 04 04 04 0c 0c 0c 0c 00 00 00 00 00 00 08 08 08 08 08 08 0c 0c ; &06 : SPRITE_PLAYER_FEET_UP_TWO &29a8 04 04 04 04 04 04 0c 0c 0c 0c 00 00 00 00 00 00 08 08 0c 0c 00 00 00 3c ; &07 : SPRITE_PLAYER_FEET_UP_THREE &29c0 11 27 27 0f 05 10 24 24 22 0f 0f 0f 0a 08 0c 0c 00 00 3c 00 00 00 00 00 ; &08 : SPRITE_PLAYER_HEAD_LEFT &29d8 30 30 04 04 04 0c 0c 00 21 21 08 0c 0c 04 04 04 03 03 00 00 00 00 08 08 ; &09 : SPRITE_PLAYER_FEET_LEFT_ONE &29f0 30 30 04 04 04 04 04 04 21 21 08 08 08 08 0c 0c 03 03 00 00 00 00 00 3c ; &0a : SPRITE_PLAYER_FEET_LEFT_TWO &2a08 30 30 04 04 04 04 0c 0c 21 21 08 0c 0c 04 04 00 03 03 00 00 00 08 08 00 ; &0b : SPRITE_PLAYER_FEET_LEFT_THREE &2a20 00 3c 00 00 00 00 00 00 11 0f 0f 0f 05 04 0c 0c 22 1b 1b 0f 0a 20 18 18 ; &0c : SPRITE_PLAYER_HEAD_RIGHT &2a38 03 03 00 00 00 00 04 04 12 12 04 0c 0c 08 08 08 30 30 08 08 08 0c 0c 00 ; &0d : SPRITE_PLAYER_FEET_RIGHT_ONE &2a50 03 03 00 00 00 00 00 3c 12 12 04 04 04 04 0c 0c 30 30 08 08 08 08 08 08 ; &0e : SPRITE_PLAYER_FEET_RIGHT_TWO &2a68 03 03 00 00 00 04 04 00 12 12 04 0c 0c 08 08 00 30 30 08 08 08 08 0c 0c ; &0f : SPRITE_PLAYER_FEET_RIGHT_THREE &2a80 11 27 27 0f 05 10 24 30 22 0f 0f 0f 0a 08 21 21 00 00 3c 00 01 03 02 00 ; &10 : SPRITE_PLAYER_HEAD_UP_RIGHT &2a98 30 04 04 04 04 0c 0c 00 0c 0c 08 0c 0c 04 04 04 00 00 00 00 00 00 08 08 ; &11 : SPRITE_PLAYER_FEET_UP_RIGHT_ONE &2ab0 30 04 04 04 04 04 04 04 0c 0c 08 08 08 08 0c 0c 00 00 00 00 00 00 00 3c ; &12 : SPRITE_PLAYER_FEET_UP_RIGHT_TWO &2ac8 30 04 04 04 04 04 0c 0c 0c 0c 08 0c 0c 04 04 00 00 00 00 00 00 08 08 00 ; &13 : SPRITE_PLAYER_FEET_UP_RIGHT_THREE &2ae0 11 27 27 0f 05 10 24 30 22 0f 0f 0f 0a 08 0c 0c 00 00 3c 00 00 00 00 00 ; &14 : SPRITE_PLAYER_HEAD_DOWN_RIGHT &2af8 30 04 04 04 04 0c 0c 00 21 21 08 0c 0c 04 04 04 00 02 03 01 00 00 08 08 ; &15 : SPRITE_PLAYER_FEET_DOWN_RIGHT_ONE &2b10 30 04 04 04 04 04 04 04 21 21 08 08 08 08 0c 0c 00 02 03 01 00 00 00 3c ; &16 : SPRITE_PLAYER_FEET_DOWN_RIGHT_TWO &2b28 30 04 04 04 04 04 0c 0c 21 21 08 0c 0c 04 04 00 00 02 03 01 00 08 08 00 ; &17 : SPRITE_PLAYER_FEET_DOWN_RIGHT_THREE &2b40 00 00 3c 00 02 03 01 00 11 0f 0f 0f 05 04 12 12 22 1b 1b 0f 0a 20 18 30 ; &18 : SPRITE_PLAYER_HEAD_UP_LEFT &2b58 00 00 00 00 00 00 04 04 0c 0c 04 0c 0c 08 08 08 30 08 08 08 08 0c 0c 00 ; &19 : SPRITE_PLAYER_FEET_UP_LEFT_ONE &2b70 00 00 00 00 00 00 00 3c 0c 0c 04 04 04 04 0c 0c 30 08 08 08 08 08 08 08 ; &1a : SPRITE_PLAYER_FEET_UP_LEFT_TWO &2b88 00 00 00 00 00 04 04 00 0c 0c 04 0c 0c 08 08 00 30 08 08 08 08 08 0c 0c ; &1b : SPRITE_PLAYER_FEET_UP_LEFT_THREE &2ba0 00 00 3c 00 00 00 00 00 11 0f 0f 0f 05 04 0c 0c 22 1b 1b 0f 0a 20 18 30 ; &1c : SPRITE_PLAYER_HEAD_DOWN_LEFT &2bb8 00 01 03 02 00 00 04 04 12 12 04 0c 0c 08 08 08 30 08 08 08 08 0c 0c 00 ; &1d : SPRITE_PLAYER_FEET_DOWN_LEFT_ONE &2bd0 00 01 03 02 00 00 00 3c 12 12 04 04 04 04 0c 0c 30 08 08 08 08 08 08 08 ; &1e : SPRITE_PLAYER_FEET_DOWN_LEFT_TWO &2be8 00 01 03 02 00 04 04 00 12 12 04 0c 0c 08 08 00 30 08 08 08 08 08 0c 0c ; &1f : SPRITE_PLAYER_FEET_DOWN_LEFT_THREE &2c00 3f 2a 2a 2a 2a 2a 2a 3f 3f 00 00 00 15 15 15 3f 2a 2a 2a 2a 2a 2a 2a 2a ; &20 : SPRITE_ZERO &2c18 00 00 00 00 00 00 00 00 15 15 15 15 3f 3f 3f 3f 00 00 00 00 00 00 00 00 ; &21 : SPRITE_ONE &2c30 3f 00 00 3f 3f 3f 3f 3f 3f 00 00 3f 00 00 3f 3f 2a 2a 2a 2a 00 00 2a 2a ; &22 : SPRITE_TWO &2c48 3f 00 00 3f 00 00 3f 3f 3f 00 00 3f 15 15 3f 3f 2a 2a 2a 2a 2a 2a 2a 2a ; &23 : SPRITE_THREE &2c60 2a 2a 2a 2a 3f 00 00 00 00 00 3f 3f 3f 3f 3f 3f 00 00 00 00 2a 00 00 00 ; &24 : SPRITE_FOUR &2c78 3f 2a 2a 3f 00 00 3f 3f 3f 00 00 3f 15 15 3f 3f 2a 00 00 2a 2a 2a 2a 2a ; &25 : SPRITE_FIVE &2c90 3f 2a 2a 3f 3f 3f 3f 3f 3f 00 00 3f 00 00 3f 3f 2a 00 00 2a 2a 2a 2a 2a ; &26 : SPRITE_SIX &2ca8 3f 00 00 00 00 00 00 00 3f 00 00 00 15 15 15 15 2a 2a 2a 2a 2a 2a 2a 2a ; &27 : SPRITE_SEVEN &2cc0 15 15 15 3f 3f 3f 3f 3f 3f 00 00 3f 00 00 3f 3f 2a 2a 2a 2a 2a 2a 2a 2a ; &28 : SPRITE_EIGHT &2cd8 3f 2a 2a 3f 00 00 00 00 3f 00 00 3f 15 15 15 15 2a 2a 2a 2a 2a 2a 2a 2a ; &29 : SPRITE_NINE &2cf0 f3 aa ff a8 fc a2 f3 ff fc a8 0c 0c 0c 0c 54 fc ff f3 51 fc 54 ff 55 f3 ; &2a : SPRITE_SPINNER &2d08 00 10 30 f6 f6 30 10 00 30 30 30 fb fb 30 30 30 00 20 30 fd fd 30 20 00 ; &2b : SPRITE_CLONE &2d20 00 05 b2 b8 aa 11 32 11 cc 0f 0f 30 0f 33 30 33 00 0a 71 74 55 22 31 22 ; &2c : SPRITE_CYBERDROID &2d38 cf 45 45 8a db 8a de 45 00 00 aa 54 aa 54 f7 cf cf 8a 8a 45 45 e7 45 8a ; &2d : SPRITE_MAGIC_POTION &2d50 00 00 50 50 50 f0 f0 a0 50 f0 f0 50 50 f0 f0 f0 00 a0 f0 50 50 f0 f0 f0 ; &2e : SPRITE_SPOOK_TOP &2d68 a0 00 00 50 50 50 f0 a0 f0 f0 f0 a0 a0 00 00 00 50 00 00 00 00 00 00 00 ; &2f : SPRITE_SPOOK_BOTTOM &2d80 00 15 15 15 00 3f 00 2a 3f 00 00 3f 00 3f 00 3f 00 2a 2a 2a 00 3f 00 15 ; &30 : SPRITE_SKELETON_HEAD &2d98 2a 00 00 15 00 15 15 3f 00 3f 00 3f 00 00 00 00 15 00 00 2a 00 2a 2a 3f ; &31 : SPRITE_SKELETON_FEET &2db0 00 45 00 45 cf cf 45 00 00 cf cf cf cf cf cf cf 00 8a 00 8a cf cf 8a 00 ; &32 : SPRITE_POT_OF_GOLD &2dc8 00 00 00 00 05 27 27 33 00 00 00 00 0a 0a 1a 1a 00 00 00 00 01 09 30 30 ; &33 : SPRITE_DEAD_PLAYER_LEFT &2de0 00 00 00 00 00 08 0c 0c 00 00 00 00 00 00 0c 0c 00 00 00 00 04 04 0c 0c ; &34 : SPRITE_DEAD_PLAYER_RIGHT &2df8 3f 2a 2a 2a 3f 3f 3f 3f 3f 00 00 00 00 00 00 3f 2a 00 00 00 00 00 00 2a ; &35 : SPRITE_C &2e10 3f 2a 2a 2a 3f 3f 3f 3f 3f 15 15 15 3f 00 00 00 00 00 00 2a 2a 2a 2a 2a ; &36 : SPRITE_R &2e28 3f 2a 2a 3f 3f 3f 3f 3f 3f 00 00 3f 00 00 3f 3f 2a 00 00 2a 00 00 2a 2a ; &37 : SPRITE_E &2e40 15 15 15 15 3f 3f 3f 3f 3f 15 15 00 00 00 00 00 3f 15 15 15 3f 3f 3f 3f ; &38 : SPRITE_M &2e58 11 05 10 10 04 04 04 04 0a 0a 00 21 00 00 00 08 00 00 00 00 00 00 00 00 ; &39 : SPRITE_LIFE &2e70 00 05 15 2b 15 05 15 00 00 05 02 07 0b 05 00 00 00 2a 00 2a 00 2a 00 00 ; &3a : SPRITE_EXPLOSION_ONE &2e88 2f 05 03 2f 05 01 05 0a 05 02 03 03 03 0f 05 2a 1f 2a 00 1f 0a 02 00 1f ; &3b : SPRITE_EXPLOSION_TWO &2ea0 00 15 15 2a 00 2a 15 00 15 00 00 00 00 00 15 2a 00 2a 15 00 2a 15 2a 00 ; &3c : SPRITE_EXPLOSION_THREE &2eb8 cf 8a 8a 8a 8a 8a 8a cf cf 00 00 45 00 00 00 cf cf 45 45 45 45 45 45 cf ; &3d : SPRITE_SAFE &2ed0 00 00 45 8a 8a 8a 45 00 cf cf 00 00 00 00 cf 00 00 00 8a 45 45 45 8a 00 ; &3e : SPRITE_RING &2ee8 45 45 45 00 00 00 00 00 cf 45 cf 8a 8a cf 8a cf 00 00 00 00 00 00 00 00 ; &3f : SPRITE_KEY ; unused # Source code fragment &2f00 3f 53 42 43 73 78 2b 31 34 3a 42 50 4c 6c 70 73 ; ... ?SBCsx+14:BPLlps1:.#255:CLC:ADC#1 &2f10 31 3a 82 23 32 35 35 3a 43 4c 43 3a 41 44 43 23 &2f20 31 0d &2f22 0f fa 17 2e 6c 70 73 31 20 43 4d 50 23 33 3a 42 ; 4090.lps1 CMP#3:BPLlp ... &2f32 50 4c 6c 70 ; collected_objects_sprites &2f36 3d ; SPRITE_SAFE &2f37 3f ; SPRITE_KEY &2f38 3e ; SPRITE_RING &2f39 32 ; SPRITE_POT_OF_GOLD &2f3a 3e ; SPRITE_RING &2f3b 32 ; SPRITE_POT_OF_GOLD &2f3c 2d ; SPRITE_MAGIC_POTION ; unused # Source code fragment &2f3d 4c 44 41 ; ... LDA ; sprite_addresses_high_table &2f40 29 29 29 29 29 29 29 29 29 29 29 2a 2a 2a 2a 2a &2f50 2a 2a 2a 2a 2a 2a 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b &2f60 2c 2c 2c 2c 2c 2c 2c 2c 2c 2c 2c 2d 2d 2d 2d 2d &2f70 2d 2d 2d 2d 2d 2d 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e ; sprite_addresses_low_table &2f80 00 18 30 48 60 78 90 a8 c0 d8 f0 08 20 38 50 68 &2f90 80 98 b0 c8 e0 f8 10 28 40 58 70 88 a0 b8 d0 e8 &2fa0 00 18 30 48 60 78 90 a8 c0 d8 f0 08 20 38 50 68 &2fb0 80 98 b0 c8 e0 f8 10 28 40 58 70 88 a0 b8 d0 e8 ; unused # Source code fragment &2fc0 41 23 30 3a 53 54 41 26 ; ... A#0:STA& ... ; wall_sprite_column_addresses_low_table &2fc8 f5 ; 0 : &2ff5 = wall_sprites_column_0_data &2fc9 ea ; 1 : &2fea = wall_sprites_column_1_data &2fca df ; 2 : &2fdf = wall_sprites_column_2_data ; wall_middle_table &2fcb 02 05 08 0a ; wall_inner_rows_table &2fcf 01 02 04 05 07 08 0a 0a ; wall_outer_rows_table &2fd7 00 02 03 02 06 02 09 02 ; wall_sprites_column_2_data &2fdf 80 c0 c2 80 c0 c2 c0 c3 c3 c0 c3 ; wall_sprites_column_1_data &2fea c0 c3 c3 c0 c3 c3 c0 c3 c3 c0 c3 ; wall_sprites_column_0_data &2ff5 40 c0 c1 c0 c3 c3 40 c0 c1 c0 c3 # &3b80 - &3f7f is moved to &0400 - &07ff at &4fb6 ; room_data_two &0400 ca cc 6c 03 00 30 cb cc 5c cb 06 6a 03 a3 35 c9 95 5c ; room &10 (level 2, room 1) &0412 ca cc 6c a3 ce 36 59 23 59 6a 31 6a 93 dc 35 c9 cc 5c ; room &11 (level 2, room 2) &0424 ca ec 6c cb 96 36 21 21 33 92 36 33 03 5b 31 c9 85 5c ; room &12 (level 2, room 3) &0436 ca ce 6c 23 a3 36 b3 5d 31 33 22 32 13 33 31 c9 95 5c ; room &13 (level 2, room 4) &0448 ca a4 6c 03 30 32 83 5c 13 83 6c 23 03 30 31 c9 94 5c ; room &14 (level 2, room 5) &045a ca cc 6c a3 cc 34 31 c8 7c da cc 34 83 cc 7c c9 84 5c ; room &15 (level 2, room 6) &046c ca a6 6c a3 35 30 33 fa 5c 33 59 6a 93 cc 35 c9 cc 5c ; room &16 (level 2, room 7) &047e ca a6 6c 03 33 30 c9 35 30 ca 36 30 03 33 30 c9 95 5c ; room &17 (level 2, room 8) &0490 ca a6 6c 03 33 30 a3 95 36 93 a6 35 03 33 30 c9 95 5c ; room &18 (level 2, room 9) &04a2 ca a6 6c a3 95 36 5b 6a 79 a3 ff 36 93 95 35 c9 84 5c ; room &19 (level 2, room 10) &04b4 ca cc 6c a3 cc 36 33 00 59 33 00 6a 93 cc 35 c9 cc 5c ; room &1a (level 2, room 11) &04c6 ca a6 6c 03 93 36 c9 6f 33 6a 59 33 93 cc 35 c9 cc 5c ; room &1b (level 2, room 12) &04d8 ca 86 6e 23 a1 35 33 5a 10 b3 85 26 13 82 35 c9 cd 5c ; room &1c (level 2, room 13) &04ea ca a6 6c a3 95 36 59 00 59 ca a6 6c 03 59 30 c9 cc 5c ; room &1d (level 2, room 14) &04fc ca cc 6c 83 ee 34 49 33 58 4a 33 68 83 95 34 c9 cc 5c ; room &1e (level 2, room 15) &050e ca cc 6c 83 4e 32 49 83 35 4a 83 36 83 4d 31 c9 cc 5c ; room &1f (level 2, room 16) &0520 ca cc 6c a3 ec 7c 5b 12 32 6b cb 37 93 cf 35 c9 85 5c ; room &20 (level 3, room 1) &0532 ca cc 6c a3 cc 36 33 00 59 33 00 6a 93 a6 35 c9 95 5c ; room &21 (level 3, room 2) &0544 ca cc 6c 83 a6 34 69 33 5a 32 33 23 13 33 31 c9 95 5c ; room &22 (level 3, room 3) &0556 ca cc 6c 03 68 30 c9 36 30 02 33 30 83 95 7c c9 cc 5c ; room &23 (level 3, room 4) &0568 ca a6 6c a3 95 36 33 00 59 33 00 6a 93 a6 35 c9 95 5c ; room &24 (level 3, room 5) &057a ca a4 6c 83 5c 30 69 00 30 32 00 78 93 4c 30 c9 cc 5c ; room &25 (level 3, room 6) &058c ca a6 6c 6b 93 36 93 05 5b a3 cc 27 93 cc 35 c9 cc 5c ; room &26 (level 3, room 7) &059e ca cc 6c a3 cc 36 59 ca 35 6a 69 30 93 36 30 c9 95 5c ; room &27 (level 3, room 8) &05b0 ca a6 6c a3 35 30 5b fa 5c a3 5f 6a 93 a5 35 c9 dc 5c ; room &28 (level 3, room 9) &05c2 ca cc 6c 83 ce 34 69 c9 5c b2 cc 26 13 22 31 c9 95 5c ; room &29 (level 3, room 10) &05d4 ca cc 6c 03 6a 30 c9 95 36 ca a6 35 03 33 30 c9 95 5c ; room &2a (level 3, room 11) &05e6 ca 84 6c cb cc 34 83 cc 7c cb cc 34 83 cc 7c c9 84 5c ; room &2b (level 3, room 12) &05f8 6a 6a 6a 93 95 35 69 00 10 5a 00 20 a3 a6 36 59 59 59 ; room &2c (level 3, room 13) &060a ca a6 6c 03 33 30 c9 95 5c 02 00 20 03 6a 30 c9 dd 5c ; room &2d (level 3, room 14) &061c ca 84 6c 83 86 36 69 69 79 92 96 36 03 49 79 c9 cc 5c ; room &2e (level 3, room 15) &062e ca 84 6c a3 cc 36 33 00 33 33 00 33 93 84 35 c9 cc 5c ; room &2f (level 3, room 16) &0640 ca cc 6c cb cc 7c 03 6a 10 03 59 20 cb cc 7c c9 cc 5c ; room &30 (level 4, room 1) &0652 ca ec 6c 83 36 32 69 13 33 32 cb 35 13 03 30 c9 85 5c ; room &31 (level 4, room 2) &0664 ca cc 6c a3 6c 30 33 90 5c 93 a6 6c 03 33 30 c9 95 5c ; room &32 (level 4, room 3) &0676 ca cc 6c a3 cc 7c 59 ca 36 ca 6f 33 03 93 35 c9 85 5c ; room &33 (level 4, room 4) &0688 ca cc 6c 03 00 30 03 ca 5c 03 a3 6c 03 33 30 c9 95 5c ; room &34 (level 4, room 5) &069a ca a6 6c a3 95 36 59 00 59 6a 00 6a 93 cc 35 c9 cc 5c ; room &35 (level 4, room 6) &06ac ca 86 6c 03 03 30 01 49 30 02 4a 30 03 03 30 c9 85 5c ; room &36 (level 4, room 7) &06be ca a6 6c cb 95 7c cb cc 7c cb cc 7c cb a6 7c c9 95 5c ; room &37 (level 4, room 8) &06d0 ca a4 6c 83 5c 30 03 4a 5a 03 83 25 03 01 30 c9 cc 5c ; room &38 (level 4, room 9) &06e2 ca ec 6c 03 30 30 81 36 12 02 5b 23 83 05 33 c9 84 5d ; room &39 (level 4, room 10) &06f4 ca a6 6c cb 95 36 01 00 33 02 00 33 cb cc 35 c9 cc 5c ; room &3a (level 4, room 11) &0706 ca a6 6c cb 35 30 a3 5c 30 93 6c 30 cb 36 30 c9 95 5c ; room &3b (level 4, room 12) &0718 ca cc 6c a3 06 30 33 c9 5c 33 ca 6c 93 05 30 c9 cc 5c ; room &3c (level 4, room 13) &072a ca a4 6c 83 5c 32 c9 cc 15 a2 cc 6c 93 cc 34 c9 cc 5c ; room &3d (level 4, room 14) &073c ca cc 6c a3 cc 36 f9 6c 59 92 5c 20 a3 cc 36 d9 cc 5d ; room &3e (level 4, room 15) &074e ca 86 6c 03 83 36 21 a3 35 5a 93 36 03 81 35 c9 cc 5c ; room &3f (level 4, room 16) ; rooms_filled_walls ; 0 1 2 3 4 5 6 7 8 9 a b c d e f &0760 01 01 01 00 00 00 00 01 01 00 01 00 00 01 00 01 ; &00 &0770 01 01 00 00 00 00 01 01 01 01 01 01 00 01 00 00 ; &10 &0780 01 01 00 00 01 00 01 01 01 00 01 00 00 01 00 00 ; &20 &0790 01 00 01 01 01 01 00 01 00 00 01 01 01 00 01 00 ; &30 ; wall_sprites &07a0 08 08 08 08 08 00 08 08 0c 0c 00 0c 0c 0c 0c 0c 04 04 04 04 04 00 04 04 ; &00 : green vertical blocks &07b8 10 10 20 20 10 10 02 02 04 04 08 08 04 04 20 20 01 01 02 02 01 01 08 08 ; &01 : red/green/blue zigzags &07d0 20 20 00 30 30 30 00 20 30 30 00 30 30 30 00 30 30 30 00 10 10 10 00 30 ; &02 : blue horizontal blocks &07e8 11 00 22 33 33 22 00 11 33 33 00 00 00 00 33 33 22 00 11 33 33 11 00 22 ; &03 : magenta circles ; introduction_screen_data &3f80 81 50 82 52 83 4f 84 47 85 52 86 41 87 4d 81 50 ; ".P.R.O.G.R.A.M.P.O.W.E.R.M.I.C.R.O.P.O.W" &3f90 82 4f 83 57 84 45 85 52 86 4d 87 49 81 43 82 52 ; ".R .E" &3fa0 83 4f 84 50 85 4f 86 57 82 52 20 20 20 20 20 20 ; ".O .R" &3fb0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ; ".G .P" &3fc0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 87 45 ; ".R .PROGRAM POWER .R" &3fd0 83 4f 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ; ".A .O" &3fe0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ; ".M .G" &3ff0 20 20 20 20 20 20 81 52 84 47 20 20 20 20 20 20 ; ".P .7!00u0p0p0u0p0p0p0 .R" &4000 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ; ".O .5.5555=%5.5.5.5555 .A" &4010 20 20 20 20 20 20 20 20 20 20 20 20 20 20 82 50 ; ".W ...s5.............. .M" &4020 85 52 20 20 20 20 20 20 20 20 20 20 20 81 50 52 ; ".E .P" &4030 4f 47 52 41 4d 20 50 4f 57 45 52 20 20 20 20 20 ; ".R .O" &4040 20 20 20 20 20 20 83 52 86 41 20 20 20 20 20 20 ; ".M .by Matthew Bates .W" &4050 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ; ".I .E" &4060 20 20 20 20 20 20 20 20 20 20 20 20 20 20 84 4f ; ".C .R" &4070 87 4d 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ; ".R .Do you want instructions? .M" &4080 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ; ".O .I" &4090 20 20 20 20 20 20 85 47 81 50 20 20 20 20 20 20 ; ".P .(Press Y or N) .C" &40a0 20 20 20 95 37 21 30 30 75 30 70 30 70 30 75 30 ; ".O .R" &40b0 70 30 70 30 70 30 20 20 20 20 20 20 20 20 86 52 ; ".W .O" &40c0 82 4f 20 20 20 20 20 20 20 20 20 95 35 00 35 35 ; ".E .P" &40d0 35 35 3d 25 35 00 35 00 35 00 35 35 35 35 20 20 ; ".R .This software is copyright .O" &40e0 20 20 20 20 20 20 87 41 83 57 20 20 20 20 20 20 ; ".P .(C) Micro Power Ltd. 1983 .W" &40f0 20 20 20 95 a3 a1 73 35 a3 a1 a3 a1 a1 00 a1 00 ; ".R .E" &4100 a1 00 a3 a1 a1 a1 20 20 20 20 20 20 20 20 81 4d ; ".O.G.R.A.M.P.O.W.E.R.M.I.C.R.O.P.O.W.E.R" &4110 84 45 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ; " " &4120 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 &4130 20 20 20 20 20 20 82 50 85 52 20 20 20 20 20 20 &4140 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 &4150 20 20 20 20 20 20 20 20 20 20 20 20 20 20 83 4f &4160 86 4d 20 20 20 20 20 20 20 20 20 20 84 62 79 20 &4170 4d 61 74 74 68 65 77 20 42 61 74 65 73 20 20 20 &4180 20 20 20 20 20 20 84 57 87 49 20 20 20 20 20 20 &4190 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 &41a0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 85 45 &41b0 81 43 20 20 20 20 20 20 20 20 20 20 20 20 20 20 &41c0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 &41d0 20 20 20 20 20 20 86 52 82 52 20 20 20 20 20 83 &41e0 44 6f 20 79 6f 75 20 77 61 6e 74 20 69 6e 73 74 &41f0 72 75 63 74 69 6f 6e 73 3f 20 20 20 20 20 87 4d &4200 83 4f 20 20 20 20 20 20 20 20 20 20 20 20 20 20 &4210 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 &4220 20 20 20 20 20 20 81 49 84 50 20 20 20 20 20 20 &4230 20 20 20 20 20 81 28 50 72 65 73 73 20 59 20 6f &4240 72 20 4e 29 20 20 20 20 20 20 20 20 20 20 82 43 &4250 85 4f 20 20 20 20 20 20 20 20 20 20 20 20 20 20 &4260 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 &4270 20 20 20 20 20 20 83 52 86 57 20 20 20 20 20 20 &4280 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 &4290 20 20 20 20 20 20 20 20 20 20 20 20 20 20 84 4f &42a0 87 45 20 20 20 20 20 20 20 20 20 20 20 20 20 20 &42b0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 &42c0 20 20 20 20 20 20 85 50 81 52 20 20 20 20 20 84 &42d0 54 68 69 73 20 73 6f 66 74 77 61 72 65 20 69 73 &42e0 20 63 6f 70 79 72 69 67 68 74 20 20 20 20 86 4f &42f0 82 50 20 20 20 20 20 84 28 43 29 20 20 4d 69 63 &4300 72 6f 20 50 6f 77 65 72 20 4c 74 64 2e 20 31 39 &4310 38 33 20 20 20 20 87 57 83 52 20 20 20 20 20 20 &4320 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 &4330 20 20 20 20 20 20 20 20 20 20 20 20 20 20 81 45 &4340 84 4f 85 47 86 52 87 41 81 4d 82 50 83 4f 84 57 &4350 85 45 86 52 87 4d 81 49 82 43 83 52 84 4f 85 50 &4360 86 4f 87 57 81 45 82 52 20 20 20 20 20 20 20 20 &4370 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ; instructions_screen_one_data &4380 81 49 4e 53 54 52 55 43 54 49 4f 4e 53 20 20 20 ; ".INSTRUCTIONS " &4390 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ; " " &43a0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ; ".Press SPACE after reading each page " &43b0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ; " " &43c0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ; " " &43d0 81 50 72 65 73 73 20 53 50 41 43 45 20 61 66 74 ; ".The Fort " &43e0 65 72 20 72 65 61 64 69 6e 67 20 65 61 63 68 20 ; " " &43f0 70 61 67 65 20 20 20 20 20 20 20 20 20 20 20 20 ; ".Equipped with the latest rapid fire " &4400 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ; ".laser rifle, your mission is to attack " &4410 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ; ".Fort Cybertron and find the treasure " &4420 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ; ".guarded by the enemy robots. The fort " &4430 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ; ".is built on many levels with strangely " &4440 20 20 20 20 20 20 20 20 85 54 68 65 20 46 6f 72 ; ".shaped rooms to confuse invaders. Avoid" &4450 74 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ; ".touching the walls because they are " &4460 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ; ".electrified to 1,000,000 Volts. " &4470 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ; " " &4480 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ; ".The Treasure " &4490 20 20 20 20 20 20 20 20 82 45 71 75 69 70 70 65 ; " " &44a0 64 20 77 69 74 68 20 74 68 65 20 6c 61 74 65 73 ; ".On reaching each level you will be " &44b0 74 20 72 61 70 69 64 20 66 69 72 65 20 20 20 20 ; ".instructed as to which objects you must" &44c0 82 6c 61 73 65 72 20 72 69 66 6c 65 2c 20 79 6f ; ".find on that level. Somewhere on each " &44d0 75 72 20 6d 69 73 73 69 6f 6e 20 69 73 20 74 6f ; ".level is a.safe.and this is where you " &44e0 20 61 74 74 61 63 6b 20 82 46 6f 72 74 20 43 79 ; ".must take the objects when you have " &44f0 62 65 72 74 72 6f 6e 20 61 6e 64 20 66 69 6e 64 ; ".collected all of them. " &4500 20 74 68 65 20 74 72 65 61 73 75 72 65 20 20 20 ; " " &4510 82 67 75 61 72 64 65 64 20 62 79 20 74 68 65 20 ; " " &4520 65 6e 65 6d 79 20 72 6f 62 6f 74 73 2e 20 54 68 &4530 65 20 66 6f 72 74 20 20 82 69 73 20 62 75 69 6c &4540 74 20 6f 6e 20 6d 61 6e 79 20 6c 65 76 65 6c 73 &4550 20 77 69 74 68 20 73 74 72 61 6e 67 65 6c 79 20 &4560 82 73 68 61 70 65 64 20 72 6f 6f 6d 73 20 74 6f &4570 20 63 6f 6e 66 75 73 65 20 69 6e 76 61 64 65 72 &4580 73 2e 20 41 76 6f 69 64 82 74 6f 75 63 68 69 6e &4590 67 20 74 68 65 20 77 61 6c 6c 73 20 62 65 63 61 &45a0 75 73 65 20 74 68 65 79 20 61 72 65 20 20 20 20 &45b0 82 65 6c 65 63 74 72 69 66 69 65 64 20 74 6f 20 &45c0 31 2c 30 30 30 2c 30 30 30 20 56 6f 6c 74 73 2e &45d0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 &45e0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 &45f0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 &4600 85 54 68 65 20 54 72 65 61 73 75 72 65 20 20 20 &4610 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 &4620 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 &4630 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 &4640 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 &4650 82 4f 6e 20 72 65 61 63 68 69 6e 67 20 65 61 63 &4660 68 20 6c 65 76 65 6c 20 79 6f 75 20 77 69 6c 6c &4670 20 62 65 20 20 20 20 20 82 69 6e 73 74 72 75 63 &4680 74 65 64 20 61 73 20 74 6f 20 77 68 69 63 68 20 &4690 6f 62 6a 65 63 74 73 20 79 6f 75 20 6d 75 73 74 &46a0 82 66 69 6e 64 20 6f 6e 20 74 68 61 74 20 6c 65 &46b0 76 65 6c 2e 20 53 6f 6d 65 77 68 65 72 65 20 6f &46c0 6e 20 65 61 63 68 20 20 82 6c 65 76 65 6c 20 69 &46d0 73 20 61 82 73 61 66 65 82 61 6e 64 20 74 68 69 &46e0 73 20 69 73 20 77 68 65 72 65 20 79 6f 75 20 20 &46f0 82 6d 75 73 74 20 74 61 6b 65 20 74 68 65 20 6f &4700 62 6a 65 63 74 73 20 77 68 65 6e 20 79 6f 75 20 &4710 68 61 76 65 20 20 20 20 82 63 6f 6c 6c 65 63 74 &4720 65 64 20 61 6c 6c 20 6f 66 20 74 68 65 6d 2e 20 &4730 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 &4740 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 &4750 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 &4760 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 &4770 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ; instructions_screen_two_data &4780 85 54 68 65 20 45 6e 65 6d 79 20 52 6f 62 6f 74 ; ".The Enemy Robots " &4790 73 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ; " " &47a0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ; ".There are various types of robots " &47b0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ; ".patrolling the fort, some armed with " &47c0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ; ".fire power that matches your own. On " &47d0 82 54 68 65 72 65 20 61 72 65 20 76 61 72 69 6f ; ".higher levels you will meet more " &47e0 75 73 20 74 79 70 65 73 20 6f 66 20 72 6f 62 6f ; ".intelligent robots, heavily armed and " &47f0 74 73 20 20 20 20 20 20 82 70 61 74 72 6f 6c 6c ; ".programmed to defend the fort at all " &4800 69 6e 67 20 74 68 65 20 66 6f 72 74 2c 20 73 6f ; ".costs! " &4810 6d 65 20 61 72 6d 65 64 20 77 69 74 68 20 20 20 ; " " &4820 82 66 69 72 65 20 70 6f 77 65 72 20 74 68 61 74 ; ".Robots are not stupid so they won't " &4830 20 6d 61 74 63 68 65 73 20 79 6f 75 72 20 6f 77 ; ".deliberately walk into you but don't " &4840 6e 2e 20 4f 6e 20 20 20 82 68 69 67 68 65 72 20 ; ".let them get too close or you could get" &4850 6c 65 76 65 6c 73 20 79 6f 75 20 77 69 6c 6c 20 ; ".trapped. " &4860 6d 65 65 74 20 6d 6f 72 65 20 20 20 20 20 20 20 ; " " &4870 82 69 6e 74 65 6c 6c 69 67 65 6e 74 20 72 6f 62 ; ".Watch out for Spook, the ghost of the " &4880 6f 74 73 2c 20 68 65 61 76 69 6c 79 20 61 72 6d ; ".last person who tried to enter the " &4890 65 64 20 61 6e 64 20 20 82 70 72 6f 67 72 61 6d ; ".fort. He can walk through walls and is " &48a0 6d 65 64 20 74 6f 20 64 65 66 65 6e 64 20 74 68 ; ".indestructable, although a blast from " &48b0 65 20 66 6f 72 74 20 61 74 20 61 6c 6c 20 20 20 ; ".a laser will stun him for a second. " &48c0 82 63 6f 73 74 73 21 20 20 20 20 20 20 20 20 20 ; " " &48d0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ; " " &48e0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ; " " &48f0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ; " " &4900 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ; " " &4910 82 52 6f 62 6f 74 73 20 61 72 65 20 6e 6f 74 20 ; " " &4920 73 74 75 70 69 64 20 73 6f 20 74 68 65 79 20 77 &4930 6f 6e 27 74 20 20 20 20 82 64 65 6c 69 62 65 72 &4940 61 74 65 6c 79 20 77 61 6c 6b 20 69 6e 74 6f 20 &4950 79 6f 75 20 62 75 74 20 64 6f 6e 27 74 20 20 20 &4960 82 6c 65 74 20 74 68 65 6d 20 67 65 74 20 74 6f &4970 6f 20 63 6c 6f 73 65 20 6f 72 20 79 6f 75 20 63 &4980 6f 75 6c 64 20 67 65 74 82 74 72 61 70 70 65 64 &4990 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 &49a0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 &49b0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 &49c0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 &49d0 20 20 20 20 20 20 20 20 82 57 61 74 63 68 20 6f &49e0 75 74 20 66 6f 72 20 53 70 6f 6f 6b 2c 20 74 68 &49f0 65 20 67 68 6f 73 74 20 6f 66 20 74 68 65 20 20 &4a00 82 6c 61 73 74 20 70 65 72 73 6f 6e 20 77 68 6f &4a10 20 74 72 69 65 64 20 74 6f 20 65 6e 74 65 72 20 &4a20 74 68 65 20 20 20 20 20 82 66 6f 72 74 2e 20 48 &4a30 65 20 63 61 6e 20 77 61 6c 6b 20 74 68 72 6f 75 &4a40 67 68 20 77 61 6c 6c 73 20 61 6e 64 20 69 73 20 &4a50 82 69 6e 64 65 73 74 72 75 63 74 61 62 6c 65 2c &4a60 20 61 6c 74 68 6f 75 67 68 20 61 20 62 6c 61 73 &4a70 74 20 66 72 6f 6d 20 20 82 61 20 6c 61 73 65 72 &4a80 20 77 69 6c 6c 20 73 74 75 6e 20 68 69 6d 20 66 &4a90 6f 72 20 61 20 73 65 63 6f 6e 64 2e 20 20 20 20 &4aa0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 &4ab0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 &4ac0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 &4ad0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 &4ae0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 &4af0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 &4b00 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 &4b10 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 &4b20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 &4b30 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 &4b40 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 &4b50 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 &4b60 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 &4b70 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ; instructions_screen_three_data &4b80 85 53 63 6f 72 69 6e 67 20 53 79 73 74 65 6d 20 ; ".Scoring System " &4b90 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ; " " &4ba0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ; " " &4bb0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ; ".Points scored for hitting robots: " &4bc0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ; " " &4bd0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ; ". Spinner................20 " &4be0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ; ". Clone..................60 " &4bf0 20 20 20 20 20 20 20 20 82 50 6f 69 6e 74 73 20 ; " .Cyber-droid...........100 " &4c00 73 63 6f 72 65 64 20 66 6f 72 20 68 69 74 74 69 ; ". Spook............no score " &4c10 6e 67 20 72 6f 62 6f 74 73 3a 20 20 20 20 20 20 ; " " &4c20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ; ".Collecting treasure: " &4c30 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ; " " &4c40 20 20 20 20 20 20 20 20 83 20 20 20 20 20 53 70 ; ". Key...................100 " &4c50 69 6e 6e 65 72 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e ; ". Ring..................500 " &4c60 2e 2e 2e 2e 2e 32 30 20 20 20 20 20 20 20 20 20 ; ". Pot of Gold..........1000 " &4c70 83 20 20 20 20 20 43 6c 6f 6e 65 2e 2e 2e 2e 2e ; " " &4c80 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 36 30 20 ; ".Bonus of.250.scored for destroying all " &4c90 20 20 20 20 20 20 20 20 20 20 20 20 20 83 43 79 ; ".the robots in a room. " &4ca0 62 65 72 2d 64 72 6f 69 64 2e 2e 2e 2e 2e 2e 2e ; " " &4cb0 2e 2e 2e 2e 31 30 30 20 20 20 20 20 20 20 20 20 ; ".Extra Lives " &4cc0 83 20 20 20 20 20 53 70 6f 6f 6b 2e 2e 2e 2e 2e ; " " &4cd0 2e 2e 2e 2e 2e 2e 2e 6e 6f 20 73 63 6f 72 65 20 ; ".One extra life is awarded on reaching " &4ce0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ; ".each level and for every 10,000 points " &4cf0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ; ".scored. Finding and drinking the magic " &4d00 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ; ".potion also gives you another life. " &4d10 82 43 6f 6c 6c 65 63 74 69 6e 67 20 74 72 65 61 ; " " &4d20 73 75 72 65 3a 20 20 20 20 20 20 20 20 20 20 20 &4d30 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 &4d40 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 &4d50 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 &4d60 83 20 20 20 20 20 4b 65 79 2e 2e 2e 2e 2e 2e 2e &4d70 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 31 30 30 20 &4d80 20 20 20 20 20 20 20 20 83 20 20 20 20 20 52 69 &4d90 6e 67 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e &4da0 2e 2e 2e 2e 35 30 30 20 20 20 20 20 20 20 20 20 &4db0 83 20 20 20 20 20 50 6f 74 20 6f 66 20 47 6f 6c &4dc0 64 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 31 30 30 30 20 &4dd0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 &4de0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 &4df0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 &4e00 82 42 6f 6e 75 73 20 6f 66 83 32 35 30 82 73 63 &4e10 6f 72 65 64 20 66 6f 72 20 64 65 73 74 72 6f 79 &4e20 69 6e 67 20 61 6c 6c 20 82 74 68 65 20 72 6f 62 &4e30 6f 74 73 20 69 6e 20 61 20 72 6f 6f 6d 2e 20 20 &4e40 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 &4e50 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 &4e60 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 &4e70 20 20 20 20 20 20 20 20 85 45 78 74 72 61 20 4c &4e80 69 76 65 73 20 20 20 20 20 20 20 20 20 20 20 20 &4e90 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 &4ea0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 &4eb0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 &4ec0 20 20 20 20 20 20 20 20 82 4f 6e 65 20 65 78 74 &4ed0 72 61 20 6c 69 66 65 20 69 73 20 61 77 61 72 64 &4ee0 65 64 20 6f 6e 20 72 65 61 63 68 69 6e 67 20 20 &4ef0 82 65 61 63 68 20 6c 65 76 65 6c 20 61 6e 64 20 &4f00 66 6f 72 20 65 76 65 72 79 20 31 30 2c 30 30 30 &4f10 20 70 6f 69 6e 74 73 20 82 73 63 6f 72 65 64 2e &4f20 20 46 69 6e 64 69 6e 67 20 61 6e 64 20 64 72 69 &4f30 6e 6b 69 6e 67 20 74 68 65 20 6d 61 67 69 63 20 &4f40 82 70 6f 74 69 6f 6e 20 61 6c 73 6f 20 67 69 76 &4f50 65 73 20 79 6f 75 20 61 6e 6f 74 68 65 72 20 6c &4f60 69 66 65 2e 20 20 20 20 20 20 20 20 20 20 20 20 &4f70 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ; entry_point &4f80 a9 00 LDA #&00 ; &1900 &4f82 85 70 STA &70 ; source_address_low &4f84 a9 80 LDA #&80 ; &0d80 &4f86 85 72 STA &72 ; target_address_low &4f88 a9 19 LDA #&19 &4f8a 85 71 STA &71 ; source_address_high &4f8c a9 0d LDA #&0d &4f8e 85 73 STA &73 ; target_address_high &4f90 a0 00 LDY #&00 ; move_1900_to_3bff_loop # Move &1900 - &3b7f to &0d80 - &2fff &4f92 b1 70 LDA (&70),Y ; source_address &4f94 91 72 STA (&72),Y ; target_address &4f96 a5 70 LDA &70 ; source_address_low &4f98 18 CLC &4f99 69 01 ADC #&01 &4f9b 85 70 STA &70 ; source_address_low &4f9d a5 71 LDA &71 ; source_address_high &4f9f 69 00 ADC #&00 &4fa1 85 71 STA &71 ; source_address_high &4fa3 a5 72 LDA &72 ; target_address_low &4fa5 18 CLC &4fa6 69 01 ADC #&01 &4fa8 85 72 STA &72 ; target_address_low &4faa a5 73 LDA &73 ; target_address_high &4fac 69 00 ADC #&00 &4fae 85 73 STA &73 ; target_address_high &4fb0 c9 30 CMP #&30 &4fb2 d0 de BNE &4f92 ; move_1900_to_3bff_loop &4fb4 a2 00 LDX #&00 ; move_3b80_to_3f7f_loop # Move &3b80 - &3f7f to &0400 - &07ff &4fb6 bd 80 3b LDA &3b80,X &4fb9 9d 00 04 STA &0400,X &4fbc bd 80 3c LDA &3c80,X &4fbf 9d 00 05 STA &0500,X &4fc2 bd 80 3d LDA &3d80,X &4fc5 9d 00 06 STA &0600,X &4fc8 bd 80 3e LDA &3e80,X &4fcb 9d 00 07 STA &0700,X &4fce e8 INX &4fcf d0 e5 BNE &4fb6 ; move_3b80_to_3f7f_loop &4fd1 a9 06 LDA #&06 # Unnecessary code &4fd3 85 c8 STA &c8 ; unused # &4fd5 a9 00 LDA #&00 # &4fd7 85 c9 STA &c9 ; unused # &4fd9 a9 20 LDA #&20 ; SPRITE_ZERO &4fdb 8d ec 0c STA &0cec ; score &4fde 8d ed 0c STA &0ced ; score + 1 &4fe1 8d ee 0c STA &0cee ; score + 2 &4fe4 8d ef 0c STA &0cef ; score + 3 &4fe7 8d b0 0b STA &0bb0 ; high_score &4fea 8d b1 0b STA &0bb1 ; high_score + 1 &4fed 8d b2 0b STA &0bb2 ; high_score + 2 &4ff0 8d b3 0b STA &0bb3 ; high_score + 3 &4ff3 a9 00 LDA #&00 &4ff5 8d eb 0c STA &0ceb ; input_method # Set to zero to use keyboard &4ff8 8d ea 0c STA &0cea ; suppress_sound # Set to zero to allow sound &4ffb a9 45 LDA #&45 &4ffd 85 7a STA &7a ; rnd_state &4fff a9 3d LDA #&3d ; SPRITE_SAFE &5001 8d 36 2f STA &2f36 ; collected_objects_sprites &5004 a9 3f LDA #&3f ; SPRITE_KEY &5006 8d 37 2f STA &2f37 ; collected_objects_sprites + 1 &5009 a9 3e LDA #&3e ; SPRITE_RING &500b 8d 38 2f STA &2f38 ; collected_objects_sprites + 2 &500e 8d 3a 2f STA &2f3a ; collected_objects_sprites + 4 &5011 a9 32 LDA #&32 ; SPRITE_POT_OF_GOLD &5013 8d 39 2f STA &2f39 ; collected_objects_sprites + 3 &5016 8d 3b 2f STA &2f3b ; collected_objects_sprites + 5 &5019 a9 81 LDA #&81 ; Check machine type &501b a2 00 LDX #&00 &501d a0 ff LDY #&ff &501f 20 f4 ff JSR &fff4 ; OSBYTE &5022 8e 03 0c STX &0c03 ; os_version # Zero if OS 0.10 &5025 a2 0f LDX #&0f ; move_5170_to_517f_loop # Move &5170 - &517f to &0cf0 - &0cff &5027 bd 70 51 LDA &5170,X &502a 9d f0 0c STA &0cf0,X &502d ca DEX &502e 10 f7 BPL &5027 ; move_5170_to_517f_loop &5030 a9 16 LDA #&16 # Change to MODE 7 &5032 20 ee ff JSR &ffee ; OSWRCH &5035 a9 07 LDA #&07 &5037 20 ee ff JSR &ffee ; OSWRCH &503a a9 17 LDA #&17 # Disable cursor &503c 20 ee ff JSR &ffee ; OSWRCH &503f a9 00 LDA #&00 &5041 20 ee ff JSR &ffee ; OSWRCH &5044 a9 0a LDA #&0a &5046 20 ee ff JSR &ffee ; OSWRCH &5049 a9 20 LDA #&20 &504b 20 ee ff JSR &ffee ; OSWRCH &504e a9 00 LDA #&00 &5050 20 ee ff JSR &ffee ; OSWRCH &5053 20 ee ff JSR &ffee ; OSWRCH &5056 20 ee ff JSR &ffee ; OSWRCH &5059 20 ee ff JSR &ffee ; OSWRCH &505c 20 ee ff JSR &ffee ; OSWRCH &505f 20 ee ff JSR &ffee ; OSWRCH &5062 a2 00 LDX #&00 ; copy_introduction_screen_loop &5064 bd 80 3f LDA &3f80,X ; introduction_screen_data &5067 9d 00 7c STA &7c00,X ; screen_memory &506a bd 80 40 LDA &4080,X ; introduction_screen_data + &100 &506d 9d 00 7d STA &7d00,X ; screen_memory + &100 &5070 bd 80 41 LDA &4180,X ; introduction_screen_data + &200 &5073 9d 00 7e STA &7e00,X ; screen_memory + &200 &5076 bd 80 42 LDA &4280,X ; introduction_screen_data + &300 &5079 9d 00 7f STA &7f00,X ; screen_memory + &300 &507c e8 INX &507d d0 e5 BNE &5064 ; copy_introduction_screen_loop ; wait_for_y_or_n_to_be_pressed &507f a9 81 LDA #&81 ; Scan for a particular key &5081 a0 ff LDY #&ff &5083 a2 bb LDX #&bb ; Y &5085 20 f4 ff JSR &fff4 ; OSBYTE &5088 e0 00 CPX #&00 &508a d0 1d BNE &50a9 ; instructions_screen &508c a9 81 LDA #&81 ; Scan for a particular key &508e a0 ff LDY #&ff &5090 a2 aa LDX #&aa ; N &5092 20 f4 ff JSR &fff4 ; OSBYTE &5095 e0 00 CPX #&00 &5097 d0 03 BNE &509c ; to_title_screen &5099 4c 7f 50 JMP &507f ; wait_for_y_or_n_to_be_pressed ; to_title_screen &509c ad 03 0c LDA &0c03 ; os_version # Zero if OS 0.10 &509f f0 05 BEQ &50a6 ; skip_setting_escape_condition &50a1 a9 7d LDA #&7d ; Set ESCAPE condition # Unclear &50a3 20 f4 ff JSR &fff4 ; OSBYTE # ; skip_setting_escape_condition &50a6 4c 02 0e JMP &0e02 ; initialise_screen_then_title_screen ; instructions_screen &50a9 a2 00 LDX #&00 ; copy_instructions_screen_one_loop &50ab bd 80 43 LDA &4380,X ; instructions_screen_one_data &50ae 9d 00 7c STA &7c00,X ; screen_memory &50b1 bd 80 44 LDA &4480,X ; instructions_screen_one_data + &100 &50b4 9d 00 7d STA &7d00,X ; screen_memory + &100 &50b7 bd 80 45 LDA &4580,X ; instructions_screen_one_data + &200 &50ba 9d 00 7e STA &7e00,X ; screen_memory + &200 &50bd bd 80 46 LDA &4680,X ; instructions_screen_one_data + &300 &50c0 9d 00 7f STA &7f00,X ; screen_memory + &300 &50c3 e8 INX &50c4 d0 e5 BNE &50ab ; copy_instructions_screen_one_loop ; wait_for_space_to_be_pressed &50c6 a9 81 LDA #&81 ; Scan for a particular key &50c8 a0 ff LDY #&ff &50ca a2 9d LDX #&9d ; SPACE &50cc 20 f4 ff JSR &fff4 ; OSBYTE &50cf e0 00 CPX #&00 &50d1 d0 f3 BNE &50c6 ; wait_for_space_to_be_pressed ; wait_for_space_to_be_released &50d3 a9 81 LDA #&81 ; Scan for a particular key &50d5 a0 ff LDY #&ff &50d7 a2 9d LDX #&9d ; SPACE &50d9 20 f4 ff JSR &fff4 ; OSBYTE &50dc e0 00 CPX #&00 &50de f0 f3 BEQ &50d3 ; wait_for_space_to_be_released &50e0 a2 00 LDX #&00 ; copy_instructions_screen_two_loop &50e2 bd 80 47 LDA &4780,X ; instructions_screen_two_data &50e5 9d 00 7c STA &7c00,X ; screen_memory &50e8 bd 80 48 LDA &4880,X ; instructions_screen_two_data + &100 &50eb 9d 00 7d STA &7d00,X ; screen_memory + &100 &50ee bd 80 49 LDA &4980,X ; instructions_screen_two_data + &200 &50f1 9d 00 7e STA &7e00,X ; screen_memory + &200 &50f4 bd 80 4a LDA &4a80,X ; instructions_screen_two_data + &300 &50f7 9d 00 7f STA &7f00,X ; screen_memory + &300 &50fa e8 INX &50fb d0 e5 BNE &50e2 ; copy_instructions_screen_two_loop ; wait_for_space_to_be_pressed &50fd a9 81 LDA #&81 ; Scan for a particular key &50ff a0 ff LDY #&ff &5101 a2 9d LDX #&9d ; SPACE &5103 20 f4 ff JSR &fff4 ; OSBYTE &5106 e0 00 CPX #&00 &5108 d0 f3 BNE &50fd ; wait_for_space_to_be_pressed ; wait_for_space_to_be_released &510a a9 81 LDA #&81 ; Scan for a particular key &510c a0 ff LDY #&ff &510e a2 9d LDX #&9d ; SPACE &5110 20 f4 ff JSR &fff4 ; OSBYTE &5113 e0 00 CPX #&00 &5115 f0 f3 BEQ &510a ; wait_for_space_to_be_released &5117 a2 00 LDX #&00 ; copy_instructions_screen_three_loop &5119 bd 80 4b LDA &4b80,X ; instructions_screen_three_data &511c 9d 00 7c STA &7c00,X ; screen_memory &511f bd 80 4c LDA &4c80,X ; instructions_screen_three_data + &100 &5122 9d 00 7d STA &7d00,X ; screen_memory + &100 &5125 bd 80 4d LDA &4d80,X ; instructions_screen_three_data + &200 &5128 9d 00 7e STA &7e00,X ; screen_memory + &200 &512b bd 80 4e LDA &4e80,X ; instructions_screen_three_data + &300 &512e 9d 00 7f STA &7f00,X ; screen_memory + &300 &5131 e8 INX &5132 d0 e5 BNE &5119 ; copy_instructions_screen_three_loop ; wait_for_space_to_be_pressed &5134 a9 81 LDA #&81 ; Scan for a particular key &5136 a0 ff LDY #&ff &5138 a2 9d LDX #&9d ; SPACE &513a 20 f4 ff JSR &fff4 ; OSBYTE &513d e0 00 CPX #&00 &513f d0 f3 BNE &5134 ; wait_for_space_to_be_pressed ; wait_for_space_to_be_released &5141 a9 81 LDA #&81 ; Scan for a particular key &5143 a0 ff LDY #&ff &5145 a2 9d LDX #&9d ; SPACE &5147 20 f4 ff JSR &fff4 ; OSBYTE &514a e0 00 CPX #&00 &514c f0 f3 BEQ &5141 ; wait_for_space_to_be_released &514e 4c 9c 50 JMP &509c ; to_title_screen ; unused # Source code fragment &5151 50 63 6c 6f 62 0d ; ... Pclob &5157 0d b6 23 2e 73 6f 75 6e 64 20 53 54 41 26 37 30 ; 3510.sound STA&70:LDAsil:B ... &5167 3a 4c 44 41 73 69 6c 3a 42 # &5170 - &517f is moved to &0cf0 - &0cff at &5027 ; plot_routine_addresses_low_table &0cf0 65 6a 79 7e af a8 00 00 ; plot_routine_addresses_high_table &0cf8 14 14 14 14 14 14 00 00