Boffin disassembly ================== Boffin was written by Paul O'Malley and published by Addictive Games in 1985. It is a platform game in which a professor must use trampolines, manta rays and an umbrella to collect unlucky horseshoes and then touch a lucky owl. It is notable for the giant tarantulas that chase the player on some levels. The following disassembly was created by reverse engineering binary images, without access to any source code. It is nevertheless reasonably complete, allowing the technical approaches used to be understood. The author of this disassembly imposes no additional copyright restrictions beyond those already present on the game itself. It is provided for educational purposes only, and it is hoped that the original authors will accept it in the good faith it was intended - as a tribute to their skills. Technical notes =============== The two-part tape loader decrypts binaries using data in the block headers. There are twenty caves. After the twentieth cave is completed, the caves are repeated with a dark colour scheme, then with a reduced time limit. Interesting pokes ================= &2869 = &00 infinite lives &0482 = &00 infinite time &25b3 = &ea complete cave without collecting all the horseshoes &34d7 = &80 fall any distance without dying Tape protection disassembly =========================== ; BOFFIN ; 001fb8 0024d9 001140 &1fb8 20 42 4f 46 46 49 4e 20 ; " BOFFIN " &1fc0 5f 5f 5f 5f 5f 5f 5f 5f ; "________" &1fc8 43 6f 70 79 72 69 67 68 ; "Copyrigh" &1fd0 74 28 43 29 20 41 64 64 ; "t(C) Add" &1fd8 69 63 74 69 76 65 20 47 ; "ictive G" &1fe0 61 6d 65 73 20 31 39 38 ; "ames 198" &1fe8 35 20 20 2a 20 20 55 6e ; "5 * Un" &1ff0 61 75 74 68 6f 72 69 73 ; "authoris" &1ff8 65 64 20 43 6f 70 79 69 ; "ed Copyi" &2000 6e 67 2c 20 48 69 72 69 ; "ng, Hiri" &2008 6e 67 2c 20 6f 72 20 4c ; "ng, or L" &2010 65 6e 64 69 6e 67 20 6f ; "ending o" &2018 66 20 74 68 69 73 20 50 ; "f this P" &2020 72 6f 64 75 63 74 20 69 ; "roduct i" &2028 73 20 50 52 4f 48 49 42 ; "s PROHIB" &2030 49 54 45 44 20 20 2a 20 ; "ITED * " &2038 47 61 6d 65 20 44 65 73 ; "Game Des" &2040 69 67 6e 65 64 20 61 6e ; "igned an" &2048 64 20 57 72 69 74 74 65 ; "d Writte" &2050 6e 20 62 79 3a 20 20 20 ; "n by: " &2058 20 20 50 61 75 6c 20 20 ; " Paul " &2060 4f 27 4d 61 6c 6c 65 79 ; "O'Malley" &2068 20 20 20 20 20 20 20 20 ; " " # Sprites # ======= # addr w h x y # &0: 2fbb 0c 0f 6c 6b &2f14 - &2fc7, &0b4 bytes ; "ames" # &1: 2f05 05 16 54 6b &2e9d - &2f0a, &06e bytes ; "G" # &2: 2e8f 0d 08 9e 1f &2e35 - &2e9c &068 bytes ; run_second_loader code # &3: 2e1b 11 13 46 6b &2cea - &2e2c, &133 bytes ; "ddictive" # &4: 2c73 10 40 24 8c &2884 - &2c83, &400 bytes ; "A" # &5: 2879 08 08 0e 07 &2842 - &2881, &040 bytes ; irq1_handler code # &6: 282b 0d 14 8c 6b &2735 - &2838, &104 bytes ; "1985" # &7: 2663 0d 1f 6c 3f &24de - &2670, &193 bytes ; "FIN" # &8: 24c7 10 1f 52 3f &22e8 - &24d7, &1f0 bytes ; "BOF" # &9: 222c 0d 15 9e b3 &2129 - &2239, &111 bytes ; "O'Malley" # &a: 2119 06 11 80 b1 &213a - &219f, &066 bytes ; "Paul" ; 0 1 2 3 4 5 6 7 8 9 a ; sprite_widths &2070 0c 05 0d 11 10 08 0d 0d 10 0d 06 ; sprite_heights &207b 0f 16 08 13 40 08 14 1f 1f 15 11 ; sprite_addresses_low # Address of left column of bottom row of sprite &2086 bb 05 8f 1b 73 79 2b 63 c7 2c 19 ; sprite_addresses_high &2091 2f 2f 2e 2e 2c 28 28 26 24 22 21 ; sprite_x_positions # Rightmost column &209c 6c 54 9e 46 24 0e 8c 6c 52 9e 80 ; sprite_y_positions # Bottom row &20a7 6b 6b 1f 6b 8c 07 6b 3f 3f b3 b1 ; post_decryption_one_address &20b2 86 2c ; &2c86 = display_loading_screen # &20b2 set to &72 at &2e2f, &20b3 set to &26 at &283b # &2672 = post_decryption_one ; unused &20b4 ee 40 00 11 ; run_second_loader_address &20b8 98 4f ; &4f98 = run_second_loader ; sprite_a_data # "Paul" &20ba 00 00 11 ee 00 00 00 00 66 11 00 00 00 11 88 00 &20ca 88 00 00 66 00 00 88 00 00 aa 00 11 00 11 11 44 &20da 00 22 00 11 00 44 00 cc 00 22 00 88 33 00 00 22 &20ea 00 88 cc 00 00 44 11 33 00 00 00 44 11 cc 00 00 &20fa 00 88 77 11 cc 22 44 88 22 22 22 44 99 11 44 44 &210a 22 44 bb 22 44 44 66 bb 44 cc 88 33 99 00 00 00 # &2100 - &2fff is decrypted at &3027 &211a 88 00 00 00 00 00 ; unused &2120 85 ; pre_decryption_four # Used unencrypted &2121 ee 38 30 INC &3038 ; decrypt_subtraction + 1 &2124 6c e6 22 JMP (&22e6) ; decrypt_loader_address ; unused &2127 2d 69 ; sprite_9_data # "O'Malley" &2129 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 &2139 88 00 88 00 00 22 22 00 00 00 00 00 00 88 88 88 &2149 00 00 22 22 00 00 00 00 33 88 00 99 88 00 00 44 &2159 44 00 00 00 00 cc 44 11 55 88 00 00 44 44 00 00 &2169 00 11 00 22 11 66 88 00 00 88 88 00 00 00 22 00 &2179 22 22 66 88 00 00 88 88 44 00 00 22 00 22 22 44 &2189 88 00 11 11 00 aa 11 22 44 00 44 44 44 88 ee 11 &2199 11 11 22 22 44 44 00 44 44 00 99 11 22 22 11 cc &21a9 22 44 88 00 88 88 00 aa 11 22 66 77 99 dd cc 88 &21b9 00 88 88 00 aa 33 55 99 88 66 00 88 88 11 11 00 &21c9 00 99 cc 88 00 00 00 11 ff 44 66 11 00 00 00 00 &21d9 00 00 00 77 ff 88 33 88 00 00 00 00 00 00 00 ff &21e9 88 11 00 00 00 00 00 00 00 00 00 ff 00 00 11 00 &21f9 00 00 00 00 00 00 00 33 00 00 00 66 00 00 00 00 &2209 00 00 00 00 44 00 00 11 cc 00 00 00 00 00 00 00 &2219 00 88 00 00 66 00 00 00 00 00 00 00 00 00 77 00 &2229 33 88 00 00 00 00 00 00 00 00 00 00 ff cc 00 00 &2239 00 ; plot_sprite &223a aa TAX &223b a5 16 LDA &16 ; sprite_address_low &223d 8d 8a 22 STA &228a ; source_address_low &2240 a5 17 LDA &17 ; sprite_address_high &2242 8d 8b 22 STA &228b ; source_address_high &2245 a9 00 LDA #&00 &2247 85 10 STA &10 ; screen_address_low &2249 85 1b STA &1b ; high &224b 98 TYA &224c 85 1c STA &1c ; row_in_group &224e 29 f8 AND #&f8 &2250 4a LSR A &2251 4a LSR A &2252 85 11 STA &11 ; screen_address_high &2254 4a LSR A &2255 4a LSR A &2256 66 10 ROR &10 ; screen_address_low &2258 65 11 ADC &11 ; screen_address_high &225a 85 11 STA &11 ; screen_address_high &225c 8a TXA &225d 29 fe AND #&fe &225f 0a ASL A &2260 26 1b ROL &1b ; high &2262 0a ASL A &2263 26 1b ROL &1b ; high &2265 65 10 ADC &10 ; screen_address_low &2267 85 10 STA &10 ; screen_address_low &2269 a5 1b LDA &1b ; high &226b 65 11 ADC &11 ; screen_address_high &226d 69 46 ADC #&46 &226f 85 11 STA &11 ; screen_address_high &2271 18 CLC &2272 98 TYA &2273 29 07 AND #&07 &2275 65 10 ADC &10 ; screen_address_low &2277 85 10 STA &10 ; screen_address_low &2279 8d 8d 22 STA &228d ; target_address_low &227c a5 11 LDA &11 ; screen_address_high &227e 69 00 ADC #&00 &2280 85 11 STA &11 ; screen_address_high &2282 8d 8e 22 STA &228e ; target_address_high &2285 a6 15 LDX &15 ; rows_to_plot ; plot_sprite_row_loop &2287 a4 14 LDY &14 ; columns_to_plot ; plot_sprite_column_loop &2289 b9 00 fe LDA &fe00,Y # actually LDA source_address,Y &228c 8d ff 50 STA &50ff # actually LDA target_address &228f 38 SEC &2290 ad 8d 22 LDA &228d ; target_address_low &2293 e9 08 SBC #&08 # Move left four pixels &2295 8d 8d 22 STA &228d ; target_address_low &2298 b0 03 BCS &229d ; skip_target_page &229a ce 8e 22 DEC &228e ; target_address_high ; skip_target_page &229d 88 DEY &229e d0 e9 BNE &2289 ; plot_sprite_column_loop &22a0 38 SEC &22a1 ad 8a 22 LDA &228a ; source_address_low ; plot_sprite_subtraction &22a4 e5 15 SBC &15 ; rows_to_plot # actually SBC &14 ; columns_to_plot # Modified at &2cb7 &22a6 8d 8a 22 STA &228a ; source_address_low &22a9 b0 03 BCS &22ae ; skip_source_page &22ab ce 8b 22 DEC &228b ; source_address_high ; skip_source_page &22ae c6 1c DEC &1c ; row_in_group &22b0 a5 1c LDA &1c ; row_in_group &22b2 29 07 AND #&07 &22b4 c9 07 CMP #&07 &22b6 f0 17 BEQ &22cf ; move_up_a_group &22b8 38 SEC &22b9 a5 10 LDA &10 ; screen_address_low &22bb e9 01 SBC #&01 &22bd 85 10 STA &10 ; screen_address_low &22bf 8d 8d 22 STA &228d ; target_address_low &22c2 a5 11 LDA &11 ; screen_address_high &22c4 e9 00 SBC #&00 &22c6 85 11 STA &11 ; screen_address_high &22c8 8d 8e 22 STA &228e ; target_address_high &22cb ca DEX &22cc d0 b9 BNE &2287 ; plot_sprite_row_loop &22ce 60 RTS ; move_up_a_group &22cf 38 SEC &22d0 a5 10 LDA &10 ; screen_address_low &22d2 e9 79 SBC #&79 # Move up one group &22d4 85 10 STA &10 ; screen_address_low &22d6 8d 8d 22 STA &228d ; target_address_low &22d9 a5 11 LDA &11 ; screen_address_high &22db e9 02 SBC #&02 &22dd 85 11 STA &11 ; screen_address_high &22df 8d 8e 22 STA &228e ; target_address_high &22e2 ca DEX &22e3 d0 a2 BNE &2287 ; plot_sprite_row_loop &22e5 60 RTS ; decrypt_loader_address # Used unencrypted &22e6 00 30 ; &3000 = decrypt_loader ; sprite_8_data # "BOF" &22e8 ff ff ff 00 00 00 11 ff 00 00 11 ff ff ff ee 11 &22f8 ff ff ff cc 00 00 77 ff cc 00 11 ff ff ff dd 11 &2208 ff ff ff ee 00 11 ff ff ff 00 11 ff ff ff cc 99 &2318 ff ff ff ff 00 33 ff ff ff 88 11 ff ff ff cc 55 &2328 ff ff ff ee 88 33 ff ff ff cc 11 ff ff ff cc 55 &2338 ff 88 77 ee 44 77 ff ff ff ee 11 ff 00 00 22 55 &2348 ff 88 33 ff 44 77 ff ff ff ee 11 ff 00 00 11 55 &2358 ff 88 33 ff 22 77 ff 11 ff dd 11 ff 00 00 00 dd &2368 ff 88 33 ff 22 77 ee 00 ff dd 11 ff 11 ff ff dd &2378 ff 88 33 ee 22 77 ee 00 ff dd 11 ff 11 00 00 11 &2388 ff 88 77 ee 22 77 ee 00 ff cc 99 ff 11 00 00 11 &2398 ff ff ff cc 44 77 ee 00 ff cc 99 ff ff ee 00 11 &23a8 ff ff ff 88 44 77 ee 00 ff cc 99 ff ff dd 00 11 &23b8 ff ff ff 00 88 77 ee 00 ff cc 99 ff ff cc 88 11 &23c8 ff ff ff 88 88 77 ee 00 ff cc 55 ff ff cc 44 11 &23d8 ff ff ff dd 00 77 ee 00 ff cc 55 ff ff cc 44 11 &23e8 ff 88 77 ff 88 77 ee 00 ff cc 55 ff 00 22 44 11 &23f8 ff 88 33 ee 44 77 ee 00 ff cc 55 ff 00 11 44 11 &2408 ff 88 33 ff 22 77 ee 00 ff cc 55 ff 00 00 cc 11 &2418 ff 88 33 ff 22 77 ff 11 ff cc 55 ff 11 ff cc 11 &2428 ff 88 33 ff 11 77 ff ff ff cc 55 ff 11 00 00 11 &2438 ff 88 77 ff 11 77 ff ff ff cc 55 ff 11 00 00 11 &2448 ff ff ff ee 11 33 ff ff ff aa 55 ff 11 00 00 11 &2458 ff ff ff ee 11 33 ff ff ff 99 55 ff 11 00 00 11 &2468 ff ff ff cc 11 33 ff ff ff 00 99 ff 11 00 00 11 &2478 ff ff ff 88 22 11 77 ff cc 00 99 ff 11 00 00 11 &2488 ff ff ee 00 22 00 99 ff 00 11 11 ff 11 00 00 11 &2498 88 00 11 00 44 00 44 00 00 22 11 00 99 00 00 11 &24a8 44 00 00 88 88 00 33 00 00 cc 00 88 55 00 00 00 &24b8 22 00 00 77 00 00 00 cc 33 00 00 44 33 00 00 00 &24c8 11 ff ff cc 00 00 00 33 cc 00 00 33 ff 00 00 00 ; unused &24d8 95 ; entry_point # Used unencrypted &24d9 03 86 SLO (&86,X) # Illegal opcode; performs ASL (&86,X), ORA (&86,X) &24db 6c 84 2c JMP (&2c84) ; pre_decryption_one_address ; sprite_7_data # "FIN" &24de ff ff ff ee 11 ff 88 33 ff 00 33 ff 00 ff ff ff &24ee dd 11 ff 44 33 ff 88 33 ee 88 ff ff ff cc 99 ff &24fe 22 33 ff 44 33 ee 44 ff ff ff cc 55 ff 11 33 ff &250e aa 33 ee 22 ff ff ff cc 55 ff 11 33 ff aa 33 ee &251e 22 ff 00 00 22 55 ff 11 33 ff ee 33 ee 22 ff 00 &252e 00 11 55 ff 11 33 ff ee 33 ee 22 ff 00 00 00 dd &253e ff 11 33 ff ee 33 ee 22 ff 11 ff ff dd ff 11 33 &254e ff ee 33 ee 22 ff 11 00 00 11 ff 11 33 ff ff 33 &255e ee 22 ff 11 00 00 11 ff 11 33 ff ff 33 ee 22 ff &256e ff ee 00 11 ff 11 33 ff ff bb ee 22 ff ff dd 00 &257e 11 ff 11 33 ff ff bb ee 22 ff ff cc 88 11 ff 11 &258e 33 ff ff ff ee 22 ff ff cc 44 11 ff 11 33 ff ff &259e ff ee 22 ff ff cc 44 11 ff 11 33 ee ff ff ee 22 &25ae ff 00 22 44 11 ff 11 33 ee ff ff ee 22 ff 00 11 &25be 44 11 ff 11 33 ee 77 ff ee 22 ff 00 00 cc 11 ff &25ce 11 33 ee 77 ff ee 22 ff 11 ff cc 11 ff 11 33 ee &25de 33 ff ee 22 ff 11 00 00 11 ff 11 33 ee 33 ff ee &25ee 22 ff 11 00 00 11 ff 11 33 ee 33 ff ee 22 ff 11 &25fe 00 00 11 ff 11 33 ee 33 ff ee 22 ff 11 00 00 11 &260e ff 11 33 ee 22 ff ee 22 ff 11 00 00 11 ff 11 33 &261e ee 22 ff ee 22 ff 11 00 00 11 ff 11 33 ee 22 77 &262e ee 22 ff 11 00 00 11 ff 11 33 ee 22 77 ee 22 00 &263e 99 00 00 11 00 99 22 11 22 22 11 22 88 55 00 00 &264e 00 88 55 11 00 aa 11 00 aa 44 33 00 00 00 44 33 &265e 00 88 66 00 88 66 33 ff 00 00 00 33 ff 00 77 ee &266e 00 77 ee ; unused &2671 23 ; post_decryption_one &2672 a9 02 LDA #&02 &2674 8d 87 2e STA &2e87 ; sprite_2_data + &52 # Modifies a byte in run_second_loader (&4fc2) &2677 4c 0c 2f JMP &2f0c ; post_decryption_two ; loading_text # Text is reversed &267a 1d 11 1f 00 1c ; define text window x:(&00, &11), y:(&1d, &1f) &267f 03 11 ; COLOUR 3 &2681 3a 79 62 20 6e 65 74 74 69 72 77 20 64 6e 61 20 ; "Game designed and written by:" &2691 64 65 6e 67 69 73 65 64 20 65 6d 61 47 &269e 1a 23 1f ; TAB(&23, &1a) &26a1 02 11 ; COLOUR 2 &26a3 01 1e 03 6c 55 19 ; FILL TRIANGLE &036c, &011e &26a9 01 0e 03 6c 55 19 ; FILL TRIANGLE &036c, &010e &26af 01 1e 00 1e 04 19 ; MOVE &001e, &011e &26b5 01 0e 00 1e 04 19 ; MOVE &001e, &010e &26bb 02 00 12 ; GCOL 0,2 &26be 00 00 00 00 00 00 1c 07 00 17 ; R7: Vertical sync position &26c8 00 00 00 00 00 00 13 06 00 17 ; R6: Vertical displayed register &26d2 00 00 00 00 00 00 00 0d 00 17 ; R13: Displayed screen start address register (low) &26dc 00 00 00 00 00 00 0a 0c 00 17 ; R12: Displayed screen start address register (high) ; &5000 &26e6 00 00 00 00 00 00 20 0a 00 17 ; R10: Cursor start register &26f0 00 00 00 00 03 13 ; Set logical colour 3 to black &26f6 00 00 00 00 02 13 ; Set logical colour 2 to black &26fc 00 00 00 00 01 13 ; Set logical colour 1 to black &2702 01 16 ; unused_text # Text is reversed, stored unencrypted &2704 32 2e 31 20 2e 53 2e 4f 20 6e 6f 20 6b 72 6f 77 ; MODE 7; TAB(&00, &0c) &2714 20 79 6c 6e 6f 20 6c 6c 69 77 20 4e 49 46 46 4f ; "BOFFIN will only work on O.S. 1.2" &2724 42 88 81 0c 00 1f 07 16 ; unused &272c 2f ; post_decryption_three &272d a9 bf LDA #&bf &272f 8d 76 2e STA &2e76 ; sprite_2_data + &41 # Modifies a byte in run_second_loader (&4f9d) &2732 4c e2 2c JMP &2ce2 ; post_decryption_four ; sprite_6_data # "1985" &2735 03 0e 00 07 0c 00 00 0f 08 01 0f 0f 0e 03 0e 01 &2745 0f 0f 00 03 0f 0e 01 0f 0f 0e 07 0e 03 0f 0f 08 &2755 07 0f 0f 01 0f 0f 0e 0f 0e 07 0c 07 0c 0f 08 0f &2765 09 0e 00 00 0f 0e 07 08 03 0c 0f 00 07 09 0e 00 &2775 00 0f 0e 07 08 03 0c 0f 00 07 09 0e 00 00 03 0e &2785 07 08 03 0c 0f 00 07 09 0e 00 00 03 0e 07 08 03 &2795 0c 07 08 0f 01 0f 0f 00 03 0e 07 0c 07 0c 07 0f &27a5 0f 01 0f 0f 0c 03 0e 03 0f 0f 0c 03 0f 0e 01 0f &27b5 0f 0e 03 0e 01 0f 0f 0c 07 0f 0f 01 0f 0f 0e 03 &27c5 0e 00 07 0f 08 07 08 0f 01 0e 01 0f 03 0e 00 00 &27d5 0f 08 0f 00 07 08 00 00 0f 03 0e 00 00 0f 08 0f &27e5 00 07 08 00 00 0f 03 0e 00 01 0f 00 0f 00 07 08 &27f5 00 00 0f 03 0e 00 01 0f 00 0f 00 07 09 0c 00 0f &2805 03 0e 00 03 0e 00 07 08 0f 01 0e 01 0e 0f 0f 08 &2815 03 0e 00 07 0f 0f 01 0f 0f 0e 0f 0f 08 07 0c 00 &2825 03 0f 0e 00 0f 0f 0c 0f 0f 08 0f 08 00 00 0f 08 &2835 00 07 0f 00 ; unused &2839 76 ; pre_decryption_three # Used unencrypted &283a a9 26 LDA #&26 &283c 8d b3 20 STA &20b3 ; post_decryption_one_address_low &283f 4c 21 21 JMP &2121 ; pre_decryption_four ; sprite_5_data # Code for irq1_handler, unpacked to &4600 - &463f &2842 08 c7 50 46 03 25 29 4c 78 03 4c a0 38 46 02 93 &2852 48 ad 16 03 e9 88 f0 dc 98 c6 46 b9 9a d0 07 a9 &2862 48 03 a9 ca 8d ee 68 7f a9 d0 4d 03 50 ad a8 8d &2872 00 05 8d 4d 48 58 68 4e 8d a9 25 ca ce 02 28 fe ; display_loading_screen_address &2882 86 2c ; &2c86 = display_loading_screen ; sprite_4_data # "A" &2884 00 00 00 00 00 00 00 00 22 88 00 00 00 00 00 00 &2894 00 00 00 00 00 00 00 00 22 88 00 00 00 00 00 00 &28a4 00 00 0f 0e 00 00 00 00 57 4c 00 00 00 00 00 00 &28b4 00 03 00 01 08 00 00 00 57 4c 00 00 00 00 00 00 &28c4 00 04 00 00 04 00 00 00 8f 4c 00 00 00 00 00 00 &28d4 00 08 03 08 02 00 00 00 8f 2e 00 00 00 00 00 00 &28e4 00 08 0f 0e 02 00 00 11 0f 2e 00 00 00 00 00 11 &28f4 01 00 0c 06 01 00 00 11 0f 2e 00 00 00 00 00 22 &2904 01 01 0c 07 01 00 00 23 0f 1f 00 00 00 00 00 44 &2914 01 01 08 03 01 00 00 23 0f 1f 00 00 00 00 00 cc &2924 01 01 08 00 01 00 00 47 0f 1f 00 00 00 00 33 88 &2934 01 01 08 00 01 00 00 47 0f 0f 88 00 00 00 75 00 &2944 01 01 08 00 01 00 00 8f 0f 0f 88 88 00 00 ea 07 &2954 01 01 08 03 01 00 00 8f 0f 0f 88 88 00 32 c4 07 &2964 01 01 0c 07 01 00 11 0f 0f 0f 5d 88 00 74 88 07 &2974 01 00 0c 06 01 00 11 0f 0f 0f 5d 4c 00 f9 00 07 &2984 00 08 0f 0e 02 00 23 0f 0f 0f 7f 4c 33 e2 07 07 &2994 00 08 03 08 02 00 23 0f 0f 0f 2f 4c 74 c5 0f 0f &29a4 00 04 00 00 04 00 47 0f 0f 0f 0f 6e f8 8b 0f 0f &29b4 00 03 00 01 08 00 47 0f 0f 0f 0f 7f f1 03 08 0f &29c4 00 00 0f 0e 00 00 8f 0f 0f 0f 0f 3e e2 07 08 07 &29d4 00 00 00 00 00 00 8f 0f 0f 0f 0f 3e c4 07 00 07 &29e4 00 00 00 00 00 11 0f 0f 0f 0f 0f 3f 88 07 00 07 &29f4 00 00 00 00 00 11 0f 0f 2f 0f 0f 1f 00 07 00 07 &2a04 00 00 00 00 00 23 2f 0f 3f 0f 0f 1f 00 07 00 07 &2a14 00 00 00 00 00 23 6f 0f 3f 0f 0f 1f 00 07 00 07 &2a24 00 00 00 00 00 47 cf 0f 4c 9f 0f 0f 88 07 08 07 &2a34 00 00 00 00 00 57 47 0f 5d bf 0f 0f 88 03 08 0f &2a44 00 00 00 00 00 ae 47 0f 7e f0 8f 0f 88 03 0f 0f &2a54 00 00 00 00 00 cc 8f 0f 7c f0 8f 0f 4c 01 0f 0f &2a64 00 00 00 00 11 88 8f 0f f8 f0 8f 0f 4c 00 07 07 &2a74 00 00 00 00 11 00 8f 3f f0 f1 0f 0f 4c 44 00 00 &2a84 00 00 00 00 00 11 0f 7c f0 e3 0f 0f 2e 44 00 00 &2a94 00 00 00 00 00 11 0f f8 f0 c7 0f 0f 2e ae 00 00 &2aa4 00 00 00 00 00 11 3f f0 f0 8f 0f 0f 2e ae 00 00 &2ab4 00 00 00 00 00 23 7c f0 f1 0f 0f 0f 1f 1f 70 f0 &2ac4 00 00 00 00 00 23 f8 f0 f3 ff ff 0f 0f 1f 70 f0 &2ad4 00 00 00 00 00 33 f0 f0 c4 00 00 8f 0f 0f b8 f0 &2ae4 00 00 00 00 00 74 f0 f0 88 00 00 8f 0f 0f b8 f0 &2af4 00 00 00 00 00 f8 f0 f1 00 00 00 47 0f 0f 5c f0 &2b04 00 00 00 00 33 f0 f0 f3 ff ff ff cf 0f 0f 4c 00 &2b14 00 00 00 00 74 f0 f0 f0 f0 f0 f0 ab 2f 0f 2e 00 &2b24 00 00 00 00 f8 f0 f0 f0 f0 f0 f3 23 3f ff ee 00 &2b34 00 00 00 33 f0 f0 f0 f0 f0 f0 c4 11 4c 00 00 00 &2b44 00 00 00 74 f0 f0 f0 f0 f0 f1 88 11 4c 00 00 00 &2b54 00 00 00 f8 f0 f0 f1 f8 f0 e2 00 00 88 00 00 00 &2b64 00 00 33 f0 f0 f0 ff f0 f0 cc 00 00 88 00 00 00 &2b74 00 00 74 f0 f0 f7 32 f0 f1 00 00 00 00 00 00 00 &2b84 00 00 f8 f0 f3 88 74 f0 e6 00 00 00 00 00 00 00 &2b94 00 33 f0 f1 cc 00 f8 f0 88 00 00 00 00 00 00 00 &2ba4 00 74 f0 ee 00 11 f0 f3 00 00 00 00 00 00 00 00 &2bb4 00 f8 f7 00 00 32 f0 c4 00 00 00 00 00 00 00 00 &2bc4 32 f7 88 00 00 74 f1 88 00 00 00 00 00 00 00 00 &2bd4 71 88 00 00 00 f8 e2 00 00 00 00 22 00 00 00 00 &2be4 cc 00 00 00 11 f0 cc 00 00 00 00 00 00 00 00 00 &2bf4 00 00 00 00 32 f1 00 00 00 11 dd dd ff 00 00 00 &2c04 00 00 00 00 74 e6 00 00 00 11 dd 55 55 00 00 00 &2c14 00 00 00 00 f8 88 00 00 00 11 11 dd 11 00 00 00 &2c24 00 00 00 11 f3 00 00 00 00 00 00 00 00 00 00 00 &2c34 00 00 00 32 c4 00 00 00 00 00 00 00 00 00 00 00 &2c44 00 00 00 75 88 00 00 00 00 00 00 00 00 00 00 00 &2c54 00 00 00 ea 00 00 00 00 00 00 00 00 00 00 00 00 &2c64 00 00 00 cc 00 00 00 00 00 00 00 00 00 00 00 00 &2c74 00 00 11 00 00 00 00 00 00 00 00 00 00 00 00 00 ; pre_decryption_one_address # Used unencrypted &2c84 2d 2e ; &2e2d = pre_decryption_one ; display_loading_screen &2c86 78 SEI &2c87 a2 09 LDX #&09 &2c89 a9 00 LDA #&00 ; disable_event_flags_loop &2c8b 9d bf 02 STA &02bf,X ; os_event_enable_flags &2c8e ca DEX &2c8f 10 fa BPL &2c8b ; disable_event_flags_loop &2c91 ad b7 ff LDA &ffb7 ; os_rom_default_vector_table_address_low &2c94 85 80 STA &80 ; default_vectors_address_low &2c96 ad b8 ff LDA &ffb8 ; os_rom_default_vector_table_address_high &2c99 85 81 STA &81 ; default_vectors_address_high &2c9b ac b6 ff LDY &ffb6 ; os_rom_vector_table_length &2c9e 88 DEY ; reset_vector_table_loop &2c9f b1 80 LDA (&80),Y ; default_vectors_address &2ca1 99 00 02 STA &0200,Y ; os_vector_table &2ca4 88 DEY &2ca5 10 f8 BPL &2c9f ; reset_vector_table_loop &2ca7 58 CLI &2ca8 a2 8a LDX #&8a ; write_loading_text_loop &2caa bd 79 26 LDA &2679,X ; loading_text + 1 &2cad 20 ee ff JSR &ffee ; OSWRCH &2cb0 ca DEX &2cb1 d0 f7 BNE &2caa ; write_loading_text_loop ; &2cb3 a2 0a LDX #&0a &2cb5 a9 14 LDA #&14 &2cb7 8d a5 22 STA &22a5 ; plot_sprite_subtraction + 1 ; plot_sprites_loop &2cba bd 70 20 LDA &2070,X ; sprite_widths &2cbd 85 14 STA &14 ; columns_to_plot &2cbf bd 7b 20 LDA &207b,X ; sprite_heights &2cc2 85 15 STA &15 ; rows_to_plot &2cc4 bd 86 20 LDA &2086,X ; sprite_addresses_low &2cc7 85 16 STA &16 ; sprite_address_low &2cc9 bd 91 20 LDA &2091,X ; sprite_addresses_high &2ccc 85 17 STA &17 ; sprite_address_high &2cce 8a TXA &2ccf 48 PHA &2cd0 bd 9c 20 LDA &209c,X ; sprite_x_positions &2cd3 bc a7 20 LDY &20a7,X ; sprite_y_positions &2cd6 20 3a 22 JSR &223a ; plot_sprite # Also unpacks irq1_handler and run_second_loader &2cd9 68 PLA &2cda aa TAX &2cdb ca DEX &2cdc 10 dc BPL &2cba ; plot_sprites_loop &2cde 6c b8 20 JMP (&20b8) ; run_second_loader_address &2ce1 2e ; post_decryption_four &2ce2 a9 46 LDA #&46 ; &4600 = irq1_handler &2ce4 85 37 STA &37 ; irq1_vector_address_high &2ce6 6c 82 28 JMP (&2882) ; display_loading_screen_address ; unused &2ce9 2e ; sprite_3_data # "ddictive" &2cea 00 00 07 07 08 00 00 00 0f 01 0e 00 00 00 00 00 &2cfa 00 00 00 07 07 08 00 00 00 0f 01 0e 00 00 00 00 &2d0a 00 00 00 00 07 07 08 00 00 00 0f 01 0e 00 00 00 &2d1a 00 00 00 00 00 07 00 00 00 00 00 0f 00 00 00 00 &2d2a 00 00 00 00 00 07 07 07 08 03 08 03 0f 0d 0e 07 &2d3a 08 07 08 0e 00 01 0f 0f 07 08 0f 0e 03 0f 0d 0e &2d4a 07 08 07 0b 0f 08 03 0f 0f 07 09 0f 0f 03 0f 0d &2d5a 0e 07 08 0f 07 0f 0c 03 08 0f 07 09 0c 07 03 0f &2d6a 0d 0e 07 08 0f 07 01 0c 07 08 07 07 0b 0c 07 08 &2d7a 0f 01 0e 07 09 0e 0e 01 0e 07 00 07 07 0b 08 03 &2d8a 08 0f 01 0e 07 0b 0c 0e 07 0e 07 00 07 07 0b 08 &2d9a 00 00 0f 01 0e 07 0b 0c 0f 0f 00 07 00 07 07 0b &2daa 08 00 00 0f 01 0e 07 0f 08 0f 08 00 07 00 07 07 &2dba 0b 08 00 00 0f 01 0e 07 0f 00 0e 00 00 07 00 07 &2dca 07 0b 08 03 08 0f 01 0e 07 0f 00 0e 00 0e 07 08 &2dda 07 07 0b 0c 07 08 0f 01 0e 07 0e 00 0f 01 0e 03 &2dea 08 0f 07 09 0c 07 00 0f 01 0e 07 0c 00 07 01 0c &2dfa 03 0f 0f 07 09 0f 0f 00 0f 01 0e 07 0c 00 07 0f &2e0a 0c 01 0f 0f 07 08 0f 0e 00 0f 01 0e 07 08 00 03 &2e1a 0f 08 00 07 07 07 08 03 08 00 0f 01 0e 07 08 00 &2e2a 00 0e 00 ; pre_decryption_one_address # Used unencrypted &2e2d a9 72 LDA #&72 &2e2f 8d b2 20 STA &20b2 ; post_decryption_one_address_low &2e32 4c 7f 30 JMP &307f ; pre_decryption_two ; sprite_2_data # Code for run_second_loader, unpacked to &4f98 - &4fff &2e35 a9 fa 7f 8d 20 8d 02 01 38 02 a1 f7 69 00 ce d0 &2e45 58 02 00 8d 02 8d 58 85 ff 6e aa 9d ed 02 8d 02 &2e55 07 ea 04 a9 e3 2f 20 9d 4f ad 78 06 ad 02 ea 02 &2e65 14 a2 22 32 00 ad 58 ad 02 fd 8d ea a5 20 f2 42 &2e75 22 4f 9d 02 fc 8d ff 05 ea 37 ee a0 6f 0d ca 4f # &2e76 set to &bf at &272f, &2e7c set to &03 at &2f03, &2e85 09 ff 04 8d 02 ea 8d ff 4f 66 00 d0 c9 02 8d 02 # &2e87 set to &02 at &2674 &2e95 21 8d a5 05 a9 4c 66 00 ; sprite_1_data # "G" &2e9d 00 07 0f 08 00 01 0f 0f 0e 00 03 0f 0f 0f 00 07 &2ead 0e 01 0f 00 07 0c 00 0f 08 07 0c 00 07 08 0f 0c &2ebd 00 07 08 0f 08 00 00 00 0f 08 00 00 00 0f 08 00 &2ecd 00 01 0f 08 00 00 01 0f 08 00 00 03 0f 08 03 0f &2edd 0b 0f 08 03 0f 0b 0f 0c 03 0f 0b 07 0c 00 07 0b &2eed 07 0c 00 07 0b 07 0e 00 07 0b 03 0f 0f 0f 01 03 &2efd 0f 0f 0f 01 01 0f 0f 0e 00 00 07 0f 08 00 ; unused &2f0b 5e ; post_decryption_two &2f0c a9 03 LDA #&03 &2f0e 8d 7c 2e STA &2e7c ; sprite_2_data + &47 # Modifies a byte in run_second_loader (&4fcd) &2f11 4c 2d 27 JMP &272d ; post_decryption_three ; sprite_0_data # "ames" &2f14 07 0b 09 08 00 06 00 07 00 01 0f 08 0f 0f 0b 0e &2f24 01 0f 01 0f 0c 03 0f 0e 0f 0f 0b 0f 03 0f 03 0f &2f34 0e 07 0f 0e 0e 03 0b 0f 0f 0f 03 08 0e 07 00 0e &2f44 0c 03 0b 0f 0f 0f 07 00 0f 07 00 00 0c 01 0b 09 &2f54 0e 07 07 03 0f 07 0c 00 08 01 0b 09 0e 07 07 0f &2f64 08 03 0e 00 08 01 0b 08 0c 07 07 0c 00 01 0f 08 &2f74 08 01 0b 08 0c 07 07 00 00 00 0f 0c 0c 01 0b 08 &2f84 0c 07 07 00 07 00 03 0e 0c 03 0b 08 00 07 07 08 &2f94 0f 00 01 0e 0e 03 0b 08 00 07 03 08 0e 06 01 0e &2fa4 0f 0f 0b 08 00 07 03 0f 0e 07 0f 0e 0f 0f 0b 08 &2fb4 00 07 01 0f 0c 07 0f 0c 03 0b 0b 08 00 07 00 07 &2fc4 00 01 0f 08 ; unused # Stored unencrypted &2fc8 20 2a 20 20 54 68 61 6e 6b 73 20 74 6f 20 4a 6f ; " * Thanks to Jo" &2fd8 6e 20 42 75 74 74 6f 6e 20 66 6f 72 20 68 69 73 ; "n Button for his" &2fe8 20 68 65 6c 70 20 77 69 74 68 20 74 68 65 20 67 ; " help with the g" &2ff8 61 6d 65 20 20 2a 20 20 ; "ame * "; # &3000 - &30f7 is unencrypted ; decrypt_loader &3000 a9 00 LDA #&00 ; Identify Host/Operating System &3002 a2 ff LDX #&ff ; Return host/OS in X &3004 20 f4 ff JSR &fff4 ; OSBYTE &3007 8a TXA &3008 f0 7e BEQ &3088 ; is_electron &300a a9 fe LDA #&fe ; Read/Write available RAM &300c a2 00 LDX #&00 &300e a0 ff LDY #&ff &3010 20 f4 ff JSR &fff4 ; OSBYTE &3013 8a TXA &3014 f0 72 BEQ &3088 ; is_electron &3016 20 e5 30 JSR &30e5 ; set_null_nmi_handler # Returns A = 3 &3019 78 SEI &301a 8d 58 02 STA &0258 ; ESCAPE/BREAK effect # so clear memory on BREAK, disable ESCAPE &301d a9 cd LDA #&cd # Reset system on break &301f 8d 02 02 STA &0202 ; brk_vector_low &3022 a9 d9 LDA #&d9 ; &d9cd = os_reset_handler &3024 8d 03 02 STA &0203 ; brk_vector_high ; decrypt_2100_to_2fff # Decrypt &2100 - &2fff &3027 a9 00 LDA #&00 &3029 85 40 STA &40 ; decrypt_address_low &302b a9 21 LDA #&21 &302d 85 41 STA &41 ; decrypt_address_high ; decrypt_2100_to_2fff_loop &302f a0 00 LDY #&00 ; decrypt_2100_to_2fff_inner_loop &3031 b1 40 LDA (&40),Y ; decrypt_address &3033 4d ca 03 EOR &03ca ; tape_block_flag # using bytes hidden in the headers of the first file &3036 38 SEC ; decrypt_subtraction &3037 ed ca 03 SBC &03ca ; tape_block_flag # actually SBC &03cb ; tape_block_spare_bytes + 0 # Modified at &2121 &303a 18 CLC &303b 6d 58 02 ADC &0258 ; ESCAPE/BREAK effect &303e 91 40 STA (&40),Y ; decrypt_address &3040 88 DEY &3041 d0 ee BNE &3031 ; decrypt_2100_to_2fff_inner_loop &3043 e6 41 INC &41 ; decrypt_address_high &3045 a5 41 LDA &41 ; decrypt_address_high &3047 c9 30 CMP #&30 &3049 30 e4 BMI &302f ; decrypt_2100_to_2fff_loop &304b a9 01 LDA #&01 &304d 8d 62 02 STA &0262 ; os_sound_suppression ; wipe_0900_to_1eff_loop # Wipe &0900 - &1eff &3050 a0 00 LDY #&00 &3052 98 TYA ; wipe_0900_to_1eff_inner_loop &3053 99 00 1e STA &1e00,Y # actually STA wipe_address,Y &3056 88 DEY &3057 d0 fa BNE &3053 ; wipe_0900_to_1eff_inner_loop &3059 ce 55 30 DEC &3055 ; wipe_address_high &305c ad 55 30 LDA &3055 ; wipe_address_high &305f c9 09 CMP #&09 &3061 10 ed BPL &3050 ; wipe_0900_to_1eff_loop &3063 a0 a0 LDY #&a0 &3065 a9 ff LDA #&ff ; wipe_0100_to_01a0_loop &3067 99 00 01 STA &0100,Y # Wipe &0100 - &01a0 with &ff &306a 88 DEY &306b d0 fa BNE &3067 ; wipe_0100_to_01a0_loop &306d a9 00 LDA #&00 &306f 20 ed 30 JSR &30ed ; set_break_intercept_code # Clear break handler &3072 6c b2 20 JMP (&20b2) ; post_decryption_one_address # Continue towards display_loading_screen ; unused &3075 4f 27 4d 61 6c 6c 65 79 20 4e ; "O'Malley N" ; pre_decryption_two &307f a9 00 LDA #&00 ; &4600 = irq1_handler &3081 85 38 STA &38 ; irq1_vector_address_low &3083 4c 3a 28 JMP &283a ; pre_decryption_three ; unused &3086 46 65 ; is_electron &3088 a2 45 LDX #&45 ; write_electron_text_loop &308a bd 9f 30 LDA &309f,X ; electron_text &308d 20 ee ff JSR &ffee ; OSWRCH &3090 ca DEX &3091 10 f7 BPL &308a ; write_electron_text_loop &3093 a9 c8 LDA #&c8 ; Read/Write BREAK/ESCAPE effect &3095 a2 03 LDX #&03 ; Clear memory on next RESET &3097 a0 00 LDY #&00 &3099 20 f4 ff JSR &fff4 ; OSBYTE ; infinite_loop &309c 4c 9c 30 JMP &309c ; infinite_loop ; electron_text # Text is reversed &309f 32 2e 31 20 2e 53 2e 4f 20 6f 72 63 69 4d 20 43 ; MODE 4; TAB(&01, &0e); "This version of BOFFIN will only work" &30af 42 42 20 65 68 74 20 6e 6f 10 07 1f 6b 72 6f 77 ; TAB(&07, &10); "on the BBC Micro O.S. 1.2" &30bf 20 79 6c 6e 6f 20 6c 6c 69 77 20 4e 49 46 46 4f &30cf 42 20 66 6f 20 6e 6f 69 73 72 65 76 20 73 69 68 &30df 54 0e 01 1f 04 16 ; set_null_nmi_handler &30e5 a9 40 LDA #&40 ; RTI &30e7 8d 00 0d STA &0d00 ; nmi_handler &30ea a9 03 LDA #&03 &30ec 60 RTS ; set_break_intercept_code &30ed 8d 87 02 STA &0287 ; BREAK intercept code &30f0 58 CLI &30f1 60 RTS ; unused &30f2 00 00 00 00 00 00 After unpacking, ; irq1_handler &4600 08 PHP &4601 78 SEI &4602 48 PHA &4603 98 TYA &4604 48 PHA &4605 a9 00 LDA #&00 &4607 8d c7 03 STA &03c7 ; tape_block_number_high &460a ad c6 03 LDA &03c6 ; tape_block_number_low &460d d0 05 BNE &4614 ; not_block_zero &460f a9 50 LDA #&50 ; (second_stage_key + 5) MOD 256 # Store three bytes from first block header &4611 4c 16 46 JMP &4616 ; set_second_stage_key_address ; not_block_zero &4614 a9 4d LDA #&4d ; second_stage_key MOD 256 # Store three bytes from last block header ; set_second_stage_key_address &4616 8d 25 46 STA &4625 ; second_stage_key_address_low &4619 a0 03 LDY #&03 ; set_second_stage_key_loop &461b b9 ca 03 LDA &03ca,Y ; tape_block_spare_bytes - 1 # First, second and third of four spare bytes &461e 4d ca 03 EOR &03ca ; tape_block_flag &4621 38 SEC &4622 e9 9a SBC #&9a &4624 8d 50 48 STA &4850 ; second_stage_key + 5 # actually STA second_stage_key_address &4627 ce 25 46 DEC &4625 ; second_stage_key_address_low &462a 88 DEY &462b d0 ee BNE &461b ; set_second_stage_key_loop &462d ad 58 02 LDA &0258 ; ESCAPE/BREAK effect &4630 29 02 AND #&02 # &02 set if memory will be cleared on BREAK &4632 f0 07 BEQ &463b ; break_after_disabling_interrupts # Only branches if tampering attempted &4634 68 PLA &4635 a8 TAY &4636 68 PLA &4637 28 PLP &4638 4c 93 dc JMP &dc93 ; os_irq1_handler ; break_after_disabling_interrupts &463b a9 7f LDA #&7f # Disable all interrupts &463d 8d 4e fe STA &fe4e ; System VIA interrupt enable register # Unpacked code ends here, next instruction is BRK ; run_second_loader ; wipe_8000_to_bfff_loop # Wipe &8000 - &bfff (sideways RAM) &4f98 a9 00 LDA #&00 &4f9a aa TAX ; wipe_8000_to_bfff_inner_loop &4f9b 9d 00 bf STA &bf00,X # &4f9d set to &bf via &272f (would be &4f) # actually STA wipe_address,X &4f9e ca DEX &4f9f d0 fa BNE &4f9b ; wipe_8000_to_bfff_inner_loop &4fa1 ce 9d 4f DEC &4f9d ; wipe_address_high &4fa4 ad 9d 4f LDA &4f9d ; wipe_address_high &4fa7 c9 7f CMP #&7f &4fa9 d0 ed BNE &4f98 ; wipe_8000_to_bfff_loop &4fab ad 58 02 LDA &0258 ; ESCAPE/BREAK effect &4fae 09 02 ORA #&02 &4fb0 8d 58 02 STA &0258 ; ESCAPE/BREAK effect &4fb3 78 SEI &4fb4 ad fc ff LDA &fffc ; os_reset_address_low # Reset system on event, irq2, break or user vector &4fb7 8d 20 02 STA &0220 ; event_vector_low &4fba 8d 06 02 STA &0206 ; irq2_vector_low &4fbd 8d 02 02 STA &0202 ; brk_vector_low &4fc0 8d 00 02 STA &0200 ; user_vector_low # &4fc2 set to &02 via &2674 (would be &04) &4fc3 ad fd ff LDA &fffd ; os_reset_address_high &4fc6 8d 21 02 STA &0221 ; event_vector_high &4fc9 8d 07 02 STA &0207 ; irq2_vector_high &4fcc 8d 03 02 STA &0203 ; brk_vector_high # &4fcd set to &03 via &2f0e (would be &05) &4fcf 8d 01 02 STA &0201 ; user_vector_high &4fd2 ea NOP &4fd3 ea NOP &4fd4 ea NOP &4fd5 ea NOP &4fd6 ea NOP &4fd7 a5 38 LDA &38 ; irq1_vector_address_low &4fd9 8d 04 02 STA &0204 ; irq1_vector_low # Set to irq1_handler &4fdc a5 37 LDA &37 ; irq1_vector_address_high &4fde 8d 05 02 STA &0205 ; irq1_vector_high &4fe1 58 CLI &4fe2 a9 14 LDA #&14 # Restore default logical colours &4fe4 20 ee ff JSR &ffee ; OSWRCH &4fe7 a9 a1 LDA #&a1 # Use OS defaults &4fe9 85 e3 STA &e3 ; cassette_filing_system_options_byte &4feb a2 f2 LDX #&f2 &4fed a0 4f LDY #&4f ; &4ff2 = run_string &4fef 4c f7 ff JMP &fff7 ; OSCLI # Run the second stage ; run_string &4ff2 2f 22 42 6f 66 66 69 6e 20 32 22 0d ; /"Boffin 2" ; unused &4ffe 00 00 ; Boffin 2 ; 004ede 004ede 000122 ; entry_point &4ede a0 00 LDY #&00 ; decrypt_loader_loop &4ee0 b9 00 4f LDA &4f00,Y ; loader_code # Decrypt &4f00 - &4fff &4ee3 4d 4d 48 EOR &484d ; second_stage_key + 2 # using bytes hidden in block headers of "Boffin 2" &4ee6 18 CLC &4ee7 6d 4b 48 ADC &484b ; second_stage_key &4eea 4d 50 48 EOR &4850 ; second_stage_key + 5 &4eed 4d 4f 48 EOR &484f ; second_stage_key + 4 &4ef0 38 SEC &4ef1 ed 4e 48 SBC &484e ; second_stage_key + 3 &4ef4 4d 4c 48 EOR &484c ; second_stage_key + 1 &4ef7 99 00 4f STA &4f00,Y ; loader_code &4efa 88 DEY &4efb d0 e3 BNE &4ee0 ; decrypt_loader_loop &4efd 6c 8c 4f JMP (&4f8c) ; decrypted_entry_point_address ; unused &4f00 4e 32 a9 ; calculate_checksum &4f03 8a TXA &4f04 48 PHA &4f05 a9 00 LDA #&00 &4f07 85 70 STA &70 ; checksum_low &4f09 85 71 STA &71 ; checksum_high &4f0b a8 TAY ; calculate_checksum_loop &4f0c a5 71 LDA &71 ; checksum_high &4f0e 51 72 EOR (&72),Y ; start_address &4f10 85 71 STA &71 ; checksum_high &4f12 a2 08 LDX #&08 ; calculate_checksum_bit_loop &4f14 a5 71 LDA &71 ; checksum_high &4f16 2a ROL A &4f17 90 0c BCC &4f25 ; skip_bit &4f19 a5 71 LDA &71 ; checksum_high &4f1b 49 08 EOR #&08 &4f1d 85 71 STA &71 ; checksum_high &4f1f a5 70 LDA &70 ; checksum_low &4f21 49 10 EOR #&10 &4f23 85 70 STA &70 ; checksum_low ; skip_bit &4f25 26 70 ROL &70 ; checksum_low &4f27 26 71 ROL &71 ; checksum_high &4f29 ca DEX &4f2a d0 e8 BNE &4f14 ; calculate_checksum_bit_loop &4f2c e6 72 INC &72 ; start_address_low &4f2e d0 02 BNE &4f32 ; skip_page &4f30 e6 73 INC &73 ; start_address_high ; skip_page &4f32 a5 72 LDA &72 ; start_address_low &4f34 c5 74 CMP &74 ; end_address_low &4f36 d0 d4 BNE &4f0c ; calculate_checksum_loop &4f38 a5 73 LDA &73 ; start_address_high &4f3a c5 75 CMP &75 ; end_address_high &4f3c d0 ce BNE &4f0c ; calculate_checksum_loop &4f3e 68 PLA &4f3f aa TAX &4f40 60 RTS ; unused &4f41 44 a9 4e 4e ff # Not meaningful encrypted or decrypted ; decrypted_entry_point &4f47 a2 03 LDX #&03 ; calculate_checksums_loop &4f48 bd e0 4f LDA &4fe0,X ; checksum_start_addresses_low # Checksum four areas of memory: &4f4b 85 72 STA &72 ; start_address_low # &4f4d bd e6 4f LDA &4fe6,X ; checksum_start_addresses_high # 0: &4600 - &463f (first stage irq1_handler) &4f50 85 73 STA &73 ; start_address_high # 1: &1fb8 - &3087 (first stage) &4f52 bd ec 4f LDA &4fec,X ; checksum_end_addresses_low # 2: &4ede - &4fff (second stage) &4f55 85 74 STA &74 ; end_address_low # 3: &7300 - &7fff (end of screen memory) &4f57 bd f2 4f LDA &4ff2,X ; checksum_end_addresses_high # &4f5a 85 75 STA &75 ; end_address_high # Use checksums as part of main binary decryption key &4f5c 20 03 4f JSR &4f03 ; calculate_checksum &4f5f a5 70 LDA &70 ; checksum_low &4f61 9d 00 4e STA &4e00,X ; main_binary_key &4f64 a5 71 LDA &71 ; checksum_high &4f66 9d 04 4e STA &4e04,X ; main_binary_key + 4 &4f69 ca DEX &4f6a 10 dc BPL &4f48 ; calculate_checksums_loop &4f6c ad 04 02 LDA &0204 ; irq1_vector_low # The address of irq1_handler is part of the key &4f6f 8d 08 4e STA &4e08 ; main_binary_key + 8 &4f72 ad 05 02 LDA &0205 ; irq1_vector_high &4f75 8d 09 4e STA &4e09 ; main_binary_key + 9 &4f78 78 SEI &4f79 a9 8e LDA #&8e &4f7b 8d 04 02 STA &0204 ; irq1_vector_low &4f7e a9 4f LDA #&4f ; &4f8e = irq1_handler &4f80 8d 05 02 STA &0205 ; irq1_vector_high &4f83 58 CLI &4f84 a2 d4 LDX #&d4 &4f86 a0 4f LDY #&4f ; &4fd4 = run_string &4f88 4c f7 ff JMP &fff7 ; OSCLI # Run the main binary ; unused &4f8b 46 ; decrypted_entry_point_address &4f8c 46 4f ; &4f46 = decrypted_entry_point ; irq1_handler &4f8e ad c6 03 LDA &03c6 ; tape_block_number_low &4f91 c9 16 CMP #&16 &4f93 d0 0e BNE &4fa3 ; not_block_16 &4f95 ad bb 03 LDA &03bb ; tape_block_header_filename + 9 # A byte of the key is in the header for block &16 &4f98 4d ca 03 EOR &03ca ; tape_block_flag &4f9b 49 dd EOR #&dd &4f9d 8d 0b 4e STA &4e0b ; main_binary_key + 11 &4fa0 4c b2 4f JMP &4fb2 ; repair_block_header ; not_block_16 &4fa3 c9 35 CMP #&35 &4fa5 d0 0b BNE &4fb2 ; repair_block_header &4fa7 ad bb 03 LDA &03bb ; tape_block_header_filename + 9 # A byte of the key is in the header for block &35 &4faa 4d ca 03 EOR &03ca ; tape_block_flag &4fad 49 2c EOR #&2c &4faf 8d 0c 4e STA &4e0c ; main_binary_key + 12 ; repair_block_header &4fb2 a9 00 LDA #&00 &4fb4 8d c7 03 STA &03c7 ; tape_block_number_high &4fb7 8d ba 03 STA &03ba ; tape_block_header_filename + 8 &4fba 8d be 03 STA &03be ; tape_load_address_low &4fbd a9 01 LDA #&01 &4fbf 8d c9 03 STA &03c9 ; tape_block_length_high &4fc2 a9 04 LDA #&04 &4fc4 8d bf 03 STA &03bf ; tape_load_address_high &4fc7 a9 0a LDA #&0a &4fc9 8d c2 03 STA &03c2 ; tape_execution_address_low &4fcc a9 10 LDA #&10 ; &100a = entry_point of main binary &4fce 8d c3 03 STA &03c3 ; tape_execution_address_high &4fd1 4c 93 dc JMP &dc93 ; os_irq1_handler ; run_string &4fd4 2f 22 42 6f 66 66 69 6e 20 33 22 0d ; /"Boffin 3" ; 0 1 2 3 4 5 # Areas four and five are unused ; checksum_start_addresses_low &4fe0 00 b8 de 00 0b 1b ; checksum_start_addresses_high &4fe6 46 1f 4e 73 01 65 ; checksum_end_addresses_low &4fec 3f 87 ff ff 50 df ; checksum_end_addresses_high &4ff2 46 30 4f 7f 01 07 ; unused &4ff8 c3 45 76 33 a2 3a 3c a9 # Not meaningful encrypted or decrypted Game disassembly ================ # &0400 - &4bff is decrypted at &4c50 ; cave_data_addresses_low_table &0400 8c ee 52 45 a8 0e 72 cc 23 8f a0 e9 4f bb 0d 2e &0410 89 e5 40 98 ; start_riding_mantaray &0414 a9 00 LDA #&00 &0416 85 0e STA &0e ; delay_reduction &0418 4c 98 12 JMP &1298 ; ride_mantaray ; cave_data_addresses_high_table &041b 04 04 05 0a 05 06 06 06 0f 0a 07 0a 0b 0b 0c 07 &042b 0c 0c 0d 0d ; unused &042f 00 ; restart_cave &0430 20 b3 0f JSR &0fb3 ; start_cave &0433 4c 1a 10 JMP &101a ; to_play_cave ; clear_out_of_time_and_collect_petridish &0436 a9 00 LDA #&00 # Zero to indicate not out of time &0438 85 49 STA &49 ; out_of_time &043a 4c bd 22 JMP &22bd ; collect_petridish ; unused &043d 00 00 00 ; long_barbed_wires_x # Values are overwritten when cave is initialised &0440 11 7d 80 ; long_barbed_wires_y # Third long barbed wire slot is never used &0443 57 5a 87 ; short_barbed_wires_x &0446 85 88 54 ; short_barbed_wires_y &0449 b0 c8 11 ; tripods_x # Second and third tripod slots are never used &044c c7 b0 0f ; tripods_y &044f 84 84 87 ; petridishes_x &0452 71 54 87 ; petridishes_y &0455 7e 73 b0 ; horseshoes_x &0458 25 6f 8b 73 81 b0 ; horseshoes_y &045e bf 97 98 c3 b0 b0 ; trampolines_x &0464 62 b0 b0 2a 57 b0 # Fifth and sixth trampoline slots are never used ; trampolines_y &046a 20 6f 83 7c b0 1d ; mantarays_x &0470 c5 2b 6f 7c 7c # Third, fourth and fifth manta ray slots are never used ; mantarays_y &0475 73 57 b0 00 00 ; initial_tarantula_x &047a 00 ; initial_tarantula_y &047b 00 ; owl_x &047c 1c # Owl position matches cave 2 ; owl_y &047d 81 ; one_second_timer_block &047e 9c ff ff ff ff # -100 centiseconds = one second ; five_centisecond_timer_block &0483 fb ff ff ff ff # -5 centiseconds ; dark_colour_scheme &0488 04 00 00 03 ; B K K Y ; cave_1_data &048c 00 # Screen size &048d 01 # 1 platform &048e b4 7c &0490 0d # 14 platforms &0491 5a 88 70 88 b4 5c 7a 4e 50 4d 84 56 46 54 8e 5e &04a1 3c 5b 98 64 32 62 a0 6c 28 69 &04ab 03 # 3 platforms &04ac 10 6e 7a 88 54 88 &04b2 01 # 1 platform &04b3 6e 40 &04b5 03 # 3 walls &04b6 84 8a 25 05 8e 25 04 17 38 25 04 1a &04c2 01 # 1 long barbed wire &04c3 64 8c &04c5 00 # 0 short barbed wires &04c6 01 # 1 tripod &04c7 b4 70 &04c9 03 # 3 petri dishes &04ca 6a 35 62 35 5a 35 &04d0 06 # 6 horseshoes &04d1 60 5e 08 3c 6a 6a 58 6a 5c 4e 66 4e &04dd 00 # 0 trampolines &04de 00 # 0 manta rays &04df 00 00 # No tarantula &04e1 0c 8c # Owl is at (&0c, &8c) &04e3 01 25 00 04 # 125 seconds or 4 seconds time &04e7 b0 49 # Player starts at (&b0, &49) &04e9 00 # Player starts facing left &04ea 07 00 05 06 ; W K M C ; cave_2_data &04ee 00 # Screen size &04ef 04 # 4 platforms &04f0 08 41 2c 72 22 69 18 60 &04f8 0b # 11 platforms &04f9 b0 7f a2 82 94 85 4c 8a 58 8a 64 8a 48 33 40 3d &0509 50 3d 58 47 38 44 &050f 03 # 3 platforms &0510 3e 7a 7c 8a 8e 4c &0515 02 # 2 platforms &0517 b4 47 76 54 &051b 03 # 3 walls &051c 3e 8a 08 10 2e 8a 0f 09 b4 8a 0d 08 &0528 01 # 1 long barbed wire &0529 88 8a &052b 01 # 1 short barbed wire &052c 6c 8a &052e 01 # 1 tripod &052f 06 35 &0531 02 # 2 petri dishes &0532 70 49 06 8a &0536 05 # 5 horseshoes &0537 b2 5e 82 1c 16 32 56 31 6a 7f &0541 00 # 0 trampolines &0542 00 # 0 manta rays &0543 00 00 # No tarantula &0545 1c 81 # Owl is at (&1c, &81) &0547 01 25 00 13 # 125 seconds or 13 seconds time &054b b2 3c # Player starts at (&b2, &3c) &054d 00 # Player starts facing left &054e 07 00 05 06 ; W K M C ; cave_3_data &0552 01 # Screen size &0553 03 # 3 platforms &0554 8c b0 1e 95 8a 8c &055a 04 # 4 platforms &055b 74 32 6a 3b 60 52 8a 5b &0563 01 # 1 platform &0564 2c 4a &0566 02 # 2 platforms &0567 52 53 58 85 &056b 02 # 4 walls &056c 1c b2 02 07 8c 4d 01 05 &0574 02 # 2 long barbed wires &0575 18 b4 0c b4 &0579 00 # 0 short barbed wires &057a 01 # 1 tripod &057b 8c a4 &057d 03 # 3 petri dishes &057e 40 7a 52 48 28 3f &0584 05 # 5 horseshoes &0585 66 25 6a 3e 32 4d 0e 1d 4a ad &058f 04 # 4 trampolines &0590 1a 89 38 b2 74 b3 56 b5 &0598 00 # 0 manta rays &0599 00 00 # No tarantula &059b 8c 80 # Owl is at (&8c, &80) &059d 02 00 00 12 # 200 seconds or 12 seconds time &05a1 8a 48 # Player starts at (&8a, &48) &05a3 00 # Player starts facing left &05a4 07 00 05 06 ; W K M C ; cave_5_data &05a8 02 # Screen size &05a9 01 # 1 platform &05aa 46 ac &05ac 0a # 10 platforms &05ad 20 40 0c 50 20 60 0c 70 20 80 0c 90 20 a0 0c b0 &05bd 20 c0 0c d0 &05c1 01 # 1 platform &05c2 50 42 &05c4 01 # 1 platform &05c5 3e 77 &05c7 06 # 6 walls &05c8 28 b2 03 34 28 4a 03 3e 28 7e 03 34 5c e0 02 50 &05d8 5c 9a 02 50 50 f6 03 04 &05e0 00 # 0 long barbed wires &05e1 00 # 0 short barbed wires &05e2 00 # 0 tripods &05e3 03 # 3 petri dishes &05e4 0a bd 0a 7d 4a 37 &05ea 06 # 6 horseshoes &05eb 1c 4a 08 5a 1c 6a 08 9a 1c 8a 62 6a &05f7 03 # 3 trampolines &05f8 3c f2 3e 6d 5a a0 &05fe 00 # 0 manta rays &05ff 00 00 # No tarantula &0601 5c f6 # Owl is at (&5c, &f6) &0603 02 00 00 15 # 200 seconds or 15 seconds time &0607 08 3d # Player starts at (&08, &3d) &0609 01 # Player starts facing right &060a 07 00 05 02 ; ; W K M G ; cave_6_data &060e 01 # Screen size &060f 03 # 3 platforms &0610 2c 78 4c 71 70 67 &0616 00 # 0 platforms &0617 02 # 2 platforms &0618 2a 36 44 70 &061c 01 # 1 platform &061d 50 42 &061f 07 # 7 walls &0620 0c 54 02 12 2c 78 04 07 48 71 0a 07 70 b2 04 34 &0630 4c b2 02 48 70 80 04 20 84 56 02 06 &063c 00 # 0 long barbed wires &063d 02 # 2 short barbed wires &063e 24 b2 48 b2 &0642 00 # 0 tripods &0643 03 # 3 petri dishes &0644 48 ab 22 ab 50 37 &064a 06 # 6 horseshoes &064b 32 73 30 3c 5c 40 7e aa 0a 40 3a 7c &0657 04 # 4 trampolines &0658 88 b2 1c b2 40 b2 68 b2 &0660 01 # 1 manta ray &0661 60 ab &0663 00 00 # No tarantula &0665 88 50 # Owl is at (&88, &50) &0667 02 00 00 26 # 200 seconds or 26 seconds time &066b 0e ab # Player starts at (&0e, &ab) &066d 01 # Player starts facing right &066e 07 00 05 02 ; W K M G ; cave_7_data &0672 01 # Screen size &0673 03 # 3 platforms &0674 2e ac 08 4a 8c 8c &067a 05 # 5 platforms &067b 60 5b 56 65 4c 6a 38 83 8c 50 &0685 04 # 4 platforms &0686 38 58 3e b3 4c a9 54 9f &068e 01 # 1 platform &068f 88 a6 &0691 02 # 2 walls &0692 56 2c 03 20 0a b2 01 07 &069a 01 # 1 long barbed wire &069b 60 b2 &069d 03 # 3 short barbed wires &069e 68 b2 08 b2 86 9b &06a4 01 # 1 tripod &06a5 34 70 &06a7 01 # 1 petri dish &06a8 38 a8 &06aa 06 # 6 horseshoes &06ab 54 6e 5a 98 3e 5d 6e 8c 8c 5a 38 80 &06b7 00 # 0 trampolines &06b8 02 # 2 manta rays &06b9 1e b2 76 9b &06bd 00 00 # No tarantula &06bf 8c 3d # Owl is at (&8c, &3d) &06c0 02 25 00 27 # 225 seconds or 27 seconds time &06c5 08 3e # Player starts at (&08, &3e) &06c7 01 # Player starts facing right &06c8 07 00 05 02 ; W K M G ; cave_8_data &06cc 02 # Screen size &06cd 00 # 0 platforms &06ce 09 # 9 platforms &06cf 5c b9 48 54 42 87 3c 96 36 a5 5a f6 28 53 42 36 &06df 42 6a &06e1 00 # 0 platforms &06e2 00 # 0 platforms &06e3 07 # 7 walls &06e4 18 f6 0c 04 42 4c 03 40 42 78 03 2c 30 a5 0a 05 &06f4 64 da 01 07 26 f2 05 08 64 31 02 07 &0700 01 # 1 long barbed wire &0701 2a a0 &0703 00 # 1 short barbed wire &0704 01 # 1 tripod &0705 64 2a &0707 02 # 2 petri dishes &0708 26 40 56 99 &070c 05 # 5 horseshoes &070d 48 1f 3e 22 3a 82 20 96 16 1b &0717 01 # 1 trampoline &0718 42 f2 &071a 02 # 2 manta rays &071b 14 f2 5c a6 &071f 00 00 # No tarantula &0721 5a e3 # Owl is at (&5a, &e3) &0723 02 25 00 31 # 225 seconds or 31 seconds time &0727 1e df # Player starts at (&1e, &df) &0729 01 # Player starts facing right &072a 07 00 05 02 ; W K M G ; cave_16_data &072e 00 # Screen size &072f 11 # 17 platforms &0730 0a 53 1e 53 32 53 46 53 5a 53 6e 53 82 53 94 53 &0740 32 5e 34 69 36 74 38 7f 3a 89 6e 5e 6c 69 6a 74 &0750 68 7f &0752 02 # 2 platforms &0753 1e 8a b6 68 &0757 00 # 0 platforms &0758 00 # 0 platforms &0759 05 # 5 walls &075a b4 80 05 18 b4 8a 0f 0a 6e 8a 02 3f 58 8a 0b 08 &076a 8a 8a 01 07 &076e 01 # 1 long barbed wire &076f 52 8a &0771 03 # 3 short barbed wires &0772 62 8a 40 8a 88 8b &0778 00 # 0 tripods &0779 02 # 2 petri dishes &077a 54 82 9a 80 &077e 05 # 5 horseshoes &077f 82 1a 4a 1e 5e 1e 72 1e 96 88 &0789 02 # 2 trampolines &078a 80 8b b2 88 &078e 01 # 1 manta ray &078f 1e 77 &0791 26 47 # Tarantula starts at (&26, &47) &0793 b6 55 # Owl is at (&b6, &55) &0795 01 50 00 15 # 150 seconds or 15 seconds time &0799 36 47 # Player starts at (&36, &47) &079b 01 # Player starts facing right &079c 03 00 00 03 ; Y K K Y ; cave_11_data &07a0 01 # Screen size &07a1 01 # 1 platform &07a2 08 3b &07a4 06 # 6 platforms &07a5 38 4d 60 4d 68 58 70 63 30 5a 36 90 &07b1 01 # 1 platform &07b2 8e 38 &07b4 00 # 0 platforms &07b5 06 # 6 walls &07b6 8e 3a 01 10 5c 90 16 05 76 b2 07 08 22 b2 06 09 &07c6 60 90 02 46 68 b2 10 05 &07ce 01 # 1 long barbed wire &07cf 5e 8b &07d1 01 # 1 short barbed wire &07d2 74 b1 &07d4 01 # 1 tripod &07d5 06 2f &07d7 02 # 2 petri dishes &07d8 68 ad 20 a9 &07dc 06 # 6 horseshoes &07dd 76 51 86 2b 30 17 36 8b 44 99 28 41 &07e9 02 # 2 trampolines &07ea 8e aa 1a a9 &07ef 01 # 1 manta ray &07ef 4a 8b &07f1 00 00 # No tarantula &07f3 36 7d # Owl is at (&36, &7d) &07f5 02 25 00 30 # 225 seconds or 30 seconds time &07f9 76 a2 # Player starts at (&76, &a2) &07fb 00 # Player starts facing left &07fc 07 00 05 06 ; W K M C ; OS sound workspace and channel buffers &0800 00 00 00 00 00 00 00 d0 c0 c0 c0 df 04 04 04 00 &0810 74 0f 40 84 00 00 01 ff 00 08 00 00 00 00 00 44 &0820 05 04 02 04 20 30 70 ff 02 01 03 00 00 00 00 00 &0830 00 00 00 84 01 ff 00 00 ff 40 3f 00 00 97 00 08 &0840 55 10 10 74 0c 10 74 0c 10 58 55 10 58 55 10 58 &0850 1a 18 0f 1a 18 0f 1a 18 0f 1a 18 0f 1a 18 0f 1a &0860 40 1a 28 89 1a 38 40 1a 38 40 1a 28 89 1a 38 38 &0870 64 06 90 64 06 90 64 06 e0 84 4e 90 64 06 90 90 ; chan vol pitch dur ; sound_0 # Walking &0880 03 00 09 00 7c 00 01 00 ; sound_1 # Blocked movement &0888 10 00 07 00 40 00 01 00 ; sound_2 # Bouncing off obstacle above &0890 02 00 08 00 40 00 1a 00 ; sound_3 # Collecting horseshoe &0898 12 00 06 00 89 00 1a 00 ; sound_4 # Collecting tripod &08a0 12 00 05 00 39 00 1a 00 ; sound_5 # Collecting petri dish &08a8 10 00 03 00 74 00 0c 00 ; sound_6 # Trampoline bounce &08b0 11 00 04 00 0f 00 1a 00 ; sound_7 # Time bonus &08b8 10 00 02 00 74 00 01 00 ; envelope_1 # Completion tune &08c0 01 00 00 00 00 00 00 3f 0a 00 c1 28 68 00 00 00 ; envelope_2 # Time bonus &08d0 01 00 01 00 02 00 01 7f 80 80 80 55 46 00 00 00 ; envelope_3 # Collecting petri dish &08e0 04 01 f8 00 01 01 00 7f fd e1 9c 73 19 00 00 00 ; envelope_4 # Trampoline bounce &08f0 02 ff 02 00 09 32 00 41 01 fb ff 7e 73 00 00 00 ; envelope_5 # Collecting tripod &0900 04 01 f7 08 01 01 02 5e fb f8 fa 7e 7e 00 00 00 ; envelope_6 # Collecting horseshoe &0910 01 ff 05 01 03 00 01 3d f3 ff f3 7e 32 00 00 00 ; envelope_7 # Blocked movement &0920 01 00 00 00 00 00 00 46 f3 e2 dd 32 37 00 00 00 ; envelope_8 # Bouncing off obstacle above &0930 06 01 ff 00 08 08 00 3c e2 f4 f9 7e 73 00 00 00 ; envelope_9 # Walking &0940 01 00 00 00 00 00 00 fb 4c e0 fb 32 4b 00 00 00 ; envelope_10 # Falling &0950 03 ff fe fd 04 04 ff 28 fa fb fb 64 70 11 00 00 ; envelope_11 # Rolling eyes &0960 02 01 ff 00 23 28 00 07 fe ff fd 78 73 00 00 00 ; envelope_12 # Manta ray moving &0970 03 00 00 00 00 00 00 09 fc f2 f2 46 41 00 00 00 ; envelope_13 # Tarantula moving &0980 04 01 fe 00 0e 37 00 64 fd 00 fe 7e 7e 00 00 00 ; envelope_14 # Collapsing manta ray, dying &0990 03 ff ff 00 16 1e 00 0a ee fd fd 72 76 00 00 00 ; chan vol pitch dur ; sound_8 # Rolling eyes &09a0 11 00 0b 00 30 00 05 00 ; sound_9 # Manta ray moving &09a8 10 00 0c 00 55 00 10 00 ; sound_10 # Tarantula moving &09b0 10 00 0d 00 ac 00 1a 00 ; sound_11 # Collapsing manta ray &09b8 13 00 0e 00 b9 00 0a 00 ; sound_12 # Falling &09c0 11 00 0a 00 44 00 20 00 ; sound_13 # Dying &09c8 11 00 0e 00 78 00 05 00 ; play_final_death_sound_and_delay &09d0 a9 07 LDA #&07 ; Generate a sound (SOUND) &09d2 a2 c8 LDX #&c8 &09d4 a0 09 LDY #&09 ; &09c8 = sound_13 # Play sound for dying &09d6 20 f1 ff JSR &fff1 ; OSWORD &09d9 a9 40 LDA #&40 &09db 4c 76 37 JMP &3776 ; delay ; cave_number_string # Text is reversed &09de 9c 09 09 09 # Move right three characters, NEW_BACKGROUND ; write_cave_number &09e2 a2 03 LDX #&03 ; write_cave_number_loop &09e4 bd de 09 LDA &09de,X ; cave_number_string &09e7 20 ee ff JSR &ffee ; OSWRCH &09ea ca DEX &09eb 10 f7 BPL &09e4 ; write_cave_number_loop &09ed 60 RTS ; cave_number_screen_and_delay &09ee 20 a9 1a JSR &1aa9 ; cave_number_screen &09f1 20 b1 1a JSR &1ab1 ; came_number_screen_second_line &09f4 a9 48 LDA #&48 &09f6 4c 76 37 JMP &3776 ; delay ; unused &09f9 50 4f 27 4d 50 ; "PO'MP" ; tune_data ; c p d &09fe 11 88 07 &0a01 12 74 07 &0a04 13 68 07 &0a07 01 88 02 &0a0a 02 74 02 &0a0d 03 68 02 &0a10 01 88 02 &0a13 02 74 02 &0a16 03 68 02 &0a19 01 88 02 &0a1c 02 74 02 &0a1f 03 68 02 &0a22 01 88 07 &0a25 02 74 07 &0a28 03 68 07 &0a2b 01 80 07 &0a2e 02 6c 07 &0a31 03 60 07 &0a34 01 88 0d &0a37 02 74 0d &0a3a 03 68 0d ; tune_sound ; chan vol pitch dur &0a3d 03 00 01 00 68 00 0d 00 ; cave_4_data &0a45 00 # Screen size &0a46 01 # 1 platform &0a47 98 8b &0a49 04 # 4 platforms &0a4a 10 50 70 57 16 5e 7a 3a &0a52 03 # 3 platforms &0a53 58 8e 78 8e 92 56 &0a59 02 # 2 platforms &0a5a 3c 50 62 47 &0a5e 02 # 2 walls &0a5f 3a 8a 1d 07 b4 4f 06 09 &0a67 00 # 0 long barbed wires &0a68 00 # 0 short barbed wires &0a69 00 # 0 tripods &0a6a 02 # 2 petri dishes &0a6b 76 27 6a 44 &0a6f 06 # 6 horseshoes &0a70 1e 1b 1e 4d 66 17 42 50 64 88 7c 35 &0a7c 01 # 1 trampoline &0a7d b4 8e &0a7f 00 # 0 manta rays &0a80 22 83 # Tarantula starts at (&22, &83) &0a82 b4 46 # Owl is at (&b4, &46) &0a84 01 50 00 10 # 150 seconds or 10 seconds time &0a88 10 3d # Player starts at (&10, &3d) &0a8a 01 # Player starts facing right &0a8a 07 00 05 06 ; W K M C ; cave_10_data &0a8f 01 # Screen size &0a90 01 # 1 platform &0a91 24 55 &0a93 04 # 4 platforms &0a94 58 4a 3c 4a 60 50 68 5e &0a9c 00 # 0 platforms &0a9d 02 # 2 platforms &0a9e 58 17 1e 8c &0aa1 05 # 5 walls &0aa3 4c 78 03 05 70 88 02 36 58 3b 14 04 3a 18 0a 0c &0ab3 58 18 14 07 &0ab7 01 # 1 long barbed wire &0ab8 6c 5b &0aba 01 # 1 short barbed wire &0abb 68 4b &0abd 00 # 0 tripods &0abe 03 # 3 petri dishes &0abf 7e a5 4c 73 20 86 &0ac5 05 # 5 horseshoes &0ac6 38 54 4e 46 80 1a 44 73 26 1a &0ad0 02 # 2 trampolines &0ad1 68 b6 38 4a &0ad5 02 # 2 manta rays &0ad6 84 b2 14 81 &0ad7 2e b2 # Tarantula starts at (&2e, &b2) &0adc 0c b2 # Owl is at (&0c, &b2) &0ade 02 25 00 26 # 225 seconds or 26 seconds time &0ae2 08 6e # Player starts at (&08, &6e) &0ae4 01 # Player starts facing right &0ae5 07 00 00 01 ; W K K R ; cave_12_data &0ae9 02 # Screen size &0aea 06 # 6 platforms &0aeb 08 3b 64 f4 08 ac 18 ac 28 ac 26 f2 &0af7 05 # 5 platforms &0af8 40 a2 14 dd 64 68 50 52 58 5d &0b02 02 # 2 platforms &0b03 28 46 42 94 &0b07 00 # 0 platforms &0b08 04 # 4 walls &0b09 48 f2 0a 12 28 6f 0e 06 34 8a 1a 01 34 f2 02 68 &0b19 01 # 1 long barbed wire &0b1a 64 55 &0b1c 03 # 3 short barbed wires &0b1d 08 a0 18 a0 28 a0 &0b23 01 # 1 tripod &0b24 06 2f &0b26 03 # 3 petri dishes &0b28 10 69 08 f6 40 e0 &0b2e 06 # 6 horseshoes &0b2f 18 97 04 97 38 dc 20 18 60 4c 64 20 &0b3a 01 # 1 trampoline &0b3b 62 e8 &0b3d 01 # 1 manta ray &0b3e 3c 89 &0b40 00 00 # No tarantula &0b42 28 e6 # Owl is at (&28, &e6) &0b43 02 25 00 20 # 225 seconds or 20 seconds time &0b48 5c 4a # Player starts at (&5c, &4a) &0b4a 01 # Player starts facing right &0b4b 07 00 05 06 ; W K M C ; cave_13_data &0b4f 00 # Screen size &0b50 00 # 0 platforms &0b51 00 # 0 platforms &0b52 00 # 0 platforms &0b53 00 # 0 platforms &0b54 0e # 14 walls &0b55 04 6a 01 32 14 6a 01 23 20 6a 01 26 2c 6a 01 26 &0b65 3a 6a 01 2c 4c 6a 01 18 5e 6a 01 10 68 6a 01 06 &0b75 74 6a 01 06 84 6a 01 06 9a 8a 30 03 3a 8a 1d 03 &0b85 1e 6a 0f 0b b4 87 03 45 &0b8d 01 # 1 long barbed wire &0b8e 10 67 &0b90 01 # 1 short barbed wire &0b91 1e 66 &0b93 00 # 0 tripods &0b94 03 # 3 petri dishes &0b95 3c 3e 4e 52 60 5a &0b9b 06 # 6 horseshoes &0b9c 3a 34 4c 48 68 60 74 60 2c 40 14 43 &0ba8 01 # 1 trampoline &0ba9 b6 8f &0bab 00 # 0 manta rays &0bac 22 87 # Tarantula starts at (&22, &87) &0bae b6 42 # Owl is at (&b6, &42) &0bb0 01 25 00 03 # 125 seconds or 3 seconds &0bb4 08 3b # Player starts at (&08, &3b) &0bb6 01 # Player starts facing right &0bb7 03 00 00 03 ; Y K K Y ; cave_14_data &0bbb 02 # Screen size &0bbc 01 # 1 platform &0bbd 62 4c &0bbf 09 # 9 platforms &0bc0 4e d9 46 e4 3e ef 2e ab 36 b6 18 ab 0c f6 2a 32 &0bd0 3a 5e &0bd2 01 # 1 platform &0bd3 34 f2 &0bd5 00 # 0 platforms &0bd6 03 # 3 walls &0bd7 04 39 02 06 0e 91 01 80 4c 4b 03 04 &0be3 00 # 0 long barbed wires &0be4 00 # 0 short barbed wires &0be5 00 # 0 tripods &0be6 02 # 2 petri dishes &0be7 2e e7 4a 47 &0beb 06 # 6 horseshoes &0bec 12 20 26 1e 56 4e 0c f4 38 da 40 cf &0bf8 02 # 2 trampolines &0bf9 66 c8 28 99 &0bfd 00 # 0 manta rays &0bfe 00 00 # No tarantula &0c00 64 40 # Owl is at (&64, &40) &0c02 02 00 00 34 # 200 seconds or 24 seconds time &0c06 08 33 # Player starts at (&08, &33) &0c08 01 # Player starts facing right &0c09 07 00 05 02 ; W K M G ; cave_15_data &0c0d 02 # Screen size &0c0e 1b # 27 platforms &0c0f 08 48 0a 50 0c 58 0e 60 10 68 12 70 14 78 26 9a &0c1f 24 a2 22 aa 20 b2 1e ba 0c da 0e e2 10 ea 12 f2 &0c2f 14 fa 50 46 52 4e 54 56 56 5e 58 66 56 f6 26 33 &0c3f 0a b2 28 70 66 a0 &0c45 00 # 0 platforms &0c46 00 # 0 platforms &0c47 00 # 0 platforms &0c48 04 # 4 walls &0c49 18 fa 0c 08 4e f6 02 64 4e 92 02 54 66 a0 01 10 &0c59 00 # 0 long barbed wires &0c5a 02 # 2 short barbed wires &0c5b 26 8e 0c ce &0c5f 01 # 1 tripod &0c60 50 9e &0c62 03 # 3 petri dishes &0c63 26 87 0a c7 52 3a &0c69 05 # 5 horseshoes &0c6a 64 28 26 25 06 a4 28 62 42 18 &0c74 01 # 1 trampoline &0c75 2c f2 &0c77 01 # 1 manta ray &0c78 40 f2 &0c7a 00 00 # No tarantula &0c7c 58 ea # Owl is at (&58, &ea) &0c7e 02 00 00 12 # 200 seconds or 12 seconds time &0c82 0a 3c # Player starts at (&0a, &3c) &0c84 01 # Player starts facing right &0c85 07 00 05 02 ; W K M G ; cave_17_data &0c89 01 # Screen size &0c8a 08 # 8 platforms &0c8b 2a b4 72 b4 84 50 0a 7e 82 aa 8a a0 4e 2c 6c 70 &0c9b 06 # 6 platforms &0c9c 18 b2 3e a7 36 b2 62 a7 6a b2 6c 48 &0ca8 01 # 1 platform &0ca9 3e 2b &0cab 00 # 0 platforms &0cac 02 # 2 walls &0cad 2c 6e 06 05 22 40 12 04 &0cb5 01 # 1 long barbed wire &0cb6 0c b2 &0cb8 02 # 2 short barbed wires &0cb9 20 b2 7a b2 &0cbd 00 # 0 tripods &0cbe 03 # 3 petri dishes &0cbf 18 3c 26 69 80 44 &0cc5 06 # 6 horseshoes &0cc6 6c 54 88 6d 3a 1f 4e 20 08 90 0a 55 &0cd2 01 # 1 trampoline &0cd3 58 94 &0cd5 00 # 0 manta rays &0cd6 00 00 # No tarantula &0cd8 0c 72 # Owl is at (&0c, &72) &0cda 02 50 00 23 # 250 seconds or 23 seconds time &0cde 0a 3c # Player starts at (&0a, &3c) &0ce0 01 # Player starts facing right &0ce1 07 00 05 01 ; W K M R ; cave_18_data &0ce5 01 # Screen size &0ce6 06 # 6 platforms &0ce7 6a 77 0a 8c 6a 36 20 9a 28 a5 30 b0 &0cf3 02 # 2 platforms &0cf4 3c 4d 1c 40 &0cf8 00 # 0 platforms &0cf9 00 # 0 platforms &0cfa 05 # 5 walls &0cfb 68 b2 02 44 8c b2 12 05 66 36 02 2a 84 42 02 06 &0d0b 18 60 02 20 &0d0f 01 # 1 long barbed wire &0d10 18 b2 &0d12 03 # 3 short barbed wires &0d13 60 b2 6a 6b 6e ad &0d19 00 # 0 tripods &0d1a 02 # 2 petri dishes &0d1b 28 99 38 3a &0d1f 06 # 6 horseshoes &0d20 68 25 8c 58 18 2b 62 80 36 74 38 ab &0d2c 01 # 1 trampoline &0d2d 8a b5 &0d2f 01 # 1 manta ray &0d30 50 b2 &0d32 00 00 # No tarantula &0d34 0c 80 # Owl is at (&0c, &80) &0d36 02 50 00 31 # 250 seconds or 31 seconds time &0d3a 86 3c # Player starts at (&86, &3c) &0d3c 00 # Player starts facing left &0d3d 07 00 05 ; W K M G # Fourth byte uses first byte of cave_19_data ; cave_19_data &0d40 02 # Screen size &0d41 06 # 6 platforms &0d42 0a 4c 60 5a 60 6e 4a 78 4a a8 24 ad &0d4e 02 # 2 platforms &0d4f 20 60 4a 3a &0d53 00 # 0 platforms &0d54 00 # 0 platforms &0d55 04 # 4 walls &0d56 64 43 02 08 64 f6 0d 04 18 f6 0c 0c 0a 8e 01 0e &0d66 01 # 1 long barbed wire &0d67 4c f2 &0d69 01 # 1 short barbed wire &0d6a 24 f2 &0d6c 00 # 0 tripods &0d6d 03 # 3 petri dishes &0d6e 5e 4e 22 a1 1c 4d &0d74 06 # 6 horseshoes &0d75 0a 23 48 26 5e 65 46 6b 44 90 06 7e &0d81 02 # 2 trampolines &0d82 66 f2 1e f2 &0d86 01 # 1 manta ray &0d87 38 f2 &0d89 00 00 # No tarantula &0d8b 0c 40 # Owl is at (&0c, &40) &0d8d 02 50 00 32 # 250 seconds or 32 seconds time &0d91 64 3c # Player starts at (&64, &3c) &0d93 00 # Player starts facing left &0d94 07 00 05 01 ; ; W K M R ; cave_20_data &0d98 02 # Screen size &0d99 05 # 5 platforms &0d9a 0a f4 50 c4 1c a6 1e cf 5c 62 &0da4 03 # 3 platforms &0da5 0c b7 24 68 1c 73 &0dab 02 # 2 platforms &0dac 5c f6 3e f2 &0db0 01 # 1 platform &0db1 44 32 &0db3 07 # 7 walls &0db4 64 35 32 04 48 b9 19 01 66 bd 07 0b 16 b8 04 01 &0dc4 0e b7 04 01 4a 9a 13 04 16 73 0b 08 &0dd0 01 # 1 long barbed wire &0dd1 66 ba &0dd3 03 # 3 short barbed wires &0dd4 24 b8 16 b7 64 f6 &0dda 00 # 0 tripods &0ddb 03 # 3 petri dishes &0ddc 0c 6b 48 96 3c e7 &0de2 05 # 5 horseshoes &0de3 06 a2 04 3d 4a 40 64 5d 1a c2 &0ded 01 # 1 trampoline &0dee 40 97 &0df0 00 # 0 manta rays &0df1 4c b8 # Tarantula starts at (&4c, &b8) &0df3 0c e8 # Owl is at (&0c, &e8) &0df5 04 00 00 13 # 400 seconds or 13 seconds time &0df9 5c 56 # Player starts at (&5c, &56) &0dfb 00 # Player starts facing left &0dfc 03 00 00 03 ; Y K K Y ; please_enter_your_name_string # Text is reversed &0e00 00 14 1f ; TAB(&14, &00 (modified)) &0e03 9c 20 20 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e &0e13 2e 83 9d 84 ; BLUE, NEW_BACKGROUND, YELLOW, "............... ", BLACK_BACKGROUND &0e17 00 11 1f ; TAB(&11, &00 (modified)) &0e1a 65 6d 61 6e 20 72 75 6f 79 20 72 65 74 6e 65 20 ; CYAN, FLASH, "Please enter your name" &0e2a 65 73 61 65 6c 50 88 86 &0e32 18 06 1f ; TAB(&06, &18) ; press_space_bar_for_game_stringA # Text is reversed &0e35 65 6d 61 67 20 72 6f 66 20 52 41 42 20 45 43 41 ; CYAN, FLASH, "Press SPACE BAR for game" &0e45 50 53 20 73 73 65 72 50 88 86 &0e4f 18 06 1f ; TAB(&06, &1f) ; cave_string # Text is reversed &0e52 09 45 56 41 43 8d 84 9d 0b 0c 1f ; TAB(&0c, &0b (modified)); NEW_BACKGROUND, BLUE, DOUBLE_HEIGHT ; "CAVE " ; write_cave &0e5d a2 0a LDX #&0a ; write_cave_loop &0e5f bd 52 0e LDA &0e52,X ; cave_string &0e62 20 ee ff JSR &ffee ; OSWRCH &0e65 ca DEX &0e66 10 f7 BPL &0e5f ; write_cave_loop &0e68 60 RTS ; next_cave &0e69 20 33 21 JSR &2133 ; increase_bcd_cave_number &0e6c 20 ee 09 JSR &09ee ; cave_number_screen_and_delay &0e6f 4c b3 0f JMP &0fb3 ; start_cave ; unused &0e72 00 00 00 &0e75 18 06 1f ; TAB(&06, &18) (reversed) ; brilliant_bouncing_boffins_string # Text is reversed &0e78 65 6d 61 47 ; "Game" &0e7c 05 23 1f ; TAB(&23, &05) &0e7f 65 6d 61 4e ; "Name" &0e83 05 14 1f ; TAB(&14, &05) &0e86 65 72 6f 63 53 20 20 20 6b 6e 61 52 ; "Rank Score" &0e92 86 0a 0a 00 9c ; BLACK_BACKGROUND, CYAN &0e97 20 20 20 20 20 20 73 6e 69 66 66 6f 42 20 67 6e ; " Brilliant Bouncing Boffins " &0ea7 69 63 6e 75 6f 42 20 74 6e 61 69 6c 6c 69 72 42 &0eb7 20 20 20 &0eba 83 8d 9d 81 9c ; BLACK_BACKGROUND, RED, NEW_BACKGROUND, DOUBLE_HEIGHT, CYAN &0ebf 20 20 20 20 20 20 73 6e 69 66 66 6f 42 20 67 6e ; " Brilliant Bouncing Boffins " &0ecf 69 63 6e 75 6f 42 20 74 6e 61 69 6c 6c 69 72 42 &0edf 20 20 20 &0ee2 83 8d 9d 81 ; RED, NEW_BACKGROUND, DOUBLE_HEIGHT, CYAN &0ee6 20 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 ; " pppppppppppppppppppppppppppppppppppppp" &0ef6 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 &0f06 70 70 70 70 70 70 70 &0f0d 91 ; GRAPHICS_RED &0f0e 00 00 00 00 00 00 20 0a 00 17 ; disable cursor &0f18 07 16 ; MODE 7 ; unused &0f1a 40 ; osbyte_with_zero_x &0f1b a2 00 LDX #&00 &0f1d 4c f4 ff JMP &fff4 ; OSBYTE ; unused &0f20 40 40 40 ; cave_9_data &0f23 00 # Screen size &0f24 00 # 0 platforms &0f25 12 # 18 platforms &0f26 34 4b 28 4b 1e 4b 2e 5b 24 5b 2a 6a 94 4b 88 4b &0f36 7c 4b 8e 5b 82 5b 88 6b 64 4b 58 4b 4c 4b 5e 5b &0f46 52 5b 58 6b &0f4a 00 # 0 platforms &0f4b 00 # 0 platforms &0f4c 06 # 6 walls &0f4d b4 5e 05 12 94 3b 2e 04 38 3b 15 04 66 69 14 04 &0f5d 82 6b 0a 04 36 6a 0a 04 &0f65 00 # 0 long barbed wires &0f66 00 # 0 short barbed wires &0f67 00 # 0 tripods &0f68 03 # 3 petri dishes &0f69 9a 85 44 8a 56 37 &0f6f 06 # 6 horseshoes &0f70 66 17 76 65 62 5e 46 5e 32 65 02 22 &0f7c 02 # 2 trampolines &0f7d 1a 8e b2 8d &0f81 00 # 0 manta rays &0f82 26 37 # Tarantula starts at (&26, &37) &0f84 b4 4c # Owl is at (&b4, &4c) &0f86 01 75 00 20 # 175 seconds or 20 seconds time &0f8b 34 37 # Player starts at (&34, &37) &0f8c 01 # Player starts facing right &0f8d 07 00 00 01 ; W K K R ; unused &0f91 ea NOP ; start_game &0f92 a9 04 LDA #&04 # Regular colours, longer time limit &0f94 85 2e STA &2e ; round &0f96 85 37 STA &37 ; player_lives + 3 # Start game with four lives &0f98 a9 00 LDA #&00 &0f9a 85 5f STA &5f ; bcd_cave_number &0f9c 85 0c STA &0c ; unused # Unused variable &0f9e 85 0d STA &0d ; score_for_extra_life &0fa0 85 0e STA &0e ; delay_reduction &0fa2 85 2a STA &2a ; round_time_type # Zero for longer time limit &0fa4 85 2b STA &2b ; round_colour_type # Zero for regular colours &0fa6 85 36 STA &36 ; player_lives + 2 &0fa8 85 38 STA &38 ; score &0faa 85 39 STA &39 ; score + 1 &0fac 85 3a STA &3a ; score + 2 &0fae 85 3b STA &3b ; score + 3 &0fb0 85 2d STA &2d ; player_jumped_off_special # Zero to use default vertical velocity when jumping &0fb2 60 RTS ; start_cave &0fb3 20 15 29 JSR &2915 ; initialise_cave &0fb6 85 1b STA &1b ; sprite_plotting_mode # Zero to plot sprite, not wipe screen memory &0fb8 85 1c STA &1c ; suppress_sprite_plotting # Zero to plot sprite, not just calculate address &0fba 85 49 STA &49 ; out_of_time # Zero to indicate not out of time &0fbc 85 62 STA &62 ; tarantula_cooldown &0fbe 85 6c STA &6c ; tarantula_is_moving # Zero to indicate tarantula is not moving &0fc0 85 6a STA &6a ; tarantula_hit_obstacle # Zero to allow tarantula to move &0fc2 85 6b STA &6b ; tarantula_killed_player &0fc4 85 60 STA &60 ; tarantula_x &0fc6 85 55 STA &55 ; prevent_umbrella_raising # Zero to allow umbrella to be raised &0fc8 85 56 STA &56 ; mantaray_is_collapsing # Zero to indicate manta ray isn't collapsing &0fca 85 49 STA &49 ; out_of_time # Unnecessary &0fcc 85 81 STA &81 ; row_y &0fce 85 7e STA &7e ; leading_zero &0fd0 85 86 STA &86 ; falling_acceleration_cooldown &0fd2 85 89 STA &89 ; player_hit_obstacle_above &0fd4 85 85 STA &85 ; result &0fd6 20 95 16 JSR &1695 ; initialise_tarantula &0fd9 20 49 28 JSR &2849 ; plot_score &0fdc 20 73 28 JSR &2873 ; plot_lives &0fdf 20 cd 36 JSR &36cd ; plot_player &0fe2 a9 01 LDA #&01 # Enable interval timer events &0fe4 8d c4 02 STA &02c4 ; os_event_enable_flags + 5 &0fe7 85 64 STA &64 ; high_score_name_offset &0fe9 85 69 STA &69 ; tarantula_sound_played &0feb a9 09 LDA #&09 &0fed 85 3f STA &3f ; tune_address_high &0fef a9 30 LDA #&30 # Set initial pitch for rolling eye sound &0ff1 8d a4 09 STA &09a4 ; sound_8 + 4 &0ff4 a9 03 LDA #&03 &0ff6 8d c8 34 STA &34c8 ; maximum_falling_acceleration_cooldown &0ff9 a2 7e LDX #&7e &0ffb a9 04 LDA #&04 ; Write interval timer &0ffd a8 TAY ; &047e = one_second_timer_block &0ffe 20 f1 ff JSR &fff1 ; OSWORD &1001 a6 25 LDX &25 ; time_x &1003 a0 0a LDY #&0a &1005 a9 30 LDA #&30 ; &30 = time &1007 4c b6 27 JMP &27b6 ; plot_number ; entry_point &100a 20 00 4c JSR &4c00 ; decrypt_main_binary # This instruction stored unencrypted ; to_display_high_scores &100d 20 d3 17 JSR &17d3 ; check_for_high_score # Displays high score screen on initial call &1010 20 92 0f JSR &0f92 ; start_game ; new_round &1013 a2 01 LDX #&01 # Start round on cave 1 &1015 86 0a STX &0a ; cave_number ; new_cave &1017 20 69 0e JSR &0e69 ; next_cave ; to_play_cave &101a 20 99 10 JSR &1099 ; play_cave # Always returns Y = 1 to indicate cave completed &101d 98 TYA # (play_cave is popped at &1769 if player dies) &101e 10 06 BPL &1026 ; cave_completed ; game_over &1020 20 4f 10 JSR &104f ; increase_game_number # Never returns &1023 4c 0d 10 JMP &100d ; to_display_high_scores # Unnecessary code; never reached ; cave_completed &1026 e6 0a INC &0a ; cave_number &1028 a5 0a LDA &0a ; cave_number &102a c9 15 CMP #&15 # After cave 20, start a new round &102c 30 e9 BMI &1017 ; new_cave &102e c6 2e DEC &2e ; round &1030 a0 01 LDY #&01 &1032 a2 00 LDX #&00 &1034 a5 2e LDA &2e ; round &1036 c9 03 CMP #&03 &1038 d0 05 BNE &103f ; not_round_3 &103a 84 2b STY &2b ; round_colour_type # Use dark colour scheme for second round &103c 4c 13 10 JMP &1013 ; new_round ; not_round_3 &103f c9 02 CMP #&02 &1041 d0 07 BNE &104a ; not_round_2 &1043 86 2b STX &2b ; round_colour_type # Use light colour scheme &1045 84 2a STY &2a ; round_time_type # but short time limit for third round &1047 4c 13 10 JMP &1013 ; new_round ; not_round_2 &104a 84 2b STY &2b ; round_colour_type # Use dark colour scheme and short time limit &104c 4c 13 10 JMP &1013 ; new_round # for fourth and subsequent rounds ; increase_game_number &104f f8 SED &1050 18 CLC &1051 a5 09 LDA &09 ; game_number &1053 69 01 ADC #&01 &1055 85 09 STA &09 ; game_number &1057 d8 CLD &1058 20 93 20 JSR &2093 ; game_over_screen &105b 4c 0d 10 JMP &100d ; to_display_high_scores # Bug: never returns, two bytes left on stack ; check_if_player_died &105e a5 08 LDA &08 ; player_touched_something_deadly # Non-zero if player touched something deadly &1060 d0 05 BNE &1067 ; to_kill_player ; check_if_player_out_of_time &1062 a5 49 LDA &49 ; out_of_time # Non-zero if player is out of time &1064 d0 01 BNE &1067 ; to_kill_player &1066 60 RTS ; to_kill_player &1067 68 PLA # Leave play_cave on next return &1068 68 PLA # (pop check_if_player_died) &1069 4c cb 16 JMP &16cb ; kill_player # and kill player ; set_delay_reduction_from_tarantula_is_moving &106c a5 6c LDA &6c ; tarantula_is_moving # Non-zero if tarantula is moving &106e f0 0a BEQ &107a ; set_delay_reduction &1070 a9 01 LDA #&01 # If so, reduce delay by one v-sync &1072 85 0e STA &0e ; delay_reduction &1074 a9 03 LDA #&03 # Player falls more slowly when tarantula moving &1076 8d c8 34 STA &34c8 ; maximum_falling_acceleration_cooldown &1079 60 RTS ; set_delay_reduction &107a 85 0e STA &0e ; delay_reduction # Set to zero &107c a9 02 LDA #&02 &107e 8d c8 34 STA &34c8 ; maximum_falling_acceleration_cooldown &1081 60 RTS ; consider_setting_tarantula_cooldown &1082 a5 6e LDA &6e ; player_is_moving_horizontally # Zero if player moving horizontally &1084 f0 0e BEQ &1094 ; not_moving_horizontally &1086 a5 6d LDA &6d ; tarantula_cooldown_was_set &1088 d0 05 BNE &108f ; skip_setting_cooldown &108a e6 6d INC &6d ; tarantula_cooldown_was_set &108c 20 ae 16 JSR &16ae ; set_tarantula_cooldown ; skip_setting_cooldown &108f a9 00 LDA #&00 &1091 85 6e STA &6e ; player_is_moving_horizontally &1093 60 RTS ; not_moving_horizontally &1094 a9 00 LDA #&00 &1096 85 6d STA &6d ; tarantula_cooldown_was_set &1098 60 RTS ; play_cave &1099 a9 00 LDA #&00 # Zero to indicate player is supported &109b 85 6f STA &6f ; player_is_in_midair &109d 20 ae 16 JSR &16ae ; set_tarantula_cooldown ; standing_game_loop &10a0 20 6c 10 JSR &106c ; set_delay_reduction_from_tarantula_is_moving &10a3 20 82 10 JSR &1082 ; consider_setting_tarantula_cooldown &10a6 20 38 23 JSR &2338 ; check_for_collecting_horseshoes &10a9 20 27 24 JSR &2427 ; check_for_collecting_petridishes &10ac 20 c4 24 JSR &24c4 ; check_for_collecting_tripods &10af 20 17 25 JSR &2517 ; check_for_touching_barbed_wire &10b2 20 a2 15 JSR &15a2 ; update_tarantula &10b5 a5 56 LDA &56 ; mantaray_is_collapsing # Non-zero if manta ray is collapsing &10b7 d0 03 BNE &10bc ; skip_mantaray_check &10b9 20 60 12 JSR &1260 ; check_for_player_starting_to_ride_mantaray ; skip_mantaray_check &10bc a5 56 LDA &56 ; mantaray_is_collapsing # Non-zero if manta ray is collapsing &10be f0 03 BEQ &10c3 ; skip_mantaray_collapse &10c0 20 c0 14 JSR &14c0 ; collapse_mantaray ; skip_mantaray_collapse &10c3 20 76 25 JSR &2576 ; check_for_touching_owl &10c6 20 c5 28 JSR &28c5 ; plot_time &10c9 20 5e 10 JSR &105e ; check_if_player_died &10cc 20 3f 12 JSR &123f ; check_for_player_quitting ; check_for_walking_left &10cf 20 83 21 JSR &2183 ; check_if_left_pressed &10d2 10 25 BPL &10f9 ; check_for_walking_right # Does the player want to move left? &10d4 a0 a0 LDY #&a0 &10d6 84 80 STY &80 ; count ; check_for_jumping_left &10d8 20 af 21 JSR &21af ; check_if_return_pressed &10db 30 15 BMI &10f2 ; start_left_jump # If so, does the player want to jump left? &10dd c6 80 DEC &80 ; count &10df d0 f7 BNE &10d8 ; check_for_jumping_left &10e1 a9 01 LDA #&01 # Non-zero to indicate player moving horizontally &10e3 85 6e STA &6e ; player_is_moving_horizontally &10e5 20 b3 31 JSR &31b3 ; move_left &10e8 a5 88 LDA &88 ; player_is_unsupported # Non-zero if nothing below player &10ea f0 03 BEQ &10ef ; to_check_for_walking_right &10ec 4c 86 17 JMP &1786 ; make_player_fall ; to_check_for_walking_right &10ef 4c f9 10 JMP &10f9 ; check_for_walking_right ; start_left_jump &10f2 a2 fe LDX #&fe # Move two pixels left &10f4 a0 00 LDY #&00 ; FACING_LEFT # and face left &10f6 4c 8b 11 JMP &118b ; start_jump ; check_for_walking_right &10f9 20 8e 21 JSR &218e ; check_if_right_pressed &10fc 10 25 BPL &1123 ; check_for_jumping_up # Does the player want to move right? &10fe a0 a0 LDY #&a0 &1100 84 80 STY &80 ; count ; check_for_jumping_right &1102 20 af 21 JSR &21af ; check_if_return_pressed &1105 30 15 BMI &111c ; start_right_jump # If so, does the player want to jump right? &1107 c6 80 DEC &80 ; count &1109 d0 f7 BNE &1102 ; check_for_jumping_right &110b a9 01 LDA #&01 # Non-zero to indicate player moving horizontally &110d 85 6e STA &6e ; player_is_moving_horizontally &110f 20 30 30 JSR &3030 ; move_right &1112 a5 88 LDA &88 ; player_is_unsupported # Non-zero if nothing below player &1114 f0 03 BEQ &1119 ; to_check_for_jumping_up &1116 4c 86 17 JMP &1786 ; make_player_fall ; to_check_for_jumping_up &1119 4c 23 11 JMP &1123 ; check_for_jumping_up ; not_jumping_right &111c a2 02 LDX #&02 # Move two pixels right &111e a0 01 LDY #&01 ; FACING_RIGHT # and face right &1120 4c 8b 11 JMP &118b ; start_jump ; check_for_jumping_up &1123 20 d0 21 JSR &21d0 ; check_if_q_or_s_pressed &1126 20 af 21 JSR &21af ; check_if_return_pressed &1129 10 27 BPL &1152 ; check_for_raising_umbrella # Does the player want to jump? &112b a0 a0 LDY #&a0 &112d 84 80 STY &80 ; count ; check_for_jumping_left_or_right &112f 20 83 21 JSR &2183 ; check_if_left_pressed &1132 10 07 BPL &113b ; not_jumping_left # If so, does the player want to jump left? &1134 a2 fe LDX #&fe # Move two pixels left &1136 a0 00 LDY #&00 ; FACING_LEFT # and face left &1138 4c 4f 11 JMP &114f ; to_start_jump ; not_jumping_left &113b 20 8e 21 JSR &218e ; check_if_right_pressed &113e 10 07 BPL &1147 ; not_jumping_right # or right? &1140 a2 02 LDX #&02 # Move two pixels right &1142 a0 01 LDY #&01 ; FACING_RIGHT # and face right &1144 4c 4f 11 JMP &114f ; to_start_jump ; not_jumping_right &1147 c6 80 DEC &80 ; count &1149 d0 e4 BNE &112f ; check_for_jumping_left_or_right # If not, &114b a2 00 LDX #&00 # Keep horizontal position &114d a4 8e LDY &8e ; player_facing # and face same direction ; to_start_jump &114f 4c 8b 11 JMP &118b ; start_jump ; check_for_raising_umbrella &1152 20 99 21 JSR &2199 ; check_if_up_pressed &1155 10 11 BPL &1168 ; check_for_lowering_umbrella # Does the player want to raise the umbrella? &1157 a6 8c LDX &8c ; umbrella_state &1159 d0 0d BNE &1168 ; check_for_lowering_umbrella &115b 20 a4 21 JSR &21a4 ; check_if_down_pressed &115e 10 05 BPL &1165 ; skip_delay # Does the player want to immediately lower it again? &1160 a9 06 LDA #&06 # If so, add delay &1162 20 76 37 JSR &3776 ; delay ; skip_delay &1165 20 05 33 JSR &3305 ; raise_umbrella ; check_for_lowering_umbrella &1168 20 a4 21 JSR &21a4 ; check_if_down_pressed &116b 10 18 BPL &1185 ; check_for_pause # Does the player want to lower the umbrella? &116d a6 8c LDX &8c ; umbrella_state &116f f0 14 BEQ &1185 ; check_for_pause # Is the umbrella raised? &1171 20 99 21 JSR &2199 ; check_if_up_pressed &1174 10 05 BPL &117b ; skip_delay &1176 a9 08 LDA #&08 &1178 20 76 37 JSR &3776 ; delay ; skip_delay &117b 20 58 33 JSR &3358 ; lower_umbrella &117e a5 88 LDA &88 ; player_is_unsupported # Non-zero if nothing below player &1180 f0 03 BEQ &1185 ; check_for_pause &1182 4c 86 17 JMP &1786 ; make_player_fall ; check_for_pause &1185 20 f1 21 JSR &21f1 ; check_if_copy_pressed &1188 4c a0 10 JMP &10a0 ; standing_game_loop ; start_jump &118b a5 8c LDA &8c ; umbrella_state &118d f0 03 BEQ &1192 ; start_jumping # Is the umbrella up? If so, player can't jump &118f 4c 99 10 JMP &1099 ; play_cave ; start_jumping &1192 86 8f STX &8f ; player_horizontal_velocity &1194 84 8e STY &8e ; player_facing &1196 a9 01 LDA #&01 # Non-zero to indicate player is not supported &1198 85 6f STA &6f ; player_is_in_midair &119a 20 6c 10 JSR &106c ; set_delay_reduction_from_tarantula_is_moving &119d 20 ae 16 JSR &16ae ; set_tarantula_cooldown ; start_jumping_from_ray &11a0 a9 15 LDA #&15 ; Flush buffer &11a2 a2 07 LDX #&07 ; Sound channel 3 &11a4 20 f4 ff JSR &fff4 ; OSBYTE &11a7 a5 2d LDA &2d ; player_jumped_off_special # Non-zero if player jumped off trampoline or manta ray &11a9 d0 04 BNE &11af ; skip_setting_velocity &11ab a9 03 LDA #&03 # If not, set player jumping up using default velocity &11ad 85 87 STA &87 ; player_vertical_velocity ; skip_setting_velocity ; jumping_game_loop &11af a9 00 LDA #&00 # Set to zero to use default velocity next time &11b1 85 2d STA &2d ; player_jumped_off_special &11b3 20 38 23 JSR &2338 ; check_for_collecting_horseshoes &11b6 20 27 24 JSR &2427 ; check_for_collecting_petridishes &11b9 20 c4 24 JSR &24c4 ; check_for_collecting_tripods &11bc 20 17 25 JSR &2517 ; check_for_touching_barbed_wire &11bf 20 76 25 JSR &2576 ; check_for_touching_owl &11c2 20 c5 28 JSR &28c5 ; plot_time &11c5 20 d0 21 JSR &21d0 ; check_if_q_or_s_pressed &11c8 20 3f 12 JSR &123f ; check_for_player_quitting &11cb 20 f1 21 JSR &21f1 ; check_if_copy_pressed &11ce 20 5e 10 JSR &105e ; check_if_player_died &11d1 a5 56 LDA &56 ; mantaray_is_collapsing # Non-zero if manta ray is collapsing &11d3 f0 03 BEQ &11d8 ; skip_mantaray_collapse &11d5 20 c0 14 JSR &14c0 ; collapse_mantaray ; skip_mantaray_collapse &11d8 a5 55 LDA &55 ; prevent_umbrella_raising # Non-zero if player has just jumped off manta ray &11da d0 36 BNE &1212 ; not_raising_umbrella &11dc 20 99 21 JSR &2199 ; check_if_up_pressed &11df 10 31 BPL &1212 ; not_raising_umbrella # Does the player want to raise the umbrella? &11e1 38 SEC &11e2 a5 11 LDA &11 ; player_y &11e4 e9 19 SBC #&19 &11e6 85 13 STA &13 ; sprite_y &11e8 a5 10 LDA &10 ; player_x &11ea 85 12 STA &12 ; sprite_x &11ec a5 8e LDA &8e ; player_facing &11ee f0 07 BEQ &11f7 ; not_facing_right &11f0 18 CLC &11f1 a5 12 LDA &12 ; sprite_x &11f3 69 04 ADC #&04 &11f5 85 12 STA &12 ; sprite_x ; not_facing_right &11f7 a2 06 LDX #&06 # 24 pixels wide &11f9 a0 09 LDY #&09 # 9 pixels high &11fb 20 f7 33 JSR &33f7 ; check_for_obstacle # Check for obstacle &11fe a5 85 LDA &85 ; result &1200 d0 10 BNE &1212 ; not_raising_umbrella # Can't jump if there's an obstacle &1202 a2 01 LDX #&01 &1204 86 8c STX &8c ; umbrella_state &1206 86 8a STX &8a ; fall_slowed_by_umbrella # Set to non-zero to indicate umbrella up while falling &1208 ca DEX &1209 86 8f STX &8f ; player_horizontal_velocity # Set to zero &120b a9 fe LDA #&fe # Negative to set player falling if umbrella is up &120d 85 87 STA &87 ; player_vertical_velocity &120f 20 cd 36 JSR &36cd ; plots_player_when_raising_umbrella ; not_raising_umbrella &1212 20 a2 15 JSR &15a2 ; update_tarantula &1215 20 27 34 JSR &3427 ; update_player_position &1218 84 52 STY &52 ; result_of_update_player_position &121a 20 10 26 JSR &2610 ; check_for_touching_trampoline # Leaves with A negative if not bouncing off trampoline &121d c9 00 CMP #&00 &121f 10 03 BPL &1224 ; finished_jumping &1221 4c 92 11 JMP &1192 ; start_jumping ; finished_jumping &1224 a5 52 LDA &52 ; result_of_update_player_position # Negative if obstacle below player &1226 10 0a BPL &1232 ; no_obstacle_below &1228 a9 15 LDA #&15 ; Flush buffer &122a a2 07 LDX #&07 ; Sound channel 3 &122c 20 f4 ff JSR &fff4 ; OSBYTE &122f 4c 99 10 JMP &1099 ; play_cave ; no_obstacle_below &1232 a5 87 LDA &87 ; player_vertical_velocity &1234 c9 fd CMP #&fd &1236 10 04 BPL &123c ; to_jumping_game_loop &1238 a9 00 LDA #&00 # Set to zero to allow umbrella to be raised &123a 85 55 STA &55 ; prevent_umbrella_raising ; to_jumping_game_loop &123c 4c af 11 JMP &11af ; jumping_game_loop ; check_for_player_quitting &123f 20 c5 21 JSR &21c5 ; check_if_escape_pressed &1242 30 01 BMI &1245 ; escape_was_pressed &1244 60 RTS ; escape_was_pressed &1245 a9 7c LDA #&7c ; Clear ESCAPE condition &1247 20 f4 ff JSR &fff4 ; OSBYTE &124a a9 00 LDA #&00 &124c 85 38 STA &38 ; score &124e 85 39 STA &39 ; score + 1 &1250 85 3a STA &3a ; score + 2 &1252 85 3b STA &3b ; score + 3 &1254 ea NOP &1255 ea NOP &1256 ea NOP &1257 ea NOP &1258 68 PLA &1259 68 PLA &125a 68 PLA &125b 68 PLA &125c 4c 0d 10 JMP &100d ; to_display_high_scores ; leave &125f 60 RTS ; check_for_player_starting_to_ride_mantaray &1260 a2 04 LDX #&04 # For each manta ray, &1262 86 80 STX &80 ; mantaray_to_check ; check_for_player_starting_to_ride_mantaray_loop &1264 bd 70 04 LDA &0470,X ; mantarays_x &1267 f0 27 BEQ &1290 ; consider_next_mantaray # Is there a manta ray in this slot? &1269 85 50 STA &50 ; riding_ray_x &126b 38 SEC &126c e9 02 SBC #&02 &126e 85 52 STA &52 ; mantaray_minimum_x &1270 bd 75 04 LDA &0475,X ; mantarays_y # If so, is the player on the manta ray? &1273 85 51 STA &51 ; riding_ray_y &1275 38 SEC &1276 e9 0d SBC #&0d &1278 85 53 STA &53 ; mantaray_minimum_y &127a a5 10 LDA &10 ; player_x &127c c5 52 CMP &52 ; mantaray_minimum_x &127e d0 10 BNE &1290 ; consider_next_mantaray &1280 a5 11 LDA &11 ; player_y &1282 c5 53 CMP &53 ; mantaray_minimum_y &1284 d0 0a BNE &1290 ; consider_next_mantaray &1286 a9 00 LDA #&00 # If so, prevent manta ray from being ridden again &1288 9d 70 04 STA &0470,X ; mantarays_x &128b 68 PLA # Leave play_cave on next return &128c 68 PLA # (pop check_for_player_starting_to_ride_mantaray) &128d 4c 14 04 JMP &0414 ; start_riding_mantaray # and start riding the manta ray ; consider_next_mantaray &1290 a6 80 LDX &80 ; mantaray_to_check &1292 ca DEX &1293 86 80 STX &80 ; mantaray_to_check &1295 10 cd BPL &1264 ; check_for_player_starting_to_ride_mantaray_loop &1297 60 RTS ; ride_mantaray &1298 a5 51 LDA &51 ; riding_ray_y &129a 85 54 STA &54 ; riding_ray_initial_y &129c a9 00 LDA #&00 &129e 85 8f STA &8f ; player_horizontal_velocity &12a0 20 5e 10 JSR &105e ; check_if_player_died ; ascending_mantaray &12a3 a9 07 LDA #&07 ; Generate a sound (SOUND) &12a5 a2 a8 LDX #&a8 &12a7 a0 09 LDY #&09 ; &09a8 = sound_9 # Play sound for manta ray moving &12a9 20 f1 ff JSR &fff1 ; OSWORD &12ac a5 51 LDA &51 ; riding_ray_y &12ae c9 80 CMP #&80 &12b0 10 07 BPL &12b9 ; not_at_top &12b2 c9 56 CMP #&56 # When the manta ray reaches the top of its climb, &12b4 10 03 BPL &12b9 ; not_at_top &12b6 4c b4 13 JMP &13b4 ; descending_mantaray # set it descending ; not_at_top &12b9 20 c5 28 JSR &28c5 ; plot_time &12bc 20 62 10 JSR &1062 ; check_if_player_out_of_time &12bf a5 8c LDA &8c ; umbrella_state &12c1 d0 03 BNE &12c6 ; skip_first_up &12c3 20 1a 13 JSR &131a ; move_player_and_ray_up ; skip_first_up &12c6 20 56 14 JSR &1456 ; plot_mantaray_with_wings_centre &12c9 20 67 13 JSR &1367 ; check_for_player_movement_while_riding_ray &12cc 20 c5 28 JSR &28c5 ; plot_time &12cf 20 3f 12 JSR &123f ; check_for_player_quitting &12d2 a9 05 LDA #&05 &12d4 20 76 37 JSR &3776 ; delay &12d7 a5 8c LDA &8c ; umbrella_state &12d9 d0 03 BNE &12de ; skip_second_up &12db 20 1a 13 JSR &131a ; move_player_and_ray_up ; skip_second_up &12de 20 35 14 JSR &1435 ; plot_mantaray_with_wings_down &12e1 20 67 13 JSR &1367 ; check_for_player_movement_while_riding_ray &12e4 20 c5 28 JSR &28c5 ; plot_time &12e7 20 62 10 JSR &1062 ; check_if_player_out_of_time &12ea 20 3f 12 JSR &123f ; check_for_player_quitting &12ed a9 09 LDA #&09 &12ef 20 76 37 JSR &3776 ; delay &12f2 20 56 14 JSR &1456 ; plot_mantaray_with_wings_centre &12f5 20 67 13 JSR &1367 ; check_for_player_movement_while_riding_ray &12f8 20 c5 28 JSR &28c5 ; plot_time &12fb 20 5e 10 JSR &105e ; check_if_player_died &12fe 20 3f 12 JSR &123f ; check_for_player_quitting &1301 a9 05 LDA #&05 &1303 20 76 37 JSR &3776 ; delay &1306 20 77 14 JSR &1477 ; plot_mantaray_with_wings_up &1309 20 67 13 JSR &1367 ; check_for_player_movement_while_riding_ray &130c 20 5e 10 JSR &105e ; check_if_player_died &130f 20 3f 12 JSR &123f ; check_for_player_quitting &1312 a9 09 LDA #&09 &1314 20 76 37 JSR &3776 ; delay &1317 4c a3 12 JMP &12a3 ; ascending_mantaray ; move_player_and_ray_up &131a 38 SEC &131b a5 11 LDA &11 ; player_y &131d e9 03 SBC #&03 &131f 85 11 STA &11 ; player_y &1321 a5 51 LDA &51 ; riding_ray_y &1323 85 13 STA &13 ; sprite_y &1325 e9 03 SBC #&03 &1327 85 51 STA &51 ; riding_ray_y &1329 a5 50 LDA &50 ; riding_ray_x &132b 85 12 STA &12 ; sprite_x &132d a9 06 LDA #&06 &132f 85 14 STA &14 ; sprite_width &1331 a9 03 LDA #&03 &1333 85 15 STA &15 ; sprite_height &1335 a2 de LDX #&de &1337 a0 3e LDY #&3e ; &3ede = empty_sprite - 1 &1339 4c b6 40 JMP &40b6 ; plot_sprite ; jump_off_ray &133c a9 01 LDA #&01 # Set to non-zero to use specified vertical velocity &133e 85 2d STA &2d ; player_jumped_off_special &1340 85 55 STA &55 ; prevent_umbrella_raising &1342 85 56 STA &56 ; mantaray_is_collapsing # Set to non-zero to start manta ray collapsing &1344 a2 04 LDX #&04 # Positive to set player going up &1346 86 87 STX &87 ; player_vertical_velocity &1348 e8 INX &1349 86 57 STX &57 ; mantaray_cooldown &134b 86 58 STX &58 ; mantaray_collapse_stage &134d 20 56 14 JSR &1456 ; plot_mantaray_with_wings_centre &1350 20 35 14 JSR &1435 ; plot_mantaray_with_wings_down &1353 a5 8e LDA &8e ; player_facing &1355 d0 07 BNE &135e ; jump_off_ray_to_right ; jump_off_ray_to_left &1357 a9 fe LDA #&fe &1359 85 8f STA &8f ; player_horizontal_velocity &135b 4c 62 13 JMP &1362 ; pop_check_for_player_movement_while_riding_ray ; jump_off_ray_to_right &135e a9 02 LDA #&02 &1360 85 8f STA &8f ; player_horizontal_velocity ; pop_check_for_player_movement_while_riding_ray &1362 68 PLA # Leave play_cave on next return &1363 68 PLA # (pop check_for_player_movement_while_riding_ray) &1364 4c a0 11 JMP &11a0 ; start_jumping_from_ray ; check_for_player_movement_while_riding_ray &1367 a5 8c LDA &8c ; umbrella_state &1369 d0 1d BNE &1388 ; not_jumping_off_ray &136b 20 af 21 JSR &21af ; check_if_return_pressed &136e 10 18 BPL &1388 ; not_jumping_off_ray # Does the player want to jump off the manta ray? ; check_if_jumping_left_off_ray &1370 20 83 21 JSR &2183 ; check_if_left_pressed &1373 10 07 BPL &137c ; check_if_jumping_right_off_ray &1375 a9 00 LDA #&00 ; FACING_LEFT &1377 85 8e STA &8e ; player_facing &1379 4c 3c 13 JMP &133c ; jump_off_ray ; check_if_jumping_right_off_ray &137c 20 8e 21 JSR &218e ; check_if_right_pressed &137f 10 07 BPL &1388 ; not_jumping_off_ray &1381 a9 01 LDA #&01 ; FACING_RIGHT &1383 85 8e STA &8e ; player_facing &1385 4c 3c 13 JMP &133c ; jump_off_ray ; not_jumping_off_ray &1388 20 d0 21 JSR &21d0 ; check_if_q_or_s_pressed &138b 20 f1 21 JSR &21f1 ; check_if_copy_pressed &138e 20 38 23 JSR &2338 ; check_for_collecting_horseshoes &1391 a5 8c LDA &8c ; umbrella_state &1393 d0 0b BNE &13a0 ; not_raising_umbrella # Is the umbrella already raised? &1395 20 99 21 JSR &2199 ; check_if_up_pressed &1398 10 06 BPL &13a0 ; not_raising_umbrella # If not, does the player want to raise the umbrella? &139a 20 05 33 JSR &3305 ; raise_umbrella &139d 4c b3 13 JMP &13b3 ; leave ; not_raising_umbrella &13a0 a5 8c LDA &8c ; umbrella_state &13a2 f0 0f BEQ &13b3 ; leave # Is the umbrella already lowered? &13a4 20 a4 21 JSR &21a4 ; check_if_down_pressed &13a7 10 0a BPL &13b3 ; leave # If not, does the player want to lower the umbrella? &13a9 a9 00 LDA #&00 &13ab 85 8c STA &8c ; umbrella_state &13ad 20 cd 36 JSR &36cd ; plot_player &13b0 4c 58 33 JMP &3358 ; lower_umbrella ; leave &13b3 60 RTS ; descending_mantaray &13b4 a5 8c LDA &8c ; umbrella_state &13b6 f0 05 BEQ &13bd ; skip_one_vsync # Is the umbrella up? &13b8 a9 13 LDA #&13 ; Wait for Vertical Retrace &13ba 20 f4 ff JSR &fff4 ; OSBYTE # If so, manta ray descends at half the velocity ; skip_one_vsync &13bd a9 13 LDA #&13 ; Wait for Vertical Retrace &13bf 20 f4 ff JSR &fff4 ; OSBYTE &13c2 38 SEC &13c3 a5 51 LDA &51 ; riding_ray_y &13c5 e9 0d SBC #&0d &13c7 85 13 STA &13 ; sprite_y &13c9 a5 50 LDA &50 ; riding_ray_x &13cb 85 12 STA &12 ; sprite_x &13cd a9 01 LDA #&01 # Non-zero to calculate screen address only &13cf 85 1c STA &1c ; suppress_sprite_plotting &13d1 20 b6 40 JSR &40b6 ; plot_sprite &13d4 a9 00 LDA #&00 &13d6 a8 TAY &13d7 91 16 STA (&16),Y ; row_address # Clear previous top right of manta ray body &13d9 38 SEC &13da a5 16 LDA &16 ; row_address_low &13dc e9 28 SBC #&28 &13de 85 16 STA &16 ; row_address_low &13e0 b0 02 BCS &13e4 ; skip_page &13e2 c6 17 DEC &17 ; row_address_high ; skip_page &13e4 a9 00 LDA #&00 &13e6 a8 TAY &13e7 91 16 STA (&16),Y ; row_address # Clear previous top left of manta ray body &13e9 20 12 14 JSR &1412 ; clear_row_above_player # Clear previous top row of player &13ec 20 56 14 JSR &1456 ; plot_mantaray_with_wings_centre # Replot manta ray &13ef 20 cd 36 JSR &36cd ; plot_player # Replot player &13f2 20 c5 28 JSR &28c5 ; plot_time &13f5 20 62 10 JSR &1062 ; check_if_player_out_of_time &13f8 20 3f 12 JSR &123f ; check_for_player_quitting &13fb 20 67 13 JSR &1367 ; check_for_player_movement_while_riding_ray &13fe e6 51 INC &51 ; riding_ray_y &1400 e6 11 INC &11 ; player_y &1402 a5 51 LDA &51 ; riding_ray_y &1404 c9 80 CMP #&80 &1406 30 ac BMI &13b4 ; descending_mantaray &1408 c5 54 CMP &54 ; riding_ray_initial_y # Manta ray never descends below initial position &140a 30 a8 BMI &13b4 ; descending_mantaray &140c 20 12 14 JSR &1412 ; clear_row_above_player &140f 4c 98 12 JMP &1298 ; ride_mantaray # Set manta ray ascending again ; clear_row_above_player &1412 38 SEC &1413 a5 11 LDA &11 ; player_y &1415 e9 19 SBC #&19 &1417 a4 8c LDY &8c ; umbrella_state &1419 f0 02 BEQ &141d ; skip_umbrella &141b e9 09 SBC #&09 ; skip_umbrella &141d 85 13 STA &13 ; sprite_y &141f 18 CLC &1420 a5 10 LDA &10 ; player_x &1422 69 04 ADC #&04 &1424 85 12 STA &12 ; sprite_x &1426 a9 08 LDA #&08 &1428 85 14 STA &14 ; sprite_width &142a a9 01 LDA #&01 &142c 85 15 STA &15 ; sprite_height &142e a2 de LDX #&de &1430 a0 3e LDY #&3e ; &3ede = empty_sprite - 1 &1432 4c b6 40 JMP &40b6 ; plot_sprite ; plot_mantaray_with_wings_down &1435 20 9d 14 JSR &149d ; plot_mantaray_body &1438 c6 13 DEC &13 ; sprite_y &143a a9 0c LDA #&0c &143c 85 15 STA &15 ; sprite_height &143e a2 6b LDX #&6b &1440 a0 2c LDY #&2c ; &2c6b = mantaray_right_wing_down_sprite - 1 &1442 20 b6 40 JSR &40b6 ; plot_sprite &1445 38 SEC &1446 a5 12 LDA &12 ; sprite_x &1448 e9 14 SBC #&14 &144a 85 12 STA &12 ; sprite_x &144c a2 3b LDX #&3b &144e a0 2c LDY #&2c ; &2c3b = mantaray_left_wing_down_sprite - 1 &1450 20 b6 40 JSR &40b6 ; plot_sprite &1453 4c cd 36 JMP &36cd ; plot_player ; plot_mantaray_with_wings_centre &1456 20 9d 14 JSR &149d ; plot_mantaray_body &1459 c6 13 DEC &13 ; sprite_y &145b a9 12 LDA #&12 &145d 85 15 STA &15 ; sprite_height &145f a2 c3 LDX #&c3 &1461 a0 2c LDY #&2c ; &2cc3 = mantaray_right_wing_centre_sprite - 1 &1463 20 b6 40 JSR &40b6 ; plot_sprite &1466 38 SEC &1467 a5 12 LDA &12 ; sprite_x &1469 e9 14 SBC #&14 &146b 85 12 STA &12 ; sprite_x &146d a2 93 LDX #&93 &146f a0 2c LDY #&2c ; &2c93 = mantaray_left_wing_centre_sprite - 1 &1471 20 b6 40 JSR &40b6 ; plot_sprite &1474 4c cd 36 JMP &36cd ; plot_player ; plot_mantaray_with_wings_up &1477 20 9d 14 JSR &149d ; plot_mantaray_body &147a 38 SEC &147b a5 13 LDA &13 ; sprite_y &147d e9 08 SBC #&08 &147f 85 13 STA &13 ; sprite_y &1481 a9 0b LDA #&0b &1483 85 15 STA &15 ; sprite_height &1485 a2 37 LDX #&37 &1487 a0 2d LDY #&2d ; &2d37 = mantaray_right_wing_up_sprite - 1 &1489 20 b6 40 JSR &40b6 ; plot_sprite &148c 38 SEC &148d a5 12 LDA &12 ; sprite_x &148f e9 14 SBC #&14 &1491 85 12 STA &12 ; sprite_x &1493 a2 0b LDX #&0b &1495 a0 2d LDY #&2d ; &2d0c = mantaray_left_wing_up_sprite - 1 &1497 20 b6 40 JSR &40b6 ; plot_sprite &149a 4c cd 36 JMP &36cd ; plot_player ; plot_mantaray_body &149d a5 50 LDA &50 ; riding_ray_x &149f 85 12 STA &12 ; sprite_x &14a1 a5 51 LDA &51 ; riding_ray_y &14a3 85 13 STA &13 ; sprite_y &14a5 a9 06 LDA #&06 &14a7 85 14 STA &14 ; sprite_width &14a9 a9 0d LDA #&0d &14ab 85 15 STA &15 ; sprite_height &14ad a2 63 LDX #&63 &14af a0 2d LDY #&2d ; &2d63 = mantaray_body_sprite - 1 &14b1 20 b6 40 JSR &40b6 ; plot_sprite &14b4 18 CLC &14b5 a5 12 LDA &12 ; sprite_x &14b7 69 08 ADC #&08 &14b9 85 12 STA &12 ; sprite_x &14bb a9 04 LDA #&04 &14bd 85 14 STA &14 ; sprite_width &14bf 60 RTS ; collapse_mantaray &14c0 a6 57 LDX &57 ; mantaray_cooldown &14c2 ca DEX &14c3 86 57 STX &57 ; mantaray_cooldown &14c5 30 01 BMI &14c8 ; collapse_mantaray_next_stage &14c7 60 RTS ; collapse_mantaray_next_stage &14c8 a9 05 LDA #&05 &14ca 85 57 STA &57 ; mantaray_cooldown &14cc a6 58 LDX &58 ; mantaray_collapse_stage &14ce ca DEX &14cf 86 58 STX &58 ; mantaray_collapse_stage &14d1 d0 07 BNE &14da ; collapse_mantaray_stage_one &14d3 a9 00 LDA #&00 &14d5 85 56 STA &56 ; mantaray_is_collapsing # Set to zero to indicate collapse complete &14d7 85 55 STA &55 ; prevent_umbrella_raising # Set to zero to allow umbrella to be raised &14d9 60 RTS ; collapse_mantaray_stage_one &14da e0 04 CPX #&04 &14dc d0 3e BNE &151c ; collapse_mantaray_stage_two &14de a9 07 LDA #&07 ; Generate a sound (SOUND) &14e0 a2 b8 LDX #&b8 &14e2 a0 09 LDY #&09 ; &09b8 = sound_11 # Play sound for collapsing manta ray &14e4 20 f1 ff JSR &fff1 ; OSWORD &14e7 18 CLC &14e8 a5 50 LDA &50 ; riding_ray_x &14ea 69 08 ADC #&08 &14ec 85 12 STA &12 ; sprite_x &14ee a5 51 LDA &51 ; riding_ray_y &14f0 85 13 STA &13 ; sprite_y &14f2 a9 0e LDA #&0e &14f4 85 14 STA &14 ; sprite_width &14f6 a9 0f LDA #&0f &14f8 85 15 STA &15 ; sprite_height &14fa a9 01 LDA #&01 # Non-zero to wipe screen memory, not plot &14fc 85 1b STA &1b ; sprite_plotting_mode &14fe a9 6f LDA #&6f &1500 85 21 STA &21 ; bytes_to_wipe &1502 20 b6 40 JSR &40b6 ; plot_sprite # Unplot previous stage &1505 a5 50 LDA &50 ; riding_ray_x &1507 85 12 STA &12 ; sprite_x &1509 a5 51 LDA &51 ; riding_ray_y &150b 85 13 STA &13 ; sprite_y &150d a9 06 LDA #&06 &150f 85 14 STA &14 ; sprite_width &1511 a9 0c LDA #&0c &1513 85 15 STA &15 ; sprite_height &1515 a2 b1 LDX #&b1 &1517 a0 20 LDY #&20 ; &20b1 = collapsing_mantaray_frame_1_sprite - 1 &1519 4c b6 40 JMP &40b6 ; plot_sprite # Plot next stage ; collapse_mantaray_stage_two &151c e0 03 CPX #&03 &151e d0 2e BNE &154e ; collapse_mantaray_stage_three &1520 a5 50 LDA &50 ; riding_ray_x &1522 85 12 STA &12 ; sprite_x &1524 a5 51 LDA &51 ; riding_ray_y &1526 85 13 STA &13 ; sprite_y &1528 a9 06 LDA #&06 &152a 85 14 STA &14 ; sprite_width &152c a9 0c LDA #&0c &152e 85 15 STA &15 ; sprite_height &1530 a2 de LDX #&de &1532 a0 3e LDY #&3e ; &3ede = empty_sprite - 1 &1534 20 b6 40 JSR &40b6 ; plot_sprite # Unplot previous stage &1537 c6 12 DEC &12 ; sprite_x &1539 c6 12 DEC &12 ; sprite_x &153b c6 13 DEC &13 ; sprite_y &153d c6 13 DEC &13 ; sprite_y &153f a9 04 LDA #&04 &1541 85 14 STA &14 ; sprite_width &1543 a9 08 LDA #&08 &1545 85 15 STA &15 ; sprite_height &1547 a2 f9 LDX #&f9 &1549 a0 20 LDY #&20 ; &20f9 = collapsing_mantaray_frame_2_sprite - 1 &154b 4c b6 40 JMP &40b6 ; plot_sprite # Plot next stage ; collapse_mantaray_stage_three &154e e0 02 CPX #&02 &1550 d0 33 BNE &1585 ; collapse_mantaray_stage_four &1552 38 SEC &1553 a5 50 LDA &50 ; riding_ray_x &1555 e9 02 SBC #&02 &1557 85 12 STA &12 ; sprite_x &1559 a5 51 LDA &51 ; riding_ray_y &155b e9 02 SBC #&02 &155d 85 13 STA &13 ; sprite_y &155f a9 04 LDA #&04 &1561 85 14 STA &14 ; sprite_width &1563 a9 08 LDA #&08 &1565 85 15 STA &15 ; sprite_height &1567 a2 de LDX #&de &1569 a0 3e LDY #&3e ; &3ede = empty_sprite - 1 &156b 20 b6 40 JSR &40b6 ; plot_sprite # Unplot previous stage &156e c6 12 DEC &12 ; sprite_x &1570 c6 12 DEC &12 ; sprite_x &1572 c6 13 DEC &13 ; sprite_y &1574 c6 13 DEC &13 ; sprite_y &1576 a9 01 LDA #&01 &1578 85 14 STA &14 ; sprite_width &157a a9 04 LDA #&04 &157c 85 15 STA &15 ; sprite_height &157e a2 19 LDX #&19 &1580 a0 21 LDY #&21 ; &2119 = collapsing_mantaray_frame_3_sprite - 1 &1582 4c b6 40 JMP &40b6 ; plot_sprite # Plot next stage ; collapse_mantaray_stage_four &1585 38 SEC &1586 a5 50 LDA &50 ; riding_ray_x &1588 e9 04 SBC #&04 &158a 85 12 STA &12 ; sprite_x &158c 38 SEC &158d a5 51 LDA &51 ; riding_ray_y &158f e9 04 SBC #&04 &1591 85 13 STA &13 ; sprite_y &1593 a9 01 LDA #&01 &1595 85 14 STA &14 ; sprite_width &1597 a9 04 LDA #&04 &1599 85 15 STA &15 ; sprite_height &159b a2 de LDX #&de &159d a0 3e LDY #&3e ; &3ede = empty_sprite - 1 &159f 4c b6 40 JMP &40b6 ; plot_sprite # Unplot previous stage ; update_tarantula &15a2 a5 60 LDA &60 ; tarantula_x &15a4 d0 01 BNE &15a7 ; cave_has_tarantula # Is there a tarantula in the cave? &15a6 60 RTS ; cave_has_tarantula &15a7 18 CLC &15a8 a5 60 LDA &60 ; tarantula_x &15aa 69 04 ADC #&04 &15ac 85 70 STA &70 ; tarantula_x2 &15ae 38 SEC &15af e9 24 SBC #&24 &15b1 85 71 STA &71 ; tarantula_x1 &15b3 a5 61 LDA &61 ; tarantula_y &15b5 85 72 STA &72 ; tarantula_y2 &15b7 38 SEC &15b8 e9 15 SBC #&15 &15ba 85 73 STA &73 ; tarantula_y1 &15bc a5 11 LDA &11 ; player_y &15be c5 73 CMP &73 ; tarantula_y1 &15c0 10 09 BPL &15cb ; consider_moving_tarantula &15c2 c5 70 CMP &70 ; tarantula_x2 # Bug: should be tarantula_y2, not x2 &15c4 30 05 BMI &15cb ; consider_moving_tarantula &15c6 a9 00 LDA #&00 # Set to zero to indicate tarantula not moving &15c8 85 6c STA &6c ; tarantula_is_moving &15ca 60 RTS ; consider_moving_tarantula &15cb a5 10 LDA &10 ; player_x &15cd c5 71 CMP &71 ; tarantula_x1 &15cf 30 19 BMI &15ea ; consider_moving_tarantula_more &15d1 38 SEC &15d2 e9 06 SBC #&06 &15d4 c5 70 CMP &70 ; tarantula_x2 &15d6 10 12 BPL &15ea ; consider_moving_tarantula_more &15d8 a5 11 LDA &11 ; player_y &15da c5 73 CMP &73 ; tarantula_y1 &15dc 30 0c BMI &15ea ; consider_moving_tarantula_more &15de 38 SEC &15df e9 1a SBC #&1a &15e1 c5 72 CMP &72 ; tarantula_y2 &15e3 10 05 BPL &15ea ; consider_moving_tarantula &15e5 e6 08 INC &08 ; player_touched_something_deadly &15e7 e6 6b INC &6b ; tarantula_killed_player &15e9 60 RTS ; consider_moving_tarantula_more &15ea c6 62 DEC &62 ; tarantula_cooldown &15ec f0 01 BEQ &15ef ; move_tarantula &15ee 60 RTS ; move_tarantula &15ef 20 ae 16 JSR &16ae ; set_tarantula_cooldown &15f2 18 CLC &15f3 a5 60 LDA &60 ; tarantula_x &15f5 69 02 ADC #&02 &15f7 85 12 STA &12 ; sprite_x &15f9 a5 61 LDA &61 ; tarantula_y &15fb 85 13 STA &13 ; sprite_y &15fd a2 01 LDX #&01 # 4 pixel wide &15ff a0 15 LDY #&15 # 21 pixels high &1601 20 f7 33 JSR &33f7 ; check_for_obstacle # Is there an obstacle in front of the tarantula? &1604 a5 85 LDA &85 ; result &1606 f0 11 BEQ &1619 ; no_obstacle ; hit_obstacle &1608 a5 6a LDA &6a ; tarantula_hit_obstacle # Non-zero if tarantula has already hit obstacle &160a d0 05 BNE &1611 ; skip_plot &160c a0 04 LDY #&04 &160e 20 5f 16 JSR &165f ; plot_tarantula ; skip_plot &1611 a0 00 LDY #&00 # Set to zero to indicate tarantula not moving &1613 84 6c STY &6c ; tarantula_is_moving &1615 c8 INY &1616 84 6a STY &6a ; tarantula_hit_obstacle # Set to non-zero to prevent future plotting &1618 60 RTS ; no_obstacle &1619 18 CLC &161a a5 60 LDA &60 ; tarantula_x &161c 69 0c ADC #&0c &161e 85 12 STA &12 ; sprite_x &1620 a4 61 LDY &61 ; tarantula_y &1622 c8 INY &1623 84 13 STY &13 ; sprite_y &1625 a2 0a LDX #&0a # 40 pixels wide &1627 a0 01 LDY #&01 # 1 pixel high &1629 20 f7 33 JSR &33f7 ; check_for_obstacle # Is there support below the tarantula? &162c a5 85 LDA &85 ; result &162e f0 d8 BEQ &1608 ; hit_obstacle # If no support, stop moving &1630 a9 01 LDA #&01 # Set to non-zero to indicate tarantula moving &1632 85 6c STA &6c ; tarantula_is_moving &1634 a5 69 LDA &69 ; tarantula_sound_played &1636 f0 0b BEQ &1643 ; skip_sound &1638 c6 69 DEC &69 ; tarantula_sound_played &163a a9 07 LDA #&07 ; Generate a sound (SOUND) &163c a2 b0 LDX #&b0 &163e a0 09 LDY #&09 ; &09b0 = sound_10 # Play sound for tarantula moving &1640 20 f1 ff JSR &fff1 ; OSWORD ; skip_sound &1643 e6 60 INC &60 ; tarantula_x &1645 e6 60 INC &60 ; tarantula_x &1647 a9 13 LDA #&13 ; Wait for Vertical Retrace &1649 20 f4 ff JSR &fff4 ; OSBYTE &164c a5 63 LDA &63 ; tarantula_frame &164e a8 TAY &164f 20 5f 16 JSR &165f ; plot_tarantula &1652 e6 63 INC &63 ; tarantula_frame &1654 a5 63 LDA &63 ; tarantula_frame &1656 c9 05 CMP #&05 &1658 d0 04 BNE &165e ; leave &165a a9 01 LDA #&01 &165c 85 63 STA &63 ; tarantula_frame ; leave &165e 60 RTS ; plot_tarantula &165f a5 60 LDA &60 ; tarantula_x &1661 85 12 STA &12 ; sprite_x &1663 a5 61 LDA &61 ; tarantula_y &1665 85 13 STA &13 ; sprite_y &1667 a9 11 LDA #&11 &1669 85 14 STA &14 ; sprite_width &166b a9 13 LDA #&13 &166d 85 15 STA &15 ; sprite_height &166f be d4 1a LDX &1ad4,Y ; tarantula_bottom_sprite_addresses_low_table - 1 &1672 b9 d8 1a LDA &1ad8,Y ; tarantula_bottom_sprite_addresses_high_table - 1 &1675 a8 TAY &1676 20 b6 40 JSR &40b6 ; plot_sprite # Plot bottom of tarantula &1679 38 SEC &167a a5 13 LDA &13 ; sprite_y &167c e9 13 SBC #&13 &167e 85 13 STA &13 ; sprite_y &1680 a5 12 LDA &12 ; sprite_x &1682 e9 06 SBC #&06 &1684 85 12 STA &12 ; sprite_x &1686 a9 0e LDA #&0e &1688 85 14 STA &14 ; sprite_width &168a a9 09 LDA #&09 &168c 85 15 STA &15 ; sprite_height &168e a2 dc LDX #&dc &1690 a0 1a LDY #&1a ; &1adc = tarantula_top_sprite - 1 &1692 4c b6 40 JMP &40b6 ; plot_sprite # Plot top of tarantula ; initialise_tarantula &1695 ad 7a 04 LDA &047a ; initial_tarantula_x &1698 d0 01 BNE &169b ; cave_has_tarantula &169a 60 RTS ; cave_has_tarantula &169b 85 60 STA &60 ; tarantula_x &169d 20 ae 16 JSR &16ae ; set_tarantula_cooldown &16a0 ad 7b 04 LDA &047b ; initial_tarantula_y &16a3 85 61 STA &61 ; tarantula_y &16a5 a9 02 LDA #&02 &16a7 85 63 STA &63 ; tarantula_frame &16a9 a0 01 LDY #&01 &16ab 4c 5f 16 JMP &165f ; plot_tarantula ; set_tarantula_cooldown &16ae a5 6f LDA &6f ; player_is_in_midair &16b0 f0 05 BEQ &16b7 ; not_in_midair &16b2 a9 02 LDA #&02 # Tarantula moves quickly if player falling &16b4 85 62 STA &62 ; tarantula_cooldown &16b6 60 RTS ; not_in_midair &16b7 20 83 21 JSR &2183 ; check_if_left_pressed &16ba 30 0a BMI &16c6 ; is_moving &16bc 20 8e 21 JSR &218e ; check_if_right_pressed &16bf 30 05 BMI &16c6 ; is_moving &16c1 a9 90 LDA #&90 # Tarantula moves slowly if player not moving &16c3 85 62 STA &62 ; tarantula_cooldown &16c5 60 RTS ; is_moving &16c6 a9 02 LDA #&02 # Tarantula moves quickly if player moving &16c8 85 62 STA &62 ; tarantula_cooldown &16ca 60 RTS ; kill_player &16cb a5 6b LDA &6b ; tarantula_killed_player &16cd f0 07 BEQ &16d6 ; skip_plotting_tarantula &16cf c6 6b DEC &6b ; tarantula_killed_player &16d1 a0 01 LDY #&01 # Make tarantula's leg touch player &16d3 20 5f 16 JSR &165f ; plot_tarantula ; skip_plotting_tarantula &16d6 c6 08 DEC &08 ; player_touched_something_deadly &16d8 a9 00 LDA #&00 # Disable interval timer events &16da 8d c4 02 STA &02c4 ; os_event_enable_flags + 5 &16dd 85 8f STA &8f ; player_horizontal_velocity &16df a0 ff LDY #&ff # Lose a life &16e1 20 52 28 JSR &2852 ; gain_or_lose_a_life &16e4 20 cd 36 JSR &36cd ; plot_player &16e7 a9 3a LDA #&3a ; &3a = (*_eyes_sprites_address_table) DIV 256 &16e9 85 7d STA &7d ; eye_sprites_table_address_high &16eb a9 01 LDA #&01 &16ed 85 14 STA &14 ; sprite_width &16ef a9 03 LDA #&03 &16f1 85 15 STA &15 ; sprite_height &16f3 38 SEC &16f4 a5 10 LDA &10 ; player_x &16f6 e9 02 SBC #&02 &16f8 a4 8e LDY &8e ; player_facing &16fa f0 16 BEQ &1712 ; use_left_eyes ; use_right_eyes &16fc a4 8b LDY &8b ; feet_state &16fe d0 02 BNE &1702 ; skip_subtraction &1700 e9 02 SBC #&02 ; skip_subtraction &1702 85 12 STA &12 ; sprite_x &1704 a5 8b LDA &8b ; feet_state &1706 d0 05 BNE &170d ; use_right_odd_eyes ; use_right_even_eyes &1708 a9 8f LDA #&8f ; &3a8f = right_even_eyes_sprites_address_table &170a 4c 25 17 JMP &1725 ; set_eye_sprites_table_address_low ; use_right_odd_eyes &170d a9 95 LDA #&95 ; &3a95 = right_odd_eyes_sprites_address_table &170f 4c 25 17 JMP &1725 ; set_eye_sprites_table_address_low ; use_left_eyes &1712 a4 8b LDY &8b ; feet_state &1714 f0 02 BEQ &1718 ; skip_subtraction &1716 e9 02 SBC #&02 ; skip_subtraction &1718 85 12 STA &12 ; sprite_x &171a a5 8b LDA &8b ; feet_state &171c d0 05 BNE &1723 ; use_left_odd_eyes ; use_left_even_eyes &171e a9 9b LDA #&9b ; &3a9b = left_even_eyes_sprites_address_table &1720 4c 25 17 JMP &1725 ; set_eye_sprites_table_address_low ; use_left_odd_eyes &1723 a9 a1 LDA #&a1 ; &3aa1 = left_odd_eyes_sprites_address_table ; set_eye_sprites_table_address_low &1725 85 7c STA &7c ; eye_sprites_table_address_low &1727 38 SEC &1728 a5 11 LDA &11 ; player_y &172a e9 13 SBC #&13 &172c 85 13 STA &13 ; sprite_y &172e a9 03 LDA #&03 &1730 85 80 STA &80 ; count ; roll_eye_loop &1732 18 CLC &1733 ad a4 09 LDA &09a4 ; sound_8 + 4 # Increase pitch of rolling eye sound &1736 69 10 ADC #&10 &1738 8d a4 09 STA &09a4 ; sound_8 + 4 &173b a9 07 LDA #&07 ; Generate a sound (SOUND) &173d a2 a0 LDX #&a0 &173f a0 09 LDY #&09 ; &09a0 = sound_8 # Play sound for rolling eye &1741 20 f1 ff JSR &fff1 ; OSWORD &1744 a0 05 LDY #&05 &1746 84 81 STY &81 ; eye_frame ; roll_eye_frame_loop &1748 b1 7c LDA (&7c),Y ; eye_sprites_table_address &174a aa TAX &174b a0 3a LDY #&3a ; &3a = *_eye_frame_*_sprite DIV 256 &174d 20 b6 40 JSR &40b6 ; plot_sprite &1750 a2 ff LDX #&ff ; roll_eye_delay_outer_loop &1752 a0 44 LDY #&44 ; roll_eye_delay_inner_loop &1754 ea NOP &1755 88 DEY &1756 d0 fc BNE &1754 ; roll_eye_delay_inner_loop &1758 ca DEX &1759 d0 f7 BNE &1752 ; roll_eye_delay_outer_loop &175b 20 3f 12 JSR &123f ; check_for_player_quitting &175e a4 81 LDY &81 ; eye_frame &1760 88 DEY &1761 84 81 STY &81 ; eye_frame &1763 10 e3 BPL &1748 ; roll_eye_frame_loop &1765 c6 80 DEC &80 ; count &1767 10 c9 BPL &1732 ; roll_eye_loop &1769 68 PLA # Pop play_cave from stack &176a 68 PLA &176b ad 62 02 LDA &0262 ; os_sound_suppression &176e d0 08 BNE &1778 ; skip_sound &1770 a9 0d LDA #&0d &1772 20 76 37 JSR &3776 ; delay &1775 20 d0 09 JSR &09d0 ; play_final_death_sound_and_delay ; skip_sound &1778 a5 37 LDA &37 ; player_lives + 3 # Does the player have any lives remaining? &177a d0 07 BNE &1783 ; to_restart_cave &177c a5 36 LDA &36 ; player_lives + 2 &177e d0 03 BNE &1783 ; to_restart_cave &1780 4c 20 10 JMP &1020 ; game_over # If not, game over ; to_restart_cave &1783 4c 30 04 JMP &0430 ; restart_cave # Otherwise, restart cave ; make_player_fall &1786 a2 01 LDX #&01 # Non-zero to indicate player not supported &1788 86 6f STX &6f ; player_is_in_midair &178a 20 6c 10 JSR &106c ; set_delay_reduction_from_tarantula_is_moving &178d 20 ae 16 JSR &16ae ; set_tarantula_cooldown &1790 ca DEX ; 0 &1791 86 8f STX &8f ; player_horizontal_velocity # Set to zero; horizontal movement handled below &1793 a9 fd LDA #&fd # Fall at 3 pixels per frame &1795 85 87 STA &87 ; player_vertical_velocity &1797 a5 80 LDA &80 ; umbrella_was_supporting &1799 d0 0d BNE &17a8 ; check_umbrella_when_falling &179b a5 8d LDA &8d ; player_direction_for_falling &179d d0 1c BNE &17bb ; is_falling_to_the_right ; is_falling_to_the_left &179f 20 b3 31 JSR &31b3 ; move_left &17a2 20 b3 31 JSR &31b3 ; move_left &17a5 20 b3 31 JSR &31b3 ; move_left ; check_umbrella_when_falling &17a8 a5 8c LDA &8c ; umbrella_state &17aa d0 1b BNE &17c7 ; is_up &17ac a9 07 LDA #&07 ; Generate a sound (SOUND) &17ae a2 c0 LDX #&c0 &17b0 a0 09 LDY #&09 ; &09c0 = sound_12 # Play sound for falling when umbrella isn't up &17b2 20 f1 ff JSR &fff1 ; OSWORD &17b5 20 cd 36 JSR &36cd ; plot_player &17b8 4c af 11 JMP &11af ; jumping_game_loop ; is_falling_to_the_right &17bb 20 30 30 JSR &3030 ; move_right &17be 20 30 30 JSR &3030 ; move_right &17c1 20 30 30 JSR &3030 ; move_right &17c4 4c a8 17 JMP &17a8 ; check_umbrella_when_falling ; is_up &17c7 85 8a STA &8a ; fall_slowed_by_umbrella # Set to non-zero to indicate umbrella up while falling &17c9 a9 fe LDA #&fe # Fall at 2 pixels per frame if umbrella up &17cb 85 87 STA &87 ; player_vertical_velocity &17cd 4c af 11 JMP &11af ; jumping_game_loop ; to_check_next_position &17d0 4c 06 19 JMP &1906 ; check_next_position ; check_for_high_score &17d3 a9 0f LDA #&0f ; Flush all buffers &17d5 20 1b 0f JSR &0f1b ; osbyte_with_zero_x &17d8 a9 04 LDA #&04 ; Define action of cursor editing keys &17da a2 01 LDX #&01 ; Cursor keys return ASCII values 135-139 &17dc 20 f4 ff JSR &fff4 ; OSBYTE &17df a9 08 LDA #&08 &17e1 85 64 STA &64 ; positions_to_check &17e3 a0 00 LDY #&00 # For each position, ; check_positions_loop &17e5 a2 00 LDX #&00 &17e7 84 62 STY &62 ; high_score_address_low ; check_score_loop &17e9 b5 38 LDA &38,X ; score # Is the player's score greater? &17eb d9 09 1a CMP &1a09,Y ; high_scores &17ee 90 e0 BCC &17d0 ; to_check_next_position &17f0 d0 06 BNE &17f8 ; new_high_score &17f2 c8 INY &17f3 e8 INX &17f4 e0 04 CPX #&04 &17f6 d0 f1 BNE &17e9 ; check_score_loop ; new_high_score &17f8 a5 64 LDA &64 ; positions_to_check &17fa c6 64 DEC &64 ; positions_to_check &17fc 85 65 STA &65 ; previous_positions_to_check &17fe a0 8b LDY #&8b &1800 c9 01 CMP #&01 # If the player's score isn't the lowest high score, &1802 f0 10 BEQ &1814 ; skip_shuffle ; shuffle_high_scores_loop # Shuffle all lower scores down a position &1804 a2 13 LDX #&13 ; shuffle_score_loop &1806 b9 09 1a LDA &1a09,Y ; high_scores &1809 99 1d 1a STA &1a1d,Y ; high_scores + &14 &180c 88 DEY &180d ca DEX &180e 10 f6 BPL &1806 ; shuffle_score_loop &1810 c6 64 DEC &64 ; positions_to_check &1812 d0 f0 BNE &1804 ; shuffle_high_scores_loop ; skip_shuffle &1814 a2 00 LDX #&00 ; insert_new_score_loop &1816 c8 INY &1817 b5 38 LDA &38,X ; score # Copy player's score into position &1819 99 09 1a STA &1a09,Y ; high_scores &181c e8 INX &181d e0 04 CPX #&04 &181f d0 f5 BNE &1816 ; insert_new_score_loop &1821 a5 09 LDA &09 ; game_number # Copy player's game number into position &1823 99 19 1a STA &1a19,Y ; high_scores + &10 &1826 18 CLC &1827 a5 62 LDA &62 ; high_score_address_low &1829 69 0d ADC #&0d &182b 48 PHA &182c a2 1a LDX #&1a &182e 90 01 BCC &1831 ; skip_page &1830 e8 INX ; skip_page &1831 86 63 STX &63 ; high_score_address_high &1833 38 SEC &1834 a9 09 LDA #&09 &1836 e5 65 SBC &65 ; previous_positions_to_check &1838 20 12 19 JSR &1912 ; display_high_scores # Called with A = offset to player name &183b 0a ASL A &183c 69 05 ADC #&05 &183e 8d 00 0e STA &0e00 ; please_enter_your_name_string &1841 8d 17 0e STA &0e17 ; please_enter_your_name_string + &17 &1844 a0 34 LDY #&34 ; write_please_enter_your_name_loop &1846 b9 00 0e LDA &0e00,Y ; please_enter_your_name_string &1849 20 ee ff JSR &ffee ; OSWRCH &184c 88 DEY &184d 10 f7 BPL &1846 ; write_please_enter_your_name_loop &184f c8 INY &1850 68 PLA &1851 84 64 STY &64 ; high_score_name_offset &1853 85 62 STA &62 ; high_score_address_low &1855 a9 0a LDA #&0a # R10: Cursor start register &1857 8d 00 fe STA &fe00 ; video register number &185a a9 60 LDA #&60 # Enable cursor &185c 8d 01 fe STA &fe01 ; video register value ; read_name_loop &185f 20 e0 ff JSR &ffe0 ; OSRDCH &1862 48 PHA &1863 a9 7c LDA #&7c ; Clear ESCAPE condition &1865 20 f4 ff JSR &fff4 ; OSBYTE &1868 68 PLA &1869 c9 7f CMP #&7f ; DELETE &186b f0 31 BEQ &189e ; delete_pressed &186d c9 88 CMP #&88 # SHIFT-f8 moves cursor left &186f f0 54 BEQ &18c5 ; move_cursor_left &1871 c9 89 CMP #&89 # SHIFT-f9 moves cursor right &1873 f0 5b BEQ &18d0 ; move_cursor_right &1875 c9 0d CMP #&0d ; RETURN # End input when RETURN pressed &1877 f0 63 BEQ &18dc ; end_of_name &1879 c9 20 CMP #&20 ; " " &187b 90 0c BCC &1889 ; to_read_name_loop # Ignore control characters &187d c9 87 CMP #&87 # apart from teletext text colours &187f 90 0b BCC &188c ; insert_character &1881 4c 89 18 JMP &1889 ; to_read_name_loop ; name_too_long &1884 a9 07 LDA #&07 ; BELL &1886 20 ee ff JSR &ffee ; OSWRCH ; to_read_name_loop &1889 4c 5f 18 JMP &185f ; read_name_loop ; insert_character &188c c0 0e CPY #&0e # Is the name already as long as allowed? If so, beep &188e f0 f4 BEQ &1884 ; name_too_long &1890 91 62 STA (&62),Y ; high_score_address # Otherwise, add character to name &1892 20 ee ff JSR &ffee ; OSWRCH &1895 c4 64 CPY &64 ; high_score_name_offset &1897 d0 02 BNE &189b ; skip_ &1899 e6 64 INC &64 ; high_score_name_offset ; skip_ &189b c8 INY &189c d0 c1 BNE &185f ; read_name_loop # Always branches ; delete_pressed &189e 98 TYA &189f f0 e8 BEQ &1889 ; to_read_name_loop # Can't delete if at start of line &18a1 c4 64 CPY &64 ; high_score_name_offset &18a3 d0 14 BNE &18b9 ; delete_character_from_middle_of_name ; delete_character_from_end_of_name &18a5 a9 08 LDA #&08 ; backspace &18a7 20 ee ff JSR &ffee ; OSWRCH &18aa a9 2e LDA #&2e ; "." # Replace character at end of name with "." &18ac 20 ee ff JSR &ffee ; OSWRCH &18af a9 08 LDA #&08 ; backspace &18b1 20 ee ff JSR &ffee ; OSWRCH &18b4 c6 64 DEC &64 ; high_score_name_offset # and shorten the name by one character &18b6 88 DEY &18b7 10 a6 BPL &185f ; read_name_loop ; delete_character_from_middle_of_name &18b9 a9 7f LDA #&7f ; delete &18bb 20 ee ff JSR &ffee ; OSWRCH &18be 88 DEY &18bf a9 20 LDA #&20 ; " " # Replace character in middle of name with " " &18c1 91 62 STA (&62),Y ; high_score_address &18c3 d0 9a BNE &185f ; read_name_loop # Always branches ; move_cursor_left &18c5 98 TYA &18c6 f0 c1 BEQ &1889 ; to_read_name_loop # Don't allow cursor to go left of start of name &18c8 a9 08 LDA #&08 ; backspace &18ca 20 ee ff JSR &ffee ; OSWRCH &18cd 88 DEY &18ce 10 8f BPL &185f ; read_name_loop # Always branches ; move_cursor_right &18d0 c4 64 CPY &64 ; high_score_name_offset # Don't allow cursor to go right of last character &18d2 f0 b0 BEQ &1884 ; name_too_long &18d4 a9 09 LDA #&09 ; right &18d6 20 ee ff JSR &ffee ; OSWRCH &18d9 c8 INY &18da d0 83 BNE &185f ; read_name_loop # Always branches ; end_of_name &18dc 20 fe 19 JSR &19fe ; disable_cursor &18df a9 00 LDA #&00 # Terminate name with null character &18e1 a4 64 LDY &64 ; high_score_name_offset &18e3 91 62 STA (&62),Y ; high_score_address ; to_display_high_scores &18e5 a9 00 LDA #&00 # Zero to display all names, not entering a new score &18e7 20 12 19 JSR &1912 ; display_high_scores &18ea a0 1c LDY #&1c ; write_press_space_bar_for_game_loop &18ec b9 35 0e LDA &0e35,Y ; press_space_bar_for_game_string &18ef 20 ee ff JSR &ffee ; OSWRCH &18f2 88 DEY &18f3 10 f7 BPL &18ec ; write_press_space_bar_for_game_loop ; wait_for_space &18f5 a9 81 LDA #&81 ; Scan for a particular key &18f7 a2 9d LDX #&9d ; SPACE &18f9 a0 ff LDY #&ff &18fb 20 f4 ff JSR &fff4 ; OSBYTE &18fe 8a TXA &18ff 10 f4 BPL &18f5 ; wait_for_space &1901 a9 7e LDA #&7e ; Acknowledge ESCAPE condition &1903 4c f4 ff JMP &fff4 ; OSBYTE ; check_next_position &1906 a5 62 LDA &62 ; high_score_address_low &1908 69 14 ADC #&14 &190a a8 TAY &190b c6 64 DEC &64 ; positions_to_check &190d f0 d6 BEQ &18e5 ; to_display_high_scores &190f 4c e5 17 JMP &17e5 ; check_positions_loop ; display_high_scores &1912 48 PHA # Preserve A on exit &1913 a0 a2 LDY #&a2 &1915 85 62 STA &62 ; offset_of_name_to_skip ; write_brilliant_bouncing_boffins_string_loop # Change to MODE 7 and write fixed text &1917 b9 77 0e LDA &0e77,Y ; brilliant_bouncing_boffins_string - 1 &191a 20 ee ff JSR &ffee ; OSWRCH &191d 88 DEY &191e d0 f7 BNE &1917 ; write_brilliant_bouncing_boffins_string_loop &1920 20 fe 19 JSR &19fe ; disable_cursor # Unnecessary, already disabled in text &1923 a2 01 LDX #&01 ; display_high_scores_loop &1925 a9 1f LDA #&1f # TAB(&02, rank * 2 + 5) &1927 20 ee ff JSR &ffee ; OSWRCH &192a a9 02 LDA #&02 &192c 20 ee ff JSR &ffee ; OSWRCH &192f 8a TXA &1930 0a ASL A &1931 69 05 ADC #&05 &1933 20 ee ff JSR &ffee ; OSWRCH &1936 8a TXA &1937 20 f2 19 JSR &19f2 ; write_digit_after_clear # Write rank &193a a9 20 LDA #&20 ; " " &193c 20 f8 19 JSR &19f8 ; write_character_twice # Write " " ; write_score &193f a9 03 LDA #&03 &1941 85 64 STA &64 ; count &1943 85 65 STA &65 ; leading_zero # Non-zero to suppress leading zeros ; write_score_loop &1945 b9 09 1a LDA &1a09,Y ; high_scores # Get two digits of score &1948 48 PHA &1949 a5 65 LDA &65 ; leading_zero &194b f0 25 BEQ &1972 ; after_leading_digit &194d 68 PLA &194e d0 08 BNE &1958 ; is_not_zero &1950 a9 20 LDA #&20 ; " " # Write " " if both digits zero at start of score &1952 20 f8 19 JSR &19f8 ; write_character_twice &1955 4c 76 19 JMP &1976 ; consider_next_pair_of_digits ; is_not_zero &1958 48 PHA &1959 a9 00 LDA #&00 &195b 85 65 STA &65 ; leading_zero &195d 68 PLA &195e 48 PHA &195f 29 f0 AND #&f0 &1961 f0 03 BEQ &1966 ; is_zero_in_tens &1963 68 PLA &1964 d0 0d BNE &1973 ; after_leading_digit ; is_zero_in_tens &1966 a9 20 LDA #&20 ; " " # Write " " if tens digit is zero at start of score &1968 20 ee ff JSR &ffee ; OSWRCH &196b 68 PLA &196c 20 f2 19 JSR &19f2 ; write_digit_after_clear &196f 4c 76 19 JMP &1976 ; consider_next_pair_of_digits ; after_leading_digit &1972 68 PLA &1973 20 e5 19 JSR &19e5 ; write_two_digits # Write two digits of score ; consider_next_pair_of_digits &1976 c8 INY &1977 c6 64 DEC &64 ; count &1979 10 ca BPL &1945 ; write_score_loop ; write_name &197b a9 0e LDA #&0e &197d 85 64 STA &64 ; count &197f a9 80 LDA #&80 # Top bit set to indicate name hasn't ended &1981 85 65 STA &65 ; skip_end_of_name &1983 e4 62 CPX &62 ; offset_of_name_to_skip &1985 f0 26 BEQ &19ad ; consider_next_character &1987 a9 20 LDA #&20 ; " " &1989 20 f8 19 JSR &19f8 ; write_character_twice # Write " ... " &198c a9 2e LDA #&2e ; "." &198e 20 f8 19 JSR &19f8 ; write_character_twice &1991 20 ee ff JSR &ffee ; OSWRCH &1994 a9 20 LDA #&20 ; " " &1996 20 f8 19 JSR &19f8 ; write_character_twice ; write_name_loop &1999 e4 62 CPX &62 ; offset_of_name_to_skip &199b f0 10 BEQ &19ad ; consider_next_character &199d 24 65 BIT &65 ; skip_end_of_name &199f 10 0c BPL &19ad ; consider_next_character &19a1 b9 09 1a LDA &1a09,Y ; high_scores &19a4 d0 04 BNE &19aa ; write_character # Names end with a zero byte &19a6 85 65 STA &65 ; skip_end_of_name # Clear top bit to skip remaining characters &19a8 f0 03 BEQ &19ad ; consider_next_character ; write_character &19aa 20 ee ff JSR &ffee ; OSWRCH ; consider_next_character &19ad c8 INY &19ae c6 64 DEC &64 ; count &19b0 10 e7 BPL &1999 ; write_name_loop &19b2 e4 62 CPX &62 ; offset_of_name_to_skip &19b4 f0 24 BEQ &19da ; consider_next_score &19b6 a9 1f LDA #&1f # TAB(&24, rank * 2 + 5) &19b8 20 ee ff JSR &ffee ; OSWRCH &19bb a9 24 LDA #&24 &19bd 20 ee ff JSR &ffee ; OSWRCH &19c0 8a TXA &19c1 0a ASL A &19c2 69 05 ADC #&05 &19c4 20 ee ff JSR &ffee ; OSWRCH &19c7 b9 09 1a LDA &1a09,Y ; high_scores &19ca 48 PHA &19cb 29 f0 AND #&f0 &19cd f0 07 BEQ &19d6 ; write_single_digit_for_game # Is the game number over 9? &19cf 68 PLA &19d0 20 e5 19 JSR &19e5 ; write_two_digits # If so, write two digits for game &19d3 4c da 19 JMP &19da ; consider_next_score ; write_single_digit_for_game &19d6 68 PLA &19d7 20 f0 19 JSR &19f0 ; write_digit_in_bottom_nibble # Otherwise, write single digit for game ; consider_next_score &19da c8 INY &19db e8 INX &19dc e0 09 CPX #&09 &19de f0 03 BEQ &19e3 ; leave &19e0 4c 25 19 JMP &1925 ; display_high_scores_loop ; leave &19e3 68 PLA &19e4 60 RTS ; write_two_digits &19e5 48 PHA &19e6 29 f0 AND #&f0 &19e8 4a LSR A &19e9 4a LSR A &19ea 4a LSR A &19eb 4a LSR A &19ec 20 f3 19 JSR &19f3 ; write_digit &19ef 68 PLA ; write_digit_in_bottom_nibble &19f0 29 0f AND #&0f ; write_digit_after_clear &19f2 18 CLC ; write_digit &19f3 69 30 ADC #&30 ; "0" &19f5 4c ee ff JMP &ffee ; OSWRCH ; write_character_twice &19f8 20 ee ff JSR &ffee ; OSWRCH &19fb 4c ee ff JMP &ffee ; OSWRCH ; disable_cursor &19fe a9 0a LDA #&0a # R10: Cursor start register &1a00 8d 00 fe STA &fe00 ; video register number &1a03 a9 20 LDA #&20 # Disable cursor &1a05 8d 00 fe STA &fe00 ; video register number &1a08 60 RTS ; high_scores &1a09 00 04 00 00 ; 40000 &1a0d 41 64 64 69 63 74 69 76 65 20 47 61 6d 65 73 00 ; "Addictive Games" &1a1d 00 03 50 00 ; 35000 &1a21 41 64 64 69 63 74 69 76 65 20 47 61 6d 65 73 00 ; "Addictive Games" &1a31 00 03 00 00 ; 30000 &1a35 41 64 64 69 63 74 69 76 65 20 47 61 6d 65 73 00 ; "Addictive Games" &1a45 00 02 50 00 ; 25000 &1a49 41 64 64 69 63 74 69 76 65 20 47 61 6d 65 73 00 ; "Addictive Games" &1a59 00 02 00 00 ; 20000 &1a5d 41 64 64 69 63 74 69 76 65 20 47 61 6d 65 73 00 ; "Addictive Games" &1a6d 00 01 50 00 ; 15000 &1a71 41 64 64 69 63 74 69 76 65 20 47 61 6d 65 73 00 ; "Addictive Games" &1a81 00 01 00 00 ; 10000 &1a85 41 64 64 69 63 74 69 76 65 20 47 61 6d 65 73 00 ; "Addictive Games" &1a95 00 00 50 00 ; 5000 &1a99 41 64 64 69 63 74 69 76 65 20 47 61 6d 65 73 00 ; "Addictive Games" ; cave_number_screen &1aa9 a9 0b LDA #&0b &1aab 8d 5a 0e STA &0e5a ; cave_string + 8 &1aae 20 1e 21 JSR &211e ; change_to_mode7_and_disable_cursor ; came_number_screen_second_line &1ab1 20 5d 0e JSR &0e5d ; write_cave &1ab4 a5 5f LDA &5f ; bcd_cave_number &1ab6 4a LSR A &1ab7 4a LSR A &1ab8 4a LSR A &1ab9 4a LSR A &1aba f0 05 BEQ &1ac1 ; skip_tens &1abc 09 30 ORA #&30 &1abe 20 ee ff JSR &ffee ; OSWRCH ; skip_tens &1ac1 a5 5f LDA &5f ; bcd_cave_number &1ac3 29 0f AND #&0f &1ac5 09 30 ORA #&30 &1ac7 20 ee ff JSR &ffee ; OSWRCH &1aca 20 e2 09 JSR &09e2 ; write_cave_number &1acd ee 5a 0e INC &0e5a ; cave_string + 8 &1ad0 60 RTS ; unused &1ad1 50 4f 27 4d ; "PO'M" ; tarantula_bottom_sprite_addresses_low_table &1ad5 5a 9d e0 23 ; tarantula_bottom_sprite_addresses_high_table &1ad9 1b 1c 1d 1f ; tarantula_top_sprite &1add 00 70 f1 fc f0 f1 fc f3 e0 10 f0 f0 f2 e8 00 30 &1aed f1 f8 f0 f1 f8 f3 e0 00 10 f0 e0 00 00 30 f3 f8 &1afd f0 f3 f8 f3 e0 00 00 00 00 00 00 10 f6 f0 f0 f3 &1b0d f0 f3 c0 00 00 00 00 00 00 00 76 f0 f0 f7 f0 f2 &1b1d c0 00 00 00 00 00 00 00 30 f0 f0 fe f0 f6 00 00 &1b2d 00 00 00 00 00 00 00 f0 f0 fc f0 e4 00 00 00 00 &1b3d 00 00 00 00 00 10 f1 f8 f0 80 00 00 00 00 00 00 &1b4d 00 00 00 00 31 f8 e0 00 00 00 00 00 00 00 ; tarantula_bottom_frame_1_sprite &1b5b 00 e4 00 00 00 00 e4 00 00 00 00 e4 00 00 00 00 &1b6b e4 00 25 00 00 00 00 25 00 00 00 01 84 00 74 80 &1b7b 01 84 00 25 00 00 00 00 25 00 00 00 01 84 00 00 &1b8b c0 01 84 00 34 08 00 00 00 25 00 00 00 01 84 00 &1b9b f1 60 01 84 00 12 18 00 00 00 34 08 00 00 01 84 &1bab 10 80 60 12 84 00 12 b4 80 00 00 12 08 00 00 01 &1bbb 84 30 80 60 12 08 00 21 b4 c4 00 00 12 08 00 00 &1bcb 61 b4 f1 cc 60 12 08 00 21 d2 f4 fc cc 12 84 00 &1bdb 30 d2 96 f1 ee ee 12 08 00 30 69 f8 fc fe e1 84 &1beb 00 f0 d2 a5 7b fd ee 34 08 00 77 78 78 fc f7 e1 &1bfb c3 2d 1e 1e 78 97 fd cc 25 00 00 f7 bc b5 f8 f7 &1c0b f0 69 c3 f0 b4 78 e1 7d cc 25 00 00 f0 de d3 f8 &1c1b f3 cb 78 3c f0 b4 1e f0 97 88 25 00 00 f0 e1 e1 &1c2b f8 e3 3c b4 f0 f0 f0 69 78 e1 88 69 00 00 f0 f0 &1c3b 78 78 1e f0 b4 f0 a5 f0 78 96 f0 87 c2 00 00 f0 &1c4b f0 b4 87 f0 f0 96 e1 78 69 f0 e7 78 f0 84 00 00 &1c5b f0 f0 d2 f0 f0 c3 5e 96 f0 69 f0 f0 96 f0 08 00 &1c6b 00 70 f0 e7 f0 e1 3c ed 18 f0 96 f0 f0 e9 69 00 &1c7b 00 00 70 f0 fe 78 1e fc f6 c0 f0 f0 f0 f2 f0 06 &1c8b 00 00 00 70 f0 fc 87 f0 fc f6 e0 70 f0 f0 f8 f2 &1c9b 00 00 00 ; tarantula_bottom_frame_2_sprite &1c9e 00 00 00 00 e4 e4 00 00 00 00 e4 00 00 00 00 e4 &1cae 00 00 00 00 00 25 25 00 00 00 01 84 00 00 74 81 &1cbe 84 00 00 00 00 00 25 25 00 00 00 01 84 00 00 00 &1cce c1 84 00 00 00 00 00 25 34 08 00 00 01 84 00 00 &1cde f1 61 84 00 00 10 10 00 25 12 08 00 00 01 84 00 &1cee 10 80 61 84 00 00 30 b0 80 25 12 08 00 00 01 84 &1cfe 00 30 80 52 84 00 00 30 f0 c4 25 12 08 00 00 01 &1d0e b4 f0 f1 cc 52 08 00 00 30 f0 f4 ad de 84 00 00 &1d1e 21 b4 78 f1 ee de 08 00 00 30 f0 f8 bc 2f b4 00 &1d2e 00 e1 b4 96 f3 fd de 08 00 00 77 f1 f8 9e c3 d2 &1d3e f3 12 1e b4 e1 7b fd 9a 08 00 00 f7 ff f1 e9 e1 &1d4e e1 f6 0f 96 96 f0 97 fd bc 08 00 00 f0 fe f1 f8 &1d5e 78 78 4f 3c 96 a5 78 e1 7b 69 00 00 00 f0 f0 f1 &1d6e f8 b4 b4 87 f0 96 b4 96 f0 87 e1 00 00 00 f0 f0 &1d7e f3 f8 d2 d2 f0 f0 1e b4 e1 78 f0 c2 00 00 00 f0 &1d8e f0 f3 f0 e1 e1 f0 c3 d2 b4 f0 96 f0 c2 00 00 00 &1d9e f0 f0 f3 f0 f0 78 78 3c d2 b4 f0 e1 78 84 00 00 &1dae 00 70 f0 f6 f0 f0 b4 87 90 e1 78 f0 f0 9e 84 00 &1dbe 00 00 70 f0 fe f0 f0 d6 d2 c0 f0 f0 f0 f2 e1 08 &1dce 00 00 00 70 f0 fc f0 f0 ef 3e e0 70 f0 f0 f8 f2 &1dde 00 00 00 ; tarantula_bottom_frame_3_sprite &1de1 00 00 00 e4 00 00 00 00 e4 e4 00 00 00 00 e4 00 &1df1 00 00 00 00 25 00 00 00 00 25 84 00 00 00 74 84 &1e01 00 00 00 00 00 25 00 00 00 00 25 84 00 00 00 01 &1e11 84 00 00 00 00 00 25 00 00 00 00 25 84 00 00 00 &1e21 e1 a4 00 00 00 10 10 25 00 00 00 00 25 84 00 00 &1e31 10 81 a4 00 00 00 30 b0 a5 00 00 00 00 25 84 00 &1e41 00 30 81 a4 00 00 00 30 f0 a5 00 00 00 00 25 84 &1e51 70 f0 f1 cd a4 00 00 00 30 f0 a5 fc cc 00 00 25 &1e61 d2 f0 78 f1 ef a6 00 00 00 30 f0 ad fc fe f0 00 &1e71 25 d2 78 b4 f3 ed a6 00 00 00 77 f1 bc 3c f7 f0 &1e81 f3 34 69 f0 c3 f3 ed 84 00 00 00 f7 ff d2 d2 f7 &1e91 f0 e7 3c 69 d2 f0 7b de 84 00 00 00 f0 fe e1 e1 &1ea1 7b f8 96 b4 69 d2 78 97 da 84 00 00 00 f0 f0 f1 &1eb1 78 b7 ef 78 b4 69 b4 b4 e1 d6 08 00 00 00 f0 f0 &1ec1 f3 9e d3 9e f0 b4 78 b4 c3 f0 3c 08 00 00 00 f0 &1ed1 f0 f3 e1 e1 78 e1 3c 78 78 f0 78 f0 08 00 00 00 &1ee1 f0 f0 f3 f0 78 f0 96 b4 78 78 f0 96 e1 80 00 00 &1ef1 00 70 f0 f6 f0 b4 e1 7c 83 87 f0 f0 e1 d3 80 00 &1f01 00 00 70 f0 fe f0 d2 d2 f6 c0 f0 f0 f0 f2 3c 00 &1f11 00 00 00 70 f0 fc f0 e1 3c f6 e0 70 f0 f0 f8 f2 &1f21 00 00 00 ; tarantula_bottom_frame_4_sprite &1f24 00 00 e4 00 00 00 00 e4 00 00 00 00 e4 e4 00 00 &1f34 00 00 00 25 00 00 00 00 25 00 00 00 01 85 b4 80 &1f44 00 00 00 00 25 00 00 00 00 25 00 00 00 01 85 84 &1f54 c0 00 00 00 00 25 00 00 00 00 25 00 00 00 01 85 &1f64 b5 60 00 00 00 10 25 00 00 00 00 25 00 00 00 01 &1f74 85 84 60 00 00 00 30 b4 08 00 00 00 25 00 00 00 &1f84 01 a5 84 60 00 00 00 30 d2 4c 00 00 00 34 08 00 &1f94 70 d2 a5 84 60 00 00 00 30 d2 7c fc cc 00 12 08 &1fa4 30 f0 5a a5 a6 ee 00 00 00 30 d2 3c fc fe f0 12 &1fb4 0b f0 f0 b4 6b b5 ee 00 00 00 77 d2 d2 fc f7 f0 &1fc4 d2 3c 2d f0 b4 6b b5 cc 00 00 00 f7 ef e1 f8 f7 &1fd4 f0 96 a5 f0 5a 69 e3 b5 cc 00 00 00 f0 fe 78 78 &1fe4 f3 e9 69 d2 f0 a5 e1 d2 b7 88 00 00 00 f0 f0 b4 &1ff4 b4 f3 9e e1 f0 d2 d2 d2 5a b7 88 00 00 00 f0 f0 &2004 d2 c3 e1 78 e1 f0 69 f0 d2 96 7b 88 00 00 00 f0 &2014 f0 e3 f0 1e f0 c3 e1 f0 78 96 f0 78 80 00 00 00 &2024 f0 f0 f3 78 f0 f0 3c 5a f0 b4 a5 f0 78 80 00 00 &2034 00 70 f0 f6 b4 f0 c3 fc 1c f0 c3 78 69 f9 80 00 &2044 00 00 70 f0 fe d2 c3 3c f6 c0 f0 f0 f0 96 f0 00 &2054 00 00 00 70 f0 fc e1 3c fc f6 e0 70 f0 f0 f8 f2 &2064 00 00 00 ; game_over_string # Text is reversed &2067 9c ; BLACK_BACKGROUND &2068 0c 1a 1f ; TAB(&1a, &0c) &206b 72 65 76 4f 09 65 6d 61 47 84 00 09 9d 8d ; DOUBLE_HEIGHT; NEW_BACKGROUND; BLUE; "Game Over" &2079 0c 0a 1f ; TAB(&0a, &0c) &207c 9c ; BLACK_BACKGROUND &207d 0b 1a 1f ; TAB(&1a, &0b) &2080 72 65 76 4f 09 65 6d 61 47 84 00 09 9d 8d ; DOUBLE_HEIGHT; NEW_BACKGROUND; BLUE; "Game Over" &208e 0b 0a 1f ; TAB(&0a, &0b) &2091 07 16 ; MODE 7 ; game_over_screen &2093 a9 2b LDA #&2b &2095 85 80 STA &80 ; offset ; write_game_over_text_loop &2097 a4 80 LDY &80 ; offset &2099 b9 67 20 LDA &2067,Y ; game_over_string &209c 20 ee ff JSR &ffee ; OSWRCH &209f c6 80 DEC &80 ; offset &20a1 10 f4 BPL &2097 ; write_game_over_text_loop &20a3 a9 0a LDA #&0a # R10: Cursor start register &20a5 8d 00 fe STA &fe00 ; video register number &20a8 a9 20 LDA #&20 # Disable cursor &20aa 8d 01 fe STA &fe01 ; video register value &20ad a9 80 LDA #&80 &20af 4c 76 37 JMP &3776 ; delay ; collapsing_mantaray_frame_1_sprite &20b2 10 c8 00 00 31 80 30 10 80 30 80 c0 60 30 e0 70 &20c2 c0 60 60 71 fe f7 e8 60 c0 f3 f0 f0 fc 30 d0 f6 &20d2 f0 f0 f6 b0 d0 f6 e1 78 f6 b0 f0 f0 f0 f0 f0 f0 &20e2 70 f0 f0 f0 f0 e0 10 f0 f8 f1 f0 80 00 34 f0 f0 &20f2 c2 00 00 03 f0 f0 0c 00 ; collapsing_mantaray_frame_2_sprite &20fa 00 60 60 00 10 f2 f4 80 30 f2 f4 c0 30 fc f3 c0 &210a 10 f0 f0 80 10 b4 d2 80 30 80 10 c0 e4 00 00 72 ; collapsing_mantaray_frame_3_sprite &211a 60 b4 f2 60 ; change_to_mode7_and_disable_cursor &211e a9 16 LDA #&16 # MODE 7 &2120 20 ee ff JSR &ffee ; OSWRCH &2123 a9 07 LDA #&07 &2125 20 ee ff JSR &ffee ; OSWRCH &2128 a9 0a LDA #&0a # R10: Cursor start register &212a 8d 00 fe STA &fe00 ; video register number &212d a9 20 LDA #&20 # Disable cursor &212f 8d 01 fe STA &fe01 ; video register value &2132 60 RTS ; increase_bcd_cave_number &2133 f8 SED &2134 18 CLC &2135 a5 5f LDA &5f ; bcd_cave_number &2137 69 01 ADC #&01 &2139 85 5f STA &5f ; bcd_cave_number &213b d8 CLD &213c 60 RTS ; unused &213d 40 40 40 ; play_completion_tune &2140 a9 7e LDA #&7e ; Acknowledge ESCAPE condition &2142 20 f4 ff JSR &fff4 ; OSBYTE &2145 a9 15 LDA #&15 &2147 85 80 STA &80 ; count &2149 a9 fe LDA #&fe ; &09fe = tune_data &214b 85 81 STA &81 ; note_address_low ; play_completion_tune_loop &214d a5 81 LDA &81 ; note_address_low &214f 20 62 21 JSR &2162 ; play_note &2152 18 CLC &2153 a5 81 LDA &81 ; note_address_low &2155 69 03 ADC #&03 &2157 85 81 STA &81 ; note_address_low &2159 90 02 BCC &215d ; skip_page &215b e6 3f INC &3f ; tune_address_high ; skip_page &215d c6 80 DEC &80 ; count &215f d0 ec BNE &214d ; play_completion_tune_loop &2161 60 RTS ; play_note &2162 85 3e STA &3e ; tune_address_low &2164 20 3f 12 JSR &123f ; check_for_player_quitting &2167 a0 00 LDY #&00 &2169 b1 3e LDA (&3e),Y ; tune_address &216b 8d 3d 0a STA &0a3d ; tune_sound # Set channel &216e c8 INY &216f b1 3e LDA (&3e),Y ; tune_address &2171 8d 41 0a STA &0a41 ; tune_sound + 4 # Set pitch &2174 c8 INY &2175 b1 3e LDA (&3e),Y ; tune_address &2177 8d 43 0a STA &0a43 ; tune_sound + 6 # Set duration &217a a9 07 LDA #&07 ; Generate a sound (SOUND) &217c a2 3d LDX #&3d &217e a0 0a LDY #&0a ; &0a3d = tune_sound # Play sound for tune &2180 4c f1 ff JMP &fff1 ; OSWORD ; check_if_left_pressed &2183 a9 81 LDA #&81 ; Scan for a particular key &2185 a8 TAY &2186 a2 9e LDX #&9e ; Z &2188 20 f4 ff JSR &fff4 ; OSBYTE &218b e0 00 CPX #&00 # Leaves with negative, non-zero if key pressed &218d 60 RTS ; check_if_right_pressed &218e a9 81 LDA #&81 ; Scan for a particular key &2190 a8 TAY &2191 a2 bd LDX #&bd ; X &2193 20 f4 ff JSR &fff4 ; OSBYTE &2196 e0 00 CPX #&00 # Leaves with negative, non-zero if key pressed &2198 60 RTS ; check_if_up_pressed &2199 a9 81 LDA #&81 ; Scan for a particular key &219b a8 TAY &219c a2 b7 LDX #&b7 ; * &219e 20 f4 ff JSR &fff4 ; OSBYTE &21a1 e0 00 CPX #&00 # Leaves with negative, non-zero if key pressed &21a3 60 RTS ; check_if_down_pressed &21a4 a9 81 LDA #&81 ; Scan for a particular key &21a6 a8 TAY &21a7 a2 97 LDX #&97 ; ? &21a9 20 f4 ff JSR &fff4 ; OSBYTE &21ac e0 00 CPX #&00 # Leaves with negative, non-zero if key pressed &21ae 60 RTS ; check_if_return_pressed &21af a9 81 LDA #&81 ; Scan for a particular key &21b1 a8 TAY &21b2 a2 b6 LDX #&b6 ; RETURN &21b4 20 f4 ff JSR &fff4 ; OSBYTE &21b7 e0 00 CPX #&00 # Leaves with negative, non-zero if key pressed &21b9 60 RTS ; check_if_delete_pressed &21ba a9 81 LDA #&81 ; Scan for a particular key &21bc a8 TAY &21bd a2 a6 LDX #&a6 ; DELETE &21bf 20 f4 ff JSR &fff4 ; OSBYTE &21c2 e0 00 CPX #&00 # Leaves with negative, non-zero if key pressed &21c4 60 RTS ; check_if_escape_pressed &21c5 a9 81 LDA #&81 ; Scan for a particular key &21c7 a8 TAY &21c8 a2 8f LDX #&8f ; ESCAPE &21ca 20 f4 ff JSR &fff4 ; OSBYTE &21cd e0 00 CPX #&00 # Leaves with negative, non-zero if key pressed &21cf 60 RTS ; check_if_q_or_s_pressed &21d0 a9 7a LDA #&7a ; Keyboard scan from &10 &21d2 20 f4 ff JSR &fff4 ; OSBYTE &21d5 e0 51 CPX #&51 ; S &21d7 d0 06 BNE &21df ; check_if_q_pressed &21d9 a9 00 LDA #&00 &21db 8d 62 02 STA &0262 ; os_sound_suppression ; leave &21de 60 RTS ; check_if_q_pressed &21df e0 10 CPX #&10 ; Q &21e1 d0 fb BNE &21de ; leave &21e3 a9 01 LDA #&01 &21e5 8d 62 02 STA &0262 ; os_sound_suppression &21e8 60 RTS ; unused &21e9 4f 27 4d 41 4c 4c 45 59 ; "O'MALLEY" ; check_if_copy_pressed &21f1 a9 7a LDA #&7a ; Keyboard scan from &10 &21f3 20 f4 ff JSR &fff4 ; OSBYTE &21f6 e0 69 CPX #&69 ; COPY &21f8 f0 04 BEQ &21fe ; pause_game &21fa 60 RTS ; unused &21fb 50 4f 4d ; "POM" ; pause_game &21fe 20 ba 21 JSR &21ba ; check_if_delete_pressed &2201 10 01 BPL &2204 ; delete_not_pressed &2203 60 RTS ; delete_not_pressed &2204 a9 00 LDA #&00 # Disable interval timer events &2206 8d c4 02 STA &02c4 ; os_event_enable_flags + 5 &2209 18 CLC &220a a5 23 LDA &23 ; score_x &220c 69 1a ADC #&1a &220e 85 12 STA &12 ; sprite_x &2210 a5 24 LDA &24 ; score_y &2212 85 13 STA &13 ; sprite_y &2214 a9 17 LDA #&17 &2216 85 14 STA &14 ; sprite_width &2218 a9 08 LDA #&08 &221a 85 15 STA &15 ; sprite_height &221c a2 df LDX #&df &221e a0 46 LDY #&46 ; &46df = game_frozen_sprite - 1 &2220 20 b6 40 JSR &40b6 ; plot_sprite # Plot "Game Frozen" over score ; wait_for_delete &2223 20 ba 21 JSR &21ba ; check_if_delete_pressed &2226 10 fb BPL &2223 ; wait_for_delete &2228 a2 ff LDX #&ff ; pause_delay_loop &222a a0 48 LDY #&48 ; pause_delay_inner_loop &222c ea NOP &222d 88 DEY &222e d0 fc BNE &222c ; pause_delay_inner_loop &2230 ca DEX &2231 d0 f7 BNE &222a ; pause_delay_loop &2233 20 ba 21 JSR &21ba ; check_if_delete_pressed &2236 10 eb BPL &2223 ; wait_for_delete &2238 a5 26 LDA &26 ; pause_x &223a 85 12 STA &12 ; sprite_x &223c a5 27 LDA &27 ; pause_y &223e 85 13 STA &13 ; sprite_y &2240 a9 0c LDA #&0c &2242 85 15 STA &15 ; sprite_height &2244 a9 09 LDA #&09 &2246 85 14 STA &14 ; sprite_width &2248 a2 2b LDX #&2b &224a a0 46 LDY #&46 ; &462b = box_right_sprite - 1 # Remove "en" &224c 20 b6 40 JSR &40b6 ; plot_sprite &224f 38 SEC &2250 a5 12 LDA &12 ; sprite_x &2252 e9 12 SBC #&12 &2254 85 12 STA &12 ; sprite_x &2256 a9 06 LDA #&06 &2258 85 14 STA &14 ; sprite_width &225a a2 97 LDX #&97 &225c a0 46 LDY #&46 ; &4697 = box_middle_sprite - 1 &225e 20 b6 40 JSR &40b6 ; plot_sprite # Remove "Fro" &2261 38 SEC &2262 a5 12 LDA &12 ; sprite_x &2264 e9 0c SBC #&0c &2266 85 12 STA &12 ; sprite_x &2268 a9 0a LDA #&0a &226a 85 14 STA &14 ; sprite_width &226c a2 e7 LDX #&e7 &226e a0 44 LDY #&44 ; &44e7 = score_box_left_sprite - 1 # Plot "Score" &2270 20 b6 40 JSR &40b6 ; plot_sprite &2273 20 49 28 JSR &2849 ; plot_score &2276 a9 01 LDA #&01 # Enable interval timer events &2278 8d c4 02 STA &02c4 ; os_event_enable_flags + 5 &227b a2 83 LDX #&83 &227d a9 04 LDA #&04 ; Write interval timer &227f a8 TAY ; &0483 = five_centisecond_timer_block # Pausing and unpausing costs up to a second of time &2280 20 f1 ff JSR &fff1 ; OSWORD &2283 a5 00 LDA &00 ; cave_border &2285 f0 05 BEQ &228c ; leave &2287 30 03 BMI &228c ; leave # Is this cave type 2? &2289 4c 99 40 JMP &4099 ; fix_cave_type_2_score_box # If so, fix pixels around Score box ; leave &228c 60 RTS ; collect_horseshoe &228d a9 07 LDA #&07 ; Generate a sound (SOUND) &228f a2 98 LDX #&98 &2291 a0 08 LDY #&08 ; &0898 = sound_3 # Play sound for collecting horseshoe &2293 20 f1 ff JSR &fff1 ; OSWORD &2296 a6 80 LDX &80 ; horseshoe_to_check &2298 bd 58 04 LDA &0458,X ; horseshoes_x &229b 85 12 STA &12 ; sprite_x &229d bd 5e 04 LDA &045e,X ; horseshoes_y &22a0 85 13 STA &13 ; sprite_y &22a2 a9 00 LDA #&00 # Mark horseshoe as collected &22a4 9d 58 04 STA &0458,X ; horseshoes_x &22a7 a9 02 LDA #&02 &22a9 85 14 STA &14 ; sprite_width &22ab a9 08 LDA #&08 &22ad 85 15 STA &15 ; sprite_height &22af a2 de LDX #&de &22b1 a0 3e LDY #&3e ; &3ede = empty_sprite - 1 &22b3 20 b6 40 JSR &40b6 ; plot_sprite # Remove horseshoe from screen &22b6 a2 75 LDX #&75 &22b8 a0 04 LDY #&04 ; 475 # Score 475 points for collecting horseshoe &22ba 4c 15 28 JMP &2815 ; increase_score ; collect_petridish &22bd a9 07 LDA #&07 ; Generate a sound (SOUND) &22bf a2 a8 LDX #&a8 &22c1 a0 08 LDY #&08 ; &08a8 = sound_5 # Play sound for collecting petri dish &22c3 20 f1 ff JSR &fff1 ; OSWORD &22c6 a6 80 LDX &80 ; petridish_to_check &22c8 bd 52 04 LDA &0452,X ; petridishes_x &22cb 85 12 STA &12 ; sprite_x &22cd bd 55 04 LDA &0455,X ; petridishes_y &22d0 85 13 STA &13 ; sprite_y &22d2 a9 00 LDA #&00 # Mark petri dish as collected &22d4 9d 52 04 STA &0452,X ; petridishes_x &22d7 a9 03 LDA #&03 &22d9 85 14 STA &14 ; sprite_width &22db a9 06 LDA #&06 &22dd 85 15 STA &15 ; sprite_height &22df f8 SED &22e0 18 CLC &22e1 a5 33 LDA &33 ; time + 3 &22e3 69 06 ADC #&06 # Gain 6 seconds time for collecting horseshoe &22e5 85 33 STA &33 ; time + 3 &22e7 a5 32 LDA &32 ; time + 2 &22e9 69 00 ADC #&00 &22eb 85 32 STA &32 ; time + 2 &22ed d8 CLD &22ee a2 de LDX #&de &22f0 a0 3e LDY #&3e ; &3ede = empty_sprite - 1 &22f2 20 b6 40 JSR &40b6 ; plot_sprite # Remove petri dish from screen &22f5 a6 25 LDX &25 ; time_x &22f7 a0 0a LDY #&0a &22f9 a9 30 LDA #&30 ; &30 = time &22fb 20 b6 27 JSR &27b6 ; plot_number &22fe a2 40 LDX #&40 &2300 a0 00 LDY #&00 ; 40 # Score 40 points for collecting horseshoe &2302 4c 15 28 JMP &2815 ; increase_score ; collect_tripod &2305 a9 07 LDA #&07 ; Generate a sound (SOUND) &2307 a2 a0 LDX #&a0 &2309 a0 08 LDY #&08 ; &08a0 = sound_4 # Play sound for collecting tripod &230b 20 f1 ff JSR &fff1 ; OSWORD &230e a6 80 LDX &80 ; tripod_to_check &2310 bd 4c 04 LDA &044c,X ; tripods_x &2313 85 12 STA &12 ; sprite_x &2315 bd 4f 04 LDA &044f,X ; tripods_y &2318 85 13 STA &13 ; sprite_y &231a a9 00 LDA #&00 # Mark tripod as collected &231c 9d 4c 04 STA &044c,X ; tripods_x &231f a9 03 LDA #&03 &2321 85 14 STA &14 ; sprite_width &2323 a9 14 LDA #&14 &2325 85 15 STA &15 ; sprite_height &2327 a2 de LDX #&de &2329 a0 3e LDY #&3e ; &3ede = empty_sprite - 1 &232b 20 b6 40 JSR &40b6 ; plot_sprite # Remove tripod from screen &232e a2 00 LDX #&00 &2330 a0 14 LDY #&14 ; 1400 # Score 1400 points for collecting tripod &2332 4c 15 28 JMP &2815 ; increase_score ; to_consider_next_horseshoe &2335 4c c5 23 JMP &23c5 ; consider_next_horseshoe ; check_for_collecting_horseshoes &2338 a2 05 LDX #&05 # For each horseshoe, &233a 86 80 STX &80 ; horseshoe_to_check ; check_for_collecting_horseshoes_loop &233c bd 58 04 LDA &0458,X ; horseshoes_x &233f f0 f4 BEQ &2335 ; to_consider_next_horseshoe # Is there a horseshoe in this slot? &2341 85 42 STA &42 ; horseshoe_x3 &2343 18 CLC &2344 69 02 ADC #&02 &2346 85 45 STA &45 ; horseshoe_x4 &2348 38 SEC &2349 e9 04 SBC #&04 &234b 85 41 STA &41 ; horseshoe_x2 &234d e9 02 SBC #&02 &234f 85 46 STA &46 ; horseshoe_x1 &2351 18 CLC &2352 bd 5e 04 LDA &045e,X ; horseshoes_y &2355 85 44 STA &44 ; horseshoe_y3 &2357 69 05 ADC #&05 &2359 85 47 STA &47 ; horseshoe_y4 &235b 38 SEC &235c e9 0c SBC #&0c &235e 85 43 STA &43 ; horseshoe_y2 &2360 e9 03 SBC #&03 &2362 85 48 STA &48 ; horseshoe_y1 &2364 a5 8b LDA &8b ; feet_state &2366 f0 22 BEQ &238a ; check_bottom_of_player &2368 a5 10 LDA &10 ; player_x # Is the side of the player touching the horseshoe? &236a a4 8e LDY &8e ; player_facing &236c d0 08 BNE &2376 ; check_right_side_of_player ; check_left_side_of_player &236e 38 SEC &236f e9 06 SBC #&06 &2371 c5 45 CMP &45 ; horseshoe_x4 &2373 4c 78 23 JMP &2378 ; check_side_of_player ; check_right_side_of_player &2376 c5 46 CMP &46 ; horseshoe_x1 ; check_side_of_player &2378 d0 10 BNE &238a ; check_bottom_of_player &237a a5 11 LDA &11 ; player_y &237c c5 43 CMP &43 ; horseshoe_y2 &237e 30 0a BMI &238a ; check_bottom_of_player &2380 38 SEC &2381 e9 1a SBC #&1a &2383 c5 44 CMP &44 ; horseshoe_y3 &2385 10 03 BPL &238a ; check_bottom_of_player &2387 4c 8d 22 JMP &228d ; collect_horseshoe # If so, collect it ; check_bottom_of_player &238a a5 11 LDA &11 ; player_y # Is the bottom of the player touching the horseshoe? &238c c5 43 CMP &43 ; horseshoe_y2 &238e 10 14 BPL &23a4 ; consider_umbrella &2390 c5 48 CMP &48 ; horseshoe_y1 &2392 30 10 BMI &23a4 ; consider_umbrella &2394 a5 10 LDA &10 ; player_x &2396 c5 41 CMP &41 ; horseshoe_x2 &2398 30 0a BMI &23a4 ; consider_umbrella &239a 38 SEC &239b e9 06 SBC #&06 &239d c5 45 CMP &45 ; horseshoe_x4 &239f 10 03 BPL &23a4 ; consider_umbrella &23a1 4c 8d 22 JMP &228d ; collect_horseshoe # If so, collect it ; consider_umbrella &23a4 a5 8c LDA &8c ; umbrella_state &23a6 d0 28 BNE &23d0 ; check_umbrella ; check_top_of_player &23a8 38 SEC # Is the top of the player touching the horseshoe? &23a9 a5 11 LDA &11 ; player_y &23ab e9 18 SBC #&18 &23ad c5 47 CMP &47 ; horseshoe_y4 &23af 10 14 BPL &23c5 ; consider_next_horseshoe &23b1 c5 44 CMP &44 ; horseshoe_y3 &23b3 30 10 BMI &23c5 ; consider_next_horseshoe &23b5 a5 10 LDA &10 ; player_x &23b7 c5 41 CMP &41 ; horseshoe_x2 &23b9 30 0a BMI &23c5 ; consider_next_horseshoe &23bb 38 SEC &23bc e9 06 SBC #&06 &23be c5 45 CMP &45 ; horseshoe_x4 &23c0 10 03 BPL &23c5 ; consider_next_horseshoe &23c2 4c 8d 22 JMP &228d ; collect_horseshoe # If so, collect it ; consider_next_horseshoe &23c5 a6 80 LDX &80 ; horseshoe_to_check &23c7 ca DEX &23c8 86 80 STX &80 ; horseshoe_to_check &23ca 30 03 BMI &23cf ; leave &23cc 4c 3c 23 JMP &233c ; check_for_collecting_horseshoes_loop ; leave &23cf 60 RTS ; check_umbrella &23d0 a5 8b LDA &8b ; feet_state # If the umbrella is up, &23d2 f0 27 BEQ &23fb ; check_top_of_umbrella ; check_side_of_umbrella &23d4 a5 10 LDA &10 ; player_x # Is the side of the umbrella touching the horseshoe? &23d6 a4 8e LDY &8e ; player_facing &23d8 d0 08 BNE &23e2 ; check_right_side_of_umbrella &23da 38 SEC &23db e9 0a SBC #&0a &23dd c5 45 CMP &45 ; horseshoe_x4 &23df 4c e7 23 JMP &23e7 ; check_side ; check_right_side_of_umbrella &23e2 18 CLC &23e3 69 04 ADC #&04 &23e5 c5 46 CMP &46 ; horseshoe_x1 ; check_side &23e7 d0 12 BNE &23fb ; check_top_of_umbrella &23e9 38 SEC &23ea a5 11 LDA &11 ; player_y &23ec e9 1a SBC #&1a &23ee c5 43 CMP &43 ; horseshoe_y2 &23f0 30 09 BMI &23fb ; check_top_of_umbrella &23f2 e9 08 SBC #&08 &23f4 c5 44 CMP &44 ; horseshoe_y3 &23f6 10 03 BPL &23fb ; check_top_of_umbrella &23f8 4c 8d 22 JMP &228d ; collect_horseshoe # If so, collect it ; check_top_of_umbrella &23fb 38 SEC # Is the top of the umbrella touching the horseshoe? &23fc a5 11 LDA &11 ; player_y &23fe e9 19 SBC #&19 &2400 c5 43 CMP &43 ; horseshoe_y2 &2402 30 c1 BMI &23c5 ; consider_next_horseshoe &2404 e9 02 SBC #&02 &2406 c5 43 CMP &43 ; horseshoe_y2 &2408 10 bb BPL &23c5 ; consider_next_horseshoe &240a a5 10 LDA &10 ; player_x &240c a4 8e LDY &8e ; player_facing &240e d0 06 BNE &2416 ; check_right_top &2410 38 SEC &2411 e9 0a SBC #&0a &2413 4c 19 24 JMP &2419 ; check_top ; check_right_top &2416 18 CLC &2417 69 04 ADC #&04 ; check_top &2419 c5 41 CMP &41 ; horseshoe_x2 &241b d0 03 BNE &2420 ; check_side &241d 4c 8d 22 JMP &228d ; collect_horseshoe # If so, collect it ; check_side &2420 c5 42 CMP &42 ; horseshoe_x3 &2422 d0 a1 BNE &23c5 ; consider_next_horseshoe &2424 4c 8d 22 JMP &228d ; collect_horseshoe ; check_for_collecting_petridishes &2427 a2 02 LDX #&02 # For each petri dish, &2429 86 80 STX &80 ; petridish_to_check ; check_for_collecting_petridishes_loop &242b bd 52 04 LDA &0452,X ; petridishes_x &242e f0 5f BEQ &248f ; to_consider_next_petridish # Is there a petri dish in this slot? &2430 18 CLC &2431 69 02 ADC #&02 &2433 85 44 STA &44 ; petridish_x3 &2435 38 SEC &2436 e9 06 SBC #&06 &2438 85 42 STA &42 ; petridish_x2 &243a e9 02 SBC #&02 &243c 85 41 STA &41 ; petridish_x1 &243e bd 55 04 LDA &0455,X ; petridishes_y &2441 85 46 STA &46 ; petridish_y3 &2443 e9 05 SBC #&05 &2445 85 45 STA &45 ; petridish_y2 &2447 e9 05 SBC #&05 &2449 85 47 STA &47 ; petridish_y1 &244b a5 8b LDA &8b ; feet_state &244d f0 22 BEQ &2471 ; check_bottom_of_player &244f a5 10 LDA &10 ; player_x # Is the side of the player touching the petri dish? &2451 a4 8e LDY &8e ; player_facing &2453 d0 08 BNE &245d ; check_right_side_of_player &2455 38 SEC &2456 e9 06 SBC #&06 &2458 c5 44 CMP &44 ; petridish_x3 &245a 4c 5f 24 JMP &245f ; check_side_of_player ; check_right_side_of_player &245d c5 41 CMP &41 ; petridish_x1 ; check_side_of_player &245f d0 10 BNE &2471 ; check_bottom_of_player &2461 a5 11 LDA &11 ; player_y &2463 c5 45 CMP &45 ; petridish_y2 &2465 30 0a BMI &2471 ; check_bottom_of_player &2467 38 SEC &2468 e9 18 SBC #&18 &246a c5 46 CMP &46 ; petridish_y3 &246c 10 03 BPL &2471 ; check_bottom_of_player &246e 4c 36 04 JMP &0436 ; clear_out_of_time_and_collect_petridish # If so, collect it ; check_bottom_of_player &2471 a5 11 LDA &11 ; player_y # Is the bottom of the player touching the petri dish? &2473 c5 45 CMP &45 ; petridish_y2 &2475 10 14 BPL &248b ; consider_umbrella &2477 c5 47 CMP &47 ; petridish_y1 &2479 30 10 BMI &248b ; consider_umbrella &247b a5 10 LDA &10 ; player_x &247d c5 42 CMP &42 ; petridish_x2 &247f 30 0a BMI &248b ; consider_umbrella &2481 38 SEC &2482 e9 06 SBC #&06 &2484 c5 44 CMP &44 ; petridish_x3 &2486 10 03 BPL &248b ; consider_umbrella &2488 4c bd 22 JMP &22bd ; collect_petridish # If so, collect it ; consider_umbrella &248b a5 8c LDA &8c ; umbrella_state &248d d0 03 BNE &2492 ; check_umbrella ; to_consider_next_petridish &248f 4c b9 24 JMP &24b9 ; consider_next_petridish ; check_umbrella &2492 38 SEC # Is the side of the umbrella touching the petri dish? &2493 a5 11 LDA &11 ; player_y &2495 e9 1d SBC #&1d &2497 c5 45 CMP &45 ; petridish_y2 &2499 10 1e BPL &24b9 ; consider_next_petridish &249b c5 47 CMP &47 ; petridish_y1 &249d 30 1a BMI &24b9 ; consider_next_petridish &249f a5 10 LDA &10 ; player_x &24a1 a4 8e LDY &8e ; player_facing &24a3 d0 06 BNE &24ab ; check_right_side_of_umbrella &24a5 38 SEC &24a6 e9 0a SBC #&0a &24a8 4c ae 24 JMP &24ae ; check_side_of_umbrella ; check_right_side_of_umbrella &24ab 18 CLC &24ac 69 04 ADC #&04 ; check_side_of_umbrella &24ae c5 44 CMP &44 ; petridish_x3 &24b0 10 07 BPL &24b9 ; consider_next_petridish &24b2 c5 42 CMP &42 ; petridish_x2 &24b4 30 03 BMI &24b9 ; consider_next_petridish &24b6 4c bd 22 JMP &22bd ; collect_petridish # If so, collect it ; consider_next_petridish &24b9 a6 80 LDX &80 ; petridish_to_check &24bb ca DEX &24bc 86 80 STX &80 ; petridish_to_check &24be 10 01 BPL &24c1 ; to_check_for_collecting_petridishes_loop &24c0 60 RTS ; to_check_for_collecting_petridishes_loop &24c1 4c 2b 24 JMP &242b ; check_for_collecting_petridishes_loop ; check_for_collecting_tripods &24c4 a2 02 LDX #&02 &24c6 86 80 STX &80 ; tripod_to_check &24c8 a5 8c LDA &8c ; umbrella_state # Tripods can only be collected if the umbrella is up &24ca f0 4a BEQ &2516 ; leave &24cc a5 8b LDA &8b ; feet_state &24ce f0 46 BEQ &2516 ; leave ; check_for_collecting_tripods_loop # For each tripod, &24d0 bd 4c 04 LDA &044c,X ; tripods_x &24d3 f0 3a BEQ &250f ; consider_next_tripod # is there a tripod in this slot? &24d5 18 CLC &24d6 69 02 ADC #&02 &24d8 85 42 STA &42 ; tripod_x2 &24da 38 SEC &24db e9 08 SBC #&08 &24dd 85 41 STA &41 ; tripod_x1 &24df bd 4f 04 LDA &044f,X ; tripods_y &24e2 85 43 STA &43 ; tripod_y2 &24e4 e9 13 SBC #&13 &24e6 85 44 STA &44 ; tripod_y1 &24e8 a5 10 LDA &10 ; player_x &24ea a4 8e LDY &8e ; player_facing &24ec d0 08 BNE &24f6 ; check_right_side_of_umbrella &24ee 38 SEC &24ef e9 0a SBC #&0a &24f1 c5 42 CMP &42 ; tripod_x2 &24f3 4c fb 24 JMP &24fb ; check_side_of_umbrella ; check_right_side_of_umbrella &24f6 18 CLC &24f7 69 04 ADC #&04 &24f9 c5 41 CMP &41 ; tripod_x1 ; check_side_of_umbrella &24fb d0 12 BNE &250f ; consider_next_tripod # Is the umbrella touching it? &24fd 38 SEC &24fe a5 11 LDA &11 ; player_y &2500 e9 1a SBC #&1a &2502 c5 44 CMP &44 ; tripod_y1 &2504 30 09 BMI &250f ; consider_next_tripod &2506 e9 08 SBC #&08 &2508 c5 43 CMP &43 ; tripod_y2 &250a 10 03 BPL &250f ; consider_next_tripod &250c 4c 05 23 JMP &2305 ; collect_tripod # If so, collect it ; consider_next_tripod &250f a6 80 LDX &80 ; tripod_to_check &2511 ca DEX &2512 86 80 STX &80 ; tripod_to_check &2514 10 ba BPL &24d0 ; check_for_collecting_tripods_loop ; leave &2516 60 RTS ; check_for_touching_barbed_wire &2517 a2 02 LDX #&02 &2519 86 80 STX &80 ; wire_to_check ; check_for_touching_barbed_wire_loop # For each pair of barbed wires, &251b bd 40 04 LDA &0440,X ; long_barbed_wires_x &251e f0 23 BEQ &2543 ; consider_short_barbed_wire # Is there a long barbed wire in this slot? &2520 18 CLC &2521 69 02 ADC #&02 &2523 85 41 STA &41 ; wire_x2 &2525 38 SEC &2526 e9 0a SBC #&0a &2528 85 42 STA &42 ; wire_x1 &252a bd 43 04 LDA &0443,X ; long_barbed_wires_y &252d 38 SEC &252e e9 08 SBC #&08 &2530 c5 11 CMP &11 ; player_y # Is the player touching it? &2532 d0 0f BNE &2543 ; consider_short_barbed_wire &2534 a5 10 LDA &10 ; player_x &2536 c5 42 CMP &42 ; wire_x1 &2538 30 09 BMI &2543 ; consider_short_barbed_wire &253a e9 06 SBC #&06 &253c c5 41 CMP &41 ; wire_x2 &253e 10 03 BPL &2543 ; consider_short_barbed_wire &2540 e6 08 INC &08 ; player_touched_something_deadly # If so, kill the player &2542 60 RTS ; consider_short_barbed_wire &2543 bd 46 04 LDA &0446,X ; short_barbed_wires_x &2546 f0 23 BEQ &256b ; consider_next_pair_of_wires # Is there a short barbed wire in this slot? &2548 18 CLC &2549 69 02 ADC #&02 &254b 85 41 STA &41 ; wire_x2 &254d 38 SEC &254e e9 06 SBC #&06 &2550 85 42 STA &42 ; wire_x1 &2552 bd 49 04 LDA &0449,X ; short_barbed_wires_y &2555 38 SEC &2556 e9 07 SBC #&07 &2558 c5 11 CMP &11 ; player_y # Is the player touching it? &255a d0 0f BNE &256b ; consider_next_pair_of_wires &255c a5 10 LDA &10 ; player_x &255e c5 42 CMP &42 ; wire_x1 &2560 30 09 BMI &256b ; consider_next_pair_of_wires &2562 e9 06 SBC #&06 &2564 c5 41 CMP &41 ; wire_x2 &2566 10 03 BPL &256b ; consider_next_pair_of_wires &2568 e6 08 INC &08 ; player_touched_something_deadly # If so, kill the player &256a 60 RTS ; consider_next_pair_of_wires &256b a6 80 LDX &80 ; wire_to_check &256d ca DEX &256e 86 80 STX &80 ; wire_to_check &2570 30 03 BMI &2575 ; leave &2572 4c 1b 25 JMP &251b ; check_for_touching_barbed_wire_loop ; leave &2575 60 RTS ; check_for_touching_owl &2576 ad 7c 04 LDA &047c ; owl_x # Is the player touching the owl? &2579 18 CLC &257a 69 04 ADC #&04 &257c 85 41 STA &41 ; owl_x2 &257e 38 SEC &257f e9 10 SBC #&10 &2581 85 42 STA &42 ; owl_x1 &2583 ad 7d 04 LDA &047d ; owl_y &2586 38 SEC &2587 e9 09 SBC #&09 &2589 85 43 STA &43 ; owl_y2 &258b e9 0a SBC #&0a &258d 85 44 STA &44 ; &258f a5 10 LDA &10 ; player_x &2591 c5 42 CMP &42 ; owl_x1 &2593 30 14 BMI &25a9 ; leave &2595 38 SEC &2596 e9 06 SBC #&06 &2598 c5 41 CMP &41 ; owl_x2 &259a 10 0d BPL &25a9 ; leave &259c 38 SEC &259d a5 11 LDA &11 ; player_y &259f e9 0c SBC #&0c &25a1 c5 44 CMP &44 ; owl_y1 &25a3 30 04 BMI &25a9 ; leave &25a5 c5 43 CMP &43 ; owl_y2 &25a7 30 01 BMI &25aa ; check_horseshoes_collected ; leave &25a9 60 RTS ; check_horseshoes_collected &25aa a0 00 LDY #&00 # If so, has the player collected all the horseshoes? &25ac a2 05 LDX #&05 ; check_horseshoes_collected_loop &25ae bd 58 04 LDA &0458,X ; horseshoes_x &25b1 f0 01 BEQ &25b4 ; horseshoe_has_been_collected # Zero if horseshoe has been collected &25b3 c8 INY ; horseshoe_has_been_collected &25b4 ca DEX &25b5 10 f7 BPL &25ae ; check_horseshoes_collected_loop &25b7 98 TYA &25b8 f0 03 BEQ &25bd ; cave_completed &25ba e6 08 INC &08 ; player_touched_something_deadly # If not, kill the player &25bc 60 RTS ; cave_completed # Otherwise, the cave is completed &25bd a9 00 LDA #&00 # Disable interval timer events &25bf 8d c4 02 STA &02c4 ; os_event_enable_flags + 5 &25c2 68 PLA # Leave play_cave on next return &25c3 68 PLA # (pop check_for_touching_owl) &25c4 a0 01 LDY #&01 # Gain a life for completing cave &25c6 20 22 2c JSR &2c22 ; gain_or_lose_a_life_after_fixing_time &25c9 ad 62 02 LDA &0262 ; os_sound_suppression &25cc d0 03 BNE &25d1 ; increase_score_for_remaining_time &25ce 20 40 21 JSR &2140 ; play_completion_tune ; increase_score_for_remaining_time &25d1 a9 07 LDA #&07 ; Generate a sound (SOUND) &25d3 a2 b8 LDX #&b8 &25d5 a0 08 LDY #&08 ; &08b8 = sound_7 # Play sound for time bonus &25d7 20 f1 ff JSR &fff1 ; OSWORD &25da a9 13 LDA #&13 ; Wait for Vertical Retrace &25dc 20 f4 ff JSR &fff4 ; OSBYTE &25df 20 95 28 JSR &2895 ; event_handler &25e2 20 c5 28 JSR &28c5 ; plot_time &25e5 a9 13 LDA #&13 ; Wait for Vertical Retrace &25e7 20 f4 ff JSR &fff4 ; OSBYTE &25ea a5 2a LDA &2a ; round_time_type # Zero if longer time limit &25ec d0 07 BNE &25f5 ; shorter_time_limit &25ee a2 55 LDX #&55 # If longer time limit, &25f0 a0 00 LDY #&00 ; 55 # Score 55 points for each remaining second &25f2 4c f9 25 JMP &25f9 ; add_points_for_second ; shorter_time_limit &25f5 a2 25 LDX #&25 # If shorter time limit, &25f7 a0 26 LDY #&26 ; 2625 # Score 2625 points for each remaining second ; add_points_for_second &25f9 20 15 28 JSR &2815 ; increase_score &25fc a5 32 LDA &32 ; time + 2 &25fe d0 d1 BNE &25d1 ; increase_score_for_remaining_time &2600 a5 33 LDA &33 ; time + 3 &2602 d0 cd BNE &25d1 ; increase_score_for_remaining_time &2604 a9 15 LDA #&15 ; Flush buffer &2606 a2 04 LDX #&04 ; Sound channel 0 &2608 20 f4 ff JSR &fff4 ; OSBYTE &260b a9 16 LDA #&16 &260d 4c 76 37 JMP &3776 ; delay # Leaves play_cave with Y = 1 on exit ; check_for_touching_trampoline &2610 a2 05 LDX #&05 &2612 86 80 STX &80 ; trampoline_to_check &2614 a5 8c LDA &8c ; umbrella_state &2616 d0 63 BNE &267b ; leave_with_not_bouncing # Can't bounce on a trampoline if umbrella is up &2618 a5 87 LDA &87 ; player_vertical_velocity &261a c9 fd CMP #&fd # or if playing isn't jumping &261c 10 5d BPL &267b ; leave_with_not_bouncing ; check_for_touching_trampoline_loop # For each trampoline, &261e bd 64 04 LDA &0464,X ; trampolines_x &2621 f0 51 BEQ &2674 ; consider_next_trampoline # is there a trampoline in this slot? &2623 85 47 STA &47 ; trampoline_x &2625 38 SEC &2626 e9 02 SBC #&02 &2628 85 41 STA &41 ; trampoline_x5 &262a e9 06 SBC #&06 &262c 85 42 STA &42 ; trampoline_x4 &262e e9 02 SBC #&02 &2630 85 43 STA &43 ; trampoline_x3 &2632 e9 02 SBC #&02 &2634 85 44 STA &44 ; trampoline_x2 &2636 e9 04 SBC #&04 &2638 85 45 STA &45 ; trampoline_x1 &263a bd 6a 04 LDA &046a,X ; trampolines_y &263d 38 SEC &263e e9 03 SBC #&03 &2640 85 46 STA &46 ; trampoline_y &2642 e9 04 SBC #&04 &2644 c5 11 CMP &11 ; player_y &2646 d0 2c BNE &2674 ; consider_next_trampoline &2648 a5 10 LDA &10 ; player_x &264a c5 41 CMP &41 ; trampoline_x5 &264c 10 26 BPL &2674 ; consider_next_trampoline &264e c5 45 CMP &45 ; trampoline_x1 &2650 30 22 BMI &2674 ; consider_next_trampoline &2652 a0 00 LDY #&00 # Zero to indicate not touching anything deadly &2654 84 08 STY &08 ; player_touched_something_deadly &2656 a0 02 LDY #&02 &2658 84 2c STY &2c ; trampoline_position &265a c5 42 CMP &42 ; trampoline_x4 &265c f0 13 BEQ &2671 ; to_touching_trampoline &265e a0 01 LDY #&01 &2660 84 2c STY &2c ; trampoline_position &2662 c5 43 CMP &43 ; trampoline_x3 &2664 f0 0b BEQ &2671 ; to_touching_trampoline &2666 a0 00 LDY #&00 &2668 84 2c STY &2c ; trampoline_position &266a c5 44 CMP &44 ; trampoline_x2 &266c f0 03 BEQ &2671 ; to_touching_trampoline &266e 4c 7b 26 JMP &267b ; leave_with_not_bouncing ; to_touching_trampoline &2671 4c 7e 26 JMP &267e ; touching_trampoline ; consider_next_trampoline &2674 a6 80 LDX &80 ; trampoline_to_check &2676 ca DEX &2677 86 80 STX &80 ; trampoline_to_check &2679 10 a3 BPL &261e ; check_for_touching_trampoline_loop ; leave_with_not_bouncing &267b a9 01 LDA #&01 # Leave with A positive to indicate player not bouncing &267d 60 RTS ; touching_trampoline &267e a9 07 LDA #&07 ; Generate a sound (SOUND) &2680 a2 b0 LDX #&b0 &2682 a0 08 LDY #&08 ; &08b0 = sound_6 # Play sound for trampoline bottom bounce &2684 20 f1 ff JSR &fff1 ; OSWORD &2687 a9 81 LDA #&81 ; Scan for a particular key &2689 a2 b6 LDX #&b6 ; RETURN &268b a8 TAY &268c 20 f4 ff JSR &fff4 ; OSBYTE &268f a9 00 LDA #&00 &2691 85 8f STA &8f ; player_horizontal_velocity &2693 38 SEC &2694 e5 87 SBC &87 ; player_vertical_velocity &2696 e0 00 CPX #&00 &2698 30 03 BMI &269d ; return_pressed &269a 38 SEC &269b e9 02 SBC #&02 # Decrease bottom velocity by 1 if RETURN not pressed ; return_pressed # Increase bottom velocity by 1 if RETURN pressed &269d c9 0a CMP #&0a &269f 30 02 BMI &26a3 ; skip_ceiling &26a1 a9 09 LDA #&09 # Limit maximum upwards velocity to 9 pixels per frame ; skip_ceiling &26a3 85 87 STA &87 ; player_vertical_velocity &26a5 20 aa 27 JSR &27aa ; trampoline_delay &26a8 20 38 27 JSR &2738 ; plot_trampoline_one # Plot trampoline stretched to stage one &26ab e6 11 INC &11 ; player_y &26ad 20 cd 36 JSR &36cd ; plot_player &26b0 20 90 27 JSR &2790 ; unplot_player_on_trampoline &26b3 20 aa 27 JSR &27aa ; trampoline_delay &26b6 a5 87 LDA &87 ; player_vertical_velocity &26b8 c9 05 CMP #&05 # If vertical velocity >= 5, &26ba 30 38 BMI &26f4 ; restore_trampoline_from_stretch_one &26bc 20 56 27 JSR &2756 ; plot_trampoline_two # Plot trampoline stretched to stage two &26bf e6 11 INC &11 ; player_y &26c1 20 cd 36 JSR &36cd ; plot_player &26c4 20 90 27 JSR &2790 ; unplot_player_on_trampoline &26c7 20 aa 27 JSR &27aa ; trampoline_delay &26ca a5 87 LDA &87 ; player_vertical_velocity &26cc c9 07 CMP #&07 # If vertical velocity >= 7, &26ce 30 19 BMI &26e9 ; restore_trampoline_from_stretch_two &26d0 20 73 27 JSR &2773 ; plot_trampoline_three # Plot trampoline stretched to stage three &26d3 e6 11 INC &11 ; player_y &26d5 20 cd 36 JSR &36cd ; plot_player &26d8 20 90 27 JSR &2790 ; unplot_player_on_trampoline &26db 20 aa 27 JSR &27aa ; trampoline_delay &26de 20 56 27 JSR &2756 ; plot_trampoline_two # Plot trampoline stretched to stage two &26e1 c6 11 DEC &11 ; player_y &26e3 20 cd 36 JSR &36cd ; plot_player &26e6 20 aa 27 JSR &27aa ; trampoline_delay ; restore_trampoline_from_stretch_two &26e9 20 38 27 JSR &2738 ; plot_trampoline_one &26ec c6 11 DEC &11 ; player_y &26ee 20 cd 36 JSR &36cd ; plot_player &26f1 20 aa 27 JSR &27aa ; trampoline_delay ; restore_trampoline_from_stretch_one &26f4 20 aa 27 JSR &27aa ; trampoline_delay &26f7 c6 11 DEC &11 ; player_y &26f9 20 cd 36 JSR &36cd ; plot_player &26fc a5 47 LDA &47 ; trampoline_x &26fe 85 12 STA &12 ; sprite_x &2700 a6 46 LDX &46 ; trampoline_y &2702 ca DEX &2703 ca DEX &2704 86 13 STX &13 ; sprite_y &2706 a9 0e LDA #&0e &2708 85 14 STA &14 ; sprite_width &270a a9 02 LDA #&02 &270c 85 15 STA &15 ; sprite_height &270e a2 09 LDX #&09 &2710 a0 2e LDY #&2e ; &2e09 = trampoline_sprite - 1 + &46 &2712 20 b6 40 JSR &40b6 ; plot_sprite # Plot unstretched trampoline &2715 20 83 21 JSR &2183 ; check_if_left_pressed &2718 10 07 BPL &2721 ; left_not_pressed &271a a2 fe LDX #&fe # Move two pixels left &271c a0 00 LDY #&00 ; FACING_LEFT &271e 4c 31 27 JMP &2731 ; leave_after_setting_player_jumped_off_special ; left_not_pressed &2721 20 8e 21 JSR &218e ; check_if_right_pressed &2724 10 07 BPL &272d ; right_not_pressed &2726 a2 02 LDX #&02 # Move two pixels right &2728 a0 01 LDY #&01 ; FACING_RIGHT &272a 4c 31 27 JMP &2731 ; leave_after_setting_player_jumped_off_special ; right_not_pressed &272d a2 00 LDX #&00 &272f a4 8e LDY &8e ; player_facing ; leave_after_setting_player_jumped_off_special &2731 a9 01 LDA #&01 # Set to non-zero to use specified vertical velocity &2733 85 2d STA &2d ; player_jumped_off_special &2735 a9 ff LDA #&ff # Leave with A negative to indicate player bouncing &2737 60 RTS ; plot_trampoline_one &2738 a5 47 LDA &47 ; trampoline_x &273a 85 12 STA &12 ; sprite_x &273c a6 46 LDX &46 ; trampoline_y &273e ca DEX &273f 86 13 STX &13 ; sprite_y &2741 a9 0e LDA #&0e &2743 85 14 STA &14 ; sprite_width &2745 a9 03 LDA #&03 &2747 85 15 STA &15 ; sprite_height &2749 a6 2c LDX &2c ; trampoline_position &274b bd b5 2d LDA &2db5,X ; trampoline_one_sprite_addresses_high_table &274e a8 TAY &274f bd b2 2d LDA &2db2,X ; trampoline_one_sprite_addresses_low_table &2752 aa TAX &2753 4c b6 40 JMP &40b6 ; plot_sprite ; plot_trampoline_two &2756 a5 47 LDA &47 ; trampoline_x &2758 85 12 STA &12 ; sprite_x &275a a5 46 LDA &46 ; trampoline_y &275c 85 13 STA &13 ; sprite_y &275e a9 0e LDA #&0e &2760 85 14 STA &14 ; sprite_width &2762 a9 04 LDA #&04 &2764 85 15 STA &15 ; sprite_height &2766 a6 2c LDX &2c ; trampoline_position &2768 bd bb 2d LDA &2dbb,X ; trampoline_two_sprite_addresses_high_table &276b a8 TAY &276c bd b8 2d LDA &2db8,X ; trampoline_two_sprite_addresses_low_table &276f aa TAX &2770 4c b6 40 JMP &40b6 ; plot_sprite ; plot_trampoline_three &2773 a5 47 LDA &47 ; trampoline_x &2775 85 12 STA &12 ; sprite_x &2777 a5 46 LDA &46 ; trampoline_y &2779 85 13 STA &13 ; sprite_y &277b a9 0e LDA #&0e &277d 85 14 STA &14 ; sprite_width &277f a9 04 LDA #&04 &2781 85 15 STA &15 ; sprite_height &2783 a6 2c LDX &2c ; trampoline_position &2785 bd c1 2d LDA &2dc1,X ; trampoline_three_sprite_addresses_high_table &2788 a8 TAY &2789 bd be 2d LDA &2dbe,X ; trampoline_three_sprite_addresses_low_table &278c aa TAX &278d 4c b6 40 JMP &40b6 ; plot_sprite ; unplot_player_on_trampoline &2790 a5 10 LDA &10 ; player_x &2792 85 12 STA &12 ; sprite_x &2794 38 SEC &2795 a5 11 LDA &11 ; player_y &2797 e9 19 SBC #&19 &2799 85 13 STA &13 ; sprite_y &279b a9 04 LDA #&04 &279d 85 14 STA &14 ; sprite_width &279f a9 01 LDA #&01 &27a1 85 15 STA &15 ; sprite_height &27a3 a2 de LDX #&de &27a5 a0 3e LDY #&3e ; &3ede = empty_sprite - 1 &27a7 4c b6 40 JMP &40b6 ; plot_sprite ; trampoline_delay &27aa a2 12 LDX #&12 ; trampoline_delay_outer_loop &27ac a0 ff LDY #&ff ; trampoline_delay_inner_loop &27ae ea NOP &27af 88 DEY &27b0 d0 fc BNE &27ae ; trampoline_delay_inner_loop &27b2 ca DEX &27b3 d0 f7 BNE &27ac ; trampoline_delay_outer_loop &27b5 60 RTS ; plot_number &27b6 86 12 STX &12 ; sprite_x &27b8 84 13 STY &13 ; sprite_y &27ba 8d d1 27 STA &27d1 ; variable_to_plot_one &27bd 8d e6 27 STA &27e6 ; variable_to_plot_two &27c0 a9 00 LDA #&00 # Zero to skip leading zeros &27c2 85 7e STA &7e ; leading_zero &27c4 a9 03 LDA #&03 &27c6 85 7f STA &7f ; length &27c8 a9 02 LDA #&02 &27ca 85 14 STA &14 ; sprite_width &27cc a9 08 LDA #&08 &27ce 85 15 STA &15 ; sprite_height ; plot_number_loop &27d0 a5 34 LDA &34 ; player_lives # actually LDA variable_to_plot_one &27d2 29 f0 AND #&f0 &27d4 4a LSR A &27d5 4a LSR A &27d6 4a LSR A &27d7 4a LSR A &27d8 d0 04 BNE &27de ; plot_first_digit &27da a4 7e LDY &7e ; leading_zero &27dc f0 03 BEQ &27e1 ; skip_first_digit ; plot_first_digit &27de 20 05 28 JSR &2805 ; plot_digit ; skip_first_digit &27e1 e6 12 INC &12 ; sprite_x &27e3 e6 12 INC &12 ; sprite_x &27e5 a5 34 LDA &34 ; player_lives # actually LDA variable_to_plot_two &27e7 29 0f AND #&0f &27e9 d0 08 BNE &27f3 ; plot_second_digit &27eb a4 7f LDY &7f ; length &27ed f0 04 BEQ &27f3 ; plot_second_digit &27ef a4 7e LDY &7e ; leading_zero &27f1 f0 03 BEQ &27f6 ; skip_second_digit ; plot_first_digit &27f3 20 05 28 JSR &2805 ; plot_digit ; skip_second_digit &27f6 e6 12 INC &12 ; sprite_x &27f8 e6 12 INC &12 ; sprite_x &27fa ee d1 27 INC &27d1 ; variable_to_plot_one &27fd ee e6 27 INC &27e6 ; variable_to_plot_two &2800 c6 7f DEC &7f ; length &2802 10 cc BPL &27d0 ; plot_number_loop &2804 60 RTS ; plot_digit &2805 a8 TAY &2806 be 3e 44 LDX &443e,Y ; digit_sprite_addresses_low_table &2809 a0 44 LDY #&44 &280b 20 b6 40 JSR &40b6 ; plot_sprite &280e e6 12 INC &12 ; sprite_x &2810 e6 12 INC &12 ; sprite_x &2812 e6 7e INC &7e ; leading_zero # Non-zero to plot non-leading zeros &2814 60 RTS ; increase_score &2815 86 3d STX &3d ; increase_low &2817 84 3c STY &3c ; increase_high &2819 f8 SED &281a 18 CLC &281b a5 3b LDA &3b ; score + 3 &281d 65 3d ADC &3d ; increase_low &281f 85 3b STA &3b ; score + 3 &2821 a5 3a LDA &3a ; score + 2 &2823 65 3c ADC &3c ; increase_high &2825 85 3a STA &3a ; score + 2 &2827 08 PHP &2828 90 11 BCC &283b ; skip_extra_life &282a e6 0d INC &0d ; score_for_extra_life &282c a5 0d LDA &0d ; score_for_extra_life &282e c9 05 CMP #&05 &2830 d0 09 BNE &283b ; skip_extra_life &2832 a9 00 LDA #&00 &2834 85 0d STA &0d ; score_for_extra_life &2836 a0 01 LDY #&01 # Extra life every 5000 points &2838 20 52 28 JSR &2852 ; gain_or_lose_a_life ; skip_extra_life &283b 28 PLP &283c a5 39 LDA &39 ; score + 1 &283e 69 00 ADC #&00 &2840 85 39 STA &39 ; score + 1 &2842 a5 38 LDA &38 ; score &2844 69 00 ADC #&00 &2846 85 38 STA &38 ; score &2848 d8 CLD ; plot_score &2849 a6 23 LDX &23 ; score_x &284b a4 24 LDY &24 ; score_y &284d a9 38 LDA #&38 ; &38 = score &284f 4c b6 27 JMP &27b6 ; plot_number ; gain_or_lose_a_life &2852 f8 SED &2853 30 10 BMI &2865 ; lose_a_life ; gain_a_life &2855 18 CLC &2856 a5 37 LDA &37 ; player_lives + 3 &2858 69 01 ADC #&01 &285a 85 37 STA &37 ; player_lives + 3 &285c a5 36 LDA &36 ; player_lives + 2 &285e 69 00 ADC #&00 &2860 85 36 STA &36 ; player_lives + 2 &2862 4c 72 28 JMP &2872 ; replot_lives ; lose_a_life &2865 38 SEC &2866 a5 37 LDA &37 ; player_lives + 3 &2868 e9 01 SBC #&01 &286a 85 37 STA &37 ; player_lives + 3 &286c a5 36 LDA &36 ; player_lives + 2 &286e e9 00 SBC #&00 &2870 85 36 STA &36 ; player_lives + 2 ; replot_lives &2872 d8 CLD ; plot_lives &2873 18 CLC &2874 a5 22 LDA &22 ; lives_x &2876 69 12 ADC #&12 &2878 85 12 STA &12 ; sprite_x &287a a9 0a LDA #&0a &287c 85 13 STA &13 ; sprite_y &287e a2 07 LDX #&07 &2880 86 14 STX &14 ; sprite_width &2882 e8 INX &2883 86 15 STX &15 ; sprite_height &2885 a2 9d LDX #&9d &2887 a0 46 LDY #&46 ; &469d = box_middle_sprite - 1 + 6 &2889 20 b6 40 JSR &40b6 ; plot_sprite &288c a6 22 LDX &22 ; lives_x &288e a0 0a LDY #&0a &2890 a9 34 LDA #&34 ; &34 = player_lives &2892 4c b6 27 JMP &27b6 ; plot_number ; event_handler &2895 08 PHP &2896 48 PHA &2897 8a TXA &2898 48 PHA &2899 98 TYA &289a 48 PHA &289b a9 04 LDA #&04 ; Write interval timer &289d a8 TAY &289e a2 7e LDX #&7e ; &047e = one_second_timer_block # Every second, &28a0 20 f1 ff JSR &fff1 ; OSWORD &28a3 f8 SED &28a4 38 SEC &28a5 a5 33 LDA &33 ; time + 3 # reduce time by one &28a7 e9 01 SBC #&01 &28a9 85 33 STA &33 ; time + 3 &28ab a5 32 LDA &32 ; time + 2 &28ad e9 00 SBC #&00 &28af 85 32 STA &32 ; time + 2 &28b1 d8 CLD &28b2 d0 06 BNE &28ba ; not_out_of_time &28b4 a5 33 LDA &33 ; time + 3 &28b6 d0 02 BNE &28ba ; not_out_of_time &28b8 e6 49 INC &49 ; out_of_time # Set to non-zero to indicate out of time ; not_out_of_time &28ba a9 01 LDA #&01 &28bc 85 0f STA &0f ; time_changed &28be 68 PLA &28bf a8 TAY &28c0 68 PLA &28c1 aa TAX &28c2 68 PLA &28c3 28 PLP &28c4 60 RTS ; plot_time &28c5 a5 0f LDA &0f ; time_changed &28c7 f0 3c BEQ &2905 ; leave &28c9 c6 0f DEC &0f ; time_changed &28cb a5 32 LDA &32 ; time + 2 &28cd d0 2d BNE &28fc ; plot_time_number &28cf a5 33 LDA &33 ; time + 3 &28d1 c9 99 CMP #&99 # Is the time 999? &28d3 f0 07 BEQ &28dc ; is_000999 # Never happens, maybe intended to allow infinite time &28d5 c9 09 CMP #&09 &28d7 f0 03 BEQ &28dc ; is_000999 &28d9 4c fc 28 JMP &28fc ; plot_time_number ; is_000999 &28dc 18 CLC &28dd a5 25 LDA &25 ; time_x &28df 69 12 ADC #&12 &28e1 85 12 STA &12 ; sprite_x &28e3 a9 0a LDA #&0a &28e5 85 13 STA &13 ; sprite_y &28e7 a9 00 LDA #&00 &28e9 85 1b STA &1b ; sprite_plotting_mode # Zero to plot sprite, not wipe screen memory &28eb 85 1c STA &1c ; suppress_sprite_plotting # Zero to plot sprite, not just calculate address &28ed a9 06 LDA #&06 &28ef 85 14 STA &14 ; sprite_width &28f1 a9 08 LDA #&08 &28f3 85 15 STA &15 ; sprite_height &28f5 a2 9d LDX #&9d &28f7 a0 46 LDY #&46 ; &469d = box_middle_sprite - 1 + 6 &28f9 20 b6 40 JSR &40b6 ; plot_sprite # If so, plot empty box ; plot_time_number &28fc a6 25 LDX &25 ; time_x &28fe a0 0a LDY #&0a &2900 a9 30 LDA #&30 ; &30 = time &2902 4c b6 27 JMP &27b6 ; plot_number # otherwise plot number ; leave &2905 60 RTS ; get_sprite_position_from_cave_data &2906 a4 80 LDY &80 ; cave_data_offset &2908 c8 INY &2909 b1 06 LDA (&06),Y ; cave_data_address # Byte for x position &290b 85 12 STA &12 ; sprite_x &290d c8 INY &290e 84 80 STY &80 ; cave_data_offset &2910 b1 06 LDA (&06),Y ; cave_data_address # Byte for y position &2912 85 13 STA &13 ; sprite_y &2914 60 RTS ; initialise_cave_data_and_screen &2915 a2 3b LDX #&3b &2917 a9 00 LDA #&00 ; wipe_0440_to_047b_loop &2919 9d 40 04 STA &0440,X # Wipe positions of all objects &291c ca DEX &291d 10 fa BPL &2919 ; wipe_0440_to_047b_loop &291f a6 0a LDX &0a ; cave_number &2921 bd ff 03 LDA &03ff,X ; cave_data_addresses_low_table - 1 &2924 85 06 STA &06 ; cave_data_address_low &2926 bd 1a 04 LDA &041a,X ; cave_data_addresses_high_table - 1 &2929 85 07 STA &07 ; cave_data_address_high &292b a0 00 LDY #&00 &292d 84 80 STY &80 ; cave_data_offset &292f b1 06 LDA (&06),Y ; cave_data_address # Byte for screen size &2931 84 80 STY &80 ; cave_data_offset &2933 aa TAX &2934 ad 60 03 LDA &0360 ; os_colours_available # 0 if in MODE 7, 3 if in MODE 1 &2937 d0 05 BNE &293e ; in_mode_1 &2939 a0 ff LDY #&ff # Negative to change mode &293b 4c 40 29 JMP &2940 ; to_initialise_cave_screen ; in_mode_1 &293e a0 01 LDY #&01 # Positive to keep mode ; to_initialise_cave_screen &2940 20 33 3f JSR &3f33 ; initialise_cave_screen ; add_platform_4s &2943 a4 80 LDY &80 ; cave_data_offset &2945 c8 INY &2946 b1 06 LDA (&06),Y ; cave_data_address # Byte for number of platforms of length 4 &2948 84 80 STY &80 ; cave_data_offset &294a f0 18 BEQ &2964 ; add_platform_6s &294c 85 81 STA &81 ; count ; add_platform_4s_loop &294e 20 06 29 JSR &2906 ; get_sprite_position_from_cave_data # Each has two bytes for position &2951 a9 04 LDA #&04 &2953 85 14 STA &14 ; sprite_width &2955 a9 0c LDA #&0c &2957 85 15 STA &15 ; sprite_height &2959 a2 a3 LDX #&a3 &295b a0 37 LDY #&37 ; &37a3 = platform_4_sprite - 1 &295d 20 b6 40 JSR &40b6 ; plot_sprite # Plot platform of length 4 &2960 c6 81 DEC &81 ; count &2962 d0 ea BNE &294e ; add_platform_4s_loop ; add_platform_6s &2964 a4 80 LDY &80 ; cave_data_offset &2966 c8 INY &2967 84 80 STY &80 ; cave_data_offset &2969 b1 06 LDA (&06),Y ; cave_data_address # Byte for number of platforms of length 6 &296b f0 18 BEQ &2985 ; add_platform_8s &296d 85 81 STA &81 ; count ; add_platform_6s_loop &296f 20 06 29 JSR &2906 ; get_sprite_position_from_cave_data # Each has two bytes for position &2972 a9 06 LDA #&06 &2974 85 14 STA &14 ; sprite_width &2976 a9 13 LDA #&13 &2978 85 15 STA &15 ; sprite_height &297a a2 d3 LDX #&d3 &297c a0 37 LDY #&37 ; &37d3 = platform_6_sprite - 1 &297e 20 b6 40 JSR &40b6 ; plot_sprite # Plot platform of length 6 &2981 c6 81 DEC &81 ; count &2983 d0 ea BNE &296f ; add_platform_6s_loop ; add_platform_8s &2985 a4 80 LDY &80 ; cave_data_offset &2987 c8 INY &2988 b1 06 LDA (&06),Y ; cave_data_address # Byte for number of platforms of length 8 &298a 84 80 STY &80 ; cave_data_offset &298c f0 18 BEQ &29a6 ; add_platform_15s &298e 85 81 STA &81 ; count ; add_platform_8s_loop &2990 20 06 29 JSR &2906 ; get_sprite_position_from_cave_data # Each has two bytes for position &2993 a9 08 LDA #&08 &2995 85 14 STA &14 ; sprite_width &2997 a9 0b LDA #&0b &2999 85 15 STA &15 ; sprite_height &299b a2 45 LDX #&45 &299d a0 38 LDY #&38 ; &3845 = platform_8_sprite - 1 &299f 20 b6 40 JSR &40b6 ; plot_sprite # Plot platform of length 8 &29a2 c6 81 DEC &81 ; count &29a4 d0 ea BNE &2990 ; add_platform_8s_loop ; add_platform_15s &29a6 a4 80 LDY &80 ; cave_data_offset &29a8 c8 INY &29a9 b1 06 LDA (&06),Y ; cave_data_address # Byte for number of platforms of length 15 &29ab 84 80 STY &80 ; cave_data_offset &29ad f0 18 BEQ &29c7 ; add_walls &29af 85 81 STA &81 ; count ; add_platform_15s_loop &29b1 20 06 29 JSR &2906 ; get_sprite_position_from_cave_data # Each has two bytes for position &29b4 a9 0f LDA #&0f &29b6 85 14 STA &14 ; sprite_width &29b8 a9 0b LDA #&0b &29ba 85 15 STA &15 ; sprite_height &29bc a2 9d LDX #&9d &29be a0 38 LDY #&38 ; &389d = platform_15_sprite - 1 &29c0 20 b6 40 JSR &40b6 ; plot_sprite # Plot platform of length 15 &29c3 c6 81 DEC &81 ; count &29c5 d0 ea BNE &29b1 ; add_platform_15s_loop ; add_walls &29c7 a4 80 LDY &80 ; cave_data_offset &29c9 c8 INY &29ca b1 06 LDA (&06),Y ; cave_data_address # Byte for number of walls &29cc 84 80 STY &80 ; cave_data_offset &29ce f0 1c BEQ &29ec ; add_long_barbed_wires &29d0 85 81 STA &81 ; count ; add_walls_loop &29d2 20 06 29 JSR &2906 ; get_sprite_position_from_cave_data # Each has two bytes for position &29d5 c8 INY &29d6 b1 06 LDA (&06),Y ; cave_data_address # and two bytes for size &29d8 85 14 STA &14 ; sprite_width &29da c8 INY &29db b1 06 LDA (&06),Y ; cave_data_address &29dd 85 15 STA &15 ; sprite_height &29df 84 80 STY &80 ; cave_data_offset &29e1 a2 97 LDX #&97 &29e3 a0 47 LDY #&47 ; &4797 = wall_sprite - 1 &29e5 20 b6 40 JSR &40b6 ; plot_sprite # Plot wall &29e8 c6 81 DEC &81 ; count &29ea d0 e6 BNE &29d2 ; add_walls_loop ; add_long_barbed_wires &29ec a4 80 LDY &80 ; cave_data_offset &29ee c8 INY &29ef b1 06 LDA (&06),Y ; cave_data_address # Byte for number of long barbed wires &29f1 84 80 STY &80 ; cave_data_offset &29f3 f0 2c BEQ &2a21 ; add_short_barbed_wires &29f5 85 81 STA &81 ; count &29f7 aa TAX ; add_long_barbed_wires_loop &29f8 a4 80 LDY &80 ; cave_data_offset # Each has two bytes for position &29fa c8 INY &29fb b1 06 LDA (&06),Y ; cave_data_address &29fd 85 12 STA &12 ; sprite_x &29ff 9d 3f 04 STA &043f,X ; long_barbed_wires_x - 1 &2a02 c8 INY &2a03 84 80 STY &80 ; cave_data_offset &2a05 b1 06 LDA (&06),Y ; cave_data_address &2a07 85 13 STA &13 ; sprite_y &2a09 9d 42 04 STA &0442,X ; long_barbed_wires_y - 1 &2a0c a9 06 LDA #&06 &2a0e 85 14 STA &14 ; sprite_width &2a10 a9 08 LDA #&08 &2a12 85 15 STA &15 ; sprite_height &2a14 a2 6e LDX #&6e &2a16 a0 39 LDY #&39 ; &396e ; barbed_wire_6_sprite - 1 &2a18 20 b6 40 JSR &40b6 ; plot_sprite # Plot long barbed wire &2a1b c6 81 DEC &81 ; count &2a1d a4 81 LDY &81 ; count &2a1f d0 d7 BNE &29f8 ; add_long_barbed_wires_loop ; add_short_barbed_wires &2a21 a4 80 LDY &80 ; cave_data_offset &2a23 c8 INY &2a24 b1 06 LDA (&06),Y ; cave_data_address # Byte for number of short barbed wires &2a26 84 80 STY &80 ; cave_data_offset &2a28 f0 2c BEQ &2a56 ; add_tripos &2a2a 85 81 STA &81 ; count &2a2c aa TAX ; add_short_barbed_wires_loop &2a2d a4 80 LDY &80 ; cave_data_offset &2a2f c8 INY &2a30 b1 06 LDA (&06),Y ; cave_data_address # Each has two bytes for position &2a32 85 12 STA &12 ; sprite_x &2a34 9d 45 04 STA &0445,X ; short_barbed_wires_x - 1 &2a37 c8 INY &2a38 84 80 STY &80 ; cave_data_offset &2a3a b1 06 LDA (&06),Y ; cave_data_address &2a3c 85 13 STA &13 ; sprite_y &2a3e 9d 48 04 STA &0448,X ; short_barbed_wires_y - 1 &2a41 a9 04 LDA #&04 &2a43 85 14 STA &14 ; sprite_width &2a45 a9 07 LDA #&07 &2a47 85 15 STA &15 ; sprite_height &2a49 a2 52 LDX #&52 &2a4b a0 39 LDY #&39 ; &3952 = barbed_wire_short_sprite - 1 &2a4d 20 b6 40 JSR &40b6 ; plot_sprite # Plot short barbed wire &2a50 c6 81 DEC &81 ; count &2a52 a6 81 LDX &81 ; count &2a54 d0 d7 BNE &2a2d ; add_short_barbed_wires_loop ; add_tripods &2a56 a4 80 LDY &80 ; cave_data_offset &2a58 c8 INY &2a59 b1 06 LDA (&06),Y ; cave_data_address # Byte for number of tripods &2a5b 84 80 STY &80 ; cave_data_offset &2a5d f0 2e BEQ &2a8d ; add_petridishes &2a5f 85 81 STA &81 ; count &2a61 aa TAX ; add_tripods_loop &2a62 a4 80 LDY &80 ; cave_data_offset &2a64 c8 INY &2a65 b1 06 LDA (&06),Y ; cave_data_address # Each has two bytes for position &2a67 84 80 STY &80 ; cave_data_offset &2a69 85 12 STA &12 ; sprite_x &2a6b 9d 4b 04 STA &044b,X ; tripods_x - 1 &2a6e c8 INY &2a6f 84 80 STY &80 ; cave_data_offset &2a71 b1 06 LDA (&06),Y ; cave_data_address &2a73 85 13 STA &13 ; sprite_y &2a75 9d 4e 04 STA &044e,X ; tripods_y - 1 &2a78 a9 03 LDA #&03 &2a7a 85 14 STA &14 ; sprite_width &2a7c a9 14 LDA #&14 &2a7e 85 15 STA &15 ; sprite_height &2a80 a2 9e LDX #&9e &2a82 a0 39 LDY #&39 ; &399e = tripod_sprite - 1 &2a84 20 b6 40 JSR &40b6 ; plot_sprite # Plot tripod &2a87 c6 81 DEC &81 ; count &2a89 a4 81 LDY &81 ; count &2a8b d0 d5 BNE &2a62 ; add_tripods_loop ; add_petridishes &2a8d a4 80 LDY &80 ; cave_data_offset &2a8f c8 INY &2a90 b1 06 LDA (&06),Y ; cave_data_address # Byte for number of petri dishes &2a92 84 80 STY &80 ; cave_data_offset &2a94 f0 2c BEQ &2ac2 ; add_horseshoes &2a96 85 81 STA &81 ; count &2a98 aa TAX ; add_petridishes_loop &2a99 a4 80 LDY &80 ; cave_data_offset &2a9b c8 INY &2a9c b1 06 LDA (&06),Y ; cave_data_address # Each has two bytes for position &2a9e 85 12 STA &12 ; sprite_x &2aa0 9d 51 04 STA &0451,X ; petridishes_x - 1 &2aa3 c8 INY &2aa4 84 80 STY &80 ; cave_data_offset &2aa6 b1 06 LDA (&06),Y ; cave_data_address &2aa8 85 13 STA &13 ; sprite_y &2aaa 9d 54 04 STA &0454,X ; petridishes_y - 1 &2aad a9 03 LDA #&03 &2aaf 85 14 STA &14 ; sprite_width &2ab1 a9 06 LDA #&06 &2ab3 85 15 STA &15 ; sprite_height &2ab5 a2 da LDX #&da &2ab7 a0 39 LDY #&39 ; &39da = petridish_sprite - 1 &2ab9 20 b6 40 JSR &40b6 ; plot_sprite # Plot petri dish &2abc c6 81 DEC &81 ; count &2abe a6 81 LDX &81 ; count &2ac0 d0 d7 BNE &2a99 ; add_petridishes_loop ; add_horseshoes &2ac2 a4 80 LDY &80 ; cave_data_offset &2ac4 c8 INY &2ac5 b1 06 LDA (&06),Y ; cave_data_address # Byte for number of horseshoes &2ac7 84 80 STY &80 ; cave_data_offset &2ac9 f0 2c BEQ &2af7 ; add_trampolines &2acb 85 81 STA &81 ; count ; add_horseshoes_loop &2acd aa TAX &2ace a4 80 LDY &80 ; cave_data_offset &2ad0 c8 INY &2ad1 b1 06 LDA (&06),Y ; cave_data_address # Each has two bytes for position &2ad3 85 12 STA &12 ; sprite_x &2ad5 9d 57 04 STA &0457,X ; horseshoes_x - 1 &2ad8 c8 INY &2ad9 84 80 STY &80 ; cave_data_offset &2adb b1 06 LDA (&06),Y ; cave_data_address &2add 85 13 STA &13 ; sprite_y &2adf 9d 5d 04 STA &045d,X ; horseshoes_y - 1 &2ae2 a9 02 LDA #&02 &2ae4 85 14 STA &14 ; sprite_width &2ae6 a9 08 LDA #&08 &2ae8 85 15 STA &15 ; sprite_height &2aea a2 42 LDX #&42 &2aec a0 39 LDY #&39 ; &3942 = horseshoe_sprite -1 &2aee 20 b6 40 JSR &40b6 ; plot_sprite # Plot horseshoe &2af1 c6 81 DEC &81 ; count &2af3 a6 81 LDX &81 ; count &2af5 d0 d7 BNE &2ace ; add_horseshoes_loop ; add_trampolines &2af7 a4 80 LDY &80 ; cave_data_offset &2af9 c8 INY &2afa b1 06 LDA (&06),Y ; cave_data_address # Byte for number of trampolines &2afc 84 80 STY &80 ; cave_data_offset &2afe f0 2c BEQ &2b2c ; add_mantarays &2b00 85 81 STA &81 ; count &2b02 aa TAX ; add_trampolines_loop &2b03 a4 80 LDY &80 ; cave_data_offset &2b05 c8 INY &2b06 b1 06 LDA (&06),Y ; cave_data_address # Each has two bytes for position &2b08 85 12 STA &12 ; sprite_x &2b0a 9d 63 04 STA &0463,X ; trampolines_x - 1 &2b0d c8 INY &2b0e 84 80 STY &80 ; cave_data_offset &2b10 b1 06 LDA (&06),Y ; cave_data_address &2b12 85 13 STA &13 ; sprite_y &2b14 9d 69 04 STA &0469,X ; trampolines_y - 1 &2b17 a9 0e LDA #&0e &2b19 85 14 STA &14 ; sprite_width &2b1b a9 08 LDA #&08 &2b1d 85 15 STA &15 ; sprite_height &2b1f a2 c3 LDX #&c3 &2b21 a0 2d LDY #&2d ; &2dc3 = trampoline_sprite - 1 &2b23 20 b6 40 JSR &40b6 ; plot_sprite # Plot trampoline &2b26 c6 81 DEC &81 ; count &2b28 a6 81 LDX &81 ; count &2b2a d0 d7 BNE &2b03 ; add_trampolines_loop ; add_mantarays &2b2c a4 80 LDY &80 ; cave_data_offset &2b2e c8 INY &2b2f b1 06 LDA (&06),Y ; cave_data_address # Byte for number of manta rays &2b31 84 80 STY &80 ; cave_data_offset &2b33 f0 57 BEQ &2b8c ; add_tarantula &2b35 85 81 STA &81 ; count &2b37 aa TAX ; add_mantarays_loop &2b38 a4 80 LDY &80 ; cave_data_offset &2b3a c8 INY &2b3b b1 06 LDA (&06),Y ; cave_data_address # Each has two bytes for position &2b3d 85 12 STA &12 ; sprite_x &2b3f 9d 6f 04 STA &046f,X ; mantarays_x - 1 &2b42 c8 INY &2b43 84 80 STY &80 ; cave_data_offset &2b45 b1 06 LDA (&06),Y ; cave_data_address &2b47 85 13 STA &13 ; sprite_y &2b49 9d 74 04 STA &0474,X ; mantarays_y - 1 &2b4c a9 06 LDA #&06 &2b4e 85 14 STA &14 ; sprite_width &2b50 a9 0d LDA #&0d &2b52 85 15 STA &15 ; sprite_height &2b54 a2 63 LDX #&63 &2b56 a0 2d LDY #&2d ; &2d63 ; mantaray_body_sprite - 1 &2b58 20 b6 40 JSR &40b6 ; plot_sprite # Plot middle of manta ray &2b5b 18 CLC &2b5c a5 12 LDA &12 ; sprite_x &2b5e 69 08 ADC #&08 &2b60 85 12 STA &12 ; sprite_x &2b62 38 SEC &2b63 a5 13 LDA &13 ; sprite_y &2b65 e9 08 SBC #&08 &2b67 85 13 STA &13 ; sprite_y &2b69 a9 04 LDA #&04 &2b6b 85 14 STA &14 ; sprite_width &2b6d a9 0b LDA #&0b &2b6f 85 15 STA &15 ; sprite_height &2b71 a2 37 LDX #&37 &2b73 a0 2d LDY #&2d ; &2d37 = mantaray_right_wing_up_sprite - 1 &2b75 20 b6 40 JSR &40b6 ; plot_sprite # Plot right of manta ray &2b78 38 SEC &2b79 a5 12 LDA &12 ; sprite_x &2b7b e9 14 SBC #&14 &2b7d 85 12 STA &12 ; sprite_x &2b7f a2 0b LDX #&0b &2b81 a0 2d LDY #&2d ; &2d0b = mantaray_left_wing_up_sprite - 1 &2b83 20 b6 40 JSR &40b6 ; plot_sprite # Plot middle of manta ray &2b86 c6 81 DEC &81 ; count &2b88 a6 81 LDX &81 ; count &2b8a d0 ac BNE &2b38 ; add_mantarays_loop ; add_tarantula &2b8c a4 80 LDY &80 ; cave_data_offset &2b8e c8 INY &2b8f b1 06 LDA (&06),Y ; cave_data_address # Two bytes for position of tarantula, zero if none &2b91 8d 7a 04 STA &047a ; initial_tarantula_x &2b94 c8 INY &2b95 b1 06 LDA (&06),Y ; cave_data_address &2b97 8d 7b 04 STA &047b ; initial_tarantula_y ; add_owl &2b9a c8 INY &2b9b b1 06 LDA (&06),Y ; cave_data_address # Two bytes for position of owl &2b9d 85 12 STA &12 ; sprite_x &2b9f 8d 7c 04 STA &047c ; owl_x &2ba2 c8 INY &2ba3 b1 06 LDA (&06),Y ; cave_data_address &2ba5 84 80 STY &80 ; cave_data_offset &2ba7 85 13 STA &13 ; sprite_y &2ba9 8d 7d 04 STA &047d ; owl_y &2bac a9 06 LDA #&06 &2bae 85 14 STA &14 ; sprite_width &2bb0 a9 1b LDA #&1b &2bb2 85 15 STA &15 ; sprite_height &2bb4 a2 ec LDX #&ec &2bb6 a0 39 LDY #&39 ; &39ec = owl_sprite - 1 &2bb8 20 b6 40 JSR &40b6 ; plot_sprite # Plot owl ; set_time &2bbb a4 80 LDY &80 ; cave_data_offset &2bbd a5 2a LDA &2a ; round_time_type &2bbf f0 02 BEQ &2bc3 ; use_first_time &2bc1 c8 INY &2bc2 c8 INY ; use_first_time &2bc3 c8 INY &2bc4 b1 06 LDA (&06),Y ; cave_data_address # Two bytes for time, times two &2bc6 85 32 STA &32 ; time + 2 &2bc8 c8 INY &2bc9 b1 06 LDA (&06),Y ; cave_data_address &2bcb 85 33 STA &33 ; time + 3 &2bcd a5 2a LDA &2a ; round_time_type &2bcf d0 02 BNE &2bd3 ; use_first_position &2bd1 c8 INY &2bd2 c8 INY ; use_first_position &2bd3 c8 INY &2bd4 b1 06 LDA (&06),Y ; cave_data_address # Two bytes for player position &2bd6 85 10 STA &10 ; player_x &2bd8 c8 INY &2bd9 b1 06 LDA (&06),Y ; cave_data_address &2bdb 85 11 STA &11 ; player_y &2bdd c8 INY &2bde b1 06 LDA (&06),Y ; cave_data_address &2be0 85 8e STA &8e ; player_facing &2be2 c8 INY &2be3 84 80 STY &80 ; cave_data_offset ; set_colours &2be5 a2 03 LDX #&03 &2be7 86 81 STX &81 ; colour ; set_colours_loop &2be9 a5 2b LDA &2b ; round_colour_type &2beb d0 05 BNE &2bf2 ; use_dark_colours &2bed b1 06 LDA (&06),Y ; cave_data_address # Four bytes for screen colours &2bef 4c f5 2b JMP &2bf5 ; set_colour ; use_dark_colours &2bf2 bd 88 04 LDA &0488,X ; dark_colour_scheme ; set_colour &2bf5 8d 7b 42 STA &427b ; palette_block + 1 &2bf8 a6 81 LDX &81 ; colour &2bfa 8e 7a 42 STX &427a ; palette_block &2bfd a9 0c LDA #&0c ; Write palette &2bff a2 7a LDX #&7a &2c01 a0 42 LDY #&42 ; &427a = palette_block &2c03 20 f1 ff JSR &fff1 ; OSWORD &2c06 e6 80 INC &80 ; cave_data_offset &2c08 a4 80 LDY &80 ; cave_data_offset &2c0a c6 81 DEC &81 ; colour &2c0c a6 81 LDX &81 ; colour &2c0e 10 d9 BPL &2be9 ; set_colours_loop &2c10 a9 00 LDA #&00 &2c12 85 8f STA &8f ; player_horizontal_velocity &2c14 85 88 STA &88 ; player_is_unsupported &2c16 85 80 STA &80 ; umbrella_was_supporting &2c18 85 8a STA &8a ; fall_slowed_by_umbrella &2c1a 85 8b STA &8b ; feet_state &2c1c 85 8c STA &8c ; umbrella_state &2c1e 85 08 STA &08 ; player_touched_something_deadly &2c20 a8 TAY &2c21 60 RTS ; gain_or_lose_a_life_after_fixing_time &2c22 a5 33 LDA &33 ; time + 3 # Is the time left exactly zero? &2c24 d0 06 BNE &2c2c ; skip_increase &2c26 a5 32 LDA &32 ; time + 2 &2c28 d0 02 BNE &2c2c ; skip_increase &2c2a e6 33 INC &33 ; time + 3 # If so, allow one second for completion bonus ; skip_increase &2c2c 98 TYA &2c2d 4c 52 28 JMP &2852 ; gain_or_lose_a_life ; unused &2c30 40 40 40 40 40 40 40 40 40 40 40 40 ; mantaray_left_wing_down_sprite &2c3c 00 20 00 00 00 22 00 00 00 30 00 00 00 10 80 00 &2c4c 00 00 e0 00 00 00 70 00 00 00 30 c0 00 00 10 f0 &2c5c 00 00 00 f0 00 00 00 30 00 00 00 00 00 00 00 00 ; mantaray_right_wing_down_sprite # Uses 8 bytes of mantaray_left_wing_centre_sprite &2c6c 00 00 40 00 00 00 44 00 00 00 c0 00 00 10 80 00 &2c7c 00 70 00 00 00 e0 00 00 30 c0 00 00 f0 80 00 00 &2c8c f0 00 00 00 c0 00 00 00 ; mantaray_left_wing_centre_sprite # Uses 24 bytes of mantaray_right_wing_centre_sprite &2c94 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &2ca4 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &2cb4 00 00 00 30 00 00 f0 f0 10 f0 f0 f0 f4 00 00 00 ; mantaray_right_wing_centre_sprite &2cc4 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &2cd4 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &2ce4 c0 00 00 00 f0 f0 00 00 f0 f0 f0 80 00 00 00 f2 &2cf4 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &2d04 00 00 00 00 00 00 00 00 ; mantaray_left_wing_up_sprite &2d0c 00 00 00 10 00 00 00 70 00 00 00 f0 00 00 10 f0 &2d1c 00 00 30 80 00 00 60 00 00 00 c0 00 00 10 80 00 &2d2c 00 30 00 00 00 22 00 00 00 20 00 00 ; mantaray_right_wing_up_sprite &2d38 80 00 00 00 e0 00 00 00 f0 00 00 00 f0 80 00 00 &2d48 10 c0 00 00 00 60 00 00 00 30 00 00 00 10 80 00 &2d58 00 00 c0 00 00 00 44 00 00 00 40 00 ; mantaray_body_sprite &2d64 00 71 80 10 e8 00 00 f2 80 10 f4 00 10 f6 c0 30 &2d74 f6 80 30 fc f0 f0 f3 c0 31 fc e1 78 f3 c8 71 f8 &2d84 d2 b4 f1 e8 71 f8 e1 78 f1 e8 f1 fc f0 f0 f3 f8 &2d94 f0 fe f0 f0 f7 f0 f0 f0 f0 f0 f0 f0 f0 f1 78 e1 &2da4 f8 f0 12 f1 f8 f1 f8 84 01 78 f0 f0 e1 08 ; trampoline_one_sprite_addresses_low_table # Player's vertical velocity is < 5 &2db2 33 67 cd # Sprite chosen depends on player's horizontal position ; trampoline_one_sprite_addresses_high_table &2db5 2e 2f 2e ; trampoline_two_sprite_addresses_low_table # Player's vertical velocity is 5 or 6 &2db8 5d 91 f7 # Sprite chosen depends on player's horizontal position ; trampoline_two_sprite_addresses_high_table &2dbb 2e 2f 2e ; trampoline_three_sprite_addresses_low_table # Player's vertical velocity is >= 7 &2dbe 95 c9 2f # Sprite chosen depends on player's horizontal position ; trampoline_three_sprite_addresses_high_table &2dc1 2e 2f 2f ; trampoline_sprite &2dc4 e0 00 00 00 00 00 00 00 00 00 00 00 00 70 c0 00 &2dd4 00 00 00 00 00 00 00 00 00 00 00 30 c0 00 00 00 &2de4 00 00 00 00 00 00 00 00 00 30 c0 00 00 00 00 00 &2df4 00 00 00 00 00 00 00 30 c0 00 00 00 00 00 00 00 &2e04 00 00 00 00 00 30 e0 00 00 00 00 00 00 00 00 00 &2e14 00 00 00 70 f0 a0 ff ff f5 f5 f5 f5 f5 f5 ff ff &2e24 50 f0 f0 00 00 00 00 00 00 00 00 00 00 00 00 f0 ; trampoline_one_position_one_sprite &2e34 c0 00 00 00 00 00 00 00 00 00 00 00 00 30 e0 00 &2e44 00 00 f5 f5 f5 f5 00 00 00 00 00 70 f0 a0 ff ff &2e54 00 00 00 00 f5 f5 ff ff 50 f0 ; trampoline_two_position_one_sprite &2e5e c0 00 00 00 00 00 00 00 00 00 00 00 00 30 c0 00 &2e6e 00 00 f5 f5 f5 f5 00 00 00 00 00 30 e0 00 00 ff &2e7e 00 00 00 00 f5 f5 00 00 00 70 f0 a0 ff 00 00 00 &2e8e 00 00 00 00 ff ff 50 f0 ; trampoline_three_position_one_sprite &2e96 c0 00 00 00 f5 f5 f5 f5 00 00 00 00 00 30 c0 00 &2ea6 00 33 00 00 00 00 f5 80 00 00 00 30 e0 00 00 cc &2eb6 00 00 00 00 00 75 cc 00 00 70 f0 a0 ff 00 00 00 &2ec6 00 00 00 00 33 ff 50 f0 ; trampoline_one_position_three_sprite &2ece c0 00 00 00 00 00 00 00 00 00 00 00 00 30 e0 00 &2ede 00 00 00 00 f5 f5 f5 f5 00 00 00 70 f0 a0 ff ff &2eee f5 f5 00 00 00 00 ff ff 50 f0 ; trampoline_two_position_three_sprite &2ef8 c0 00 00 00 00 00 00 00 00 00 00 00 00 30 c0 00 &2f08 00 00 00 00 f5 f5 f5 f5 00 00 00 30 e0 00 00 00 &2f18 f5 f5 00 00 00 00 ff 00 00 70 f0 a0 ff ff 00 00 &2f28 00 00 00 00 00 ff 50 f0 ; trampoline_three_position_three_sprite &2f30 c0 00 00 00 00 00 f5 f5 f5 f5 00 00 00 30 c0 00 &2f40 00 00 11 f5 00 00 00 00 cc 00 00 30 e0 00 00 33 &2f50 e4 00 00 00 00 00 33 00 00 70 f0 a0 ff cc 00 00 &2f60 00 00 00 00 00 ff 50 f0 ; trampoline_one_position_two_sprite &2f68 c0 00 00 00 00 00 00 00 00 00 00 00 00 30 e0 00 &2f78 00 00 00 f5 f5 f5 f5 00 00 00 00 70 f0 a0 ff ff &2f88 f5 00 00 00 00 f5 ff ff 50 f0 ; trampoline_two_position_two_sprite &2f92 c0 00 00 00 00 00 00 00 00 00 00 00 00 30 c0 00 &2fa2 00 00 00 f5 f5 f5 f5 00 00 00 00 30 e0 00 00 00 &2fb2 f5 00 00 00 00 f5 00 00 00 70 f0 a0 ff ff 00 00 &2fc2 00 00 00 00 ff ff 50 f0 ; trampoline_three_position_two_sprite &2fca c0 00 00 00 00 f5 f5 f5 f5 00 00 00 00 30 c0 00 &2fda 00 00 f5 00 00 00 00 f5 00 00 00 30 e0 00 00 33 &2fea 00 00 00 00 00 00 cc 00 00 70 f0 a0 ff cc 00 00 &2ffa 00 00 00 00 33 ff 50 f0 ; play_walking_sound &3002 a9 15 LDA #&15 ; Flush buffer &3004 a2 07 LDX #&07 ; Sound channel 3 &3006 20 f4 ff JSR &fff4 ; OSBYTE &3009 8a TXA ; Generate a sound (SOUND) &300a a2 80 LDX #&80 &300c a0 08 LDY #&08 ; &0880 = sound_0 # Play sound for walking &300e 4c f1 ff JMP &fff1 ; OSWORD ; play_blocked_sound &3011 a9 15 LDA #&15 ; Flush buffer &3013 a2 07 LDX #&07 ; Sound channel 3 &3015 20 f4 ff JSR &fff4 ; OSBYTE &3018 8a TXA ; Generate a sound (SOUND) &3019 a2 88 LDX #&88 &301b a0 08 LDY #&08 ; &0888 = sound_1 # Play sound for blocked movement &301d 4c f1 ff JMP &fff1 ; OSWORD ; play_bouncing_sound &3020 a9 15 LDA #&15 ; Flush buffer &3022 a2 06 LDX #&06 ; Sound channel 2 &3024 20 f4 ff JSR &fff4 ; OSBYTE &3027 a9 07 LDA #&07 ; Generate a sound (SOUND) &3029 a2 90 LDX #&90 &302b a0 08 LDY #&08 ; &0890 = sound_2 # Play sound for bouncing off obstacle above &302d 4c f1 ff JMP &fff1 ; OSWORD ; move_right &3030 a9 01 LDA #&01 ; FACING_RIGHT &3032 85 8d STA &8d ; player_direction_for_falling &3034 a5 11 LDA &11 ; player_y &3036 85 13 STA &13 ; sprite_y &3038 a5 8e LDA &8e ; player_facing &303a d0 07 BNE &3043 ; already_facing_right &303c a5 8b LDA &8b ; feet_state # If the player is facing left, keep feet as they are &303e d0 3f BNE &307f ; make_feet_odd &3040 4c 47 30 JMP &3047 ; make_feet_even ; already_facing_right &3043 a5 8b LDA &8b ; feet_state # Otherwise, animate the player's feet &3045 f0 38 BEQ &307f ; make_feet_odd ; make_feet_even &3047 18 CLC &3048 a5 10 LDA &10 ; player_x &304a 69 02 ADC #&02 &304c 85 12 STA &12 ; sprite_x &304e a2 01 LDX #&01 # 4 pixels wide &3050 a0 19 LDY #&19 # 25 pixels high &3052 a5 8c LDA &8c ; umbrella_state &3054 f0 01 BEQ &3057 ; skip_umbrella &3056 c8 INY # or 26 if umbrella is up ; skip_umbrella &3057 20 f7 33 JSR &33f7 ; check_for_obstacle # Is there an obstacle to the right of the player? &305a a5 85 LDA &85 ; result &305c f0 03 BEQ &3061 ; no_obstacle &305e 4c 11 30 JMP &3011 ; play_blocked_sound # If so, can't move ; no_obstacle &3061 a5 8c LDA &8c ; umbrella_state &3063 f0 1a BEQ &307f ; make_feet_odd &3065 38 SEC &3066 a5 11 LDA &11 ; player_y &3068 e9 1a SBC #&1a &306a 85 13 STA &13 ; sprite_y &306c 18 CLC &306d a5 10 LDA &10 ; player_x &306f 69 06 ADC #&06 &3071 85 12 STA &12 ; sprite_x &3073 a2 01 LDX #&01 # 4 pixels wide &3075 a0 08 LDY #&08 # 8 pixels high &3077 20 f7 33 JSR &33f7 ; check_for_obstacle # Is there an obstacle to the right of the umbrella? &307a a5 85 LDA &85 ; result &307c f0 01 BEQ &307f ; make_feet_odd &307e 60 RTS # If so, can't move; no sound ; make_feet_odd &307f 20 02 30 JSR &3002 ; play_walking_sound &3082 a5 88 LDA &88 ; player_is_unsupported # Non-zero if nothing below player &3084 d0 21 BNE &30a7 ; check_umbrella_side &3086 a5 10 LDA &10 ; player_x &3088 85 12 STA &12 ; sprite_x &308a a4 11 LDY &11 ; player_y &308c c8 INY &308d 84 13 STY &13 ; sprite_y &308f a5 8b LDA &8b ; feet_state &3091 d0 04 BNE &3097 ; odd_feet &3093 c6 12 DEC &12 ; sprite_x &3095 c6 12 DEC &12 ; sprite_x ; odd_feet &3097 a2 02 LDX #&02 # 8 pixels wide &3099 a0 01 LDY #&01 # 1 pixel high &309b 20 f7 33 JSR &33f7 ; check_for_obstacle # Is there anything below the player's feet? &309e a5 85 LDA &85 ; result &30a0 d0 05 BNE &30a7 ; check_umbrella_side &30a2 a9 01 LDA #&01 # If not, &30a4 85 88 STA &88 ; player_is_unsupported # Set to non-zero to indicate player not supported &30a6 60 RTS # Can't move; no sound ; check_umbrella_side &30a7 a5 8c LDA &8c ; umbrella_state &30a9 f0 26 BEQ &30d1 ; move_right_or_flip &30ab a5 8e LDA &8e ; player_facing &30ad d0 22 BNE &30d1 ; move_right_or_flip # If the player is facing left and the umbrella is up? &30af 18 CLC &30b0 a5 10 LDA &10 ; player_x &30b2 69 06 ADC #&06 &30b4 85 12 STA &12 ; sprite_x &30b6 38 SEC &30b7 a5 11 LDA &11 ; player_y &30b9 e9 1a SBC #&1a &30bb 85 13 STA &13 ; sprite_y &30bd a5 8b LDA &8b ; feet_state &30bf f0 04 BEQ &30c5 ; even_feet &30c1 c6 12 DEC &12 ; sprite_x &30c3 c6 12 DEC &12 ; sprite_x ; even_feet &30c5 a2 02 LDX #&02 # 8 pixels wide &30c7 a0 08 LDY #&08 # 8 pixels high &30c9 20 f7 33 JSR &33f7 ; check_for_obstacle # Is there an obstacle to the right of the umbrella? &30cc a5 85 LDA &85 ; result &30ce f0 01 BEQ &30d1 ; move_right_or_flip &30d0 60 RTS # If so, can't move; no sound ; move_right_or_flip &30d1 a5 8e LDA &8e ; player_facing # Is the player already facing right? &30d3 d0 06 BNE &30db ; player_was_already_facing_right &30d5 20 01 37 JSR &3701 ; unplot_player_after_delay # If not, flip but don't move &30d8 4c 26 31 JMP &3126 ; plot_player_right ; player_was_already_facing_right &30db a9 02 LDA #&02 &30dd 20 76 37 JSR &3776 ; delay &30e0 a5 11 LDA &11 ; player_y &30e2 85 13 STA &13 ; sprite_y &30e4 38 SEC &30e5 a5 10 LDA &10 ; player_x &30e7 e9 06 SBC #&06 &30e9 85 12 STA &12 ; sprite_x &30eb a9 01 LDA #&01 &30ed 85 14 STA &14 ; sprite_width &30ef a9 19 LDA #&19 &30f1 85 15 STA &15 ; sprite_height &30f3 a6 8c LDX &8c ; umbrella_state &30f5 f0 28 BEQ &311f ; skip_umbrella &30f7 18 CLC &30f8 69 09 ADC #&09 &30fa 85 15 STA &15 ; sprite_height ; unused_loop &30fc a2 de LDX #&de &30fe a0 3e LDY #&3e ; &3ede = empty_sprite - 1 &3100 20 b6 40 JSR &40b6 ; plot_sprite # Remove previous left side of umbrella &3103 a5 11 LDA &11 ; player_y &3105 85 13 STA &13 ; sprite_y &3107 38 SEC &3108 a5 10 LDA &10 ; player_x &310a e9 06 SBC #&06 &310c 85 12 STA &12 ; sprite_x &310e a9 01 LDA #&01 &3110 85 14 STA &14 ; sprite_width &3112 a9 19 LDA #&19 &3114 85 15 STA &15 ; sprite_height &3116 a6 8c LDX &8c ; umbrella_state # Unnecessary code, umbrella_state is always zero here &3118 f0 e2 BEQ &30fc ; unused_loop # would cause infinite loop if branch taken &311a 18 CLC &311b 69 09 ADC #&09 &311d 85 15 STA &15 ; sprite_height ; skip_umbrella &311f a2 de LDX #&de &3121 a0 3e LDY #&3e ; &3ede = empty_sprite - 1 &3123 20 b6 40 JSR &40b6 ; plot_sprite # Remove previous left side of player ; plot_player_right &3126 a9 04 LDA #&04 &3128 85 14 STA &14 ; sprite_width &312a a9 19 LDA #&19 &312c 85 15 STA &15 ; sprite_height &312e a5 10 LDA &10 ; player_x &3130 85 12 STA &12 ; sprite_x &3132 a5 11 LDA &11 ; player_y &3134 85 13 STA &13 ; sprite_y &3136 a5 8e LDA &8e ; player_facing &3138 f0 06 BEQ &3140 ; skip_changing_feet &313a a5 8b LDA &8b ; feet_state &313c 49 01 EOR #&01 # Animate feet if player didn't just turn &313e 85 8b STA &8b ; feet_state ; skip_changing_feet &3140 a9 01 LDA #&01 &3142 85 8e STA &8e ; player_facing &3144 a5 8b LDA &8b ; feet_state &3146 d0 3a BNE &3182 ; plot_player_right_odd &3148 18 CLC &3149 a5 10 LDA &10 ; player_x &314b 69 02 ADC #&02 &314d 85 10 STA &10 ; player_x &314f 85 12 STA &12 ; sprite_x ; plot_player_right_even &3151 a5 8c LDA &8c ; umbrella_state &3153 f0 26 BEQ &317b ; plot_player_right_umbrella_down_even ; plot_umbrella_up_right_even &3155 e6 15 INC &15 ; sprite_height &3157 a2 7e LDX #&7e &3159 a0 3c LDY #&3c ; &3c7e = player_right_umbrella_up_even_sprite - 1 &315b 20 b6 40 JSR &40b6 ; plot_sprite &315e 18 CLC &315f a5 10 LDA &10 ; player_x &3161 69 04 ADC #&04 &3163 85 12 STA &12 ; sprite_x &3165 38 SEC &3166 a5 11 LDA &11 ; player_y &3168 e9 1a SBC #&1a &316a 85 13 STA &13 ; sprite_y &316c a9 06 LDA #&06 &316e 85 14 STA &14 ; sprite_width &3170 a9 08 LDA #&08 &3172 85 15 STA &15 ; sprite_height &3174 a2 1e LDX #&1e &3176 a0 3e LDY #&3e ; &3e1e = umbrella_right_even_sprite - 1 &3178 4c b6 40 JMP &40b6 ; plot_sprite ; plot_player_right_umbrella_down_even &317b a2 ee LDX #&ee &317d a0 3a LDY #&3a ; &3aee = player_right_umbrella_down_even_sprite - 1 &317f 4c b6 40 JMP &40b6 ; plot_sprite ; plot_player_right_odd &3182 a5 8c LDA &8c ; umbrella_state &3184 f0 26 BEQ &31ac ; plot_player_right_umbrella_down_odd ; plot_umbrella_up_right_odd &3186 e6 15 INC &15 ; sprite_height &3188 a2 e6 LDX #&e6 &318a a0 3c LDY #&3c ; &3ce6 = player_right_umbrella_up_odd_sprite - 1 &318c 20 b6 40 JSR &40b6 ; plot_sprite &318f 18 CLC &3190 a5 10 LDA &10 ; player_x &3192 69 04 ADC #&04 &3194 85 12 STA &12 ; sprite_x &3196 38 SEC &3197 a5 11 LDA &11 ; player_y &3199 e9 1a SBC #&1a &319b 85 13 STA &13 ; sprite_y &319d a9 06 LDA #&06 &319f 85 14 STA &14 ; sprite_width &31a1 a9 08 LDA #&08 &31a3 85 15 STA &15 ; sprite_height &31a5 a2 4e LDX #&4e &31a7 a0 3e LDY #&3e ; &3e4e = umbrella_right_odd_sprite - 1 &31a9 4c b6 40 JMP &40b6 ; plot_sprite ; plot_player_right_umbrella_down_odd &31ac a2 52 LDX #&52 &31ae a0 3b LDY #&3b ; &3b52 = player_right_umbrella_down_odd_sprite - 1 &31b0 4c b6 40 JMP &40b6 ; plot_sprite ; move_left &31b3 a9 00 LDA #&00 ; FACING_LEFT &31b5 85 8d STA &8d ; player_direction_for_falling &31b7 a5 11 LDA &11 ; player_y &31b9 85 13 STA &13 ; sprite_y &31bb a5 8e LDA &8e ; player_facing &31bd f0 07 BEQ &31c6 ; already_facing_left &31bf a5 8b LDA &8b ; feet_state # If the player is facing right, keep feet as they are &31c1 d0 3f BNE &3202 ; make_feet_odd &31c3 4c ca 31 JMP &31ca ; make_feet_even ; already_facing_left &31c6 a5 8b LDA &8b ; feet_state # Otherwise, animate the player's feet &31c8 f0 38 BEQ &3202 ; make_feet_odd ; make_feet_even &31ca 38 SEC &31cb a5 10 LDA &10 ; player_x &31cd e9 08 SBC #&08 &31cf 85 12 STA &12 ; sprite_x &31d1 a2 01 LDX #&01 # 4 pixels wide &31d3 a0 19 LDY #&19 # 25 pixels high &31d5 a5 8c LDA &8c ; umbrella_state &31d7 f0 01 BEQ &31da ; skip_umbrella &31d9 c8 INY # or 26 if umbrella is up ; skip_umbrella &31da 20 f7 33 JSR &33f7 ; check_for_obstacle # Is there an obstacle to the left of the player? &31dd a5 85 LDA &85 ; result &31df f0 03 BEQ &31e4 ; no_obstacle &31e1 4c 11 30 JMP &3011 ; play_blocked_sound # If so, can't move &31e4 a5 8c LDA &8c ; umbrella_state &31e6 f0 1a BEQ &3202 ; make_feet_odd &31e8 38 SEC &31e9 a5 11 LDA &11 ; player_y &31eb e9 1a SBC #&1a &31ed 85 13 STA &13 ; sprite_y &31ef 38 SEC &31f0 a5 10 LDA &10 ; player_x &31f2 e9 0c SBC #&0c &31f4 85 12 STA &12 ; sprite_x &31f6 a2 01 LDX #&01 # 4 pixels wide &31f8 a0 08 LDY #&08 # 8 pixels high &31fa 20 f7 33 JSR &33f7 ; check_for_obstacle # Is there an obstacle to the right of the umbrella? &31fd a5 85 LDA &85 ; result &31ff f0 01 BEQ &3202 ; make_feet_odd &3201 60 RTS # If so, can't move; no sound ; make_feet_odd &3202 20 02 30 JSR &3002 ; play_walking_sound &3205 a5 88 LDA &88 ; player_is_unsupported # Non-zero if nothing below player &3207 d0 24 BNE &322d ; check_umbrella_side &3209 38 SEC &320a a5 10 LDA &10 ; player_x &320c e9 04 SBC #&04 &320e 85 12 STA &12 ; sprite_x &3210 a4 11 LDY &11 ; player_y &3212 c8 INY &3213 84 13 STY &13 ; sprite_y &3215 a5 8b LDA &8b ; feet_state &3217 d0 04 BNE &321d ; odd_feet &3219 e6 12 INC &12 ; sprite_x &321b e6 12 INC &12 ; sprite_x ; odd_feet &321d a2 02 LDX #&02 # 8 pixels wide &321f a0 01 LDY #&01 # 1 pixel high &3221 20 f7 33 JSR &33f7 ; check_for_obstacle # Is there anything below the player's feet? &3224 a5 85 LDA &85 ; result &3226 d0 05 BNE &322d ; check_umbrella_side &3228 a9 01 LDA #&01 # If not, &322a 85 88 STA &88 ; player_is_unsupported # Set to non-zero to indicate player not supported &322c 60 RTS # Can't move; no sound ; check_umbrella_side &322d a5 8c LDA &8c ; umbrella_state &322f f0 26 BEQ &3257 ; move_left_or_flip &3231 a5 8e LDA &8e ; player_facing &3233 f0 22 BEQ &3257 ; move_left_or_flip # If the player is facing right and the umbrella is up? &3235 38 SEC &3236 a5 10 LDA &10 ; player_x &3238 e9 0a SBC #&0a &323a 85 12 STA &12 ; sprite_x &323c 38 SEC &323d a5 11 LDA &11 ; player_y &323f e9 1a SBC #&1a &3241 85 13 STA &13 ; sprite_y &3243 a5 8b LDA &8b ; feet_state &3245 f0 04 BEQ &324b ; even_feet &3247 e6 12 INC &12 ; sprite_x &3249 e6 12 INC &12 ; sprite_x ; even_feet &324b a2 02 LDX #&02 # 8 pixels wide &324d a0 08 LDY #&08 # 8 pixels high &324f 20 f7 33 JSR &33f7 ; check_for_obstacle # Is there an obstacle to the right of the umbrella? &3252 a5 85 LDA &85 ; result &3254 f0 01 BEQ &3257 ; move_left_or_flip &3256 60 RTS ; move_left_or_flip &3257 a5 8e LDA &8e ; player_facing # Is the player already facing left? &3259 f0 06 BEQ &3261 ; player_was_already_facing_left &325b 20 01 37 JSR &3701 ; unplot_player_after_delay # If not, flip but don't move &325e 4c 86 32 JMP &3286 ; plot_player_left ; player_was_already_facing_left &3261 a9 02 LDA #&02 &3263 20 76 37 JSR &3776 ; delay &3266 a5 11 LDA &11 ; player_y &3268 85 13 STA &13 ; sprite_y &326a a5 10 LDA &10 ; player_x &326c 85 12 STA &12 ; sprite_x &326e a9 01 LDA #&01 &3270 85 14 STA &14 ; sprite_width &3272 a9 19 LDA #&19 &3274 85 15 STA &15 ; sprite_height &3276 a6 8c LDX &8c ; umbrella_state &3278 f0 05 BEQ &327f ; skip_umbrella &327a 18 CLC &327b 69 09 ADC #&09 &327d 85 15 STA &15 ; sprite_height ; skip_umbrella &327f a2 de LDX #&de &3281 a0 3e LDY #&3e ; &3ede = empty_sprite - 1 &3283 20 b6 40 JSR &40b6 ; plot_sprite # Remove previous right side of player and umbrella ; plot_player_left &3286 a5 10 LDA &10 ; player_x &3288 85 12 STA &12 ; sprite_x &328a a9 04 LDA #&04 &328c 85 14 STA &14 ; sprite_width &328e a9 19 LDA #&19 &3290 85 15 STA &15 ; sprite_height &3292 a5 11 LDA &11 ; player_y &3294 85 13 STA &13 ; sprite_y &3296 a5 8e LDA &8e ; player_facing &3298 d0 06 BNE &32a0 ; skip_changing_feet &329a a5 8b LDA &8b ; feet_state &329c 49 01 EOR #&01 # Animate feet if player didn't just turn &329e 85 8b STA &8b ; feet_state ; skip_changing_feet &32a0 a9 00 LDA #&00 &32a2 85 8e STA &8e ; player_facing &32a4 a5 8b LDA &8b ; feet_state &32a6 d0 33 BNE &32db ; plot_player_left_odd &32a8 38 SEC &32a9 a5 10 LDA &10 ; player_x &32ab e9 02 SBC #&02 &32ad 85 10 STA &10 ; player_x &32af 85 12 STA &12 ; sprite_x ; plot_player_left_even &32b1 a5 8c LDA &8c ; umbrella_state &32b3 f0 1f BEQ &32d4 ; plot_player_left_umbrella_down_even ; plot_umbrella_up_left_even &32b5 e6 15 INC &15 ; sprite_height &32b7 a2 4e LDX #&4e &32b9 a0 3d LDY #&3d ; &3d4e = player_left_umbrella_up_even_sprite - 1 &32bb 20 b6 40 JSR &40b6 ; plot_sprite &32be 38 SEC &32bf a5 11 LDA &11 ; player_y &32c1 e9 1a SBC #&1a &32c3 85 13 STA &13 ; sprite_y &32c5 a9 06 LDA #&06 &32c7 85 14 STA &14 ; sprite_width &32c9 a9 08 LDA #&08 &32cb 85 15 STA &15 ; sprite_height &32cd a2 7e LDX #&7e &32cf a0 3e LDY #&3e ; &3e7e = umbrella_left_even_sprite - 1 &32d1 4c b6 40 JMP &40b6 ; plot_sprite ; plot_player_left_umbrella_down_even &32d4 a2 b6 LDX #&b6 &32d6 a0 3b LDY #&3b ; &3bb6 = player_left_umbrella_down_even_sprite - 1 &32d8 4c b6 40 JMP &40b6 ; plot_sprite ; plot_player_left_odd &32db a5 8c LDA &8c ; umbrella_state &32dd f0 1f BEQ &32fe ; plot_player_left_umbrella_down_odd ; plot_umbrella_up_left_odd &32df e6 15 INC &15 ; sprite_height &32e1 a2 b6 LDX #&b6 &32e3 a0 3d LDY #&3d ; &3db6 = player_left_umbrella_up_odd_sprite - 1 &32e5 20 b6 40 JSR &40b6 ; plot_sprite &32e8 38 SEC &32e9 a5 11 LDA &11 ; player_y &32eb e9 1a SBC #&1a &32ed 85 13 STA &13 ; sprite_y &32ef a9 06 LDA #&06 &32f1 85 14 STA &14 ; sprite_width &32f3 a9 08 LDA #&08 &32f5 85 15 STA &15 ; sprite_height &32f7 a2 ae LDX #&ae &32f9 a0 3e LDY #&3e ; &3eae = umbrella_left_odd_sprite - 1 &32fb 4c b6 40 JMP &40b6 ; plot_sprite ; plot_player_left_umbrella_down_odd &32fe a2 1a LDX #&1a &3300 a0 3c LDY #&3c ; &3c1a = player_left_umbrella_down_odd_sprite - 1 &3302 4c b6 40 JMP &40b6 ; plot_sprite ; raise_umbrella &3305 38 SEC &3306 a5 11 LDA &11 ; player_y &3308 e9 1a SBC #&1a &330a 85 13 STA &13 ; sprite_y &330c a5 10 LDA &10 ; player_x &330e 85 12 STA &12 ; sprite_x &3310 a5 8e LDA &8e ; player_facing &3312 f0 07 BEQ &331b ; check_umbrella &3314 18 CLC &3315 a5 12 LDA &12 ; sprite_x &3317 69 04 ADC #&04 &3319 85 12 STA &12 ; sprite_x ; check_umbrella &331b a2 06 LDX #&06 # 24 pixels wide &331d a0 08 LDY #&08 # 8 pixels high &331f 20 f7 33 JSR &33f7 ; check_for_obstacle # Is there anything where the umbrella would go? &3322 a5 85 LDA &85 ; result &3324 f0 01 BEQ &3327 ; no_obstacle &3326 60 RTS # If so, keep umbrella down ; no_obstacle &3327 a9 01 LDA #&01 # Set to non-zero to indicate umbrella is up &3329 85 8c STA &8c ; umbrella_state &332b a9 13 LDA #&13 ; Wait for Vertical Retrace &332d 20 f4 ff JSR &fff4 ; OSBYTE &3330 a5 10 LDA &10 ; player_x &3332 85 12 STA &12 ; sprite_x &3334 a5 11 LDA &11 ; player_y &3336 85 13 STA &13 ; sprite_y &3338 a9 04 LDA #&04 &333a 85 14 STA &14 ; sprite_width &333c a9 19 LDA #&19 &333e 85 15 STA &15 ; sprite_height &3340 a5 8e LDA &8e ; player_facing # Plot umbrella &3342 d0 0a BNE &334e ; facing_right ; facing_left &3344 a5 8b LDA &8b ; feet_state &3346 d0 03 BNE &334b ; to_plot_umbrella_up_left_odd &3348 4c b5 32 JMP &32b5 ; plot_umbrella_up_left_even ; to_plot_umbrella_up_left_odd &334b 4c df 32 JMP &32df ; plot_umbrella_up_left_odd ; facing_right &334e a5 8b LDA &8b ; feet_state &3350 d0 03 BNE &3355 ; to_plot_umbrella_up_right_odd &3352 4c 55 31 JMP &3155 ; plot_umbrella_up_right_even ; to_plot_umbrella_up_right_odd &3355 4c 86 31 JMP &3186 ; plot_umbrella_up_right_odd ; lower_umbrella &3358 a9 00 LDA #&00 # Set to zero to indicate umbrella is down &335a 85 8c STA &8c ; umbrella_state &335c 85 80 STA &80 ; umbrella_was_supporting &335e 38 SEC &335f a5 10 LDA &10 ; player_x &3361 e9 02 SBC #&02 &3363 85 12 STA &12 ; sprite_x &3365 a4 11 LDY &11 ; player_y &3367 c8 INY &3368 84 13 STY &13 ; sprite_y &336a a2 02 LDX #&02 # 8 pixels wide &336c a0 01 LDY #&01 # 1 pixel high &336e 20 f7 33 JSR &33f7 ; check_for_obstacle # Was the umbrella supporting the player? &3371 a5 85 LDA &85 ; result &3373 d0 02 BNE &3377 ; not_supporting &3375 e6 80 INC &80 ; umbrella_was_supporting # Set to non-zero to make player fall afterwards ; not_supporting &3377 a9 13 LDA #&13 ; Wait for Vertical Retrace &3379 20 f4 ff JSR &fff4 ; OSBYTE &337c a9 08 LDA #&08 &337e 85 15 STA &15 ; sprite_height &3380 a9 06 LDA #&06 &3382 85 14 STA &14 ; sprite_width &3384 38 SEC &3385 a5 11 LDA &11 ; player_y &3387 e9 1a SBC #&1a &3389 85 13 STA &13 ; sprite_y &338b a5 10 LDA &10 ; player_x &338d 85 12 STA &12 ; sprite_x &338f a2 de LDX #&de &3391 a0 3e LDY #&3e ; &3ede = empty_sprite - 1 &3393 a5 8e LDA &8e ; player_facing &3395 f0 07 BEQ &339e ; unplot_umbrella &3397 18 CLC &3398 a5 12 LDA &12 ; sprite_x &339a 69 04 ADC #&04 &339c 85 12 STA &12 ; sprite_x ; unplot_umbrella &339e 20 b6 40 JSR &40b6 ; plot_sprite # Unplot raised umbrella &33a1 a5 10 LDA &10 ; player_x &33a3 85 12 STA &12 ; sprite_x &33a5 e6 13 INC &13 ; sprite_y &33a7 a9 04 LDA #&04 &33a9 85 14 STA &14 ; sprite_width &33ab a9 01 LDA #&01 &33ad 85 15 STA &15 ; sprite_height &33af a2 de LDX #&de &33b1 a0 3e LDY #&3e ; &3ede = empty_sprite - 1 &33b3 20 b6 40 JSR &40b6 ; plot_sprite &33b6 a5 80 LDA &80 ; umbrella_was_supporting # Was the umbrella supporting the player? &33b8 f0 05 BEQ &33bf ; plot_player_umbrella_down &33ba a9 01 LDA #&01 # If so, make the player fall &33bc 85 88 STA &88 ; player_is_unsupported &33be 60 RTS ; plot_player_umbrella_down &33bf a5 8e LDA &8e ; player_facing &33c1 d0 1a BNE &33dd ; plot_player_right_umbrella_down ; plot_player_left_umbrella_down &33c3 a9 04 LDA #&04 &33c5 85 14 STA &14 ; sprite_width &33c7 a9 19 LDA #&19 &33c9 85 15 STA &15 ; sprite_height &33cb a5 11 LDA &11 ; player_y &33cd 85 13 STA &13 ; sprite_y &33cf a5 8b LDA &8b ; feet_state &33d1 d0 07 BNE &33da ; to_plot_player_left_umbrella_down_odd &33d3 a5 10 LDA &10 ; player_x &33d5 85 12 STA &12 ; sprite_x &33d7 4c d4 32 JMP &32d4 ; plot_player_left_umbrella_down_even ; to_plot_player_left_umbrella_down_odd &33da 4c fe 32 JMP &32fe ; plot_player_left_umbrella_down_odd ; plot_player_right_umbrella_down &33dd a9 04 LDA #&04 &33df 85 14 STA &14 ; sprite_width &33e1 a9 19 LDA #&19 &33e3 85 15 STA &15 ; sprite_height &33e5 a5 10 LDA &10 ; player_x &33e7 85 12 STA &12 ; sprite_x &33e9 a5 11 LDA &11 ; player_y &33eb 85 13 STA &13 ; sprite_y &33ed a5 8b LDA &8b ; feet_state &33ef d0 03 BNE &33f4 ; to_plot_player_right_umbrella_down_odd &33f1 4c 7b 31 JMP &317b ; plot_player_right_umbrella_down_even ; to_plot_player_right_umbrella_down_odd &33f4 4c ac 31 JMP &31ac ; plot_player_right_umbrella_down_odd ; check_for_obstacle &33f7 86 83 STX &83 ; width &33f9 84 84 STY &84 ; height &33fb a9 00 LDA #&00 &33fd 85 85 STA &85 ; result ; check_for_obstacle_row_loop &33ff a9 01 LDA #&01 # Non-zero to calculate screen address only &3401 85 1c STA &1c ; suppress_sprite_plotting &3403 20 bc 40 JSR &40bc ; plot_sprite_from_previous_address &3406 a0 00 LDY #&00 &3408 a6 83 LDX &83 ; width ; check_for_obstacle_column_loop &340a b1 16 LDA (&16),Y ; row_address &340c f0 02 BEQ &3410 ; no_obstacle &340e e6 85 INC &85 ; result # Set to non-zero if screen memory in area isn't empty ; no_obstacle &3410 38 SEC &3411 a5 16 LDA &16 ; row_address_low &3413 e9 08 SBC #&08 # Move left four pixels &3415 85 16 STA &16 ; row_address_low &3417 b0 02 BCS &341b ; skip_page &3419 c6 17 DEC &17 ; row_address_high ; skip_page &341b ca DEX &341c d0 ec BNE &340a ; check_for_obstacle_column_loop &341e c6 13 DEC &13 ; sprite_y &3420 c6 84 DEC &84 ; height &3422 d0 db BNE &33ff ; check_for_obstacle_row_loop &3424 e6 13 INC &13 ; sprite_y &3426 60 RTS ; update_player_position &3427 38 SEC &3428 a5 11 LDA &11 ; player_y &342a a4 87 LDY &87 ; player_vertical_velocity &342c 10 02 BPL &3430 ; not_falling &342e e5 87 SBC &87 ; player_vertical_velocity ; not_falling &3430 85 13 STA &13 ; sprite_y &3432 a5 10 LDA &10 ; player_x &3434 85 12 STA &12 ; sprite_x &3436 a5 8f LDA &8f ; player_horizontal_velocity &3438 f0 23 BEQ &345d ; not_moving_horizontally &343a 10 12 BPL &344e ; moving_right ; moving_left &343c 38 SEC &343d a5 10 LDA &10 ; player_x &343f e9 08 SBC #&08 &3441 85 12 STA &12 ; sprite_x &3443 a5 8b LDA &8b ; feet_state &3445 d0 04 BNE &344b ; odd_feet_left &3447 e6 12 INC &12 ; sprite_x &3449 e6 12 INC &12 ; sprite_x ; odd_feet_left &344b 4c 5d 34 JMP &345d ; not_moving_horizontally ; moving_right &344e 18 CLC &344f a5 10 LDA &10 ; player_x &3451 69 02 ADC #&02 &3453 85 12 STA &12 ; sprite_x &3455 a5 8b LDA &8b ; feet_state &3457 d0 04 BNE &345d ; odd_feet_right &3459 e6 12 INC &12 ; sprite_x &345b e6 12 INC &12 ; sprite_x ; odd_feet_right ; not_moving_horizontally &345d a2 01 LDX #&01 # 4 pixels wide &345f a9 19 LDA #&19 # 25 pixels high &3461 a4 87 LDY &87 ; player_vertical_velocity &3463 f0 0b BEQ &3470 ; set_height_to_check &3465 30 06 BMI &346d ; is_falling ; is_jumping &3467 18 CLC &3468 65 87 ADC &87 ; player_vertical_velocity # plus vertical speed if jumping &346a 4c 70 34 JMP &3470 ; set_height_to_check ; is_falling &346d 38 SEC &346e e5 87 SBC &87 ; player_vertical_velocity # plus vertical speed if falling ; set_height_to_check &3470 a8 TAY &3471 20 f7 33 JSR &33f7 ; check_for_obstacle # Check for an obstacle in player's new position &3474 a5 8b LDA &8b ; feet_state &3476 f0 08 BEQ &3480 ; even_feet &3478 a5 85 LDA &85 ; result &347a f0 04 BEQ &3480 ; even_feet &347c a9 00 LDA #&00 # If there is, keep same horizontal position &347e 85 8f STA &8f ; player_horizontal_velocity ; even_feet &3480 20 fc 34 JSR &34fc ; check_vertical_movement # Returns Y = &ff if player hit obstacle below &3483 a5 85 LDA &85 ; result &3485 f0 06 BEQ &348d ; no_obstacle_below &3487 98 TYA &3488 10 03 BPL &348d ; no_obstacle_below &348a 4c d4 34 JMP &34d4 ; hit_obstacle_below ; no_obstacle_below &348d 20 01 37 JSR &3701 ; unplot_player_after_delay # Unplot player &3490 a5 89 LDA &89 ; player_hit_obstacle_above &3492 c9 02 CMP #&02 &3494 d0 09 BNE &349f ; skip_velocity_inversion # After the player has bounced off an obstacle above, &3496 38 SEC &3497 a9 00 LDA #&00 # Set to zero to continue moving afterwards &3499 85 89 STA &89 ; player_hit_obstacle_above &349b e5 87 SBC &87 ; player_vertical_velocity &349d 85 87 STA &87 ; player_vertical_velocity # set player moving in opposite direction vertically ; skip_velocity_inversion &349f a5 89 LDA &89 ; player_hit_obstacle_above # Zero if player didn't hit obstacle above &34a1 f0 12 BEQ &34b5 ; no_obstacle_above &34a3 20 20 30 JSR &3020 ; play_bouncing_sound # Play sound for hitting obstacle above player &34a6 38 SEC &34a7 a5 11 LDA &11 ; player_y &34a9 e5 82 SBC &82 ; vertical_velocity_limited_by_any_obstacle # Move player up to the obstacle above &34ab 85 11 STA &11 ; player_y &34ad 20 cd 36 JSR &36cd ; plot_player # Replot player after bounce &34b0 e6 89 INC &89 ; player_hit_obstacle_above # Set to two to make player bounce of obstacle &34b2 4c 8d 34 JMP &348d ; no_obstacle_below ; no_obstacle_above &34b5 38 SEC &34b6 a5 11 LDA &11 ; player_y &34b8 e5 87 SBC &87 ; player_vertical_velocity # Apply vertical velocity &34ba 85 11 STA &11 ; player_y &34bc 20 cd 36 JSR &36cd ; plot_player # Replot player in new position &34bf a5 8a LDA &8a ; fall_slowed_by_umbrella &34c1 d0 0e BNE &34d1 ; leave_with_zero # Non-zero if umbrella is up while falling &34c3 e6 86 INC &86 ; falling_acceleration_cooldown &34c5 a5 86 LDA &86 ; falling_acceleration_cooldown # If the umbrella is down, increase falling speed &34c7 c9 02 CMP #&02 # every two frames (three if tarantula is moving) # actually CMP maximum_falling_acceleration_cooldown &34c9 d0 06 BNE &34d1 ; leave_with_zero &34cb a9 00 LDA #&00 &34cd 85 86 STA &86 ; falling_acceleration_cooldown &34cf c6 87 DEC &87 ; player_vertical_velocity # Make player fall faster ; leave_with_zero &34d1 a0 00 LDY #&00 # Leave with Y positive to indicate no obstacle below &34d3 60 RTS ; hit_obstacle_below &34d4 a5 87 LDA &87 ; player_vertical_velocity &34d6 c9 fb CMP #&fb # Did the player hit the obstacle too fast? &34d8 10 04 BPL &34de ; landing_wasn't_deadly &34da a9 01 LDA #&01 # If so, kill them &34dc 85 08 STA &08 ; player_touched_something_deadly ; landing_wasn't_deadly &34de a9 00 LDA #&00 &34e0 85 88 STA &88 ; player_is_unsupported # Set to zero to indicate player is supported &34e2 85 8a STA &8a ; fall_slowed_by_umbrella # Set to zero to indicate not falling &34e4 85 89 STA &89 ; player_hit_obstacle_above # Set to zero to indicate no obstacle above &34e6 85 86 STA &86 ; falling_acceleration_cooldown &34e8 a5 82 LDA &82 ; vertical_velocity_limited_by_any_obstacle &34ea d0 03 BNE &34ef ; replot_player_after_vertical_movement &34ec a0 ff LDY #&ff # Leave with Y negative to indicate obstacle below &34ee 60 RTS ; replot_player_after_vertical_movement &34ef 20 01 37 JSR &3701 ; unplot_player_after_delay # Unplot player &34f2 38 SEC &34f3 a5 11 LDA &11 ; player_y &34f5 e5 82 SBC &82 ; vertical_velocity_limited_by_any_obstacle # Move player down to the obstacle below &34f7 85 11 STA &11 ; player_y &34f9 4c cd 36 JMP &36cd ; plot_player # Replot player in new position ; check_vertical_movement &34fc a9 00 LDA #&00 &34fe 85 82 STA &82 ; vertical_velocity_limited_by_any_obstacle &3500 a5 87 LDA &87 ; player_vertical_velocity &3502 d0 01 BNE &3505 ; is_moving_vertically # Is the player moving vertically? &3504 60 RTS ; is_moving_vertically &3505 30 0a BMI &3511 ; is_falling # If so, consider the row above or below them ; is_jumping &3507 38 SEC &3508 a5 11 LDA &11 ; player_y &350a e9 1a SBC #&1a &350c 85 13 STA &13 ; sprite_y &350e 4c 16 35 JMP &3516 ; checking_loop ; is_falling # depending on vertical direction &3511 a6 11 LDX &11 ; player_y &3513 e8 INX &3514 86 13 STX &13 ; sprite_y ; check_vertical_movement_loop &3516 a5 10 LDA &10 ; player_x &3518 85 12 STA &12 ; sprite_x &351a a5 13 LDA &13 ; sprite_y &351c 85 81 STA &81 ; row_y &351e 20 90 35 JSR &3590 ; check_row_of_player &3521 a5 81 LDA &81 ; row_y &3523 85 13 STA &13 ; sprite_y &3525 a5 10 LDA &10 ; player_x &3527 85 12 STA &12 ; sprite_x &3529 a5 87 LDA &87 ; player_vertical_velocity &352b 10 34 BPL &3561 ; skip_umbrella # Is the player falling? &352d a5 8c LDA &8c ; umbrella_state &352f f0 30 BEQ &3561 ; skip_umbrella # If so, and the umbrella is up, &3531 a5 8e LDA &8e ; player_facing &3533 d0 0a BNE &353f ; facing_right ; facing_left &3535 38 SEC &3536 a5 12 LDA &12 ; sprite_x &3538 e9 08 SBC #&08 &353a 85 12 STA &12 ; sprite_x &353c 4c 46 35 JMP &3546 ; check_umbrella ; facing_right &353f 18 CLC &3540 a5 12 LDA &12 ; sprite_x &3542 69 04 ADC #&04 &3544 85 12 STA &12 ; sprite_x ; check_umbrella &3546 a5 85 LDA &85 ; result &3548 48 PHA &3549 a5 13 LDA &13 ; sprite_y &354b 48 PHA &354c 38 SEC &354d e9 1a SBC #&1a &354f 85 13 STA &13 ; sprite_y &3551 a2 02 LDX #&02 # 8 pixels wide &3553 a0 01 LDY #&01 # 1 pixels high &3555 20 f7 33 JSR &33f7 ; check_for_obstacle # Check if the side of the umbrella has hit an obstacle &3558 68 PLA &3559 85 13 STA &13 ; sprite_y &355b 68 PLA &355c 18 CLC &355d 65 85 ADC &85 ; result &355f 85 85 STA &85 ; result # Consider obstacles to both player and umbrella ; skip_umbrella &3561 a5 87 LDA &87 ; player_vertical_velocity &3563 30 16 BMI &357b ; is_falling ; is_jumping # If the player is jumping, &3565 a5 85 LDA &85 ; result &3567 f0 07 BEQ &3570 ; no_obstacle # and there is an obstacle, &3569 a0 01 LDY #&01 &356b 84 89 STY &89 ; player_hit_obstacle_above # Set to non-zero to indicate obstacle above &356d e6 82 INC &82 ; vertical_velocity_limited_by_any_obstacle &356f 60 RTS # Leave with Y positive to indicate no obstacle below ; no_obstacle # If there is no obstacle, &3570 c6 13 DEC &13 ; sprite_y &3572 e6 82 INC &82 ; vertical_velocity_limited_by_any_obstacle # the player can jump through this row &3574 a5 82 LDA &82 ; vertical_velocity_limited_by_any_obstacle &3576 c5 87 CMP &87 ; player_vertical_velocity &3578 d0 13 BNE &358d ; to_checking_loop # so check the next row, if there is one &357a 60 RTS ; is_falling # if the player is falling &357b a5 85 LDA &85 ; result &357d f0 03 BEQ &3582 ; no_obstacle # and there is an obstacle, &357f a0 ff LDY #&ff # leave with Y negative to indicate obstacle below &3581 60 RTS ; no_obstacle # If there is no obstacle, &3582 e6 13 INC &13 ; sprite_y &3584 c6 82 DEC &82 ; vertical_velocity_limited_by_any_obstacle # the player can fall through this row &3586 a5 82 LDA &82 ; vertical_velocity_limited_by_any_obstacle &3588 c5 87 CMP &87 ; player_vertical_velocity &358a d0 01 BNE &358d ; to_checking_loop # so check the next one, if there is one &358c 60 RTS ; to_checking_loop &358d 4c 16 35 JMP &3516 ; checking_loop ; check_row_of_player &3590 a5 87 LDA &87 ; player_vertical_velocity &3592 30 1e BMI &35b2 ; is_falling ; is_jumping # If the player is jumping, &3594 a5 8f LDA &8f ; player_horizontal_velocity &3596 f0 13 BEQ &35ab ; skip_horizontal_movement &3598 a5 8b LDA &8b ; feet_state &359a f0 0f BEQ &35ab ; skip_horizontal_movement &359c a5 8e LDA &8e ; player_facing &359e d0 07 BNE &35a7 ; facing_right ; facing_left &35a0 c6 12 DEC &12 ; sprite_x &35a2 c6 12 DEC &12 ; sprite_x &35a4 4c ab 35 JMP &35ab ; skip_horizontal_movement ; facing_right &35a7 e6 12 INC &12 ; sprite_x &35a9 e6 12 INC &12 ; sprite_x ; skip_horizontal_movement &35ab a2 04 LDX #&04 # 16 pixels wide &35ad a0 01 LDY #&01 # 1 pixel high &35af 4c f7 33 JMP &33f7 ; check_for_obstacle # Check row for obstacles to player's head ; is_falling &35b2 c6 12 DEC &12 ; sprite_x # If the player is falling, &35b4 c6 12 DEC &12 ; sprite_x &35b6 a2 01 LDX #&01 # 4 pixels wide if feet are even &35b8 a5 8e LDA &8e ; player_facing &35ba f0 08 BEQ &35c4 ; facing_left &35bc a5 8b LDA &8b ; feet_state &35be d0 04 BNE &35c4 ; facing_left &35c0 c6 12 DEC &12 ; sprite_x &35c2 c6 12 DEC &12 ; sprite_x ; facing_left &35c4 a5 8b LDA &8b ; feet_state &35c6 f0 01 BEQ &35c9 ; even_feet &35c8 e8 INX # 8 pixels wide if feet are odd ; even_feet &35c9 a0 01 LDY #&01 # 1 pixel high &35cb 20 f7 33 JSR &33f7 ; check_for_obstacle # Check row for obstacles to player's feet &35ce a5 85 LDA &85 ; result &35d0 f0 01 BEQ &35d3 ; no_obstacle &35d2 60 RTS # Leave if there is an obstacle ; no_obstacle # If not, &35d3 a5 8e LDA &8e ; player_facing &35d5 f0 3b BEQ &3612 ; consider_slipping_left_two &35d7 a5 8b LDA &8b ; feet_state &35d9 d0 37 BNE &3612 ; consider_slipping_left_two ; consider_slipping_left_one # If the player is facing right, &35db e6 12 INC &12 ; sprite_x &35dd e6 12 INC &12 ; sprite_x &35df a2 01 LDX #&01 # 4 pixels wide &35e1 a0 01 LDY #&01 # 1 pixel high &35e3 20 f7 33 JSR &33f7 ; check_for_obstacle # Check for obstacle to right &35e6 a5 85 LDA &85 ; result &35e8 f0 28 BEQ &3612 ; consider_slipping_right &35ea a9 00 LDA #&00 # If there is an obstacle, &35ec 85 8f STA &8f ; player_horizontal_velocity # stop the player moving horizontally &35ee a9 02 LDA #&02 &35f0 20 76 37 JSR &3776 ; delay &35f3 20 2f 37 JSR &372f ; unplot_player # Unplot player &35f6 38 SEC &35f7 a5 11 LDA &11 ; player_y &35f9 e5 82 SBC &82 ; vertical_velocity_limited_by_any_obstacle &35fb 85 11 STA &11 ; player_y &35fd 20 cd 36 JSR &36cd ; plot_player # Replot player in unslipped position &3600 a9 02 LDA #&02 &3602 20 76 37 JSR &3776 ; delay &3605 20 2f 37 JSR &372f ; unplot_player # Unplot player &3608 c6 10 DEC &10 ; player_x # Make player slip left off obstacle &360a c6 10 DEC &10 ; player_x &360c 20 cd 36 JSR &36cd ; plot_player # Replot player &360f 4c 37 36 JMP &3637 ; stop_player_and_slip_left ; consider_slipping_left_two # If the player is facing left or right, &3612 e6 12 INC &12 ; sprite_x &3614 e6 12 INC &12 ; sprite_x &3616 a2 01 LDX #&01 # 4 pixels wide &3618 a0 01 LDY #&01 # 1 pixel high &361a 20 f7 33 JSR &33f7 ; check_for_obstacle # Check for obstacle to right &361d a5 85 LDA &85 ; result &361f f0 2b BEQ &364c ; consider_slipping_right_one &3621 a9 00 LDA #&00 # If there is an obstacle, &3623 85 8f STA &8f ; player_horizontal_velocity # stop the player moving horizontally &3625 a9 02 LDA #&02 &3627 20 76 37 JSR &3776 ; delay &362a 20 2f 37 JSR &372f ; unplot_player # Unplot player &362d 38 SEC &362e a5 11 LDA &11 ; player_y &3630 e5 82 SBC &82 ; vertical_velocity_limited_by_any_obstacle &3632 85 11 STA &11 ; player_y &3634 20 cd 36 JSR &36cd ; plot_player # Replot player in unslipped position ; stop_player_and_slip_left &3637 a9 00 LDA #&00 &3639 85 85 STA &85 ; result # Ignore this obstacle later &363b 85 82 STA &82 ; vertical_velocity_limited_by_any_obstacle &363d a9 02 LDA #&02 &363f 20 76 37 JSR &3776 ; delay &3642 20 2f 37 JSR &372f ; unplot_player # Unplot player &3645 c6 10 DEC &10 ; player_x # Make player slip left off obstacle &3647 c6 10 DEC &10 ; player_x &3649 4c cd 36 JMP &36cd ; plot_player # Replot player ; consider_slipping_right_one &364c 38 SEC &364d a5 12 LDA &12 ; sprite_x &364f e9 06 SBC #&06 &3651 85 12 STA &12 ; sprite_x &3653 a5 8e LDA &8e ; player_facing &3655 d0 3f BNE &3696 ; consider_slipping_right_two &3657 a5 8b LDA &8b ; feet_state &3659 d0 3b BNE &3696 ; consider_slipping_right_two &365b e6 12 INC &12 ; sprite_x # If the player is facing right, &365d e6 12 INC &12 ; sprite_x &365f a2 01 LDX #&01 # 4 pixels wide &3661 a0 01 LDY #&01 # 1 pixel high &3663 20 f7 33 JSR &33f7 ; check_for_obstacle # Check for obstacle to left &3666 c6 12 DEC &12 ; sprite_x &3668 c6 12 DEC &12 ; sprite_x &366a a5 85 LDA &85 ; result &366c f0 28 BEQ &3696 ; consider_slipping_right_two &366e a9 00 LDA #&00 # If there is an obstacle, &3670 85 8f STA &8f ; player_horizontal_velocity # stop the player moving horizontally &3672 a9 02 LDA #&02 &3674 20 76 37 JSR &3776 ; delay &3677 20 2f 37 JSR &372f ; unplot_player # Unplot player &367a 38 SEC &367b a5 11 LDA &11 ; player_y &367d e5 82 SBC &82 ; vertical_velocity_limited_by_any_obstacle &367f 85 11 STA &11 ; player_y &3681 20 cd 36 JSR &36cd ; plot_player # Replot player in unslipped position &3684 a9 02 LDA #&02 &3686 20 76 37 JSR &3776 ; delay &3689 20 2f 37 JSR &372f ; unplot_player # Unplot player &368c e6 10 INC &10 ; player_x # Make player slip right off obstacle &368e e6 10 INC &10 ; player_x &3690 20 cd 36 JSR &36cd ; plot_player # Replot player &3693 4c b7 36 JMP &36b7 ; stop_player_and_slip_right ; consider_slipping_right_two # If the player is facing left or right, &3696 a2 01 LDX #&01 # 4 pixels wide &3698 a0 01 LDY #&01 # 1 pixel high &369a 20 f7 33 JSR &33f7 ; check_for_obstacle # Check for obstacle to left &369d a5 85 LDA &85 ; result &369f f0 2b BEQ &36cc ; leave &36a1 a9 00 LDA #&00 # If there is an obstacle, &36a3 85 8f STA &8f ; player_horizontal_velocity # stop the player moving horizontally &36a5 a9 02 LDA #&02 &36a7 20 76 37 JSR &3776 ; delay &36aa 20 2f 37 JSR &372f ; unplot_player # Unplot player &36ad 38 SEC &36ae a5 11 LDA &11 ; player_y &36b0 e5 82 SBC &82 ; vertical_velocity_limited_by_any_obstacle &36b2 85 11 STA &11 ; player_y &36b4 20 cd 36 JSR &36cd ; plot_player # Replot player in unslipped position ; stop_player_and_slip_right &36b7 a9 00 LDA #&00 # Ignore this obstacle later &36b9 85 85 STA &85 ; result &36bb 85 82 STA &82 ; vertical_velocity_limited_by_any_obstacle &36bd a9 02 LDA #&02 &36bf 20 76 37 JSR &3776 ; delay &36c2 20 2f 37 JSR &372f ; unplot_player # Unplot player &36c5 e6 10 INC &10 ; player_x # Make player slip right off obstacle &36c7 e6 10 INC &10 ; player_x &36c9 4c cd 36 JMP &36cd ; plot_player # Replot player ; leave &36cc 60 RTS ; plot_player &36cd a5 8f LDA &8f ; player_horizontal_velocity &36cf f0 08 BEQ &36d9 ; plot_horizontally_stationary_player &36d1 30 03 BMI &36d6 ; to_plot_player_left &36d3 4c 26 31 JMP &3126 ; plot_player_right ; to_plot_player_left &36d6 4c 86 32 JMP &3286 ; plot_player_left ; plot_horizontally_stationary_player &36d9 a9 04 LDA #&04 &36db 85 14 STA &14 ; sprite_width &36dd a9 19 LDA #&19 &36df 85 15 STA &15 ; sprite_height &36e1 a5 10 LDA &10 ; player_x &36e3 85 12 STA &12 ; sprite_x &36e5 a5 11 LDA &11 ; player_y &36e7 85 13 STA &13 ; sprite_y &36e9 a5 8e LDA &8e ; player_facing &36eb d0 0a BNE &36f7 ; facing_right ; facing_left &36ed a5 8b LDA &8b ; feet_state &36ef d0 03 BNE &36f4 ; to_plot_player_left_odd &36f1 4c b1 32 JMP &32b1 ; plot_player_left_even ; to_plot_player_left_odd &36f4 4c db 32 JMP &32db ; plot_player_left_odd ; facing_right &36f7 a5 8b LDA &8b ; feet_state &36f9 d0 03 BNE &36fe ; to_plot_player_right_odd &36fb 4c 51 31 JMP &3151 ; plot_player_right_even ; to_plot_player_right_odd &36fe 4c 82 31 JMP &3182 ; plot_player_right_odd ; unplot_player_after_delay &3701 a9 02 LDA #&02 &3703 20 76 37 JSR &3776 ; delay &3706 a5 8a LDA &8a ; fall_slowed_by_umbrella # Non-zero if umbrella up while falling &3708 f0 25 BEQ &372f ; unplot_player &370a a5 10 LDA &10 ; player_x &370c 85 12 STA &12 ; sprite_x &370e a5 8e LDA &8e ; player_facing &3710 f0 07 BEQ &3719 ; facing_left &3712 18 CLC &3713 a5 12 LDA &12 ; sprite_x &3715 69 04 ADC #&04 &3717 85 12 STA &12 ; sprite_x ; facing_left &3719 38 SEC &371a a5 11 LDA &11 ; player_y &371c e9 20 SBC #&20 &371e 85 13 STA &13 ; sprite_y &3720 a9 06 LDA #&06 &3722 85 14 STA &14 ; sprite_width &3724 a9 02 LDA #&02 &3726 85 15 STA &15 ; sprite_height &3728 a2 de LDX #&de &372a a0 3e LDY #&3e ; &3ede = empty_sprite - 1 &372c 4c b6 40 JMP &40b6 ; plot_sprite # Unplot previous top of umbrella ; unplot_player &372f a5 10 LDA &10 ; player_x &3731 85 12 STA &12 ; sprite_x &3733 a5 11 LDA &11 ; player_y &3735 85 13 STA &13 ; sprite_y &3737 a9 04 LDA #&04 &3739 85 14 STA &14 ; sprite_width &373b a9 18 LDA #&18 &373d 85 15 STA &15 ; sprite_height &373f a5 8c LDA &8c ; umbrella_state &3741 f0 02 BEQ &3745 ; is_down &3743 e6 15 INC &15 ; sprite_height ; is_down &3745 a9 01 LDA #&01 # Non-zero to wipe screen memory, not plot &3747 85 1b STA &1b ; sprite_plotting_mode &3749 a9 1f LDA #&1f &374b 85 21 STA &21 ; bytes_to_wipe &374d 20 b6 40 JSR &40b6 ; plot_sprite &3750 a5 8c LDA &8c ; umbrella_state &3752 f0 21 BEQ &3775 ; leave &3754 a5 8e LDA &8e ; player_facing &3756 f0 07 BEQ &375f ; facing_left &3758 18 CLC &3759 a5 12 LDA &12 ; sprite_x &375b 69 04 ADC #&04 &375d 85 12 STA &12 ; sprite_x ; facing_left &375f 38 SEC &3760 a5 13 LDA &13 ; sprite_y &3762 e9 1a SBC #&1a &3764 85 13 STA &13 ; sprite_y &3766 a9 06 LDA #&06 &3768 85 14 STA &14 ; sprite_width &376a a9 08 LDA #&08 &376c 85 15 STA &15 ; sprite_height &376e a2 de LDX #&de &3770 a0 3e LDY #&3e ; &3ede = empty_sprite - 1 &3772 4c b6 40 JMP &40b6 ; plot_sprite &3775 60 RTS ; delay &3776 38 SEC &3777 e5 0e SBC &0e ; delay_reduction &3779 85 80 STA &80 ; count # Delay for A v-syncs ; delay_vsync_loop &377b a9 13 LDA #&13 ; Wait for Vertical Retrace &377d 20 f4 ff JSR &fff4 ; OSBYTE &3780 c6 80 DEC &80 ; count &3782 d0 f7 BNE &377b ; delay_vsync_loop &3784 a5 00 LDA &00 ; cave_border # Is this a tall cave? &3786 30 18 BMI &37a0 ; leave &3788 f0 16 BEQ &37a0 ; leave &378a a5 11 LDA &11 ; player_y # If so, is the player in the top quarter? &378c c9 80 CMP #&80 &378e 10 10 BPL &37a0 ; leave &3790 c9 40 CMP #&40 &3792 10 0c BPL &37a0 ; leave &3794 78 SEI # If so, an additional short delay to avoid flicker &3795 a2 06 LDX #&06 ; delay_outer_loop &3797 a0 ff LDY #&ff ; delay_inner_loop &3799 ea NOP &379a 88 DEY &379b d0 fc BNE &3799 ; delay_inner_loop &379d ca DEX &379e d0 f7 BNE &3797 ; delay_outer_loop ; leave &37a0 a0 01 LDY #&01 &37a2 58 CLI &37a3 60 RTS ; platform_4_sprite &37a4 00 10 80 00 00 21 48 00 00 21 48 00 00 52 a4 00 &37b4 00 52 a4 00 10 b4 d2 80 21 78 e1 48 f0 f0 f0 f0 &37c4 87 0f 0f 1e 96 e1 78 96 f0 30 c0 f0 f0 30 c0 f0 ; platform_6_sprite &37d4 00 00 30 c0 00 00 00 00 30 48 00 00 00 00 21 c0 &37e4 00 00 00 00 30 48 00 00 00 00 21 c0 00 00 00 00 &37f4 30 48 00 00 00 00 21 c0 00 00 00 00 70 68 00 00 &3804 00 00 61 a4 00 00 00 00 52 68 00 00 00 00 e1 b4 &3814 00 00 00 00 d2 5a 00 00 00 10 b4 e1 80 00 00 70 &3824 f0 f0 e0 00 f0 f0 f0 f0 f0 f0 87 0f 0f 0f 0f 1e &3834 96 e1 3c c3 78 96 f0 30 e0 70 c0 f0 f0 30 e0 70 &3844 c0 f0 ; platform_8_sprite &3846 10 f0 f0 00 00 f0 f0 80 00 70 5a f0 f0 d2 68 00 &3856 00 30 a5 a5 a5 a5 c0 00 00 10 d2 5a 5a 5a 80 00 &3866 00 10 b4 f0 f0 b4 80 00 00 70 f0 f0 f0 f0 e0 00 &3876 f0 f0 f0 f0 f0 f0 f0 f0 87 0f 0f 0f 0f 0f 0f 1e &3886 96 e1 3c c3 3c c3 78 96 f0 30 e0 70 e0 70 c0 f0 &3896 f0 30 e0 70 e0 70 c0 f0 ; platform_15_sprite &389e 00 00 00 00 00 00 f0 f0 f0 00 00 00 00 00 00 00 &38ae 00 00 00 f0 f0 87 0f 1e f0 f0 00 00 00 00 00 00 &38be 00 00 a5 a5 a5 a5 a5 a5 b4 00 00 00 00 00 00 00 &38ce 10 d2 5a 78 f0 f0 5a 5a 80 00 00 00 00 00 00 70 &38de 5a 78 f0 f0 f0 f0 5a e0 00 00 00 00 10 f0 e1 b4 &38ee f0 f0 f0 f0 f0 e1 b4 f0 80 00 f0 f0 f0 f0 f0 f0 &38fe f0 f0 f0 f0 f0 f0 f0 f0 f0 87 0f 0f 0f 0f 0f 0f &390e 0f 0f 0f 0f 0f 0f 0f 1e 96 e1 78 96 e1 78 87 f0 &391e 1e e1 78 96 e1 78 96 f0 30 c0 f0 30 c0 f0 90 f0 &392e 30 c0 f0 30 c0 f0 f0 30 c0 f0 30 c0 f0 90 f0 30 &393e c0 f0 30 c0 f0 ; horseshoe_sprite &3943 60 60 64 62 e0 70 c0 30 c8 31 e0 70 70 e0 32 c4 ; short_barbed_wire_sprite &3953 10 80 00 40 20 40 60 a0 10 20 90 90 10 20 a0 50 &3963 00 a0 60 20 90 60 50 30 60 10 80 c0 ; long_barbed_wire_sprite &396f 00 00 e0 00 00 c0 10 d0 10 10 10 20 20 20 20 a0 &397f a0 10 20 10 40 c0 50 90 10 20 d0 40 40 60 80 a0 &398f 20 20 80 80 60 50 c0 50 10 40 10 80 30 80 e0 30 ; tripod_sprite &399f 20 20 40 40 40 20 40 40 20 60 40 60 20 40 40 20 &39af 40 40 30 40 c0 10 40 80 30 f0 c0 10 f0 80 30 0f &39bf c0 61 0f 68 61 0f 68 21 0f 48 30 00 c0 10 00 80 &39cf 10 f6 80 00 f6 00 00 f6 00 10 66 80 ; petridish_sprite &39db 10 f0 80 70 ff e0 f3 ff fc f7 ff fe 80 00 10 c0 &39eb 00 30 ; owl_sprite &39ed 00 70 f4 f4 c0 00 00 f4 fa f4 e4 00 10 f0 f8 f0 &39fd f8 00 10 f1 f0 f8 f4 00 30 f0 f2 fa f4 80 30 f4 &3a0d f0 f2 f4 80 30 f8 f9 f0 f0 80 70 f8 fa f1 f1 c0 &3a1d 70 f4 fa f1 f5 c0 71 f4 f0 f5 f4 c0 71 f1 f2 f4 &3a2d f0 c8 70 f1 f2 f0 f8 c8 71 f0 f8 f8 f8 c0 70 f8 &3a3d f0 f9 f1 c0 72 f8 f0 f0 f2 c0 70 f4 0f 0f f0 c0 &3a4d 70 c3 1e 0f 3c c0 30 87 1e 0f 1e 80 30 0f 3c 87 &3a5d 0f 80 21 1e b4 b4 0f 80 21 3c b6 bc 87 80 21 1e &3a6d 3e 9e 0f 80 30 0f 7e cf 1e 80 10 87 7c c7 1e 00 &3a7d 00 f1 f8 f3 e0 00 00 30 f0 f0 c0 00 00 00 70 e0 &3a8d 00 00 ; right_even_eyes_sprites_address_table &3a8f a6 a9 ac af b2 b5 ; right_odd_eyes_sprites_address_table &3a95 b8 bb be c1 c4 c7 ; left_even_eyes_sprites_address_table &3a9b ca cd d0 d3 d6 d9 ; left_odd_eyes_sprites_address_table &3aa1 dc df e2 e5 e8 eb ; right_even_eye_frame_0_sprite &3aa7 3e 3f b7 ; right_even_eye_frame_1_sprite &3aaa 3d 3f b7 ; right_even_eye_frame_2_sprite &3aad 3f 3d b7 ; right_even_eye_frame_3_sprite &3ab0 3f 3f b5 ; right_even_eye_frame_4_sprite &3ab3 3f 3f b6 ; right_even_eye_frame_5_sprite &3ab6 3f 3e b7 ; right_odd_eye_frame_0_sprite &3ab9 cb cf ce ; right_odd_eye_frame_1_sprite &3abc c7 cf ce ; right_odd_eye_frame_2_sprite &3abf cf c7 ce ; right_odd_eye_frame_3_sprite &3ac2 cf cf c6 ; right_odd_eye_frame_4_sprite &3ac5 cf cf ca ; right_odd_eye_frame_5_sprite &3ac8 cf cb ce ; left_even_eye_frame_0_sprite &3acb c7 cf de ; left_even_eye_frame_1_sprite &3ace cb cf de ; left_even_eye_frame_2_sprite &3ad1 cf cb de ; left_even_eye_frame_3_sprite &3ad4 cf cf da ; left_even_eye_frame_4_sprite &3ad7 cf cf d6 ; left_even_eye_frame_5_sprite &3ada cf c7 de ; left_odd_eye_frame_0_sprite &3add 3d 3f 37 ; left_odd_eye_frame_1_sprite &3ae0 3e 3f 37 ; left_odd_eye_frame_2_sprite &3ae3 3f 3e 37 ; left_odd_eye_frame_3_sprite &3ae6 3f 3f 36 ; left_odd_eye_frame_4_sprite &3ae9 3f 3f 35 ; left_odd_eye_frame_5_sprite &3aec 3f 3d 37 ; player_right_umbrella_down_even_sprite &3aef 00 f0 80 80 00 f0 00 88 00 e0 10 c0 00 f0 10 c0 &3aff 10 ff 90 c0 31 ff d8 c0 73 f3 fc c0 73 f3 fc c0 &3b0f 70 f0 f0 c0 73 fb fc c0 73 ff e8 80 73 ff f6 80 &3b1f 73 ff ff 80 73 ff ff 80 73 ff f8 80 31 ff 80 00 &3b2f 10 1e 00 00 30 0f 08 00 61 0f 48 00 61 3f 0c 00 &3b3f 61 3e 0c 00 70 b7 08 00 70 c3 08 00 30 f0 80 00 &3b4f 10 f0 00 00 ; player_right_umbrella_down_odd_sprite &3b53 00 70 70 20 00 e0 70 a2 00 e0 e0 70 00 70 c0 70 &3b63 00 73 ec 70 00 f7 fe 70 10 fc ff f0 10 fc ff f0 &3b73 10 f0 f0 f0 10 fe ff f0 10 ff fe a0 10 ff fd e8 &3b83 10 ff ff ec 10 ff ff ec 10 ff fe e0 00 f7 ec 00 &3b93 00 43 48 00 00 c3 0e 00 10 87 1e 00 10 87 cf 00 &3ba3 10 87 cb 00 10 e1 ce 00 10 f0 0e 00 00 f0 e0 00 &3bb3 00 70 c0 00 ; player_left_umbrella_down_even_sprite &3bb7 10 10 f0 00 11 00 f0 00 30 80 70 00 30 80 f0 00 &3bc7 30 90 ff 80 30 b1 ff c8 30 f3 8f ec 30 f3 8f e4 &3bd7 30 f0 f3 e0 30 f3 fb e4 30 f3 fb e4 10 73 f7 e4 &3be7 10 fb f7 e4 10 fd ff e4 10 f1 ff ec 00 10 ff c8 &3bf7 00 00 87 80 00 01 0f c0 00 21 0f 68 00 03 cf 68 &3c07 00 03 c7 68 00 01 de e0 00 01 3c e0 00 10 f0 c0 &3c17 00 00 f0 80 ; player_left_umbrella_down_odd_sprite &3c1b 40 e0 e0 00 54 e0 70 00 e0 70 70 00 e0 30 e0 00 &3c2b e0 73 ec 00 e0 f7 fe 00 f0 ef 3f 80 f0 ef 3d 80 &3c3b f0 f0 fc 80 f0 fe fd 80 f0 fe fd 80 50 fd fd 80 &3c4b 72 fd fd 80 73 f7 fd 80 70 f7 ff 80 00 73 fe 00 &3c5b 00 21 2c 00 00 07 3c 00 00 87 1e 80 00 3f 1e 80 &3c6b 00 3d 1e 80 00 37 78 80 00 07 f0 80 00 70 f0 00 &3c7b 00 30 e0 00 ; player_right_umbrella_up_even_sprite &3c7f 00 f0 80 00 00 f0 00 00 00 e0 00 00 00 f0 00 00 &3c8f 10 ff 80 00 31 ff c8 00 73 f3 ec 00 73 f3 ec 00 &3c9f 70 f0 e0 00 73 fb ec 00 73 fe e4 00 73 ff e0 00 &3caf 73 ff fe 00 73 ff ff 80 73 ff ff c8 31 ff f9 c8 &3cbf 10 1e 90 c8 30 0f 18 40 61 0f 58 00 61 3f 1c 00 &3ccf 61 3f 1c 00 70 b6 18 00 70 c3 18 00 30 f0 90 00 &3cdf 10 f0 30 80 00 00 50 40 ; player_right_umbrella_up_odd_sprite &3ce7 00 70 70 00 00 e0 70 80 00 e0 e0 00 00 70 c0 00 &3cf7 00 73 ec 00 00 f7 fe 00 10 fc ff 80 10 fc ff 80 &3d07 10 f0 f0 80 10 fe ff 80 10 ff f9 80 10 ff fc 80 &3d17 10 ff ff c8 10 ff ff ec 10 ff ff fe 00 f7 fe f6 &3d27 00 43 68 72 00 c3 0e 50 10 87 1e 40 10 87 cf 40 &3d37 10 87 cf 40 10 e1 ca 40 10 f0 0e 40 00 f0 e0 40 &3d47 00 70 c0 e0 00 00 10 50 ; player_left_umbrella_up_even_sprite &3d4f 00 10 f0 00 00 00 f0 00 00 00 70 00 00 00 f0 00 &3d5f 00 10 ff 80 00 31 ff c8 00 73 8f ec 00 73 8f e4 &3d6f 00 70 f3 e0 00 73 fb e4 00 73 fb e4 00 73 f7 e4 &3d7f 00 f3 f7 e4 10 f9 ff e4 31 fd ff ec 31 d8 ff c8 &3d8f 31 80 87 80 20 81 0f c0 00 a1 0f 68 00 83 cf 68 &3d9f 00 83 cf 68 00 81 d6 e0 00 81 3c e0 00 90 f0 c0 &3daf 10 c0 f0 80 20 a0 00 00 ; player_left_umbrella_up_odd_sprite &3db7 00 e0 e0 00 10 e0 70 00 00 70 70 00 00 30 e0 00 &3dc7 00 73 ec 00 00 f7 fe 00 10 ef 3f 80 10 ef 3d 80 &3dd7 10 f0 fc 80 10 fe fd 80 10 fe fd 80 10 fd fd 80 &3de7 30 fd fd 80 72 f7 fd 80 f7 f7 ff 80 f6 73 fe 00 &3df7 e4 21 2c 00 a0 07 3c 00 20 87 1e 80 20 3f 1e 80 &3e07 20 3f 1e 80 20 35 78 80 20 07 f0 80 20 70 f0 00 &3e17 70 30 e0 00 a0 80 00 00 ; umbrella_right_even_sprite &3e1f 70 f0 f0 f0 f0 c0 70 f0 f0 f0 f0 c0 30 f0 f0 f0 &3e2f f0 80 00 f0 f0 f0 e0 00 00 30 f0 f0 80 00 00 00 &3e3f f0 e0 00 00 00 00 11 00 00 00 00 00 10 00 00 00 ; umbrella_right_odd_sprite &3e4f 10 f0 f0 f0 f0 f0 10 f0 f0 f0 f0 f0 00 f0 f0 f0 &3e5f f0 e0 00 30 f0 f0 f0 80 00 00 f0 f0 e0 00 00 00 &3e6f 30 f0 80 00 00 00 00 44 00 00 00 00 00 40 00 00 ; umbrella_left_even_sprite &3e7f 30 f0 f0 f0 f0 e0 30 f0 f0 f0 f0 e0 10 f0 f0 f0 &3e8f f0 c0 00 70 f0 f0 f0 00 00 10 f0 f0 c0 00 00 00 &3e9f 70 f0 00 00 00 00 00 88 00 00 00 00 00 80 00 00 ; umbrella_left_odd_sprite &3eaf f0 f0 f0 f0 f0 80 f0 f0 f0 f0 f0 80 70 f0 f0 f0 &3ebf f0 00 10 f0 f0 f0 c0 00 00 70 f0 f0 00 00 00 10 &3ecf f0 c0 00 00 00 00 22 00 00 00 00 00 20 00 00 00 ; empty_sprite &3edf 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &3eef 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &3eff 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &3f0f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &3f1f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &3f2f 00 00 00 00 ; initialise_cave_screen &3f33 86 05 STX &05 ; cave_type &3f35 10 27 BPL &3f5e ; not_mode_7 # Is the screen in MODE 7? &3f37 a2 ae LDX #&ae &3f39 a0 40 LDY #&40 ; &40ae = irq1_handler # If so, limit amount of screen memory cleared to 1k &3f3b a9 09 LDA #&09 # by overwriting OS variable while changing mode &3f3d 78 SEI &3f3e 8e 04 02 STX &0204 ; irq1_vector_low &3f41 8c 05 02 STY &0205 ; irq1_vector_high &3f44 8d 45 fe STA &fe45 ; System VIA timer 1 counter MSB &3f47 58 CLI &3f48 a9 01 LDA #&01 # and change to MODE 1 &3f4a 20 00 c3 JSR &c300 ; to_os_rom_set_mode &3f4d a9 27 LDA #&27 &3f4f a2 93 LDX #&93 &3f51 a0 dc LDY #&dc ; &dc93 = os_irq1_handler &3f53 78 SEI &3f54 8d 45 fe STA &fe45 ; System VIA timer 1 counter MSB &3f57 8e 04 02 STX &0204 ; irq1_vector_low &3f5a 8c 05 02 STY &0205 ; irq1_vector_high &3f5d 58 CLI ; not_mode_7 &3f5e a9 00 LDA #&00 ; K &3f60 8d 7b 42 STA &427b ; palette_block + 1 &3f63 85 1b STA &1b ; sprite_plotting_mode # Zero to plot sprite, not wipe screen memory &3f65 85 1c STA &1c ; suppress_sprite_plotting # Zero to plot sprites, not just calculate address &3f67 a9 03 LDA #&03 &3f69 85 28 STA &28 ; colour &3f6b 8d 7a 42 STA &427a ; palette_block &3f6e a9 0c LDA #&0c ; Write palette ; hide_palette_loop # Set all logical colours to black &3f70 a2 7a LDX #&7a &3f72 a0 42 LDY #&42 ; &427a = palette_block &3f74 20 f1 ff JSR &fff1 ; OSWORD &3f77 a6 28 LDX &28 ; colour &3f79 ca DEX &3f7a 86 28 STX &28 ; colour &3f7c 8e 7a 42 STX &427a ; palette_block &3f7f 10 ef BPL &3f70 ; hide_palette_loop &3f81 a9 56 LDA #&56 &3f83 8d 5d 03 STA &035d ; vdu_vector_low &3f86 a9 cc LDA #&cc ; &cc56 ; os_clear_screen + &54 # Clear screen memory from &4600 to &7fff &3f88 8d 5e 03 STA &035e ; vdu_vector_high &3f8b a2 00 LDX #&00 &3f8d 8a TXA &3f8e 20 71 d3 JSR &d371 ; os_to_vdu_vector &3f91 a9 08 LDA #&08 # R8: Interlace and delay register &3f93 8d 00 fe STA &fe00 ; video register number &3f96 ad 01 fe LDA &fe01 ; video register value &3f99 29 fe AND #&fe &3f9b 8d 01 fe STA &fe01 ; video register value &3f9e a9 0a LDA #&0a # R10: Cursor start register &3fa0 8d 00 fe STA &fe00 ; video register number &3fa3 a9 20 LDA #&20 # Disable cursor &3fa5 8d 01 fe STA &fe01 ; video register value &3fa8 a0 0c LDY #&0c # R12: Displayed screen start address register (high) &3faa 8c 00 fe STY &fe00 ; video register number &3fad a9 09 LDA #&09 &3faf 8d 01 fe STA &fe01 ; video register value &3fb2 c8 INY # R13: Displayed screen start address register (low) &3fb3 8c 00 fe STY &fe00 ; video register number &3fb6 a9 80 LDA #&80 # Set screen start address to &4c00 &3fb8 8d 01 fe STA &fe01 ; video register value &3fbb a6 05 LDX &05 ; cave_type &3fbd a0 01 LDY #&01 # R1: Number of characters per line &3fbf 8c 00 fe STY &fe00 ; video register number &3fc2 bd 7f 42 LDA &427f,X ; cave_types_r1 &3fc5 8d 01 fe STA &fe01 ; video register value &3fc8 c8 INY # R2: Horizontal sync position register &3fc9 8c 00 fe STY &fe00 ; video register number &3fcc bd 82 42 LDA &4282,X ; cave_types_r2 &3fcf 8d 01 fe STA &fe01 ; video register value &3fd2 a0 06 LDY #&06 # R6: Vertical displayed register &3fd4 8c 00 fe STY &fe00 ; video register number &3fd7 bd 85 42 LDA &4285,X ; cave_types_r6 &3fda 8d 01 fe STA &fe01 ; video register value &3fdd c8 INY # R7: Vertical sync position &3fde 8c 00 fe STY &fe00 ; video register number &3fe1 bd 88 42 LDA &4288,X ; cave_types_r7 &3fe4 8d 01 fe STA &fe01 ; video register value &3fe7 bd 8b 42 LDA &428b,X ; cave_types_lives_x &3fea 85 22 STA &22 ; lives_x &3fec bd 8e 42 LDA &428e,X ; cave_types_score_x &3fef 85 23 STA &23 ; score_x &3ff1 bd 91 42 LDA &4291,X ; cave_types_score_y &3ff4 85 24 STA &24 ; score_y &3ff6 bd 94 42 LDA &4294,X ; cave_types_time_x &3ff9 85 25 STA &25 ; time_x &3ffb bd 97 42 LDA &4297,X ; cave_types_pause_x &3ffe 85 26 STA &26 ; pause_x &4000 bd 9a 42 LDA &429a,X ; cave_types_pause_y &4003 85 27 STA &27 ; pause_y &4005 bd 9d 42 LDA &429d,X ; cave_types_group_size_high &4008 85 01 STA &01 ; group_size_high &400a bd a0 42 LDA &42a0,X ; cave_types_group_size_low &400d 85 02 STA &02 ; group_size_low &400f bd a3 42 LDA &42a3,X ; cave_types_group_size_minus_one_low &4012 85 03 STA &03 ; group_size_minus_one_low &4014 bd a6 42 LDA &42a6,X ; cave_types_group_size_minus_two_low &4017 85 04 STA &04 ; group_size_minus_two_low &4019 bd a9 42 LDA &42a9,X ; cave_types_border &401c 85 00 STA &00 ; cave_border &401e f0 2a BEQ &404a ; plot_cave_type_1_border &4020 10 50 BPL &4072 ; plot_cave_type_2_border ; plot_cave_type_0_border &4022 a2 17 LDX #&17 ; plot_cave_type_0_border_loop &4024 bd ac 42 LDA &42ac,X ; cave_type_0_border_sprite_widths &4027 85 14 STA &14 ; sprite_width &4029 bd c4 42 LDA &42c4,X ; cave_type_0_border_sprite_heights &402c 85 15 STA &15 ; sprite_height &402e bd dc 42 LDA &42dc,X ; cave_type_0_border_sprite_x_positions &4031 85 12 STA &12 ; sprite_x &4033 bd f4 42 LDA &42f4,X ; cave_type_0_border_sprite_y_positions &4036 85 13 STA &13 ; sprite_y &4038 bc 24 43 LDY &4324,X ; cave_type_0_border_sprite_addresses_high &403b 8a TXA &403c 48 PHA &403d bd 0c 43 LDA &430c,X ; cave_type_0_border_sprite_addresses_low &4040 aa TAX &4041 20 b6 40 JSR &40b6 ; plot_sprite &4044 68 PLA &4045 aa TAX &4046 ca DEX &4047 10 db BPL &4024 ; plot_cave_type_0_border_loop &4049 60 RTS ; plot_cave_type_1_border &404a a2 14 LDX #&14 ; plot_cave_type_1_border_loop &404c bd 3c 43 LDA &433c,X ; cave_type_1_border_sprite_widths &404f 85 14 STA &14 ; sprite_width &4051 bd 51 43 LDA &4351,X ; cave_type_1_border_sprite_heights &4054 85 15 STA &15 ; sprite_height &4056 bd 66 43 LDA &4366,X ; cave_type_1_border_sprite_x_positions &4059 85 12 STA &12 ; sprite_x &405b bd 7b 43 LDA &437b,X ; cave_type_1_border_sprite_y_positions &405e 85 13 STA &13 ; sprite_y &4060 bc a5 43 LDY &43a5,X ; cave_type_1_border_sprite_addresses_high &4063 8a TXA &4064 48 PHA &4065 bd 90 43 LDA &4390,X ; cave_type_1_border_sprite_addresses_low &4068 aa TAX &4069 20 b6 40 JSR &40b6 ; plot_sprite &406c 68 PLA &406d aa TAX &406e ca DEX &406f 10 db BPL &404c ; plot_cave_type_1_border_loop &4071 60 RTS ; plot_cave_type_2_border &4072 a2 15 LDX #&15 ; plot_cave_type_2_border_loop &4074 bd ba 43 LDA &43ba,X ; cave_type_2_border_sprite_widths &4077 85 14 STA &14 ; sprite_width &4079 bd d0 43 LDA &43d0,X ; cave_type_2_border_sprite_heights &407c 85 15 STA &15 ; sprite_height &407e bd e6 43 LDA &43e6,X ; cave_type_2_border_sprite_x_positions &4081 85 12 STA &12 ; sprite_x &4083 bd fc 43 LDA &43fc,X ; cave_type_2_border_sprite_y_positions &4086 85 13 STA &13 ; sprite_y &4088 bc 28 44 LDY &4428,X ; cave_type_2_border_sprite_addresses_high &408b 8a TXA &408c 48 PHA &408d bd 12 44 LDA &4412,X ; cave_type_2_border_sprite_addresses_low &4090 aa TAX &4091 20 b6 40 JSR &40b6 ; plot_sprite &4094 68 PLA &4095 aa TAX &4096 ca DEX &4097 10 db BPL &4074 ; plot_cave_type_2_border_loop ; fix_cave_type_2_score_box &4099 a9 c0 LDA #&c0 &409b 8d eb 7d STA &7deb # Top right of score box &409e a9 30 LDA #&30 &40a0 8d 2b 7d STA &7d2b # Top left of score box &40a3 a9 68 LDA #&68 &40a5 8d ec 7d STA &7dec # Top right of score box &40a8 a9 61 LDA #&61 &40aa 8d 2c 7d STA &7d2c # Top left of score box &40ad 60 RTS ; irq1_handler &40ae a9 04 LDA #&04 # Clear only top 1k of screen memory &40b0 8d 56 03 STA &0356 ; os_screen_memory_type &40b3 4c 93 dc JMP &dc93 ; os_irq1_handler ; plot_sprite &40b6 8e 72 41 STX &4172 ; sprite_address_low # Called with sprite address -1 in XY &40b9 8c 73 41 STY &4173 ; sprite_address_high ; plot_sprite_from_previous_address &40bc a9 00 LDA #&00 &40be 85 16 STA &16 ; row_address_low &40c0 85 18 STA &18 ; x_high &40c2 a5 13 LDA &13 ; sprite_y &40c4 85 19 STA &19 ; row_in_group &40c6 29 f8 AND #&f8 &40c8 85 1a STA &1a ; row_group &40ca 4a LSR A &40cb 4a LSR A &40cc a6 00 LDX &00 ; cave_border # Calculate screen address depending on cave type &40ce f0 2c BEQ &40fc ; is_cave_type_1 &40d0 10 3a BPL &410c ; is_cave_type_2 ; is_cave_type_0 # Wide cave, group is &2e0 bytes &40d2 85 17 STA &17 ; row_address_high &40d4 4a LSR A &40d5 65 17 ADC &17 ; row_address_high &40d7 85 17 STA &17 ; row_address_high &40d9 38 SEC &40da a9 00 LDA #&00 &40dc e5 1a SBC &1a ; row_group &40de b0 03 BCS &40e3 ; skip_page_one &40e0 c6 17 DEC &17 ; row_address_high &40e2 38 SEC ; skip_page_one &40e3 e5 1a SBC &1a ; row_group &40e5 b0 03 BCS &40ea ; skip_page_two &40e7 c6 17 DEC &17 ; row_address_high &40e9 38 SEC ; skip_page_two &40ea e5 1a SBC &1a ; row_group &40ec b0 03 BCS &40f1 ; skip_page_three &40ee c6 17 DEC &17 ; row_address_high &40f0 38 SEC ; skip_page_three &40f1 e5 1a SBC &1a ; row_group &40f3 b0 02 BCS &40f7 ; skip_page_four &40f5 c6 17 DEC &17 ; row_address_high ; skip_page_four &40f7 85 16 STA &16 ; row_address_low &40f9 4c 35 41 JMP &4135 ; add_sprite_x ; is_cave_type_1 # Middle cave, group is &240 bytes &40fc 85 17 STA &17 ; row_address_high &40fe 4a LSR A &40ff 4a LSR A &4100 66 16 ROR &16 ; row_address_low &4102 4a LSR A &4103 66 16 ROR &16 ; row_address_low &4105 65 17 ADC &17 ; row_address_high &4107 85 17 STA &17 ; row_address_high &4109 4c 35 41 JMP &4135 ; add_sprite_x ; is_cave_type_2 # Tall cave, group is &1a0 bytes &410c 4a LSR A &410d 85 17 STA &17 ; row_address_high &410f 4a LSR A &4110 66 16 ROR &16 ; row_address_low &4112 65 17 ADC &17 ; row_address_high &4114 85 17 STA &17 ; row_address_high &4116 a5 16 LDA &16 ; row_address_low &4118 65 1a ADC &1a ; row_group &411a 90 03 BCC &411f ; skip_page_one &411c e6 17 INC &17 ; row_address_high &411e 18 CLC ; skip_page_one &411f 65 1a ADC &1a ; row_group &4121 90 03 BCC &4126 ; skip_page_two &4123 e6 17 INC &17 ; row_address_high &4125 18 CLC ; skip_page_two &4126 65 1a ADC &1a ; row_group &4128 90 03 BCC &412d ; skip_page_three &412a e6 17 INC &17 ; row_address_high &412c 18 CLC ; skip_page_three &412d 65 1a ADC &1a ; row_group &412f 90 02 BCC &4133 ; skip_page_four &4131 e6 17 INC &17 ; row_address_high ; skip_page_four &4133 85 16 STA &16 ; row_address_low ; add_sprite_x &4135 a5 12 LDA &12 ; sprite_x &4137 29 fe AND #&fe &4139 0a ASL A &413a 26 18 ROL &18 ; x_high &413c 0a ASL A &413d 26 18 ROL &18 ; x_high &413f 65 16 ADC &16 ; row_address_low &4141 85 16 STA &16 ; row_address_low &4143 a5 18 LDA &18 ; x_high &4145 65 17 ADC &17 ; row_address_high &4147 69 4c ADC #&4c ; &4c00 # Screen starts at &4c00 &4149 85 17 STA &17 ; row_address_high &414b a5 1b LDA &1b ; sprite_plotting_mode # Zero to plot sprite, non-zero to wipe sprite &414d d0 7f BNE &41ce ; wipe_sprite &414f 18 CLC &4150 a5 13 LDA &13 ; sprite_y &4152 29 07 AND #&07 &4154 65 16 ADC &16 ; row_address_low &4156 85 16 STA &16 ; row_address_low &4158 8d 75 41 STA &4175 ; screen_address_low &415b a5 17 LDA &17 ; row_address_high &415d 69 00 ADC #&00 &415f 85 17 STA &17 ; row_address_high &4161 8d 76 41 STA &4176 ; screen_address_high &4164 a5 1c LDA &1c ; suppress_sprite_plotting # Non-zero if calculating screen address only &4166 f0 05 BEQ &416d ; plot_sprite_data &4168 a9 00 LDA #&00 # Set to zero to plot sprite next time &416a 85 1c STA &1c ; suppress_sprite_plotting &416c 60 RTS ; plot_sprite_data &416d a6 15 LDX &15 ; sprite_height ; plot_sprite_row_loop &416f a4 14 LDY &14 ; sprite_width ; plot_sprite_column_loop &4171 b9 33 c3 LDA &c333,Y # actually LDA sprite_address,Y &4174 8d 5d 03 STA &035d # actually STA screen_address &4177 38 SEC &4178 ad 75 41 LDA &4175 ; screen_address_low &417b e9 08 SBC #&08 # Move left four pixels &417d 8d 75 41 STA &4175 ; screen_address_low &4180 b0 03 BCS &4185 ; skip_screen_page &4182 ce 76 41 DEC &4176 ; screen_address_high ; skip_screen_page &4185 88 DEY &4186 d0 e9 BNE &4171 ; plot_sprite_column_loop &4188 18 CLC &4189 ad 72 41 LDA &4172 ; sprite_address_low &418c 65 14 ADC &14 ; columns_to_plot &418e 8d 72 41 STA &4172 ; sprite_address_low &4191 90 03 BCC &4196 ; skip_sprite_page &4193 ee 73 41 INC &4173 ; sprite_address_high ; skip_sprite_page &4196 c6 19 DEC &19 ; row_in_group &4198 a5 19 LDA &19 ; row_in_group &419a 29 07 AND #&07 &419c c9 07 CMP #&07 &419e f0 17 BEQ &41b7 ; move_up_a_group &41a0 38 SEC &41a1 a5 16 LDA &16 ; row_address_low &41a3 e9 01 SBC #&01 # Move up one row within group &41a5 85 16 STA &16 ; row_address_low &41a7 8d 75 41 STA &4175 ; screen_address_low &41aa a5 17 LDA &17 ; row_address_high &41ac e9 00 SBC #&00 &41ae 85 17 STA &17 ; row_address_high &41b0 8d 76 41 STA &4176 ; screen_address_high &41b3 ca DEX &41b4 d0 b9 BNE &416f ; plot_sprite_row_loop &41b6 60 RTS ; move_up_a_group &41b7 38 SEC &41b8 a5 16 LDA &16 ; row_address_low &41ba e5 03 SBC &03 ; group_size_minus_one_low # Move up one group &41bc 85 16 STA &16 ; row_address_low &41be 8d 75 41 STA &4175 ; screen_address_low &41c1 a5 17 LDA &17 ; row_address_high &41c3 e5 01 SBC &01 ; group_size_high &41c5 85 17 STA &17 ; row_address_high &41c7 8d 76 41 STA &4176 ; screen_address_high &41ca ca DEX &41cb d0 a2 BNE &416f ; plot_sprite_row_loop &41cd 60 RTS ; wipe_sprite &41ce a9 00 LDA #&00 # Set to zero to plot sprite, not wipe next time &41d0 85 1b STA &1b ; sprite_plotting_mode &41d2 a5 16 LDA &16 ; row_address_low &41d4 8d 00 42 STA &4200 ; bottom_screen_address_low &41d7 a5 17 LDA &17 ; row_address_high &41d9 8d 01 42 STA &4201 ; bottom_screen_address_high &41dc a5 13 LDA &13 ; sprite_y &41de 29 07 AND #&07 &41e0 85 1d STA &1d ; row_in_bottom_group &41e2 38 SEC &41e3 a5 15 LDA &15 ; sprite_height &41e5 e5 1d SBC &1d ; row_in_bottom_group &41e7 a8 TAY &41e8 4a LSR A &41e9 4a LSR A &41ea 4a LSR A &41eb 85 1e STA &1e ; groups &41ed 98 TYA &41ee 29 07 AND #&07 &41f0 85 20 STA &20 ; row_in_top_group &41f2 38 SEC &41f3 a9 07 LDA #&07 &41f5 e5 20 SBC &20 ; row_in_top_group &41f7 85 1f STA &1f ; seven_minus_row_in_top_group &41f9 a4 14 LDY &14 ; sprite_width # Wipe all or part of the bottom group of the sprite ; wipe_bottom_of_sprite_column_loop &41fb a9 00 LDA #&00 &41fd a6 1d LDX &1d ; row_in_bottom_group ; wipe_bottom_of_sprite_byte_loop &41ff 9d 00 01 STA &0100,X # Wipe up to eight rows in column # actually STA bottom_screen_address,X &4202 ca DEX &4203 10 fa BPL &41ff ; wipe_bottom_of_sprite_byte_loop &4205 38 SEC &4206 ad 00 42 LDA &4200 ; bottom_screen_address_low &4209 e9 08 SBC #&08 # Move left four pixels &420b 8d 00 42 STA &4200 ; bottom_screen_address_low &420e b0 03 BCS &4213 ; skip_page &4210 ce 01 42 DEC &4201 ; bottom_screen_address_high ; skip_page &4213 88 DEY &4214 d0 e5 BNE &41fb ; wipe_bottom_of_sprite_column_loop &4216 38 SEC &4217 ad 00 42 LDA &4200 ; bottom_screen_address_low # Move up a group &421a e5 04 SBC &04 ; group_size_minus_two_low &421c 8d 2e 42 STA &422e ; middle_screen_address_low &421f ad 01 42 LDA &4201 ; bottom_screen_address_high &4222 e5 01 SBC &01 ; group_size_high &4224 8d 2f 42 STA &422f ; middle_screen_address_high &4227 a4 1e LDY &1e ; groups # Wipe the middle of the sprite, whole groups ; wipe_middle_of_sprite_group_loop &4229 a9 00 LDA #&00 &422b a6 21 LDX &21 ; bytes_to_wipe ; wipe_middle_of_sprite_byte_loop &422d 9d 36 02 STA &0236,X # actaully STA middle_screen_address,X &4230 ca DEX &4231 10 fa BPL &422d ; wipe_middle_of_sprite_byte_loop &4233 38 SEC &4234 ad 2e 42 LDA &422e ; middle_screen_address_low &4237 e5 02 SBC &02 ; group_size_low # Move up a group &4239 8d 2e 42 STA &422e ; middle_screen_address_low &423c ad 2f 42 LDA &422f ; middle_screen_address_high &423f e5 01 SBC &01 ; group_size_high &4241 8d 2f 42 STA &422f ; middle_screen_address_high &4244 88 DEY &4245 d0 e2 BNE &4229 ; wipe_middle_of_sprite_group_loop &4247 a5 20 LDA &20 ; row_in_top_group # Are there any rows remaining? &4249 f0 2e BEQ &4279 ; leave # If not, leave &424b 18 CLC &424c ad 2e 42 LDA &422e ; middle_screen_address_low &424f 65 1f ADC &1f ; seven_minus_row_in_top_group &4251 8d 63 42 STA &4263 ; top_screen_address_low &4254 ad 2f 42 LDA &422f ; middle_screen_address_high &4257 69 00 ADC #&00 &4259 8d 64 42 STA &4264 ; top_screen_address_high &425c a4 14 LDY &14 ; sprite_width # Otherwise, wipe part of the top group of the sprite ; wipe_top_of_sprite_column_loop &425e a9 00 LDA #&00 &4260 a6 20 LDX &20 ; row_in_top_group ; wipe_top_of_sprite_byte_loop &4262 9d b2 03 STA &03b2,X # actually STA top_screen_address,X &4265 ca DEX &4266 d0 fa BNE &4262 ; wipe_top_of_sprite_byte_loop &4268 18 CLC &4269 ad 63 42 LDA &4263 ; top_screen_address_low &426c 69 08 ADC #&08 # Move right four pixels &426e 8d 63 42 STA &4263 ; top_screen_address_low &4271 90 03 BCC &4276 ; skip_page &4273 ee 64 42 INC &4264 ; top_screen_address_high ; skip_page &4276 88 DEY &4277 d0 e5 BNE &425e ; wipe_top_of_sprite_column_loop ; leave &4279 60 RTS ; palette_block &427a 00 00 00 00 00 ; 0 1 2 ; cave_types_r1 &427f 5c 48 34 ; cave_types_r2 &4282 67 5e 54 ; cave_types_r6 &4285 12 17 20 ; cave_types_r7 &4288 1c 1f 23 ; cave_types_lives_x &428b 16 10 12 ; cave_types_score_x &428e 58 44 2e ; cave_types_score_y &4291 0a 0a fc ; cave_types_time_x &4294 96 74 4a ; cave_types_pause_x &4297 74 60 4a ; cave_types_pause_y &429a 0c 0c fe ; cave_types_group_size_high &429d 02 02 01 ; cave_types_group_size_low &42a0 e0 40 a0 ; cave_types_group_size_minus_one_low &42a3 d9 39 99 ; cave_types_group_size_minus_two_low &42a6 d8 38 98 ; cave_types_border &42a9 ff 00 01 ; 0 1 2 3 4 5 6 7 8 9 a b c d e f 10 11 12 13 14 15 16 17 ; cave_type_0_border_sprite_widths &42ac 09 08 09 06 0a 09 09 1f 1f 1f 01 01 0c 10 10 10 10 10 10 10 10 10 10 10 ; cave_type_0_border_sprite_heights &42c4 0c 0c 0c 0c 0c 0c 0c 05 05 05 76 76 0a 0a 0a 0a 0a 0a 0d 0d 0d 0d 0d 0d ; cave_type_0_border_sprite_x_positions &42dc ac 9a 74 62 56 2c 1a 3d 79 b6 b6 00 b6 9e 7e 5e 3e 1e 9e b6 7e 5e 3e 1e ; cave_type_0_border_sprite_y_positions &42f4 0c 0c 0c 0c 0c 0c 0c 8f 8f 8f 8c 8c 16 16 16 16 16 16 0c 0c 0c 0c 0c 0c ; cave_type_0_border_sprite_addresses_low &430c 2b cb 2b 97 e7 2b 5f 97 97 97 97 97 87 e7 47 a7 07 67 97 97 97 97 97 97 ; cave_type_0_border_sprite_addresses_high &4324 46 45 46 46 44 46 45 47 47 47 47 47 4b 4a 4a 49 49 48 47 47 47 47 47 47 ; 0 1 2 3 4 5 6 7 8 9 a b c d e f 10 11 12 13 14 ; cave_type_1_border_sprite_widths &433c 09 08 09 06 0a 09 09 24 24 01 01 10 0c 10 10 10 10 10 10 10 10 ; cave_type_1_border_sprite_heights &4351 0c 0c 0c 0c 0c 0c 0c 05 05 9d 9d 0a 0a 0a 0a 0a 0d 0d 0d 0d 0d ; cave_type_1_border_sprite_x_positions &4366 8a 78 60 4e 42 26 14 46 8e 8e 00 7e 8e 5e 3e 1e 7e 8e 5e 3e 1e ; cave_type_1_border_sprite_y_positions &437b 0c 0c 0c 0c 0c 0c 0c b7 b7 b3 b3 16 16 16 16 16 0c 0c 0c 0c 0c ; cave_type_1_border_sprite_addresses_low &4390 2b cb 2b 97 e7 2b 5f 97 97 97 97 47 87 a7 07 67 97 97 97 97 97 ; cave_type_1_border_sprite_addresses_high &43a5 46 45 46 46 44 46 45 47 47 47 47 4a 4b 49 49 48 47 47 47 47 47 ; 0 1 2 3 4 5 6 7 8 9 a b c d e f 10 11 12 13 14 15 ; cave_type_2_border_sprite_widths &43ba 09 08 09 06 0a 09 09 12 12 12 01 01 01 01 10 0c 10 10 10 10 10 10 ; cave_type_2_border_sprite_heights &43d0 0c 0c 0c 0c 0c 0c 0c 09 09 09 71 71 71 71 0a 0a 0a 0a 0d 0d 0d 0d ; cave_type_2_border_sprite_x_positions &43e6 60 4e 4a 38 2c 28 16 22 42 66 00 66 66 00 5e 66 3e 1e 5e 66 3e 1e ; cave_type_2_border_sprite_y_positions &43fc 0c 0c fe fe fe 0c 0c ff ff ff 87 87 f8 f8 16 16 16 16 0c 0c 0c 0c ; cave_type_2_border_sprite_addresses_low &4412 2b cb 2b 97 e7 2b 5f 97 97 97 97 97 97 97 a7 87 07 67 97 97 97 97 ; cave_type_2_border_sprite_addresses_high &4428 46 45 46 46 44 46 45 47 47 47 47 47 47 47 49 4b 49 48 47 47 47 47 ; digit_sprite_addresses_low_table &443e 47 57 67 77 87 97 a7 b7 c7 d7 ; digit_sprites &4448 3f cf 7e e7 e7 e7 e7 e7 e7 e7 e7 e7 f3 cf 78 87 &4458 7f ef f1 cb 3d 8f 3d 8f 3d 8f 3f 8f 79 8f 3c 0f &4468 7f ef f3 c3 79 8f 3c cf 1e e7 6f e7 f3 cf 78 87 &4478 3f cf 7e e7 c3 e7 1f cf 3c e7 6f e7 f3 cf 78 87 &4488 0f cf 1e cf 7f ef f6 cf f3 cf 79 cf 3c cf 1e 87 &4498 3f cf 7e e7 c3 e7 0f e7 7f cf f6 87 f7 ef f0 c3 &44a8 3f cf 7e e7 e7 e7 f7 cf f6 87 f3 0f 79 cf 3c 87 &44b8 3f 0f 7b 0f 7b 0f 79 8f 3c cf 1e e7 7f ef f0 c3 &44c8 3f cf 7e e7 e7 e7 f3 cf 7e e7 e7 e7 f3 cf 78 87 &44d8 3f 8f 78 cf 1e e7 3f ef 7e e7 e7 e7 f3 cf 78 87 ; score_box_left_sprite &44e8 3c f0 f0 f0 f0 f0 f0 f0 f0 f0 69 0f 0f 0f 0f 0f &44f8 0f 0f 0f 0f e3 3f cf 7f 8f ff 3f 0f 3f cf 87 7e &4508 e7 fc df f9 fb 0f 7e 87 87 c3 f6 de b5 bd fb 0f &4518 f7 ef 87 3f de cf fd bd fb bf f6 e7 87 7e 96 f7 &4528 bc ff 7b 6f f3 cf 87 e7 6f f0 1e e1 69 c3 78 87 &4538 87 f3 cf 0f 0f 0f 0f 0f 0f 0f e3 78 87 0f 0f 0f &4548 0f 0f 0f 0f 69 0f 0f 0f 0f 0f 0f 0f 0f 0f 3c f0 &4558 f0 f0 f0 f0 f0 f0 f0 f0 ; lives_box_left_sprite &4560 3c f0 f0 f0 f0 f0 f0 f0 f0 69 0f 0f 0f 0f 0f 0f &4570 0f 0f e3 7f ef ff 3f 0f ff 3f ef 87 f6 d2 e7 7f &4580 9f e9 78 f3 87 e7 0f f6 de fd ff 9f ef 87 e7 0f &4590 f6 de fd f9 bf c3 87 e7 0f fe de fc ff 79 ff 87 &45a0 e7 1e d2 96 96 e1 3c e1 87 e7 0f 6f 0f 0f 0f 0f &45b0 0f e3 c3 0f c3 0f 0f 0f 0f 0f 69 0f 0f 0f 0f 0f &45c0 0f 0f 0f 3c f0 f0 f0 f0 f0 f0 f0 f0 ; time_box_left_sprite &45cc 3c f0 f0 f0 f0 f0 f0 f0 69 0f 0f 0f 0f 0f 0f 0f &45dc e3 1f 8f ff 6f 3f 3f cf 87 3d 9e e7 f6 fb 7e 87 &45ec 87 3d 8f e7 f6 fb f7 ef 87 3d 8f e7 f7 ff f6 e7 &45fc 87 3d 8f ef f3 e7 f3 cf 87 3d 9e c3 69 c3 78 87 &460c 87 7f ef 6f 0f 0f 0f 0f e3 f0 c3 c3 0f 0f 0f 0f &461c 69 0f 0f 0f 0f 0f 0f 0f 3c f0 f0 f0 f0 f0 f0 f0 ; box_right_sprite &462c f0 f0 f0 f0 f0 f0 f0 f0 c3 0f 0f 0f 0f 0f 0f 0f &463c 0f 69 0f 0f 0f 0f 0f 0f 0f 0f 7c 0f 0f 0f 0f 0f &464c 0f 0f 0f 1e 0f 0f 0f 0f 0f 0f 0f 0f 1e 0f 0f 0f &465c 0f 0f 0f 0f 0f 1e 0f 0f 0f 0f 0f 0f 0f 0f 1e 0f &466c 0f 0f 0f 0f 0f 0f 0f 1e 0f 0f 0f 0f 0f 0f 0f 0f &467c 1e 0f 0f 0f 0f 0f 0f 0f 0f 7c 0f 0f 0f 0f 0f 0f &468c 0f 0f 69 f0 f0 f0 f0 f0 f0 f0 f0 c3 ; box_middle_sprite &4698 f0 f0 f0 f0 f0 f0 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f &46a8 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f &46b8 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f &46c8 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f &46d8 0f 0f f0 f0 f0 f0 f0 f0 ; game_frozen_sprite &46e0 0f 0f 3f cf 7f df 8f cf ff 0f 1f 8f 3f 0f 3f cf &46f0 ff cf ff 3f 3f 0f 0f 0f 0f 7e e7 fc fd fa df e9 &4700 0f 3d 8f 7b 0f 7e f6 f6 97 e9 7b 7b 0f 0f 0f 0f &4710 e7 f6 f7 fd fa fd ff 8f 3d 8f 7b 0f e7 e7 f3 3d &4720 ff fb 7b 0f 0f 0f 0f e7 ef f0 fd ff fd f9 8f 3d &4730 ff 7b bf e7 e7 79 bd f9 fb 7b 0f 0f 0f 0f f6 c3 &4740 7f bc fd bc ff 0f 3d e9 7b 6f f3 cf ff fc ff 7b &4750 ef 0f 0f 0f 0f e7 6f f0 1e b4 1e e1 0f 3d 8f 69 &4760 c3 78 96 f0 96 e1 78 c3 0f 0f 0f 0f f3 cf 0f 0f &4770 0f 0f 0f 0f 3d ff 8f 0f 0f 0f 0f 0f 0f 0f 0f 0f &4780 0f 0f 0f 78 87 0f 0f 0f 0f 0f 0f 3c f0 0f 0f 0f &4790 0f 0f 0f 0f 0f 0f 0f 0f ; wall_sprite &4798 2d c3 4b 4b 4b 1e 4b 69 1e 4b a5 a5 87 a5 2d 4b &47a8 96 2d 4b 87 69 78 c3 5a 1e 1e 4b c3 5a 1e d2 3c &47b8 78 2d a5 96 96 c3 4b d2 3c 1e 2d 2d 2d 2d 4b c3 &47c8 2d 78 1e 69 2d 4b 78 4b c3 e1 1e c3 a5 4b 2d 4b &47d8 69 4b 96 2d 2d 4b 5a 2d 2d a5 1e 3c 5a c3 1e a5 &47e8 5a 4b 96 1e e1 3c 87 f0 2d 96 96 2d 4b 2d f0 2d &47f8 87 87 e1 96 1e 1e 4b 96 5a d2 69 2d 2d 1e 1e 3c &4808 2d 1e 4b 69 3c b4 78 87 e1 3c 1e 5a 3c 96 1e 4b &4818 3c e1 4b a5 4b 4b 4b 5a 1e 1e 2d 4b c3 a5 2d 4b &4828 4b 4b 78 1e c3 2d a5 4b 96 2d 96 87 96 2d 69 2d &4838 87 a5 2d 1e 3c d2 1e a5 a5 a5 a5 4b 4b d2 96 96 &4848 3c 1e e1 2d 2d 1e 0f 96 4b 4b c3 2d 4b 2d 4b 69 &4858 4b 1e 1e 2d 2d 0f 96 0f 4b 4b 2d 2d 4b 2d 4b 4b ; cave_roof_one_sprite &4868 f0 00 60 00 10 c0 00 00 00 00 00 00 10 80 00 00 &4878 96 80 70 00 30 48 00 00 10 00 00 00 30 c0 00 00 &4888 5a 80 d2 00 21 c0 00 00 30 80 00 00 21 48 00 00 &4898 2d d0 96 00 61 48 00 30 e1 c0 00 20 21 68 00 00 &48a8 2d 78 5a 00 52 48 00 e1 2d 48 00 70 21 a4 00 00 &48b8 5a 2d 3c 00 43 c0 10 96 3c 68 00 52 b0 2c f0 00 &48c8 96 c3 5a 80 c3 48 30 69 a5 b4 00 c3 a1 78 96 00 &48d8 2d 4b 87 d0 87 e0 30 0f 4b 96 f0 a5 e1 87 96 80 &48e8 2d 2d 96 78 1e 3c e1 87 87 87 87 a5 4b 87 a5 80 &48f8 96 2d a5 2d a5 0f 87 96 69 78 5a 1e 3c 5a 2d f0 ; cave_roof_two_sprite &4908 00 00 00 00 30 80 00 00 00 00 00 00 00 00 60 00 &4918 00 00 00 00 61 c0 00 00 00 00 00 00 00 00 e0 00 &4928 00 00 00 00 43 48 00 00 00 00 00 00 00 00 a4 00 &4938 00 00 00 00 52 c0 00 00 00 00 00 30 80 10 a4 00 &4948 00 00 00 00 e1 48 00 00 00 c0 00 61 c0 10 3c 00 &4958 00 00 00 10 a5 78 c0 00 00 e0 00 43 48 10 5a 00 &4968 00 00 00 10 1e 96 68 00 10 b4 80 c3 68 30 96 10 &4978 30 c0 00 30 1e 5a 2c 00 10 0f f0 87 a4 21 1e 30 &4988 61 78 80 e1 78 2d 3c 00 10 1e 1e 5a 3c 30 96 e1 &4998 c3 4b f0 d2 87 e1 3c f0 f0 b4 1e 2d 96 e1 69 87 ; cave_roof_three_sprite &49a8 00 00 00 00 00 00 00 30 00 00 00 30 80 00 00 00 &49b8 00 00 00 00 70 00 20 30 80 00 00 21 c0 00 00 00 &49c8 00 00 00 20 52 80 70 21 80 00 00 61 68 00 00 30 &49d8 00 00 00 70 43 80 d2 a1 80 30 f0 c3 a4 00 e0 61 &49e8 00 00 00 52 43 80 87 a1 80 61 2d 3c 3c 90 a4 c3 &49f8 00 00 00 d2 61 c0 d2 a1 80 52 a5 5a 1e f0 3c b4 &4a08 c0 00 10 b4 52 48 a5 b0 c0 c3 5a 4b a5 2d 3c 0f &4a18 68 00 f0 1e 43 58 a5 a1 58 a5 5a 5a 69 2d 4b 87 &4a28 3c 10 c3 96 43 d0 1e e1 78 5a 87 96 1e d2 4b 96 &4a38 5a f0 3c 5a f0 78 2d 1e 0f 87 4b 96 1e 1e b4 2d ; cave_roof_four_sprite &4a48 00 00 00 00 00 00 00 00 00 00 00 30 f0 80 00 00 &4a58 00 00 00 00 00 00 30 00 00 00 00 e1 c3 f0 00 00 &4a68 c0 00 00 00 00 00 70 00 00 00 10 96 3c 1e 80 00 &4a78 78 c0 00 00 00 00 52 80 00 00 30 69 0f 87 80 00 &4a88 4b 68 00 00 00 00 43 f0 00 00 30 2d 0f d2 c0 00 &4a98 96 2c 00 00 00 00 43 96 f0 00 61 96 5a 2d 68 00 &4aa8 a5 b4 00 00 00 10 e1 96 3c 80 43 e1 a5 87 3c 80 &4ab8 4b 5a 00 00 00 30 5a 1e 4b 80 d2 4b 4b 4b c3 c0 &4ac8 a5 5a 90 e0 00 61 5a 69 4b f0 96 3c e1 5a 1e 68 &4ad8 1e 2d f0 3c f0 c3 87 87 2d 2d 1e 2d 1e 5a 1e 3c ; cave_roof_five_sprite &4ae8 00 00 00 00 00 00 00 e0 00 00 00 00 00 00 00 00 &4af8 00 00 00 00 00 00 10 b4 c0 00 00 00 00 00 00 00 &4b08 00 00 00 00 00 00 10 0f 68 00 00 00 00 00 00 00 &4b18 00 00 00 70 00 00 30 a5 b4 00 00 00 00 00 70 00 &4b28 00 00 00 d2 80 00 61 78 1e 00 30 00 00 00 d2 80 &4b38 00 20 00 61 b0 80 d2 4b d2 00 70 80 00 10 c3 80 &4b48 00 70 00 d2 e1 c0 87 a5 3c 00 43 e0 00 30 4b c0 &4b58 00 52 10 a5 5a 78 d2 2d 68 00 e1 b4 f0 e1 96 68 &4b68 30 d2 b0 1e 2d 5a 3c d2 48 30 87 87 4b b4 b4 3c &4b78 e1 2d e1 96 5a 96 2d 0f f0 e1 96 1e 87 4b 4b 87 ; cave_roof_six_sprite &4b88 00 00 00 00 00 00 00 00 00 00 10 f0 00 70 00 00 &4b98 00 00 00 00 00 00 10 0f 00 d2 80 00 00 00 00 00 &4ba8 00 00 00 d2 00 c3 80 00 00 30 e0 30 c0 00 00 96 &4bb8 00 a5 c0 00 00 61 b4 e1 68 00 00 d2 00 a5 78 80 &4bc8 00 c3 4b 2d 78 00 00 e1 00 c3 87 c0 00 a5 4b 69 &4bd8 96 00 00 43 00 b4 5a 48 10 96 3c 96 3c 00 00 61 &4be8 90 d2 69 68 30 69 2d 4b d2 80 70 d2 f0 4b 96 b4 &4bf8 e1 2d 4b 4b 87 f0 c3 96 ; decrypt_main_binary &4c00 ad 05 02 LDA &0205 ; irq1_vector_high &4c03 8d 0a 4e STA &4e0a ; main_binary_key + 10 &4c06 78 SEI &4c07 a2 09 LDX #&09 &4c09 a9 00 LDA #&00A ; disable_event_flags_loop &4c0b 9d bf 02 STA &02bf,X ; os_event_enable_flags &4c0e ca DEX &4c0f 10 fa BPL &4c0b ; disable_event_flags_loop &4c11 ad b7 ff LDA &ffb7 ; os_rom_default_vector_table_address_low &4c14 85 80 STA &80 ; default_vectors_address_low &4c16 ad b8 ff LDA &ffb8 ; os_rom_default_vector_table_address_high &4c19 85 81 STA &81 ; default_vectors_address_high &4c1b ac b6 ff LDY &ffb6 ; os_rom_vector_table_length &4c1e 88 DEY ; reset_vector_table_loop &4c1f b1 80 LDA (&80),Y ; default_vectors_address &4c21 99 00 02 STA &0200,Y ; os_vector_table &4c24 88 DEY &4c25 10 f8 BPL &4c1f ; reset_vector_table_loop &4c27 58 CLI &4c28 a9 02 LDA #&02 # Clear memory on BREAK &4c2a 8d 58 02 STA &0258 ; ESCAPE/BREAK effect &4c2d a9 00 LDA #&00 &4c2f 85 72 STA &72 ; start_address_low &4c31 85 40 STA &40 ; decrypt_address_low &4c33 a9 04 LDA #&04 &4c35 85 41 STA &41 ; decrypt_address_high &4c37 a9 4c LDA #&4c &4c39 85 73 STA &73 ; start_address_high &4c3b a9 ff LDA #&ff &4c3d 85 74 STA &74 ; end_address_low &4c3f a9 4d LDA #&4d &4c41 85 75 STA &75 ; end_address_high &4c43 20 03 4f JSR &4f03 ; calculate_checksum # Checksum &4c00 - &4dff (main binary decryption code) &4c46 a5 70 LDA &70 ; checksum_low &4c48 8d 0d 4e STA &4e0d ; main_binary_key + 13 &4c4b a5 71 LDA &71 ; checksum_high &4c4d 8d 0e 4e STA &4e0e ; main_binary_key + 14 ; decrypt_0400_to_26ff_loop # Decrypt &0400 - &26ff &4c50 a0 00 LDY #&00 ; decrypt_0400_to_26ff_inner_loop &4c52 b1 40 LDA (&40),Y ; decrypt_address &4c54 4d 03 4e EOR &4e03 ; main_binary_key + 3 &4c57 18 CLC &4c58 6d 0d 4e ADC &4e0d ; main_binary_key + 13 &4c5b 4d 0c 4e EOR &4e0c ; main_binary_key + 12 &4c5e 4d 00 4e EOR &4e00 ; main_binary_key &4c61 38 SEC &4c62 ed 02 4e SBC &4e02 ; main_binary_key + 2 &4c65 4d 0e 4e EOR &4e0e ; main_binary_key + 14 &4c68 4d 08 4e EOR &4e08 ; main_binary_key + 8 &4c6b 18 CLC &4c6c 6d 01 4e ADC &4e01 ; main_binary_key + 1 &4c6f 91 40 STA (&40),Y ; decrypt_address &4c71 88 DEY &4c72 d0 de BNE &4c52 ; decrypt_0400_to_26ff_inner_loop &4c74 e6 41 INC &41 ; address_high &4c76 a5 41 LDA &41 ; address_high &4c78 c9 27 CMP #&27 &4c7a 30 d4 BMI &4c50 ; decrypt_0400_to_26ff_loop ; decrypt_2700_to_4bff_loop # Decrypt &2700 - &4bff differently &4c7c a0 00 LDY #&00 ; decrypt_2700_to_4bff_inner_loop &4c7e b1 40 LDA (&40),Y ; decrypt_address &4c80 4d 0b 4e EOR &4e0b ; main_binary_key + 11 &4c83 18 CLC &4c84 6d 05 4e ADC &4e05 ; main_binary_key + 5 &4c87 38 SEC &4c88 ed 0d 4e SBC &4e0d ; main_binary_key + 13 &4c8b 4d 0a 4e EOR &4e0a ; main_binary_key + 10 &4c8e 4d 04 4e EOR &4e04 ; main_binary_key + 4 &4c91 4d 06 4e EOR &4e06 ; main_binary_key + 6 &4c94 18 CLC &4c95 6d 07 4e ADC &4e07 ; main_binary_key + 7 &4c98 4d 09 4e EOR &4e09 ; main_binary_key + 9 &4c9b 4d 0c 4e EOR &4e0c ; main_binary_key + 12 &4c9e 91 40 STA (&40),Y ; decrypt_address &4ca0 88 DEY &4ca1 d0 db BNE &4c7e ; decrypt_2700_to_4bff_inner_loop &4ca3 e6 41 INC &41 ; decrypt_address_high &4ca5 a5 41 LDA &41 ; decrypt_address_high &4ca7 c9 4c CMP #&4c &4ca9 30 d1 BMI &4c7c ; decrypt_2700_to_4bff_loop ; flush_sound_buffers &4cab a2 04 LDX #&04 ; Sound channel 0 &4cad a9 15 LDA #&15 ; Flush buffer ; flush_sound_buffers_loop &4caf 20 f4 ff JSR &fff4 ; OSBYTE &4cb2 e8 INX &4cb3 e0 08 CPX #&08 &4cb5 30 f8 BMI &4caf ; flush_sound_buffers_loop &4cb7 a9 00 LDA #&00 # Zero to allow sound &4cb9 8d 62 02 STA &0262 ; os_sound_suppression &4cbc a9 95 LDA #&95 &4cbe 8d 20 02 STA &0220 ; event_vector_low &4cc1 a9 28 LDA #&28 ; &2895 = event_handler &4cc3 8d 21 02 STA &0221 ; event_vector_high &4cc6 a9 00 LDA #&00 &4cc8 85 30 STA &30 ; time &4cca 85 31 STA &31 ; time + 1 &4ccc 85 34 STA &34 ; player_lives &4cce 85 35 STA &35 ; player_lives + 1 &4cd0 85 38 STA &38 ; score &4cd2 85 39 STA &39 ; score + 1 &4cd4 85 3a STA &3a ; score + 2 &4cd6 85 3b STA &3b ; score + 3 &4cd8 85 09 STA &09 ; game_number &4cda 8d 62 02 STA &0262 ; os_sound_suppression # Unnecessary, already set at &4cb9 &4cdd 8d 76 02 STA &0276 ; os_escape_effect_flag &4ce0 a9 19 LDA #&19 &4ce2 8d 52 02 STA &0252 ; os_mark_period_counter &4ce5 8d 53 02 STA &0253 ; os_space_period_counter &4ce8 a9 1b LDA #&1b &4cea 8d 6c 02 STA &026c ; os_escape_character_value &4ced a9 80 LDA #&80 &4cef 8d 8e 02 STA &028e ; os_available_ram &4cf2 60 RTS ; unused &4cf3 20 20 20 20 20 31 20 0d ; " 1 \r" ; unused # Not meaningful &4cfb 83 c0 53 a0 0d a3 c0 d8 a3 bf f3 d8 54 a0 8f 61 &4d0b 91 c8 98 21 37 8b 41 26 71 85 59 d4 68 bd c2 f8 &4d1b 60 23 4f 34 32 c4 35 e0 ee 2a ff d6 a8 d6 f8 5d &4d2b 08 2d 0b 70 7f 16 c6 74 15 b5 b1 b8 3d 4e 43 15 &4d3b 51 8a dc 14 35 1e ce 5c a0 fb ec 8c c2 &4d48 20 20 20 20 20 20 20 20 ; " " &4d50 20 42 4f 46 46 49 4e 20 ; " BOFFIN " &4d58 5f 5f 5f 5f 5f 5f 5f 5f ; "________" &4d60 43 6f 70 79 72 69 67 68 ; "Copyrigh" &4d68 74 28 43 29 20 41 64 64 ; "t(C) Add" &4d70 69 63 74 69 76 65 20 47 ; "ictive G" &4d78 61 6d 65 73 20 31 39 38 ; "ames 198" &4d80 35 20 20 2a 20 20 55 6e ; "5 * Un" &4d88 61 75 74 68 6f 72 69 73 ; "authoris" &4d90 65 64 20 43 6f 70 79 69 ; "ed Copyi" &4d98 6e 67 2c 20 48 69 72 69 ; "ng, Hiri" &4da0 6e 67 2c 20 6f 72 20 4c ; "ng, or L" &4da8 65 6e 64 69 6e 67 20 6f ; "ending o" &4db0 66 20 74 68 69 73 20 50 ; "f this P" &4db8 72 6f 64 75 63 74 20 69 ; "roduct i" &4dc0 73 20 50 52 4f 48 49 42 ; "s PROHIB" &4dc8 49 54 45 44 20 20 2a 20 ; "ITED * " &4dd0 47 61 6d 65 20 44 65 73 ; "Game Des" &4dd8 69 67 6e 65 64 20 61 6e ; "igned an" &4de0 64 20 57 72 69 74 74 65 ; "d Writte" &4de8 6e 20 62 79 3a 20 20 20 ; "n by: " &4df0 20 20 50 61 75 6c 20 20 ; " Paul " &4df8 4f 27 4d 61 6c 6c 65 79 ; "O'Malley"