Spellbinder disassembly ======================= Written by Etan and Dan Shirron, Spellbinder was published by Superior Software for the BBC Micro in 1987. The player navigates a pseudo-3D castle, collecting ingredients and items which can be used to cast spells to defeat enemies. The following disassembly was created by reverse engineering a binary image, without access to any source code. It is nevertheless reasonably complete, allowing the technical approaches used to be understood. The author of this disassembly imposes no additional copyright restrictions beyond those already present on the game itself. It is provided for educational purposes only, and it is hoped that the original authors will accept it in the good faith it was intended - as a tribute to their skills. Technical notes =============== This disassembly analyses a snapshot taken after the game has just started. The game's idiosyncratic coding style is consistent with it having been developed using a "memory monitor chip". As might be expected from such an approach, there are numerous inefficiencies, sections of unused code and the occasional bug. Even so, it's an enjoyable romp with a rocking soundtrack. As well as the puzzles that abound in the castle, there are some hidden in the code too. Most of the graphics are background scenery. Only the player and a second sprite (either an enemy or an item of scenery) are plotted each time. Two buffers are used to store the screen behind them. Sprites are repeatedly flipped using a function rather than a lookup table. There are three separate sprite plotting routines, one of which is set to one of four different modes by means of self-modifying code. The game is slowed using three delay loops, presumably to accommodate the sprites moving eight pixels horizontally each step. Removing these makes both magelord and enemies zip along! A prize competition accompanied the game's original release, presumably requiring the password displayed on completion. A naive dumping of the binary would indicate this to be "WOLFSON" (as part of text string &3e at &7a01), but this is a feint. An embedded control code stops this text from being displayed. The routine at &350f decrypts a different password when Zorn is defeated. There are two other, unused routines that would decrypt secret messages. The code at &2662 appears designed to change the text displayed when BREAK is pressed, but doesn't work as intended. At &4f49, unofficial opcodes break up a second routine that would also display the authors' names. Etan and Dan take another ego trip in the input buffer used for the DEMON's wish at &2d54. A bug in the comparison code allows the player to ask for any three or four letter word ending in "S". Ask for "EGGS" or a "BUS", but don't use the CORK here! The METAL DISK grants fifty FULL HEALs when used in the room two doors to the west of the starting room, but this object isn't to be found anywhere in the game. Was it once a cheat? There are also unused slots in the object and scenery sprite tables that suggest the presence of other removed items. The routine at &353a is called whenever the player makes contact with a wall. It checks hard coded (rather than user-defined) directional keys, but then does nothing. It is possible that this once allowed the developers to change rooms without needing doors, functionality which can be returned with a few pokes. Game-play notes =============== The RED HERRING (unsurprisingly), TAP, CORK and GOLDEN CROWN serve no purpose. Ditto the THUNDER HIT spell, and consequently the GOLDEN FRUIT. In addition to the ingredients and objects needed along the way, the following are available for the player to use at their discretion: 7 BURNED ASHES 3 SULPHUR 6 TOAD LEGS 1 RED HERRING (useless) 3 FLEAS 2 WINE 1 GOLDEN FRUIT (useless) 1 BLUE MUSHROOM 1 BLACK PEARL 4 DRIED ROOTS 1 HEAL * 1 FREEZE * 2 DEEP FREEZE * 1 AIR SHIELD * 1 WIND SHIELD * 1 CORK (harmful) 1 GOLDEN CROWN (useless) 1 TAP (useless) The player can thus mix a maximum of three FULL HEAL spells to restore energy. A screenshot map may be found at: http://www.level7.org.uk/miscellany/spellbinder-map.png Interesting Pokes ================= &1c4c = &60 player is invulnerable to enemies &1cb7 = &ad all enemies permanently frozen &1c41 = &60, &1c61 = &60, &1cbc = &60 speed up game &2a3d = &3f, &2a44 = &a9, &2d41 = &0f, &2bdb = &0f infinite inventory &3540 = &15 &354b = &d0, &354c = &7e &354e = &0c, &354f = &20 &3551 = &dc, &3552 = &1f &3554 = &66, &3555 = &20 &3557 = &ac, &3558 = &1f &35ab = &3a, &35ac = &35 jump between rooms using Z X * ? (define different keys for movement) Applying the above pokes changes the flow of code as follows: ; consider_extra_keys ... &35aa 4c 3a 35 JMP &353a ; check_for_room_jumping ; check_for_room_jumping &353a ad 39 35 LDA &3539 ; keypress &353d c9 c8 CMP #&c8 ; * &353f f0 15 BEQ &3556 ; jump_up_a_room &3541 c9 e8 CMP #&e8 ; ? &3543 f0 0b BEQ &3550 ; jump_down_a_room &3545 c9 e1 CMP #&e1 ; Z &3547 f0 0a BEQ &3553 ; jump_left_a_room &3549 c9 c2 CMP #&c2 ; X &354b d0 7e BNE &35cb ; towards_continue_main_game_loop ; jump_right_a_room &354d 4c 0c 20 JMP &200c ; move_right_a_room jump_down_a_room &3550 4c dc 1f JMP &1fdc ; move_down_a_room ; jump_left_a_room &3553 4c 66 20 JMP &2066 ; move_left_a_room ; jump_up_a_room &3556 4c ac 1f JMP &1fac ; to_check_for_death_door_then_move_up_a_room ; towards_continue_main_game_loop &35cb 4c d5 26 JMP &26d5 ; to_continue_main_game_loop Disassembly =========== &0070 03 ; sprite_width, sprite_x &0071 20 ; sprite_address_low, sprite_y &0072 31 ; sprite_address_high, range &0073 08 ; screen_address_low, random_number &0074 6a ; screen_address_high &0075 20 ; sprite_height &0076 18 ; screen_offset &0077 16 ; mask_address_low &0078 57 ; mask_address_high &0079 00 ; door_number &007a b9 ; sound_muted &007b 01 ; x_position_of_inverted_icon &007c 01 ; y_position_of_inverted_icon &007d e1 ; input_buffer_length &007e c9 ; text_address_low &007f 00 ; text_address_high &0080 11 ; previous_player_x &0081 50 ; previous_player_y &0082 11 ; player_x &0083 50 ; player_y &0084 00 ; previous_object_x &0085 00 ; previous_object_y &0086 00 ; object_x &0087 00 ; object_y &0088 00 ; room_data_byte_one &0089 10 ; room_data_byte_two &008a 00 ; room_data_byte_three &008b 00 ; room_data_byte_four &008c 01 ; player_left_right_facing &008d 00 ; object_is_flipped &008e 00 ; object_sprite_width &008f 00 ; object_sprite_height &0090 00 ; object_height_from_below &0091 00 ; object_sprite_frame_zero_low &0092 00 ; object_sprite_frame_zero_high &0093 00 ; object_sprite_frame_one_low &0094 00 ; object_sprite_frame_zero_high &0095 00 ; object_framerate_address_low &0096 00 ; object_framerate_address_high &0097 00 ; object_framerate_comparison &0098 00 ; spell_or_item_used &0099 00 ; direction_player_moved_into_object &009a 00 ; object_height_from_above &009b 00 ; enemy_energy_drain &009c f0 ; player_room &009d 00 ; ingredients_data_pointer_low &009e 00 ; ingredients_data_pointer_high &009f 00 ; ingredient ; SPB.1B is loaded at &0100-&019b ; load_and_run_files &0100 a2 8a LDX #&8a &0102 a0 01 LDY #&01 ; &018a = load_spb4_command &0104 20 f7 ff JSR &fff7 ; OSCLI # Load SPB.4 at &0400-&07ff &0107 a2 95 LDX #&95 &0109 a0 01 LDY #&01 ; &0195 = run_spb5_command &010b 4c f7 ff JMP &fff7 ; OSCLI # Load SPB.5 at &5800-&5dff, entry point at &5d00 ; SPB.5 &5d00 a9 8c LDA #&8c ; *TAPE &5d02 a2 0c LDX #&0c &5d04 20 f4 ff JSR &fff4 ; OSBYTE # Free memory used by disk filing system &5d07 a2 00 LDX #&00 ; move_memory_loop &5d09 bd 00 58 LDA &5800,X # Move first &500 bytes of SPB.5 to &0d00-&11ff &5d0c 9d 00 0d STA &0d00,X &5d0f bd 00 59 LDA &5900,X &5d12 9d 00 0e STA &0e00,X &5d15 bd 00 5a LDA &5a00,X &5d18 9d 00 0f STA &0f00,X &5d1b bd 00 5b LDA &5b00,X &5d1e 9d 00 10 STA &1000,X &5d21 bd 00 5c LDA &5c00,X &5d24 9d 00 11 STA &1100,X &5d27 e8 INX &5d28 d0 df BNE &5d09 ; move_memory_loop ; move_relocate_data_loop &5d2a bd 41 5d LDA &5d41,X ; copy_of_relocate_data # Move &80 bytes of SPB.5 to &0380-&03ff &5d2d 9d 80 03 STA &0380,X ; relocate_data &5d30 e8 INX &5d31 10 f7 BPL &5d2a ; move_relocate_data_loop &5d33 a2 3f LDX #&3f ; move_other_memory_loop &5d35 bd c0 57 LDA &57c0,X # Temporarily move &57c0-&57ff to &0880-&08bf &5d38 9d 80 08 STA &0880,X ; temporary_buffer &5d3b ca DEX &5d3c 10 f7 BPL &5d35 ; move_other_memory_loop &5d3e 4c 0e 01 JMP &010e ; unpack_run-length_encoded_screen ; SPB.1B ; unpack_run-length_encoded_screen &010e a9 c0 LDA #&c0 # Unpack data from &5e10 (SPB.3) into &57c0 &0110 85 00 STA &00 ; target_address_low &0112 a9 57 LDA #&57 ; &57c0 &0114 85 01 STA &01 ; target_address_high &0116 a9 10 LDA #&10 &0118 85 02 STA &02 ; source_address_low &011a a9 5e LDA #&5e ; &5e10 &011c 85 03 STA &03 ; source_address_high &011e a0 00 LDY #&00 ; unpacking_loop &0120 20 48 01 JSR &0148 ; get_byte_from_source # Read two bytes to determine count &0123 85 04 STA &04 ; count_low &0125 20 48 01 JSR &0148 ; get_byte_from_source &0128 48 PHA &0129 29 7f AND #&7f &012b 85 05 STA &05 ; count_high &012d 68 PLA &012e 30 42 BMI &0172 ; count_has_top_bit_set # If the top bit is set, it's a run of identical bytes &0130 10 4e BPL &0180 ; count_has_top_bit_unset # If the top bit is unset, it's a stream of bytes ; continue_unpacking &0132 a5 01 LDA &01 ; target_address_high &0134 10 ea BPL &0120 ; unpacking_loop # Continue until &8000 ; finished_unpacking &0136 a9 03 LDA #&03 &0138 8d 58 02 STA &0258 ; ESCAPE/BREAK effect # Memory cleared on next reset &013b 20 80 03 JSR &0380 ; relocate_data &013e a2 01 LDX #&01 &0140 a0 01 LDY #&01 &0142 20 03 36 JSR &3603 ; invert_function_icon &0145 4c ec 41 JMP &41ec ; main_entry_point ; get_byte_from_source &0148 b1 02 LDA (&02),Y ; source_address &014a 48 PHA &014b e6 02 INC &02 ; source_address_low &014d d0 02 BNE &0151 &014f e6 03 INC &03 ; source_address_high &0151 68 PLA &0152 60 RTS ; push_byte_to_target &0153 91 00 STA (&00),Y ; target_address &0155 e6 00 INC &00 ; target_address_low &0157 d0 02 BNE &015b &0159 e6 01 INC &01 ; target_address_high &015b 24 01 BIT &01 ; target_address_high &015d 30 10 BMI &016f ; leave_with_zero # Leave with zero if target_address = &8000 &015f a5 04 LDA &04 ; count_low &0161 38 SEC &0162 e9 01 SBC #&01 &0164 85 04 STA &04 ; count_low &0166 a5 05 LDA &05 ; count_high &0168 e9 00 SBC #&00 &016a 85 05 STA &05 ; count_high &016c 05 04 ORA &04 ; count_low &016e 60 RTS ; leave_with_zero &016f a9 00 LDA #&00 &0171 60 RTS ; count_has_top_bit_set &0172 20 48 01 JSR &0148 ; get_byte_from_source # Get a third byte &0175 85 06 STA &06 ; byte_to_push # and push it count times ; run-length_loop &0177 a5 06 LDA &06 ; byte_to_push &0179 20 53 01 JSR &0153 ; push_byte_to_target &017c d0 f9 BNE &0177 ; run-length_loop &017e f0 b2 BEQ &0132 ; continue_unpacking ; count_has_top_bit_unset &0180 20 48 01 JSR &0148 ; get_byte_from_source # Read and push count bytes &0183 20 53 01 JSR &0153 ; push_byte_to_target &0186 d0 f8 BNE &0180 ; count_has_top_bit_unset &0188 f0 a8 BEQ &0132 ; continue_unpacking ; load_spb4_command &018a 4c 4f 41 44 20 53 50 42 2e 34 0d ; "LOAD SPB.4\r" ; run_spb5_command &0195 2f 53 50 42 2e 35 0d ; "/SPB.5\r" &019c - &01ff ; stack &0200 - &037f ; OS workspace, noting that: &0206 42 29 ; Interrupt-request vector 2(IRQ2V) = &2942, irq2_interrupt_routine &0220 1b 3e ; Event interrupt vector(EVNTV) = &3b1b, event_interrupt_routine ; from SPB.5 ; relocate_data &0380 a9 ff LDA #&ff &0382 85 00 STA &00 ; target_address_low &0384 a9 bf LDA #&bf &0386 85 02 STA &02 ; source_address_low &0388 a9 7f LDA #&7f &038a 85 01 STA &01 ; target_address_high # Copy data from &57c0-&7fbf to &5800-&7fff &038c 85 03 STA &03 ; source_address_high &038e a0 00 LDY #&00 ; copy_loop &0390 b1 02 LDA (&02),Y ; source_address &0392 91 00 STA (&00),Y ; target_address &0394 a5 02 LDA &02 ; source_address_low &0396 38 SEC &0397 e9 01 SBC #&01 &0399 85 02 STA &02 ; source_address_low &039b b0 02 BCS &039f &039d c6 03 DEC &03 ; source_address_high &039f a5 00 LDA &00 ; target_address_low &03a1 38 SEC &03a2 e9 01 SBC #&01 &03a4 85 00 STA &00 ; target_address_low &03a6 b0 02 BCS &03aa &03a8 c6 01 DEC &01 ; target_address_high &03aa a5 01 LDA &01 ; target_address_high &03ac c9 57 CMP #&57 &03ae d0 e0 BNE &0390 ; copy_loop &03b0 a2 3f LDX #&3f ; second_copy_loop &03b2 bd 80 08 LDA &0880,X ; temporary_buffer # Copy data from &0880-&08bf to &57c0-&57ff &03b5 9d c0 57 STA &57c0,X &03b8 ca DEX &03b9 10 f7 BPL &03b2 ; second_copy_loop &03bb 60 RTS ; unused &03bc 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &03cc 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &03dc 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &03ec 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &03fc 00 00 00 00 ; SPB.4 is loaded at &0400 - &07ff &0400 0d 20 0d 0d 41 4c 41 53 2c 20 59 4f 55 52 20 51 ; text &65 "ALAS, YOU QUEST HAS FAILED! (PRESS SPACE BAR)" &0410 55 45 53 54 0d 48 41 53 20 46 41 49 4c 45 44 5b &0420 05 28 50 52 45 53 53 20 53 50 41 43 45 20 42 41 &0430 52 29 03 05 05 00 &0436 05 41 20 50 52 49 53 4f 4e 45 52 00 ; text &66 "A PRISONER" &0442 05 41 20 54 45 4c 45 50 4f 52 54 06 9c 00 84 13 ; text &67 "A TELEPORT" &0450 00 ; set &009c (player_room) = &84 &0453 05 59 4f 55 20 44 4f 4e 27 54 20 48 41 56 45 0d ; text &69 "YOU DON'T HAVE A MIXING TOOL" &0463 41 20 4d 49 58 49 4e 47 20 54 4f 4f 4c 00 &0470 08 16 0f 06 06 00 06 1e 08 0d 0d 00 ; text &6a ""EGOTRIP"" (encrypted) &047d 05 41 20 44 4f 4f 52 00 ; text &6c "A DOOR" &0485 05 46 41 49 4c 45 44 5b 00 ; text &6d "FAILED!" &048e 05 22 43 27 45 53 54 20 4c 41 20 56 49 45 5b 22 ; text &6e ""C'EST LA VIE!"" &049e 00 &049f 00 ; enemy_4_frame_0_sprite WATCHER &04a0 00 ff 00 03 db c0 0e f6 f0 1d fb b8 37 6f f8 2f &04b0 fc 00 77 c3 fe 6f 3e 00 fe c1 56 f3 be ab ec 7d &04c0 45 9b fe 83 d7 fd 45 eb fe ab 74 7f 56 7b 9f aa &04d0 34 61 fc 3f 9e 00 1a e1 f8 0f 7c 20 03 9b c0 00 &04e0 ff 00 00 00 00 00 00 00 ; enemy_4_frame_1_sprite WATCHER &04e8 00 ff 00 03 db c0 0e f6 f0 1d fb b8 37 6f f8 2d &04f8 fe ec 77 77 be 6f ff 8c f7 e0 03 df 3f fe f0 c0 &0508 01 8f 7e 80 e0 fd 45 fb 06 a8 7c c0 03 7f 3f fc &0518 37 c0 02 3b 7f fc 1e d7 b8 0f 6e e0 03 9b c0 00 &0528 ef 00 00 00 00 00 00 00 ; enemy_5_frame_0_sprite WINGED SKULL &0530 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &0540 00 3f 00 78 0e 00 ff c1 fc 1f 01 ff e3 8e 1f 83 &0550 ff e7 4e 11 83 ff ee 4e 30 e3 cf 34 56 62 78 a6 &0560 54 56 6a 3e b6 d0 96 6a 3f 56 b0 97 52 9f 7f f0 &0570 97 d2 8c 7c f2 97 d4 91 f8 e3 13 94 e3 3a e3 13 &0580 a5 90 9f eb a3 a5 98 95 46 73 ac c8 6a 8c 6b ac &0590 64 7f 88 66 a6 00 3f 00 ce d2 00 00 00 0c 70 00 &05a0 00 00 38 38 00 00 00 00 ; enemy_5_frame_1_sprite WINGED SKULL &05a8 00 00 00 00 00 00 00 00 00 00 02 00 00 01 80 07 &05b8 00 3f 03 c0 0b 80 ff c7 e0 15 c1 ff ee 60 14 e3 &05c8 ff ec e0 14 f3 ff e4 e0 14 7b cf 31 60 2d 3c a6 &05d8 55 60 2d 3e b6 d5 60 2c bf 56 b5 60 2c 9f 7f f5 &05e8 60 3c 4c 7c f5 60 36 11 f8 e5 60 36 63 3a e5 60 &05f8 76 80 9f e9 60 7b 00 95 4a 60 6d 80 ea 94 c0 36 &0608 e0 7f a4 c0 1e f0 3f 09 80 0f 08 00 63 00 07 70 &0618 00 86 00 03 e0 00 7c 00 ; enemy_6_frame_0_sprite CYCLOPS GUARD &0620 0e f8 00 07 fe 00 0f fe 00 0c 01 00 0b d6 00 0d &0630 a2 00 1f 01 00 17 ff 00 39 ff 40 7e fe e0 7f 41 &0640 60 7f 7f 60 fe f7 70 fe f1 b0 fe 74 b1 fd ed 33 &0650 f9 0c b3 f1 db a6 ec 53 a6 7e 07 b0 3f 79 bb 1f &0660 e9 b5 07 fb 17 0b e8 cb 0c f3 ce 0d 07 c0 0d bf &0670 d8 61 7f d8 f4 ff 90 b7 ff 80 3b ff 80 3b ff 80 &0680 3d ff 80 3e ff 80 1e ff c0 1f 7f c0 0e bf c0 0f &0690 bf c0 07 ff 80 01 ff 00 ; enemy_6_frame_1_sprite CYCLOPS GUARD &0698 01 f8 00 07 fe 00 0f 02 00 0c fd 00 0b d6 00 0d &06a8 a2 00 1e d5 00 17 03 00 39 ff 40 3e fe e0 3f 41 &06b8 60 7f 7f 60 7e f7 70 7e f1 b0 7e 76 b2 7e e6 36 &06c8 7e 06 b6 7d cc a6 38 49 a6 3e 03 b0 1f 3d bb 0f &06d8 f5 b5 07 fd 17 0b f4 8b 8c 79 8e 4d 03 80 4d bf &06e8 0c 61 7f 0c 64 ff 08 67 ff 00 63 ff 00 73 fe 00 &06f8 73 fe 00 73 fe 00 7b fc 00 3b fc 00 3f f8 00 1f &0708 f0 00 07 e0 00 00 00 00 ; enemy_7_frame_0_sprite ZOMBIE &0710 07 e0 00 0f f0 00 1f f8 00 19 f8 00 38 08 00 3c &0720 10 00 37 e0 00 3b d0 00 5c 38 00 6f e4 00 77 ec &0730 00 f8 1e 00 ff fe 00 f7 de 00 f4 9e 00 f5 4e 50 &0740 f3 ec f8 ff ef f8 fd ef 78 fc 1f 00 7d df 00 73 &0750 dc 00 0f e0 00 61 f0 00 7e 10 00 7f f0 00 7f f0 &0760 00 61 f0 00 7e 10 00 7f f0 00 7f f0 00 63 d0 00 &0770 78 20 00 3f e0 00 3f e0 00 37 e0 00 38 20 00 1f &0780 e0 00 0f c0 00 07 80 00 ; enemy_7_frame_1_sprite ZOMBIE &0788 03 f0 00 07 f8 00 0f fc 00 0e fc 00 1e 04 00 1e &0798 08 00 17 f0 00 3b d0 00 5c 38 00 6f e4 00 77 ec &07a8 00 f8 1e 00 ff ee 00 f7 ef 00 f7 d7 04 f7 a9 0a &07b8 fa 7d 1f f9 fd bf 7b bd f7 7f 81 f0 3f 83 f0 1e &07c8 11 c0 00 70 00 61 f0 00 7e 10 00 7f f0 00 7f f0 &07d8 00 61 f0 00 7e 00 00 7f e0 00 7f e0 00 63 c0 00 &07e8 78 00 00 7f c0 00 ff c0 00 df 80 00 e0 00 00 ff &07f8 00 00 7e 00 00 3c 00 00 &0800 - &087f ; OS sound channel buffers ; SPB.1D is loaded at &0880-&08bf, but subsequently overwritten ; temporary_buffer &0880 a9 06 LDA #&06 # R6: Vertical displayed register &0881 8d 00 STA &fe00 # Write to video controller (register number) &0885 a0 00 LDY #&00 # Zero vertical rows &0887 8c 01 fe STY &fe01 # Write to video controller (register value) &088a 84 a8 STY &a8 ; source_address_low &088c 84 aa STY &aa ; target_address_low &088e a9 30 LDA #&30 &0890 85 a9 STA &a9 ; source_address_high &0892 a9 58 LDA #&58 &0894 85 ab STA &ab ; target_address_high ; swap_memory_loop # Swap memory &3000-&57ff and &5800-&7fff &0896 b1 a8 LDA (&a8),Y ; source_address &0898 48 PHA &0899 b1 aa LDA (&aa),Y ; target_address &089b 91 a8 STA (&a8),Y ; source_address &089d 68 PLA &089e 91 aa STA (&aa),Y ; target_address &08a0 c8 INY &08a1 d0 f3 BNE &0896 ; swap_memory_loop &08a3 e6 a9 INC &a9 ; source_address_high &08a5 e6 ab INC &ab ; target_address_high &08a7 10 ed BPL &0896 ; swap_memory_loop &08a9 60 RTS ; OS envelope storage area &08c0 02 01 01 01 01 01 01 79 f6 fb f6 5a 5a 00 00 00 ; envelope 1 &08d0 07 01 01 01 01 01 01 79 f6 fb f6 5a 5a 00 00 00 ; envelope 2 &08e0 01 7f 00 00 03 01 01 03 00 00 fd 7e 00 00 00 00 ; envelope 3 &08f0 81 14 fb f6 07 07 07 74 ff ff ff 74 74 00 00 00 ; envelope 4 ; SPB.1C is loaded at &0900-&cff ; place_trapdoor &0900 a2 12 LDX #&12 &0902 a5 89 LDA &89 ; room_data_byte_two &0904 29 10 AND #&10 &0906 f0 05 BEQ &090d ; short_room &0908 a0 6a LDY #&6a &090a 4c 0f 09 JMP &090f ; tall_room ; short_room &090d a0 64 LDY #&64 ; tall_room &090f a9 07 LDA #&07 ; TELEPORT / TRAPDOOR &0911 8e 54 20 STX &2054 ; trapdoor_x &0914 8c 55 20 STY &2055 ; trapdoor_y &0917 20 2b 13 JSR &132b ; plot_scenery_sprite &091a 60 RTS ; place_trapdoor_or_teleport &091b a2 00 LDX #&00 ; check_room_for_trapdoors_loop &091d bd 08 51 LDA &5108,X ; rooms_with_trapdoors &0920 c5 9c CMP &9c ; player_room &0922 f0 17 BEQ &093b ; room_has_trapdoor &0924 e8 INX &0925 e0 04 CPX #&04 &0927 d0 f4 BNE &091d ; check_room_for_trapdoors_loop ; room_has_teleport &0929 a9 30 LDA #&30 &092b a2 3b LDX #&3b ; &3b30 = scenery_sprite_07_teleport &092d a0 03 LDY #&03 ; set_teleport_or_trapdoor_sprite &092f 8d 82 55 STA &5582 ; scenery_sprite_07_data &0932 8e 83 55 STX &5583 ; scenery_sprite_07_data + 1 &0935 8c 84 55 STY &5584 ; scenery_sprite_07_data + 2 &0938 4c 44 09 JMP &0944 ; to_place_trapdoor ; room_has_trapdoor &093b a9 98 LDA #&98 &093d a2 43 LDX #&43 ; &4398 = scenery_sprite_07_trapdoor &093f a0 04 LDY #&04 &0941 4c 2f 09 JMP &092f ; set_teleport_or_trapdoor_sprite ; to_place_trapdoor &0944 20 00 09 JSR &0900 ; place_trapdoor &0947 4c c9 17 JMP &17c9 ; plot_torches_on_side_walls ; check_for_collision_with_trapdoor &094a 86 70 STX &70 ; sprite_x &094c 84 71 STY &71 ; sprite_y &094e 8a TXA &094f 18 CLC &0950 69 00 ADC #&00 &0952 aa TAX &0953 98 TYA &0954 38 SEC &0955 e9 08 SBC #&08 &0957 a8 TAY &0958 8a TXA &0959 c5 82 CMP &82 ; player_x &095b 10 19 BPL &0976 ; leave_with_zero &095d 98 TYA &095e c5 83 CMP &83 ; player_y &0960 10 14 BPL &0976 ; leave_with_zero &0962 8a TXA &0963 18 CLC &0964 69 02 ADC #&02 &0966 aa TAX &0967 98 TYA &0968 18 CLC &0969 69 08 ADC #&08 &096b a8 TAY &096c 8a TXA &096d c5 82 CMP &82 ; player_x &096f 30 05 BMI &0976 ; leave_with_zero &0971 98 TYA &0972 c5 83 CMP &83 ; player_y &0974 10 03 BPL &0979 ; leave_with_one ; leave_with_zero &0976 a9 00 LDA #&00 &0978 60 RTS ; leave_with_one &0979 a9 01 LDA #&01 &097b 60 RTS ; copy_object_details_into_zero_page &097c aa TAX &097d a9 00 LDA #&00 ; calculate_object_data_offset_loop &097f 18 CLC &0980 69 0b ADC #&0b # &b bytes per object type &0982 ca DEX &0983 10 fa BPL &097f ; calculate_object_data_offset_loop &0985 38 SEC &0986 e9 0b SBC #&0b &0988 aa TAX &0989 a0 00 LDY #&00 ; copy_object_details_into_zero_page_loop &098b bd 16 57 LDA &5716,X ; object_type_data &098e 99 8e 00 STA &008e,Y ; object_data &0991 e8 INX &0992 c8 INY &0993 c0 0a CPY #&0a &0995 d0 f4 BNE &098b ; copy_object_details_into_zero_page_loop &0997 bd 16 57 LDA &5716,X ; object_type_data &099a 85 9a STA &9a ; object_height_from_above &099c 60 RTS ; check_for_object_in_room &099d a2 00 LDX #&00 ; check_for_object_in_room_loop &099f bd 2a 50 LDA &502a,X ; object_table # 1st byte = object room &09a2 c5 9c CMP &9c ; player_room &09a4 f0 09 BEQ &09af ; object_in_this_room &09a6 e8 INX &09a7 e8 INX &09a8 e8 INX &09a9 e8 INX &09aa e0 c8 CPX #&c8 # Bug: this should only be &90. Were there once more? &09ac d0 f1 BNE &099f ; check_for_object_in_room_loop # (this bug doesn't make any difference to the rooms) &09ae 60 RTS ; object_in_this_room &09af e8 INX &09b0 bd 2a 50 LDA &502a,X ; object_table # 2nd byte & &7f = object_type &09b3 c9 28 CMP #&28 # This suggests there may once have been &28 types. &09b5 30 03 BMI &09ba ; object_not_flipped &09b7 38 SEC &09b8 e9 80 SBC #&80 # Inefficient way to unset top bit! ; object_not_flipped &09ba 85 70 STA &70 ; object_type &09bc 8a TXA &09bd 48 PHA &09be a5 70 LDA &70 ; object_type &09c0 20 7c 09 JSR &097c ; copy_object_details_into_zero_page &09c3 68 PLA &09c4 aa TAX &09c5 e8 INX &09c6 bd 2a 50 LDA &502a,X ; object_table # 3nd byte = object_x &09c9 85 86 STA &86 ; object_x &09cb e8 INX &09cc bd 2a 50 LDA &502a,X ; object_table # 4th byte = object_y &09cf 85 87 STA &87 ; object_y &09d1 ca DEX &09d2 ca DEX &09d3 bd 2a 50 LDA &502a,X ; object_table &09d6 29 80 AND #&80 # 2nd byte & 80 = object is flipped &09d8 f0 36 BEQ &0a10 ; leave &09da a9 01 LDA #&01 &09dc 85 8d STA &8d ; object_is_flipped ; flip_object_sprites &09de a5 8e LDA &8e ; object_sprite_width &09e0 85 70 STA &70 ; sprite_width &09e2 a5 8f LDA &8f ; object_sprite_height &09e4 85 75 STA &75 ; sprite_height &09e6 a5 91 LDA &91 ; object_sprite_frame_zero_low &09e8 85 71 STA &71 ; sprite_address_low &09ea a5 92 LDA &92 ; object_sprite_frame_zero_high &09ec 85 72 STA &72 ; sprite_address_high &09ee 20 c3 11 JSR &11c3 ; flip_sprite &09f1 a5 91 LDA &91 ; object_sprite_frame_zero_low &09f3 c5 93 CMP &93 ; object_sprite_frame_one_low &09f5 d0 06 BNE &09fd &09f7 a5 92 LDA &92 ; object_sprite_frame_zero_high &09f9 c5 94 CMP &94 ; object_sprite_frame_one_high &09fb f0 13 BEQ &0a10 ; leave &09fd a5 8e LDA &8e ; object_sprite_width &09ff 85 70 STA &70 ; sprite_width &0a01 a5 8f LDA &8f ; object_sprite_height &0a03 85 75 STA &75 ; sprite_height &0a05 a5 93 LDA &93 ; object_sprite_frame_one_low &0a07 85 71 STA &71 ; sprite_address_low &0a09 a5 94 LDA &94 ; object_sprite_frame_one_high &0a0b 85 72 STA &72 ; sprite_address_high &0a0d 20 c3 11 JSR &11c3 ; flip_sprite ; leave &0a10 60 RTS ; towards_check_for_object_in_room &0a11 a5 8d LDA &8d ; object_is_flipped &0a13 f0 0a BEQ &0a1f ; previous_object_wasn't_flipped &0a15 20 de 09 JSR &09de ; flip_objects_sprites &0a18 ea NOP &0a19 ea NOP &0a1a ea NOP &0a1b a9 00 LDA #&00 &0a1d 85 8d STA &8d ; object_is_flipped ; previous_object_wasn't_flipped &0a1f 20 9d 09 JSR &099d ; check_for_object_in_room &0a22 ea NOP &0a23 ea NOP &0a24 ea NOP &0a25 60 RTS ; check_room_for_passages &0a26 a2 00 LDX #&00 ; check_room_for_passages_loop &0a28 bd 0e 51 LDA &510e,X ; passages_table &0a2b c5 9c CMP &9c ; player_room &0a2d f0 09 BEQ &0a38 ; passage_in_this_room &0a2f e8 INX &0a30 e8 INX &0a31 e8 INX &0a32 e8 INX &0a33 e0 28 CPX #&28 &0a35 d0 f1 BNE &0a28 ; check_room_for_passages_loop &0a37 60 RTS ; passage_in_this_room &0a38 bd 0f 51 LDA &510f,X ; passages_table + 1 &0a3b a8 TAY &0a3c bd 10 51 LDA &5110,X ; passages_table + 2 &0a3f 99 48 20 STA &2048,Y ; doors_x &0a42 bd 11 51 LDA &5111,X : passages_table + 3 &0a45 99 49 20 STA &2049,Y ; doors_y &0a48 60 RTS ; various_room_initialisation &0a49 20 11 0a JSR &0a11 ; towards_check_for_object_in_room &0a4c 20 60 1e JSR &1e60 ; copy_room_data_into_zero_page &0a4f 20 26 0a JSR &0a26 ; check_room_for_passages &0a52 20 24 2f JSR &2f24 ; set_specific_furniture_positions &0a55 60 RTS ; update_object_frame &0a56 20 5b 24 JSR &245b ; check_for_walking_into_pool &0a59 ad d1 1b LDA &1bd1 ; object_frame &0a5c c9 10 CMP #&10 &0a5e d0 06 BNE &0a66 &0a60 a9 00 LDA #&00 &0a62 8d d1 1b STA &1bd1 ; object_frame &0a65 ea NOP &0a66 20 b4 20 JSR &20b4 ; check_for_player_leaving_side_of_extended_room &0a69 a5 9c LDA &9c ; player_room &0a6b c9 10 CMP #&10 ; room_with_bottle &0a6d f0 01 BEQ &0a70 ; update_demon_state &0a6f 60 RTS ; update_demon_state &0a70 ad d2 1b LDA &1bd2 ; demon_state &0a73 d0 0e BNE &0a83 ; demon_not_state_0 &0a75 a5 99 LDA &99 ; direction_player_moved_into_object &0a77 f0 09 BEQ &0a82 ; leave # Trigger demon when bottle touched &0a79 c9 03 CMP #&03 &0a7b f0 05 BEQ &0a82 ; leave # in any direction other than from above &0a7d a9 01 LDA #&01 &0a7f 8d d2 1b STA &1bd2 ; demon_state ; leave &0a82 60 RTS ; demon_not_state_0 &0a83 ad d2 1b LDA &1bd2 ; demon_state &0a86 c9 01 CMP #&01 &0a88 d0 0c BNE &0a96 ; demon_not_state_1 &0a8a ad d1 1b LDA &1bd1 ; object_frame &0a8d 8d d4 1b STA &1bd4 ; demon_initial_frame &0a90 a9 02 LDA #&02 &0a92 8d d2 1b STA &1bd2 ; demon_state &0a95 60 RTS ; demon_not_state_1 &0a96 ad d1 1b LDA &1bd1 ; object_frame &0a99 cd d4 1b CMP &1bd4 ; demon_initial_frame &0a9c d0 0f BNE &0aad ; leave &0a9e ad d2 1b LDA &1bd2 ; demon_state &0aa1 c9 02 CMP #&02 &0aa3 f0 09 BEQ &0aae ; demon_state_2 &0aa5 c9 03 CMP #&03 &0aa7 f0 1a BEQ &0ac3 ; demon_state_3 &0aa9 c9 04 CMP #&04 &0aab f0 2b BEQ &0ad8 ; demon_state_4 ; leave &0aad 60 RTS ; demon_state_2 &0aae a5 87 LDA &87 ; object_y &0ab0 38 SEC &0ab1 e9 14 SBC #&14 &0ab3 85 87 STA &87 ; object_y &0ab5 ea NOP &0ab6 ea NOP &0ab7 ea NOP &0ab8 a9 0c LDA #&0c ; SMOKE STAGE ONE &0aba 20 7c 09 JSR &097c ; copy_object_details_into_zero_page &0abd a9 03 LDA #&03 &0abf 8d d2 1b STA &1bd2 ; demon_state &0ac2 60 RTS ; demon_state_3 &0ac3 a5 87 LDA &87 ; object_y &0ac5 38 SEC &0ac6 e9 0c SBC #&0c &0ac8 85 87 STA &87 ; object_y &0aca ea NOP &0acb ea NOP &0acc ea NOP &0acd a9 0d LDA #&0d ; SMOKE STAGE TWO &0acf 20 7c 09 JSR &097c ; copy_object_details_into_zero_page &0ad2 a9 04 LDA #&04 &0ad4 8d d2 1b STA &1bd2 ; demon_state &0ad7 60 RTS ; demon_state_4 &0ad8 a5 87 LDA &87 ; object_y &0ada 38 SEC &0adb e9 0b SBC #&0b &0add 85 87 STA &87 ; object_y &0adf ea NOP &0ae0 ea NOP &0ae1 ea NOP &0ae2 a9 0b LDA #&0b ; DEMON AND BOTTLE &0ae4 20 7c 09 JSR &097c ; copy_object_details_into_zero_page &0ae7 a9 05 LDA #&05 &0ae9 8d d2 1b STA &1bd2 ; demon_state &0aec 60 RTS &0aed ea NOP &0aee ea NOP ; check_for_collision_with_enemy &0aef a6 86 LDX &86 ; object_x &0af1 a5 87 LDA &87 ; object_y &0af3 18 CLC &0af4 65 90 ADC &90 ; object_height_from_below &0af6 38 SEC &0af7 e9 20 SBC #&20 &0af9 a8 TAY &0afa 20 10 1f JSR &1f10 ; player_collision_check &0afd d0 01 BNE &0b00 ; to_play_sound_and_drain_player_energy &0aff 60 RTS ; to_play_sound_and_drain_player_energy &0b00 4c 4c 1c JMP &1c4c ; play_sound_and_drain_player_energy &0b03 ea NOP &0b04 ea NOP &0b05 ea NOP ; drain_player_energy &0b06 ad fc 53 LDA &53fc ; player_energy &0b09 f8 SED &0b0a 38 SEC &0b0b e5 9b SBC &9b ; enemy_energy_drain &0b0d 8d fc 53 STA &53fc ; player_energy &0b10 90 02 BCC &0b14 ; towards_kill_player_after_drained_away &0b12 d8 CLD &0b13 60 RTS ; towards_kill_player_after_drained_away &0b14 4c 57 2f JMP &2f57 ; to_kill_player_after_drained_away ; drain_player_energy_from_zorn_magic &0b17 a9 0b LDA #&0b &0b19 85 86 STA &86 ; object_x &0b1b a9 48 LDA #&48 &0b1d 85 87 STA &87 ; object_y &0b1f ad fc 53 LDA &53fc ; player_energy &0b22 f8 SED &0b23 38 SEC &0b24 e9 20 SBC #&20 &0b26 8d fc 53 STA &53fc ; player_energy &0b29 90 02 BCC &0b2d ; towards_kill_player_after_cld &0b2b d8 CLD &0b2c 60 RTS ; towards_kill_player_after_cld &0b2d 4c 50 2d JMP &2d50 ; to_kill_player_after_cld ; use_mask_mode_and_prepare_pool_and_throne_magic &0b30 20 e2 4f JSR &4fe2 ; use_mask_mode_and_prepare_pool &0b33 a5 9c LDA &9c ; player_room &0b35 c9 c1 CMP #&c1 ; throne_room &0b37 d0 0c BNE &0b45 ; leave &0b39 a2 00 LDX #&00 ; copy_zorn_magic_loop &0b3b bd 46 0b LDA &0b46,X ; zorn_magic_object_data &0b3e 95 8e STA &8e,X ; object_data &0b40 e8 INX &0b41 e0 0a CPX #&0a &0b43 d0 f6 BNE &0b3b ; copy_zorn_magic_loop ; leave &0b45 60 RTS ; zorn_magic_object_data ; w h bh fr-0 fr-1 addr cmp &0b46 02 0c 18 1e 52 36 52 51 02 0a ; move_furniture_then_prepare_pool &0b50 a5 8a LDA &8a ; room_data_byte_three &0b52 29 02 AND #&02 &0b54 f0 0c BEQ &0b62 ; don't_move_furniture &0b56 ad 53 20 LDA &2053 ; furniture_y &0b59 18 CLC &0b5a 69 10 ADC #&10 &0b5c 8d 53 20 STA &2053 ; furniture_y &0b5f ee 52 20 INC &2052 ; furniture_x ; don't_move_furniture &0b62 20 30 0b JSR &0b30 ; use_mask_mode_and_prepare_pool_and_throne_magic &0b65 60 RTS ; plot_control_character_0b # Control character &0b ends the text here &0b66 c9 0b CMP #&0b &0b68 d0 03 BNE &0b6d ; plot_control_character_0c &0b6a 68 PLA &0b6b 68 PLA &0b6c 60 RTS ; plot_control_character_0c # Control character &0c flushes the input buffer &0b6d c9 0c CMP #&0c &0b6f d0 0a BNE &0b7b ; plot_control_character_0e &0b71 a9 0f LDA #&0f ; Flush all buffers/input buffer &0b73 a2 02 LDX #&02 ; Input buffer flushed only &0b75 a0 00 LDY #&00 &0b77 20 f4 ff JSR &fff4 ; OSBYTE &0b7a 60 RTS ; plot_control_character_0e # Control character &0e plots a byte as a number &0b7b c9 0e CMP #&0e &0b7d d0 29 BNE &0ba8 ; plot_control_character_0f &0b7f 20 3a 26 JSR &263a ; increment_text_address &0b82 a0 00 LDY #&00 &0b84 b1 7e LDA (&7e),Y ; text_address # Next two bytes are low and high of address to read &0b86 85 70 STA &70 ; read_address_low &0b88 20 3a 26 JSR &263a ; increment_text_address &0b8b b1 7e LDA (&7e),Y ; text_address &0b8d 85 71 STA &71 ; read_address_high &0b8f b1 70 LDA (&70),Y ; read_address &0b91 29 f0 AND #&f0 &0b93 6a ROR A &0b94 6a ROR A &0b95 6a ROR A &0b96 6a ROR A &0b97 4c 90 34 JMP &3490 ; plot_two_digit_number ; cursor_x &0b9a 0b &0b9b ea NOP &0b9c ea NOP ; plot_one_digit_number &0b9d b1 70 LDA (&70),Y ; read_address &0b9f 29 0f AND #&0f &0ba1 18 CLC &0ba2 69 30 ADC #&30 &0ba4 20 ee ff JSR &ffee ; OSWRCH &0ba7 60 RTS ; plot_control_character_0f # Control character &0f crashes the game &0ba8 c9 0f CMP #&0f # (unused!) &0baa d0 0b BNE &0bb7 ; plot_control_character_10 &0bac 20 4d 0c JSR &0c4d ; ? &0baf 60 RTS ; set_furniture_position &0bb0 8e 52 20 STX &2052 ; furniture_x &0bb3 8c 53 20 STY &2053 ; furniture_y &0bb6 60 RTS ; plot_control_character_10 # Control character &10 skips subsequent bytes &0bb7 c9 10 CMP #&10 &0bb9 d0 11 BNE &0bcc ; plot_control_character_11 &0bbb 20 3a 26 JSR &263a ; increment_text_address &0bbe a0 00 LDY #&00 &0bc0 a5 7e LDA &7e ; text_address_low &0bc2 18 CLC &0bc3 71 7e ADC (&7e),Y ; text_address # Next byte is number of bytes to skip &0bc5 85 7e STA &7e ; text_address_low &0bc7 90 02 BCC &0bcb &0bc9 e6 7f INC &7f ; text_address_high &0bcb 60 RTS ; plot_control_character_11 # Control character &11 adds to a byte of memory &0bcc c9 11 CMP #&11 # (unused) &0bce d0 25 BNE &0bf5 ; to_plot_control_character_12 &0bd0 20 3a 26 JSR &263a ; increment_text_address &0bd3 a0 00 LDY #&00 &0bd5 b1 7e LDA (&7e),Y ; text_address # Next two bytes are low and high of address &0bd7 85 70 STA &70 ; read_address &0bd9 20 3a 26 JSR &263a ; increment_text_address &0bdc b1 7e LDA (&7e),Y ; text_address &0bde 85 71 STA &71 ; read_address &0be0 20 3a 26 JSR &263a ; increment_text_address &0be3 f8 SED &0be4 b1 70 LDA (&70),Y ; read_address &0be6 18 CLC &0be7 71 7e ADC (&7e),Y ; text_address # Third byte is value to add &0be9 d8 CLD &0bea 91 70 STA (&70),Y ; read_address &0bec 90 06 BCC &0bf4 ; leave &0bee 20 3a 26 JSR &263a ; increment_text_address # Skip two further bytes if this overflows &0bf1 20 3a 26 JSR &263a ; increment_text_address &0bf4 60 RTS ; to_plot_control_character_12 &0bf5 4c 00 0f JMP &0f00 ; plot_control_character_12 ; wait_for_all_keys_to_be_released &0bf8 a5 ec LDA &ec ; Internal key number of most recently pressed key &0bfa d0 fc BNE &0bf8 ; wait_for_all_keys_to_be_released &0bfc 60 RTS ; unused &0bfd 00 00 00 ; character font &0c00 1c 1c 1c 7f 3e 1c 08 00 &0c08 00 0e 3e 36 66 7e 66 00 &0c10 00 3c 36 3c 66 66 7c 00 &0c18 00 1c 36 60 60 6e 3c 00 &0c20 00 3c 36 36 66 6c 78 00 &0c28 00 1c 36 60 7c 60 3c 00 &0c30 00 1e 30 7c 60 60 60 00 &0c38 00 1c 36 60 6e 66 3c 00 &0c40 00 36 66 7e 66 66 6c 00 &0c48 00 18 18 18 30 30 30 00 &0c50 00 0f 03 03 06 66 3c 00 &0c58 00 36 3c 38 78 6c 66 00 &0c60 00 30 30 70 60 60 7e 00 &0c68 00 32 77 7f 6b 63 63 00 &0c70 00 7c 36 66 66 66 66 00 &0c78 00 1c 36 66 66 6c 38 00 &0c80 00 3c 36 36 7c 60 60 00 &0c88 00 1c 36 62 5a 6c 36 00 &0c90 00 1c 36 76 7c 66 66 00 &0c98 00 1e 30 1c 06 4e 7c 00 &0ca0 00 7e 58 18 30 30 30 00 &0ca8 00 36 36 66 66 66 3e 00 &0cb0 00 66 66 66 6c 78 30 00 &0cb8 00 33 63 6b 7f 77 66 00 &0cc0 00 36 36 1c 38 6c 6c 00 &0cc8 00 66 66 3c 18 18 70 00 &0cd0 00 3f 66 0c 18 33 7e 00 &0cd8 0c 0c 0c 18 18 00 30 30 &0ce0 3e 67 c3 1e 18 00 30 30 &0ce8 08 1c 3e 7f 1c 1c 1c 00 &0cf0 08 0c 7e 7f 7e 0c 08 00 &0cf8 08 1c 48 e2 47 12 38 10 ; scenery_sprite_0b BOOKSHELVES &0d00 03 78 1e 64 0d 8f 00 18 31 c1 e3 80 c1 f0 77 98 &0d10 f1 bc f6 9e fc 63 d6 9e cf 18 96 9e c3 c6 b6 86 &0d20 c4 f1 ce 42 c7 3c 0f 42 c3 2f 0f c2 cc 73 cf 8e &0d30 ce 10 f7 02 dc 63 3c 0e dc f7 0f 32 cc e6 83 e2 &0d40 b0 e5 8c ca 8c e3 8e da 83 63 82 da 80 83 cc da &0d50 80 f1 de da 83 0d dc da 8c 07 1c da b0 0f cc da &0d60 c0 4f 30 da ba ae 2c da 8d 5e 37 da a3 ae 60 da &0d70 b0 f7 c1 5a b6 3a 02 da b6 1d 55 5a b6 4f aa da &0d80 86 6c d5 5a b6 6c 3a da be 6d 8d 5a 8f 0d a3 da &0d90 b7 ed b0 da b6 6d b2 5a c6 0c b3 5a 32 6d 33 5a &0da0 0c 6d f3 5a 03 2c 7c 5a 00 cd bf 5a 00 3d b3 5a &0db0 00 0c 30 5a 00 03 10 5a 00 00 c3 5a 00 00 31 52 &0dc0 ff ff cc 46 00 00 03 58 00 00 00 e0 00 00 00 00 &0dd0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; scenery_sprite_0c PRISON BARS &0de0 7a 20 03 03 0c 40 75 23 1f 87 e2 46 7a 24 7c 4f &0df0 f8 4e 55 21 f4 4d 56 4c 3f e3 e8 4a ab 0e 00 01 &0e00 d7 cf 24 00 00 8e 17 50 00 00 7f 3c d8 30 64 f0 &0e10 74 7e 70 04 39 e8 68 75 00 03 83 a4 74 eb 20 02 &0e20 7b d4 69 d5 20 02 43 a2 71 ea 23 e2 21 d2 69 d4 &0e30 67 f3 10 ea 73 a4 6f fb 08 d2 6a 04 6f fb 08 e2 &0e40 42 08 6f fb 04 72 31 f8 68 8b 02 7c 00 00 6c 9b &0e50 08 00 39 f8 6b eb 0e 7e 73 f8 67 73 08 fe 73 a8 &0e60 67 f3 08 ea 73 c9 66 33 48 d2 73 ab 62 23 68 ea &0e70 73 cb 01 c0 68 d2 73 ab f4 17 e8 e2 63 0b c2 61 &0e80 e8 c2 42 0b f3 e7 e4 c2 31 fb c1 c1 e2 7e 00 00 &0e90 f0 87 8c 00 31 f8 f0 cc 0a 7e 73 f8 6c 1b 08 fe &0ea0 73 e8 6f fb 08 ea 63 48 63 e3 08 d2 73 a8 60 03 &0eb0 08 ea 63 48 6c 1b 08 d2 73 a8 e3 f7 88 ea 63 49 &0ec0 e2 2b c8 d2 73 a9 e5 d7 c4 e2 63 49 e2 ab ca c2 &0ed0 42 09 e5 d7 cc c2 31 f9 62 ab 4a 7e 00 00 65 d7 &0ee0 09 00 31 f8 62 ab 08 7e 73 f8 75 d7 04 fe 73 a8 &0ef0 6f 7b 04 ea 73 48 80 03 02 d2 73 f8 20 02 00 fe ; plot_control_character_12 # Control character &12 subtracts from a byte of memory &0f00 c9 12 CMP #&12 &0f02 d0 25 BNE &0f29 ; plot_control_character_13 &0f04 20 3a 26 JSR &263a ; increment_text_address &0f07 a0 00 LDY #&00 &0f09 b1 7e LDA (&7e),Y ; text_address # Next two bytes are low and high of address &0f0b 85 70 STA &70 ; read_address_low &0f0d 20 3a 26 JSR &263a ; increment_text_address &0f10 b1 7e LDA (&7e),Y ; text_address &0f12 85 71 STA &71 ; read_address_high &0f14 20 3a 26 JSR &263a ; increment_text_address &0f17 f8 SED &0f18 b1 70 LDA (&70),Y ; read_address &0f1a 38 SEC &0f1b f1 7e SBC (&7e),Y ; text_address # Third byte is value to subtract &0f1d d8 CLD &0f1e 91 70 STA (&70),Y ; read_address &0f20 4c 15 34 JMP &3415 ; check_if_result_is_negative &0f23 ea NOP &0f24 ea NOP &0f25 ea NOP &0f26 ea NOP &0f27 ea NOP &0f28 ea NOP ; plot_control_character_13 # Control character &13 redraws the room &0f29 c9 13 CMP #&13 &0f2b d0 07 BNE &0f34 ; plot_control_character_14 &0f2d 20 13 21 JSR &2113 ; plot_room_and_set_details &0f30 20 63 1f JSR &1f63 ; plot_player_on_entry_to_room &0f33 60 RTS ; plot_control_character_14 # Control character &14 compares a byte of memory &0f34 c9 14 CMP #&14 &0f36 d0 37 BNE &0f6f ; to_plot_control_character_05 &0f38 20 3a 26 JSR &263a ; increment_text_address &0f3b a0 00 LDY #&00 &0f3d b1 7e LDA (&7e),Y ; text_address # Next two bytes are low and high of address &0f3f 85 70 STA &70 ; read_address_low &0f41 20 3a 26 JSR &263a ; increment_text_address &0f44 b1 7e LDA (&7e),Y ; text_address &0f46 85 71 STA &71 ; read_address_high &0f48 20 3a 26 JSR &263a ; increment_text_address &0f4b b1 70 LDA (&70),Y ; read_address &0f4d d1 7e CMP (&7e),Y ; text_address # Third byte is what to compare it to &0f4f d0 06 BNE &0f57 ; leave &0f51 20 3a 26 JSR &263a ; increment_text_address # If it's the same, skip two further bytes &0f54 20 3a 26 JSR &263a ; increment_text_address ; leave &0f57 60 RTS ; plot_text_without_affecting_address # Unused code &0f58 20 3a 26 JSR &263a ; increment_text_address &0f5b a5 7e LDA &7e ; text_address_low &0f5d 48 PHA &0f5e a5 7f LDA &7f ; text_address_high &0f60 48 PHA &0f61 a0 00 LDY #&00 &0f63 b1 7e LDA (&7e),Y ; text_address &0f65 20 38 25 JSR &2538 ; plot_text_string &0f68 68 PLA &0f69 85 7f STA &7f ; text_address_high &0f6b 68 PLA &0f6c 85 7e STA &7e ; text_address_low &0f6e 60 RTS ; to_plot_control_character_05 &0f6f 4c df 35 JMP &35df ; plot_control_character_05 ; plot_masked_sprite &0f72 a6 75 LDX &75 ; sprite_height ; plot_masked_sprite_column_loop &0f74 8a TXA &0f75 48 PHA &0f76 a6 70 LDX &70 ; sprite_width &0f78 a0 00 LDY #&00 &0f7a 84 76 STY &76 ; screen_offset ; plot_masked_sprite_row_loop &0f7c a4 76 LDY &76 ; screen_offset &0f7e b1 73 LDA (&73),Y ; screen_address &0f80 a0 00 LDY #&00 &0f82 31 77 AND (&77),Y ; mask_address &0f84 11 71 ORA (&71),Y ; sprite_address &0f86 a4 76 LDY &76 ; screen_offset &0f88 91 73 STA (&73),Y ; screen_address &0f8a 98 TYA &0f8b 18 CLC &0f8c 69 08 ADC #&08 # Move right eight pixels &0f8e 85 76 STA &76 ; screen_offset &0f90 e6 71 INC &71 ; sprite_address_low &0f92 d0 02 BNE &0f96 &0f94 e6 72 INC &72 ; sprite_address_high &0f96 e6 77 INC &77 ; mask_address_low &0f98 d0 02 BNE &0f9c &0f9a e6 78 INC &78 ; mask_address_high &0f9c ca DEX &0f9d d0 dd BNE &0f7c ; plot_masked_sprite_row_loop &0f9f 68 PLA &0fa0 aa TAX &0fa1 a5 73 LDA &73 ; screen_address_low &0fa3 29 07 AND #&07 &0fa5 c9 07 CMP #&07 &0fa7 f0 05 BEQ &0fae &0fa9 e6 73 INC &73 ; screen_address_low # Move down a pixel &0fab 4c bb 0f JMP &0fbb &0fae e6 74 INC &74 ; screen_address_high &0fb0 a5 73 LDA &73 ; screen_address_low &0fb2 18 CLC &0fb3 69 39 ADC #&39 &0fb5 90 02 BCC &0fb9 &0fb7 e6 74 INC &74 ; screen_address_high &0fb9 85 73 STA &73 ; screen_address_low &0fbb ca DEX &0fbc d0 b6 BNE &0f74 ; plot_masked_sprite_column_loop &0fbe 60 RTS ; use_player_sprite_with_mask &0fbf a9 03 LDA #&03 &0fc1 85 70 STA &70 ; sprite_width &0fc3 a9 20 LDA #&20 &0fc5 85 75 STA &75 ; sprite_height &0fc7 a9 c0 LDA #&c0 # actually LDA player_sprite_address_low &0fc9 85 71 STA &71 ; sprite_address_low &0fcb a9 30 LDA #&30 # actually LDA player_sprite_address_high &0fcd 85 72 STA &72 ; sprite_address_high &0fcf a9 b6 LDA #&b6 # actually LDA &0fd0 ; player_mask_address_low &0fd1 85 77 STA &77 ; mask_address_low &0fd3 a9 56 LDA #&56 # actually LDA &0fd4 ; player_mask_address_high &0fd5 85 78 STA &78 ; mask_address_high &0fd7 60 RTS ; use_vertical_player_mask_then_on_upwards &0fd8 a9 b6 LDA #&b6 &0fda 8d d0 0f STA &0fd0 ; player_mask_address_low &0fdd a9 56 LDA #&56 ; &56b6 = player_vertical_mask &0fdf 8d d4 0f STA &0fd4 ; player_mask_address_high &0fe2 4c f9 1a JMP &1af9 ; use_player_up_sprite_then_onwards ; use_vertical_player_mask_then_on_downwards &0fe5 a9 b6 LDA #&b6 &0fe7 8d d0 0f STA &0fd0 ; player_mask_address_low &0fea a9 56 LDA #&56 ; &56b6 = player_vertical_mask &0fec 8d d4 0f STA &0fd4 ; player_mask_address_high &0fef 4c 0d 1b JMP &1b0d ; use_player_down_sprite_then_onwards ; use_sideways_player_mask &0ff2 a9 56 LDA #&56 &0ff4 8d d0 0f STA &0fd0 ; player_mask_address_low &0ff7 a9 56 LDA #&56 ; &5656 = player_sideways_mask &0ff9 8d d4 0f STA &0fd4 ; player_mask_address_high &0ffc 60 RTS ; unused &0ffd 00 00 00 ; polymorphic_plot_sprite &1000 a6 75 LDX &75 ; sprite_height ; polymorphic_plot_sprite_column_loop &1002 8a TXA &1003 48 PHA &1004 a6 70 LDX &70 ; sprite_width &1006 a0 00 LDY #&00 &1008 84 76 STY &76 ; screen_offset ; polymorphic_plot_sprite_row_loop ; polymorphic_plot_sprite_instructions &100a a0 00 LDY #&00 # In mask mode &100c b1 71 LDA (&71),Y ; sprite_address &100e a4 76 LDY &76 ; screen_offset &1010 c9 00 CMP #&00 &1012 f0 02 BEQ &1016 ; skip_byte # also #100a a0 00 LDY #&00 # In invert mode #100c b1 71 LDA (&71),Y ; sprite_address #100e a4 76 LDY &76 ; screen_offset #1010 b1 73 LDA (&73),Y ; screen_address #1012 49 ff EOR #&ff # also #100a a0 00 LDY #&00 # In wipe mode #100c a9 00 LDA #&00 #100e a4 76 LDY &76 ; screen_offset #1010 ea NOP #1011 ea NOP #1012 ea NOP #1013 ea NOP # also #100a a4 76 LDY &76 ; screen_offset # In overlay mode #100c b1 73 LDA (&73),Y ; screen_address #100e a0 00 LDY #&00 #1010 11 71 ORA (&71),Y ; sprite_address #1012 a4 76 LDY &76 ; screen_offset ; store_byte &1014 91 73 STA (&73),Y ; screen_address ; skip_byte &1016 98 TYA &1017 18 CLC &1018 69 08 ADC #&08 # Move right eight pixels &101a 85 76 STA &76 ; screen_offset &101c e6 71 INC &71 ; sprite_address_low &101e d0 02 BNE &1022 &1020 e6 72 INC &72 ; sprite_address_high &1022 ca DEX &1023 d0 e5 BNE &100a ; polymorphic_plot_sprite_row_loop &1025 68 PLA &1026 aa TAX &1027 a5 73 LDA &73 ; screen_address_low &1029 29 07 AND #&07 &102b c9 07 CMP #&07 &102d f0 05 BEQ &1034 &102f e6 73 INC &73 ; screen_address_low # Move down a pixel &1031 4c 41 10 JMP &1041 &1034 e6 74 INC &74 ; screen_address_high &1036 a5 73 LDA &73 ; screen_address_low &1038 18 CLC &1039 69 39 ADC #&39 &103b 90 02 BCC &103f &103d e6 74 INC &74 ; screen_address_high &103f 85 73 STA &73 ; screen_address_low &1041 ca DEX &1042 d0 be BNE &1002 ; polymorphic_plot_sprite_column_loop &1044 60 RTS ; plot_sprite &1045 a6 75 LDX &75 ; sprite_height ; plot_sprite_column_loop &1047 8a TXA &1048 48 PHA &1049 a6 70 LDX &70 ; sprite_width &104b a0 00 LDY #&00 &104d 84 76 STY &76 ; screen_offset ; plot_sprite_row_loop &104f a0 00 LDY #&00 &1051 b1 71 LDA (&71),Y ; sprite_address &1053 a4 76 LDY &76 ; screen_offset &1055 91 73 STA (&73),Y ; screen_address &1057 98 TYA &1058 18 CLC &1059 69 08 ADC #&08 # Move right eight pixels &105b 85 76 STA &76 ; screen_offset &105d e6 71 INC &71 ; sprite_address_low &105f d0 02 BNE &1063 &1061 e6 72 INC &72 ; sprite_address_high &1063 ca DEX &1064 d0 e9 BNE &104f ; plot_sprite_row_loop &1066 68 PLA ; sprite_height &1067 aa TAX &1068 a5 73 LDA &73 ; screen_address_low &106a 29 07 AND #&07 &106c c9 07 CMP #&07 &106e f0 05 BEQ &1075 &1070 e6 73 INC &73 ; screen_address_low # Move down a pixel &1072 4c 82 10 JMP &1082 &1075 e6 74 INC &74 ; screen_address_high &1077 a5 73 LDA &73 ; screen_address_low &1079 18 CLC &107a 69 39 ADC #&39 &107c 90 02 BCC &1080 &107e e6 74 INC &74 ; screen_address_high &1080 85 73 STA &73 ; screen_address_low &1082 ca DEX &1083 d0 c2 BNE &1047 ; plot_sprite_column_loop &1085 60 RTS ; copy_screen_behind_sprite &1086 a6 75 LDX &75 ; sprite_height ; copy_screen_column_loop &1088 8a TXA &1089 48 PHA &108a a6 70 LDX &70 ; sprite_width &108c a0 00 LDY #&00 &108e 84 76 STY &76 ; screen_offset ; copy_screen_row_loop &1090 a4 76 LDY &76 ; screen_offset &1092 b1 73 LDA (&73),Y ; screen_address &1094 a0 00 LDY #&00 &1096 91 71 STA (&71),Y ; sprite_address &1098 a5 76 LDA &76 ; screen_offset &109a 18 CLC &109b 69 08 ADC #&08A # Move right eight pixels &109d 85 76 STA &76 ; screen_offset &109f e6 71 INC &71 ; sprite_address_low &10a1 d0 02 BNE &10a5 &10a3 e6 72 INC &72 ; sprite_address_high &10a5 ca DEX &10a6 d0 e8 BNE &1090 ; copy_screen_row_loop &10a8 68 PLA &10a9 aa TAX &10aa a5 73 LDA &73 ; screen_address_low &10ac 29 07 AND #&07 &10ae c9 07 CMP #&07 &10b0 f0 05 BEQ &10b7 &10b2 e6 73 INC &73 ; screen_address_low # Move down a pixel &10b4 4c c4 10 JMP &10c4 &10b7 e6 74 INC &74 ; screen_address_high &10b9 a5 73 LDA &73 ; screen_address_low &10bb 18 CLC &10bc 69 39 ADC #&39 &10be 90 02 BCC &10c2 &10c0 e6 74 INC &74 ; screen_address_high &10c2 85 73 STA &73 ; screen_address_low &10c4 ca DEX &10c5 d0 c1 BNE &1088 ; copy_screen_column_loop &10c7 60 RTS ; calculate_screen_address &10c8 a9 00 LDA #&00 &10ca 85 73 STA &73 ; screen_address_low &10cc a9 58 LDA #&58 &10ce 85 74 STA &74 ; screen_address_high &10d0 a5 70 LDA &70 ; sprite_x &10d2 18 CLC &10d3 2a ROL A &10d4 2a ROL A &10d5 2a ROL A &10d6 90 02 BCC &10da &10d8 e6 74 INC &74 ; screen_address_high &10da 85 73 STA &73 ; screen_address_low &10dc a5 71 LDA &71 ; sprite_y &10de 29 07 AND #&07 &10e0 18 CLC &10e1 65 73 ADC &73 ; screen_address_low &10e3 85 73 STA &73 ; screen_address_low &10e5 a5 71 LDA &71 ; sprite_y &10e7 29 f8 AND #&f8 &10e9 f0 14 BEQ &10ff &10eb 6a ROR A &10ec 6a ROR A &10ed 6a ROR A &10ee a8 TAY &10ef e6 74 INC &74 ; screen_address_high &10f1 a5 73 LDA &73 ; screen_address_low &10f3 18 CLC &10f4 69 40 ADC #&40 &10f6 85 73 STA &73 ; screen_address_low &10f8 90 02 BCC &10fc &10fa e6 74 INC &74 ; screen_address_high &10fc 88 DEY &10fd d0 f0 BNE &10ef &10ff 60 RTS ; reverse_bits_in_byte &1100 ad 72 11 LDA &1172 ; input_byte &1103 29 01 AND #&01 &1105 18 CLC &1106 6a ROR A &1107 6a ROR A &1108 8d 73 11 STA &1173 ; output_byte &110b ad 72 11 LDA &1172 ; input_byte &110e 29 80 AND #&80 &1110 2a ROL A &1111 2a ROL A &1112 6d 73 11 ADC &1173 ; output_byte &1115 8d 73 11 STA &1173 ; output_byte &1118 ad 72 11 LDA &1172 ; input_byte &111b 29 40 AND #&40 &111d 2a ROL A &111e 2a ROL A &111f 2a ROL A &1120 2a ROL A &1121 18 CLC &1122 6d 73 11 ADC &1173 ; output_byte &1125 8d 73 11 STA &1173 ; output_byte &1128 ad 72 11 LDA &1172 ; input_byte &112b 29 02 AND #&02 &112d 6a ROR A &112e 6a ROR A &112f 6a ROR A &1130 6a ROR A &1131 18 CLC &1132 6d 73 11 ADC &1173 ; output_byte &1135 8d 73 11 STA &1173 ; output_byte &1138 ad 72 11 LDA &1172 ; input_byte &113b 29 20 AND #&20 &113d 6a ROR A &113e 6a ROR A &113f 6a ROR A &1140 18 CLC &1141 6d 73 11 ADC &1173 ; output_byte &1144 8d 73 11 STA &1173 ; output_byte &1147 ad 72 11 LDA &1172 ; input_byte &114a 29 04 AND #&04 &114c 2a ROL A &114d 2a ROL A &114e 2a ROL A &114f 18 CLC &1150 6d 73 11 ADC &1173 ; output_byte &1153 8d 73 11 STA &1173 ; output_byte &1156 ad 72 11 LDA &1172 ; input_byte &1159 29 10 AND #&10 &115b 6a ROR A &115c 18 CLC &115d 6d 73 11 ADC &1173 ; output_byte &1160 8d 73 11 STA &1173 ; output_byte &1163 ad 72 11 LDA &1172 ; input_byte &1166 29 08 AND #&08 &1168 2a ROL A &1169 18 CLC &116a 6d 73 11 ADC &1173 ; output_byte &116d 8d 73 11 STA &1173 ; output_byte &1170 60 RTS ; unused &1171 ea NOP ; input_bute &1172 c3 ; output_byte &1173 c3 ; flip_byte_of_sprite &1174 a5 74 LDA &74 ; column &1176 38 SEC &1177 e5 77 SBC &77 ; offset_two &1179 a8 TAY &117a b1 71 LDA (&71),Y ; sprite_address &117c 85 73 STA &73 ; right_hand_byte &117e a4 77 LDY &77 ; offset_two &1180 b1 71 LDA (&71),Y ; sprite_address &1182 8d 72 11 STA &1172 ; input_byte &1185 20 00 11 JSR &1100 ; reverse_bits_in_byte &1188 a5 74 LDA &74 ; column &118a 38 SEC &118b e5 77 SBC &77 ; offset_two &118d a8 TAY &118e c4 77 CPY &77 ; offset_two &1190 f0 0d BEQ &119f ; skip_if_middle_byte &1192 ad 73 11 LDA &1173 ; output_byte &1195 91 71 STA (&71),Y ; sprite_address &1197 a5 73 LDA &73 ; right_hand_byte &1199 8d 72 11 STA &1172 ; input_byte &119c 20 00 11 JSR &1100 ; reverse_bits_in_byte ; skip_if_middle_byte &119f a4 77 LDY &77 ; mask_address_low &11a1 ad 73 11 LDA &1173 ; output_byte &11a4 91 71 STA (&71),Y ; sprite_address &11a6 60 RTS ; flip_row_of_sprite &11a7 a5 70 LDA &70 ; sprite_width &11a9 4a LSR A &11aa ea NOP &11ab 69 00 ADC #&00 &11ad 85 76 STA &76 ; offset_one &11af a9 00 LDA #&00 &11b1 85 77 STA &77 ; offset_two ; width_loop &11b3 a6 76 LDX &76 ; offset_one &11b5 ca DEX &11b6 86 76 STX &76 ; offset_one &11b8 30 08 BMI &11c2 ; leave &11ba 20 74 11 JSR &1174 ; flip_byte_of_sprite &11bd e6 77 INC &77 ; offset_two &11bf 4c b3 11 JMP &11b3 ; width_loop ; leave &11c2 60 RTS ; flip_sprite &11c3 a5 70 LDA &70 ; sprite_width &11c5 85 74 STA &74 ; column &11c7 c6 74 DEC &74 ; column ; height_loop &11c9 20 a7 11 JSR &11a7 ; flip_row_of_sprite &11cc a5 71 LDA &71 ; sprite_address_low &11ce 18 CLC &11cf 65 70 ADC &70 &11d1 85 71 STA &71 ; sprite_address_low &11d3 a5 72 LDA &72 ; sprite_address_high &11d5 69 00 ADC #&00 &11d7 85 72 STA &72 ; sprite_address_high &11d9 a6 75 LDX &75 ; sprite_height &11db ca DEX &11dc 86 75 STX &75 ; sprite_height &11de d0 e9 BNE &11c9 ; height_loop &11e0 60 RTS ; use_player_down_sprite &11e1 a9 03 LDA #&03 &11e3 85 70 STA &70 ; sprite_width &11e5 a9 20 LDA #&20 &11e7 85 75 STA &75 ; sprite_height &11e9 a9 c0 LDA #&c0 &11eb 85 71 STA &71 ; sprite_address_low &11ed a9 30 LDA #&30 ; &30c0 = player_down_sprite &11ef 85 72 STA &72 ; sprite_address_high &11f1 60 RTS ; plot_player &11f2 a5 82 LDA &82 ; player_x &11f4 85 70 STA &70 ; sprite_x &11f6 a5 83 LDA &83 ; player_y &11f8 85 71 STA &71 ; sprite_y &11fa 20 c8 10 JSR &10c8 ; calculate_screen_address &11fd 20 bf 0f JSR &0fbf ; use_player_sprite_with_mask &1200 20 72 0f JSR &0f72 ; plot_masked_sprite # SPB.2 is loaded at &1200-&57ff &1203 60 RTS ; restore_screen_behind_player &1204 a5 80 LDA &80 ; previous_player_x &1206 85 70 STA &70 ; sprite_x &1208 a5 81 LDA &81 ; previous_player_y &120a 85 71 STA &71 ; sprite_y &120c 20 c8 10 JSR &10c8 ; calculate_screen_address &120f 20 e1 11 JSR &11e1 ; use_player_down_sprite &1212 a9 a0 LDA #&a0 &1214 85 71 STA &71 ; sprite_address_low &1216 a9 2f LDA #&2f ; &2fa0 = backup_of_player_screen &1218 85 72 STA &72 ; sprite_address_high &121a 20 45 10 JSR &1045 ; plot_sprite &121d 60 RTS ; copy_screen_behind_player &121e a5 82 LDA &82 ; player_x &1220 85 70 STA &70 ; sprite_x &1222 a5 83 LDA &83 ; player_y &1224 85 71 STA &71 ; sprite_y &1226 20 c8 10 JSR &10c8 ; calculate_screen_address &1229 20 e1 11 JSR &11e1 ; use_player_down_sprite &122c a9 a0 LDA #&a0 &122e 85 71 STA &71 ; sprite_address_low &1230 a9 2f LDA #&2f ; &2fa0 = backup_of_player_screen &1232 85 72 STA &72 ; sprite_address_high &1234 20 86 10 JSR &1086 ; copy_screen_behind_sprite &1237 60 RTS ; use_object_sprite &1238 a5 8e LDA &8e ; object_sprite_width &123a 85 70 STA &70 ; sprite_width &123c a5 8f LDA &8f ; object_sprite_height &123e 85 75 STA &75 ; sprite_height &1240 a0 00 LDY #&00 &1242 b1 95 LDA (&95),Y ; object_framerate_address &1244 c5 97 CMP &97 ; object_framerate_comparison &1246 90 09 BCC &1251 ; use_frame_one_address ; use_frame_zero_address &1248 a5 91 LDA &91 ; object_sprite_frame_zero_low &124a 85 71 STA &71 ; sprite_address_low &124c a5 92 LDA &92 ; object_sprite_frame_zero_high &124e 85 72 STA &72 ; sprite_address_high &1250 60 RTS ; use_frame_one_address &1251 a5 93 LDA &93 ; object_sprite_frame_one_low &1253 85 71 STA &71 ; sprite_address_low &1255 a5 94 LDA &94 ; object_sprite_frame_one_high &1257 85 72 STA &72 ; sprite_address_high &1259 60 RTS ; plot_object &125a a5 86 LDA &86 ; object_x &125c 85 70 STA &70 ; sprite_x &125e a5 87 LDA &87 ; object_y &1260 85 71 STA &71 ; sprite_y &1262 20 c8 10 JSR &10c8 ; calculate_screen_address &1265 20 38 12 JSR &1238 ; use_object_sprite &1268 20 00 10 JSR &1000 ; polymorphic_plot_sprite &126b 60 RTS ; restore_screen_behind_object &126c a5 84 LDA &84 ; previous_object_x &126e 85 70 STA &70 ; sprite_x &1270 a5 85 LDA &85 ; previous_object_y &1272 85 71 STA &71 ; sprite_y &1274 20 c8 10 JSR &10c8 ; calculate_screen_address &1277 20 38 12 JSR &1238 ; use_object_sprite &127a a9 60 LDA #&60 &127c 85 71 STA &71 ; sprite_address_low &127e a9 2d LDA #&2d ; &2d60 = backup_of_object_screen &1280 85 72 STA &72 ; sprite_address_high &1282 20 45 10 JSR &1045 ; plot_sprite &1285 60 RTS ; copy_screen_behind_object &1286 a5 86 LDA &86 ; object_x &1288 85 70 STA &70 ; sprite_x &128a a5 87 LDA &87 ; object_y &128c 85 71 STA &71 ; sprite_y &128e 20 c8 10 JSR &10c8 ; calculate_screen_address &1291 20 38 12 JSR &1238 ; use_object_sprite &1294 a9 60 LDA #&60 &1296 85 71 STA &71 ; sprite_address_low &1298 a9 2d LDA #&2d ; &2d60 = backup_of_object_screen &129a 85 72 STA &72 ; sprite_address_high &129c 20 86 10 JSR &1086 ; copy_screen_behind_sprite &129f 60 RTS ; unplot_and_replot_player_and_object &12a0 20 04 12 JSR &1204 ; restore_screen_behind_player &12a3 20 6c 12 JSR &126c ; restore_screen_behind_object &12a6 20 1e 12 JSR &121e ; copy_screen_behind_player &12a9 20 86 12 JSR &1286 ; copy_screen_behind_object &12ac 20 8e 1c JSR &1c8e ; check_if_object_is_in_front_of_player &12af f0 0b BEQ &12bc ; object_is_in_front_of_player &12b1 ea NOP &12b2 20 5a 12 JSR &125a ; plot_object &12b5 20 f2 11 JSR &11f2 ; plot_player &12b8 4c bc 1c JMP &1cbc ; delay_for_57344_loops &12bb ea NOP ; object_is_in_front_of_player &12bc 20 f2 11 JSR &11f2 ; plot_player &12bf 20 5a 12 JSR &125a ; plot_object &12c2 4c bc 1c JMP &1cbc ; delay_for_57344_loops ; plot_player_after_vsync_with_two_delays &12c5 a9 13 LDA #&13 ; Wait for Vertical Retrace &12c7 20 f4 ff JSR &fff4 ; OSBYTE &12ca 20 61 1c JSR &1c61 ; delay_for_10836_loops &12cd 20 04 12 JSR &1204 ; restore_screen_behind_player &12d0 20 1e 12 JSR &121e ; copy_screen_behind_player &12d3 20 f2 11 JSR &11f2 ; plot_player &12d6 20 61 1c JSR &1c61 ; delay_for_10836_loops &12d9 ea NOP &12da ea NOP &12db ea NOP &12dc ea NOP &12dd 60 RTS ; use_object_frame_zero &12de a5 8e LDA &8e ; object_sprite_width &12e0 85 70 STA &70 ; sprite_width &12e2 a5 8f LDA &8f ; object_sprite_height &12e4 85 75 STA &75 ; sprite_height &12e6 a5 91 LDA &91 ; object_sprite_frame_zero_low &12e8 85 71 STA &71 ; sprite_address_low &12ea a5 92 LDA &92 ; object_sprite_frame_zero_high &12ec 85 72 STA &72 ; sprite_address_high &12ee 60 RTS ; use_object_frame_one &12ef a5 8e LDA &8e ; object_sprite_width &12f1 85 70 STA &70 ; sprite_width &12f3 a5 8f LDA &8f ; object_sprite_height &12f5 85 75 STA &75 ; sprite_height &12f7 a5 93 LDA &93 ; object_sprite_frame_one_low &12f9 85 71 STA &71 ; sprite_address_low &12fb a5 94 LDA &94 ; object_sprite_frame_one_high &12fd 85 72 STA &72 ; sprite_address_high &12ff 60 RTS ; use_scenery_sprite &1300 ad 3a 20 LDA &203a ; scenery_sprite_x &1303 85 70 STA &70 ; sprite_x &1305 ad 3b 20 LDA &203b ; scenery_sprite_y &1308 85 71 STA &71 ; sprite_y &130a 20 c8 10 JSR &10c8 ; calculate_screen_address &130d ad 39 20 LDA &2039 ; scenery_sprite_to_use &1310 0a ASL A &1311 0a ASL A &1312 aa TAX &1313 bd 66 55 LDA &5566,X ; scenery_sprite_data_table &1316 85 71 STA &71 ; sprite_address_low &1318 e8 INX &1319 bd 66 55 LDA &5566,X ; scenery_sprite_data_table &131c 85 72 STA &72 ; sprite_address_high &131e e8 INX &131f bd 66 55 LDA &5566,X ; scenery_sprite_data_table &1322 85 70 STA &70 ; sprite_width &1324 e8 INX &1325 bd 66 55 LDA &5566,X ; scenery_sprite_data_table &1328 85 75 STA &75 ; sprite_height &132a 60 RTS ; plot_scenery_sprite &132b 8e 3a 20 STX &203a ; scenery_sprite_x &132e 8c 3b 20 STY &203b ; scenery_sprite_y &1331 a2 00 LDX #&00 &1333 8e 38 20 STX &2038 ; unused_scenery_sprite_variable # Redundant variable &1336 c9 1c CMP #&1c &1338 90 19 BCC &1353 ; plot_scenery_sprite_unflipped &133a 38 SEC &133b e9 1c SBC #&1c &133d 8d 39 20 STA &2039 ; scenery_sprite_to_use &1340 20 00 13 JSR &1300 ; use_scenery_sprite &1343 20 c3 11 JSR &11c3 ; flip_sprite &1346 20 00 13 JSR &1300 ; use_scenery_sprite &1349 20 45 10 JSR &1045 ; plot_sprite &134c 20 00 13 JSR &1300 ; use_scenery_sprite &134f 20 c3 11 JSR &11c3 ; flip_sprite &1352 60 RTS ; plot_scenery_sprite_unflipped &1353 8d 39 20 STA &2039 ; scenery_sprite_to_use &1356 20 00 13 JSR &1300 ; use_scenery_sprite &1359 20 45 10 JSR &1045 ; plot_sprite &135c 60 RTS ; plot_top_wall &135d a9 14 LDA #&14 &135f 38 SEC &1360 ed 3c 20 SBC &203c ; offset_from_centre_to_left_of_top_wall &1363 8d 3e 20 STA &203e ; room_top_left_corner_x &1366 ad 3d 20 LDA &203d ; offset_from_centre_to_right_of_top_wall &1369 18 CLC &136a 69 14 ADC #&14 &136c ea NOP &136d 8d 3f 20 STA &203f ; room_top_right_corner_x &1370 a0 18 LDY #&18 ; minimum y of top wall &1372 ae 3e 20 LDX &203e ; room_top_left_corner_x ; plot_top_wall_loop &1375 98 TYA &1376 48 PHA &1377 8a TXA &1378 48 PHA &1379 a9 01 LDA #&01 ; TOP WALL &137b 20 2b 13 JSR &132b ; plot_scenery_sprite &137e 68 PLA &137f aa TAX &1380 68 PLA &1381 a8 TAY &1382 e8 INX &1383 e8 INX &1384 e8 INX &1385 e8 INX &1386 ec 3f 20 CPX &203f ; room_top_right_corner_x &1389 d0 ea BNE &1375 ; plot_top_wall_loop &138b 98 TYA &138c 18 CLC &138d 69 18 ADC #&18 &138f a8 TAY &1390 ae 3e 20 LDX &203e ; room_top_left_corner_x &1393 c9 60 CMP #&60 ; maximum y of top wall &1395 d0 de BNE &1375 ; plot_top_wall_loop &1397 60 RTS ; plot_side_wall_down_to_corner &1398 ea NOP &1399 ea NOP &139a ea NOP &139b a2 03 LDX #&03 &139d ac 42 20 LDY &2042 ; y_position_of_side_wall ; plot_side_wall_loop &13a0 8a TXA &13a1 48 PHA &13a2 98 TYA &13a3 48 PHA &13a4 ae 41 20 LDX &2041 ; x_position_of_side_wall &13a7 ad 40 20 LDA &2040 ; whether_to_flip_side_wall &13aa c9 00 CMP #&00 &13ac d0 05 BNE &13b3 &13ae a9 03 LDA #&03 ; SIDE WALL &13b0 4c b5 13 JMP &13b5 &13b3 a9 1f LDA #&1f ; SIDE WALL (flipped) &13b5 20 2b 13 JSR &132b ; plot_scenery_sprite &13b8 68 PLA &13b9 a8 TAY &13ba 68 PLA &13bb aa TAX &13bc 98 TYA &13bd 18 CLC &13be 69 18 ADC #&18 &13c0 a8 TAY &13c1 ca DEX &13c2 e0 00 CPX #&00 &13c4 d0 da BNE &13a0 ; plot_side_wall_loop &13c6 ae 41 20 LDX &2041 ; x_position_of_side_wall &13c9 ad 40 20 LDA &2040 ; whether_to_flip_side_wall &13cc c9 00 CMP #&00 &13ce d0 05 BNE &13d5 &13d0 a9 04 LDA #&04 ; SIDE WALL BOTTOM &13d2 4c d7 13 JMP &13d7 &13d5 a9 20 LDA #&20 ; SIDE WALL BOTTOM (flipped) &13d7 20 2b 13 JSR &132b ; plot_scenery_sprite &13da 60 RTS ; plot_side_wall &13db ad 43 20 LDA &2043 ; side_wall_has_top &13de c9 00 CMP #&00 &13e0 d0 03 BNE &13e5 &13e2 4c 05 14 JMP &1405 ; to_plot_side_wall_down_to_corner &13e5 ae 41 20 LDX &2041 ; x_position_of_side_wall &13e8 ac 42 20 LDY &2042 ; y_position_of_side_wall &13eb ad 40 20 LDA &2040 ; whether_to_flip_side_wall &13ee c9 00 CMP #&00 &13f0 d0 05 BNE &13f7 &13f2 a9 00 LDA #&00 ; SIDE WALL TOP &13f4 4c f9 13 JMP &13f9 &13f7 a9 1c LDA #&1c ; SIDE WALL TOP (flipped) &13f9 20 2b 13 JSR &132b ; plot_scenery_sprite &13fc ad 42 20 LDA &2042 ; y_position_of_side_wall &13ff 18 CLC &1400 69 10 ADC #&10 &1402 8d 42 20 STA &2042 ; y_position_of_side_wall ; to_plot_side_wall_down_to_corner &1405 20 98 13 JSR &1398 ; plot_side_wall_down_to_corner &1408 60 RTS ; plot_walls_doors_and_other_scenery &1409 20 5d 13 JSR &135d ; plot_top_wall &140c ad 3d 20 LDA &203d ; offset_from_centre_to_right_of_top_wall &140f c9 09 CMP #&09 &1411 90 03 BCC &1416 ; plot_right_wall &1413 4c 4c 14 JMP &144c ; skip_plotting_right_wall ; plot_right_wall &1416 ae 3f 20 LDX &203f ; room_top_right_corner_x &1419 a0 18 LDY #&18 &141b a9 00 LDA #&00 &141d 8d 43 20 STA &2043 ; side_wall_has_top &1420 8d 40 20 STA &2040 ; whether_to_flip_side_wall &1423 8e 41 20 STX &2041 ; x_position_of_side_wall &1426 8c 42 20 STY &2042 ; y_position_of_side_wall &1429 20 db 13 JSR &13db ; plot_side_wall &142c ad 44 20 LDA &2044 ; side_walls_are_double_width &142f c9 00 CMP #&00 &1431 d0 03 BNE &1436 ; plot_double_right_wall &1433 4c 4c 14 JMP &144c ; skip_plotting_right_wall ; plot_double_right_wall &1436 ad 3f 20 LDA &203f ; room_top_right_corner_x &1439 18 CLC &143a 69 04 ADC #&04 &143c 8d 41 20 STA &2041 ; x_position_of_side_wall &143f a9 18 LDA #&18 &1441 8d 42 20 STA &2042 ; y_position_of_side_wall &1444 a9 01 LDA #&01 &1446 8d 43 20 STA &2043 ; side_wall_has_top &1449 20 db 13 JSR &13db ; plot_side_wall ; skip_plotting_right_wall &144c ea NOP &144d ad 3c 20 LDA &203c ; offset_from_centre_to_left_of_top_wall &1450 c9 09 CMP #&09 &1452 b0 39 BCS &148d ; skip_plotting_left_wall ; plot_left_wall &1454 ad 3e 20 LDA &203e ; room_top_left_corner_x &1457 38 SEC &1458 e9 04 SBC #&04 &145a a0 18 LDY #&18 &145c a2 00 LDX #&00 &145e 8e 43 20 STX &2043 ; side_wall_has_top &1461 ee 40 20 INC &2040 ; whether_to_flip_side_wall &1464 8d 41 20 STA &2041 ; x_position_of_side_wall &1467 8c 42 20 STY &2042 ; y_position_of_side_wall &146a 20 db 13 JSR &13db ; plot_side_wall &146d ad 44 20 LDA &2044 ; side_walls_are_double_width &1470 c9 00 CMP #&00 &1472 d0 03 BNE &1477 ; plot_double_left_wall &1474 4c 8d 14 JMP &148d ; skip_plotting_left_wall ; plot_double_left_wall &1477 ad 3e 20 LDA &203e ; room_top_left_corner_x &147a 38 SEC &147b e9 08 SBC #&08 &147d 8d 41 20 STA &2041 ; x_position_of_side_wall &1480 a9 18 LDA #&18 &1482 8d 42 20 STA &2042 ; y_position_of_side_wall &1485 a9 01 LDA #&01 &1487 8d 43 20 STA &2043 ; side_wall_has_top &148a 20 db 13 JSR &13db ; plot_side_wall ; skip_plotting_left_wall ; calculate_room_start_and_end_x &148d a5 89 LDA &89 ; room_data_byte_two &148f 29 10 AND #&10 &1491 d0 05 BNE &1498 ; tall_room &1493 a9 70 LDA #&70 &1495 4c 9a 14 JMP &149a ; short_room ; tall_room &1498 a9 80 LDA #&80 ; short_room &149a 38 SEC &149b e9 60 SBC #&60 &149d 4a LSR A &149e 4a LSR A &149f 18 CLC &14a0 6d 3f 20 ADC &203f ; room_top_right_corner_x &14a3 8d 45 20 STA &2045 ; room_end_x &14a6 a5 89 LDA &89 ; room_data_byte_two &14a8 29 10 AND #&10 &14aa d0 05 BNE &14b1 ; tall_room &14ac a9 70 LDA #&70 &14ae 4c b3 14 JMP &14b3 ; short_room ; tall_room &14b1 a9 80 LDA #&80 ; short_room &14b3 38 SEC &14b4 e9 60 SBC #&60 &14b6 4a LSR A &14b7 4a LSR A &14b8 8d 46 20 STA &2046 ; room_start_x &14bb ad 3e 20 LDA &203e ; room_top_left_corner_x &14be 38 SEC &14bf ed 46 20 SBC &2046 ; room_start_x &14c2 c9 01 CMP #&01 &14c4 10 03 BPL &14c9 &14c6 ad 3e 20 LDA &203e ; room_top_left_corner_x &14c9 8d 46 20 STA &2046 ; room_start_x &14cc ad 45 20 LDA &2045 ; room_end_x &14cf c9 24 CMP #&24 &14d1 30 05 BMI &14d8 &14d3 a9 24 LDA #&24 &14d5 8d 45 20 STA &2045 ; room_end_x &14d8 ae 46 20 LDX &2046 ; room_start_x ; plot_room_bottom_border &14db a5 89 LDA &89 ; room_data_byte_two &14dd 29 10 AND #&10 &14df d0 05 BNE &14e6 ; tall_room &14e1 a9 70 LDA #&70 &14e3 4c e8 14 JMP &14e8 ; short_room ; tall_room &14e6 a9 80 LDA #&80 ; short_room &14e8 a8 TAY ; plot_room_bottom_border_loop &14e9 86 70 STX &70 &14eb 84 71 STY &71 &14ed 8a TXA &14ee 48 PHA &14ef 98 TYA &14f0 48 PHA &14f1 20 c8 10 JSR &10c8 ; calculate_screen_address &14f4 a0 00 LDY #&00 &14f6 a9 ff LDA #&ff &14f8 91 73 STA (&73),Y ; screen_address &14fa 68 PLA &14fb a8 TAY &14fc 68 PLA &14fd aa TAX &14fe e8 INX &14ff ec 45 20 CPX &2045 ; room_end_x &1502 d0 e5 BNE &14e9 ; plot_room_bottom_border_loop ; plot_doors &1504 a5 88 LDA &88 ; room_data_byte_one &1506 29 01 AND #&01 &1508 f0 10 BEQ &151a ; no_top_left_door &150a a9 02 LDA #&02 ; TOP DOOR &150c ae 3e 20 LDX &203e ; room_top_left_corner_x &150f a0 30 LDY #&30 &1511 8e 48 20 STX &2048 ; top_door_x &1514 8c 49 20 STY &2049 ; top_door_y &1517 20 2b 13 JSR &132b ; plot_scenery_sprite ; no_top_left_door &151a a5 88 LDA &88 ; room_data_byte_one &151c 29 02 AND #&02 &151e f0 14 BEQ &1534 ; no_top_right_door &1520 ad 3f 20 LDA &203f ; room_top_right_corner_x &1523 38 SEC &1524 e9 08 SBC #&08 &1526 aa TAX &1527 a9 02 LDA #&02 ; TOP DOOR &1529 a0 30 LDY #&30 &152b 8e 48 20 STX &2048 ; top_door_x &152e 8c 49 20 STY &2049 ; top_door_y &1531 20 2b 13 JSR &132b ; plot_scenery_sprite ; no_top_right_door &1534 a5 89 LDA &89 ; room_data_byte_two &1536 29 10 AND #&10 &1538 f0 05 BEQ &153f ; short_room &153a a0 80 LDY #&80 &153c 4c 41 15 JMP &1541 ; tall_room ; short_room &153f a0 70 LDY #&70 ; tall_room &1541 8c 47 20 STY &2047 ; room_height &1544 a5 88 LDA &88 ; room_data_byte_one &1546 29 20 AND #&20 &1548 f0 15 BEQ &155f ; no_bottom_left_door &154a ad 47 20 LDA &2047 ; room_height &154d 38 SEC &154e e9 08 SBC #&08 &1550 a8 TAY &1551 a9 06 LDA #&06 ; BOTTOM DOOR &1553 ae 3e 20 LDX &203e ; room_top_left_corner_x &1556 8e 4a 20 STX &204a ; bottom_door_x &1559 8c 4b 20 STY &204b ; bottom_door_y &155c 20 2b 13 JSR &132b ; plot_scenery_sprite ; no_bottom_left_door &155f a5 88 LDA &88 ; room_data_byte_one &1561 29 10 AND #&10 &1563 f0 19 BEQ &157e ; no_bottom_right_door &1565 ad 47 20 LDA &2047 ; room_height &1568 38 SEC &1569 e9 08 SBC #&08 &156b a8 TAY &156c ad 3f 20 LDA &203f ; room_top_right_corner_x &156f 38 SEC &1570 e9 06 SBC #&06 &1572 aa TAX &1573 a9 06 LDA #&06 ; BOTTOM DOOR &1575 8e 4a 20 STX &204a ; bottom_door_x &1578 8c 4b 20 STY &204b ; bottom_door_y &157b 20 2b 13 JSR &132b ; plot_scenery_sprite ; no_bottom_right_door &157e a5 88 LDA &88 ; room_data_byte_one &1580 29 04 AND #&04 &1582 f0 10 BEQ &1594 ; no_right_top_door &1584 ae 3f 20 LDX &203f ; room_top_right_corner_x &1587 a0 30 LDY #&30 &1589 a9 05 LDA #&05 ; SIDE DOOR &158b 8e 4c 20 STX &204c ; right_door_x &158e 8c 4d 20 STY &204d ; right_door_y &1591 20 2b 13 JSR &132b ; plot_scenery_sprite ; no_right_top_door &1594 a5 88 LDA &88 ; room_data_byte_one &1596 29 80 AND #&80 &1598 f0 14 BEQ &15ae ; no_left_bottom_door &159a ad 3e 20 LDA &203e ; room_top_left_corner_x &159d 38 SEC &159e e9 04 SBC #&04 &15a0 aa TAX &15a1 a0 30 LDY #&30 &15a3 a9 21 LDA #&21 ; SIDE DOOR (flipped) &15a5 8e 4e 20 STX &204e ; left_door_x &15a8 8c 4f 20 STY &204f ; left_door_y &15ab 20 2b 13 JSR &132b ; plot_scenery_sprite ; no_left_bottom_door &15ae a5 88 LDA &88 ; room_data_byte_one &15b0 29 08 AND #&08 &15b2 f0 14 BEQ &15c8 ; no_right_bottom_door &15b4 ad 3f 20 LDA &203f ; room_top_right_corner_x &15b7 18 CLC &15b8 69 04 ADC #&04 &15ba aa TAX &15bb a0 40 LDY #&40 &15bd a9 05 LDA #&05 ; SIDE DOOR &15bf 8e 4c 20 STX &204c ; right_door_x &15c2 8c 4d 20 STY &204d ; right_door_y &15c5 20 2b 13 JSR &132b ; plot_scenery_sprite ; no_right_bottom_door &15c8 a5 88 LDA &88 ; room_data_byte_one &15ca 29 40 AND #&40 &15cc f0 14 BEQ &15e2 ; no_left_top_door &15ce ad 3e 20 LDA &203e ; room_top_left_corner_x &15d1 38 SEC &15d2 e9 08 SBC #&08 &15d4 aa TAX &15d5 a0 40 LDY #&40 &15d7 a9 21 LDA #&21 ; SIDE DOOR (flipped) &15d9 8e 4e 20 STX &204e ; left_door_x &15dc 8c 4f 20 STY &204f ; left_door_y &15df 20 2b 13 JSR &132b ; plot_scenery_sprite ; no_left_top_door &15e2 a5 8a LDA &8a ; room_data_byte_three &15e4 29 08 AND #&08 &15e6 f0 33 BEQ &161b ; no_shields &15e8 ad 3d 20 LDA &203d ; offset_from_centre_to_right_of_top_wall &15eb c9 09 CMP #&09 &15ed 10 10 BPL &15ff ; no_right_shield # No shield if the room extends to the right &15ef a5 88 LDA &88 ; room_data_byte_one &15f1 29 04 AND #&04 &15f3 d0 0a BNE &15ff ; no_right_shield # or if the room has a right door at the top &15f5 a9 0e LDA #&0e ; SHIELD &15f7 ae 3f 20 LDX &203f ; room_top_right_corner_x &15fa a0 30 LDY #&30 &15fc 20 2b 13 JSR &132b ; plot_scenery_sprite ; no_right_shield &15ff ad 3c 20 LDA &203c ; offset_from_centre_to_left_of_top_wall &1602 c9 09 CMP #&09 &1604 10 15 BPL &161b ; no_left_shield # No shield if the room extends to the left &1606 a5 88 LDA &88 ; room_data_byte_one &1608 29 40 AND #&40 &160a d0 0f BNE &161b ; no_left_shield # or if the room has a left door at the top &160c ae 46 20 LDX &2046 ; room_start_x &160f ad 47 20 LDA &2047 ; room_height &1612 38 SEC &1613 e9 40 SBC #&40 &1615 a8 TAY &1616 a9 2a LDA #&2a ; SHIELD (flipped) &1618 20 2b 13 JSR &132b ; plot_scenery_sprite ; no_left_shield ; no_shields &161b 4c d7 1b JMP &1bd7 ; consider_plotting_bookshelves &161e ea NOP &161f ea NOP &1620 ea NOP ; plot_bookshelves &1621 a5 88 LDA &88 ; room_data_byte_one &1623 29 08 AND #&08 # If the room has a right door at the bottom, &1625 d0 1e BNE &1645; bookshelves_are_flipped # then the bookshelves are on the left wall &1627 ad 3d 20 LDA &203d ; offset_from_centre_to_right_of_top_wall &162a c9 09 CMP #&09 # If the room extends to the right, &162c 10 17 BPL &1645 ; bookshelves_are_flipped # then the bookshelves are on the right wall &162e ad 3f 20 LDA &203f ; room_top_right_corner_x &1631 18 CLC &1632 69 04 ADC #&04 &1634 a0 50 LDY #&50 &1636 aa TAX &1637 a9 0b LDA #&0b ; BOOKSHELVES &1639 8e 52 20 STX &2052 ; furniture_x &163c 8c 53 20 STY &2053 ; furniture_y &163f 20 2b 13 JSR &132b ; plot_scenery_sprite &1642 4c 59 16 JMP &1659 ; plot_armour ; bookshelves_are_flipped &1645 ad 3e 20 LDA &203e ; room_top_left_corner_x &1648 38 SEC &1649 e9 08 SBC #&08 &164b a0 50 LDY #&50 &164d aa TAX &164e a9 27 LDA #&27 ; BOOKSHELVES (flipped) &1650 8e 52 20 STX &2052 ; furniture_x &1653 8c 53 20 STY &2053 ; furniture_y &1656 20 2b 13 JSR &132b ; plot_scenery_sprite ; plot_armour &1659 a5 8a LDA &8a ; room_data_byte_three &165b 29 80 AND #&80 &165d f0 39 BEQ &1698 ; room_doesn't_have_armour &165f ad 3d 20 LDA &203d ; offset_from_centre_to_right_of_top_wall &1662 c9 09 CMP #&09 &1664 10 17 BPL &167d ; room_doesn't_have_right_armour # No right armour if the room extends to the right &1666 ad 45 20 LDA &2045 ; room_end_x &1669 a5 88 LDA &88 ; room_data_byte_one &166b 29 08 AND #&08 &166d d0 0e BNE &167d ; room_doesn't_have_right_armour # or if the room has a right door at the bottom &166f ad 45 20 LDA &2045 ; room_end_x &1672 38 SEC &1673 e9 04 SBC #&04 &1675 aa TAX &1676 a0 40 LDY #&40 &1678 a9 0f LDA #&0f ; ARMOUR &167a 20 2b 13 JSR &132b ; plot_scenery_sprite ; room_doesn't_have_right_armour &167d ad 3c 20 LDA &203c ; offset_from_centre_to_left_of_top_wall &1680 c9 09 CMP #&09 &1682 10 14 BPL &1698 ; room_doesn't_have_left_armour # No left armour if the room extends to the left &1684 a5 88 LDA &88 ; room_data_byte_one &1686 29 80 AND #&80 &1688 d0 0e BNE &1698 ; room_doesn't_have_left_armour # or if the room has a left door at the bottom &168a ad 3e 20 LDA &203e ; room_top_left_corner_x &168d 38 SEC &168e e9 04 SBC #&04 &1690 aa TAX &1691 a0 30 LDY #&30 &1693 a9 2b LDA #&2b ; ARMOUR (flipped) &1695 20 2b 13 JSR &132b ; plot_scenery_sprite ; room_doesn't_have_left_armour ; room_doesn't_have_armour ; plot_picture &1698 a5 8a LDA &8a ; room_data_byte_three &169a 29 20 AND #&20 &169c f0 25 BEQ &16c3 ; room_doesn't_have_picture &169e a5 88 LDA &88 ; room_data_byte_one &16a0 29 02 AND #&02 # If the room has a top door on the right, &16a2 d0 11 BNE &16b5 ; room_has_picture_on_left # then the picture is on the left &16a4 ad 3f 20 LDA &203f ; room_top_right_corner_x &16a7 38 SEC &16a8 e9 06 SBC #&06 &16aa aa TAX &16ab a0 30 LDY #&30 &16ad a9 0d LDA #&0d ; PICTURE &16af 20 2b 13 JSR &132b ; plot_scenery_sprite &16b2 4c c3 16 JMP &16c3 ; plot_stone_dwarf ; room_has_picture_on_left &16b5 ad 3e 20 LDA &203e ; room_top_left_corner_x &16b8 18 CLC &16b9 69 02 ADC #&02 &16bb aa TAX &16bc a0 30 LDY #&30 &16be a9 0d LDA #&0d ; PICTURE &16c0 20 2b 13 JSR &132b ; plot_scenery_sprite ; room_doesn't_have_picture ; plot_stone_dwarf &16c3 a5 8a LDA &8a ; room_data_byte_three &16c5 29 40 AND #&40 &16c7 f0 31 BEQ &16fa ; room_doesn't_have_stone_dwarf &16c9 a5 88 LDA &88 ; room_data_byte_one &16cb 29 01 AND #&01 # Bug: if the room has a top door on the left, &16cd d0 17 BNE &16e6 ; stone_dwarf_is_on_left # then the stone dwarf is on the left too. &16cf ad 3f 20 LDA &203f ; room_top_right_corner_x &16d2 38 SEC &16d3 e9 05 SBC #&05 &16d5 aa TAX &16d6 a0 48 LDY #&48 &16d8 a9 0a LDA #&0a ; STONE DWARF &16da 8e 52 20 STX &2052 ; furniture_x &16dd 8c 53 20 STY &2053 ; furniture_y &16e0 20 2b 13 JSR &132b ; plot_scenery_sprite &16e3 4c fa 16 JMP &16fa ; plot_prison_bars ; stone_dwarf_is_on_left &16e6 ad 3e 20 LDA &203e ; room_top_left_corner_x &16e9 18 CLC &16ea 69 03 ADC #&03 &16ec aa TAX &16ed a0 48 LDY #&48 &16ef a9 0a LDA #&0a ; STONE DWARF &16f1 8e 52 20 STX &2052 ; furniture_x &16f4 8c 53 20 STY &2053 ; furniture_y &16f7 20 2b 13 JSR &132b ; plot_scenery_sprite ; room_doesn't_have_stone_dwarf ; plot_prison_bars &16fa a5 8a LDA &8a ; room_data_byte_three &16fc 29 02 AND #&02 &16fe f0 10 BEQ &1710 ; room_doesn't_have_prison_bars &1700 ae 3e 20 LDX &203e ; room_top_left_corner_x &1703 a9 0c LDA #&0c ; PRISON BARS &1705 a0 30 LDY #&30 &1707 8e 52 20 STX &2052 ; furniture_x &170a 8c 53 20 STY &2053 ; furniture_y &170d 20 2b 13 JSR &132b ; plot_scenery_sprite ; room_doesn't_have_prison_bars ; plot_chest &1710 a5 8a LDA &8a ; room_data_byte_three &1712 29 04 AND #&04 &1714 f0 31 BEQ &1747 ; room_doesn't_have_chest &1716 a5 88 LDA &88 ; room_data_byte_one &1718 29 02 AND #&02 # If the room has a top door on the right, &171a d0 17 BNE &1733 ; chest_is_on_left # then the chest is on the left &171c ad 3f 20 LDA &203f ; room_top_right_corner_x &171f 38 SEC &1720 e9 06 SBC #&06 &1722 aa TAX &1723 a0 48 LDY #&48 &1725 a9 10 LDA #&10 ; CHEST &1727 8e 50 20 STX &2050 ; chest_x &172a 8c 51 20 STY &2051 ; chest_y &172d 20 2b 13 JSR &132b ; plot_scenery_sprite &1730 4c 47 17 JMP &1747 ; plot_window ; chest_is_on_left &1733 ad 3e 20 LDA &203e ; room_top_left_corner_x &1736 18 CLC &1737 69 02 ADC #&02 &1739 aa TAX &173a a0 48 LDY #&48 &173c a9 10 LDA #&10 ; CHEST &173e 8e 50 20 STX &2050 ; chest_x &1741 8c 51 20 STY &2051 ; chest_y &1744 20 2b 13 JSR &132b ; plot_scenery_sprite ; room_doesn't_have_chest ; plot_window &1747 a5 8b LDA &8b ; room_data_byte_four &1749 29 01 AND #&01 &174b f0 41 BEQ &178e ; room_doesn't_have_window &174d a5 88 LDA &88 ; room_data_byte_one &174f 29 01 AND #&01 # If the room has a top door on the left, &1751 d0 1f BNE &1772 ; room_doesn't_have_left_windows # then the room doesn't have windows on the left &1753 ae 3e 20 LDX &203e ; room_top_left_corner_x &1756 a0 18 LDY #&18 &1758 a9 08 LDA #&08 ; WINDOW &175a 20 2b 13 JSR &132b ; plot_scenery_sprite &175d ad 3e 20 LDA &203e ; room_top_left_corner_x &1760 18 CLC &1761 69 04 ADC #&04 &1763 aa TAX &1764 a9 08 LDA #&08 ; WINDOW &1766 a0 18 LDY #&18 &1768 20 2b 13 JSR &132b ; plot_scenery_sprite &176b ad 3d 20 LDA &203d ; offset_from_centre_to_right_of_top_wall &176e c9 09 CMP #&09 # If the room extends to the right, &1770 30 1c BMI &178e ; room_doesn't_have_window # then the room doesn't have windows on the right ; room_doesn't_have_left_windows &1772 ad 3f 20 LDA &203f ; room_top_right_corner_x &1775 38 SEC &1776 e9 08 SBC #&08 &1778 aa TAX &1779 a0 18 LDY #&18 &177b a9 08 LDA #&08 ; WINDOW &177d 20 2b 13 JSR &132b ; plot_scenery_sprite &1780 ad 3f 20 LDA &203f ; room_top_right_corner_x &1783 38 SEC &1784 e9 04 SBC #&04 &1786 aa TAX &1787 a0 18 LDY #&18 &1789 a9 08 LDA #&08 ; WINDOW &178b 20 2b 13 JSR &132b ; plot_scenery_sprite ; room_doesn't_have_window &178e a5 8b LDA &8b ; room_data_byte_four &1790 29 20 AND #&20 &1792 f0 15 BEQ &17a9 ; room_doesn't_have_row_of_windows &1794 a2 0c LDX #&0c ; plot_windows_loop &1796 8a TXA &1797 48 PHA &1798 a0 18 LDY #&18 &179a a9 08 LDA #&08 ; WINDOW &179c 20 2b 13 JSR &132b ; plot_scenery_sprite &179f 68 PLA &17a0 aa TAX &17a1 e8 INX &17a2 e8 INX &17a3 e8 INX &17a4 e8 INX &17a5 c9 18 CMP #&18 &17a7 d0 ed BNE &1796 ; plot_windows_loop ; room_doesn't_have_row_of_windows &17a9 a5 8b LDA &8b ; room_data_byte_four &17ab 29 04 AND #&04 &17ad f0 1a BEQ &17c9 ; plot_torches_on_side_walls &17af 4c 1b 09 JMP &091b ; place_trapdoor_or_teleport ; towards_room_contains_object &17b2 a5 89 LDA &89 ; room_data_byte_two &17b4 29 80 AND #&80 &17b6 d0 03 BNE &17bb ; room_still_has_object &17b8 4c 26 1a JMP &1a26 ; ? # Never called, would jump mid-instruction ; room_still_has_object &17bb 4c 48 1a JMP &1a48 ; room_contains_object ; update_object_and_demon_state &17be 20 04 35 JSR &3504 ; update_demon_state ; jmp_update_object_frame_instructions &17c1 4c 60 33 JMP &3360 ; start_game_on_leaving_entrance_room # actually JMP &0a56 ; update_object_frame # After the player has left the entrance room ; unused &17c4 00 00 00 00 00 ; plot_torches_on_side_walls &17c9 a5 8b LDA &8b ; room_data_byte_four &17cb 29 02 AND #&02 &17cd f0 49 BEQ &1818 ; leave &17cf ad 3d 20 LDA &203d ; offset_from_centre_to_right_of_top_wall &17d2 c9 09 CMP #&09 # If the room extends to the right, &17d4 10 1d BPL &17f3 ; no_torches_on_right # then the room doesn't have torches on the right &17d6 ae 3f 20 LDX &203f ; room_top_right_corner_x &17d9 a0 18 LDY #&18 &17db a9 09 LDA #&09 ; TORCH &17dd 20 2b 13 JSR &132b ; plot_scenery_sprite &17e0 ad 45 20 LDA &2045 ; room_end_x &17e3 38 SEC &17e4 e9 04 SBC #&04 &17e6 aa TAX &17e7 ad 47 20 LDA &2047 ; room_height &17ea 38 SEC &17eb e9 58 SBC #&58 &17ed a8 TAY &17ee a9 09 LDA #&09 ; TORCH &17f0 20 2b 13 JSR &132b ; plot_scenery_sprite ; no_torches_on_right &17f3 ad 3c 20 LDA &203c ; offset_from_centre_to_left_of_top_wall &17f6 c9 09 CMP #&09 # If the room extends to the left, &17f8 10 1e BPL &1818 ; no_torches_on_left # then the room doesn't have torches on the left &17fa ad 3e 20 LDA &203e ; room_top_left_corner_x &17fd 38 SEC &17fe e9 04 SBC #&04 &1800 aa TAX &1801 a0 18 LDY #&18 &1803 a9 25 LDA #&25 ; TORCH (flipped) &1805 20 2b 13 JSR &132b ; plot_scenery_sprite &1808 ad 46 20 LDA &2046 ; room_start_x &180b aa TAX &180c ad 47 20 LDA &2047 ; room_height &180f 38 SEC &1810 e9 58 SBC #&58 &1812 a8 TAY &1813 a9 25 LDA #&25 ; TORCH (flipped) &1815 20 2b 13 JSR &132b ; plot_scenery_sprite ; no_torches_on_left ; leave &1818 60 RTS ; calculate_room_size_and_properties &1819 a9 04 LDA #&04 &181b 8d 3c 20 STA &203c ; offset_from_centre_to_left_of_top_wall &181e 8d 3d 20 STA &203d ; offset_from_centre_to_right_of_top_wall &1821 a5 89 LDA &89 ; room_data_byte_two &1823 29 08 AND #&08 &1825 f0 12 BEQ &1839 ; narrow_room ; wide_room &1827 ad 3d 20 LDA &203d ; offset_from_centre_to_right_of_top_wall &182a 18 CLC &182b 69 04 ADC #&04 &182d 8d 3d 20 STA &203d ; offset_from_centre_to_right_of_top_wall &1830 ad 3c 20 LDA &203c ; offset_from_centre_to_left_of_top_wall &1833 18 CLC &1834 69 04 ADC #&04 &1836 8d 3c 20 STA &203c ; offset_from_centre_to_left_of_top_wall ; narrow_room &1839 a5 89 LDA &89 ; room_data_byte_two &183b 29 40 AND #&40 &183d f0 09 BEQ &1848 ; room_doesn't_extent_to_right ; room_extends_to_right &183f a9 10 LDA #&10 &1841 8d 3d 20 STA &203d ; offset_from_centre_to_right_of_top_wall &1844 ea NOP &1845 ea NOP &1846 ea NOP &1847 ea NOP ; room_doesn't_extent_to_right &1848 a5 89 LDA &89 ; room_data_byte_two &184a 29 20 AND #&20 &184c f0 09 BEQ &1857 ; room_doesn't_extent_to_left ; room_extends_to_left &184e a9 10 LDA #&10 &1850 8d 3c 20 STA &203c ; offset_from_centre_to_left_of_top_wall &1853 ea NOP &1854 ea NOP &1855 ea NOP &1856 ea NOP ; room_doesn't_extent_to_left &1857 a9 00 LDA #&00 &1859 8d 44 20 STA &2044 ; side_walls_are_double_width &185c a5 89 LDA &89 ; room_data_byte_two &185e 29 10 AND #&10 &1860 f0 05 BEQ &1867 ; short_room ; tall_room &1862 a9 ff LDA #&ff &1864 8d 44 20 STA &2044 ; side_walls_are_double_width ; short_room &1867 20 09 14 JSR &1409 ; plot_walls_doors_and_other_scenery &186a ad 3f 20 LDA &203f ; room_top_right_corner_x &186d 38 SEC &186e e9 03 SBC #&03 &1870 8d 3f 20 STA &203f ; room_top_right_corner_x &1873 a5 89 LDA &89 ; room_data_byte_two &1875 29 07 AND #&07 &1877 f0 2c BEQ &18a5 ; leave # Is there an enemy in this room? &1879 ea NOP &187a 38 SEC &187b e9 01 SBC #&01 &187d f0 0c BEQ &188b ; copy_enemy_zero_data &187f aa TAX &1880 a9 00 LDA #&00 ; calculate_enemy_data_offset_loop &1882 18 CLC &1883 69 0b ADC #&0b &1885 ca DEX &1886 d0 fa BNE &1882 ; calculate_enemy_data_offset_loop &1888 4c 8d 18 JMP &188d ; copy_enemy_data ; copy_enemy_zero_data &188b a9 00 LDA #&00 ; copy_enemy_data &188d aa TAX &188e a0 00 LDY #&00 ; copy_enemy_data_loop &1890 bd 3c 4b LDA &4b3c,X ; enemy_object_data &1893 99 8e 00 STA &008e,Y ; object_data &1896 e8 INX &1897 c8 INY &1898 c0 0a CPY #&0a &189a d0 f4 BNE &1890 ; copy_enemy_data_loop &189c bd 3c 4b LDA &4b3c,X ; enemy_object_data &189f 85 9b STA &9b ; enemy_energy_drain &18a1 a9 04 LDA #&04 &18a3 85 9a STA &9a ; object_height_from_above &18a5 60 RTS ; set_wall_sprites &18a6 a5 8b LDA &8b ; room_data_byte_four &18a8 29 c0 AND #&c0 &18aa c9 00 CMP #&00 &18ac d0 0a BNE &18b8 ; room_doesn't_have_regular_wall ; room_has_regular_wall &18ae a9 f0 LDA #&f0 &18b0 8d 6a 55 STA &556a ; scenery_sprite_01_data &18b3 a9 37 LDA #&37 ; &37f0 = scenery_sprite_01_regular &18b5 8d 6b 55 STA &556b ; scenery_sprite_01_data + 1 ; room_doesn't_have_regular_wall &18b8 a5 8b LDA &8b ; room_data_byte_four &18ba 29 c0 AND #&c0 &18bc c9 40 CMP #&40 &18be d0 0a BNE &18ca ; room_doesn't_have_vine_wall ; room_has_vine_wall &18c0 a9 58 LDA #&58 &18c2 8d 6a 55 STA &556a ; scenery_sprite_01_data &18c5 a9 44 LDA #&44 ; &4458 = scenery_sprite_01_vines &18c7 8d 6b 55 STA &556b ; scenery_sprite_01_data + 1 ; room_doesn't_have_vine_wall &18ca a5 8b LDA &8b ; room_data_byte_four &18cc 29 c0 AND #&c0 &18ce c9 80 CMP #&80 &18d0 d0 0a BNE &18dc ; room_doesn't_have_lion_wall ; room_has_lion_wall &18d2 a9 28 LDA #&28 &18d4 8d 6a 55 STA &556a ; scenery_sprite_01_data &18d7 a9 45 LDA #&45 ; &4528 = scenery_sprite_01_lion &18d9 8d 6b 55 STA &556b ; scenery_sprite_01_data + 1 ; room_doesn't_have_lion_wall &18dc a5 8b LDA &8b ; room_data_byte_four &18de 29 c0 AND #&c0 &18e0 c9 c0 CMP #&c0 &18e2 d0 0a BNE &18ee ; room_doesn't_have_stone_wall ; room_has_stone_wall &18e4 a9 89 LDA #&89 &18e6 8d 6a 55 STA &556a ; scenery_sprite_01_data &18e9 a9 4b LDA #&4b ; &4b89 scenery_sprite_01_stone &18eb 8d 6b 55 STA &556b ; scenery_sprite_01_data + 1 ; room_doesn't_have_stone_wall &18ee 20 8a 19 JSR &198a ; further_scenery_initialisation &18f1 ad 49 20 LDA &2049 ; top_door_y &18f4 f0 0c BEQ &1902 ; no_top_door &18f6 ee 48 20 INC &2048 ; top_door_x &18f9 ad 49 20 LDA &2049 ; top_door_y &18fc 18 CLC &18fd 69 10 ADC #&10 &18ff 8d 49 20 STA &2049 ; top_door_y ; no_top_door &1902 ad 4b 20 LDA &204b ; bottom_door_y &1905 f0 09 BEQ &1910 ; no_bottom_door &1907 ad 4b 20 LDA &204b ; bottom_door_y &190a 38 SEC &190b e9 18 SBC #&18 &190d 8d 4b 20 STA &204b ; bottom_door_y ; no_bottom_door &1910 ad 4d 20 LDA &204d ; right_door_y &1913 f0 0f BEQ &1924 ; no_right_door &1915 ad 4d 20 LDA &204d ; right_door_y &1918 18 CLC &1919 69 18 ADC #&18 &191b 8d 4d 20 STA &204d ; right_door_y &191e ce 4c 20 DEC &204c ; right_door_x &1921 ce 4c 20 DEC &204c ; right_door_x ; no_right_door &1924 ad 4f 20 LDA &204f ; left_door_y &1927 f0 0f BEQ &1938 ; no_left_door &1929 ea NOP &192a ea NOP &192b ea NOP &192c ee 4e 20 INC &204e ; left_door_x &192f ad 4f 20 LDA &204f ; left_door_y &1932 18 CLC &1933 69 1a ADC #&1a &1935 8d 4f 20 STA &204f ; left_door_y ; no_left_door &1938 ad 51 20 LDA &2051 ; chest_y &193b f0 09 BEQ &1946 ; no_chest &193d ad 51 20 LDA &2051 ; chest_y &1940 38 SEC &1941 e9 08 SBC #&08 &1943 8d 51 20 STA &2051 ; chest_y ; no_chest &1946 ad 55 20 LDA &2055 ; trapdoor_y &1949 f0 09 BEQ &1954 ; no_trapdoor &194b ad 55 20 LDA &2055 ; trapdoor_y &194e 38 SEC &194f e9 1a SBC #&1a &1951 8d 55 20 STA &2055 ; trapdoor_y ; no_trapdoor &1954 ad 53 20 LDA &2053 ; furniture_y &1957 f0 30 BEQ &1989 ; no_furniture &1959 a5 8a LDA &8a ; room_data_byte_three &195b 29 40 AND #&40 &195d f0 09 BEQ &1968 ; no_stone_dwarf &195f 20 e5 34 JSR &34e5 ; move_furniture_up &1962 ce 52 20 DEC &2052 ; furniture_x &1965 8d 53 20 STA &2053 ; furniture_y ; no_stone_dwarf &1968 a5 8a LDA &8a ; room_data_byte_three &196a 29 10 AND #&10 &196c f0 1b BEQ &1989 ; no_bookshelves &196e ad 53 20 LDA &2053 ; furniture_y &1971 18 CLC &1972 69 0a ADC #&0a &1974 8d 53 20 STA &2053 ; furniture_y &1977 a5 88 LDA &88 ; room_data_byte_one &1979 29 08 AND #&08 &197b d0 09 BNE &1986 ; has_right_bottom_door &197d ce 52 20 DEC &2052 ; furniture_x &1980 ce 52 20 DEC &2052 ; furniture_x &1983 4c 89 19 JMP &1989 ; leave ; has_right_bottom_door &1986 ee 52 20 INC &2052 ; furniture_x ; no_bookshelves ; no_furniture &1989 60 RTS ; further_scenery_initialisation &198a a5 8b LDA &8b ; room_data_byte_four &198c 29 c0 AND #&c0 &198e c9 40 CMP #&40 &1990 d0 1b BNE &19ad ; room_doesn't_have_vine_walls # Bug: branches mid-instruction, but still works. &1992 a2 8e LDX #&8e &1994 a0 52 LDY #&52 ; &528e = scenery_sprite_00_vines &1996 8e 66 55 STX &5566 ; scenery_sprite_00_data &1999 8c 67 55 STY &5567 ; scenery_sprite_00_data + 1 &199c a2 6e LDX #&6e ; &526e = scenery_sprite_03_vines &199e 8e 72 55 STX &5572 ; scenery_sprite_03_data &19a1 8c 73 55 STY &5573 ; scenery_sprite_03_data + 1 &19a4 a2 ce LDX #&ce ; &52ce = scenery_sprite_04_vines &19a6 8e 76 55 STX &5576 ; scenery_sprite_04_data &19a9 8c 77 55 STY &5577 ; scenery_sprite_04_data + 1 &19ac 4c c9 19 JMP &19c9 ; after_setting_side_wall_sprites ; room_doesn't_have_vine_walls #19ad CMP #&19 &19af a2 90 LDX #&90 &19b1 a0 39 LDY #&39 ; &3990 = scenery_sprite_00_regular &19b3 8e 66 55 STX &5566 ; scenery_sprite_00_data &19b6 8c 67 55 STY &5567 ; scenery_sprite_00_data + 1 &19b9 a2 70 LDX #&70 ; &3970 = scenery_sprite_03_regular &19bb 8e 72 55 STX &5572 ; scenery_sprite_03_data &19be 8c 73 55 STY &5573 ; scenery_sprite_03_data + 1 &19c1 a2 d0 LDX #&d0 ; &39d0 = scenery_sprite_04_regular &19c3 8e 76 55 STX &5576 ; scenery_sprite_04_data &19c6 8c 77 55 STY &5577 ; scenery_sprite_04_data + 1 ; after_setting_side_wall_sprites &19c9 20 19 18 JSR &1819 ; calculate_room_size_and_properties &19cc 20 60 22 JSR &2260 ; check_room_for_throne_and_pools &19cf a5 8b LDA &8b ; room_data_byte_four &19d1 29 c0 AND #&c0 &19d3 c9 40 CMP #&40 &19d5 f0 08 BEQ &19df ; to_plot_outdoor_scenery &19d7 a9 40 LDA #&40 &19d9 8d c2 1b STA &1bc2 ; room_top_limit &19dc 4c e2 19 JMP &19e2 ; leave ; to_plot_outdoor_scenery &19df 20 97 21 JSR &2197 ; plot_outdoor_scenery ; leave &19e2 60 RTS ; remove_object_from_room &19e3 20 6c 12 JSR &126c ; restore_screen_behind_object &19e6 a5 89 LDA &89 ; room_data_byte_two &19e8 29 7f AND #&7f &19ea 85 89 STA &89 ; room_data_byte_two &19ec a9 00 LDA #&00 &19ee 85 86 STA &86 ; object_x &19f0 85 87 STA &87 ; object_y &19f2 60 RTS ; kill_player &19f3 a9 40 LDA #&40 ; "YOU ARE DEAD" &19f5 20 38 25 JSR &2538 ; plot_text_string ; kill_player_without_text &19f8 20 85 48 JSR &4885 ; reset_inventory &19fb ea NOP &19fc ea NOP &19fd 4c 66 52 JMP &5266 ; play_death_sound_and_restart_game ; main_game_loop &1a00 a5 82 LDA &82 ; player_x &1a02 85 80 STA &80 ; previous_player_x &1a04 a5 83 LDA &83 ; player_y &1a06 85 81 STA &81 ; previous_player_y &1a08 20 be 17 JSR &17be ; update_object_and_demon_state &1a0b a9 00 LDA #&00 &1a0d 85 99 STA &99 ; direction_player_moved_into_object &1a0f ea NOP &1a10 a5 ec LDA &ec ; Internal key number of most recently pressed key &1a12 8d 39 35 STA &3539 ; keypress &1a15 c9 e1 CMP #&e1 ; Z # actually CMP key_left &1a17 f0 17 BEQ &1a30 ; left_pressed &1a19 c9 c2 CMP #&c2 ; X # actually CMP key_right &1a1b f0 16 BEQ &1a33 ; right_pressed &1a1d c9 b9 CMP #&c8 ; * # actually CMP key_up &1a1f f0 15 BEQ &1a36 ; up_pressed &1a21 c9 a9 CMP #&e8 ; ? # actually CMP key_down &1a23 f0 14 BEQ &1a39 ; down_pressed &1a25 4c e5 26 JMP &26e5 ; set_menu_active_to_zero_and_consider_keypress_for_function_keys ; continue_main_game_loop &1a28 20 ba 50 JSR &50ba ; check_if_demon_is_emerging &1a2b d0 1b BNE &1a48 ; room_contains_enemy &1a2d 4c 3f 1a JMP &1a3f ; check_if_room_contains_animated_object ; left_pressed &1a30 4c bb 1a JMP &1abb ; to_really_left_pressed ; right_pressed &1a33 4c d3 1a JMP &1ad3 ; to_really_right_pressed ; up_pressed &1a36 4c d8 0f JMP &0fd8 ; use_vertical_player_mask_then_on_upwards ; down_pressed &1a39 4c e5 0f JMP &0fe5 ; use_vertical_player_mask_then_on_downwards ; unused # Unused code &1a3c 4c 9e 1f JMP &1f9e ; check_for_collision_with_doors ; check_if_room_contains_animated_object &1a3f a5 8a LDA &8a ; room_data_byte_three &1a41 29 01 AND #&01 &1a43 d0 03 BNE &1a48 ; room_contains_animated_object &1a45 4c 00 1a JMP &1a00 ; main_game_loop ; room_contains_animated_object &1a48 a5 86 LDA &86 ; object_x &1a4a 85 84 STA &84 ; previous_object_x &1a4c a5 87 LDA &87 ; object_y &1a4e 85 85 STA &85 ; previous_object_y &1a50 4c b0 1c JMP &1cb0 ; check_for_deep_freeze ; to_update_enemy_frame_and_pool_bubbles &1a53 ea NOP &1a54 ea NOP &1a55 ea NOP &1a56 4c 2a 23 JMP &232a ; update_enemy_frame_and_pool_bubbles &1a59 ea NOP &1a5a ea NOP &1a5b ea NOP &1a5c ea NOP &1a5d ea NOP &1a5e ea NOP &1a5f ea NOP &1a60 ea NOP &1a61 ea NOP ; consider_enemy_move &1a62 20 ef 0a JSR &0aef ; check_for_collision_with_enemy &1a65 a5 86 LDA &86 ; object_x &1a67 c5 82 CMP &82 ; player_x &1a69 f0 0b BEQ &1a76 ; enemy_at_same_x_position &1a6b 90 06 BCC &1a73 ; enemy_left_of_player &1a6d 20 99 1a JSR &1a99 ; move_enemy_left ; enemy_right_of_player &1a70 4c 76 1a JMP &1a76 ; enemy_at_same_x_position ; enemy_left_of_player &1a73 20 aa 1a JSR &1aaa ; move_enemy_right ; enemy_at_same_x_position &1a76 a5 83 LDA &83 ; player_y &1a78 18 CLC &1a79 69 20 ADC #&20 &1a7b 85 70 STA &70 &1a7d a5 87 LDA &87 ; object_y &1a7f 18 CLC &1a80 65 90 ADC &90 ; object_height_from_below &1a82 c5 70 CMP &70 &1a84 f0 0d BEQ &1a93 ; enemy_at_same_y_position &1a86 90 07 BCC &1a8f ; enemy_above_player ; enemy_below_player &1a88 c6 87 DEC &87 ; object_y &1a8a c6 87 DEC &87 ; object_y &1a8c 4c 93 1a JMP &1a93 ; enemy_at_same_y_position ; enemy_above_player &1a8f e6 87 INC &87 ; object_y &1a91 e6 87 INC &87 ; object_y ; enemy_at_same_y_position ; finished_moving_enemy &1a93 20 eb 1b JSR &1beb ; update_player_and_object_on_screen &1a96 4c 00 1a JMP &1a00 ; main_game_loop ; move_enemy_left &1a99 c6 86 DEC &86 ; object_x &1a9b a5 8d LDA &8d ; object_is_flipped &1a9d d0 0a BNE &1aa9 ; leave &1a9f a9 01 LDA #&01 &1aa1 85 8d STA &8d ; object_is_flipped &1aa3 ea NOP &1aa4 ea NOP &1aa5 ea NOP &1aa6 20 21 1b JSR &1b21 ; flip_object_sprites ; leave &1aa9 60 RTS ; move_enemy_right &1aaa e6 86 INC &86 ; object_x &1aac a5 8d LDA &8d ; object_is_flipped &1aae f0 0a BEQ &1aba ; leave &1ab0 a9 00 LDA #&00 &1ab2 85 8d STA &8d ; object_is_flipped &1ab4 ea NOP &1ab5 ea NOP &1ab6 ea NOP &1ab7 20 21 1b JSR &1b21 ; flip_object_sprites ; leave &1aba 60 RTS ; to_really_left_pressed &1abb 4c eb 1c JMP &1ceb ; really_left_pressed &1abe ea NOP ; move_player_left &1abf c6 82 DEC &82 ; player_x &1ac1 20 eb 1a JSR &1aeb ; use_player_sideways_sprite_and_mask &1ac4 a5 8c LDA &8c ; player_horizontal_direction &1ac6 f0 08 BEQ &1ad0 ; already_facing_left &1ac8 c6 8c DEC &8c ; player_horizontal_direction &1aca 20 7a 4f JSR &4f7a ; flip_player_sideways_sprites_and_mask &1acd ea NOP &1ace ea NOP &1acf ea NOP ; already_facing_left &1ad0 4c a0 27 JMP &27a0 ; use_player_sideways_sprite_and_plot_change ; to_really_right_pressed &1ad3 4c 04 1d JMP &1d04 ; really_right_pressed &1ad6 ea NOP ; move_player_right &1ad7 e6 82 INC &82 ; player_x &1ad9 20 eb 1a JSR &1aeb ; use_player_sideways_sprite_and_mask &1adc a5 8c LDA &8c ; player_horizontal_direction &1ade d0 08 BNE &1ae8 ; already_facing_right &1ae0 e6 8c INC &8c ; player_horizontal_direction &1ae2 20 7a 4f JSR &4f7a ; flip_player_sideways_sprites_and_mask &1ae5 ea NOP &1ae6 ea NOP &1ae7 ea NOP ; already_facing_right &1ae8 4c a0 27 JMP &27a0 ; use_player_sideways_sprite_and_plot_change ; use_player_sideways_sprite_and_mask &1aeb 20 f2 0f JSR &0ff2 ; use_sideways_player_mask &1aee a9 00 LDA #&00 # actually LDA player_sprite_address_frame_low &1af0 8d c8 0f STA &0fc8 ; player_sprite_address_low &1af3 a9 30 LDA #&30 # actually LDA player_sprite_address_frame_high &1af5 8d cc 0f STA &0fcc ; player_sprite_address_high &1af8 60 RTS ; use_player_up_sprite_then_onwards &1af9 a9 60 LDA #&60 &1afb 8d c8 0f STA &0fc8 ; player_sprite_address_low &1afe a9 30 LDA #&30 ; &3060 = player_up_sprite &1b00 8d cc 0f STA &0fcc ; player_sprite_address_high &1b03 4c 42 1d JMP &1d42 ; check_if_player_is_moving_up_into_object ; move_player_up &1b06 c6 83 DEC &83 ; player_y &1b08 c6 83 DEC &83 ; player_y ; to_plot_any_change_in_player_position_up &1b0a 4c 2e 1b JMP &1b2e ; plot_any_change_in_player_position ; use_player_down_sprite_then_onwards &1b0d a9 c0 LDA #&c0 &1b0f 8d c8 0f STA &0fc8 ; player_sprite_address_low &1b12 a9 30 LDA #&30 ; &30c0 = player_down_sprite &1b14 8d cc 0f STA &0fcc ; player_sprite_address_high &1b17 4c 1d 1d JMP &1d1d ; check_if_player_is_moving_down_into_object ; move_player_down &1b1a e6 83 INC &83 ; player_y &1b1c e6 83 INC &83 ; player_y ; to_plot_any_change_in_player_position_down &1b1e 4c 2e 1b JMP &1b2e ; plot_any_change_in_player_position ; flip_object_sprites &1b21 20 de 12 JSR &12de ; use_object_frame_zero &1b24 20 c3 11 JSR &11c3 ; flip_sprite &1b27 20 ef 12 JSR &12ef ; use_object_frame_one &1b2a 20 c3 11 JSR &11c3 ; flip_sprite &1b2d 60 RTS ; plot_any_change_in_player_position &1b2e a5 89 LDA &89 ; room_data_byte_two &1b30 29 80 AND #&80 &1b32 d0 03 BNE &1b37 ; room_has_object &1b34 20 c5 12 JSR &12c5 ; plot_player_after_vsync_with_two_delays ; room_has_object &1b37 4c b2 17 JMP &17b2 ; towards_room_contains_object ; enemy_frame &1b3a 00 ; room_limit &1b3b 60 ; calculate_wall_slope &1b3c a5 83 LDA &83 ; player_y &1b3e 38 SEC &1b3f e9 40 SBC #&40 &1b41 ea NOP &1b42 4a LSR A &1b43 4a LSR A &1b44 8d 3b 1b STA &1b3b ; room_limit &1b47 60 RTS ; check_for_collision_with_left_hand_wall &1b48 20 3c 1b JSR &1b3c ; calculate_wall_slope &1b4b ad 3e 20 LDA &203e ; room_top_left_corner_x &1b4e 38 SEC &1b4f ed 3b 1b SBC &1b3b ; room_limit &1b52 8d 3b 1b STA &1b3b ; room_limit &1b55 a5 82 LDA &82 ; player_x &1b57 cd 3b 1b CMP &1b3b ; room_limit &1b5a f0 03 BEQ &1b5f ; player_has_hit_left_hand_wall &1b5c 4c bf 1a JMP &1abf ; move_player_left ; player_has_hit_left_hand_wall &1b5f 4c 59 35 JMP &3559 ; make_player_face_left_and_consider_doors ; check_for_collision_with_right_hand_wall &1b62 20 3c 1b JSR &1b3c ; calculate_wall_slope &1b65 ad 3f 20 LDA &203f ; room_top_right_corner_x &1b68 18 CLC &1b69 6d 3b 1b ADC &1b3b ; room_limit &1b6c 8d 3b 1b STA &1b3b ; room_limit &1b6f a5 82 LDA &82 ; player_x &1b71 cd 3b 1b CMP &1b3b ; room_limit &1b74 f0 03 BEQ &1b79 ; player_has_hit_right_hand_wall &1b76 4c d7 1a JMP &1ad7 ; move_player_right ; player_has_hit_right_hand_wall &1b79 4c 68 35 JMP &3568 ; make_player_face_right_and_consider_doors ; check_if_player_has_hit_bottom_edge_of_room &1b7c a5 89 LDA &89 ; room_data_byte_two &1b7e 29 10 AND #&10 &1b80 d0 05 BNE &1b87 ; tall_room ; short_room &1b82 a9 50 LDA #&50 &1b84 4c 89 1b JMP &1b89 ; set_room_limit ; tall_room &1b87 a9 60 LDA #&60 ; set_room_limit &1b89 8d 3b 1b STA &1b3b ; room_limit &1b8c a5 83 LDA &83 ; player_y &1b8e cd 3b 1b CMP &1b3b ; room_limit &1b91 f0 03 BEQ &1b96 ; player_has_hit_bottom_wall &1b93 4c 1a 1b JMP &1b1a ; move_player_down ; player_has_hit_bottom_wall &1b96 4c 9e 1f JMP &1f9e ; check_for_collision_with_doors ; check_if_player_has_hit_top_edge_of_room &1b99 20 3c 1b JSR &1b3c ; calculate_wall_slope &1b9c ad 3e 20 LDA &203e ; room_top_left_corner_x &1b9f 38 SEC &1ba0 ed 3b 1b SBC &1b3b ; room_limit &1ba3 8d 3b 1b STA &1b3b ; room_limit &1ba6 a5 82 LDA &82 ; player_x &1ba8 cd 3b 1b CMP &1b3b ; room_limit &1bab f0 1d BEQ &1bca ; player_has_hit_top_wall &1bad 20 3c 1b JSR &1b3c ; calculate_wall_slope &1bb0 ad 3f 20 LDA &203f ; room_top_right_corner_x &1bb3 18 CLC &1bb4 6d 3b 1b ADC &1b3b ; room_limit &1bb7 8d 3b 1b STA &1b3b ; room_limit &1bba a5 82 LDA &82 ; player_x &1bbc cd 3b 1b CMP &1b3b ; room_limit &1bbf f0 09 BEQ &1bca ; player_has_hit_top_wall &1bc1 a9 40 LDA #&40 # actually LDA room_top_limit &1bc3 c5 83 CMP &83 ; player_y &1bc5 f0 03 BEQ &1bca ; unable_to_move_up &1bc7 4c 06 1b JMP &1b06 ; move_player_up ; player_has_hit_top_wall &1bca 4c 9e 1f JMP &1f9e ; check_for_collision_with_doors ; room_data_address_low &1bcd 11 ; room_data_address_high &1bce 4f ; special_entry_position_x &1bcf 1f ; special_entry_position_y &1bd0 5a ; object_frame &1bd1 08 ; demon_state &1bd2 00 ; height_of_player_visible &1bd3 02 ; demon_initial_frame &1bd4 0f ; day_or_night &1bd5 01 &1bd6 ea NOP ; consider_plotting_bookshelves &1bd7 a5 8b LDA &8b ; room_data_byte_four &1bd9 29 c0 AND #&c0 &1bdb c9 40 CMP #&40 # Outside rooms do not contain bookshelves &1bdd f0 09 BEQ &1be8 ; room_doesn't_have_bookshelves &1bdf a5 8a LDA &8a ; room_data_byte_three &1be1 29 10 AND #&10 &1be3 f0 03 BEQ &1be8 ; room_doesn't_have_bookshelves &1be5 4c 21 16 JMP &1621 ; plot_bookshelves ; room_doesn't_have_bookshelves &1be8 4c 59 16 JMP &1659 ; plot_armour ; update_player_and_object_on_screen &1beb a5 89 LDA &89 ; room_data_byte_two &1bed 29 07 AND #&07 # Is there an enemy in the room? &1bef f0 7b BEQ &1c6c ; wait_for_vysnc_then_plot_player_and_object &1bf1 a5 98 LDA &98 ; spell_or_item_used &1bf3 c9 13 CMP #&13 ; DEEP FREEZE &1bf5 f0 75 BEQ &1c6c ; wait_for_vysnc_then_plot_player_and_object &1bf7 20 03 1c JSR &1c03 ; does_player_overlap_object_in_x &1bfa f0 03 BEQ &1bff ; to_unplot_and_replot_player_and_object &1bfc 4c 8f 4f JMP &4f8f ; plot_player_then_object_later ; to_unplot_and_replot_player_and_object &1bff 20 a0 12 JSR &12a0 ; unplot_and_replot_player_and_object &1c02 60 RTS ; does_player_overlap_object_in_x &1c03 a5 82 LDA &82 ; player_x &1c05 c5 86 CMP &86 ; object_x &1c07 f0 22 BEQ &1c2b ; leave_with_zero &1c09 30 12 BMI &1c1d ; player_is_left_of_object &1c0b a5 86 LDA &86 ; object_x &1c0d 18 CLC &1c0e 65 8e ADC &8e ; object_sprite_width &1c10 85 70 STA &70 ; object_end_x &1c12 a5 82 LDA &82 ; player_x &1c14 c5 70 CMP &70 ; object_end_x &1c16 30 13 BMI &1c2b ; leave_with_zero &1c18 f0 0e BEQ &1c28 ; leave_with_one &1c1a 4c 28 1c JMP &1c28 ; leave_with_one ; player_is_left_of_object &1c1d a5 82 LDA &82 ; player_x &1c1f 18 CLC &1c20 69 02 ADC #&02 &1c22 c5 86 CMP &86 ; object_x &1c24 f0 05 BEQ &1c2b ; leave_with_zero &1c26 10 03 BPL &1c2b ; leave_with_zero ; leave_with_one &1c28 a9 01 LDA #&01 &1c2a 60 RTS ; leave_with_zero &1c2b a9 00 LDA #&00 &1c2d 60 RTS ; unused_player_x_comparison_routine # Unused code &1c2e 25 15 AND &15 &1c30 a5 82 LDA &82 ; player_x &1c32 18 CLC &1c33 69 02 ADC #&02 &1c35 c5 86 CMP &86 ; object_x &1c37 f0 05 BEQ &1c3e ; leave_with_zero &1c39 10 03 BPL &1c3e ; leave_with_zero ; leave_with_one &1c3b a9 01 LDA #&01 &1c3d 60 RTS ; leave_with_zero &1c3e a9 00 LDA #&00 &1c40 60 RTS ; delay_for_11176_loops &1c41 a2 d4 LDX #&d4 &1c43 a0 02 LDY #&02 &1c45 c8 INY &1c46 d0 fd BNE &1c45 &1c48 e8 INX &1c49 d0 f8 BNE &1c43 &1c4b 60 RTS ; play_sound_and_drain_player_energy &1c4c a9 07 LDA #&07 ; bell &1c4e 20 ee ff JSR &ffee ; OSWRCH &1c51 a5 9c LDA &9c ; player_room &1c53 c9 c1 CMP #&c1 ; throne_room &1c55 f0 03 BEQ &1c5a ; player_is_in_throne_room &1c57 4c 06 0b JMP &0b06 ; drain_player_energy ; player_is_in_throne_room &1c5a 4c 17 0b JMP &0b17 ; drain_player_energy_from_zorn_magic &1c5d ea NOP ; unused &1c5e 00 00 00 ; delay_for_10836_loops &1c61 a2 d5 LDX #&d5 &1c63 a0 04 LDY #&04 &1c65 c8 INY &1c66 d0 fd BNE &1c65 &1c68 e8 INX &1c69 d0 f8 BNE &1c63 &1c6b 60 RTS ; wait_for_vysnc_then_plot_player_and_object &1c6c a9 13 LDA #&13 ; Wait for Vertical Retrace &1c6e 20 f4 ff JSR &fff4 ; OSBYTE &1c71 20 12 28 JSR &2812 ; variable_delay_depending_on_presence_of_enemy &1c74 20 04 12 JSR &1204 ; restore_screen_behind_player &1c77 20 1e 12 JSR &121e ; copy_screen_behind_player &1c7a 20 8e 1c JSR &1c8e ; check_if_object_is_in_front_of_player &1c7d f0 08 BEQ &1c87 ; object_is_in_front_of_player &1c7f ea NOP &1c80 20 5a 12 JSR &125a ; plot_object &1c83 20 f2 11 JSR &11f2 ; plot_player &1c86 60 RTS ; object_is_in_front_of_player &1c87 20 f2 11 JSR &11f2 ; plot_player &1c8a 20 5a 12 JSR &125a ; plot_object &1c8d 60 RTS ; check_if_object_is_in_front_of_player &1c8e a5 83 LDA &83 ; player_y &1c90 18 CLC &1c91 69 20 ADC #&20 &1c93 85 70 STA &70 ; tmp &1c95 a5 87 LDA &87 ; object_y &1c97 18 CLC &1c98 65 90 ADC &90 ; object_height_from_below &1c9a c5 70 CMP &70 ; tmp &1c9c 90 03 BCC &1ca1 ; leave_with_one ; leave_with_zero &1c9e a9 00 LDA #&00 &1ca0 60 RTS ; leave_with_one &1ca1 a9 01 LDA #&01 &1ca3 60 RTS ; check_if_deep_freeze_used_on_enemy &1ca4 a5 98 LDA &98 ; spell_or_item_used &1ca6 c9 13 CMP #&13 ; DEEP FREEZE &1ca8 f0 03 BEQ &1cad ; deep_freeze_used_on_enemy &1caa 4c 53 1a JMP &1a53 ; to_update_enemy_frame_and_pool_bubbles ; deep_freeze_used_on_enemy &1cad 4c 93 1a JMP &1a93 ; finished_moving_enemy ; check_for_deep_freeze &1cb0 a5 89 LDA &89 ; room_data_byte_two &1cb2 29 07 AND #&07 &1cb4 f0 03 BEQ &1cb9 ; no_enemy_in_room &1cb6 4c a4 1c JMP &1ca4 ; check_if_deep_freeze_used_on_enemy ; no_enemy_in_room &1cb9 4c 93 1a JMP &1a93 ; finished_moving_enemy ; delay_for_57344_loops &1cbc a2 20 LDX #&20 &1cbe a0 00 LDY #&00 &1cc0 c8 INY &1cc1 d0 fd BNE &1cc0 &1cc3 e8 INX &1cc4 d0 f8 BNE &1cbe &1cc6 60 RTS ; compare_player_with_object_height_from_above &1cc7 a5 90 LDA &90 ; object_height_from_below &1cc9 18 CLC &1cca 69 02 ADC #&02 &1ccc 85 70 STA &70 ; calculated_object_y &1cce a5 87 LDA &87 ; object_y &1cd0 18 CLC &1cd1 65 70 ADC &70 ; calculated_object_y &1cd3 38 SEC &1cd4 e9 22 SBC #&22 &1cd6 85 70 STA &70 ; tmp &1cd8 c5 83 CMP &83 ; player_y &1cda 30 0c BMI &1ce8 ; leave_with_one &1cdc a5 70 LDA &70 ; calculated_object_y &1cde 38 SEC &1cdf e5 9a SBC &9a ; object_height_from_above &1ce1 c5 83 CMP &83 ; player_y &1ce3 10 03 BPL &1ce8 ; leave_with_one ; leave_with_zero &1ce5 a9 00 LDA #&00 &1ce7 60 RTS ; leave_with_one &1ce8 a9 01 LDA #&01 &1cea 60 RTS ; really_left_pressed &1ceb a5 82 LDA &82 ; player_x &1ced 38 SEC &1cee e5 8e SBC &8e ; object_sprite_width &1cf0 c5 86 CMP &86 ; object_x &1cf2 d0 05 BNE &1cf9 ; player_hasn't_moved_left_into_object &1cf4 20 c7 1c JSR &1cc7 ; compare_player_with_object_height_from_above &1cf7 f0 03 BEQ &1cfc ; player_has_moved_left_into_object ; player_hasn't_moved_left_into_object &1cf9 4c 48 1b JMP &1b48 ; check_for_collision_with_left_hand_wall ; player_has_moved_left_into_object &1cfc a9 01 LDA #&01 &1cfe 85 99 STA &99 ; direction_player_moved_into_object &1d00 ea NOP &1d01 4c ca 27 JMP &27ca ; turn_player_left ; really_right_pressed &1d04 a5 82 LDA &82 ; player_x &1d06 18 CLC &1d07 69 03 ADC #&03 &1d09 c5 86 CMP &86 ; object_x &1d0b d0 05 BNE &1d12 ; player_hasn't_moved_right_into_object &1d0d 20 c7 1c JSR &1cc7 ; compare_player_with_object_height_from_above &1d10 f0 03 BEQ &1d15 ; player_has_moved_right_into_object ; player_hasn't_moved_right_into_object &1d12 4c 62 1b JMP &1b62 ; check_for_collision_with_right_hand_wall ; player_has_moved_right_into_object &1d15 a9 02 LDA #&02 &1d17 85 99 STA &99 ; direction_player_moved_into_object &1d19 ea NOP &1d1a 4c bb 27 JMP &27bb ; turn_player_right ; check_if_player_is_moving_down_into_object &1d1d a5 90 LDA &90 ; object_height_from_below &1d1f 18 CLC &1d20 69 02 ADC #&02 &1d22 85 70 STA &70 ; tmp &1d24 a5 87 LDA &87 ; object_y &1d26 18 CLC &1d27 65 70 ADC &70 ; tmp &1d29 38 SEC &1d2a e9 22 SBC #&22 &1d2c e5 9a SBC &9a ; object_height_from_above &1d2e c5 83 CMP &83 ; player_y &1d30 d0 05 BNE &1d37 ; player_doesn't_overlap_object_moving_down &1d32 20 03 1c JSR &1c03 ; does_player_overlap_object_in_x &1d35 f0 03 BEQ &1d3a ; player_does_overlap_object_moving_down ; player_doesn't_overlap_object_moving_down &1d37 4c 7c 1b JMP &1b7c ; check_if_player_has_hit_bottom_edge_of_room ; player_does_overlap_object_moving_down &1d3a a9 03 LDA #&03 &1d3c 85 99 STA &99 ; direction_player_moved_into_object &1d3e ea NOP &1d3f 4c 1e 1b JMP &1b1e ; to_plot_any_change_in_player_position_down ; check_if_player_is_moving_up_into_object &1d42 20 03 1c JSR &1c03 ; does_player_overlap_object_in_x &1d45 d0 13 BNE &1d5a ; player_doesn't_overlap_object_moving_up &1d47 a5 90 LDA &90 ; object_height_from_below &1d49 18 CLC &1d4a 69 02 ADC #&02 &1d4c 85 70 STA &70 &1d4e a5 87 LDA &87 ; object_y &1d50 18 CLC &1d51 65 70 ADC &70 &1d53 38 SEC &1d54 e9 20 SBC #&20 &1d56 c5 83 CMP &83 ; player_y &1d58 f0 03 BEQ &1d5d ; player_does_overlap_object_moving_up ; player_doesn't_overlap_object_moving_up &1d5a 4c 99 1b JMP &1b99 ; check_if_player_has_hit_top_edge_of_room ; player_does_overlap_object_moving_up &1d5d a9 04 LDA #&04 &1d5f 85 99 STA &99 ; direction_player_moved_into_object &1d61 ea NOP &1d62 4c 0a 1b JMP &1b0a ; to_plot_any_change_in_player_position_up ; plot_top_part_of_player &1d65 a5 82 LDA &82 ; player_x &1d67 85 70 STA &70 ; sprite_x &1d69 a5 83 LDA &83 ; player_y &1d6b 85 71 STA &71 ; sprite_y &1d6d 20 c8 10 JSR &10c8 ; calculate_screen_address &1d70 20 bf 0f JSR &0fbf ; use_player_sprite_with_mask &1d73 ad d3 1b LDA &1bd3 ; height_of_player_visible &1d76 85 75 STA &75 ; sprite_height &1d78 20 72 0f JSR &0f72 ; plot_masked_sprite &1d7b 60 RTS ; plot_top_of_player_after_vsync &1d7c a9 13 LDA #&13 ; Wait for Vertical Retrace &1d7e 20 f4 ff JSR &fff4 ; OSBYTE &1d81 20 04 12 JSR &1204 ; restore_screen_behind_player &1d84 a5 83 LDA &83 ; player_y &1d86 48 PHA &1d87 a5 81 LDA &81 ; previous_player_y &1d89 85 83 STA &83 ; player_y &1d8b 20 1e 12 JSR &121e ; copy_screen_behind_player &1d8e 68 PLA &1d8f 85 83 STA &83 ; player_y &1d91 20 65 1d JSR &1d65 ; plot_top_part_of_player &1d94 20 bc 1c JSR &1cbc ; delay_for_57344_loops &1d97 60 RTS ; plot_player_sinking_into_pool_right &1d98 a9 20 LDA #&20 &1d9a 8d d3 1b STA &1bd3 ; height_of_player_visible &1d9d a9 0a LDA #&0a ; plot_player_sinking_into_pool_right_loop &1d9f 48 PHA &1da0 20 7c 1d JSR &1d7c ; plot_top_of_player_after_vsync &1da3 ce d3 1b DEC &1bd3 ; height_of_player_visible &1da6 ce d3 1b DEC &1bd3 ; height_of_player_visible &1da9 ce d3 1b DEC &1bd3 ; height_of_player_visible &1dac a5 82 LDA &82 ; player_x &1dae 85 80 STA &80 ; previous_player_x &1db0 e6 82 INC &82 ; player_x &1db2 e6 83 INC &83 ; player_y &1db4 e6 83 INC &83 ; player_y &1db6 e6 83 INC &83 ; player_y &1db8 68 PLA &1db9 38 SEC &1dba e9 01 SBC #&01 &1dbc d0 e1 BNE &1d9f ; plot_player_sinking_into_pool_right_loop &1dbe 60 RTS ; plot_player_rising_out_of_pool_right &1dbf a9 02 LDA #&02 &1dc1 8d d3 1b STA &1bd3 ; height_of_player_visible &1dc4 a9 0b LDA #&0b ; plot_player_rising_out_of_pool_right_loop &1dc6 48 PHA &1dc7 20 7c 1d JSR &1d7c ; plot_top_of_player_after_vsync &1dca ee d3 1b INC &1bd3 ; height_of_player_visible &1dcd ee d3 1b INC &1bd3 ; height_of_player_visible &1dd0 ee d3 1b INC &1bd3 ; height_of_player_visible &1dd3 a5 82 LDA &82 ; player_x &1dd5 85 80 STA &80 ; previous_player_x &1dd7 e6 82 INC &82 ; player_x &1dd9 c6 83 DEC &83 ; player_y &1ddb c6 83 DEC &83 ; player_y &1ddd c6 83 DEC &83 ; player_y &1ddf 68 PLA &1de0 38 SEC &1de1 e9 01 SBC #&01 &1de3 d0 e1 BNE &1dc6 ; plot_player_rising_out_of_pool_right_loop &1de5 60 RTS ; move_one_row_of_text_area_up_a_pixel &1de6 a0 00 LDY #&00 &1de8 a2 13 LDX #&13 ; column_loop &1dea a5 70 LDA &70 ; screen_address_low &1dec 48 PHA &1ded a5 71 LDA &71 ; screen_address_high &1def 48 PHA &1df0 b1 70 LDA (&70),Y ; screen_address &1df2 48 PHA &1df3 a5 70 LDA &70 ; screen_address_low &1df5 29 07 AND #&07 &1df7 c9 00 CMP #&00 &1df9 f0 05 BEQ &1e00 &1dfb c6 70 DEC &70 ; screen_address_low &1dfd 4c 0d 1e JMP &1e0d &1e00 c6 71 DEC &71 ; screen_address_high &1e02 a5 70 LDA &70 ; screen_address_low &1e04 38 SEC &1e05 e9 39 SBC #&39 &1e07 b0 02 BCS &1e0b &1e09 c6 71 DEC &71 ; screen_address_high &1e0b 85 70 STA &70 ; screen_address_low &1e0d 68 PLA &1e0e 91 70 STA (&70),Y ; screen_address &1e10 68 PLA &1e11 85 71 STA &71 ; screen_address_high &1e13 68 PLA &1e14 85 70 STA &70 ; screen_address_low &1e16 18 CLC &1e17 69 08 ADC #&08 &1e19 90 02 BCC &1e1d &1e1b e6 71 INC &71 ; screen_address_high &1e1d 85 70 STA &70 ; screen_address_low &1e1f ca DEX &1e20 e0 00 CPX #&00 &1e22 d0 c6 BNE &1dea ; column_loop &1e24 60 RTS ; scroll_text_area_one_row &1e25 a9 50 LDA #&50 &1e27 85 70 STA &70 ; screen_address_low &1e29 a9 70 LDA #&70 &1e2b 85 71 STA &71 ; screen_address_high &1e2d a2 00 LDX #&00 ; row_loop &1e2f a5 70 LDA &70 ; screen_address_low &1e31 48 PHA &1e32 a5 71 LDA &71 ; screen_address_high &1e34 48 PHA &1e35 8a TXA &1e36 48 PHA &1e37 20 e6 1d JSR &1de6 ; move_one_row_of_text_area_up_a_pixel &1e3a 68 PLA &1e3b aa TAX &1e3c 68 PLA &1e3d 85 71 STA &71 ; screen_address_high &1e3f 68 PLA &1e40 85 70 STA &70 ; screen_address_low &1e42 29 07 AND #&07 &1e44 c9 07 CMP #&07 &1e46 f0 05 BEQ &1e4d &1e48 e6 70 INC &70 ; screen_address_low &1e4a 4c 5a 1e JMP &1e5a &1e4d e6 71 INC &71 ; screen_address_high &1e4f a5 70 LDA &70 ; screen_address_low &1e51 18 CLC &1e52 69 39 ADC #&39 &1e54 90 02 BCC &1e58 &1e56 e6 71 INC &71 ; screen_address_high &1e58 85 70 STA &70 ; screen_address_low &1e5a e8 INX &1e5b e0 21 CPX #&21 &1e5d d0 d0 BNE &1e2f ; row_loop &1e5f 60 RTS ; copy_room_data_into_zero_page &1e60 a9 00 LDA #&00 &1e62 a2 00 LDX #&00 ; remove_doors_loop &1e64 9d 48 20 STA &2048,X ; door_positions &1e67 e8 INX &1e68 e0 0e CPX #&0e &1e6a d0 f8 BNE &1e64 ; remove_doors_loop &1e6c a9 09 LDA #&09 &1e6e 8d cd 1b STA &1bcd ; room_data_address_low &1e71 a9 4c LDA #&4c ; &4c09 = room_data_table &1e73 8d ce 1b STA &1bce ; room_data_address_high &1e76 a5 9c LDA &9c ; player_room &1e78 0a ASL A &1e79 90 06 BCC &1e81 &1e7b ee ce 1b INC &1bce ; room_data_address_high &1e7e ee ce 1b INC &1bce ; room_data_address_high &1e81 0a ASL A &1e82 90 03 BCC &1e87 &1e84 ee ce 1b INC &1bce ; room_data_address_high &1e87 18 CLC &1e88 6d cd 1b ADC &1bcd ; room_data_address_low &1e8b 90 03 BCC &1e90 &1e8d ee ce 1b INC &1bce ; room_data_address_high &1e90 8d cd 1b STA &1bcd ; room_data_address_low &1e93 ad cd 1b LDA &1bcd ; room_data_address_low &1e96 85 70 STA &70 ; data_address_low &1e98 ad ce 1b LDA &1bce ; room_data_address_high &1e9b 85 71 STA &71 ; data_address_high &1e9d a0 00 LDY #&00 ; copy_room_data_loop &1e9f b1 70 LDA (&70),Y ; data_address &1ea1 99 88 00 STA &0088,Y ; room_data_bytes &1ea4 c8 INY &1ea5 c0 04 CPY #&04 &1ea7 d0 f6 BNE &1e9f ; copy_room_data_loop &1ea9 20 a6 18 JSR &18a6 ; set_wall_sprites &1eac 60 RTS ; set_polymorphic_plot_sprite_to_wipe_mode_and_wipe_screen &1ead a2 00 LDX #&00 ; set_polymorphic_plot_sprite_to_wipe_mode_loop &1eaf bd d1 1e LDA &1ed1,X ; polymorphic_plot_sprite_wipe_code &1eb2 9d 0c 10 STA &100c,X ; polymorphic_plot_sprite_instructions + 2 &1eb5 e8 INX &1eb6 e0 08 CPX #&08 &1eb8 d0 f5 BNE &1eaf ; set_polymorphic_plot_sprite_to_wipe_mode_loop &1eba a9 15 LDA #&15 # Wipe the left half of the screen &1ebc 85 70 STA &70 ; sprite_width &1ebe a9 6b LDA #&6b &1ec0 85 75 STA &75 ; sprite_height &1ec2 a9 d8 LDA #&d8 &1ec4 85 73 STA &73 ; screen_address_low &1ec6 a9 5b LDA #&5b ; &5bd8 = top left of room screen area &1ec8 85 74 STA &74 ; screen_address_high &1eca 20 00 10 JSR &1000 ; polymorphic_plot_sprite &1ecd 20 01 34 JSR &3401 ; wipe_right_part_of_screen # Then the right &1ed0 60 RTS ; polymorphic_plot_sprite_wipe_code &1ed1 a9 00 LDA #&00 &1ed3 a4 76 LDY &76 ; screen_offset &1ed5 ea NOP &1ed6 ea NOP &1ed7 ea NOP &1ed8 ea NOP ; plot_sinking_player &1ed9 a9 20 LDA #&20 &1edb 8d d3 1b STA &1bd3 ; height_of_player_visible &1ede a9 20 LDA #&20 ; plot_sinking_player_loop &1ee0 48 PHA &1ee1 20 f4 1e JSR &1ef4 ; replot_player_after_vsync &1ee4 ce d3 1b DEC &1bd3 ; height_of_player_visible &1ee7 a5 82 LDA &82 ; player_x &1ee9 85 80 STA &80 ; previous_player_x &1eeb e6 83 INC &83 ; player_y &1eed 68 PLA &1eee 38 SEC &1eef e9 01 SBC #&01 &1ef1 d0 ed BNE &1ee0 ; plot_sinking_player_loop &1ef3 60 RTS ; replot_player_after_vsync &1ef4 a9 13 LDA #&13 ; Wait for Vertical Retrace &1ef6 20 f4 ff JSR &fff4 ; OSBYTE &1ef9 20 04 12 JSR &1204 ; restore_screen_behind_player &1efc a5 83 LDA &83 ; player_y &1efe 48 PHA &1eff a5 81 LDA &81 ; previous_player_y &1f01 85 83 STA &83 ; player_y &1f03 20 1e 12 JSR &121e ; copy_screen_behind_player &1f06 68 PLA &1f07 85 83 STA &83 ; player_y &1f09 20 65 1d JSR &1d65 ; plot_top_part_of_player &1f0c 20 61 1c JSR &1c61 ; delay_for_10836_loops &1f0f 60 RTS ; player_collision_check &1f10 86 70 STX &70 ; sprite_x &1f12 84 71 STY &71 ; sprite_y &1f14 8a TXA &1f15 38 SEC &1f16 e9 01 SBC #&01 &1f18 aa TAX &1f19 98 TYA &1f1a 38 SEC &1f1b e9 07 SBC #&07 &1f1d a8 TAY &1f1e 8a TXA &1f1f c5 82 CMP &82 ; player_x &1f21 10 19 BPL &1f3c ; leave_with_zero &1f23 98 TYA &1f24 c5 83 CMP &83 ; player_y &1f26 10 14 BPL &1f3c ; leave_with_zero &1f28 8a TXA &1f29 18 CLC &1f2a 69 03 ADC #&03 &1f2c aa TAX &1f2d 98 TYA &1f2e 18 CLC &1f2f 69 0c ADC #&0c &1f31 a8 TAY &1f32 8a TXA &1f33 c5 82 CMP &82 ; player_x &1f35 30 05 BMI &1f3c ; leave_with_zero &1f37 98 TYA &1f38 c5 83 CMP &83 ; player_y &1f3a 10 03 BPL &1f3f ; leave_with_one ; leave_with_zero &1f3c a9 00 LDA #&00 &1f3e 60 RTS ; leave_with_one &1f3f a9 01 LDA #&01 &1f41 60 RTS ; play_sound_for_spell_casting &1f42 a9 01 LDA #&01 &1f44 8d e0 08 STA &08e0 ; envelope_3_byte_0 &1f47 a9 03 LDA #&03 &1f49 a2 65 LDX #&65 &1f4b a0 0f LDY #&0f &1f4d 20 7a 37 JSR &377a ; play_sound &1f50 60 RTS ; play_sound_for_mixing &1f51 a9 01 LDA #&01 &1f53 8d e0 08 STA &08e0 ; envelope_3_byte_0 &1f56 a9 03 LDA #&03 &1f58 a2 0a LDX #&0a &1f5a a0 08 LDY #&08 &1f5c 20 7a 37 JSR &377a ; play_sound &1f5f 60 RTS ; menu_active &1f60 00 ; return_address_from_list_inventory_low &1f61 00 ; return_address_from_list_inventory_high &1f62 00 ; plot_player_on_entry_to_room &1f63 a5 89 LDA &89 ; room_data_byte_two &1f65 29 80 AND #&80 &1f67 d0 0d BNE &1f76 ; room_has_object &1f69 a9 00 LDA #&00 &1f6b 85 86 STA &86 ; object_x &1f6d 85 87 STA &87 ; object_y &1f6f 20 1e 12 JSR &121e ; copy_screen_behind_player &1f72 20 f2 11 JSR &11f2 ; plot_player &1f75 60 RTS ; room_has_object &1f76 a5 89 LDA &89 ; room_data_byte_two &1f78 29 07 AND #&07 &1f7a f0 03 BEQ &1f7f ; no_enemy &1f7c 20 98 20 JSR &2098 ; initialise_enemy_position ; no_enemy &1f7f 20 86 12 JSR &1286 ; copy_screen_behind_object &1f82 20 1e 12 JSR &121e ; copy_screen_behind_player &1f85 20 f2 11 JSR &11f2 ; plot_player &1f88 20 5a 12 JSR &125a ; plot_object &1f8b 60 RTS ; use_special_entry_position &1f8c d0 0d BNE &1f9b ; leave_with_zero &1f8e ad cf 1b LDA &1bcf ; special_entry_position_x &1f91 85 82 STA &82 ; player_x &1f93 ad d0 1b LDA &1bd0 ; special_entry_position_y &1f96 85 83 STA &83 ; player_y &1f98 a9 01 LDA #&01 &1f9a 60 RTS ; leave_with_zero &1f9b a9 00 LDA #&00 &1f9d 60 RTS ; check_for_collision_with_doors &1f9e ad 48 20 LDA &2048 ; top_door_x &1fa1 f0 2b BEQ &1fce ; check_for_collision_with_bottom_door &1fa3 aa TAX &1fa4 ac 49 20 LDY &2049 ; top_door_y &1fa7 20 10 1f JSR &1f10 ; player_collision_check &1faa f0 22 BEQ &1fce ; check_for_collision_with_bottom_door ; to_check_for_death_door_then_move_up_a_room &1fac 20 00 2d JSR &2d00 ; check_for_death_door_then_move_up_a_room &1faf ea NOP &1fb0 ea NOP &1fb1 ea NOP &1fb2 ea NOP &1fb3 20 13 21 JSR &2113 ; plot_room_and_set_details &1fb6 ad 4a 20 LDA &204a ; bottom_door_x &1fb9 20 8c 1f JSR &1f8c ; use_special_entry_position &1fbc d0 0a BNE &1fc8 ; room_has_special_entry_position_top &1fbe ad 4a 20 LDA &204a ; bottom_door_x &1fc1 85 82 STA &82 ; player_x &1fc3 ad 4b 20 LDA &204b ; bottom_door_y &1fc6 85 83 STA &83 ; player_y ; room_has_special_entry_position_top &1fc8 20 63 1f JSR &1f63 ; plot_player_on_entry_to_room &1fcb 4c 00 1a JMP &1a00 ; main_game_loop ; check_for_collision_with_bottom_door &1fce ad 4a 20 LDA &204a ; bottom_door_x &1fd1 f0 2b BEQ &1ffe ; check_for_collision_with_right_door &1fd3 aa TAX &1fd4 ac 4b 20 LDY &204b ; bottom_door_y &1fd7 20 10 1f JSR &1f10 ; player_collision_check &1fda f0 22 BEQ &1ffe ; check_for_collision_with_right_door ; move_down_a_room &1fdc a5 9c LDA &9c ; player_room &1fde 38 SEC &1fdf e9 0d SBC #&0d &1fe1 85 9c STA &9c ; player_room &1fe3 20 13 21 JSR &2113 ; plot_room_and_set_details &1fe6 ad 48 20 LDA &2048 ; top_door_x &1fe9 20 8c 1f JSR &1f8c ; use_special_entry_position &1fec d0 0a BNE &1ff8 ; room_has_special_entry_position_bottom &1fee ad 48 20 LDA &2048 ; top_door_x &1ff1 85 82 STA &82 ; player_x &1ff3 ad 49 20 LDA &2049 ; top_door_y &1ff6 85 83 STA &83 ; player_y ; room_has_special_entry_position_bottom &1ff8 20 63 1f JSR &1f63 ; plot_player_on_entry_to_room &1ffb 4c 00 1a JMP &1a00 ; main_game_loop ; check_for_collision_with_right_door &1ffe ad 4c 20 LDA &204c ; right_door_x &2001 f0 55 BEQ &2058 ; check_for_collision_with_left_door &2003 aa TAX &2004 ac 4d 20 LDY &204d ; right_door_y &2007 20 10 1f JSR &1f10 ; player_collision_check &200a f0 4c BEQ &2058 ; check_for_collision_with_left_door ; move_right_a_room &200c a5 9c LDA &9c ; player_room &200e 18 CLC &200f 69 01 ADC #&01 &2011 85 9c STA &9c ; player_room &2013 20 13 21 JSR &2113 ; plot_room_and_set_details &2016 ad 4e 20 LDA &204e ; left_door_x &2019 20 8c 1f JSR &1f8c ; use_special_entry_position &201c d0 0d BNE &202b ; room_has_special_entry_position_right &201e ad 4e 20 LDA &204e ; left_door_x &2021 18 CLC &2022 69 01 ADC #&01 &2024 85 82 STA &82 ; player_x &2026 ad 4f 20 LDA &204f ; left_door_y &2029 85 83 STA &83 ; room_has_special_entry_position_right &202b 20 63 1f JSR &1f63 ; plot_player_on_entry_to_room &202e 4c 00 1a JMP &1a00 ; main_game_loop ; plot_room_and_player &2031 20 13 21 JSR &2113 ; plot_room_and_set_details &2034 20 63 1f JSR &1f63 ; plot_player_on_entry_to_room &2037 60 RTS ; unused_scenery_sprite_variable &2038 00 ; scenery_sprite_to_use &2039 09 ; scenery_sprite_x &203a 08 ; scenery_sprite_y &203b 28 ; offset_from_centre_to_left_of_top_wall &203c 04 ; offset_from_centre_to_right_of_top_wall &203d 04 ; room_top_left_corner_x &203e 10 ; room_top_right_corner_x &203f 15 ; whether_to_flip_side_wall &2040 01 ; x_position_of_side_wall &2041 08 ; y_position_of_side_wall &2042 28 ; side_wall_has_top &2043 01 ; side_walls_are_double_width &2044 ff ; room_end_x &2045 20 ; room_start_x &2046 08 ; room_height &2047 80 ; door_positions ; top_door_x &2048 00 ; top_door_y &2049 00 ; bottom_door_x &204a 00 ; bottom_door_y &204b 00 ; right_door_x &204c 00 ; right_door_y &204d 00 ; left_door_x &204e 00 ; left_door_y &204f 00 ; chest_x &2050 00 ; chest_y &2051 00 ; furniture_x &2052 1a ; furniture_y &2053 5a ; trapdoor_x &2054 ff ; trapdoor_y &2055 00 ; mushroom_collected &2056 00 ; unused &2057 00 ; check_for_collision_with_left_door &2058 ad 4e 20 LDA &204e ; left_door_x &205b f0 2b BEQ &2088 ; to_return_after_failure_to_collide_with_any_doors &205d aa TAX &205e ac 4f 20 LDY &204f ; left_door_y &2061 20 10 1f JSR &1f10 ; player_collision_check &2064 f0 22 BEQ &2088 ; to_return_after_failure_to_collide_with_any_doors ; move_left_a_room &2066 a5 9c LDA &9c ; player_room &2068 38 SEC &2069 e9 01 SBC #&01 &206b 85 9c STA &9c ; player_room &206d 20 13 21 JSR &2113 ; plot_room_and_set_details &2070 ad 4c 20 LDA &204c ; right_door_x &2073 20 8c 1f JSR &1f8c ; use_special_entry_position &2076 d0 0a BNE &2082 ; room_has_special_entry_position_left &2078 ad 4c 20 LDA &204c ; right_door_x &207b 85 82 STA &82 ; player_x &207d ad 4d 20 LDA &204d ; right_door_y &2080 85 83 STA &83 ; player_y ; room_has_special_entry_position_left &2082 20 63 1f JSR &1f63 ; plot_player_on_entry_to_room &2085 4c 00 1a JMP &1a00 ; main_game_loop ; to_return_after_failure_to_collide_with_any_doors &2088 4c 3a 35 JMP &353a ; return_after_failure_to_collide_with_any_doors ; mixed_ingredients &208b 13 01 06 00 00 01 ; unused &2091 00 00 00 00 00 0b 0b ; initialise_enemy_position &2098 a5 89 LDA &89 ; room_data_byte_two &209a 29 07 AND #&07 &209c f0 12 BEQ &20b0 ; no_enemy_in_room &209e a9 13 LDA #&13 &20a0 85 86 STA &86 ; object_x &20a2 85 84 STA &84 ; previous_object_x &20a4 a9 6c LDA #&6c &20a6 38 SEC &20a7 e5 90 SBC &90 ; object_height_from_below &20a9 85 87 STA &87 ; object_y &20ab 85 85 STA &85 ; previous_object_y &20ad 4c b3 20 JMP &20b3 ; leave ; no_enemy_in_room &20b0 60 RTS &20b1 00 BRK &20b2 00 BRK ; leave &20b3 60 RTS ; check_for_player_leaving_side_of_extended_room &20b4 a5 82 LDA &82 ; player_x &20b6 c9 04 CMP #&04 &20b8 f0 05 BEQ &20bf ; player_at_left_of_extended_room &20ba c9 21 CMP #&21 &20bc f0 1b BEQ &20d9 ; player_at_right_of_extended_room &20be 60 RTS ; player_at_left_of_extended_room &20bf a5 89 LDA &89 ; room_data_byte_two &20c1 29 20 AND #&20 &20c3 f0 13 BEQ &20d8 ; leave &20c5 a5 9c LDA &9c ; player_room &20c7 38 SEC &20c8 e9 01 SBC #&01 &20ca 85 9c STA &9c ; player_room &20cc 20 13 21 JSR &2113 ; plot_room_and_set_details &20cf a9 20 LDA #&20 &20d1 85 82 STA &82 ; player_x &20d3 85 80 STA &80 ; previous_player_x &20d5 20 63 1f JSR &1f63 ; plot_player_on_entry_to_room ; leave &20d8 60 RTS ; player_at_right_of_extended_room &20d9 a5 89 LDA &89 ; room_data_byte_two &20db 29 40 AND #&40 &20dd f0 13 BEQ &20f2 ; leave &20df a5 9c LDA &9c ; player_room &20e1 18 CLC &20e2 69 01 ADC #&01 &20e4 85 9c STA &9c ; player_room &20e6 20 13 21 JSR &2113 ; plot_room_and_set_details &20e9 a9 05 LDA #&05 &20eb 85 82 STA &82 ; player_x &20ed 85 80 STA &80 ; previous_player_x &20ef 20 63 1f JSR &1f63 ; plot_player_on_entry_to_room ; leave &20f2 60 RTS ; check_room_for_special_entry_position &20f3 a2 00 LDX #&00 ; check_room_for_special_entry_position_loop &20f5 bd d2 50 LDA &50d2,X ; special_entry_position_table &20f8 c5 9c CMP &9c ; player_room &20fa f0 08 BEQ &2104 ; room_has_special_entry_position &20fc e8 INX &20fd e8 INX &20fe e8 INX &20ff e0 12 CPX #&12 &2101 d0 f2 BNE &20f5 ; check_room_for_special_entry_position_loop &2103 60 RTS ; room_has_special_entry_position &2104 e8 INX &2105 bd d2 50 LDA &50d2,X ; special_entry_position &2108 8d cf 1b STA &1bcf ; special_entry_position_x &210b e8 INX &210c bd d2 50 LDA &50d2,X ; special_entry_position &210f 8d d0 1b STA &1bd0 ; special_entry_position_y &2112 60 RTS ; plot_room_and_set_details &2113 20 f3 20 JSR &20f3 ; check_room_for_special_entry_position &2116 a9 08 LDA #&08 # R8: Interlace and delay register &2118 8d 00 fe STA &fe00 # Write to video controller (register number) &211b ad 01 fe LDA &fe01 # Read from video controller (register value) &211e 09 30 ORA #&30 # Disable video output &2120 8d 01 fe STA &fe01 # Write to video controller (register value) &2123 20 23 29 JSR &2923 ; set_window_sprite_and_wipe_screen &2126 20 00 2f JSR &2f00 ; set_spell_enemy_and_mushroom_state &2129 20 1c 46 JSR &461c ; plot_room &212c a9 08 LDA #&08 # R8: Interlace and delay register &212e 8d 00 fe STA &fe00 # Write to video controller (register number) &2131 ad 01 fe LDA &fe01 # Read from video controller (register value) &2134 29 cf AND #&cf # Re-enable video output &2136 8d 01 fe STA &fe01 # Write to video controller (register value) &2139 ce 54 20 DEC &2054 ; trapdoor_x &213c 60 RTS ; look_pressed &213d ad 54 20 LDA &2054 ; trapdoor_x &2140 f0 37 BEQ &2179 ; to_check_for_collision_with_furniture &2142 aa TAX &2143 ac 55 20 LDY &2055 ; trapdoor_y &2146 ea NOP &2147 4c 50 36 JMP &3650 ; consider_trapdoor_and_teleport ; find_teleport_destination &214a ea NOP &214b a2 00 LDX #&00 ; find_teleport_destination_loop &214d bd e8 50 LDA &50e8,X ; teleport_destination_table &2150 c5 9c CMP &9c ; player_room &2152 f0 07 BEQ &215b ; found_teleport_destination &2154 e8 INX &2155 e8 INX &2156 e0 1a CPX #&1a &2158 d0 f3 BNE &214d ; find_teleport_destination_loop &215a 60 RTS ; found_teleport_destination &215b 8a TXA &215c 48 PHA &215d 4c 35 42 JMP &4235 ; activate_teleport_or_trapdoor &2160 ea NOP &2161 ea NOP &2162 ea NOP &2163 ea NOP &2164 ea NOP &2165 ea NOP &2166 ea NOP &2167 ea NOP &2168 ea NOP &2169 ea NOP &216a ea NOP ; teleport_player_to_destination_room &216b 68 PLA &216c aa TAX &216d e8 INX &216e bd e8 50 LDA &50e8,X ; teleport_destination_table &2171 85 9c STA &9c ; player_room &2173 20 31 20 JSR &2031 ; plot_room_and_player &2176 4c 00 1a JMP &1a00 ; main_game_loop ; to_check_for_collision_with_furniture &2179 4c 30 28 JMP &2830 ; check_for_collision_with_furniture ; teleport_player_to_destination_room_via_trapdoor &217c a2 00 LDX #&00 ; store_location_loop &217e b5 80 LDA &80,X ; previous_player_x &2180 48 PHA &2181 e8 INX &2182 e0 04 CPX #&04 &2184 d0 f8 BNE &217e ; store_location_loop &2186 20 d9 1e JSR &1ed9 ; plot_sinking_player &2189 a2 03 LDX #&03 ; restore_location_loop &218b 68 PLA &218c 95 80 STA &80,X ; previous_player_x &218e ca DEX &218f 10 fa BPL &218b ; restore_location_loop &2191 4c 6b 21 JMP &216b ; teleport_player_to_destination_room ; unused # Unused code &2194 4c 00 1a JMP &1a00 ; main_game_loop ; plot_outdoor_scenery &2197 a5 89 LDA &89 ; room_data_byte_two &2199 29 10 AND #&10 &219b f0 1b BEQ &21b8 ; no_leaves &219d a9 15 LDA #&15 ; LEAF &219f a2 14 LDX #&14 &21a1 a0 6e LDY #&6e &21a3 20 2b 13 JSR &132b ; plot_scenery_sprite &21a6 a9 15 LDA #&15 ; LEAF &21a8 a2 19 LDX #&19 &21aa a0 64 LDY #&64 &21ac 20 2b 13 JSR &132b ; plot_scenery_sprite &21af a9 15 LDA #&15 ; LEAF &21b1 a2 09 LDX #&09 &21b3 a0 72 LDY #&72 &21b5 20 2b 13 JSR &132b ; plot_scenery_sprite ; no_leaves &21b8 ae 3e 20 LDX &203e ; room_top_left_corner_x ; plot_undergrowth_loop &21bb 8a TXA &21bc 48 PHA &21bd a0 48 LDY #&48 &21bf a9 11 LDA #&11 ; UNDERGROWTH &21c1 20 2b 13 JSR &132b ; plot_scenery_sprite &21c4 68 PLA &21c5 aa TAX &21c6 e8 INX &21c7 e8 INX &21c8 e8 INX &21c9 e8 INX &21ca ec 3f 20 CPX &203f ; room_top_right_corner_x &21cd 30 ec BMI &21bb ; plot_undergrowth_loop &21cf a5 8a LDA &8a ; room_data_byte_three &21d1 29 10 AND #&10 &21d3 f0 7f BEQ &2254 ; room_doesn't_have_trees &21d5 ae 3e 20 LDX &203e ; room_top_left_corner_x ; plot_tree_bottom_loop &21d8 8a TXA &21d9 48 PHA &21da a0 30 LDY #&30 &21dc a9 13 LDA #&13 ; TREE BOTTOM &21de 20 2b 13 JSR &132b ; plot_scenery_sprite &21e1 68 PLA &21e2 aa TAX &21e3 e8 INX &21e4 e8 INX &21e5 e8 INX &21e6 e8 INX &21e7 ec 3f 20 CPX &203f ; room_top_right_corner_x &21ea 30 ec BMI &21d8 ; plot_tree_bottom_loop &21ec ae 3e 20 LDX &203e ; room_top_left_corner_x ; plot_tree_trunk_loop &21ef 8a TXA &21f0 48 PHA &21f1 a0 38 LDY #&38 &21f3 a9 17 LDA #&17 ; TREE TRUNK &21f5 20 2b 13 JSR &132b ; plot_scenery_sprite &21f8 68 PLA &21f9 18 CLC &21fa 69 08 ADC #&08 &21fc aa TAX &21fd ea NOP &21fe ec 3f 20 CPX &203f ; room_top_right_corner_x &2201 30 ec BMI &21ef ; plot_tree_trunk_loop &2203 a0 18 LDY #&18 ; plot_tree_body_vertical_loop &2205 ae 3e 20 LDX &203e ; room_top_left_corner_x ; plot_tree_body_loop &2208 98 TYA &2209 48 PHA &220a 8a TXA &220b 48 PHA &220c a9 12 LDA #&12 ; TREE BODY &220e 20 2b 13 JSR &132b ; plot_scenery_sprite &2211 68 PLA &2212 aa TAX &2213 e8 INX &2214 68 PLA &2215 a8 TAY &2216 ad 3f 20 LDA &203f ; room_top_right_corner_x &2219 18 CLC &221a 69 03 ADC #&03 &221c 85 70 STA &70 ; tmp &221e e4 70 CPX &70 ; tmp &2220 d0 e6 BNE &2208 ; plot_tree_body_loop &2222 98 TYA &2223 18 CLC &2224 69 08 ADC #&08 &2226 a8 TAY &2227 c0 38 CPY #&38 &2229 d0 da BNE &2205 ; plot_tree_body_vertical_loop &222b a5 89 LDA &89 ; room_data_byte_two &222d 29 40 AND #&40 &222f d0 0e BNE &223f ; room_extends_to_right &2231 ae 3f 20 LDX &203f ; room_top_right_corner_x &2234 e8 INX &2235 e8 INX &2236 e8 INX &2237 a0 18 LDY #&18 &2239 a9 14 LDA #&14 ; TREE LEFT &223b ea NOP &223c 20 2b 13 JSR &132b ; plot_scenery_sprite ; room_extends_to_right &223f a5 89 LDA &89 ; room_data_byte_two &2241 29 20 AND #&20 &2243 d0 0c BNE &2251 ; room_extends_to_left &2245 ae 3e 20 LDX &203e ; room_top_left_corner_x &2248 ca DEX &2249 ca DEX &224a a0 18 LDY #&18 &224c a9 1b LDA #&1b ; TREE RIGHT &224e 20 2b 13 JSR &132b ; plot_scenery_sprite ; room_extends_to_left &2251 4c 5a 22 JMP &225a ; room_does_have_trees ; room_doesn't_have_trees &2254 a9 40 LDA #&40 &2256 8d c2 1b STA &1bc2 ; room_top_limit &2259 60 RTS ; room_does_have_trees &225a a9 46 LDA #&46 &225c 8d c2 1b STA &1bc2 ; room_top_limit &225f 60 RTS ; check_room_for_throne_and_pools &2260 a5 9c LDA &9c ; player_room &2262 c9 c1 CMP #&c1 ; throne_room &2264 d0 11 BNE &2277 ; not_throne_room &2266 a2 08 LDX #&08 &2268 a0 50 LDY #&50 &226a a9 18 LDA #&18 ; ZORN &226c 20 2b 13 JSR &132b ; plot_scenery_sprite &226f a9 11 LDA #&11 &2271 8d 3e 20 STA &203e ; room_top_left_corner_x &2274 ea NOP &2275 ea NOP &2276 ea NOP ; not_throne_room &2277 a5 9c LDA &9c ; player_room &2279 c9 2b CMP #&2b ; left_end_of_first_pool_room &227b f0 04 BEQ &2281 ; room_has_left_pool &227d c9 ce CMP #&ce ; left_end_of_second_pool_room &227f d0 0d BNE &228e ; room_has_no_left_pool ; room_has_left_pool &2281 a2 13 LDX #&13 &2283 8e f7 53 STX &53f7 ; pool_start_position &2286 ee f7 53 INC &53f7 ; pool_start_position &2289 a9 16 LDA #&16 ; POOL SIDE &228b 20 c8 23 JSR &23c8 ; plot_pool ; room_has_no_left_pool &228e a5 9c LDA &9c ; player_room &2290 c9 2c CMP #&2c ; right_end_of_first_pool_room &2292 f0 04 BEQ &2298 ; room_has_right_pool &2294 c9 cf CMP #&cf ; right_end_of_second_pool_room &2296 d0 0d BNE &22a5 ; room_has_no_right_pool ; room_has_right_pool &2298 a2 04 LDX #&04 &229a 8e f7 53 STX &53f7 ; pool_start_position &229d a2 14 LDX #&14 &229f ea NOP &22a0 a9 32 LDA #&32 ; POOL SIDE (flipped) &22a2 20 c8 23 JSR &23c8 ; plot_pool ; room_has_no_right_pool &22a5 60 RTS ; plot_player_rising_out_of_pool_left &22a6 a9 02 LDA #&02 &22a8 8d d3 1b STA &1bd3 ; height_of_player_visible &22ab a9 0b LDA #&0b ; plot_player_rising_out_of_pool_left_loop &22ad 48 PHA &22ae 20 7c 1d JSR &1d7c ; plot_top_of_player_after_vsync &22b1 ee d3 1b INC &1bd3 ; height_of_player_visible &22b4 ee d3 1b INC &1bd3 ; height_of_player_visible &22b7 ee d3 1b INC &1bd3 ; height_of_player_visible &22ba a5 82 LDA &82 ; player_x &22bc 85 80 STA &80; previous_player_x &22be c6 82 DEC &82 ; player_x &22c0 c6 83 DEC &83 ; player_y &22c2 c6 83 DEC &83 ; player_y &22c4 c6 83 DEC &83 ; player_y &22c6 68 PLA &22c7 38 SEC &22c8 e9 01 SBC #&01 &22ca d0 e1 BNE &22ad ; plot_player_rising_out_of_pool_left_loop &22cc 60 RTS ; plot_player_sinking_into_pool_left &22cd a9 20 LDA #&20 &22cf 8d d3 1b STA &1bd3 ; height_of_player_visible &22d2 a9 0a LDA #&0a ; plot_player_sinking_into_pool_left_loop &22d4 48 PHA &22d5 20 7c 1d JSR &1d7c ; plot_top_of_player_after_vsync &22d8 ce d3 1b DEC &1bd3 ; height_of_player_visible &22db ce d3 1b DEC &1bd3 ; height_of_player_visible &22de ce d3 1b DEC &1bd3 ; height_of_player_visible &22e1 a5 82 LDA &82 ; player_x &22e3 85 80 STA &80; previous_player_x &22e5 c6 82 DEC &82 ; player_x &22e7 e6 83 INC &83 ; player_y &22e9 e6 83 INC &83 ; player_y &22eb e6 83 INC &83 ; player_y &22ed 68 PLA &22ee 38 SEC &22ef e9 01 SBC #&01 &22f1 d0 e1 BNE &22d4 ; plot_player_sinking_into_pool_left_loop &22f3 60 RTS ; random_number_within_range &22f4 86 70 STX &70 ; minimum &22f6 84 71 STY &71 ; maximum &22f8 a5 71 LDA &71 ; maximum &22fa 18 CLC &22fb e5 70 SBC &70 ; minimum &22fd 85 72 STA &72 ; range &22ff ad 40 02 LDA &0240 ; CFS timeout counter &2302 4d 9b 02 EOR &029b ; TIME value 2, low byte &2305 85 73 STA &73 ; random_number ; reduce_until_less_than_maximum &2307 a5 73 LDA &73 ; random_number &2309 c5 71 CMP &71 ; maximum &230b 90 0a BCC &2317 ; increase_until_more_than_minimum &230d a5 73 LDA &73 ; random_number &230f 38 SEC &2310 e5 72 SBC &72 ; range &2312 85 73 STA &73 ; random_number &2314 4c 07 23 JMP &2307 ; reduce_until_less_than_maximum ; increase_until_more_than_minimum &2317 a5 73 LDA &73 ; random_number &2319 c5 70 CMP &70 ; minimum &231b b0 0a BCS &2327 ; leave_with_random_number &231d a5 73 LDA &73 ; random_number &231f 18 CLC &2320 65 72 ADC &72 ; range &2322 85 73 STA &73 ; random_number &2324 4c 17 23 JMP &2317 ; increase_until_more_than_minimum ; leave_with_random_number &2327 a5 73 LDA &73 ; random_number &2329 60 RTS ; update_enemy_frame_and_pool_bubbles &232a a5 9c LDA &9c ; player_room &232c c9 2b CMP #&2b ; left_end_of_first_pool_room &232e f0 29 BEQ &2359 ; move_pool_bubbles_to_random_position &2330 c9 2c CMP #&2c ; right_end_of_first_pool_room &2332 f0 25 BEQ &2359 ; move_pool_bubbles_to_random_position &2334 c9 ce CMP #&ce ; left_end_of_second_pool_room &2336 f0 21 BEQ &2359 ; move_pool_bubbles_to_random_position &2338 c9 cf CMP #&cf ; right_end_of_second_pool_room &233a f0 1d BEQ &2359 ; move_pool_bubbles_to_random_position &233c ea NOP &233d ea NOP &233e ea NOP &233f ea NOP &2340 ea NOP &2341 ea NOP &2342 ea NOP &2343 ea NOP &2344 ad 3a 1b LDA &1b3a ; enemy_frame &2347 c9 01 CMP #&01 # actually CMP maximum_enemy_frame &2349 f0 06 BEQ &2351 ; reset_enemy_frame &234b ee 3a 1b INC &1b3a ; enemy_frame ; to_finished_moving_enemy &234e 4c 93 1a JMP &1a93 ; finished_moving_enemy ; reset_enemy_frame &2351 a9 00 LDA #&00 &2353 8d 3a 1b STA &1b3a ; enemy_frame &2356 4c 62 1a JMP &1a62 ; consider_enemy_move ; move_pool_bubbles_to_random_position &2359 ad d1 1b LDA &1bd1 ; object_frame &235c d0 f0 BNE &234e ; to_finished_moving_enemy &235e a2 60 LDX #&60 &2360 a0 6a LDY #&6a &2362 20 f4 22 JSR &22f4 ; random_number_within_range &2365 85 87 STA &87 ; object_y &2367 a5 9c LDA &9c ; player_room &2369 c9 2b CMP #&2b ; left_end_of_first_pool_room &236b f0 0b BEQ &2378 ; left_end_of_pool &236d c9 ce CMP #&ce ; left_end_of_second_pool_room &236f f0 07 BEQ &2378 ; left_end_of_pool &2371 ea NOP &2372 ea NOP &2373 ea NOP &2374 ea NOP &2375 4c 87 23 JMP &2387 ; right_end_of_pool ; left_end_of_pool &2378 a2 14 LDX #&14 &237a a0 1f LDY #&1f &237c 20 f4 22 JSR &22f4 ; random_number_within_range &237f 85 86 STA &86 ; object_x &2381 4c 93 1a JMP &1a93 ; finished_moving_enemy &2384 ea NOP &2385 ea NOP &2386 ea NOP ; right_end_of_pool &2387 a2 05 LDX #&05 &2389 a0 12 LDY #&12 &238b 20 f4 22 JSR &22f4 ; random_number_within_range &238e 85 86 STA &86 ; object_x &2390 4c 93 1a JMP &1a93 ; finished_moving_enemy &2393 ea NOP &2394 ea NOP &2395 ea NOP ; prepare_pool_bubbles &2396 a5 9c LDA &9c ; player_room &2398 c9 2b CMP #&2b ; left_end_of_first_pool_room &239a f0 0d BEQ &23a9 ; room_has_pool &239c c9 2c CMP #&2c ; right_end_of_first_pool_room &239e f0 09 BEQ &23a9 ; room_has_pool &23a0 c9 ce CMP #&ce ; left_end_of_second_pool_room &23a2 f0 05 BEQ &23a9 ; room_has_pool &23a4 c9 cf CMP #&cf ; right_end_of_second_pool_room &23a6 f0 01 BEQ &23a9 ; room_has_pool &23a8 60 RTS ; room_has_pool &23a9 a9 44 LDA #&44 &23ab 8d c2 1b STA &1bc2 ; room_top_limit &23ae 20 b2 4f JSR &4fb2 ; set_polymorphic_plot_sprite_to_overlay_mode &23b1 a2 00 LDX #&00 ; copy_pool_bubbles_object_data_loop &23b3 bd be 23 LDA &23be,X ; pool_bubbles_object_data &23b6 95 8e STA &8e,X ; object_data &23b8 e8 INX &23b9 e0 0a CPX #&0a &23bb d0 f6 BNE &23b3 ; copy_pool_bubbles_object_data_loop &23bd 60 RTS ; pool_bubbles_object_data ; w h bh fr-0 fr-1 addr cmp &23be 02 08 08 e9 4b f9 4b 51 02 0a ; plot_pool &23c8 a0 60 LDY #&60 &23ca 20 2b 13 JSR &132b ; plot_scenery_sprite &23cd ea NOP &23ce ae f7 53 LDX &53f7 ; pool_start_position &23d1 a0 00 LDY #&00 ; plot_pool_loop &23d3 98 TYA &23d4 48 PHA &23d5 8a TXA &23d6 48 PHA &23d7 a0 60 LDY #&60 &23d9 a9 1a LDA #&1a ; POOL &23db 20 2b 13 JSR &132b ; plot_scenery_sprite &23de 68 PLA &23df 18 CLC &23e0 69 04 ADC #&04 &23e2 aa TAX &23e3 68 PLA &23e4 a8 TAY &23e5 c8 INY &23e6 c0 04 CPY #&04 &23e8 d0 e9 BNE &23d3 ; plot_pool_loop &23ea 60 RTS ; walk_into_pool &23eb a5 82 LDA &82 ; player_x &23ed c9 12 CMP #&12 &23ef f0 08 BEQ &23f9 ; player_at_right_of_pool ; check_if_player_at_left_of_pool &23f1 c9 13 CMP #&13 &23f3 f0 7a BEQ &246f ; player_at_left_of_pool &23f5 ad d1 1b LDA &1bd1 ; object_frame &23f8 60 RTS ; player_at_right_of_pool &23f9 a5 9c LDA &9c ; player_room &23fb c9 2c CMP #&2c ; right_end_of_first_pool_room &23fd f0 0d BEQ &240c ; player_in_first_pool &23ff c9 cf CMP #&cf ; right_end_of_second_pool_room &2401 f0 0e BEQ &2411 ; player_in_second_pool &2403 a5 82 LDA &82 ; player_x &2405 4c f1 23 JMP &23f1 ; check_if_player_at_left_of_pool &2408 ea NOP &2409 ea NOP &240a ea NOP &240b ea NOP ; player_in_first_pool &240c a9 0f LDA #&0f ; AIR BUBBLE &240e 4c 13 24 JMP &2413 ; set_spell_required ; player_in_second_pool &2411 a9 10 LDA #&10 ; BODY BUBBLE ; set_spell_required &2413 8d f8 53 STA &53f8 ; spell_required_to_survive_pool &2416 20 cd 22 JSR &22cd ; plot_player_sinking_into_pool_left &2419 a5 98 LDA &98 ; spell_or_item_used &241b cd f8 53 CMP &53f8 ; spell_required_to_survive_pool &241e f0 03 BEQ &2423 ; player_survives_pool_left &2420 4c 60 2f JMP &2f60 ; drown_player ; player_survives_pool_left &2423 20 ea 33 JSR &33ea ; grab_black_pearl_in_second_pool &2426 ea NOP &2427 ea NOP &2428 a5 82 LDA &82 ; player_x &242a 18 CLC &242b 69 12 ADC #&12 &242d 85 82 STA &82 ; player_x &242f a5 80 LDA &80; previous_player_x &2431 18 CLC &2432 69 11 ADC #&11 &2434 85 80 STA &80; previous_player_x &2436 20 e5 24 JSR &24e5 ; copy_screen_above_player_initialise_and_plot_enemy &2439 20 a6 22 JSR &22a6 ; plot_player_rising_out_of_pool_left &243c e6 83 INC &83 ; player_y &243e e6 83 INC &83 ; player_y &2440 e6 83 INC &83 ; player_y &2442 60 RTS ; check_if_room_has_pool &2443 a5 9c LDA &9c ; player_room &2445 c9 2b CMP #&2b ; left_end_of_first_pool_room &2447 f0 0f BEQ &2458 ; leave_with_one &2449 c9 2c CMP #&2c ; right_end_of_first_pool_room &244b f0 0b BEQ &2458 ; leave_with_one &244d c9 ce CMP #&ce ; left_end_of_second_pool_room &244f f0 07 BEQ &2458 ; leave_with_one &2451 c9 cf CMP #&cf ; right_end_of_second_pool_room &2453 f0 03 BEQ &2458 ; leave_with_one &2455 a9 00 LDA #&00 &2457 60 RTS ; leave_with_one &2458 a9 01 LDA #&01 &245a 60 RTS ; check_for_walking_into_pool &245b 20 43 24 JSR &2443 ; check_if_room_has_pool &245e f0 03 BEQ &2463 ; no_pool &2460 20 eb 23 JSR &23eb ; walk_into_pool ; no_pool &2463 ee d1 1b INC &1bd1 ; object_frame &2466 60 RTS ; polymorphic_plot_sprite_invert_code &2467 a4 76 LDY &76 ; screen_offset &2469 b1 73 LDA (&73),Y ; screen_address &246b 49 ff EOR #&ff &246d ea NOP &246e ea NOP ; player_at_left_of_pool &246f a5 9c LDA &9c ; player_room &2471 c9 2b CMP #&2b ; left_end_of_first_pool_room &2473 f0 0d BEQ &2482 ; player_at_left_edge_of_first_pool &2475 c9 ce CMP #&ce ; left_end_of_second_pool_room &2477 f0 0e BEQ &2487 ; player_at_left_edge_of_second_pool &2479 60 RTS &247a ea NOP &247b ea NOP &247c ea NOP &247d ea NOP &247e ea NOP &247f ea NOP &2480 ea NOP &2481 ea NOP ; player_at_left_edge_of_first_pool &2482 a9 0f LDA #&0f ; AIR BUBBLE &2484 4c 89 24 JMP &2489 ; set_spell_required_to_survive_pool ; player_at_left_edge_of_second_pool &2487 a9 10 LDA #&10 ; BODY BUBBLE ; set_spell_required_to_survive_pool &2489 8d f8 53 STA &53f8 ; spell_required_to_survive_pool &248c 20 98 1d JSR &1d98 plot_player_sinking_into_pool_right &248f a5 98 LDA &98 ; spell_or_item_used &2491 cd f8 53 CMP &53f8 ; spell_required_to_survive_pool &2494 f0 03 BEQ &2499 ; player_survices_pool_right &2496 4c 60 2f JMP &2f60 ; drown_player ; player_survices_pool_right &2499 20 d5 33 JSR &33d5 ; grab_red_herring_in_first_pool &249c ea NOP &249d ea NOP &249e a5 82 LDA &82 ; player_x &24a0 38 SEC &24a1 e9 13 SBC #&13 &24a3 85 82 STA &82 ; player_x &24a5 a5 80 LDA &80; previous_player_x &24a7 38 SEC &24a8 e9 12 SBC #&12 &24aa 85 80 STA &80; previous_player_x &24ac 20 e5 24 JSR &24e5 ; copy_screen_above_player_initialise_and_plot_enemy &24af 20 bf 1d JSR &1dbf ; plot_player_rising_out_of_pool_right &24b2 e6 83 INC &83 ; player_y &24b4 e6 83 INC &83 ; player_y &24b6 e6 83 INC &83 ; player_y &24b8 60 RTS ; unused_routine_to_increment_object_frame_in_rooms_with_pool # Unused code &24b9 ea NOP &24ba ea NOP &24bb ea NOP &24bc ea NOP &24bd ea NOP &24be ea NOP &24bf ea NOP &24c0 a5 9c LDA &9c ; player_room &24c2 c9 2b CMP #&2b ; left_end_of_first_pool_room &24c4 f0 18 BEQ &24de ; room_has_pool &24c6 c9 2c CMP #&2c ; right_end_of_first_pool_room &24c8 f0 14 BEQ &24de ; room_has_pool &24ca c9 ce CMP #&ce ; left_end_of_second_pool_room &24cc f0 10 BEQ &24de ; room_has_pool &24ce c9 cf CMP #&cf ; right_end_of_second_pool_room &24d0 f0 0c BEQ &24de ; room_has_pool &24d2 ea NOP &24d3 ea NOP &24d4 ea NOP &24d5 ea NOP &24d6 ea NOP &24d7 ea NOP &24d8 ea NOP &24d9 ea NOP &24da ee d1 1b INC &1bd1 ; object_frame &24dd 60 RTS ; room_has_pool &24de 20 eb 23 JSR &23eb ; walk_into_pool &24e1 ee d1 1b INC &1bd1 ; object_frame &24e4 60 RTS ; copy_screen_above_player_initialise_and_plot_enemy &24e5 20 f2 24 JSR &24f2 ; copy_screen_above_player &24e8 20 98 20 JSR &2098 ; initialise_enemy_position &24eb 20 86 12 JSR &1286 ; copy_screen_behind_object &24ee 20 5a 12 JSR &125a ; plot_object &24f1 60 RTS ; copy_screen_above_player &24f2 a5 83 LDA &83 ; player_y &24f4 38 SEC &24f5 e9 1e SBC #&1e &24f7 85 83 STA &83 ; player_y &24f9 20 1e 12 JSR &121e ; copy_screen_behind_player &24fc a5 83 LDA &83 ; player_y &24fe 18 CLC &24ff 69 1e ADC #&1e &2501 85 83 STA &83 ; player_y &2503 60 RTS ; calculate_text_address &2504 8d f9 53 STA &53f9 ; text_id &2507 a9 40 LDA #&40 &2509 85 7e STA &7e ; text_address_low &250b a9 77 LDA #&77 ; &7740 = text_strings &250d 85 7f STA &7f ; text_address_high &250f a2 00 LDX #&00 ; find_text_loop &2511 ec f9 53 CPX &53f9 ; text_id &2514 f0 21 BEQ &2537 ; leave ; skip_to_end_of_string_loop &2516 a5 7e LDA &7e ; text_address_low &2518 18 CLC &2519 69 01 ADC #&01 &251b 90 02 BCC &251f &251d e6 7f INC &7f ; text_address_high &251f 85 7e STA &7e ; text_address_low &2521 a0 00 LDY #&00 &2523 b1 7e LDA (&7e),Y ; text_address &2525 d0 04 BNE &252b ; next_byte &2527 e8 INX &2528 4c ce 34 JMP &34ce ; consider_moving_to_second_block_of_text_strings ; next_byte &252b a5 7e LDA &7e ; text_address_low &252d c9 20 CMP #&20 &252f d0 e5 BNE &2516 ; skip_to_end_of_string_loop &2531 a5 7f LDA &7f ; text_address_high &2533 c9 27 CMP #&27 ; &2720 = ? # Bug: doesn't usefully catch anything &2535 d0 df BNE &2516 ; skip_to_end_of_string_loop &2537 60 RTS ; plot_text_string &2538 20 04 25 JSR &2504 ; calculate_text_address ; plot_text_string_loop &253b e6 7e INC &7e ; text_address_low &253d d0 02 BNE &2541 &253f e6 7f INC &7f ; text_address_high &2541 a0 00 LDY #&00 &2543 b1 7e LDA (&7e),Y ; text_address &2545 f0 06 BEQ &254d ; end_of_string &2547 20 53 25 JSR &2553 ; plot_character &254a 4c 3b 25 JMP &253b ; plot_text_string_loop ; end_of_string &254d ad f9 53 LDA &53f9 ; text_id &2550 4c ea 27 JMP &27ea ; plot_magical_star_after_spell_names ; plot_character &2553 8d fa 53 STA &53fa ; text_character &2556 a9 1f LDA #&1f &2558 cd fa 53 CMP &53fa ; text_character &255b b0 07 BCS &2564 ; is_control_character &255d ad fa 53 LDA &53fa ; text_character &2560 20 ee ff JSR &ffee ; OSWRCH &2563 60 RTS ; is_control_character &2564 ad fa 53 LDA &53fa ; text_character ; plot_control_character_01 # Control character &01 scrolls text area up eight rows &2567 c9 01 CMP #&01 &2569 d0 0d BNE &2578 ; plot_control_character_02 &256b a9 08 LDA #&08 ; scroll_text_area_loop &256d 48 PHA &256e 20 25 1e JSR &1e25 ; scroll_text_area_one_row &2571 68 PLA &2572 38 SEC &2573 e9 01 SBC #&01 &2575 d0 f6 BNE &256d ; scroll_text_area_loop &2577 60 RTS ; plot_control_character_02 # Control character &02 moves text cursor to (0, 3) &2578 c9 02 CMP #&02 &257a d0 10 BNE &258c ; plot_control_character_03 &257c a9 1f LDA #&1f &257e 20 ee ff JSR &ffee ; OSWRCH &2581 a9 00 LDA #&00 &2583 20 ee ff JSR &ffee ; OSWRCH &2586 a9 03 LDA #&03 &2588 20 ee ff JSR &ffee ; OSWRCH &258b 60 RTS ; plot_control_character_03 # Control character &03 waits for a keypress &258c c9 03 CMP #&03 &258e d0 07 BNE &2597 ; plot_control_character_04 ; wait_for_keypress &2590 a5 ec LDA &ec ; Internal key number of most recently pressed key &2592 f0 fc BEQ &2590 ; wait_for_keypress &2594 ea NOP &2595 ea NOP &2596 60 RTS ; plot_control_character_04 # Control character &04 asks for input from player &2597 c9 04 CMP #&04 &2599 d0 27 BNE &25c2 ; to_plot_control_character_0d &259b a0 00 LDY #&00 ; read_character &259d 20 e0 ff JSR &ffe0 ; OSRDCH # Read a character from the keyboard &25a0 c9 7f CMP #&7f &25a2 d0 0a BNE &25ae ; not_delete &25a4 c0 00 CPY #&00 &25a6 f0 f5 BEQ &259d ; read_character # Ignore DELETE if nothing has been pressed yet &25a8 88 DEY &25a9 a9 7f LDA #&7f ; not_delete &25ab 20 ee ff JSR &ffee ; OSWRCH &25ae c9 0d CMP #&0d &25b0 f0 13 BEQ &25c5 ; return_pressed # Stop when RETURN is pressed &25b2 c9 20 CMP #&20 &25b4 90 e7 BCC &259d ; read_character # Ignore control characters &25b6 c9 7c CMP #&7c &25b8 b0 e3 BCS &259d ; read_character # and top bit set characters &25ba 4c fd 27 JMP &27fd ; convert_to_upper_case &25bd 00 BRK &25be 00 BRK &25bf 00 BRK &25c0 00 BRK &25c1 00 BRK ; to_plot_control_character_0d &25c2 4c 2b 26 JMP &262b ; plot_control_character_0d ; return_pressed &25c5 98 TYA &25c6 aa TAX &25c7 86 7d STX &7d ; input_buffer_length &25c9 ea NOP &25ca ea NOP &25cb ea NOP &25cc ea NOP &25cd ea NOP &25ce ea NOP &25cf ea NOP &25d0 ea NOP &25d1 ea NOP &25d2 ea NOP &25d3 ea NOP ; compare_input_buffer_loop &25d4 b1 7e LDA (&7e),Y ; text_address &25d6 dd 53 2d CMP &2d53,X ; input_buffer - 1 &25d9 d0 09 BNE &25e4 ; failed_match &25db ca DEX &25dc 88 DEY &25dd f0 f5 BEQ &25d4 ; compare_input_buffer_loop # Bug: should be BNE &25df a9 01 LDA #&01 # Any three or four letter word ending in S matches, &25e1 4c e6 25 JMP &25e6 ; successful_match # as does any two letter word ending in A. ; failed_match &25e4 a9 00 LDA #&00 ; successful_match &25e6 8d fb 53 STA &53fb ; input_matches_text ; skip_subsequent_text_loop &25e9 a5 7e LDA &7e ; text_address_low &25eb 18 CLC &25ec 69 01 ADC #&01 &25ee 90 02 BCC &25f2 &25f0 e6 7f INC &7f ; text_address_high &25f2 85 7e STA &7e ; text_address_low &25f4 a0 00 LDY #&00 &25f6 b1 7e LDA (&7e),Y ; text_address &25f8 c9 05 CMP #&05 &25fa d0 ed BNE &25e9 ; skip_subsequent_text_loop &25fc ad fb 53 LDA &53fb ; input_matches_text &25ff d0 19 BNE &261a ; input_matched_text &2601 a5 7e LDA &7e ; text_address_low # If the input didn't match the text, skip some &2603 18 CLC &2604 69 01 ADC #&01 &2606 90 02 BCC &260a &2608 e6 7f INC &7f ; text_address_high &260a 85 7e STA &7e ; text_address_low &260c a0 00 LDY #&00 &260e a5 7e LDA &7e ; text_address_low &2610 18 CLC &2611 71 7e ADC (&7e),Y ; text_address &2613 90 02 BCC &2617 &2615 e6 7f INC &7f ; text_address_high &2617 85 7e STA &7e ; text_address_low &2619 60 RTS ; input_matched_text &261a a5 7e LDA &7e ; text_address_low # If the input did match the text, skip a single byte &261c 18 CLC # (note this routine doesn't use increment_text_address) &261d 69 01 ADC #&01 &261f 90 02 BCC &2623 &2621 e6 7f INC &7f ; text_address_high &2623 85 7e STA &7e ; text_address_low &2625 60 RTS ; unused # Unused code? &2626 ac 25 08 LDY &0825 ; ? &2629 20 80 JSR &c980 ; ? ; plot_control_character_0d # Control character &0d plots a newline &262b c9 0d CMP #&0d &262d d0 17 BNE &2646 ; plot_control_character_06 &262f a9 01 LDA #&01 &2631 20 53 25 JSR &2553 ; plot_character # by scrolling text window up eight rows &2634 a9 02 LDA #&02 &2636 20 53 25 JSR &2553 ; plot_character # and repositioning cursor &2639 60 RTS ; increment_text_address &263a a5 7e LDA &7e ; text_address_low &263c 18 CLC &263d 69 01 ADC #&01 &263f 90 02 BCC &2643 &2641 e6 7f INC &7f ; text_address_high &2643 85 7e STA &7e ; text_address_low &2645 60 RTS ; plot_control_character_06 # Control character &06 sets a byte of memory &2646 c9 06 CMP #&06 &2648 d0 7b BNE &26c5 ; to_plot_control_character_0b &264a 20 3a 26 JSR &263a ; increment_text_address # It takes three further bytes &264d a0 00 LDY #&00 &264f b1 7e LDA (&7e),Y ; text_address &2651 85 70 STA &70 ; write_address_low # Two for an address to write to (low, high) &2653 20 3a 26 JSR &263a ; increment_text_address &2656 b1 7e LDA (&7e),Y ; text_address &2658 85 71 STA &71 ; write_address_high &265a 20 3a 26 JSR &263a ; increment_text_address &265d b1 7e LDA (&7e),Y ; text_address # And a third for the byte to write to that address &265f 91 70 STA (&70),Y ; write_address &2661 60 RTS ; unused_routine_to_change_break_message # Unused code, which doesn't work as intended. &2662 a2 00 LDX #&00 # Set &0287 = &4b (JMP) and &267b = &00 ; copy_zero_page_routine_loop # for a brief display of the intended message. &2664 bd 82 26 LDA &2682,X ; zero_page_routine &2667 95 40 STA &40,X &2669 e8 INX &266a e0 41 CPX #&41 &266c d0 f6 BNE &2664 ; copy_zero_page_routine_loop &266e a9 40 LDA #&40 &2670 8d 88 02 STA &0288 ; break_intercept_vector_low # Bug: break intercept code doesn't have JMP prior &2673 a9 00 LDA #&00 &2675 8d 89 02 STA &0289 ; break_intercept_vector_high &2678 a9 c8 LDA #&c8 ; Read/Write BREAK/ESCAPE effect &267a a2 02 LDX #&02 ; Memory cleared on next reset, Escape disabled &267c 20 f4 ff JSR &fff4 ; OSBYTE # This wipes memory on reset, including this routine &267f 4c cd d9 JMP &d9cd ; OS reset (break) entry point # Reset system ; zero_page_routine &2682 &0040 a2 00 LDX #&00 ; zero_page_routine_loop &2684 &0042 b5 4d LDA &4d,X ; eored_characters &2686 &0044 20 7b 00 JSR &007b ; write_eored_character &2689 &0047 e8 INX &268a &0048 e0 2e CPX #&2e &268c &004a d0 f6 BNE &2684 ; zero_page_routine_loop &268e &004c 60 RTS ; eored_characters &268f &004d 45 54 73 73 73 73 73 73 00 03 16 1f 1f 11 1a 1d ; CLS, BELL, " SPELLBINDER\r\nBY DAN & ETAN SHIRRON!!\r\n" &269f &005d 17 16 01 5e 59 11 0a 73 17 12 1d 73 75 73 16 07 &26af &006d 12 1d 73 00 1b 1a 01 01 1c 1d 72 72 5e 59 ; write_eored_character &26bd &007b 49 53 EOF #&53 &26bf &007d 20 ee ff JSR &ffee ; OSWRCH &26c2 &007e 60 RTS ; unused &26c3 4f 52 ; "OR" ; to_plot_control_character_0b &26c5 4c 66 0b JMP &0b66 ; plot_control_character_0b ; restart_game_if_shift_pressed &26c8 a9 81 LDA #&81 ; Scan for a particular key &26ca a2 ff LDX #&ff ; SHIFT &26cc a0 ff LDY #&ff &26ce 20 f4 ff JSR &fff4 ; OSBYTE &26d1 e0 ff CPX #&ff &26d3 f0 03 BEQ &26d8 ; to_kill_player ; to_continue_main_game_loop &26d5 4c 28 1a JMP &1a28 ; continue_main_game_loop ; to_kill_player &26d8 4c f3 19 JMP &19f3 ; kill_player ; function_key_handling &26db c9 a0 CMP #&a0 ; f0 &26dd f0 03 BEQ &26e2 ; to_uninvert_icon_and_return_to_game &26df 4c 77 35 JMP &3577 ; more_function_key_handling ; to_uninvert_icon_and_return_to_game &26e2 4c 38 36 JMP &3638 ; uninvert_icon_and_return_to_game ; set_menu_active_to_zero_and_consider_keypress_for_function_keys &26e5 a9 00 LDA #&00 &26e7 8d 60 1f STA &1f60 ; menu_active &26ea 4c 1a 27 JMP &271a ; consider_keypress_for_function_keys ; consider_down_and_enter_if_listing_inventory &26ed c9 01 CMP #&01 &26ef f0 03 BEQ &26f4 ; to_restore_caller_of_list_inventory_to_stack_and_consider_down_and_enter &26f1 4c 5b 2b JMP &2b5b ; consider_keys_in_mix_routine ; to_restore_caller_of_list_inventory_to_stack_and_consider_down_and_enter &26f4 4c 0f 27 JMP &270f ; restore_caller_of_list_inventory_to_stack_and_consider_down_and_enter ; set_menu_active_to_two_and_consider_keypress_for_function_keys &26f7 a9 02 LDA #&02 &26f9 8d 60 1f STA &1f60 ; menu_active &26fc 4c df 27 JMP &27df ; consider_keypress_in_70_for_function_keys ; remove_caller_of_list_inventory_from_stack_and_consider_function_keys &26ff a9 01 LDA #&01 &2701 8d 60 1f STA &1f60 ; menu_active &2704 68 PLA &2705 8d 61 1f STA &1f61 ; return_address_from_list_inventory_low &2708 68 PLA &2709 8d 62 1f STA &1f62 ; return_address_from_list_inventory_high &270c 4c 26 27 JMP &2726 ; consider_keypress_in_inventory_for_function_keys ; restore_caller_of_list_inventory_to_stack_and_consider_down_and_enter &270f ad 62 1f LDA &1f62 ; return_address_from_list_inventory_high &2712 48 PHA &2713 ad 61 1f LDA &1f61 ; return_address_from_list_inventory_low &2716 48 PHA &2717 4c 68 2a JMP &2a68 ; check_for_down_and_enter_in_inventory ; consider_keypress_for_function_keys &271a ad 39 35 LDA &3539 ; keypress &271d 4c db 26 JMP &26db ; function_key_handling ; to_remove_caller_of_list_inventory_from_stack_and_consider_function_keys &2720 8d 8d 37 STA &378d ; keypress_in_inventory &2723 4c ff 26 JMP &26ff ; remove_caller_of_list_inventory_from_stack_and_consider_function_keys ; consider_keypress_in_inventory_for_function_keys &2726 ad 8d 37 LDA &378d ; keypress_in_inventory &2729 4c db 26 JMP &26db ; function_key_handling ; decrease_music_volume &272c ad db 08 LDA &08db ; envelope_2_target_amplitude_attack &272f c9 00 CMP #&00 &2731 f0 15 BEQ &2748 ; to_delay_then_continue_main_game_loop &2733 38 SEC &2734 e9 0a SBC #&0a &2736 8d db 08 STA &08db ; envelope_2_target_amplitude_attack &2739 8d dc 08 STA &08dc ; envelope_2_target_amplitude_decay &273c ad cb 08 LDA &08cb ; envelope_3_target_amplitude_attack &273f 38 SEC &2740 e9 0a SBC #&0a &2742 8d cb 08 STA &08cb ; envelope_3_target_amplitude_attack &2745 8d cc 08 STA &08cc ; envelope_3_target_amplitude_decay ; to_delay_then_continue_main_game_loop &2748 4c 67 27 JMP &2767 ; delay_then_continue_main_game_loop ; increase_music_volume &274b ad db 08 LDA &08db ; envelope_2_target_amplitude_attack &274e c9 5a CMP #&5a &2750 f0 15 BEQ &2767 ; delay_then_continue_main_game_loop &2752 18 CLC &2753 69 0a ADC #&0a &2755 8d db 08 STA &08db ; envelope_2_target_amplitude_attack &2758 8d dc 08 STA &08dc ; envelope_2_target_amplitude_decay &275b ad cb 08 LDA &08cb ; envelope_3_target_amplitude_attack &275e 18 CLC &275f 69 0a ADC #&0a &2761 8d cb 08 STA &08cb ; envelope_3_target_amplitude_attack &2764 8d cc 08 STA &08cc ; envelope_3_target_amplitude_decay ; delay_then_continue_main_game_loop &2767 20 bc 1c JSR &1cbc ; delay_for_57344_loops &276a 4c 28 1a JMP &1a28 ; continue_main_game_loop ; remove_player_and_plot_scream &276d 20 04 12 JSR &1204 ; restore_screen_behind_player &2770 a9 61 LDA #&61 ; ""AAAHHH... WATCH HOW YOU GO!" &2772 4c 38 25 JMP &2538 ; plot_text_string ; sound_data ; chan vol pitch dur &2775 02 00 04 00 b8 00 04 00 ; flip_player_sprites &277d 20 eb 1a JSR &1aeb ; use_player_sideways_sprite_and_mask &2780 20 bf 0f JSR &0fbf ; use_player_sprite_with_mask &2783 a9 00 LDA #&00 &2785 85 71 STA &71 ; sprite_address_low &2787 a9 30 LDA #&30 ; &3000 = player_sideways_frame_0_sprite &2789 85 72 STA &72 ; sprite_address_high # Flip player sideways sprite frame 0 &278b 20 c3 11 JSR &11c3 ; flip_sprite &278e 20 eb 1a JSR &1aeb ; use_player_sideways_sprite_and_mask &2791 20 bf 0f JSR &0fbf ; use_player_sprite_with_mask &2794 a9 90 LDA #&90 &2796 85 71 STA &71 ; sprite_address_low &2798 a9 37 LDA #&37 ; &3790 = player_sideways_frame_1_sprite &279a 85 72 STA &72 ; sprite_address_high # Flip player sideways sprite frame 1 &279c 20 c3 11 JSR &11c3 ; flip_sprite &279f 60 RTS ; use_player_sideways_sprite_and_plot_change &27a0 ad 51 02 LDA &0251 ; Flashing colours counter &27a3 c9 0e CMP #&0e &27a5 90 07 BCC &27ae ; use_player_sideways_frame_1 &27a7 a2 00 LDX #&00 &27a9 a0 30 LDY #&30 ; &3000 = player_sideways_frame_0_sprite # Use player sideways sprite frame 0 &27ab 4c b2 27 JMP &27b2 ; use_player_sideways_frame_0 ; use_player_sideways_frame_1 &27ae a2 90 LDX #&90 &27b0 a0 37 LDY #&37 ; &3790 = player_sideways_frame_1_sprite # Use player sideways sprite frame 1 ; use_player_sideways_frame_0 &27b2 8e ef 1a STX &1aef ; player_sprite_address_frame_low &27b5 8c f4 1a STY &1af4 ; player_sprite_address_frame_high &27b8 4c 2e 1b JMP &1b2e ; plot_any_change_in_player_position ; turn_player_right &27bb 20 eb 1a JSR &1aeb ; use_player_sideways_sprite_and_mask &27be a5 8c LDA &8c ; player_horizontal_direction &27c0 d0 05 BNE &27c7 ; player_is_already_facing_right &27c2 e6 8c INC &8c ; player_horizontal_direction &27c4 20 7a 4f JSR &4f7a ; flip_player_sideways_sprites_and_mask ; player_is_already_facing_right &27c7 4c 2e 1b JMP &1b2e ; plot_any_change_in_player_position ; turn_player_left &27ca 20 eb 1a JSR &1aeb ; use_player_sideways_sprite_and_mask &27cd a5 8c LDA &8c ; player_horizontal_direction &27cf f0 05 BEQ &27d6 ; player_is_already_facing_left &27d1 c6 8c DEC &8c ; player_horizontal_direction &27d3 20 7a 4f JSR &4f7a ; flip_player_sideways_sprites_and_mask ; player_is_already_facing_left &27d6 4c 2e 1b JMP &1b2e ; plot_any_change_in_player_position ; invert_and_uninvert_room_then_return_to_game &27d9 20 37 37 JSR &3737 ; invert_entire_room &27dc 4c 63 42 JMP &4263 ; wait_a_while_and_uninvert_room_and_icon ; consider_keypress_in_70_for_function_keys &27df a5 70 LDA &70 &27e1 4c db 26 JMP &26db ; function_key_handling ; list_inventory_item &27e4 20 38 25 JSR &2538 ; plot_text_string &27e7 4c 55 2a JMP &2a55 ; towards_plotting_inventory_slot_count ; plot_magical_star_after_spell_names &27ea c9 0d CMP #&0d &27ec 90 0e BCC &27fc ; leave &27ee c9 18 CMP #&18 &27f0 b0 0a BCS &27fc ; leave &27f2 a9 20 LDA #&20 &27f4 20 ee ff JSR &ffee ; OSWRCH &27f7 a9 5f LDA #&5f &27f9 4c ee ff JMP &ffee ; OSWRCH ; leave &27fc 60 RTS ; convert_to_upper_case &27fd 29 5f AND #&5f &27ff 4c b3 29 JMP &29b3 ; add_character_to_input_buffer ; unused &2802 ff &2803 4c 55 2a JMP &2a55 ; towards_plotting_inventory_slot_count # Unused code ; flush_sound_channel_two_then_return_to_game &2806 a9 15 LDA #&15 ; Flush Selected Buffer &2808 a2 06 LDX #&06 ; Sound channel 2 &280a a0 00 LDY #&00 &280c 20 f4 ff JSR &fff4 ; OSBYTE &280f 4c d8 35 JMP &35d8 ; wait_for_all_keys_to_be_released_then_return_to_game ; variable_delay_depending_on_presence_of_enemy &2812 a5 8a LDA &8a ; room_data_byte_three &2814 29 01 AND #&01 &2816 d0 03 BNE &281b ; room_contains_enemy &2818 4c 61 1c JMP &1c61 ; delay_for_10836_loops ; room_contains_enemy &281b 4c 41 1c JMP &1c41 ; delay_for_11176_loops ; reset_room_6c_data_and_enter_main_game_loop &281e a9 11 LDA #&11 &2820 8d bb 4d STA &4dbb ; room_6c_data + 2 # Re-animate EATING PLANT in room &6c &2823 4c 00 1a JMP &1a00 ; main_game_loop ; unused &2826 4d 41 47 45 4c 4f 52 44 53 0d ; "MAGELORDS\r" ; check_for_collision_with_furniture &2830 20 48 36 JSR &3648 ; uninvert_function_icon &2833 a2 02 LDX #&02 &2835 a0 01 LDY #&01 &2837 20 03 36 JSR &3603 ; invert_function_icon &283a ae 52 20 LDX &2052 ; furniture_x &283d ac 53 20 LDY &2053 ; furniture_y &2840 20 10 1f JSR &1f10 ; player_collision_check &2843 f0 3c BEQ &2881 ; check_for_collision_with_chest &2845 a2 00 LDX #&00 ; check_furniture_loop &2847 bd ba 2e LDA &2eba,X ; furniture_text_table &284a c5 9c CMP &9c ; player_room &284c f0 09 BEQ &2857 ; room_has_furniture_with_text &284e e8 INX &284f e8 INX &2850 e0 46 CPX #&46 &2852 d0 f3 BNE &2847 ; check_loop &2854 4c 81 28 JMP &2881 ; check_for_collision_with_chest ; room_has_furniture_with_text &2857 e8 INX &2858 bd ba 2e LDA &2eba,X ; furniture_text_table ; to_plot_text_and_return_to_game &285b 20 38 25 JSR &2538 ; plot_text_string &285e 4c 38 36 JMP &3638 ; uninvert_icon_and_return_to_game ; play_death_sound &2861 a2 e4 LDX #&e4 ; play_death_sound_loop &2863 a0 04 LDY #&04 &2865 8a TXA &2866 48 PHA &2867 a9 04 LDA #&04 &2869 20 7a 37 JSR &377a ; play_sound &286c 68 PLA &286d 38 SEC &286e e9 04 SBC #&04 &2870 aa TAX &2871 e0 b4 CPX #&b4 &2873 d0 ee BNE &2863 ; play_death_sound_loop &2875 60 RTS ; plot_control_character_others # Remaining control characters play a sound &2876 a9 04 LDA #&04 &2878 a2 65 LDX #&65 &287a a0 07 LDY #&07 &287c 20 7a 37 JSR &377a ; play_sound &287f 60 RTS ; unused &2880 00 ; check_for_collision_with_chest &2881 ae 50 20 LDX &2050 ; chest_x &2884 ac 51 20 LDY &2051 ; chest_y &2887 20 10 1f JSR &1f10 ; player_collision_check &288a f0 03 BEQ &288f ; to_look_at_object &288c 4c 8e 29 JMP &298e ; process_ingredients_data ; to_look_at_object &288f ea NOP &2890 ea NOP ; look_at_object &2891 a2 00 LDX #&00 ; find_object_loop &2893 bd 2a 50 LDA &502a,X ; object_table &2896 c5 9c CMP &9c ; player_room &2898 f0 0b BEQ &28a5 ; found_object_in_this_room &289a e8 INX &289b e8 INX &289c e8 INX &289d e8 INX &289e e0 90 CPX #&90 &28a0 d0 f1 BNE &2893 ; find_object_loop &28a2 4c 65 36 JMP &3665 ; check_for_collision_with_doors ; found_object_in_this_room &28a5 bd 2b 50 LDA &502b,X ; object_table + 1 &28a8 29 7f AND #&7f &28aa ea NOP &28ab ea NOP &28ac 18 CLC &28ad 69 25 ADC #&25 # Convert object type &0 - &b - to text &25 - &30 &28af 20 1b 29 JSR &291b ; subtract_three_if_greater_than_32 # and &f - &10 to &31 - &32 &28b2 ea NOP &28b3 ea NOP &28b4 ea NOP &28b5 8d fd 53 STA &53fd ; text_id_for_object_looked_at &28b8 20 c7 1c JSR &1cc7 ; compare_player_with_object_height_from_above &28bb d0 15 BNE &28d2 ; player_isn't_at_side_of_object &28bd a5 82 LDA &82 ; player_x &28bf 18 CLC &28c0 69 03 ADC #&03 &28c2 c5 86 CMP &86 ; object_x &28c4 f0 09 BEQ &28cf ; to_plot_text_for_object_looked_at &28c6 a5 82 LDA &82 ; player_x &28c8 38 SEC &28c9 e5 8e SBC &8e ; object_sprite_width &28cb c5 86 CMP &86 ; object_x &28cd d0 03 BNE &28d2 ; player_isn't_at_side_of_object ; to_plot_text_for_object_looked_at &28cf 4c 04 29 JMP &2904 ; plot_text_for_object_looked_at ; player_isn't_at_side_of_object &28d2 20 03 1c JSR &1c03 ; does_player_overlap_object_in_x &28d5 d0 21 BNE &28f8 ; to_check_for_collision_with_doors &28d7 a5 90 LDA &90 ; object_height_from_below &28d9 18 CLC &28da 69 02 ADC #&02 &28dc 85 70 STA &70 ; tmp &28de a5 87 LDA &87 ; object_y &28e0 18 CLC &28e1 65 70 ADC &70 ; tmp &28e3 38 SEC &28e4 e9 20 SBC #&20 &28e6 c5 83 CMP &83 ; player_y &28e8 f0 e5 BEQ &28cf ; to_plot_text_for_object_looked_at &28ea a5 87 LDA &87 ; object_y &28ec 18 CLC &28ed 65 70 ADC &70 ; tmp &28ef 38 SEC &28f0 e9 22 SBC #&22 &28f2 e5 9a SBC &9a ; object_height_from_above &28f4 c5 83 CMP &83 ; player_y &28f6 f0 d7 BEQ &28cf ; to_plot_text_for_object_looked_at ; to_check_for_collision_with_doors &28f8 4c 65 36 JMP &3665 ; check_for_collision_with_doors &28fb ea NOP &28fc ea NOP &28fd ea NOP &28fe ea NOP &28ff ea NOP &2900 ea NOP &2901 ea NOP &2902 ea NOP &2903 ea NOP ; plot_text_for_object_looked_at &2904 a9 05 LDA #&05 &2906 20 53 25 JSR &2553 ; plot_character &2909 ad fd 53 LDA &53fd ; text_id_for_object_looked_at &290c 20 38 25 JSR &2538 ; plot_text_string &290f 20 4b 2f JSR &2f4b ; replot_room_if_collected_mushroom &2912 20 16 2d JSR &2d16 ; touch_altar &2915 ea NOP &2916 ea NOP &2917 ea NOP &2918 4c 38 36 JMP &3638 ; uninvert_icon_and_return_to_game ; subtract_three_if_greater_than_32 &291b c9 32 CMP #&32 &291d 90 03 BCC &2922 ; leave &291f 38 SEC &2920 e9 03 SBC #&03 ; leave &2922 60 RTS ; set_window_sprite_and_wipe_screen &2923 ad d5 1b LDA &1bd5 ; day_or_night &2926 f0 0d BEQ &2935 ; use_day_window &2928 a9 48 LDA #&48 &292a 8d 86 55 STA &5586 ; scenery_sprite_08_data &292d a9 3b LDA #&3b ; &3b48 = scenery_sprite_08_night &292f 8d 87 55 STA &5587 ; scenery_sprite_08_data + 1 &2932 4c 3f 29 JMP &293f ; to_set_polymorphic_plot_sprite_to_wipe_mode_and_wipe_screen ; use_day_window &2935 a9 26 LDA #&26 &2937 8d 86 55 STA &5586 ; scenery_sprite_08_data &293a a9 53 LDA #&53 ; &5326 = scenery_sprite_08_day &293c 8d 87 55 STA &5587 ; scenery_sprite_08_data + 1 &293f 4c ad 1e JMP &1ead ; set_polymorphic_plot_sprite_to_wipe_mode_and_wipe_screen ; irq2_interrupt_routine &2942 ee fe 53 INC &53fe ; timer &2945 d0 35 BNE &297c &2947 ad fe 53 LDA &53fe ; timer &294a ad ff 53 LDA &53ff ; timer + 1 &294d 18 CLC &294e 69 01 ADC #&01 &2950 8d ff 53 STA &53ff ; timer + 1 &2953 c9 04 CMP #&04 &2955 d0 25 BNE &297c &2957 a9 00 LDA #&00 &2959 8d ff 53 STA &53ff ; timer + 1 &295c ad 00 54 LDA &5400 ; timer + 2 &295f 18 CLC &2960 69 01 ADC #&01 &2962 c9 04 CMP #&04 &2964 d0 02 BNE &2968 &2966 a9 00 LDA #&00 &2968 8d 00 54 STA &5400 ; timer + 2 &296b ad 00 54 LDA &5400 ; timer + 2 &296e c9 02 CMP #&02 &2970 90 05 BCC &2977 ; become_night &2972 a9 00 LDA #&00 ; day &2974 4c 79 29 JMP &2979 ; set_day_or_night ; become_night &2977 a9 01 LDA #&01 ; night ; set_day_or_night &2979 8d d5 1b STA &1bd5 ; day_or_night &297c ad 64 fe LDA &fe64 ; Timer 1 latch/counter LSB &297f a5 fc LDA &fc ; Interrupt Temp A reg store # Restore accumulator before leaving interrupt &2981 40 RTI ; increase_ingredients_data_pointer_by_one &2982 a5 9d LDA &9d ; ingredients_data_pointer_low &2984 18 CLC &2985 69 01 ADC #&01 &2987 90 02 BCC &298b &2989 e6 9e INC &9e ; ingredients_data_pointer_high &298b 85 9d STA &9d ; ingredients_data_pointer_low &298d 60 RTS ; process_ingredients_data &298e a9 10 LDA #&10 &2990 85 9d STA &9d ; ingredients_data_pointer_low &2992 a9 2e LDA #&2e ; &2e10 = ingredients_data &2994 85 9e STA &9e ; ingredients_data_pointer_high &2996 a0 00 LDY #&00 ; room_data_loop &2998 b1 9d LDA (&9d),Y ; ingredients_data_pointer &299a c5 9c CMP &9c ; player_room &299c f0 28 BEQ &29c6 ; found_ingredients_in_this_room ; skip_until_zero_byte &299e 20 82 29 JSR &2982 ; increase_ingredients_data_pointer_by_one &29a1 b1 9d LDA (&9d),Y ; ingredients_data_pointer &29a3 c9 00 CMP #&00 &29a5 d0 f7 BNE &299e ; skip_until_zero_byte &29a7 20 82 29 JSR &2982 ; increase_ingredients_data_pointer_by_one &29aa b1 9d LDA (&9d),Y ; ingredients_data_pointer &29ac c9 ff CMP #&ff &29ae d0 e8 BNE &2998 ; room_data_loop &29b0 4c 91 28 JMP &2891 ; look_at_object ; add_character_to_input_buffer &29b3 c0 08 CPY #&08 &29b5 f0 07 BEQ &29be ; skip_character &29b7 20 ee ff JSR &ffee ; OSWRCH &29ba 99 54 2d STA &2d54,Y ; input_buffer &29bd c8 INY ; skip_character &29be 4c 9d 25 JMP &259d ; read_character &29c1 00 BRK &29c2 00 BRK &29c3 00 BRK &29c4 00 BRK &29c5 00 BRK ; found_ingredients_in_this_room &29c6 a9 05 LDA #&05 ; two newlines &29c8 20 53 25 JSR &2553 ; plot_character &29cb a9 34 LDA #&34 ; "YOU FOUND:" &29cd 20 38 25 JSR &2538 ; plot_text_string &29d0 20 13 2a JSR &2a13 ; remove_ingredients_from_room ; collect_ingredients_loop &29d3 20 82 29 JSR &2982 ; increase_ingredients_data_pointer_by_one &29d6 b1 9d LDA (&9d),Y; ingredients_data_pointer &29d8 c9 00 CMP #&00 &29da f0 23 BEQ &29ff ; end_of_ingredients &29dc aa TAX &29dd ca DEX &29de bd e8 4f LDA &4fe8,X ; player_inventory &29e1 f8 SED &29e2 18 CLC &29e3 69 01 ADC #&01 &29e5 9d e8 4f STA &4fe8,X ; player_inventory &29e8 d8 CLD &29e9 e8 INX &29ea 86 9f STX &9f ; ingredient &29ec a9 0d LDA #&0d ; newline &29ee 20 53 25 JSR &2553 ; plot_character &29f1 a5 9f LDA &9f ; ingredient &29f3 20 38 25 JSR &2538 ; plot_text_string &29f6 20 76 28 JSR &2876 ; plot_control_character_others # Play a sound for each ingredient collected &29f9 a0 00 LDY #&00 &29fb ea NOP &29fc 4c d3 29 JMP &29d3 ; collect_ingredients_loop ; end_of_ingredients &29ff 4c 38 36 JMP &3638 ; uninvert_icon_and_return_to_game ; play_teleport_sound &2a02 a9 02 LDA #&02 &2a04 8d e0 08 STA &08e0 ; envelope_3_byte_0 &2a07 a9 03 LDA #&03 &2a09 a2 32 LDX #&32 &2a0b a0 20 LDY #&20 &2a0d 20 7a 37 JSR &377a ; play_sound &2a10 60 RTS &2a11 ea NOP &2a12 ea NOP ; remove_ingredients_from_room &2a13 a9 fe LDA #&fe &2a15 91 9d STA (&9d),Y ; ingredients_data_pointer # Change room number for ingredients to &fe &2a17 60 RTS ; plot_nothing_text &2a18 a9 0d LDA #&0d ; newline &2a1a 20 53 25 JSR &2553 ; plot_character &2a1d a9 33 LDA #&33 ; "NOTHING" &2a1f 20 38 25 JSR &2538 ; plot_text_string &2a22 a9 fe LDA #&fe ; nothing &2a24 60 RTS ; check_if_inventory_is_empty &2a25 a9 01 LDA #&01 &2a27 a6 70 LDX &70 ; minimum_inventory_slot_to_consider &2a29 bd e8 4f LDA &4fe8,X ; player_inventory &2a2c d0 08 BNE &2a36 ; leave &2a2e e8 INX &2a2f ec 03 54 CPX &5403 ; maximum_inventory_slot_to_consider &2a32 d0 f5 BNE &2a29 &2a34 a9 00 LDA #&00 ; leave &2a36 60 RTS ; list_inventory_items &2a37 20 25 2a JSR &2a25 ; check_if_inventory_is_empty &2a3a d0 03 BNE &2a3f ; inventory_isn't_empty &2a3c 4c 18 2a JMP &2a18 ; plot_nothing_text ; inventory_isn't_empty &2a3f a6 70 LDX &70 ; minimum_inventory_slot_to_consider ; list_inventory_items_loop &2a41 bd e8 4f LDA &4fe8,X ; player_inventory &2a44 f0 43 BEQ &2a89 ; increment_current_inventory_slot &2a46 e8 INX &2a47 8e 02 54 STX &5402 ; current_inventory_slot &2a4a a9 0d LDA #&0d ; newline &2a4c 20 53 25 JSR &2553 ; plot_character &2a4f ad 02 54 LDA &5402 ; current_inventory_slot &2a52 4c e4 27 JMP &27e4 ; list_inventory_item ; towards_plotting_inventory_slot_count &2a55 20 84 2a JSR &2a84 ; get_current_inventory_slot_minus_one &2a58 bd e8 4f LDA &4fe8,X ; player_inventory &2a5b 8d 01 54 STA &5401 ; inventory_slot_count &2a5e 4c 9b 34 JMP &349b ; position_cursor_for_inventory_slot_count ; wait_for_keypress_after_plotting_inventory_slot_count &2a61 a9 29 LDA #&29 ; ")" &2a63 20 ee ff JSR &ffee ; OSWRCH &2a66 ea NOP &2a67 ea NOP ; check_for_down_and_enter_in_inventory &2a68 a5 ec LDA &ec ; Internal key number of most recently pressed key &2a6a c9 c9 CMP #&c9 ; RETURN # actually CMP key_select &2a6c f0 07 BEQ &2a75 ; leave_with_this_slot &2a6e c9 a9 CMP #&e8 ; ? # actually CMP key_down &2a70 f0 07 BEQ &2a79 ; consider_next_inventory_slot &2a72 4c 20 27 JMP &2720 ; to_remove_caller_of_list_inventory_from_stack_and_consider_function_keys ; leave_with_this_slot &2a75 ad 02 54 LDA &5402 ; current_inventory_slot &2a78 60 RTS ; consider_next_inventory_slot &2a79 ae 02 54 LDX &5402 ; current_inventory_slot &2a7c ec 03 54 CPX &5403 ; maximum_inventory_slot_to_consider &2a7f d0 c0 BNE &2a41 ; list_inventory_items_loop &2a81 a9 46 LDA #&46 ; end of inventory &2a83 60 RTS ; get_current_inventory_slot_minus_one &2a84 ae 02 54 LDX &5402 ; current_inventory_slot &2a87 ca DEX &2a88 60 RTS ; increment_current_inventory_slot &2a89 e8 INX &2a8a 8e 02 54 STX &5402 ; current_inventory_slot &2a8d 4c 79 2a JMP &2a79 ; consider_next_inventory_slot ; display_strength_and_inventory &2a90 a9 3a LDA #&3a ; "STRENGTH:" &2a92 20 38 25 JSR &2538 ; plot_text_string ; loop_if_full_list &2a95 a9 0d LDA #&0d &2a97 20 53 25 JSR &2553 ; plot_character &2a9a a9 35 LDA #&35 ; "YOU HAVE:" &2a9c 20 38 25 JSR &2538 ; plot_text_string &2a9f a9 00 LDA #&00 &2aa1 85 70 STA &70 ; minimum_inventory_slot_to_consider &2aa3 a9 23 LDA #&23 &2aa5 8d 03 54 STA &5403 ; maximum_inventory_slot_to_consider &2aa8 20 37 2a JSR &2a37 ; list_inventory_items &2aab c9 46 CMP #&46 ; end of inventory &2aad f0 e6 BEQ &2a95 ; loop_if_full_list &2aaf 4c 38 36 JMP &3638 ; uninvert_icon_and_return_to_game ; choose_item_to_use &2ab2 a9 05 LDA #&05 &2ab4 20 53 25 JSR &2553 ; plot_character &2ab7 a9 37 LDA #&37 ; "USE:" &2ab9 20 38 25 JSR &2538 ; plot_text_string &2abc a9 17 LDA #&17 &2abe 85 70 STA &70 ; minimum_inventory_slot_to_consider &2ac0 a9 20 LDA #&20 &2ac2 8d 03 54 STA &5403 ; maximum_inventory_slot_to_consider &2ac5 20 37 2a JSR &2a37 ; list_inventory_items &2ac8 c9 46 CMP #&46 ; end of inventory &2aca f0 e6 BEQ &2ab2 ; choose_item_to_use &2acc c9 fe CMP #&fe ; nothing &2ace f0 12 BEQ &2ae2 ; to_uninvert_icon_and_return_to_game &2ad0 aa TAX &2ad1 85 98 STA &98 ; spell_or_item_used &2ad3 ca DEX &2ad4 bd e8 4f LDA &4fe8,X ; player_inventory &2ad7 f8 SED &2ad8 38 SEC &2ad9 e9 01 SBC #&01 &2adb d8 CLD &2adc 9d e8 4f STA &4fe8,X ; player_inventory &2adf 4c 66 2c JMP &2c66 ; use_object ; to_uninvert_icon_and_return_to_game &2ae2 4c 38 36 JMP &3638 ; uninvert_icon_and_return_to_game &2ae5 ea NOP &2ae6 ea NOP ; choose_spell_to_cast &2ae7 a9 38 LDA #&38 ; "CAST:" &2ae9 20 38 25 JSR &2538 ; plot_text_string &2aec a9 0c LDA #&0c &2aee 85 70 STA &70 ; minimum_inventory_slot_to_consider &2af0 a9 17 LDA #&17 &2af2 8d 03 54 STA &5403 ; maximum_inventory_slot_to_consider &2af5 20 37 2a JSR &2a37 ; list_inventory_items &2af8 c9 46 CMP #&46 ; end of inventory &2afa f0 eb BEQ &2ae7 ; choose_spell_to_cast &2afc c9 fe CMP #&fe ; nothing &2afe f0 e2 BEQ &2ae2 ; to_uninvert_icon_and_return_to_game &2b00 aa TAX &2b01 85 98 STA &98 ; spell_or_item_used &2b03 ca DEX &2b04 bd e8 4f LDA &4fe8,X ; player_inventory &2b07 f8 SED &2b08 38 SEC &2b09 e9 01 SBC #&01 &2b0b d8 CLD &2b0c 9d e8 4f STA &4fe8,X ; player_inventory &2b0f 4c cc 2b JMP &2bcc ; consider_cast_spell ; choose_ingredients_to_max &2b12 a9 00 LDA #&00 &2b14 20 3d 2d JSR &2d3d ; check_for_mortar_and_pestle ; mix_loop &2b17 a9 05 LDA #&05 &2b19 20 53 25 JSR &2553 ; plot_character &2b1c a9 36 LDA #&36 ; "MIX:" &2b1e 20 38 25 JSR &2538 ; plot_text_string &2b21 a9 00 LDA #&00 &2b23 85 70 STA &70 ; minimum_inventory_slot_to_consider &2b25 a9 0c LDA #&0c &2b27 8d 03 54 STA &5403 ; maximum_inventory_slot_to_consider &2b2a 20 37 2a JSR &2a37 ; list_inventory_items &2b2d c9 46 CMP #&46 ; end of inventory &2b2f f0 25 BEQ &2b56 ; end_of_list &2b31 c9 fe CMP #&fe ; nothing &2b33 f0 ad BEQ &2ae2 ; to_uninvert_icon_and_return_to_game &2b35 ae 04 54 LDX &5404 ; mix_position &2b38 9d 8b 20 STA &208b,X ; mixed_ingredients &2b3b aa TAX &2b3c ca DEX &2b3d bd e8 4f LDA &4fe8,X ; player_inventory &2b40 f8 SED &2b41 38 SEC &2b42 e9 01 SBC #&01 &2b44 d8 CLD &2b45 9d e8 4f STA &4fe8,X ; player_inventory &2b48 ae 04 54 LDX &5404 ; mix_position &2b4b e8 INX &2b4c 8e 04 54 STX &5404 ; mix_position &2b4f e0 06 CPX #&06 &2b51 f0 15 BEQ &2b68 ; six_ingredients # Bug: Branches mid-instruction ; to_mix_loop &2b53 4c 17 2b JMP &2b17 ; mix_loop ; end_of_list &2b56 a9 3b LDA #&3b ; "END" &2b58 20 38 25 JSR &2538 ; plot_text_string ; consider_keys_in_mix_routine &2b5b a5 ec LDA &ec ; Internal key number of most recently pressed key &2b5d 85 70 STA &70 ; keypress &2b5f c9 a9 CMP #&e8 ; ? # actually CMP key_down &2b61 f0 f0 BEQ &2b53 ; to_mix_loop &2b63 c9 c9 CMP #&c9 ; RETURN # actually CMP key_select &2b65 f0 03 BEQ &2b6a ; finished_mixing &2b67 4c f7 26 JMP &26f7 ; set_menu_active_to_two_and_consider_keypress_for_function_keys ; six_ingredients #2b68 f7 26 *ISC &26,X # Unofficial opcode; INC &26,X, SBC &26,X ; finished_mixing &2b6a 20 4f 42 JSR &424f ; sound_and_lights_for_mixing &2b6d 9d 8b 20 STA &208b,X ; mixed_ingredients &2b70 a2 00 LDX #&00 ; consider_recipe_against_mixed_ingredients &2b72 a0 00 LDY #&00 &2b74 b9 8b 20 LDA &208b,Y ; mixed_ingredients &2b77 dd 80 2e CMP &2e80,X ; recipe_list &2b7a f0 03 BEQ &2b7f ; matches_recipe &2b7c 4c ac 2b JMP &2bac ; consider_next_recipe ; matches_recipe &2b7f b9 8b 20 LDA &208b,Y ; mixed_ingredients &2b82 f0 05 BEQ &2b89 ; found_end_of_recipe_with_successful_mix &2b84 e8 INX &2b85 c8 INY &2b86 4c 74 2b JMP &2b74 ; matches_recipe ; found_end_of_recipe_with_successful_mix &2b89 e8 INX &2b8a bd 80 2e LDA &2e80,X ; recipe_list &2b8d aa TAX &2b8e ca DEX &2b8f bd e8 4f LDA &4fe8,X ; player_inventory &2b92 f8 SED &2b93 18 CLC &2b94 69 01 ADC #&01 &2b96 d8 CLD &2b97 9d e8 4f STA &4fe8,X ; player_inventory &2b9a e8 INX &2b9b 8e 8b 20 STX &208b ; mixed_ingredients &2b9e a9 0d LDA #&0d ; newline &2ba0 20 53 25 JSR &2553 ; plot_character &2ba3 ad 8b 20 LDA &208b ; mixed_ingredients &2ba6 20 38 25 JSR &2538 ; plot_text_string &2ba9 4c 38 36 JMP &3638 ; uninvert_icon_and_return_to_game ; consider_next_recipe &2bac bd 80 2e LDA &2e80,X ; recipe_list &2baf f0 04 BEQ &2bb5 ; found_end_of_recipe &2bb1 e8 INX &2bb2 4c ac 2b JMP &2bac ; consider_next_recipe ; found_end_of_recipe &2bb5 e8 INX &2bb6 e8 INX &2bb7 e0 3a CPX #&3a &2bb9 f0 03 BEQ &2bbe ; to_failed_mix &2bbb 4c 72 2b JMP &2b72 ; consider_recipe_against_mixed_ingredients ; to_failed_mix &2bbe 4c 5b 42 JMP &425b ; failed_mix ; unused_spell_menu_fragment # Unused code &2bc1 c9 fe CMP #&fe ; nothing &2bc3 f0 04 BEQ &2bc9 ; to_choose_spell_to_cast &2bc5 c9 46 CMP #&46 ; end of inventory &2bc7 d0 03 BNE &2bcc ; consider_cast_spell ; to_choose_spell_to_cast &2bc9 4c e7 2a JMP &2ae7 ; choose_spell_to_cast ; consider_cast_spell &2bcc e8 INX &2bcd 8a TXA &2bce 48 PHA &2bcf a5 9c LDA &9c ; player_room &2bd1 c9 c1 CMP #&c1 ; throne_room &2bd3 d0 20 BNE &2bf5 ; consider_cast_spell_away_from_throne &2bd5 68 PLA ; spell &2bd6 c9 11 CMP #&11 ; SUN HIT &2bd8 d0 40 BNE &2c1a ; to_uninvert_icon_and_return_to_game # Only SUN HIT works in the throne room &2bda ad 03 50 LDA &5003 ; player_inventory + &1b, CRYSTAL BALL &2bdd d0 08 BNE &2be7 ; player_has_crystal_ball &2bdf a9 3f LDA #&3f ; "THE POWERFUL MAGIC KILLED YOU TOO!" &2be1 20 38 25 JSR &2538 ; plot_text_string &2be4 4c e8 36 JMP &36e8 ; uninvert_icon_and_kill_player ; player_has_crystal_ball &2be7 20 23 29 JSR &2923 ; set_window_sprite_and_wipe_screen &2bea a9 3e LDA #&3e ; "CASTING THE SPELL, MADE ZORN FADE AWAY" &2bec 20 38 25 JSR &2538 ; plot_text_string &2bef 4c 0f 35 JMP &350f ; display_encrypted_egotrip_message_and_hang ; unused # Unused code &2bf2 4c f0 2b JMP &2bf0 ; ? ; consider_cast_spell_away_from_throne &2bf5 a5 98 LDA &98 ; spell_or_item_used &2bf7 c9 0d CMP #&0d ; HEAL &2bf9 d0 12 BNE &2c0d ; not_heal &2bfb ad fc 53 LDA &53fc ; player_energy &2bfe f8 SED &2bff 18 CLC &2c00 69 10 ADC #&10 &2c02 90 02 BCC &2c06 ; set_player_energy ; set_player_energy_to_maximum &2c04 a9 99 LDA #&99 ; set_player_energy &2c06 8d fc 53 STA &53fc ; player_energy &2c09 d8 CLD &2c0a 4c 08 2e JMP &2e08 ; sound_and_lights_for_casting_spell ; not_heal &2c0d c9 0e CMP #&0e ; FULL HEAL &2c0f f0 f3 BEQ &2c04 ; set_player_energy_to_maximum &2c11 c9 0f CMP #&0f ; AIR BUBBLE &2c13 d0 12 BNE &2c27 ; not_air_bubble &2c15 a6 9c LDX &9c ; player_room &2c17 4c c6 36 JMP &36c6 ; cast_air_bubble ; to_uninvert_icon_and_return_to_game &2c1a 4c 38 36 JMP &3638 ; uninvert_icon_and_return_to_game ; note_spell_has_been_cast_silently &2c1d 85 98 STA &98 ; spell_or_item_used &2c1f 4c 38 36 JMP &3638 ; uninvert_icon_and_return_to_game ; note_spell_has_been_cast_noisily &2c22 85 98 STA &98 ; spell_or_item_used &2c24 4c 08 2e JMP &2e08 ; sound_and_lights_for_casting_spell ; not_air_bubble &2c27 c9 10 CMP #&10 ; BODY BUBBLE &2c29 f0 f7 BEQ &2c22 ; note_spell_has_been_cast_noisily &2c2b c9 12 CMP #&12 ; FREEZE &2c2d d0 08 BNE &2c37 &2c2f a9 04 LDA #&04 &2c31 8d 48 23 STA &2348 ; maximum_enemy_frame # FREEZE makes enemy move more slowly &2c34 4c 08 2e JMP &2e08 ; sound_and_lights_for_casting_spell &2c37 c9 13 CMP #&13 ; DEEP FREEZE &2c39 d0 03 BNE &2c3e ; not_deep_freeze &2c3b 4c 22 2c JMP &2c22 ; note_spell_has_been_cast_noisily ; not_deep_freeze &2c3e c9 14 CMP #&14 ; AIR SHIELD &2c40 d0 09 BNE &2c4b ; not_air_shield &2c42 a5 9b LDA &9b ; enemy_energy_drain &2c44 4a LSR A &2c45 18 CLC ; set_enemy_energy_drain &2c46 85 9b STA &9b ; enemy_energy_drain # AIR SHIELD halves damage enemy inflicts &2c48 4c 22 2c JMP &2c22 ; note_spell_has_been_cast_noisily ; not_air_shield &2c4b c9 15 CMP #&15 ; WIND SHIELD &2c4d d0 05 BNE &2c54 ; not_wind_shield &2c4f a9 00 LDA #&00 &2c51 4c 46 2c JMP &2c46 ; set_enemy_energy_drain # WIND SHIELD sets damage enemy inflicts to zero ; not_wind_shield &2c54 c9 16 CMP #&16 ; STORM HIT &2c56 d0 0b BNE &2c63 ; not_storm_hit &2c58 a5 9c LDA &9c ; player_room &2c5a c9 46 CMP #&46 ; room_with_phantom &2c5c d0 05 BNE &2c63 ; not_storm_hit &2c5e a9 3d LDA #&3d ; "THE MAGIC KILLED THE PHANTOM." # STORM HIT removes PHANTOM from room &46 &2c60 20 38 25 JSR &2538 ; plot_text_string # (text also adds doors to rooms &46 and &47) ; not_storm_hit &2c63 4c 22 2c JMP &2c22 ; note_spell_has_been_cast_noisily ; use_object &2c66 e8 INX &2c67 8a TXA &2c68 c9 1b CMP #&1b ; TELECHANGE &2c6a d0 08 BNE &2c74 ; not_telechange &2c6c a9 c3 LDA #&c3 # TELECHANGE changes teleport destination in room &4d &2c6e 8d 01 51 STA &5101 ; teleport_4d_destination # (regardless of where it is used) ; to_note_spell_has_been_cast_silently &2c71 4c 1d 2c JMP &2c1d ; note_spell_has_been_cast_silently ; not_telechange &2c74 c9 19 CMP #&19 ; LUTE &2c76 d0 16 BNE &2c8e ; not_lite &2c78 a5 9c LDA &9c ; player_room &2c7a c9 32 CMP #&32 ; room_with_gramofoot &2c7c d0 0d BNE &2c8b &2c7e 20 e3 19 JSR &19e3 ; remove_object_from_room &2c81 a9 44 LDA #&44 ; "YOUR AWFUL MUSIC DROVE THE GRAMOFOOT AWAY" &2c83 20 38 25 JSR &2538 ; plot_text_string &2c86 a9 08 LDA #&08 &2c88 8d d2 4c STA &4cd2 ; room_32_data + 1 # LUTE removes GRAMOFOOT from room &32 &2c8b 4c 1a 2c JMP &2c1a ; to_uninvert_icon_and_return_to_game ; not_lute &2c8e c9 1a CMP #&1a ; GOLDEN CROSS &2c90 d0 16 BNE &2ca8 ; not_golden_cross &2c92 a5 9c LDA &9c ; player_room &2c94 c9 c5 CMP #&c5 ; room_with_vampire &2c96 d0 0d BNE &2ca5 ; towards_uninvert_icon_and_return_to_game &2c98 20 e3 19 JSR &19e3 ; remove_object_from_room &2c9b a9 45 LDA #&45 ; "SEEING THE CROSS THE VAMPIRE DISAPPEARS" &2c9d 20 38 25 JSR &2538 ; plot_text_string &2ca0 a9 28 LDA #&28 &2ca2 8d 1e 4f STA &4f1e ; room_c5_data + 1 # GOLDEN CROSS removes VAMPIRE from room &c5 ; towards_uninvert_icon_and_return_to_game &2ca5 4c 1a 2c JMP &2c1a ; to_uninvert_icon_and_return_to_game ; not_golden_cross &2ca8 c9 18 CMP #&18 ; POISONED WORMS &2caa d0 11 BNE &2cbd ; not_poisoned_worms &2cac a5 9c LDA &9c ; player_room &2cae c9 6c CMP #&6c ; room_with_hungry_plant &2cb0 d0 f3 BNE &2ca5 ; towards_uninvert_icon_and_return_to_game &2cb2 a9 10 LDA #&10 &2cb4 8d bb 4d STA &4dbb ; room_6c_data + 2 # POISONED WORMS de-animates EATING PLANT in room &6c &2cb7 ea NOP &2cb8 a9 46 LDA #&46 ; "YOUR WORMS KILLED THE PLANT" # (text also adds doors to rooms &a6 and &a7) &2cba 4c 5b 28 JMP &285b ; to_plot_text_and_return_to_game ; not_poisoned_worms &2cbd c9 1d CMP #&1d ; CORK &2cbf d0 0e BNE &2ccf ; not_cork &2cc1 a5 9c LDA &9c ; player_room &2cc3 c9 10 CMP #&10 ; room_with_bottle &2cc5 d0 de BNE &2ca5 ; towards_uninvert_icon_and_return_to_game &2cc7 a9 42 LDA #&42 ; "THE DEMON KILLS YOU" # CORK kills player if used in room &10 &2cc9 20 38 25 JSR &2538 ; plot_text_string &2ccc 4c e8 36 JMP &36e8 ; uninvert_icon_and_kill_player ; not_cork &2ccf c9 1e CMP #&1e ; METAL DISK &2cd1 d0 9e BNE &2c71 ; to_note_spell_has_been_cast_silently &2cd3 a5 9c LDA &9c ; player_room &2cd5 c9 53 CMP #&53 ; room_with_passages_are_invisible_doors_bookshelves &2cd7 d0 05 BNE &2cde ; to_note_spell_has_been_cast_noisily &2cd9 a9 50 LDA #&50 &2cdb 8d f5 4f STA &4ff5 ; player_inventory + &d, FULL HEAL # METAL DISK gives 50 FULL HEALS if used in room &53 ; to_note_spell_has_been_cast_noisily &2cde 4c 22 2c JMP &2c22 ; note_spell_has_been_cast_noisily ; check_for_ingredients_in_furniture &2ce1 a2 00 LDX #&00 ; check_for_ingredients_in_furniture_loop &2ce3 bd 61 2e LDA &2e61,X ; ingredients_in_furniture &2ce6 c5 9c CMP &9c ; player_room &2ce8 f0 08 BEQ &2cf2 ; force_collision_with_chest &2cea e8 INX &2ceb e8 INX &2cec e8 INX &2ced e0 1b CPX #&1b &2cef d0 f2 BNE &2ce3 ; check_for_ingredients_in_furniture_loop &2cf1 60 RTS ; force_collision_with_chest &2cf2 a5 82 LDA &82 ; player_x &2cf4 8d 50 20 STA &2050 ; chest_x &2cf7 a5 83 LDA &83 ; player_y &2cf9 8d 51 20 STA &2051 ; chest_y &2cfc 4c 81 28 JMP &2881 ; check_for_collision_with_chest ; unused &2cff 60 RTS ; check_for_death_door_then_move_up_a_room &2d00 a5 9c LDA &9c ; player_room &2d02 c9 41 CMP #&41 ; room_with_door_to_death # The top door in room &41 kills the player &2d04 d0 08 BNE &2d0e ; move_up_a_room &2d06 20 6d 27 JSR &276d ; remove_player_and_plot_scream &2d09 ea NOP &2d0a ea NOP &2d0b 4c f8 19 JMP &19f8 ; kill_player_without_text ; move_up_a_room &2d0e a5 9c LDA &9c ; player_room &2d10 18 CLC &2d11 69 0d ADC #&0d &2d13 85 9c STA &9c ; player_room &2d15 60 RTS ; touch_altar &2d16 a5 9c LDA &9c ; player_room &2d18 c9 c9 CMP #&c9 ; room_with_skull_altar &2d1a d0 0d BNE &2d29 ; check_second_altar &2d1c a9 45 LDA #&45 &2d1e 8d 59 4d STA &4d59 ; room_54_data # ALTAR in room &c9 changes doors in room &54 and &6e &2d21 a9 a4 LDA #&a4 # from right to left side of rooms and WALL &2d23 8d c1 4d STA &4dc1 ; room_6e_data &2d26 4c 37 2d JMP &2d37 ; plot_altar_text ; check_second_altar &2d29 c9 48 CMP #&48 ; second_room_with_skull_altar &2d2b d0 0f BNE &2d3c ; leave &2d2d a9 25 LDA #&25 &2d2f 8d 75 4d STA &4d75 ; room_5b_data # (redundant; &4d75 is always &25) &2d32 a9 88 LDA #&88 &2d34 8d 79 4d STA &4d79 ; room_5c_data # ALTAR in room &48 adds left door to room &5c ; plot_altar_text &2d37 a9 49 LDA #&49 ; "TOUCHING THE ALTAR YOU HEAR MOVING STONES" &2d39 20 38 25 JSR &2538 ; plot_text_string ; leave &2d3c 60 RTS ; check_for_mortar_and_pestle &2d3d 8d 04 54 STA &5404 ; mix_position &2d40 ad 08 50 LDA &5008 ; player_inventory + &20, MORTAR&PESTLE &2d43 d0 0a BNE &2d4f ; leave &2d45 a9 69 LDA #&69 ; "YOU DON'T HAVE A MIXING TOOL" &2d47 20 38 25 JSR &2538 ; plot_text_string &2d4a 68 PLA # Abandon mixing &2d4b 68 PLA &2d4c 4c 38 36 JMP &3638 ; uninvert_icon_and_return_to_game ; leave &2d4f 60 RTS ; to_kill_player_after_cld &2d50 d8 CLD &2d51 4c f3 19 JMP &19f3 ; kill_player ; input_buffer &2d54 45 54 41 4e 26 44 41 4e 21 ; "ETAN&DAN!" ; unused &2d5d 00 00 00 ; backup_of_object_screen &2d60 a7 27 42 26 a7 a2 27 26 02 23 e3 fe 20 00 00 23 &2d70 fe 3e 27 fe 7e 26 aa 62 e7 52 72 06 a2 62 e7 42 &2d80 72 a6 82 62 27 42 72 26 82 42 23 fe 3e 20 00 00 &2d90 23 e3 fe 27 e7 fe 27 67 42 26 a7 a2 27 27 42 e6 &2da0 a7 a2 07 27 42 e6 a7 a2 c2 fe 7e 33 30 c2 aa 62 &2db0 cc cc 7e 52 72 33 32 00 a2 62 cc cc 7e 42 72 33 &2dc0 30 fe 82 62 cc cc ea 42 72 33 30 d2 82 42 cc cc &2dd0 ea fe 3e 33 30 d2 00 00 00 00 00 00 00 00 00 00 &2de0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &2df0 00 07 93 c0 00 3c 6c 78 00 e3 6f 8e 00 3e 6c f8 ; unused &2e00 00 00 00 00 00 00 00 00 ; sound_and_lights_for_casting_spell &2e08 20 42 1f JSR &1f42 ; play_sound_for_spell_casting &2e0b 4c d9 27 JMP &27d9 ; invert_and_uninvert_room_then_return_to_game ; unused &2e0e 00 00 ; ingredients_data &2e10 b7 0c 03 02 00 ; room &b7, DRIED ROOTS, TOAD LEGS, SULPHUR &2e15 6f 01 03 00 ; room &6f, BURNED ASHES, TOAD LEGS &2e19 ba 03 01 00 ; room &ba, TOAD LEGS, BURNED ASHES &2e1d a9 01 00 ; room &a9, BURNED ASHES &2e20 b4 0c 01 00 ; room &b4, DRIED ROOTS, BURNED ASHES &2e24 9c 0c 01 00 ; room &9c, DRIED ROOTS, BURNED ASHES &2e28 8c 23 1d 14 00 ; room &8c, GOLDEN BAR, CORK, AIR SHIELD * &2e2d 81 02 00 ; room &81, SULPHUR &2e30 75 0d 15 00 ; room &75, HEAL *, WIND SHIELD * &2e34 6a 01 00 ; room &6a, BURNED ASHES &2e37 67 0c 1b 00 ; room &67, DRIED ROOTS, TELECHANGE &2e3b 5d 03 02 21 00 ; room &5d, TOAD LEGS, SULPHUR, MORTAR&PESTLE &2e40 52 02 12 00 ; room &52, missing (SULPHUR, FREEZE *) # Room has no CHEST &2e44 cd 20 12 00 ; room &cd, TAP, FREEZE * &2e48 38 0c 13 00 ; room &38, DRIED ROOTS, DEEP FREEZE * &2e4c 40 1a 06 00 ; room &40, GOLDEN CROSS, FLEAS &2e50 31 02 03 00 ; room &31, SULPHUR, TOAD LEGS &2e54 27 19 01 00 ; room &27, LUTE, BURNED ASHES &2e58 15 01 03 13 00 ; room &15, BURNED ASHES, TOAD LEGS, DEEP FREEZE * &2e5d 07 0c 01 00 ; room &07, DRIED ROOTS, BURNED ASHES ; ingredients_in_furniture &2e61 5c 08 00 ; room &5c, WORMS &2e64 69 07 00 ; room &69, WINE &2e67 91 07 00 ; room &91, WINE &2e6a 1e 09 00 ; room &1e, GOLDEN FRUIT &2e6d 6b 05 00 ; room &6b, OAK LEAVES &2e70 a3 05 00 ; room &a3, OAK LEAVES &2e73 82 06 00 ; room &82, FLEAS &2e76 47 1f 00 ; room &47, GOLDEN CROWN &2e79 85 06 06 06 06 00 ; room &85, FLEAS, FLEAS, FLEAS, FLEAS &2e7f ff ; end of list ; recipe_list &2e80 02 0c 00 0d ; SULPHUR, DRIED ROOTS = HEAL * &2e84 02 0c 06 00 0e ; SULPHUR, DRIED ROOTS, FLEAS = FULL HEAL * &2e89 05 0c 00 0f ; OAK LEAVES, DRIED ROOTS = AIR BUBBLE * &2e8d 05 0c 06 00 10 ; OAK LEAVES, DRIED ROOTS, FLEAS = BODY BUBBLE * &2e92 08 02 00 18 ; WORMS, SULPHUR = POISONED WORMS &2e96 03 01 00 12 ; TOAD LEGS, BURNED ASHES = FREEZE * &2e9a 03 01 06 00 13 ; TOAD LEGS, BURNED ASHES, FLEAS = DEEP FREEZE * &2e9f 07 01 00 14 ; WINE, BURNED ASHES = AIR SHIELD * &2ea3 07 01 06 00 15 ; WINE, BURNED ASHES, FLEAS = WIND SHIELD * &2ea8 0a 01 01 06 00 16 ; BLUE MUSHROOM, BURNED ASHES X2, FLEAS = STORM HIT * &2eae 09 03 03 06 00 17 ; GOLDEN FRUIT, TOAD LEGS X2, FLEAS = THUNDER HIT * &2eb4 0b 01 06 06 00 11 ; BLACK PEARL, BURNED ASHES, FLEAS X2 = SUN HIT * ; furniture_text_table &2eba 7e 57 ; room &7e, "YOU MOVE THE PICTURE" + &2ebc 75 5a ; room &75, "YOU PUSH THE AXE" + &2ebe 18 62 ; room &18, "SHIELD MOVED!" + &2ec0 1f 53 ; room &1f, ""SEARCH THY PROTECTOR"" &2ec2 26 52 ; room &26, ""SHIELD v PROTECTION"" &2ec4 ad 47 ; room &ad, ""SOME EAT EVEN WORMS"" &2ec6 ca 4a ; room &ca, ""STORM CASTING : MUSHROOM 2 ASHES A FLEA"" &2ec8 3a 4b ; room &3a, ""THUNDER CASTING : FRUIT TWO LEGS ONE FLEA"" &2eca c7 4c ; room &c7, ""TO BE LIKE THE SUN ITSELF,PUT ONE PEARL AGAINST ASHES AND TWO FLEAS"" &2ecc 31 4d ; room &31, ""FLEAS GREAT THY MAGIC"" &2ece 4d 4e ; room &4d, ""YOU NEED A CHANGE"" &2ed0 c2 4f ; room &c2, ""THE REGULAR BUBBLE CAN'T STAND ACID"" &2ed2 2d 50 ; room &2d, ""AT MIDNIGHT I PRESUME YOU'LL FIND FOREST MUSHROOM"" &2ed4 64 51 ; room &64, ""STORM THE PHANTOM!"" &2ed6 b6 54 ; room &b6, "AN OLD MAP SHOWS >>v>!" &2ed8 be 55 ; room &be, ""FIND PASSAGES BETWEEN THE TREES"" &2eda 53 56 ; room &53, ""PASSAGES ARE INVISIBLE DOORS"" &2edc 41 58 ; room &41, ""LOOK CAREFULLY AND YOU'LL NEVER FALL"" &2ede 38 59 ; room &38, ""USE LEAVES AND ROOTS TO BREATHE"" &2ee0 78 5b ; room &78, ""USE ALEC'S ADVICE AT THE EAST END OF THIS CORRIDOR."" &2ee2 a8 5c ; room &a8, ""WISH FOR A PASS."" &2ee4 76 5d ; room &76, ""SEARCH THE IRON MAN."" &2ee6 80 5e ; room &80, ""POISON THE HUNGRY ONE."" &2ee8 42 5f ; room &42, "MY ADVICE COSTS A GOLD BAR. ANSWER WITH 'YES' IF YOU WANT IT"" + &2eea 0f 60 ; room &0f, "IN THE CELL YOU SEE MAGELORD MERLAN HE GIVES YOU A CRYSTAL BALL "THIS SOFTENS THE SUN HIT."" + &2eec 55 63 ; room &55, ""YOU'LL NEVER GET OUT!"" &2eee 20 66 ; room &20, "A PRISONER" &2ef0 21 66 ; room &21, "A PRISONER" &2ef2 22 66 ; room &22, "A PRISONER" &2ef4 23 66 ; room &23, "A PRISONER" &2ef6 24 66 ; room &24, "A PRISONER" &2ef8 47 67 ; room &47, "A TELEPORT" + &2efa cb 63 ; room &cb, ""YOU'LL NEVER GET OUT!"" &2efc 3f 6e ; room &3f, ""C'EST LA VIE!"" &2efe c3 64 ; room &c3, ""HELLO MAGELORD!"" ; set_spell_enemy_and_mushroom_state &2f00 a9 00 LDA #&00 &2f02 85 98 STA &98 ; spell_or_item_used &2f04 a9 00 LDA #&00 &2f06 8d 3a 1b STA &1b3a ; enemy_frame &2f09 a9 01 LDA #&01 &2f0b 8d 48 23 STA &2348 ; maximum_enemy_frame &2f0e ad d5 1b LDA &1bd5 ; day_or_night &2f11 f0 0a BEQ &2f1d ; no_mushroom # If it is night, &2f13 ad 56 20 LDA &2056 ; mushroom_collected &2f16 d0 05 BNE &2f1d ; no_mushroom # and the MUSHROOM hasn't been already collected, &2f18 a9 b8 LDA #&b8 # room &8b contains an object. &2f1a 4c 1f 2f JMP &2f1f ; set_mushroom_presence ; no_mushroom &2f1d a9 38 LDA #&38 # Otherwise, it doesn't. ; set_mushroom_presence &2f1f 8d 36 4e STA &4e36 ; room_8b_data + 1 &2f22 60 RTS &2f23 ea NOP ; set_specific_furniture_positions &2f24 20 50 0b JSR &0b50 ; move_furniture_then_prepare_pool &2f27 a5 9c LDA &9c ; player_room &2f29 c9 75 CMP #&75 &2f2b f0 0f BEQ &2f3c ; armour_in_room_75 # ARMOUR in room &75 &2f2d c9 18 CMP #&18 &2f2f f0 12 BEQ &2f43 ; shield_in_room_18 # and SHIELD in room &18 &2f31 c9 7e CMP #&7e &2f33 d0 15 BNE &2f4a ; leave ; picture_in_room_73 # can be interacted with &2f35 a2 16 LDX #&16 &2f37 a0 40 LDY #&40 &2f39 4c 47 2f JMP &2f47 ; to_set_furniture_position ; armour_in_room_75 &2f3c a2 09 LDX #&09 &2f3e a0 4a LDY #&4a &2f40 4c 47 2f JMP &2f47 ; to_set_furniture_position ; shield_in_room_18 &2f43 a2 1b LDX #&1b &2f45 a0 4a LDY #&4a ; to_set_furniture_position &2f47 20 b0 0b JSR &0bb0 ; set_furniture_position ; leave &2f4a 60 RTS ; replot_room_if_collected_mushroom &2f4b a5 9c LDA &9c ; player_room &2f4d c9 8b CMP #&8b ; room_where_mushroom_appears_at_night &2f4f d0 03 BNE &2f54 ; to_check_for_ingredients_in_furniture &2f51 20 31 20 JSR &2031 ; plot_room_and_player ; to_check_for_ingredients_in_furniture &2f54 4c e1 2c JMP &2ce1 ; check_for_ingredients_in_furniture ; to_kill_player_after_drained_away &2f57 d8 CLD &2f58 a9 41 LDA #&41 ; "ALL YOUR POWER HAS BEEN DRAINED AWAY!" &2f5a 20 38 25 JSR &2538 ; plot_text_string &2f5d 4c f3 19 JMP &19f3 ; kill_player ; drown_player &2f60 a9 43 LDA #&43 ; "NO AIR LEFT" &2f62 20 38 25 JSR &2538 ; plot_text_string &2f65 4c f3 19 JMP &19f3 ; kill_player ; reset_game_data &2f68 a9 10 LDA #&10 &2f6a 85 70 STA &70 ; target_address_low &2f6c a9 2e LDA #&2e ; &2e10, ingredients_data &2f6e 85 71 STA &71 ; target_address_high &2f70 a2 00 LDX #&00 ; reset_ingredients_data_loop &2f72 bd 20 48 LDA &4820,X ; backup_data &2f75 a0 00 LDY #&00 &2f77 91 70 STA (&70),Y ; target_address ; skip_to_next_location &2f79 e6 70 INC &70 &2f7b b1 70 LDA (&70),Y ; target_address &2f7d c9 00 CMP #&00 &2f7f d0 f8 BNE &2f79 ; skip_to_next_location &2f81 e6 70 INC &70 ; target_address_low &2f83 e8 INX &2f84 e0 1d CPX #&1d &2f86 d0 ea BNE &2f72 ; reset_ingredients_data_loop ; reset_other_data_loop &2f88 bd 20 48 LDA &4820,X ; backup_data &2f8b 85 70 STA &70 ; target_address_low &2f8d e8 INX &2f8e bd 20 48 LDA &4820,X ; backup_data &2f91 85 71 STA &71 ; target_address_high &2f93 e8 INX &2f94 bd 20 48 LDA &4820,X ; backup_data &2f97 91 70 STA (&70),Y ; target_address &2f99 e8 INX &2f9a e0 65 CPX #&65 &2f9c d0 ea BNE &2f88 ; reset_other_data_loop &2f9e 60 RTS &2f9f ea NOP ; backup_of_player_screen &2fa0 a8 10 00 a1 10 00 a0 10 00 a2 50 00 a9 0a aa a2 &2fb0 60 00 a1 80 00 a6 00 00 98 00 00 e0 00 00 80 00 &2fc0 00 80 00 00 00 00 2a 00 00 00 00 aa aa 08 aa aa &2fd0 00 00 00 a0 2a aa 00 2a aa 00 aa aa 00 00 00 0a &2fe0 aa aa 2a aa aa 2a a0 0a 08 0a aa 00 00 00 0a aa &2ff0 aa 02 aa aa 2a aa aa aa aa aa aa a0 2a aa aa aa ; player_sideways_frame_0_sprite &3000 00 f8 00 01 5e 00 03 55 80 05 57 c0 05 56 80 05 &3010 5d 40 05 5a 00 05 74 40 0a ea a0 0a f5 c0 0a 7f &3020 80 0a 7f 00 0a 1e c0 08 df c0 09 4f c0 0a e7 e0 &3030 12 ef e0 12 f7 e0 02 e3 e0 01 59 e0 01 7e 40 02 &3040 ff 00 02 3f 70 02 87 70 02 f8 60 05 ff 00 05 ff &3050 80 09 ff 80 0b ff 80 0b ff 80 17 ff 80 2f ff 00 ; player_up_sprite &3060 00 74 00 00 d5 00 01 d5 00 03 55 40 03 55 40 07 &3070 55 40 07 55 40 07 55 40 07 55 40 07 55 40 01 55 &3080 00 0d 55 60 1d 55 50 3c 54 68 7e 54 f4 76 54 34 &3090 76 54 b4 f7 11 da cf 93 da ef d7 ca 6f d7 d4 67 &30a0 c7 94 23 ff 08 0c 00 a0 1f ff d0 1f ff d0 1f ff &30b0 d0 1f ff d0 1f ff d0 0f ff a0 0f ff a0 07 ff 40 ; player_down_sprite &30c0 00 7e 00 00 ff 00 01 ab 00 03 55 80 02 00 80 06 &30d0 54 c0 06 aa c0 06 6c c0 06 fe c0 07 ef c0 03 c7 &30e0 80 0d bb 60 1d ff 50 3c fe 68 7e fe f4 76 fe 34 &30f0 76 7c b4 f7 39 8a c3 83 b2 fb ff 3a 7c 3f 74 7d &3100 be 74 3b 80 e8 1b bd 10 00 7d 20 1f fd d0 1f fc &3110 10 1f ff d0 1f ff d0 0f ff a0 0f ff a0 07 ff 40 ; enemy_1_frame_0_sprite BLACKWITCH &3120 02 a8 00 05 54 00 0a a0 00 15 06 00 0a 3e 00 14 &3130 60 10 0a 3e 18 54 6f 18 a8 f9 98 05 cd 18 29 c0 &3140 18 50 78 18 03 88 00 07 e0 0e 0f f0 4e 0f b5 c6 &3150 1f 77 d0 3e f7 98 3d f3 18 3e fa 18 1e 78 18 0d &3160 b8 18 03 88 18 00 50 18 05 54 00 0a a8 28 15 54 &3170 14 2a a8 28 15 54 54 2a a8 aa 55 50 55 aa a8 aa ; enemy_1_frame_1_sprite BLACKWITCH &3180 02 a8 00 05 54 00 0a a0 00 15 06 00 0a 3e 00 14 &3190 60 80 0a 3e 40 54 6f 00 a8 f9 80 05 cd 00 29 c0 &31a0 40 50 70 c0 03 98 00 07 e0 e0 0f f4 e0 0f b6 60 &31b0 1f b6 80 1f 76 c0 1f 72 c0 1f b2 c0 0f c0 c0 07 &31c0 b0 c0 03 70 c0 02 00 c0 05 50 00 0a a9 40 05 52 &31d0 a0 0a a9 40 15 54 a0 0a a9 50 15 54 a0 2a aa 50 ; enemy_2_frame_0_sprite DEATH MONK &31e0 00 00 00 0f f0 00 3f fe 00 7f fd 80 00 3e 40 00 &31f0 0f 30 00 03 88 00 01 84 01 f0 c2 07 f8 67 0f e4 &3200 2e 1f e4 1c 3f e4 18 3f e4 30 3f e4 60 7f e4 c0 &3210 7f 74 00 46 1b c0 0f db c0 1f c3 c0 3d f0 a0 3b &3220 ec 60 3b da e0 3d b2 e0 3d 6e e0 10 6e e0 0f 5e &3230 e0 07 3e e0 07 7f 40 12 1d 00 38 01 00 73 c3 80 &3240 e2 ff 80 c5 ff 80 03 ff 80 0d ff 80 0b ff 80 0d &3250 7f 80 0b ff 80 0f 7f 80 0a ff c0 17 ff c0 2a ff &3260 40 57 ff 40 2e fe c0 17 fd 80 03 fe 00 00 00 00 ; enemy_2_frame_1_sprite DEATH MONK &3270 00 00 00 00 00 00 00 fc 00 0f 03 c0 10 80 70 2f &3280 f8 08 7f cf 08 bc 01 90 61 f0 f0 87 f8 60 0f e4 &3290 60 1f e4 60 3f e4 c0 3f e4 c0 3f e5 80 7f e5 80 &32a0 7c 74 00 47 9b c0 0f db c0 1d e3 c0 3d e0 00 3b &32b0 da c0 3b db e0 3d b6 e0 3d b6 e0 1d 6e e0 0e 6e &32c0 e0 06 9f 60 05 df 40 03 dd 00 01 c1 00 06 03 80 &32d0 06 ff c0 0d bf c0 0d 5f c0 02 bf c0 0d 7f c0 0a &32e0 bf e0 0d 7f e0 0a ff e0 0d 7f f0 1a ff f0 15 ff &32f0 f0 1b ff f0 05 ff e0 07 ff 80 01 fe 00 00 00 00 ; next_baseline_section &3300 ae 76 34 LDX &3476 ; baseline_section_number &3303 e8 INX &3304 e0 07 CPX #&07 &3306 d0 02 BNE &330a &3308 a2 00 LDX #&00 &330a 8e 76 34 STX &3476 ; baseline_section_number &330d bd 6f 34 LDA &346f,X ; baseline_section_conversion_table &3310 aa TAX &3311 bd 64 34 LDA &3464,X ; baseline_section_address_table &3314 a8 TAY &3315 bd 63 34 LDA &3463,X ; baseline_section_address_table &3318 8c b9 3c STY &3cb9 ; baseline_section_start_address_high &331b 8d b8 3c STA &3cb8 ; baseline_section_start_address_low &331e 8c bb 3c STY &3cbb ; baseline_section_current_address_high &3321 8d ba 3c STA &3cba ; baseline_section_current_address_low &3324 18 CLC &3325 7d 65 34 ADC &3465,X ; baseline_section_address_table &3328 90 01 BCC &332b &332a c8 INY &332b 8d bc 3c STA &3cbc ; baseline_section_end_address_low &332e 8c bd 3c STY &3cbd ; baseline_section_end_address_high &3331 a9 00 LDA #&00 &3333 8d be 3c STA &3cbe ; baseline_rhythm_position &3336 60 RTS ; melody_section_start_address_low &3337 ef ; melody_section_start_address_high &3338 3c ; melody_section_current_address_low &3339 3f ; melody_section_current_address_high &333a 3c ; melody_section_end_address_low &333b 21 ; melody_section_end_address_high &333c 3d ; music_sound ; chan vol pitch dur &333d 03 00 01 00 29 00 02 00 ; baseline_rhythm_data ; lo hi lo hi lo hi lo lo ; 8 4 6 2 4 4 2 2 &3345 08 84 06 82 04 84 02 02 ; unused # Unused code &334d 20 50 27 JSR &2750 ; ? &3350 20 00 27 JSR &2700 ; ? &3353 20 45 10 JSR &1045 ; plot_sprite &3356 4c f3 19 JMP &19f3 ; kill_player ; unused &3359 00 00 00 00 00 00 00 ; start_game_on_leaving_entrance_room &3360 a5 9c LDA &9c ; player_room &3362 c9 f0 CMP #&f0 ; entrance_room &3364 d0 16 BNE &337c ; to_update_object_frame &3366 a5 83 LDA &83 ; player_y &3368 c9 40 CMP #&40 &336a d0 10 BNE &337c ; to_update_object_frame &336c a2 ff LDX #&ff &336e 9a TXS &336f a9 56 LDA #&56 &3371 8d c2 17 STA &17c2 ; jmp_update_object_frame_instructions + 1 &3374 a9 0a LDA #&0a ; &0a56 = update_object_frame &3376 8d c3 17 STA &17c3 ; jmp_update_object_frame_instructions + 2 &3379 4c 9a 48 JMP &489a ; start_game ; to_update_object_frame &337c 4c 56 0a JMP &0a56 ; update_object_frame &337f ea NOP &3380 ea NOP &3381 ea NOP ; set_room_colour_from_room_data &3382 a5 8b LDA &8b ; room_data_byte_four &3384 29 c0 AND #&c0 &3386 c9 40 CMP #&40 &3388 d0 0f BNE &3399 ; room_is_inside &338a ad d5 1b LDA &1bd5 ; day_or_night &338d f0 05 BEQ &3394 ; is_day &338f a9 04 LDA #&04 ; blue &3391 4c ca 33 JMP &33ca ; to_set_room_colour ; is_day &3394 a9 02 LDA #&02 ; green &3396 4c ca 33 JMP &33ca ; to_set_room_colour ; room_is_inside &3399 c9 00 CMP #&00 &339b d0 22 BNE &33bf ; room_isn't_regular &339d a5 8b LDA &8b ; room_data_byte_four &339f 29 18 AND #&18 &33a1 d0 05 BNE &33a8 &33a3 a9 06 LDA #&06 ; cyan &33a5 4c ca 33 JMP &33ca ; to_set_room_colour &33a8 c9 08 CMP #&08 &33aa d0 05 BNE &33b1 &33ac a9 05 LDA #&05 ; magenta &33ae 4c ca 33 JMP &33ca ; to_set_room_colour &33b1 c9 10 CMP #&10 &33b3 d0 05 BNE &33ba &33b5 a9 03 LDA #&03 ; yellow &33b7 4c ca 33 JMP &33ca ; to_set_room_colour &33ba a9 07 LDA #&07 ; white &33bc 4c ca 33 JMP &33ca ; to_set_room_colour ; room_isn't_regular &33bf c9 c0 CMP #&c0 &33c1 d0 05 BNE &33c8 ; room_has_lion_wall &33c3 a9 06 LDA #&06 ; cyan &33c5 4c ca 33 JMP &33ca ; to_set_room_colour ; room_has_lion_wall &33c8 a9 01 LDA #&01 ; red ; to_set_room_colour &33ca 20 ac 48 JSR &48ac ; set_room_colour &33cd 60 RTS ; room_checks_and_colour_stuff &33ce 20 49 0a JSR &0a49 ; various_room_initialisation &33d1 20 82 33 JSR &3382 ; set_room_colour_from_room_data &33d4 60 RTS ; grab_red_herring_in_first_pool &33d5 ad f8 53 LDA &53f8 ; spell_required_to_survive_pool &33d8 c9 0f CMP #&0f ; AIR BUBBLE &33da d0 08 BNE &33e4 ; nothing_there &33dc a9 48 LDA #&48 ; "I GRABBED SOMETHING" &33de 20 38 25 JSR &2538 ; plot_text_string &33e1 ee eb 4f INC &4feb ; player_inventory + 3, RED HERRING ; nothing_there &33e4 e6 9c INC &9c ; player_room &33e6 20 13 21 JSR &2113 ; plot_room_and_set_details &33e9 60 RTS ; grab_black_pearl_in_second_pool &33ea ad f8 53 LDA &53f8 ; spell_required_to_survive_pool &33ed c9 10 CMP #&10 ; BODY BUBBLE # Is this the second pool? &33ef d0 10 BNE &3401 ; wipe_right_part_of_screen # Bug: If not, leave with wiping &33f1 a9 48 LDA #&48 ; "I GRABBED SOMETHING" # (returning left into first pool goes wrong) &33f3 20 38 25 JSR &2538 ; plot_text_string &33f6 a9 02 LDA #&02 &33f8 8d f2 4f STA &4ff2 ; player_inventory + &a, BLACK PEARL &33fb c6 9c DEC &9c ; player_room &33fd 20 13 21 JSR &2113 ; plot_room_and_set_details &3400 60 RTS ; wipe_right_part_of_screen &3401 a9 0c LDA #&0c &3403 85 70 STA &70 ; sprite_width &3405 a9 6b LDA #&6b &3407 85 71 STA &71 ; sprite_address_low &3409 a9 80 LDA #&80 &340b 85 73 STA &73 ; screen_address_low &340d a9 5c LDA #&5c ; &5c80 = top middle of room screen area &340f 85 74 STA &74 ; screen_address_high &3411 20 00 10 JSR &1000 ; polymorphic_plot_sprite &3414 60 RTS ; check_if_result_is_negative &3415 b0 05 BCS &341c &3417 a9 00 LDA #&00 # Reset read address to zero &3419 91 70 STA (&70),Y ; read_address &341b 60 RTS &341c 20 3a 26 JSR &263a ; increment_text_address # Otherwise, skip two bytes &341f 20 3a 26 JSR &263a ; increment_text_address &3422 60 RTS ; redraw_room_and_reset_room_10_data &3423 20 31 20 JSR &2031 ; plot_room_and_player &3426 a9 98 LDA #&98 &3428 8d 4a 4c STA &4c4a ; room_10_data + 1 # Restore BOTTLE to room &10 &342b a9 08 LDA #&08 &342d 8d 49 4c STA &4c49 ; room_10_data # Remove left door from room &10 &3430 60 RTS ; next_melody_section &3431 ae 8d 34 LDX &348d ; melody_section_number &3434 e8 INX &3435 e0 07 CPX #&07 &3437 d0 02 BNE &343b &3439 a2 00 LDX #&00 &343b 8e 8d 34 STX &348d ; melody_section_number &343e bd 86 34 LDA &3486,X ; melody_section_conversion_table &3441 aa TAX &3442 bd 78 34 LDA &3478,X ; melody_section_address_table + 1 &3445 a8 TAY &3446 bd 77 34 LDA &3477,X ; melody_section_address_table &3449 8c 38 33 STY &3338 ; melody_section_start_address_high &344c 8d 37 33 STA &3337 ; melody_section_start_address_low &344f 8c 3a 33 STY &333a ; melody_section_current_address_high &3452 8d 39 33 STA &3339 ; melody_section_current_address_low &3455 18 CLC &3456 7d 79 34 ADC &3479,X ; melody_section_address_table + 2 &3459 90 01 BCC &345c &345b c8 INY &345c 8d 3b 33 STA &333b ; melody_section_end_address_low &345f 8c 3c 33 STY &333c ; melody_section_end_address_high &3462 60 RTS ; baseline_section_address_table ; lo hi count &3463 bf 3c 10 &3466 cf 3c 08 &3469 cf 3c 10 &346c df 3c 10 ; baseline_section_conversion_table &346f 00 00 03 06 00 00 09 ; baseline_section_number &3476 00 ; melody_section_address_table ; lo hi count &3477 ef 3c 32 &347a 21 3d 24 &347d 23 3d 38 &3480 ef 3c 30 &3483 5b 3d 4c ; melody_section_conversion_table &3486 00 00 03 06 00 09 0c ; melody_section_number &348d 00 ; unused &348e 00 00 ; plot_two_digit_number &3490 f0 06 BEQ &3498 ; to_plot_one_digit_number &3492 18 CLC &3493 69 30 ADC #&30 &3495 20 ee ff JSR &ffee ; OSWRCH ; to_plot_one_digit_number &3498 4c 9d 0b JMP &0b9d ; plot_one_digit_number ; position_cursor_for_inventory_slot_count &349b a9 86 LDA #&86 ; Text cursor position (get it) &349d 20 f4 ff JSR &fff4 ; OSBYTE &34a0 8e 9a 0b STX &0b9a ; cursor_x &34a3 a9 12 LDA #&12 &34a5 38 SEC &34a6 ed 9a 0b SBC &0b9a ; cursor_x &34a9 e9 03 SBC #&03 &34ab aa TAX &34ac ad 01 54 LDA &5401 ; inventory_slot_count &34af 29 f0 AND #&f0 &34b1 f0 01 BEQ &34b4 ; plot_spaces_for_inventory_slot_loop &34b3 ca DEX # One fewer space if double digit number ; plot_spaces_for_inventory_slot_loop &34b4 e0 00 CPX #&00 &34b6 f0 09 BEQ &34c1 ; plot_inventory_slot_count &34b8 a9 20 LDA #&20 ; " " &34ba 20 ee ff JSR &ffee ; OSWRCH &34bd ca DEX &34be 4c b4 34 JMP &34b4 ; plot_spaces_for_inventory_slot_loop ; plot_inventory_slot_count &34c1 a9 28 LDA #&28 ; "(" &34c3 20 ee ff JSR &ffee ; OSWRCH &34c6 a9 39 LDA #&39 ; (&5401, inventory_slot_count) &34c8 20 38 25 JSR &2538 ; plot_text_string &34cb 4c 61 2a JMP &2a61 ; wait_for_keypress_after_plotting_inventory_slot_count ; consider_moving_to_second_block_of_text_strings &34ce a5 7e LDA &7e ; text_address_low &34d0 c9 fd CMP #&fd &34d2 d0 0e BNE &34e2 ; to_find_text_loop &34d4 a5 7f LDA &7f ; text_address_high &34d6 c9 7f CMP #&7f ; &7ffd &34d8 d0 08 BNE &34e2 ; to_find_text_loop &34da a9 ff LDA #&ff &34dc 85 7e STA &7e ; text_address_low &34de a9 03 LDA #&03 ; &03ff &34e0 85 7f STA &7f ; text_address_high # Text strings continue at &0400 ; to_find_text_loop &34e2 4c 11 25 JMP &2511 ; find_text_loop ; move_furniture_up &34e5 ad 53 20 LDA &2053 ; furniture_y &34e8 38 SEC &34e9 e9 08 SBC #&08 &34eb 8d 53 20 STA &2053 ; furniture_y &34ee 60 RTS ; start_baseline &34ef a9 41 LDA #&41 &34f1 8d f9 3c STA &3cf9 ; melody_notes_data + 10 &34f4 a9 20 LDA #&20 &34f6 8d a8 3e STA &3ea8 ; jmp_play_baseline_instructions &34f9 a9 a7 LDA #&a7 &34fb 8d a9 3e STA &3ea9 ; jmp_play_baseline_instructions + 1 &34fe a9 3d LDA #&3d &3500 8d aa 3e STA &3eaa ; jmp_play_baseline_instructions + 2 &3503 60 RTS ; update_demon_state &3504 ad d2 1b LDA &1bd2 ; demon_state &3507 c9 05 CMP #&05 &3509 d0 03 BNE &350e ; leave &350b ee d2 1b INC &1bd2 ; demon_state ; leave &350e 60 RTS ; display_encrypted_egotrip_message_and_hang &350f a2 00 LDX #&00 ; decrypt_text_6a_loop &3511 bd 71 04 LDA &0471,X ; text_6a_data + 1 &3514 5d de 78 EOR &78de,X ; text_2d_data + 1 &3517 ea NOP &3518 9d 71 04 STA &0471,X ; text_6a_data + 1 &351b e8 INX &351c e0 09 CPX #&09 &351e d0 f1 BNE &3511 ; decrypt_text_6a_loop &3520 a9 6a LDA #&6a ; ""EGOTRIP"" &3522 20 38 25 JSR &2538 ; plot_text_string &3525 a2 00 LDX #&00 ; encrypt_text_6a_loop &3527 bd 71 04 LDA &0471,X ; text_6a_data &352a 5d de 78 EOR &78de,X ; text_2d_data + 1 &352d ea NOP &352e 9d 71 04 STA &0471,X ; text_6a_data &3531 e8 INX &3532 e0 09 CPX #&09 &3534 d0 f1 BNE &3527 ; encrypt_text_6a_loop ; endless_loop &3536 4c 36 35 JMP &3536 ; endless_loop ; keypress &3539 00 ; return_after_failure_to_collide_with_any_doors # This routine doesn't do anything useful. &353a ad 39 35 LDA &3539 ; keypress &353d c9 c8 CMP #&c8 ; * # Fixed key values, not user-defined. &353f f0 0c BEQ &354d ; towards_plot_any_change_in_player_position_up &3541 c9 e8 CMP #&e8 ; ? &3543 f0 0b BEQ &3550 ; towards_plot_any_change_in_player_position_down &3545 c9 e1 CMP #&e1 ; Z &3547 f0 0a BEQ &3553 ; towards_plot_any_change_in_player_position_left &3549 c9 c2 CMP #&c2 ; X &354b f0 09 BEQ &3556 ; towards_plot_any_change_in_player_position_right ; towards_plot_any_change_in_player_position_up &354d 4c 0a 1b JMP &1b0a ; to_plot_any_change_in_player_position_up ; towards_plot_any_change_in_player_position_down &3550 4c 1e 1b JMP &1b1e ; to_plot_any_change_in_player_position_down ; towards_plot_any_change_in_player_position_left &3553 4c 2e 1b JMP &1b2e ; plot_any_change_in_player_position ; towards_plot_any_change_in_player_position_right &3556 4c 2e 1b JMP &1b2e ; plot_any_change_in_player_position ; make_player_face_left_and_consider_doors &3559 20 eb 1a JSR &1aeb ; use_player_sideways_sprite_and_mask &355c a5 8c LDA &8c ; player_horizontal_direction &355e f0 05 BEQ &3565 ; to_check_for_collision_with_doors &3560 c6 8c DEC &8c ; player_horizontal_direction &3562 20 7a 4f JSR &4f7a ; flip_player_sideways_sprites_and_mask ; to_check_for_collision_with_doors &3565 4c 9e 1f JMP &1f9e ; check_for_collision_with_doors ; make_player_face_right_and_consider_doors &3568 20 eb 1a JSR &1aeb ; use_player_sideways_sprite_and_mask &356b a5 8c LDA &8c ; player_horizontal_direction &356d d0 05 BNE &3574 ; to_check_for_collision_with_doors &356f e6 8c INC &8c ; player_horizontal_direction &3571 20 7a 4f JSR &4f7a ; flip_player_sideways_sprites_and_mask ; to_check_for_collision_with_doors &3574 4c 9e 1f JMP &1f9e ; check_for_collision_with_doors ; more_function_key_handling &3577 c9 f1 CMP #&f1 ; f1 &3579 f0 32 BEQ &35ad ; to_look_pressed &357b c9 f2 CMP #&f2 ; f2 &357d f0 31 BEQ &35b0 ; to_inventory_pressed &357f c9 f3 CMP #&f3 ; f3 &3581 f0 30 BEQ &35b3 ; to_mix_pressed &3583 c9 94 CMP #&94 ; f4 &3585 f0 2f BEQ &35b6 ; to_cast_pressed &3587 c9 f4 CMP #&f4 ; f5 &3589 f0 2e BEQ &35b9 ; to_use_pressed &358b ad 60 1f LDA &1f60 ; menu_active &358e f0 03 BEQ &3593 ; consider_extra_keys &3590 4c ed 26 JMP &26ed ; consider_down_and_enter_if_listing_inventory ; consider_extra_keys &3593 ad 39 35 LDA &3539 ; keypress &3596 c9 f5 CMP #&f5 ; f6 &3598 f0 22 BEQ &35bc ; to_toggle_sound &359a c9 96 CMP #&96 ; f7 &359c f0 21 BEQ &35bf ; to_pause_game &359e c9 f6 CMP #&f6 ; f8 &35a0 f0 20 BEQ &35c2 ; to_decrease_music_volume &35a2 c9 f7 CMP #&f7 ; f9 &35a4 f0 1f BEQ &35c5 ; to_increase_music_volume &35a6 c9 f0 CMP #&f0 ; ESCAPE &35a8 f0 1e BEQ &35c8 ; to_restart_game_if_shift_pressed &35aa 4c 28 1a JMP &1a28 ; continue_main_game_loop ; to_look_pressed &35ad 4c 3d 21 JMP &213d ; look_pressed ; to_inventory_pressed &35b0 4c 96 36 JMP &3696 ; inventory_pressed ; to_mix_pressed &35b3 4c b9 36 JMP &36b9 ; mix_pressed ; to_cast_pressed &35b6 4c db 36 JMP &36db ; cast_pressed ; to_use_pressed &35b9 4c f5 36 JMP &36f5 ; use_pressed ; to_toggle_sound &35bc 4c 02 37 JMP &3702 ; toggle_sound ; to_pause_game &35bf 4c ce 35 JMP &35ce ; pause_game ; to_decrease_music_volume &35c2 4c 2c 27 JMP &272c ; decrease_music_volume ; to_increase_music_volume &35c5 4c 4b 27 JMP &274b ; increase_music_volume ; to_restart_game_if_shift_pressed &35c8 4c c8 26 JMP &26c8 ; restart_game_if_shift_pressed ; unused # Unused code &35cb 4c d5 26 JMP &26d5 ; to_continue_main_game_loop ; pause_game &35ce a5 ec LDA &ec ; Internal key number of most recently pressed key &35d0 d0 fc BNE &35ce ; pause_game ; wait_for_f7_to_be_pressed &35d2 a5 ec LDA &ec ; Internal key number of most recently pressed key &35d4 c9 96 CMP #&96 ; f7 &35d6 d0 fa BNE &35d2 ; wait_for_f7_to_be_pressed ; wait_for_all_keys_to_be_released_then_return_to_game &35d8 a5 ec LDA &ec ; Internal key number of most recently pressed key &35da d0 fc BNE &35d8 ; wait_for_all_keys_to_be_released_then_return_to_game &35dc 4c 28 1a JMP &1a28 ; continue_main_game_loop ; plot_control_character_05 # Control character &05 writes two newlines &35df c9 05 CMP #&05 &35e1 d0 0b BNE &35ee ; to_plot_control_character_others &35e3 a9 0d LDA #&0d &35e5 20 53 25 JSR &2553 ; plot_character &35e8 a9 0d LDA #&0d &35ea 20 53 25 JSR &2553 ; plot_character &35ed 60 RTS ; to_plot_control_character_others &35ee 4c 76 28 JMP &2876 ; plot_control_character_others ; set_polymorphic_plot_sprite_to_invert_mode &35f1 a2 00 LDX #&00 ; set_polymorphic_plot_sprite_to_invert_mode_loop &35f3 bd 67 24 LDA &2467,X ; polymorphic_plot_sprite_invert_code &35f6 9d 0e 10 STA &100e,X ; polymorphic_plot_sprite_instructions + 4 &35f9 e8 INX &35fa e0 06 CPX #&06 &35fc d0 f5 BNE &35f3 ; set_polymorphic_plot_sprite_to_invert_mode_loop &35fe 60 RTS &35ff ea NOP &3600 ea NOP &3601 ea NOP &3602 ea NOP ; invert_function_icon &3603 86 7b STX &7b ; x_position_of_inverted_icon &3605 84 7c STY &7c ; y_position_of_inverted_icon &3607 8a TXA &3608 18 CLC &3609 2a ROL A &360a 2a ROL A &360b 85 70 STA &70 ; sprite_x &360d 8a TXA &360e 18 CLC &360f 65 70 ADC &70 ; sprite_x &3611 38 SEC &3612 e9 03 SBC #&03 &3614 aa TAX &3615 a9 91 LDA #&91 &3617 c0 01 CPY #&01 &3619 f0 03 BEQ &361e ; icon_in_first_row &361b 18 CLC &361c 69 19 ADC #&19 ; icon_in_first_row &361e a8 TAY &361f 86 70 STX &70 ; sprite_x &3621 84 71 STY &71 ; sprite_y &3623 20 c8 10 JSR &10c8 ; calculate_screen_address &3626 20 f1 35 JSR &35f1 ; set_polymorphic_plot_sprite_to_invert_mode &3629 a9 04 LDA #&04 &362b 85 70 STA &70 ; sprite_width &362d a9 18 LDA #&18 &362f 85 75 STA &75 ; sprite_height &3631 20 00 10 JSR &1000 ; polymorphic_plot_sprite &3634 20 6d 37 JSR &376d ; set_polymorphic_plot_sprite_to_mask_or_overlay_depending_on_presence_of_pool &3637 60 RTS ; uninvert_icon_and_return_to_game &3638 20 48 36 JSR &3648 ; uninvert_function_icon &363b a2 01 LDX #&01 &363d a0 01 LDY #&01 &363f 20 03 36 JSR &3603 ; invert_function_icon &3642 20 f8 0b JSR &0bf8 ; wait_for_all_keys_to_be_released &3645 4c 28 1a JMP &1a28 ; continue_main_game_loop ; uninvert_function_icon &3648 a6 7b LDX &7b ; x_position_of_inverted_icon &364a a4 7c LDY &7c ; y_position_of_inverted_icon &364c 20 03 36 JSR &3603 ; invert_function_icon &364f 60 RTS ; consider_trapdoor_and_teleport &3650 20 4a 09 JSR &094a ; check_for_collision_with_trapdoor &3653 d0 03 BNE &3658 ; player_looked_at_trapdoor_or_teleport &3655 4c 79 21 JMP &2179 ; to_check_for_collision_with_furniture ; player_looked_at_trapdoor_or_teleport &3658 20 48 36 JSR &3648 ; uninvert_function_icon &365b a2 01 LDX #&01 &365d a0 01 LDY #&01 &365f 20 03 36 JSR &3603 ; invert_function_icon &3662 4c 4a 21 JMP &214a ; find_teleport_destination ; check_for_collision_with_doors &3665 a2 00 LDX #&00 ; check_for_collision_with_doors_loop &3667 bd 48 20 LDA &2048,X ; doors_x &366a bc 49 20 LDY &2049,X ; doors_y &366d 85 70 STA &70 ; tmp &366f 8a TXA &3670 a6 70 LDX &70 ; tmp &3672 85 79 STA &79 ; door_number &3674 20 10 1f JSR &1f10 ; player_collision_check &3677 d0 15 BNE &368e ; plot_door_text &3679 a6 79 LDX &79 ; door_number &367b e8 INX &367c e8 INX &367d e0 08 CPX #&08 &367f d0 e6 BNE &3667 ; check_for_collision_with_doors_loop &3681 a9 05 LDA #&05 &3683 20 53 25 JSR &2553 ; plot_character &3686 a9 33 LDA #&33 ; "NOTHING" &3688 20 38 25 JSR &2538 ; plot_text_string &368b 4c 38 36 JMP &3638 ; uninvert_icon_and_return_to_game ; plot_door_text &368e a9 6c LDA #&6c ; "A DOOR" &3690 20 38 25 JSR &2538 ; plot_text_string &3693 4c 38 36 JMP &3638 ; uninvert_icon_and_return_to_game ; inventory_pressed &3696 20 48 36 JSR &3648 ; uninvert_function_icon &3699 a2 03 LDX #&03 &369b a0 01 LDY #&01 &369d 20 03 36 JSR &3603 ; invert_function_icon &36a0 4c 90 2a JMP &2a90 ; display_strength_and_inventory ; unused &36a3 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &36b3 00 00 00 00 00 00 ; mix_pressed &36b9 20 48 36 JSR &3648 ; uninvert_function_icon &36bc a2 01 LDX #&01 &36be a0 02 LDY #&02 &36c0 20 03 36 JSR &3603 ; invert_function_icon &36c3 4c 12 2b JMP &2b12 ; choose_ingredients_to_max ; cast_air_bubble &36c6 a6 9c LDX &9c ; player_room &36c8 e0 cf CPX #&cf ; right_end_of_second_pool_room &36ca f0 03 BEQ &36cf ; inadequate_bubble &36cc 4c 22 2c JMP &2c22 ; note_spell_has_been_cast_noisily ; inadequate_bubble &36cf 48 PHA &36d0 a9 3c LDA #&3c ; "THIS BUBBLE IS NO GOOD" &36d2 20 38 25 JSR &2538 ; plot_text_string &36d5 68 PLA &36d6 85 98 STA &98 ; spell_or_item_used &36d8 4c 38 36 JMP &3638 ; uninvert_icon_and_return_to_game ; cast_pressed &36db 20 48 36 JSR &3648 ; uninvert_function_icon &36de a2 02 LDX #&02 &36e0 a0 02 LDY #&02 &36e2 20 03 36 JSR &3603 ; invert_function_icon &36e5 4c e7 2a JMP &2ae7 ; choose_spell_to_cast ; uninvert_icon_and_kill_player &36e8 20 48 36 JSR &3648 ; uninvert_function_icon &36eb a2 01 LDX #&01 &36ed a0 01 LDY #&01 &36ef 20 03 36 JSR &3603 ; invert_function_icon &36f2 4c f3 19 JMP &19f3 ; kill_player ; use_pressed &36f5 20 48 36 JSR &3648 ; uninvert_function_icon &36f8 a2 03 LDX #&03 &36fa a0 02 LDY #&02 &36fc 20 03 36 JSR &3603 ; invert_function_icon &36ff 4c b2 2a JMP &2ab2 ; choose_item_to_use ; toggle_sound &3702 a5 7a LDA &7a ; sound_muted &3704 d0 05 BNE &370b &3706 a9 01 LDA #&01 &3708 4c 0d 37 JMP &370d &370b a9 00 LDA #&00 &370d 85 7a STA &7a ; sound_muted &370f aa TAX &3710 a9 d2 LDA #&d2 ; Read/Write sound suppression flag &3712 20 f4 ff JSR &fff4 ; OSBYTE &3715 4c 06 28 JMP &2806 ; flush_sound_channel_two_then_return_to_game ; previous_room_colour &3718 06 ; rotate_through_room_colours &3719 ad ba 48 LDA &48ba ; palette_data + 1 &371c 8d 18 37 STA &3718 ; previous_room_colour &371f a9 00 LDA #&00 ; rotate_through_room_colours_loop &3721 48 PHA &3722 20 ac 48 JSR &48ac ; set_room_colour &3725 68 PLA &3726 18 CLC &3727 69 01 ADC #&01 &3729 20 41 1c JSR &1c41 ; delay_for_11176_loops &372c c9 08 CMP #&08 &372e d0 f1 BNE &3721 ; rotate_through_room_colours_loop &3730 ad 18 37 LDA &3718 ; previous_room_colour &3733 20 ac 48 JSR &48ac ; set_room_colour &3736 60 RTS ; invert_entire_room &3737 20 f1 35 JSR &35f1 ; set_polymorphic_plot_sprite_to_invert_mode &373a a0 18 LDY #&18 &373c ae 46 20 LDX &2046 ; room_start_x &373f e0 04 CPX #&04 &3741 d0 08 BNE &374b &3743 ad 45 20 LDA &2045 ; room_end_x &3746 c9 24 CMP #&24 &3748 d0 01 BNE &374b &374a e8 INX &374b 86 70 STX &70 ; sprite_x &374d 84 71 STY &71 ; sprite_y &374f 20 c8 10 JSR &10c8 ; calculate_screen_address &3752 ad 47 20 LDA &2047 ; room_height &3755 38 SEC &3756 e9 18 SBC #&18 &3758 85 75 STA &75 ; sprite_height &375a ad 45 20 LDA &2045 ; room_end_x &375d 38 SEC &375e ed 46 20 SBC &2046 ; room_start_x &3761 c9 20 CMP #&20 &3763 d0 03 BNE &3768 &3765 38 SEC &3766 e9 02 SBC #&02 &3768 85 70 STA &70 ; sprite_width &376a 20 00 10 JSR &1000 ; polymorphic_plot_sprite ; set_polymorphic_plot_sprite_to_mask_or_overlay_depending_on_presence_of_pool &376d 20 43 24 JSR &2443 ; check_if_room_has_pool &3770 d0 04 BNE &3776 ; to_set_polymorphic_plot_sprite_to_overlay_mode &3772 20 c0 4f JSR &4fc0 ; set_polymorphic_plot_sprite_to_mask_mode &3775 60 RTS ; to_set_polymorphic_plot_sprite_to_overlay_mode &3776 20 b2 4f JSR &4fb2 ; set_polymorphic_plot_sprite_to_overlay_mode &3779 60 RTS ; play_sound &377a 8d 77 27 STA &2777 ; sound_volume &377d 8e 79 27 STX &2779 ; sound_pitch &3780 8c 7b 27 STY &277b ; sound_duration &3783 a9 07 LDA #&07 ; Generate a sound (SOUND) &3785 a2 75 LDX #&75 &3787 a0 27 LDY #&27 ; &2775 = sound_data &3789 20 f1 ff JSR &fff1 ; OSWORD &378c 60 RTS ; unused &378d 00 00 00 ; player_sideways_frame_1_sprite &3790 00 f8 00 01 5e 00 03 55 80 05 57 c0 05 56 80 05 &37a0 5d 40 05 5a 00 05 74 40 0a ea a0 0a f5 c0 0a 7f &37b0 80 0a 7f 00 0a 1e c0 08 df c0 09 4f c0 0a e7 e0 &37c0 15 e7 e0 15 e3 e0 0b d9 e0 0b bd e0 0f bd e0 07 &37d0 dd e0 03 e6 60 01 db 60 02 bb b0 04 33 c0 05 c7 &37e0 c0 05 ff c0 05 ff c0 05 ff c0 05 ff c0 05 ff c0 ; scenery_sprite_01_regular TOP WALL &37f0 7a 20 00 00 75 23 fe 3e 6a 27 fe 7e 55 26 aa 62 &3800 3f e7 52 72 00 06 a2 62 3f e7 42 72 7f a6 82 62 &3810 75 27 42 72 6a 26 82 42 75 23 fe 3e 68 20 00 00 &3820 74 23 e3 fe 68 27 e7 fe 70 27 67 42 68 26 a7 a2 &3830 40 27 27 42 3f e6 a7 a2 00 07 27 42 3f e6 a7 a2 &3840 7f a7 27 42 75 26 a7 a2 7a 27 26 02 75 23 e3 fe ; scenery_sprite_02 TOP DOOR &3850 7a 20 03 03 04 20 75 23 1f 87 e2 27 6a 24 7c 4f &3860 f8 2f 55 21 f4 4d 56 2c 3f e3 e8 4a ab 0e 00 01 &3870 d7 cf 92 0c 3f 81 ac 00 c6 07 7f 3c d8 00 64 f0 &3880 74 7e 60 00 19 e8 68 f5 00 23 03 a4 74 eb 00 8c &3890 cb d4 69 d5 02 23 33 a2 71 ea 08 8c c9 d2 69 d4 &38a0 02 33 30 ea 73 a4 08 cc cc d2 6a 04 23 33 30 e2 &38b0 42 08 08 cc cc 72 31 f8 23 33 32 7c 00 f0 8c cc &38c0 cc 00 39 f8 23 33 32 7e 73 f8 8c cc cc fe 73 a8 &38d0 23 33 30 ea 73 c8 8c cc cc d2 73 a8 23 33 30 ea &38e0 73 c8 8c cc cc d2 73 a8 23 33 30 e2 63 08 8c cc &38f0 cc c2 42 08 23 33 30 c2 31 f8 68 cc cc 7e 00 f0 &3900 f3 33 32 00 31 f8 f0 cc cc 7e 73 f8 f1 33 30 fe &3910 73 e8 60 cc cc ea 63 48 01 33 30 d2 73 a8 0c cc &3920 cc ea 63 48 23 33 30 d2 73 a8 8c cc cc ea 63 48 &3930 23 33 30 d2 73 a8 8c cc cc e2 63 48 23 33 30 c2 &3940 42 08 8c cc cc c2 31 f8 23 33 32 7e 00 00 8c cc &3950 cc 00 31 f8 23 33 32 7e 73 f8 8c cc cc fe 73 a8 &3960 23 33 32 ea 73 d8 8c cc cc d2 73 a8 00 00 00 ea ; scenery_sprite_03_regular SIDE WALL (&3970 - &39af) &3970 41 73 3e 64 31 7a af 18 0d 75 55 60 e3 6a a9 78 &3980 f8 75 55 7e fe 3a a1 7e ff 8f 41 7e ff e2 81 66 ; scenery_sprite_00_regular SIDE WALL TOP (&3990 - &39cf) &3990 d7 f3 41 72 ea ba 81 6a d5 4a 41 72 48 89 81 6a &39a0 34 08 61 72 4c 09 99 6a f3 0b e6 72 fc cb f8 6a &39b0 ff 3b fe 1a ff 03 af 86 e9 3b 57 e0 d5 7d a8 f8 &39c0 e9 7f 74 3c d1 7f d8 0e e1 7f f6 02 d1 7f fd 82 ; scenery_sprite_04_regular SIDE WALL BOTTOM (&39d0 - &3a10) &39d0 c1 73 3e 62 31 7a af 1a 0d 75 55 24 03 6a a9 78 &39e0 00 75 55 7e 00 32 a1 7e 00 0d 41 76 00 03 01 6a &39f0 00 00 c1 76 00 00 31 6a 00 00 0d 76 00 00 03 6a &3a00 00 00 00 3e 00 00 00 3a 00 00 00 0e 00 00 00 00 ; scenery_sprite_05 SIDE DOOR &3a10 41 73 3e 64 31 7a af 18 0d 75 55 60 e3 6a a9 78 &3a20 f8 60 05 7e fe 1f f1 7e fe cf f9 7e f9 ef 09 66 &3a30 c7 e6 05 72 ef d6 04 6a cf 77 c5 92 5e 48 29 ca &3a40 1e b0 1b e2 5d 60 03 f2 cd 40 01 d2 c6 80 00 ca &3a50 db 00 64 ca d8 81 18 6a df 84 46 68 de 81 18 78 &3a60 da 84 66 38 da 91 19 1a da 84 66 22 da 91 99 7a &3a70 5a 84 66 78 1a 91 99 68 1a 84 66 68 c7 11 99 68 &3a80 d8 84 66 6a df 91 99 6a de 84 66 6a de 9d 99 6a &3a90 da be 66 6a da be 19 6a da 9e 66 6a 5a 80 19 2a &3aa0 1a 80 66 1a 5a 90 99 22 c7 04 66 7a d8 91 99 7a &3ab0 df 86 66 6a de 91 99 6a de 86 66 68 da 91 99 68 &3ac0 da 86 66 68 da 91 99 6a da 86 66 6a da 91 99 6a &3ad0 da 86 66 2a 1a 91 99 1a 07 06 66 20 00 11 99 78 &3ae0 00 06 66 7a 00 11 99 6a 00 06 66 6a 00 01 99 6a &3af0 00 00 66 6a 00 00 19 6a 00 00 06 6a 00 00 01 6a &3b00 00 00 00 6a 00 00 00 6a 00 00 00 1e 00 00 00 00 ; scenery_sprite_06 BOTTOM DOOR &3b10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &3b20 00 00 00 00 0f ff ff f0 3f ff ff fc ff ff ff ff ; scenery_sprite_07_teleport TELEPORT &3b30 01 ff 80 1f aa f8 75 55 5e ea aa ab d5 55 57 7a &3b40 aa ae 1f 55 f8 01 ff 80 ; scenery_sprite_08_night WINDOW &3b48 03 d1 00 00 f3 a9 1f f1 f3 51 3f f3 12 a9 35 53 &3b58 91 ff 3a 93 10 00 35 13 91 e0 0a 13 13 c0 00 13 &3b68 92 1f f0 13 10 3f f8 12 f1 ba b3 31 03 db 97 80 &3b78 e6 dc 76 e7 cf 60 07 77 1e d0 03 b2 1d a0 00 d1 &3b88 0f 40 40 62 00 40 00 01 1f 40 00 fa 1d 40 10 e9 &3b98 1b 40 38 da 1d 40 10 e9 1b 44 00 d8 dd 40 00 eb &3ba8 1b 40 00 d8 cf 40 00 79 c0 41 00 03 0f 40 08 7b &3bb8 9d 40 08 eb 1b 40 3e db 9d 44 08 eb 1b 40 08 db &3bc8 9d 40 00 eb 1b 40 00 da dd 40 00 e9 1b 40 00 d8 &3bd8 df 40 00 fb c0 00 00 03 1f f7 f7 fa 5f d7 f7 f9 &3be8 5a 96 96 aa 4f e3 e3 f1 00 00 00 00 3f e6 a7 d2 &3bf8 7f a7 27 a2 75 26 a7 d2 7a 27 26 02 75 23 e3 fe ; scenery_sprite_09 TORCH &3c08 41 73 3e 64 31 7a af 18 0d 75 55 60 e3 62 a9 78 &3c18 f8 41 55 7e fe 08 a1 7e ff 84 01 7e ff c6 01 66 &3c28 d7 cf 01 72 ea 8f 81 6a d5 4d 81 72 48 8a 81 6a &3c38 34 0d a1 72 4c 0a 99 6a f3 05 06 72 fc c2 00 6a &3c48 ff 18 c8 1a ff 1f dd 86 e9 1f f5 e0 d5 5d 68 f8 &3c58 e9 5e d0 3c d1 5d 68 0e e1 5e c6 02 d1 4d 41 82 &3c68 41 4e c0 64 31 4d 41 18 0d 4e 81 60 e3 4d 81 78 &3c78 f8 46 81 7e fe 05 81 7e ff 86 81 7e ff c3 01 66 ; scenery_sprite_0a STONE DWARF &3c88 00 f4 78 0a e3 e4 cf fa df fd b0 86 ae ba b1 c6 &3c98 aa aa b1 c6 3f fe 39 ce 9b ec d7 f4 9f fc 4c 18 &3ca8 88 08 48 0b 84 10 43 e7 85 df 44 0a 04 f4 fc ea ; baseline_section_start_address_low &3cb8 bf ; baseline_section_start_address_high &3cb9 3c ; baseline_section_current_address_low &3cba bf ; baseline_section_current_address_high &3cbb 3c ; baseline_section_end_address_low &3cbc cf ; baseline_section_end_address_high &3cbd 3c ; baseline_rhythm_position &3cbe 00 ; baseline_notes_data ; two bytes per rhythm bar, specifying low and high pitch of rhythm ; &3cbf 21 5d &3cc1 29 59 &3cc3 0d 3d &3cc5 05 35 &3cc7 21 51 &3cc9 29 59 &3ccb 0d 3d &3ccd 0d 45 ; &3ccf 35 65 &3cd1 19 49 &3cd3 21 5d &3cd5 29 59 &3cd7 2d 5d &3cd9 35 65 &3cdb 3d 6d &3cdd 3d 6d ; &3cdf 2d 5d &3ce1 2d 5d &3ce3 0d 3d &3ce5 0d 3d &3ce7 2d 5d &3ce9 2d 5d &3ceb 21 51 &3ced 29 59 ; melody_notes_data ; ; two bytes per note ; ; 1st byte 2nd byte ; 842184.. ........ duration / 4 ; ......2. ........ start baseline ; .......1 ........ channel ; ........ 842184.. pitch ; ........ ......21 volume ; &3cef 11 8a &3cf1 11 82 &3cf3 11 7a &3cf5 11 76 &3cf7 41 8e &3cf9 43 8e ; becomes 41 when baseline started &3cfb 21 8a &3cfd 11 76 &3cff 11 7a &3d01 11 82 &3d03 31 8e &3d05 11 8a &3d07 21 7a &3d09 91 6e &3d0b 11 7a &3d0d 11 76 &3d0f 11 6e &3d11 11 66 &3d13 61 5e &3d15 21 7a &3d17 61 76 &3d19 11 6e &3d1b 11 6a &3d1d b1 6e &3d1f 11 00 ; &3d21 41 00 &3d23 41 00 &3d25 31 96 &3d27 11 8e &3d29 11 8e &3d2b 21 8a &3d2d 21 8a &3d2f 11 6e &3d31 11 76 &3d33 11 7a &3d35 11 8e &3d37 21 8a &3d39 21 82 &3d3b 31 7a &3d3d 11 8a &3d3f 21 82 &3d41 21 7a &3d43 31 76 &3d45 11 82 &3d47 21 7a &3d49 21 76 &3d4b 31 6e &3d4d 11 7a &3d4f 21 72 &3d51 21 6e &3d53 31 66 &3d55 11 66 &3d57 21 6e &3d59 91 6e ; &3d5b 11 5a &3d5d 11 76 &3d5f 11 7a &3d61 11 76 &3d63 11 6e &3d65 11 7a &3d67 21 6e &3d69 21 7a &3d6b 21 8e &3d6d 51 9e &3d6f 11 76 &3d71 11 7a &3d73 11 76 &3d75 11 6e &3d77 11 7a &3d79 21 6e &3d7b 21 7a &3d7d 21 8a &3d7f 51 9e &3d81 11 76 &3d83 11 7a &3d85 11 76 &3d87 11 6e &3d89 11 7a &3d8b 21 6e &3d8d 21 5e &3d8f 21 6e &3d91 21 7a &3d93 21 8e &3d95 31 9e &3d97 11 5e &3d99 11 5a &3d9b 41 52 &3d9d 31 96 &3d9f 11 8e &3da1 11 8e &3da3 31 8a &3da5 00 00 ; play_baseline &3da7 a9 03 LDA #&03 &3da9 8d 3d 33 STA &333d ; music_sound_channel &3dac a9 00 LDA #&00 &3dae 8d 3e 33 STA &333e ; music_sound_channel_high &3db1 a9 01 LDA #&01 &3db3 8d 3f 33 STA &333f ; music_sound_volume &3db6 ae be 3c LDX &3cbe ; baseline_rhythm_position &3db9 bd 45 33 LDA &3345,X ; baseline_rhythm_data &3dbc 29 80 AND #&80 &3dbe f0 05 BEQ &3dc5 &3dc0 a0 01 LDY #&01 &3dc2 4c c7 3d JMP &3dc7 &3dc5 a0 00 LDY #&00 &3dc7 ad ba 3c LDA &3cba ; baseline_section_current_address_low &3dca 85 70 STA &70 ; note_address_low &3dcc ad bb 3c LDA &3cbb ; baseline_section_current_address_high &3dcf 85 71 STA &71 ; note_address_high &3dd1 b1 70 LDA (&70),Y ; note_address &3dd3 8d 41 33 STA &3341 ; music_sound_pitch &3dd6 ae be 3c LDX &3cbe ; baseline_rhythm_position &3dd9 bd 45 33 LDA &3345,X ; baseline_rhythm_data &3ddc 29 7f AND #&7f &3dde 8d 43 33 STA &3343 ; music_sound_duration &3de1 a9 07 LDA #&07 ; Generate a sound (SOUND) &3de3 a2 3d LDX #&3d &3de5 a0 33 LDY #&33 ; &333d = music_sound &3de7 20 f1 ff JSR &fff1 ; OSWORD &3dea ee be 3c INC &3cbe ; baseline_rhythm_position &3ded ad be 3c LDA &3cbe ; baseline_rhythm_position &3df0 c9 08 CMP #&08 &3df2 d0 26 BNE &3e1a ; not_next_baseline_bar &3df4 a9 00 LDA #&00 &3df6 8d be 3c STA &3cbe ; baseline_rhythm_position &3df9 ad ba 3c LDA &3cba ; baseline_section_current_address_low &3dfc 18 CLC &3dfd 69 02 ADC #&02 &3dff 8d ba 3c STA &3cba ; baseline_section_current_address_low &3e02 90 03 BCC &3e07 &3e04 ee bb 3c INC &3cbb ; baseline_section_current_address_high &3e07 ad ba 3c LDA &3cba ; baseline_section_current_address_low &3e0a cd bc 3c CMP &3cbc ; baseline_section_end_address_low &3e0d d0 0b BNE &3e1a ; not_next_baseline_section &3e0f ad bb 3c LDA &3cbb ; baseline_section_current_address_high &3e12 cd bd 3c CMP &3cbd ; baseline_section_end_address_high &3e15 d0 03 BNE &3e1a ; not_next_baseline_section &3e17 20 00 33 JSR &3300 ; next_baseline_section ; not_next_baseline_section ; not_next_baseline_bar &3e1a 60 RTS ; event_interrupt_routine &3e1b 08 PHP &3e1c 48 PHA &3e1d 8a TXA &3e1e 48 PHA &3e1f 98 TYA &3e20 48 PHA &3e21 a5 70 LDA &70 &3e23 48 PHA &3e24 a5 71 LDA &71 &3e26 48 PHA &3e27 a9 80 LDA #&80 ; Read I/O device or buffer status &3e29 a0 ff LDY #&ff &3e2b a2 fa LDX #&fa ; Sound output buffer 1 &3e2d 20 f4 ff JSR &fff4 ; OSBYTE &3e30 8a TXA # Redundant op &3e31 e0 05 CPX #&05 &3e33 90 66 BCC &3e9b ; skip_melody &3e35 ad 39 33 LDA &3339 ; melody_section_current_address_low &3e38 85 70 STA &70 ; note_address_low &3e3a ad 3a 33 LDA &333a ; melody_section_current_address_high &3e3d 85 71 STA &71 ; note_address_high &3e3f ea NOP &3e40 ea NOP &3e41 a0 00 LDY #&00 &3e43 b1 70 LDA (&70),Y ; note_address &3e45 29 01 AND #&01 &3e47 8d 3d 33 STA &333d ; music_sound_channel &3e4a b1 70 LDA (&70),Y ; note_address &3e4c 29 02 AND #&02 &3e4e f0 03 BEQ &3e53 ; don't_start_baseline &3e50 20 ef 34 JSR &34ef ; start_baseline ; don't_start_baseline &3e53 b1 70 LDA (&70),Y ; note_address &3e55 29 fc AND #&fc &3e57 18 CLC &3e58 4a LSR A &3e59 18 CLC &3e5a 4a LSR A &3e5b 8d 43 33 STA &3343 ; music_sound_duration &3e5e a0 01 LDY #&01 &3e60 b1 70 LDA (&70),Y ; note_address &3e62 29 03 AND #&03 &3e64 8d 3f 33 STA &333f ; music_sound_volume &3e67 b1 70 LDA (&70),Y ; note_address &3e69 29 fc AND #&fc &3e6b 8d 41 33 STA &3341 ; music_sound_pitch &3e6e a9 02 LDA #&02 &3e70 18 CLC &3e71 6d 39 33 ADC &3339 ; melody_section_current_address_low &3e74 8d 39 33 STA &3339 ; melody_section_current_address_low &3e77 ad 3a 33 LDA &333a ; melody_section_current_address_high &3e7a 69 00 ADC #&00 &3e7c 8d 3a 33 STA &333a ; melody_section_current_address_high &3e7f ad 39 33 LDA &3339 ; melody_section_current_address_low &3e82 cd 3b 33 CMP &333b ; melody_section_end_address_low &3e85 d0 0b BNE &3e92 ; not_next_melody_section &3e87 ad 3a 33 LDA &333a ; melody_section_current_address_high &3e8a cd 3c 33 CMP &333c ; melody_section_end_address_high &3e8d d0 03 BNE &3e92 ; not_next_melody_section &3e8f 20 31 34 JSR &3431 ; next_melody_section ; not_next_melody_section &3e92 a9 07 LDA #&07 ; Generate a sound (SOUND) &3e94 a2 3d LDX #&3d &3e96 a0 33 LDY #&33 ; &333d = music_sound &3e98 20 f1 ff JSR &fff1 ; OSWORD ; skip_melody &3e9b a9 80 LDA #&80 ; Read I/O device or buffer status &3e9d a0 ff LDY #&ff &3e9f a2 f8 LDX #&f8 ; Sound output buffer 3 &3ea1 20 f4 ff JSR &fff4 ; OSBYTE &3ea4 e0 05 CPX #&05 &3ea6 90 03 BCC &3eab ; skip_baseline ; jmp_play_baseline_instructions &3ea8 ea NOP &3ea9 ea NOP &3eaa ea NOP # also JSR &3da7 ; play_baseline # Once baseline has started ; skip_baseline &3eab 68 PLA &3eac 85 71 STA &71 &3eae 68 PLA &3eaf 85 70 STA &70 &3eb1 68 PLA &3eb2 a8 TAY &3eb3 68 PLA &3eb4 aa TAX &3eb5 68 PLA &3eb6 28 PLP &3eb7 60 RTS ; scenery_sprite_0d PICTURE &3eb8 ff ff ff fc ff ff ff f4 c0 00 00 08 d5 55 55 74 &3ec8 d0 00 00 68 d7 ea df 74 d7 db 6f 68 d7 db b7 74 &3ed8 d7 9b b7 68 d7 eb 6f 74 d6 12 9d 68 d6 1a 71 74 &3ee8 d6 00 03 68 d2 2a 82 74 d5 00 05 68 d2 aa aa 74 &3ef8 d5 55 55 68 d2 aa aa 74 d0 00 00 68 df ff ff f4 &3f08 ca aa aa a8 95 55 55 54 00 00 00 00 00 00 00 00 ; scenery_sprite_0e SHIELD &3f18 41 73 3e 64 31 7a af 18 0d 75 55 60 e3 6a a9 78 &3f28 f8 75 55 7e fe 3a a1 7e e1 8f 41 7e c0 e2 81 66 &3f38 c0 f3 41 72 c4 3a 81 6a c7 0a 41 72 47 89 81 6a &3f48 27 28 61 02 41 63 18 02 f1 70 c4 32 f8 78 30 72 &3f58 fc 7e 08 72 ff 7f 80 72 eb 7f 62 c0 d4 7f 1e 80 &3f68 ea 7f 06 9c d4 7f 02 0e ea 7f 02 02 d4 7f 02 02 &3f78 40 7f 02 04 30 4f 02 18 0c 43 02 00 e3 40 c2 18 &3f88 f8 40 f2 1e fe 40 fe 1e ff 40 fe 1e ff 40 fe 06 &3f98 d5 40 fe 12 e8 20 fe 2a d4 a0 fc 12 49 90 fc 2a &3fa8 31 8c fc 12 4b 02 f8 2a f3 02 80 12 fa 01 08 6a &3fb8 fc 00 0c 1a fc 00 0c 86 e8 30 06 60 d5 7c 06 38 &3fc8 e9 7f 02 3c d1 7f d8 0e e1 7f f4 02 d1 7f fd 82 ; scenery_sprite_0f ARMOUR &3fd8 41 7e 3e 64 31 70 0f 18 0d 43 c1 60 e3 07 f0 78 &3fe8 f8 0e a8 7e fc 1d 50 3e fc 0a 88 3e f8 20 28 06 &3ff8 f8 2a a8 02 f8 0a a0 0a f8 22 08 02 f0 78 50 0a &4008 31 3a a4 02 03 dd 4a 8a 0b ea 95 02 13 f0 0a 8a &4018 0d f3 e5 8a f6 f3 f3 46 fb 03 f0 40 7d 03 f9 a8 &4028 7e db fd 4c 3c b9 f1 ae 84 7a 09 42 9a 7b fb a2 &4038 0e d0 fb 44 0d e6 78 28 0d c7 3b 00 e3 c3 9b 88 &4048 f7 d1 cb 4e f7 d4 e2 8e f3 d6 75 0e f1 97 2e 06 &4058 d0 37 1e 02 e0 40 1e 0a d0 76 0d 02 40 66 63 8a &4068 30 57 d5 c2 40 66 ac 8a f0 57 54 02 f0 66 ac 0a &4078 f0 57 54 0a f0 66 a8 06 e0 53 50 00 d0 6a a8 08 &4088 e0 5b 50 0c d0 0a a0 0e e0 d4 08 02 d2 e9 a8 02 &4098 cc d5 d3 02 30 e9 a8 ca 00 55 d0 34 00 68 a8 08 &40a8 00 54 d0 0e 00 e8 a8 0e 00 d5 d0 06 01 a9 a8 0a &40b8 03 d3 50 06 03 a6 a8 0a 03 cd 50 06 00 0e 80 0a &40c8 00 00 00 0e 00 00 00 0a 00 00 00 0e 00 00 00 00 ; scenery_sprite_10 CHEST &40d8 03 f7 f7 e0 0f f7 f7 e8 24 00 00 1e 30 aa aa 86 &40e8 62 aa aa c0 62 07 e0 43 61 01 80 83 01 01 80 83 &40f8 60 80 01 03 60 80 01 03 60 aa ab 03 61 00 00 80 &4108 62 00 00 43 05 55 55 63 65 55 55 63 65 55 55 63 &4118 65 56 d5 63 65 56 d5 63 05 55 55 e0 65 55 57 e3 &4128 65 55 7f e3 65 57 ff e3 60 00 00 03 60 00 00 03 ; furniture_sprite_0f ALTAR &4138 78 00 00 1e e4 00 00 39 c4 00 00 31 c4 00 00 31 &4148 68 00 00 1a 68 00 00 1a 68 00 00 1a 68 07 f0 1a &4158 68 3f fe 1a 68 7f f9 1a 68 ff fc 9a 69 fd df 5a &4168 69 82 a0 da 6b 01 c0 6a 6b 01 c0 6a 6b 03 e0 6a &4178 69 87 70 da 69 fe 3f da 68 fc 1f 9a 68 fc 1f 9a &4188 68 fc 1f 9a 69 de bd ca 6b 6f fb 6a 64 bf fe 92 &4198 65 db 6d d6 7b d5 55 e6 7d c5 51 c6 65 c0 01 c6 &41a8 65 c0 05 c6 60 ea ab 86 62 72 a7 16 62 82 a8 16 &41b8 62 a8 2a 96 62 09 20 96 62 88 22 96 62 aa aa 96 &41c8 60 00 00 16 67 ff ff f6 60 00 00 06 7f ff ff fe ; unused_load_routine # Unused code &41d8 a2 e2 LDA #&e2 &41da a0 41 LDY #&41 ; &41e2, load_spb4 &41dc 20 f7 ff JSR &fff7 ; OSCLI &41df 4c ec 41 JMP &41ec ; main_entry_point ; load_spb4 # Unused string &41e2 4c 2e 20 53 50 42 2e 34 0d ; "L. SPB.4" ; unused &41eb 30 a9 ; main_entry_point &41ec a9 0e LDA #&0e ; Enable Event &41ee a2 00 LDX #&00 ; output buffer empty event &41f0 a0 00 LDY #&00 &41f2 20 f4 ff JSR &fff4 ; OSBYTE &41f5 a9 07 LDA #&07 &41f7 20 ee ff JSR &ffee ; OSWRCH &41fa 20 0f 50 JSR &500f ; enable_interrupt_timer &41fd 20 63 1f JSR &1f63 ; plot_player_on_entry_to_room &4200 a9 08 LDA #&08 # R8: Interlace and delay register &4202 8d 00 fe STA &fe00 # Write to video controller (register number) &4205 a9 00 LDA #&00 &4207 8d 01 fe STA &fe01 # Write to video controller (register value) &420a a9 1c LDA #&1c # Define a text window &420c 20 ee ff JSR &ffee ; OSWRCH &420f a9 12 LDA #&12 # (&12 to &24) x (&13 to &16) &4211 20 ee ff JSR &ffee ; OSWRCH &4214 a9 16 LDA #&16 &4216 20 ee ff JSR &ffee ; OSWRCH &4219 a9 24 LDA #&24 &421b 20 ee ff JSR &ffee ; OSWRCH &421e a9 13 LDA #&13 &4220 20 ee ff JSR &ffee ; OSWRCH &4223 ea NOP &4224 ea NOP &4225 ea NOP &4226 ea NOP &4227 ea NOP &4228 ea NOP &4229 ea NOP &422a ea NOP &422b ea NOP &422c ea NOP &422d ea NOP &422e ea NOP &422f ea NOP &4230 ea NOP &4231 ea NOP &4232 4c 00 1a JMP &1a00 ; main_game_loop ; activate_teleport_or_trapdoor &4235 a2 00 LDX #&00 ; check_for_trapdoor_loop &4237 bd 08 51 LDA &5108,X ; rooms_with_trapdoors &423a c5 9c CMP &9c ; player_room &423c f0 0e BEQ &424c ; room_has_trapdoor &423e e8 INX &423f e0 05 CPX #&05 &4241 d0 f4 BNE &4237 ; check_for_trapdoor_loop &4243 20 02 2a JSR &2a02 ; play_teleport_sound &4246 20 19 37 JSR &3719 ; rotate_through_room_colours &4249 4c 6b 21 JMP &216b ; teleport_player_to_destination_room ; room_has_trapdoor &424c 4c 7c 21 JMP &217c ; teleport_player_to_destination_room_via_trapdoor ; sound_and_lights_for_mixing &424f 20 51 1f JSR &1f51 ; play_sound_for_mixing &4252 20 19 37 JSR &3719 ; rotate_through_room_colours &4255 a9 00 LDA #&00 &4257 ae 04 54 LDX &5404 ; mix_position &425a 60 RTS ; failed_mix &425b a9 6d LDA #&6d ; "FAILED!" &425d 20 38 25 JSR &2538 ; plot_text_string &4260 4c 38 36 JMP &3638 ; uninvert_icon_and_return_to_game ; wait_a_while_and_uninvert_room_and_icon &4263 a2 00 LDX #&00 ; wait_loop &4265 8a TXA &4266 48 PHA &4267 20 bc 1c JSR &1cbc ; delay_for_57344_loops &426a 68 PLA &426b aa TAX &426c e8 INX &426d e0 05 CPX #&05 &426f d0 f4 BNE &4265 ; wait_loop &4271 20 37 37 JSR &3737 ; invert_entire_room &4274 4c 38 36 JMP &3638 ; uninvert_icon_and_return_to_game &4277 00 BRK ; furniture_sprite_00 TABLE &4278 00 00 07 c0 00 00 00 02 af 2a a0 00 07 d5 57 55 &4288 55 40 7e aa af aa aa aa ff 55 5f 15 55 55 ff ea &4298 af ea aa aa ff ff 55 55 55 7f a7 ff ff ea bf e9 &42a8 74 17 ff ff e1 0e 0f f0 20 20 4f f0 02 9f ff ff &42b8 f8 50 02 94 00 00 14 50 02 94 00 00 14 50 04 94 &42c8 00 00 14 48 05 34 00 00 1a 28 05 38 00 00 0e 28 &42d8 07 38 00 00 0e 38 07 10 00 00 04 38 0f 00 00 00 &42e8 00 3c 0e 00 00 00 00 1c 0e 00 00 00 00 1c 0e 00 &42f8 00 00 00 1c 0e 00 00 00 00 1c 04 00 00 00 00 08 ; furniture_sprite_01 BED &4308 00 1c 00 00 00 07 00 3a 00 00 00 0e 00 20 00 00 &4318 00 0c 00 3f 80 00 00 05 00 8f e0 00 00 05 73 f7 &4328 e0 00 00 e5 ef fb e0 00 01 d5 cf fb d7 57 bd 9d &4338 59 ff 1d bb ee a5 5e 7e 77 7e f6 a5 5f b8 df ff &4348 fe a7 53 f1 ff 7e f6 a7 50 03 bf ff fe af 5f f7 &4358 7f 7e f6 b7 55 57 ff ff fe ef 7f f6 ff 7d f4 f7 &4368 70 0f ff ff ff e7 70 0d fd fb f6 e2 70 0f ff ff &4378 fe e0 70 0e fb f7 f0 e0 70 07 ff fc 00 e0 70 00 &4388 00 00 00 e0 70 00 00 00 00 e0 20 00 00 00 00 40 ; scenery_sprite_07_trapdoor TRAPDOOR &4398 1f ff ff f8 10 00 00 08 30 00 00 0c 30 00 00 0c &43a8 70 00 00 0e 70 00 00 0e f0 00 00 0f ff ff ff ff ; furniture_sprite_02 OAK PLANT &43b8 00 00 28 00 00 00 75 c0 00 07 81 a0 00 8e 5a d0 &43c8 07 4d db 60 01 9b 0d b8 3c 06 0d 80 72 10 0d 80 &43d8 6e e8 05 80 d8 35 c2 1c b7 81 a0 1a ee 5a d1 ad &43e8 0d db 61 b6 1b 0d b8 1b 16 0d 81 08 1c 8d 8e 80 &43f8 00 45 83 5c 30 02 78 1a 60 80 e5 ad d7 40 dd b6 &4308 41 ae 30 db 3c 0d 22 d8 72 d6 84 d8 6e db 04 58 &4418 d8 6d c8 20 b0 6c 08 00 e0 6c 10 00 00 2c 50 00 &4428 00 10 20 00 00 04 20 00 00 0e 20 00 00 1f 20 00 &4438 00 1f 20 00 00 3f 90 00 00 7f cc 00 01 dd f2 00 &4448 03 b7 1b 00 07 58 8b 00 02 8d c4 00 01 02 00 00 ; scenery_sprite_01_vines TOP WALL &4458 63 d9 01 80 63 99 1d b1 63 59 3d b3 62 99 31 93 &4468 61 db 39 93 30 18 31 93 99 cd 3b 13 0b ed 07 13 &4478 8d 8d 1e 13 05 46 6f 12 f6 87 8c c1 06 1f 0c 78 &4488 cf e6 18 67 38 06 33 60 1b 46 07 6f 1b 8c 3c 6f &4498 3b 0d 3a c1 31 ed 34 d1 30 0c 3a c1 71 d8 35 91 &44a8 63 d9 39 a1 63 99 35 91 63 19 31 a1 63 19 1d bf ; furniture_sprite_03 WALL &44b8 00 07 00 1f 00 33 00 c5 01 89 07 f1 0e 31 38 53 &44c8 70 95 7f 15 fd 1d d1 15 e9 25 d1 47 e9 47 c1 c5 &44d8 7f 49 fd 49 d1 51 e9 71 d1 73 e9 53 c1 95 81 95 &44e8 7f 1d fd 15 d1 15 e9 25 d1 47 e9 45 c1 45 81 c9 &44f8 7f 49 ff 51 d1 51 e9 51 d1 73 e9 53 d1 55 c1 9d &4508 7f 1e fd 16 d1 14 e9 24 d1 28 e9 48 81 d0 7f 50 &4518 fd 60 d1 60 e9 40 d1 40 e9 80 d1 80 81 00 7f 00 ; scenery_sprite_01_lion TOP WALL &4528 bf ff ff fe d5 55 55 56 ca aa aa a8 d5 55 55 54 &4538 ca 0a a8 28 d4 40 01 14 ca e5 53 88 d4 d9 4d 84 &4548 ca d9 4d 88 d4 fc 1f 84 ca 67 f3 08 d5 71 c7 04 &4558 ca 7b ef 08 d5 7f ff 04 ca 6c 1b 08 d5 6e 3b 04 &4568 ca 6f 7b 08 d5 37 76 14 ca 96 34 28 d5 44 10 54 &4578 ca a3 e0 a8 d0 00 00 04 e0 00 00 02 bf ff ff ff ; furniture_sprite_04 BARREL &4588 00 00 00 00 00 00 00 00 00 07 fe 00 00 3f ff c0 &4598 02 f9 13 f0 29 c8 88 f8 41 c4 44 58 81 7a 22 78 &45a8 83 07 ff c4 86 a0 10 0c 87 45 45 14 87 8a 8a 8a &45b8 87 f5 45 5e 87 fe 8b fe 85 1f ff e2 86 21 fe 13 &45c8 85 15 01 47 86 2a 8a a3 85 15 45 51 86 2a 8a a3 &45d8 85 15 45 51 86 2a 8a a3 85 11 45 51 86 20 8a a3 &45e8 85 11 45 51 84 2a 8a a2 85 15 45 54 85 0a 8a a2 &45f8 85 e1 44 1e 83 fe 01 fe 82 1f ff e0 81 01 fe 0c &4608 40 8a 80 9c 20 c5 45 38 10 22 8a 70 0c 1c 03 e0 &4618 03 c3 ff 80 ; plot_room &461c 20 ce 33 JSR &33ce ; room_checks_and_colour_stuff &461f a9 00 LDA #&00 &4621 8d d2 1b STA &1bd2 ; demon_state &4624 60 RTS ; unused &4625 00 00 00 00 00 00 00 00 00 ; furniture_sprite_05 KLERE'S BODY &462e 00 00 00 00 00 00 1f 00 00 00 00 00 30 cf fe 00 &463e 00 20 43 a8 13 7f fe 90 41 60 0d bf fd d0 46 c0 &464e 3c 3f fd d7 47 01 fb bf fd d1 40 37 e3 bf f9 d1 &465e 20 79 cf bf f9 c7 20 7e 1e 7f f8 85 10 7f f9 01 &466e 04 1f 2a 47 f2 aa aa b5 55 50 05 55 55 5f aa aa &467e aa aa aa b5 81 80 80 80 81 9f 8b 8b 8b 8b 8b b5 &468e 8b 8b 8b 8b 8b 9f 8b 8b 8b 8b 8b b4 8b 8b 8b 8b &469e 8b 9c 8b 8b 8b 8b 8b b0 8b 8b 8b 8b 8b 90 bf bf &46ae bf bf bf a0 aa aa aa aa aa 80 ; furniture_sprite_06 PHANTOM &46b8 00 7c 00 00 fe 00 01 fe 00 01 ff 00 03 ff 00 03 &46c8 33 80 02 21 80 03 ff c0 03 b7 00 0b 7f 60 1a ff &46d8 78 1b ff 7c 23 fe be 23 fe c7 21 fe eb 44 fc eb &46e8 45 03 d3 5a ff b3 5c fe 73 26 fd f3 36 fd f3 76 &46f8 fa 73 76 fb 73 e6 f7 7b f6 f7 7b d6 ee 7b d6 ef &4708 73 d5 ed 4b c5 ed 53 6b ed 53 0b ec 53 43 f6 b3 &4718 42 f8 e3 42 7f 13 43 80 73 43 ff e3 43 ff d3 43 &4728 ff e3 43 ff d3 4b ff a3 53 ff e3 63 ff a7 03 ff &4738 e7 03 ff b3 03 ff 52 03 ff b8 03 ff 54 07 ff f4 &4748 07 ff 54 07 ff 32 07 ff d2 07 ff ba 07 ff ea 07 &4758 ff 5a 03 ff ac 01 ff f8 ; furniture_sprite_07_frame_0 EATING PLANT &4760 00 00 00 00 00 f8 01 01 bc 1f 83 7e 3e c2 f7 7f &4770 45 d4 97 45 80 01 a5 ab ab b7 fe ff 53 fc 7f b9 &4780 f8 3e 38 40 00 39 c0 00 29 40 00 29 40 00 29 40 &4790 03 a8 40 0f a9 d8 0d cb ec 19 4a ee 19 6d 6e 39 &47a0 ad 77 f0 ad 70 62 a5 70 06 a5 70 1e a5 70 0e e5 &47b0 78 00 67 3c 00 67 98 00 77 80 00 6f 80 00 3f 00 ; furniture_sprite_07_frame_1 EATING PLANT &47c0 00 00 00 00 00 80 18 01 fc 3f 03 fe 7f 83 ff bf &47d0 c7 d5 17 c7 00 c5 e7 aa ff f7 ff ff f3 ff 7f b9 &47e0 fc 3e 39 f8 00 29 c0 00 29 40 00 29 40 00 29 40 &47f0 03 a9 40 07 a9 40 1d 2b 40 03 ca b0 0f ed 1c 19 &4800 ad ce 18 ad 6e 38 a5 77 f0 a5 70 60 a5 70 01 e5 &4810 70 00 e7 70 00 e7 78 00 f6 3c 00 6f 18 00 3c 00 ; backup_data &4820 b7 6f ba a9 b4 9c 8c 81 75 6a 67 5d 52 cd 38 40 # Ingredient locations &4830 31 27 15 07 5c 69 91 1e 6b a3 82 47 85 &483d 4d 4c 04 ; &4c4d = &04 ; room_11_data # Remove left door from room &11 &4840 4c 49 00 ; &494c = &00 ; furniture_sprite_0a + &14 # (redundant) &4843 01 4e 04 ; &4e01 = &04 ; room_7e_data # Remove bottom door from room &7e &4846 cd 4d 04 ; &4dcd = &04 ; room_71_data # Remove top door from room &71 &4849 f9 4e 8a ; &4ef9 = &8a ; room_bc_data # Remove bottom door from room &bc &484c c5 4e a4 ; &4ec5 = &a4 ; room_af_data # Remove top door from room &af &484f 21 4d 40 ; &4d21 = &40 ; room_46_data # Remove right door from room &46 &4852 22 4d 98 ; &4d22 = &98 ; room_46_data + 1 # Restore PHANTOM to room &46 &4855 25 4d 00 ; &4d25 = &00 ; room_47_data # Remove left door from room &47 &4858 01 51 0e ; &5101 = &0e ; teleport_4d_destination # Point teleport in room &4d to &0e &485b 1e 4f a8 ; &4f1e = &a8 ; room_c5_data + 1 # Restore VAMPIRE to room &c5 &485e d2 4c 88 ; &4cd2 = &88 ; room_32_data + 1 # Restore GRAMOFOOT to room &32 &4861 ba 4d f8 ; &4dba = &f8 ; room_6c_data + 1 # Restore EATING PLANT to room &6c (redundant) &4864 a1 4e 00 ; &4ea1 = &00 ; room_a6_data # Remove right door from room &a6 &4867 a5 4e 00 ; &4ea5 = &00 ; room_a7_data # Remove left door from room &a7 &486a 36 4e b8 ; &4e36 = &b8 ; room_8b_data + 1 # Restore MUSHROOM to room &8b (redundant) &486d 59 4d 46 ; &4d59 = &46 ; room_54_data # Restore top door in room &54 to right side &4870 c1 4d 94 ; &4dc1 = &94 ; room_6e_data # Restore bottom door in room &6e to left side &4873 75 4d 25 ; &4d75 = &25 ; room_5b_data # (redundant) &4876 79 4d 08 ; &4d79 = &08 ; room_5c_data # Remove left door from room &5c &4879 82 00 10 ; &0082 = &10 ; player_x # Restore player's starting position &487c 83 00 60 ; &0083 = &60 ; player_y &487f d2 1b 00 ; &1bd2 = &00 ; demon_state # Return DEMON to BOTTLE &4882 fc 53 99 ; &53fc = &99 ; player_energy # Restore player's energy ; reset_inventory &4885 a2 00 LDX #&00 ; reset_inventory_loop &4887 a9 00 LDA #&00 &4889 9d e8 4f STA &4fe8,X ; player_inventory &488c e8 INX &488d e0 23 CPX #&23 &488f d0 f8 BNE &4889 ; reset_inventory_loop &4891 60 RTS ; restart_game &4892 a2 ff LDX #&ff &4894 9a TXS &4895 a9 65 LDA #&65 ; "ALAS, YOU QUEST HAS FAILED! (PRESS SPACE BAR)" &4897 20 38 25 JSR &2538 ; plot_text_string ; start_game &489a 20 68 2f JSR &2f68 ; reset_game_data &489d a9 55 LDA #&55 ; starting_room &489f 85 9c STA &9c ; player_room &48a1 a9 00 LDA #&00 &48a3 8d 56 20 STA &2056 ; mushroom_collected &48a6 20 23 34 JSR &3423 ; redraw_room_and_reset_room_10_data &48a9 4c 1e 28 JMP &281e ; reset_room_6c_data_and_enter_main_game_loop ; set_room_colour &48ac 8d ba 48 STA &48ba ; palette_data + 1 &48af a9 0c LDA #&0c ; Write palette &48b1 a2 b9 LDX #&b9 ; palette_data &48b3 a0 48 LDY #&48 &48b5 20 f1 ff JSR &fff1 ; OSWORD &48b8 60 RTS ; palette_data &48b9 01 05 00 00 00 ; unused &48be 00 00 ; furniture_sprite_09 GRAMOFOOT &48c0 07 80 00 0a e0 00 11 7c 00 15 7f 00 28 bf c0 28 &48d0 5f 70 50 5e 18 50 5f 8c 50 5f ce a0 5f de a0 5f &48e0 ff a0 5f ff a0 5f ff 50 5f ff 50 5f 0f 50 7e 3f &48f0 28 78 9b 28 e3 7b 15 c6 73 11 98 73 0b 60 73 07 &4900 80 73 00 00 6b 00 00 79 00 00 7b 00 00 7d 00 00 &4910 fb 00 01 f5 00 03 eb 00 07 f5 00 0f eb 00 3f d5 &4920 01 ff ab 07 ff 76 1f ff fc 2f ff e0 1f ef c0 36 &4930 df 00 0d 9c 00 03 00 00 ; furniture_sprite_0a VAMPIRE &4938 00 00 00 00 a8 00 05 54 00 0a aa 00 15 f4 00 0f &4948 fa 00 03 14 00 2f fa 80 27 f4 c0 67 fa c0 64 34 &4958 c0 61 61 c0 63 c7 40 70 1e 80 34 5d 00 37 de c0 &4968 33 8f 60 41 07 a0 19 03 d8 b9 43 a4 b9 03 d2 8d &4978 01 ea ec 01 f2 e6 45 ca e6 0d f2 e4 31 ea e3 40 &4988 f2 e7 c0 ea f7 c2 f2 c3 cc ea d1 b0 d2 d0 01 e4 &4998 d8 62 d4 de 6e e4 dd 32 d4 dd 32 e8 dd 9a d8 dd &49a8 9a f0 dd 80 d0 dd e9 f0 03 d1 e0 4d e9 c0 6d d1 &49b8 a8 2d eb 80 0c d0 00 0c 0a 1c 0c d2 00 0c ea 00 &49c8 0c d2 00 0c ea 00 0c d2 00 0c ea 00 08 82 00 0e &49d8 7c 00 1d fc 00 3b fc 00 ; furniture_sprite_0b DEMON AND BOTTLE ; furniture_sprite_0e BOTTLE (&4a61-&4aa0) &49e0 0f 80 00 10 40 00 10 20 00 26 d0 00 26 d0 00 20 &49f0 08 00 40 08 00 40 06 00 40 0f 80 40 33 e0 3f fc &4a00 f0 73 ee f8 fe f7 04 ff 70 7a bf 8f 3a bf bf 86 &4a10 4f 7f ff 37 7d df 0b 7a 06 0f b7 a0 11 cf 20 16 &4a20 70 e0 17 07 e0 17 ff e0 0f 7f e0 0e ff c0 16 ff &4a30 c0 17 bf 80 17 7f 80 0b 7f 80 02 bf 80 05 9f 80 &4a40 05 ad 00 05 fb 00 02 fb 00 01 7a 00 00 9e 00 00 &4a50 a6 00 00 bc 00 00 9c 00 00 44 00 00 28 00 00 28 &4a60 00 00 28 00 00 44 00 00 7c 00 00 5c 00 00 5c 00 &4a70 00 5c 00 00 5c 00 00 54 00 00 ae 00 01 7f 00 02 &4a80 bd 80 02 7e 80 02 fe 80 02 fe 80 02 ff 80 02 ff &4a90 80 02 ff 80 02 ff 80 02 ff 80 01 7f 00 00 fe 00 ; furniture_sprite_0c SMOKE STAGE ONE &4aa0 00 00 00 00 18 00 00 7e 00 00 cf 00 00 bf 00 01 &4ab0 b6 80 02 ef 80 05 ef 80 05 ff 80 05 fd 80 02 fd &4ac0 c0 01 5b c0 02 bf c0 02 bf c0 02 bf 80 01 9e 00 &4ad0 00 44 00 00 28 00 00 28 00 00 28 00 ; furniture_sprite_0d SMOKE STAGE TWO &4adc 00 60 00 00 98 00 01 7e 00 01 4f 00 01 7f 80 01 &4aec f6 c0 02 ef e0 05 ef e0 05 bf e0 05 7d 80 07 7d &4afc 60 0d db f0 0b ff f0 0b ff f0 1f df a0 17 de 40 &4b0c 17 bd e0 0b 79 f0 05 fb f0 0b ff e0 0b ff e0 0a &4b1c 77 e0 05 f8 c0 03 ff 80 02 ef 80 02 ef 80 02 6f &4b2c 80 01 b7 00 00 7e 00 00 28 00 00 28 00 00 28 00 ; enemy_object_data &4b3c 03 20 20 20 31 80 31 51 02 0a 03 ; enemy type 1: BLACKWITCH &4b47 03 30 30 e0 31 70 32 51 02 0a 08 ; enemy type 2: DEATHMONK &4b52 03 20 20 20 31 80 31 51 02 0a 06 ; enemy type 3: FOREST HAG &4b5d 03 18 28 a0 04 e8 04 51 02 0a 02 ; enemy type 4: WATCHER &4b68 05 18 28 30 05 a8 05 51 02 0a 05 ; enemy type 5: WINGED SKULL &4b73 03 28 28 20 06 98 06 51 02 0a 04 ; enemy type 6: CYCLOPS GUARD &4b7e 03 28 28 10 07 88 07 51 02 0a 07 ; enemy type 7: ZOMBIE ; scenery_sprite_01_stone TOP WALL &4b89 27 f0 3c 7a 63 c3 fb 75 41 0f f1 32 4c 1f e9 30 &4b99 de 9f d2 38 9f ce a2 38 9f 6f 51 18 ba 66 a0 9b &4ba9 bd 17 00 9e 3a 97 80 80 35 53 c1 3f 72 10 f1 7f &4bb9 f8 20 1e 69 b8 61 c0 d4 9e 87 f8 c8 03 0f f6 7f &4bc9 00 8f 53 70 83 e6 a1 07 e7 f7 51 1f ef b7 a1 3f &4bd9 ae 4b 41 7a 2d ab 02 75 af 99 fc 72 2f 98 00 75 ; pool_bubbles_frame_0_sprite &4be9 08 00 08 00 1c 00 7f 00 1c 00 08 40 09 f0 00 40 ; pool_bubbles_frame_1_sprite &4bf9 00 00 10 20 10 20 7c 70 11 fc 10 70 00 20 00 20 ; room_data_table ; ; four byte per room ; ; 1st byte 2nd byte 3rd byte 4th byte ; 8....... ........ ........ ........ room has left door, bottom ; .4...... ........ ........ ........ room has left door, top ; ..2..... ........ ........ ........ room has bottom door, left ; ...1.... ........ ........ ........ room has bottom door, right ; ....8... ........ ........ ........ room has right door, bottom ; .....4.. ........ ........ ........ room has right door, top ; ......2. ........ ........ ........ room has top door, right ; .......1 ........ ........ ........ room has top door, left ; ; ........ 8....... ........ ........ room has second sprite ; ........ .4...... ........ ........ room extends out to right ; ........ ..2..... ........ ........ room extends out to left ; ........ ...18... ........ ........ room size for indoor rooms: &08 = wide, &10 = tall; outdoor rooms: &10 = has LEAFs ; ........ .....421 ........ ........ enemy type: &0 = none, &1 - &7 = enemy type ; ; ........ ........ 8....... ........ room has ARMOUR ; ........ ........ .4...... ........ room has STONE DWARF ; ........ ........ ..2..... ........ room has PICTURE ; ........ ........ ...1.... ........ room has BOOKSHELVES if inside, TREEs if outside ; ........ ........ ....8... ........ room has SHIELDs ; ........ ........ .....4.. ........ room has CHEST ; ........ ........ ......2. ........ room has PRISON BARS ; ........ ........ .......1 ........ room has animated second sprite ; ; ........ ........ ........ 84...... type of top wall: &00 = regular, &40 = outside, &80 = lions, &c0 = stones ; ........ ........ ........ ..2..... room has WINDOWs along all of top wall ; ........ ........ ........ ...18... room colour for regular walls: &00 = cyan, &08 = magenta, &10 = yellow, &18 = white ; ........ ........ ........ .....4.. room has TELEPORT or TRAPDOOR ; ........ ........ ........ ......2. room has TORCHes ; ........ ........ ........ .......1 room has WINDOWS along left of top wall ; &4c09 05 9a 81 c0 ; room &00 &4c0d 80 58 0c c2 ; room &01 &4c11 00 fa 01 c0 ; room &02 &4c15 04 38 20 c2 ; room &03 &4c19 80 58 00 c2 ; room &04 &4c1d 08 38 80 c0 ; room &05 &4c21 80 da 29 c2 ; room &06 &4c25 00 78 04 c0 ; room &07 &4c29 08 5a 21 c2 ; room &08 &4c2d 44 18 a0 c0 ; room &09 &4c31 80 58 08 c2 ; room &0a &4c35 00 fa 01 c0 ; room &0b &4c39 00 38 28 c2 ; room &0c &4c3d 11 10 88 c0 ; room &0d &4c41 08 18 28 c6 ; room &0e &4c45 48 18 0a 02 ; room &0f &4c49 08 98 20 c2 ; room &10 &4c4d 04 18 80 80 ; room &11 &4c51 81 58 08 c2 ; room &12 &4c55 01 78 00 c0 ; room &13 &4c59 01 78 00 c0 ; room &14 &4c5d 01 78 04 c0 ; room &15 &4c61 01 fa 01 c0 ; room &16 &4c65 01 78 00 c0 ; room &17 &4c69 01 38 08 c2 ; room &18 &4c6d 10 18 88 c0 ; room &19 &4c71 20 da 69 c2 ; room &1a &4c75 04 38 24 c0 ; room &1b &4c79 80 48 00 c2 ; room &1c &4c7d 04 28 00 c0 ; room &1d &4c81 90 98 08 c2 ; room &1e &4c85 10 00 02 0a ; room &1f &4c89 10 00 02 0a ; room &20 &4c8d 10 00 02 0a ; room &21 &4c91 10 00 02 0a ; room &22 &4c95 10 00 02 0a ; room &23 &4c99 10 00 02 0a ; room &24 &4c9d 14 00 20 0a ; room &25 &4ca1 80 00 02 0a ; room &26 &4ca5 0a 18 2c 1a ; room &27 &4ca9 45 10 80 18 ; room &28 &4cad 80 9e ad 18 ; room &29 &4c51 09 9c 09 1a ; room &2a &4c5b 80 c9 01 00 ; room &2b &4c59 04 a9 01 02 ; room &2c &4c5d 44 18 30 18 ; room &2d &4cc1 84 08 20 1a ; room &2e &4cc5 88 9e 2d 1a ; room &2f &4cc9 41 10 80 18 ; room &30 &4ccd 0a 95 35 1a ; room &31 &4cd1 84 88 20 12 ; room &32 &4cd5 41 95 81 18 ; room &33 &4cd9 11 18 88 18 ; room &34 &4cdd 11 10 00 1a ; room &35 &4ce1 05 9c 29 1a ; room &36 &4ce5 94 96 09 1a ; room &37 &4ce9 80 18 3c 38 ; room &38 &4ced 04 00 08 17 ; room &39 &4cf1 84 08 60 3a ; room &3a &4cf5 86 08 20 1a ; room &3b &4cf9 81 9e a9 18 ; room &3c &4cfd 11 10 88 18 ; room &3d &4c01 15 00 08 1a ; room &3e &4d05 80 8c 41 1a ; room &3f &4d09 20 18 8c 14 ; room &40 &4d0d 21 18 18 09 ; room &41 &4d11 14 00 48 13 ; room &42 &4d15 50 10 80 19 ; room &43 &4d19 0a 9f 05 c2 ; room &44 &4d1d 48 9f 81 c0 ; room &45 &4d21 40 98 08 c2 ; room &46 &4d25 00 98 19 82 ; room &47 &4d29 10 98 a9 38 ; room &48 &4d2d 20 58 08 35 ; room &49 &4d31 10 58 80 39 ; room &4a &4d35 19 96 09 1a ; room &4b &4d39 84 88 01 1a ; room &4c &4d3d 40 18 c8 14 ; room &4d &4d41 09 18 08 1a ; room &4e &4d45 84 08 00 1a ; room &4f &4d49 40 18 80 14 ; room &50 &4d4d 14 97 81 00 ; room &51 &4d51 81 9f 29 00 ; room &52 &4d55 09 18 1c 00 ; room &53 &4d59 46 18 20 02 ; room &54 &4d5d 80 18 48 02 ; room &55 &4d61 48 18 0c 0a ; room &56 &4d65 41 18 00 0a ; room &57 &4d69 14 00 20 18 ; room &58 &4d6d 48 95 09 38 ; room &59 &4d71 80 00 00 15 ; room &5a &4d75 25 18 80 18 ; room &5b &4d79 08 98 08 02 ; room &5c &4d7d 41 98 84 00 ; room &5d &4d81 01 00 00 0e ; room &5e &4d85 10 96 89 00 ; room &5f &4d89 20 98 08 00 ; room &60 &4d8d 11 10 00 02 ; room &61 &4d91 08 18 20 0e ; room &62 &4d95 44 18 84 10 ; room &63 &4d99 a4 18 10 0a ; room &64 &4d9d 84 18 88 08 ; room &65 &4da1 84 18 08 08 ; room &66 &4dab 81 9f 85 08 ; room &67 &4da9 10 00 08 02 ; room &68 &4dad 01 90 00 02 ; room &69 &4db1 22 9e 85 00 ; room &6a &4db5 20 d8 10 40 ; room &6b &4db9 00 f8 11 40 ; room &6c &4dbd 08 38 10 40 ; room &6d &4dc1 94 88 00 02 ; room &6e &4dc5 4a 18 0c 02 ; room &6f &4dc9 40 18 0c 00 ; room &70 &4dcd 04 18 80 08 ; room &71 &4dd1 84 08 00 0a ; room &72 &4dd5 84 00 00 0a ; room &73 &4dd9 a0 10 28 08 ; room &74 &4ddd 08 98 8c 00 ; room &75 &4de1 51 10 10 02 ; room &76 &4de5 1a 18 00 02 ; room &77 &4de9 80 48 40 1a ; room &78 &4ded 00 ee 01 18 ; room &79 &4df1 04 28 00 1a ; room &7a &4df5 85 8d 01 1a ; room &7b &4df9 90 48 00 1a ; room &7c &4dfd 00 ee 01 18 ; room &7d &4e01 04 28 20 1a ; room &7e &4e05 45 18 84 00 ; room &7f &4e09 88 18 18 02 ; room &80 &4e0d 40 18 a4 00 ; room &81 &4e11 08 98 08 02 ; room &82 &4e15 a5 8c 01 02 ; room &83 &4e19 50 18 28 00 ; room &84 &4e1d 04 80 00 13 ; room &85 &4e21 84 08 00 13 ; room &86 &4e25 42 98 08 11 ; room &87 &4e29 11 10 88 00 ; room &88 &4e2d 00 58 10 40 ; room &89 &4e31 00 78 10 40 ; room &8a &4e35 00 b8 10 40 ; room &8b &4e39 24 18 84 00 ; room &8c &4e3d 80 58 10 40 ; room &8d &4e41 00 38 10 40 ; room &8e &4e45 04 98 80 00 ; room &8f &4e49 91 10 00 02 ; room &90 &4e4d 02 98 88 00 ; room &91 &4e51 00 58 10 40 ; room &92 &4e55 00 fb 11 40 ; room &93 &4e59 10 38 10 40 ; room &94 &4e5d 11 10 00 02 ; room &95 &4e61 00 58 10 40 ; room &96 &4e65 00 78 10 40 ; room &97 &4e69 00 f5 11 40 ; room &98 &4e6d 00 78 10 40 ; room &99 &4e71 00 f3 11 40 ; room &9a &4e75 00 38 10 40 ; room &9b &4e79 04 98 0c 22 ; room &9c &4e7d 94 90 00 03 ; room &9d &4e81 90 00 20 00 ; room &9e &4e85 00 58 10 40 ; room &9f &4e89 00 f8 10 40 ; room &a0 &4e8d 04 38 10 40 ; room &a1 &4e91 95 10 08 00 ; room &a2 &4e9b 80 d8 00 40 ; room &a3 &4e99 00 38 00 40 ; room &a4 &4e9d 00 58 10 40 ; room &a5 &4ea1 00 5b 11 40 ; room &a6 &4ea5 00 58 10 c2 ; room &a7 &4ea9 00 38 10 c4 ; room &a8 &4ead 04 00 04 08 ; room &a9 &4eb1 48 99 0d 08 ; room &aa &4eb5 41 10 08 08 ; room &ab &4eb9 00 00 20 14 ; room &ac &4ebd 04 98 10 0a ; room &ad &4ec1 84 08 00 82 ; room &ae &4ec5 a4 9c 0d 00 ; room &af &4ec9 84 08 00 82 ; room &b0 &4ecd 80 18 a4 08 ; room &b1 &4ed1 09 94 09 08 ; room &b2 &4ed5 41 dc 21 08 ; room &b3 &4ed9 00 fc 05 08 ; room &b4 &4edd 00 30 08 0a ; room &b5 &4ee1 08 99 31 08 ; room &b6 &4ee5 40 58 84 08 ; room &b7 &4ee9 14 59 81 08 ; room &b8 &4eed 81 00 00 0a ; room &b9 &4ef1 04 18 04 2a ; room &ba &4ef5 84 08 00 82 ; room &bb &4ef9 8a 9c 09 02 ; room &bc &4efd 84 08 00 82 ; room &bd &4f01 40 98 10 0a ; room &be &4f05 11 10 80 08 ; room &bf &4f09 11 10 88 08 ; room &c0 &4f0d 00 99 09 3a ; room &c1 &4f11 01 10 18 0a ; room &c2 &4f15 08 18 c8 28 ; room &c3 &4f19 80 48 00 31 ; room &c4 &4f1d 04 a8 00 33 ; room &c5 &4f21 90 00 00 05 ; room &c6 &4f25 00 9a 19 24 ; room &c7 &4f29 00 58 88 25 ; room &c8 &4f2d 00 f8 00 21 ; room &c9 &4f31 00 38 1c 21 ; room &ca &4f35 00 18 c8 2c ; room &cb &4f39 10 18 28 17 ; room &cc &4f3d 28 18 ac 28 ; room &cd &4f41 80 c9 01 23 ; room &ce &4f45 10 a9 09 23 ; room &cf ; unused_routine_to_print_encrypted_string &4f49 4f 00 20 *LSE &2000 # Unofficial opcode, LSR &2000; EOR &2000 &4f4c a2 0a LDX #&0a &4f4e 4f 20 20 *LSE &2020 # Unofficial opcode, LSR &2020; EOR &2020 ; decrypt_string_loop &4f51 bd 5e 4f LDA &4f5e,X ; encrypted_string - &a &4f54 4f 20 20 *LSE &2020 # Unofficial opcode, LSR &2020; EOR &2020 &4f57 49 07 EOR #&07 &4f59 ea NOP &4f5a 20 ee ff JSR &ffee ; OSWRCH &4f5d 4f 00 20 *LSE &2000 # Unofficial opcode, LSR &2000; EOR &2000 &4f60 e8 INX &4f61 33 20 *RLA (&20),Y # Unofficial opcode, ROL (&20),Y; AND (&20),Y &4f63 e0 1c CPX #&1c &4f65 d0 ea BNE &4f51 ; decrypt_string_loop &4f67 60 RTS ; encrypted_string &4f68 42 53 46 49 27 21 27 43 46 49 27 54 4f 4e 55 55 ; "ETAN & DAN SHIRRON" (eor-ed with &07) &4f78 48 49 ; flip_player_sideways_sprites_and_mask &4f7a 20 7d 27 JSR &277d ; flip_player_sprites &4f7d ea NOP &4f7e ea NOP &4f7f ea NOP &4f80 20 bf 0f JSR &0fbf ; use_player_sprite_with_mask &4f83 a9 56 LDA #&56 &4f85 85 71 STA &71 ; sprite_address_low &4f87 a9 56 LDA #&56 ; &5656 = player_sideways_mask &4f89 85 72 STA &72 ; sprite_address_high &4f8b 20 c3 11 JSR &11c3 ; flip_sprite &4f8e 60 RTS ; plot_player_then_object_later &4f8f a9 13 LDA #&13 ; Wait for Vertical Retrace &4f91 20 f4 ff JSR &fff4 ; OSBYTE &4f94 20 41 1c JSR &1c41 ; delay_for_11176_loops &4f97 20 04 12 JSR &1204 ; restore_screen_behind_player &4f9a 20 1e 12 JSR &121e ; copy_screen_behind_player &4f9d 20 f2 11 JSR &11f2 ; plot_player &4fa0 a9 13 LDA #&13 ; Wait for Vertical Retrace &4fa2 20 f4 ff JSR &fff4 ; OSBYTE &4fa5 20 41 1c JSR &1c41 ; delay_for_11176_loops &4fa8 20 6c 12 JSR &126c ; restore_screen_behind_object &4fab 20 86 12 JSR &1286 ; copy_screen_behind_object &4fae 20 5a 12 JSR &125a ; plot_object &4fb1 60 RTS ; set_polymorphic_plot_sprite_to_overlay_mode &4fb2 a2 00 LDX #&00 ; set_polymorphic_plot_sprite_to_overlay_mode_loop &4fb4 bd ce 4f LDA &4fce,X ; polymorphic_plot_sprite_overlay_instructions &4fb7 9d 0a 10 STA &100a,X ; polymorphic_plot_sprite_instructions &4fba e8 INX &4fbb e0 0a CPX #&0a &4fbd d0 f5 BNE &4fb4 ; set_polymorphic_plot_sprite_to_overlay_mode_loop &4fbf 60 RTS ; set_polymorphic_plot_sprite_to_mask_mode &4fc0 a2 00 LDX #&00 ; set_polymorphic_plot_sprite_to_mask_mode_loop &4fc2 bd d8 4f LDA &4fd8,X ; polymorphic_plot_sprite_mask_instructions &4fc5 9d 0a 10 STA &100a,X ; polymorphic_plot_sprite_instructions &4fc8 e8 INX &4fc9 e0 0a CPX #&0a &4fcb d0 f5 BNE &4fc2 ; set_polymorphic_plot_sprite_to_mask_mode_loop &4fcd 60 RTS ; polymorphic_plot_sprite_overlay_instructions &4fce a4 76 LDY &76 ; screen_offset &4fd0 b1 73 LDA (&73),Y ; screen_address &4fd2 a0 00 LDY #&00 &4fd4 11 71 ORA (&71),Y ; sprite_address &4fd6 a4 76 LDY &76 ; screen_offset ; polymorphic_plot_sprite_mask_instructions &4fd8 a0 00 LDY #&00 &4fda b1 71 LDA (&71),Y ; sprite_address &4fdc a4 76 LDY &76 ; screen_offset &4fde c9 00 CMP #&00 &4fe0 f0 02 BEQ &4fe4 ; skip_byte ; use_mask_mode_and_prepare_pool &4fe2 20 c0 4f JSR &4fc0 ; set_polymorphic_plot_sprite_to_mask_mode &4fe5 4c 96 23 JMP &2396 ; prepare_pool_bubbles ; player_inventory &4fe8 00 ; BURNED ASHES &4fe9 00 ; SULPHUR &4fea 00 ; TOAD LEGS &4feb 00 ; RED HERRING &4fec 00 ; OAK LEAVES &4fed 00 ; FLEAS &4fee 00 ; WINE &4fef 00 ; WORMS &4ff0 00 ; GOLDEN FRUIT &4ff1 00 ; BLUE MUSHROOM &4ff2 00 ; BLACK PEARL &4ff3 00 ; DRIED ROOTS &4ff4 00 ; HEAL * &4ff5 00 ; FULL HEAL * &4ff6 00 ; AIR BUBBLE * &4ff7 00 ; BODY BUBBLE * &4ff8 00 ; SUN HIT * &4ff9 00 ; FREEZE * &4ffa 00 ; DEEP FREEZE * &4ffb 00 ; AIR SHIELD * &4ffc 00 ; WIND SHIELD * &4ffd 00 ; STORM HIT * &4ffe 00 ; THUNDER HIT * &4fff 00 ; POISONED WORMS &5000 00 ; LUTE &5001 00 ; GOLDEN CROSS &5002 00 ; TELECHANGE &5003 00 ; CRYSTAL BALL &5004 00 ; CORK &5005 00 ; METAL DISK &5006 00 ; GOLDEN CROWN &5007 00 ; TAP &5008 00 ; MORTAR&PESTLE &5009 00 ; unused # Unused inventory slot &500a 00 ; GOLDEN BAR &500b 00 ; unused # Unused inventory slot ; unused &500c 00 00 00 ; enable_interrupt_timer &500f ad 6e fe LDA &fe6e ; Interrupt control register &5012 09 c0 ORA #&c0 # Enable Timer 1 &5014 8d 6e fe STA &fe6e ; Interrupt control register &5017 ad 6b fe LDA &fe6b ; Auxiliary control register # Enable latching on port B, &501a 09 fe ORA #&fe # continuous interrupts, count down with pulses, &501c 8d 6b fe STA &fe6b ; Auxiliary control register # shift out under control of external clock &501f a9 ff LDA #&ff &5021 8d 64 fe STA &fe64 ; Timer 1 latch/counter LSB &5024 8d 65 fe STA &fe65 ; Timer 1 latch/counter MSB &5027 60 RTS ; unused &5028 00 00 ; object_table ; r t x y &502a 48 0f 12 40 ; room &48 ; ALTAR &502e 10 0e 12 5b ; room &10 ; BOTTLE &5032 1e 02 11 50 ; room &1e ; PLANT &5036 32 09 12 48 ; room &32 ; GRAMOFOOT &503a 46 06 1a 44 ; room &46 ; PHANTOM &503e 47 05 11 60 ; room &47 ; KLERE'S BODY &5042 60 00 11 5a ; room &60 ; TABLE &5046 4a 84 1a 44 ; room &4a ; BARREL (reversed) &504a 4c 03 13 38 ; room &4c ; WALL &504e 6c 07 13 50 ; room &6c ; EATING PLANT &5052 6b 02 09 50 ; room &6b ; PLANT &5056 6d 02 0a 44 ; room &6d ; missing (PLANT) &505a 6e 03 13 38 ; room &6e ; WALL &505e 5c 00 11 5a ; room &5c ; TABLE &5062 5d 00 14 58 ; room &5d ; TABLE &5066 60 00 11 5a ; room &60 ; TABLE &506a c5 0a 19 34 ; room &c5 ; VAMPIRE &506e c9 0f 12 40 ; room &c9 ; ALTAR &5072 be 00 0b 54 ; room &be ; TABLE &5076 a0 02 08 50 ; room &a0 ; PLANT &507a a1 02 1c 50 ; room &a1 ; missing (PLANT) &507e a3 02 0c 50 ; room &a3 ; PLANT &5082 8b 10 12 64 ; room &8b ; MUSHROOM (at night) &5086 9c 81 1d 68 ; room &9c ; BED (reversed) &508a 8f 01 05 68 ; room &8f ; BED &508e 82 01 05 68 ; room &82 ; BED &5092 75 81 19 58 ; room &75 ; BED (reversed) &5096 85 01 0f 50 ; room &85 ; BED &509a 9d 04 09 58 ; room &9d ; BARREL &509e 69 84 16 44 ; room &69 ; BARREL (reversed) &50a2 ad 00 10 58 ; room &ad ; TABLE &50a6 91 04 0d 40 ; room &91 ; BARREL &50aa 93 00 11 5a ; room &93 ; missing (TABLE) &50ae 87 00 0d 54 ; room &87 ; TABLE &50b2 ad 00 11 5a ; room &ad ; TABLE (again) &50b6 55 00 0b 54 ; room &55 ; missing (TABLE) ; check_if_demon_is_emerging &50ba ad d2 1b LDA &1bd2 ; demon_state &50bd f0 04 BEQ &50c3 ; leave_with_zero &50bf c9 06 CMP #&06 &50c1 90 03 BCC &50c6 ; leave_with_one ; leave_with_zero &50c3 a9 00 LDA #&00 &50c5 60 RTS ; leave_with_one &50c6 a9 01 LDA #&01 &50c8 60 RTS ; unused &50c9 00 00 00 00 00 00 00 00 00 ; special_entry_position_table ; r x y &50d2 8c 0c 60 ; room &8c &50d5 c9 1c 60 ; room &c9 &50d8 0c 15 40 ; room &0c &50db 11 15 40 ; room &11 &50de 55 1f 5a ; room &55 &50e1 10 1f 58 ; room &10 ; unused &50e4 00 00 01 00 ; teleport_destination_table ; r d &50e8 c8 34 ; room &c8 to &34 &50ea 39 84 ; room &39 to &84 &50ec 0e 4d ; room &0e to &4d &50ee c7 7b ; room &c7 to &7b &50f0 cc c7 ; room &cc to &c7 &50f2 cb c1 ; room &cb to &c1, trapdoor &50f4 a8 19 ; room &a8 to &19, trapdoor &50f6 40 7b ; room &40 to &7b &50f8 50 59 ; room &50 to &59 &50fa 62 cb ; room &62 to &cb &50fc 5e 5f ; room &5e to &5f, trapdoor &50fe ac c2 ; room &ac to &c2 &5100 4d 0e ; room &4d to &0e ; unused &5102 00 00 00 00 00 00 ; rooms_with_trapdoors &5108 5e cb a8 00 00 ; unused &510d 00 ; passages_table ; r d x y &510e a5 02 08 60 ; room &a5 bottom to &98 &5112 98 00 08 46 ; room &98 top to &a5 &5116 97 02 08 60 ; room &97 bottom to &8a &511a 8a 00 08 46 ; room &8a top to &97 &511e 9f 02 10 60 ; room &9f bottom to &92 &5122 92 00 10 46 ; room &92 top to &9f &5126 9b 02 19 60 ; room &9b bottom to &8e &512a 8e 00 18 46 ; room &8e top to &9b &512e ab 04 1a 58 ; room &ab right to &ac &5132 ac 06 0d 4c ; room &ac left to &ab ; scenery_sprite_11 UNDERGROWTH &5136 63 d9 01 80 63 99 1d b1 63 59 3d b3 62 99 31 93 &5146 61 db 39 93 30 18 31 93 99 cd 3b 13 0b ed 07 13 &5156 8d 8d 1e 13 05 46 6b 12 f0 87 90 c0 00 18 42 08 &5166 10 44 cb 0a 11 6c db 1a 53 6c db 9a db 6e d9 ba &5176 db 66 dd ba db 76 dd b2 db b6 cd b6 fb be ef ba &5186 db f0 ef bf 0f 0f 0f b8 e0 70 f0 07 1f 80 0f f8 ; scenery_sprite_12 TREE BODY ; scenery_sprite_13 TREE BOTTOM starts at 519e &5196 88 22 88 22 88 22 88 22 88 88 88 88 22 22 22 22 &51a6 88 88 88 88 22 22 22 22 &51ae 88 88 88 88 22 22 22 22 88 88 88 9a 22 22 1e 5d &51be 88 88 b8 8e 22 22 2a 47 8c c8 c8 87 e3 33 2f 03 &51ce 6c cc c6 80 1e 33 0d 00 03 8c 0a 00 00 00 1c 00 ; scenery_sprite_14 TREE LEFT &51de 88 e2 22 32 88 8a 22 2a 88 8a 22 2a 88 8c 22 34 &51de 8c e4 23 d4 88 a4 22 34 88 94 22 34 88 8c 22 28 &51fe 88 90 22 11 88 e1 27 d1 89 50 23 50 89 50 23 50 &520e 8a 22 2c 22 84 22 24 22 88 22 36 42 cf 44 9f 44 ; zorn_magic_frame_0_sprite &521e 0e 00 1d 00 19 00 2e 00 10 6e 0f dd 01 99 3b 0e &522e 74 00 64 00 38 00 00 00 ; zorn_magic_frame_1_sprite &5236 00 00 00 38 00 74 06 64 39 38 74 84 64 fc 39 80 &5246 02 70 02 e8 00 c8 00 70 ; furniture_sprite_10 MUSHROOM &524e 07 e0 1a b8 77 54 ea ea dd 5d 6a ea 15 50 07 e0 &525e 07 e0 07 e0 07 e0 03 c0 ; play_death_sound_and_restart_game &5266 20 61 28 JSR &2861 ; play_death_sound &5269 4c 92 48 JMP &4892 ; restart_game ; unused &526c 00 00 ; scenery_sprite_03_vines SIDE WALL (&526e - &52cb) &526e 41 22 2a 64 31 2a 2b 18 0d 22 2d 60 e3 2a 29 78 &527e f8 22 55 7e fe 42 55 7e ff 44 65 7e ff 44 64 66 ; scenery_sprite_00_vines SIDE WALL TOP (&528e - &52cb) &528e d6 54 52 72 ea b4 92 6a d4 84 92 72 48 88 91 6a &529e 34 88 a9 72 4c 88 a9 6a f2 8a aa 72 fc 8a a8 6a &52ae fd 08 88 1a fd 11 25 86 e9 11 55 e0 d5 55 24 f8 &52be e9 52 74 3c d1 52 c8 0e e1 52 68 02 d1 52 69 82 ; scenery_sprite_04_vines SIDE WALL BOTTOM (&52ce - &530d) &52ce c2 52 2a 62 24 52 ab 1a 08 52 4d 24 13 52 a9 78 &52de 10 52 49 7e 10 12 a9 7e 0e 26 49 76 01 03 09 6a &52ee 1c c2 c5 76 60 62 35 6a 80 0c 05 76 00 78 05 6a &52fe 00 84 04 3e 01 03 02 3a 06 00 c1 8e 00 00 00 00 ; scenery_sprite_15 LEAF &530e 0f cf c0 38 6c 30 07 93 c0 3c 6c 78 e3 6f 8e 3e &531e 6c f8 00 28 00 00 10 00 ; scenery_sprite_08_day WINDOW &5326 03 d1 00 00 f3 a9 1f f1 f3 51 3f f3 12 a9 35 53 &5336 91 ff 3a 93 10 00 35 13 91 e0 0a 13 13 c0 00 13 &5346 92 1f f0 13 10 3f f8 12 f1 ba b3 31 03 db 97 80 &5356 e6 dc 76 e7 cf 60 07 77 1e c7 f3 b2 1d 90 00 d1 &5366 0f 31 54 62 00 6a aa 01 1f 65 40 fa 1d 08 0e e9 &5376 1b 41 f6 da 1d 63 fe e9 1b 61 fe d8 dd 68 3e eb &5386 1b 6f 1e d8 cf 6f 80 79 c0 6f 14 03 0f 0e 2a 7b &5396 9d 40 54 eb 1b 6a aa db 9d 65 54 eb 1b 6a aa db &53a6 9d 65 54 eb 1b 6a aa da dd 65 54 e9 1b 6a aa d8 &53b6 df 65 54 fb c0 00 00 03 1f f7 f7 fa 5f d7 f7 f9 &53c6 5a 96 96 aa 4f e3 e3 f1 00 00 00 00 3f e6 a7 42 &53d6 7f a7 26 82 75 26 a7 42 7a 27 26 02 75 23 e3 fe ; scenery_sprite_16 POOL SIDE &53e6 03 1f 06 06 1d 0d 3d 0d 1a 7a 1a 1a f4 34 74 34 &53f6 02 ; pool_start_position &53f7 14 ; spell_required_to_survive_pool &53f8 0f ; text_id &53f9 64 ; text_character &53fa 02 ; input_matches_text &53fb 00 ; player_energy &53fc 99 ; text_id_for_object_looked_at &53fd 27 ; timer &53fe 42 02 00 ; inventory_slot_count &5401 01 ; current_inventory_slot &5402 13 ; maximum_inventory_slot_to_consider &5403 17 ; mix_position &5404 03 ; unused &5405 00 ; scenery_sprite_17 TREE TRUNK &5406 88 88 ba 2e 22 22 28 a7 88 88 aa 07 a2 22 08 83 &5416 68 88 86 a0 1b 64 0d 2c 03 be 8a 78 10 ee 9c 50 &5426 1e 9a 40 92 4f 3d c7 62 e3 ff c5 c2 e3 ff ed 02 &5436 f9 fb f5 12 05 fb d6 12 64 ff ba 13 64 ff aa 10 &5446 64 7f ac 00 64 7b a4 11 64 7b 24 13 60 7f 44 13 &5456 60 76 54 13 30 7d 54 13 98 7d 54 13 08 74 c4 13 &5466 8c 7a 84 13 04 77 84 12 f4 72 94 01 04 76 b4 18 &5476 cc 75 84 07 38 6a 94 10 84 6d 54 12 54 75 04 12 &5486 94 65 04 12 10 6a ac 12 f0 ec 8a 13 00 fd 02 00 &5496 00 f5 52 00 00 f5 55 00 0e bd 45 40 3d f6 01 78 &54a6 71 d6 b7 1c 03 96 aa 80 07 fc a9 e2 3f 94 4f 1d &54b6 7f 38 30 83 38 30 0f fe 00 00 00 00 00 00 00 00 ; scenery_sprite_18 ZORN &54c6 00 fc e0 04 01 86 20 0e 1b 3d 20 1d e3 45 60 19 &54d6 87 45 20 19 96 4d 20 0e e6 4d 20 06 86 4d 20 04 &54e6 86 5a a0 03 8e 22 c0 0b 9c 14 60 3b 9c 14 60 da &54f6 b8 14 31 90 ba 08 3f 12 ba 09 0e 16 ba 00 84 16 &5506 ba 00 c0 16 b2 00 b0 d6 b1 00 8f 36 b0 c0 98 16 &5516 a0 3c 66 06 b8 16 11 86 bf 97 08 86 ae 57 04 86 &5526 bb b7 02 86 9e 9b 02 86 97 88 02 86 95 c0 02 86 &5536 95 a0 02 86 95 b0 02 86 95 b0 02 86 95 b8 02 86 &5546 95 b8 02 86 85 bc 02 86 e1 9e 02 80 39 9f 86 00 &5556 0e 93 fa 00 03 8c 04 00 00 83 f8 00 00 00 00 00 ; scenery_sprite_data_table ; addr w h &5566 90 39 04 10 ; scenery sprite &00 SIDE WALL TOP (regular) #also 8e 52 04 10 ; (vines) &556a f0 37 04 18 ; scenery sprite &01 TOP WALL (regular) #also 58 44 04 18 ; (vines) # or 28 45 04 18 ; (lion) # or 89 4b 04 18 ; (stone) &556e 50 38 06 30 ; scenery sprite &02 TOP DOOR &5572 70 39 04 18 ; scenery sprite &03 SIDE WALL (regular) #also 6e 52 04 18 ; (vines) &5576 d0 39 04 10 ; scenery sprite &04 SIDE WALL BOTTOM (regular) #also ce 52 04 10 ; (vines) &557a 10 3a 04 40 ; scenery sprite &05 SIDE DOOR &557e 10 3b 04 08 ; scenery sprite &06 BOTTOM DOOR &5582 30 3b 03 08 ; scenery sprite &07 TELEPORT #also 98 43 04 08 ; TRAPDOOR &5586 48 3b 04 30 ; scenery sprite &08 WINDOW (day) #also 26 53 04 08 ; (night) &558a 08 3c 04 20 ; scenery sprite &09 TORCH &558e 88 3c 02 18 ; scenery sprite &0a STONE DWARF &5592 00 0d 04 38 ; scenery sprite &0b BOOKSHELVES &5596 e0 0d 06 30 ; scenery sprite &0c PRISON BARS &559a b8 3e 04 18 ; scenery sprite &0d PICTURE &559e 18 3f 04 30 ; scenery sprite &0e SHIELD &55a2 d8 3f 04 40 ; scenery sprite &0f ARMOUR &55a6 d8 40 04 18 ; scenery sprite &10 CHEST &55aa 36 51 04 18 ; scenery sprite &11 UNDERGROWTH - bottom of trees and vines &55ae 96 51 01 08 ; scenery sprite &12 TREE BODY &55b2 9e 51 04 10 ; scenery sprite &13 TREE BOTTOM - the bit between the trunks &55b6 de 51 02 20 ; scenery sprite &14 TREE LEFT &55ba 0e 53 03 08 ; scenery sprite &15 LEAF &55be e6 53 01 10 ; scenery sprite &16 POOL SIDE &55c2 06 54 04 30 ; scenery sprite &17 TREE TRUNK &55c6 c6 54 04 28 ; scenery sprite &18 ZORN &55ca ff ff ff ff ; scenery sprite &19 unused # Unused scenery sprite slot &55ce 16 56 04 10 ; scenery sprite &1a POOL &55d2 d6 55 02 20 ; scenery sprite &1b TREE RIGHT ; scenery_sprite_1b TREE RIGHT &55d6 43 88 4e 22 58 88 52 22 58 88 52 22 38 88 2e 22 &55e6 2f 88 23 e2 28 88 22 22 28 88 22 22 38 88 12 22 &55f6 08 88 8a 22 87 08 8b e2 0a 88 0a a2 0a 88 0a c2 &5606 44 58 44 32 44 28 44 22 44 18 42 6e 22 f3 22 f9 ; scenery_sprite_1a POOL &5616 ff ff ff ff 00 00 00 00 00 00 00 00 ff ff ff ff &5626 aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa &5636 aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa &5646 aa aa aa aa aa aa aa 2a a2 aa aa 08 82 22 08 08 ; player_sideways_mask &5656 fe 00 ff fc 00 3f f8 00 1f f0 00 1f f0 00 1f f0 &5666 00 1f f0 00 1f f0 00 0f e0 00 0f e0 00 0f e0 00 &5676 1f e0 00 1f e0 00 1f e0 00 1f e0 00 1f e0 00 1f &5686 c0 00 1f c0 00 3f c0 00 3f f8 00 3f f8 00 07 f8 &5696 00 07 f8 00 07 f8 00 07 f0 00 07 f0 00 3f f0 00 &56a6 3f e0 00 3f e0 00 3f e0 00 3f c0 00 3f 80 00 7f ; player_vertical_mask &56b6 fe 00 ff fc 00 7f f8 00 7f f0 00 3f f0 00 3f f0 &56c6 00 1f f0 00 1f f0 00 1f f0 00 1f f0 00 1f e0 00 &56d6 0f c0 00 07 80 00 03 00 00 01 00 00 01 00 00 01 &56e6 00 00 01 00 00 01 00 00 01 00 00 01 00 00 01 00 &56f6 00 01 80 00 03 80 00 03 c0 00 07 c0 00 07 c0 00 &5706 07 c0 00 07 c0 00 07 e0 00 0f e0 00 0f f0 00 1f ; object_type_data ; w h bh fr-0 fr-1 addr cmp ah &5716 06 18 18 78 42 78 42 51 02 0a 08 ; type 00 - TABLE &5721 06 18 18 08 43 08 43 51 02 0a 0a ; type 01 - BED &572c 04 28 28 b8 43 b8 43 51 02 0a 0a ; type 02 - OAK PLANT &5737 02 38 38 b8 44 b8 44 51 02 0a 12 ; type 03 - WALL &5742 04 25 26 88 45 88 45 51 02 0a 0a ; type 04 - BARREL &574d 06 17 18 2e 46 2e 46 51 02 0a 0a ; type 05 - KLERE'S BODY &5758 03 38 38 b8 46 b8 46 51 02 0a 0a ; type 06 - PHANTOM &5763 03 20 20 60 47 c0 47 51 02 0a 0a ; type 07 - EATING PLANT &576e 04 28 28 20 48 20 48 51 02 0a 0a ; type 08 - unused # Unused object sprite slot &5779 03 28 28 c0 48 c0 48 51 02 0a 12 ; type 09 - GRAMOFOOT &5784 03 38 3c 38 49 38 49 51 02 0a 12 ; type 0a - VAMPIRE &578f 03 40 40 e0 49 e0 49 51 02 0a 0a ; type 0b - DEMON AND BOTTLE &579a 03 14 29 a0 4a a0 4a 51 02 0a 0a ; type 0c - SMOKE STAGE ONE &57a5 03 20 35 dc 4a dc 4a 51 02 0a 0a ; type 0d - SMOKE STAGE TWO &57b0 03 15 15 61 4a 61 4a 51 02 0a 0a ; type 0e - BOTTLE &57bb 04 28 28 38 41 38 41 44 fe 7f 0a ; type 0f - ALTAR &57c6 02 0c 0c 4e 52 4e 52 51 02 0a 06 ; type 10 - MUSHROOM ; unused &57d1 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &57e1 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &57f1 00 00 00 00 00 00 00 54 00 00 86 49 20 00 00 # end of SPB.2 &5800 - &773f screen memory, rows &140 wide # from end of SPB.3 ; text_strings &7740 00 &7741 00 &7742 42 55 52 4e 45 44 20 41 53 48 45 53 00 ; text &01 "BURNED ASHES" &774f 53 55 4c 50 48 55 52 00 ; text &02 "SULPHUR" &7757 54 4f 41 44 20 4c 45 47 53 00 ; text &03 "TOAD LEGS" &7761 52 45 44 20 48 45 52 52 49 4e 47 00 ; text &04 "RED HERRING" &776d 4f 41 4b 20 4c 45 41 56 45 53 00 ; text &05 "OAK LEAVES" &7778 46 4c 45 41 53 00 ; text &06 "FLEAS" &777e 57 49 4e 45 00 ; text &07 "WINE" &7783 57 4f 52 4d 53 00 ; text &08 "WORMS" &7789 47 4f 4c 44 45 4e 20 46 52 55 49 54 00 ; text &09 "GOLDEN FRUIT" &7796 42 4c 55 45 20 4d 55 53 48 52 4f 4f 4d 00 ; text &0a "BLUE MUSHROOM" &77a4 42 4c 41 43 4b 20 50 45 41 52 4c 00 ; text &0b "BLACK PEARL" &77b0 44 52 49 45 44 20 52 4f 4f 54 53 00 ; text &0c "DRIED ROOTS" &77bc 48 45 41 4c 00 ; text &0d "HEAL" &77c1 46 55 4c 4c 20 48 45 41 4c 00 ; text &0e "FULL HEAL" &77cb 41 49 52 20 42 55 42 42 4c 45 00 ; text &0f "AIR BUBBLE" &77d6 42 4f 44 59 20 42 55 42 42 4c 45 00 ; text &10 "BODY BUBBLE" &77e2 53 55 4e 20 48 49 54 00 ; text &11 "SUN HIT" &77ea 46 52 45 45 5a 45 00 ; text &12 "FREEZE" &77f1 44 45 45 50 20 46 52 45 45 5a 45 00 ; text &13 "DEEP FREEZE" &77fd 41 49 52 20 53 48 49 45 4c 44 00 ; text &14 "AIR SHIELD" &7808 57 49 4e 44 20 53 48 49 45 4c 44 00 ; text &15 "WIND SHIELD" &7814 53 54 4f 52 4d 20 48 49 54 00 ; text &16 "STORM HIT" &781e 54 48 55 4e 44 45 52 20 48 49 54 00 ; text &17 "THUNDER HIT" &782a 50 4f 49 53 4f 4e 45 44 20 57 4f 52 4d 53 00 ; text &18 "POISONED WORMS" &7839 4c 55 54 45 00 ; text &19 "LUTE" &783e 47 4f 4c 44 45 4e 20 43 52 4f 53 53 00 ; text &1a "GOLDEN CROSS" &784b 54 45 4c 45 43 48 41 4e 47 45 00 ; text &1b "TELECHANGE" &7856 43 52 59 53 54 41 4c 20 42 41 4c 4c 00 ; text &1c "CRYSTAL BALL" &7863 43 4f 52 4b 00 ; text &1d "CORK" &7868 4d 45 54 41 4c 20 44 49 53 4b 00 ; text &1e "METAL DISK" &7873 47 4f 4c 44 45 4e 20 43 52 4f 57 4e 00 ; text &1f "GOLDEN CROWN" &7880 54 41 50 00 ; text &20 "TAP" &7884 4d 4f 52 54 41 52 26 50 45 53 54 4c 45 00 ; text &21 "MORTAR&PESTLE" &7892 00 ; text &22 # corresponds to unused inventory slot &7893 47 4f 4c 44 45 4e 20 42 41 52 00 ; text &23 "GOLDEN BAR" &789e 00 ; text &24 # corresponds to unused inventory slot &789f 54 41 42 4c 45 00 ; text &25 "TABLE" &78a5 42 45 44 00 ; text &26 "BED" &78a9 50 4c 41 4e 54 00 ; text &27 "PLANT" &78af 57 41 4c 4c 00 ; text &28 "WALL" &78b4 42 41 52 52 45 4c 00 ; text &29 "BARREL" &78bb 4b 4c 45 52 45 27 53 20 42 4f 44 59 00 ; text &2a "KLERE'S BODY" &78c8 50 48 41 4e 54 4f 4d 00 ; text &2b "PHANTOM" &78d0 45 41 54 49 4e 47 20 50 4c 41 4e 54 00 ; text &2c "EATING PLANT" &78dd 22 2a 53 48 49 52 52 4f 4e 2a 22 00 ; text &2d ""*SHIRRON*"" # Used to decrypt &78e9 47 52 41 4d 4f 46 4f 4f 54 00 ; text &2e "GRAMOFOOT" &78f3 56 41 4d 50 49 52 45 00 ; text &2f "VAMPIRE" &78fb 14 d2 1b 06 10 45 0d 59 4f 55 52 20 57 49 53 48 ; text &30 &790b 20 49 53 0d 4d 59 20 43 4f 4d 4d 41 4e 44 0d 4d ; if &1bd2 (demon_status) = &06, # If fully emerged, &791b 41 53 54 45 52 0c 3a 04 50 41 53 53 05 0a 06 49 ; "YOUR WISH IS MY COMAND MASTER" &792b 4c 48 06 4a 4c 18 13 0b 0d 49 27 4d 20 4e 4f 54 ; flush buffer, ":", ask for input &793b 20 54 48 41 54 20 47 4f 4f 44 0b 0d 42 45 57 41 ; if "PASS" &794b 52 45 00 ; set &4c49 (room_10_data) = &48 # Add left door ; set &4c4a (room_10_data + 1) = &18 # Remove object ; redraw room ; else ; "I'M NOT THAT GOOD" ; else ; "BEWARE" &794e 41 4c 54 41 52 00 ; text &31 "ALTAR" &7954 4d 55 53 48 52 4f 4f 4d 09 0d 4d 55 53 48 52 4f ; text &32 "MUSHROOM" (sound) "MUSHROOM" &7964 4f 4d 09 06 56 20 01 06 f1 4f 02 00 ; set &2056 (mushroom_collected) = &01 ; set &4ff1 (player_inventory + 9, BLUE MUSHROOM) = &02 &7970 4e 4f 54 48 49 4e 47 00 ; text &33 "NOTHING" &7978 59 4f 55 20 46 4f 55 4e 44 3a 00 ; text &34 "YOU FOUND:" &7983 59 4f 55 20 48 41 56 45 3a 00 ; text &35 "YOU HAVE:" &798d 4d 49 58 3a 0d 00 ; text &36 "MIX:" &7993 55 53 45 3a 0d 00 ; text &37 "USE:" &7999 05 43 41 53 54 3a 0d 00 ; text &38 "CAST:" &79a1 0e 01 54 00 ; text &39 (&5401, inventory_slot_count) &79a5 05 53 54 52 45 4e 47 54 48 3a 20 0e fc 53 25 00 ; text &3a "STRENGTH: " (&53fc player_energy) "%" &79b5 0d 45 4e 44 00 ; text &3b "END" &79ba 05 54 48 49 53 20 42 55 42 42 4c 45 20 49 53 0d ; text &3c "THIS BUBBLE IS NO GOOD[" &79ca 4e 4f 20 47 4f 4f 44 5b 00 &79d3 05 54 48 45 20 4d 41 47 49 43 20 4b 49 4c 4c 45 ; text &3d "THE MAGIC KILLED THE PHANTOM." &79e3 44 0d 54 48 45 20 50 48 41 4e 54 4f 4d 2e 03 0d ; set &4d21 (room_46_data) = &44 # Add right door &79f3 06 21 4d 44 06 22 4d 18 06 25 4d 80 13 00 ; set &4d22 (room_46_data + 1) = &18 # Remove PHANTOM ; set &4d25 (room_47 data) = &80 # Add left door &7a01 05 43 41 53 54 49 4e 47 20 54 48 45 20 53 50 45 ; text &3e &7a11 4c 4c 2c 0d 4d 41 44 45 20 5a 4f 52 4e 20 46 41 ; "CASTING THE SPELL, MADE ZORN FADE AWAY. &7a21 44 45 20 20 20 0d 41 57 41 59 2e 0d 5a 4f 52 4e ; ZORN ESCAPED BUT NOW THY MAGELORDS RULE AGAIN &7a31 20 45 53 43 41 50 45 44 20 42 55 54 03 0d 4e 4f ; WELL DONE! &7a41 57 20 54 48 59 20 4d 41 47 45 4c 4f 52 44 53 0d ; (PRESS SPACE BAR)" &7a51 52 55 4c 45 20 41 47 41 49 4e 0d 57 45 4c 4c 20 ; &7a61 44 4f 4e 45 21 20 0d 28 50 52 45 53 53 20 53 50 ; &7a71 41 43 45 20 42 41 52 29 03 05 05 0b 22 57 4f 4c ; ""WOLFSON"" (never printed) &7a81 46 53 4f 4e 22 00 &7a87 05 54 48 45 20 50 4f 57 45 52 46 55 4c 20 4d 41 ; text &3f "THE POWERFUL MAGIC KILLED YOU TOO!" &7a97 47 49 43 0d 4b 49 4c 4c 45 44 20 59 4f 55 20 54 &7aa7 4f 4f 2e 00 &7aaa 03 0d 59 4f 55 20 41 52 45 20 44 45 41 44 0d 00 ; text &40 "YOU ARE DEAD!" &7abb 05 41 4c 4c 20 59 4f 55 52 20 50 4f 57 45 52 0d ; text &41 "ALL YOUR POWER HAS BEEN DRAINED AWAY!" &7acb 48 41 53 20 42 45 45 4e 20 44 52 41 49 4e 45 44 &7adb 0d 41 57 41 59 2e 00 &7ae2 05 54 48 45 20 44 45 4d 4f 4e 0d 4b 49 4c 4c 53 ; text &42 "THE DEMON KILLS YOU" &7af2 20 59 4f 55 00 &7af7 05 4e 4f 20 41 49 52 20 4c 45 46 54 00 ; text &43 "NO AIR LEFT" &7b04 05 59 4f 55 52 20 41 57 46 55 4c 20 4d 55 53 49 ; text &44 "YOUR AWFUL MUSIC DROVE THE GRAMOFOOT AWAY" &7b14 43 0d 44 52 4f 56 45 0d 54 48 45 20 47 52 41 4d &7b24 4f 46 4f 4f 54 20 41 57 41 59 00 &7b2f 05 53 45 45 49 4e 47 20 54 48 45 20 43 52 4f 53 ; text &45 "SEEING THE CROSS THE VAMPIRE DISAPPEARS" &7b3f 53 0d 54 48 45 20 56 41 4d 50 49 52 45 0d 44 49 &7b4f 53 41 50 50 45 41 52 53 20 00 &7b58 05 59 4f 55 52 20 57 4f 52 4d 53 0d 4b 49 4c 4c ; text &46 "YOUR WORMS KILLED THE PLANT" &7b68 45 44 20 54 48 45 20 50 4c 41 4e 54 06 ba 4d 78 ; set &4ea1 (room_a6_data) = &08 # Add right door &7b78 06 a1 4e 08 06 a5 4e 80 13 00 ; set &4ea5 (room_a7_data) = &80 # Add left door &7b83 05 22 53 4f 4d 45 20 45 41 54 0d 45 56 45 4e 20 ; text &47 ""SOME EAT EVEN WORMS"" &7b93 57 4f 52 4d 53 22 00 &7b9a 05 49 20 47 52 41 42 42 45 44 0d 53 4f 4d 45 54 ; text &48 "I GRABBED SOMETHING" (sound) &7baa 48 49 4e 47 09 00 &7bb0 05 54 4f 55 43 48 49 4e 47 20 54 48 45 20 41 4c ; text &49 "TOUCHING THE ALTAR YOU HEAR MOVING STONES" &7bc0 54 41 52 0d 59 4f 55 20 48 45 41 52 20 4d 4f 56 &7bd0 49 4e 47 0d 53 54 4f 4e 45 53 00 &7bdb 05 22 53 54 4f 52 4d 20 43 41 53 54 49 4e 47 20 ; text &4a ""STORM CASTING : MUSHROOM 2 ASHES A FLEA"" &7beb 3a 0d 4d 55 53 48 52 4f 4f 4d 0d 32 20 41 53 48 &7bfb 45 53 20 0d 41 20 46 4c 45 41 22 00 &7c07 05 22 54 48 55 4e 44 45 52 20 43 41 53 54 49 4e ; text &4b ""THUNDER CASTING : FRUIT TWO LEGS ONE FLEA" &7c17 47 20 3a 0d 46 52 55 49 54 0d 54 57 4f 20 4c 45 &7c27 47 53 20 0d 4f 4e 45 20 46 4c 45 41 22 00 &7c35 05 22 54 4f 20 42 45 20 4c 49 4b 45 20 54 48 45 ; text &4c ""TO BE LIKE THE SUN ITSELF,PUT ONE PEARL AGAINST &7c45 0d 53 55 4e 20 49 54 53 45 4c 46 2c 50 55 54 0d ASHES AND TWO FLEAS"" &7c55 4f 4e 45 20 50 45 41 52 4c 20 41 47 41 49 4e 53 &7c65 54 0d 41 53 48 45 53 20 41 4e 44 20 54 57 4f 03 &7c75 0d 46 4c 45 41 53 22 00 &7c7d 05 22 46 4c 45 41 53 20 47 52 45 41 54 0d 54 48 ; text &4d ""FLEAS GREAT THY MAGIC"" &7c8d 59 20 4d 41 47 49 43 22 00 &7c96 05 22 59 4f 55 20 4e 45 45 44 0d 41 20 43 48 41 ; text &4e ""YOU NEED A CHANGE"" &7ca6 4e 47 45 22 00 &7cab 05 22 54 48 45 20 52 45 47 55 4c 41 52 0d 42 55 ; text &4f ""THE REGULAR BUBBLE CAN'T STAND ACID"" &7cbb 42 42 4c 45 20 43 41 4e 27 54 0d 53 54 41 4e 44 &7ccb 20 41 43 49 44 22 00 &7cd2 05 22 41 54 20 4d 49 44 4e 49 47 48 54 0d 49 20 ; text &50 ""AT MIDNIGHT I PRESUME YOU'LL FIND FOREST MUSHROOM"" &7ce2 50 52 45 53 55 4d 45 0d 59 4f 55 27 4c 4c 20 46 &7cf2 49 4e 44 0d 46 4f 52 45 53 54 20 4d 55 53 48 52 &7d02 4f 4f 4d 2e 22 00 &7d08 05 22 53 54 4f 52 4d 0d 54 48 45 20 50 48 41 4e ; text &51 ""STORM THE PHANTOM!"" &7d18 54 4f 4d 5b 22 00 &7d1e 05 22 20 20 53 48 49 45 4c 44 0d 20 20 20 20 20 ; text &52 ""SHIELD v PROTECTION"" &7d2e 40 0d 20 50 52 4f 54 45 43 54 49 4f 4e 22 00 &7d3d 05 22 53 45 41 52 43 48 0d 54 48 59 20 50 52 4f ; text &53 ""SEARCH THY PROTECTOR"" &7d4d 54 45 43 54 4f 52 22 00 &7d55 05 41 4e 20 4f 4c 44 20 4d 41 50 20 53 48 4f 57 ; text &54 "AN OLD MAP SHOWS >>v>!" &7d65 53 20 0d 5e 5e 40 5e 5b 00 &7d6e 05 22 46 49 4e 44 20 50 41 53 53 41 47 45 53 0d ; text &55 ""FIND PASSAGES BETWEEN THE TREES"" &7d7e 42 45 54 57 45 45 4e 20 54 48 45 20 54 52 45 45 &7d8e 53 22 00 &7d91 05 22 50 41 53 53 41 47 45 53 20 41 52 45 0d 49 ; text &56 ""PASSAGES ARE INVISIBLE DOORS"" &7da1 4e 56 49 53 49 42 4c 45 20 44 4f 4f 52 53 22 00 &7db1 05 59 4f 55 20 4d 4f 56 45 0d 54 48 45 20 50 49 ; text &57 "YOU MOVE THE PICTURE" &7dc1 43 54 55 52 45 06 01 4e 14 06 cd 4d 06 13 00 ; set &4e01 (room_7e_data) = &14 # Add bottom door ; set &4dcd (room_71_data) = &06 # Add top door &7dd0 05 22 4c 4f 4f 4b 20 43 41 52 45 46 55 4c 4c 59 ; text &58 ""LOOK CAREFULLY AND YOU'LL NEVER FALL"" &7de0 0d 41 4e 44 20 59 4f 55 27 4c 4c 20 4e 45 56 45 &7df0 52 0d 46 41 4c 4c 5b 22 00 &7df9 05 22 55 53 45 20 4c 45 41 56 45 53 20 41 4e 44 ; text &59 ""USE LEAVES AND ROOTS TO BREATHE"" &7e09 0d 52 4f 4f 54 53 20 54 4f 20 42 52 45 41 54 48 &7e19 45 22 00 &7e1c 05 59 4f 55 20 50 55 53 48 20 54 48 45 0d 41 58 ; text &5a "YOU PUSH THE AXE" &7e2c 45 2e 06 f9 4e aa 06 c5 4e a5 00 ; set &4ef9 (room_bc_data) = &aa # Add bottom door ; set &4ec5 (room_af_data) = &a5 # Add top door &7e37 05 22 55 53 45 20 41 4c 45 43 27 53 20 41 44 56 ; text &5b ""USE ALEC'S ADVICE AT THE EAST END OF THIS CORRIDOR."" &7e47 49 43 45 0d 41 54 20 54 48 45 20 45 41 53 54 20 &7e57 45 4e 44 0d 4f 46 20 54 48 49 53 20 43 4f 52 52 &7e67 49 44 4f 52 2e 22 00 &7e6e 05 22 57 49 53 48 20 46 4f 52 20 41 20 50 41 53 ; text &5c ""WISH FOR A PASS."" &7e7e 53 2e 22 00 &7e82 05 22 53 45 41 52 43 48 20 54 48 45 20 49 52 4f ; text &5d ""SEARCH THE IRON MAN."" &7e92 4e 0d 4d 41 4e 2e 22 00 &7e9a 05 22 50 4f 49 53 4f 4e 20 54 48 45 20 48 55 4e ; text &5e ""POISON THE HUNGRY ONE."" &7eaa 47 52 59 0d 4f 4e 45 2e 22 00 &7eb4 05 22 4d 59 20 41 44 56 49 43 45 20 43 4f 53 54 ; text &5f &7ec4 53 20 41 0d 47 4f 4c 44 20 42 41 52 2e 20 41 4e ; ""MY ADVICE COSTS A GOLD BAR. ANSWER WITH 'YES' IF YOU WANT IT" &7ed4 53 57 45 52 0d 57 49 54 48 20 27 59 45 53 27 20 ; flush buffer x 4, ask for input &7ee4 49 46 0d 59 4f 55 20 57 41 4e 54 20 49 54 5c 22 ; if "YES" &7ef4 0c 0c 0c 0c 04 59 45 53 05 1c 12 0a 50 01 10 16 ; decrement &500a (player_inventory + 22, GOLDEN BAR) &7f04 0d 22 53 45 41 52 43 48 0d 54 48 45 20 50 49 43 ; if positive &7f14 54 55 52 45 22 0b 0d 22 59 4f 55 20 43 41 4e 27 ; "SEARCH THE PICTURE" &7f24 54 0d 41 46 46 4f 52 44 20 4d 45 2e 22 00 ; else ; ""YOU CAN'T AFFORD ME."" &7f32 05 49 4e 20 54 48 45 20 43 45 4c 4c 20 59 4f 55 ; text &60 &7f42 0d 53 45 45 20 4d 41 47 45 4c 4f 52 44 0d 4d 45 ; "IN THE CELL YOU SEE MAGELORD MERLAN &7f52 52 4c 41 4e 03 0d 09 48 45 20 47 49 56 45 53 20 ; HE GIVES YOU A CRYSTAL BALL &7f62 59 4f 55 0d 41 20 43 52 59 53 54 41 4c 20 42 41 ; "THIS SOFTENS THE SUN HIT." &7f72 4c 4c 03 0d 22 54 48 49 53 20 53 4f 46 54 45 4e ; set &5003 (player_inventory + &1b, CRYSTAL BALL) = &01 &7f82 53 20 20 0d 54 48 45 20 53 55 4e 20 48 49 54 2e &7f92 22 06 03 50 01 00 &7f98 05 41 41 41 48 48 48 2e 2e 2e 0d 57 41 54 43 48 ; text &61 "AAAHHH... WATCH HOW YOU GO!" &7fa8 20 48 4f 57 0d 59 4f 55 20 47 4f 21 20 20 20 20 &7f98 20 03 00 &7fbb 05 53 48 49 45 4c 44 20 4d 4f 56 45 44 5b 06 4d ; text &62 "SHIELD MOVED!" &7fcb 4c 44 06 49 4c 08 00 ; set &4c4d (room_11_data) = &44 # Add left door ; set &7f49 (room_10_data) = &08 # (redundant) &7fd2 05 22 59 4f 55 27 4c 4c 20 4e 45 56 45 52 20 47 ; text &63 ""YOU'LL NEVER GET OUT!"" &7fe2 45 54 0d 4f 55 54 5b 22 00 &7feb 05 22 48 45 4c 4c 4f 20 4d 41 47 45 4c 4f 52 44 ; text &64 ""HELLO MAGELORD!"" &7ffb 5b 22 00 ; unused &7ffe 00 00