; $.XOR ; FF1100 FF3380 005500 ; Various addresses used in zero-page: ; &40 channel3dataptr ; &41 channel3dataptr_h ; &50 screenlookupoffset ; &53 temp ; &54 temp_h ; &55 redrawpiece ; &56 screenlookupptr ; &57 screenlookupptr_h ; &58 screenaddr ; &59 screenaddr_h ; &5a spritelookupptr ; &5b spritelookupptr_h ; &5c redrawx ; &5d redrawy ; &69 playerdirection / playerdirectionframecount ; &6a playerscreenaddr ; &6b playerscreenaddr_h ; &70 playeraddr ; &71 playeraddr_h ; &72 playerxoffset ; &73 playeryoffset ; &74 viewpointx ; &75 viewpointy ; &76 viewpointaddr ; &77 viewpointaddr_h ; &78 address_map_tl ; &79 address_map_tl_h ; &7a address_map_tr ; &7b address_map_tr_h ; &7c address_map_bl ; &7d address_map_bl_h ; &7e address_map_br ; &7f address_map_br_h ; &80 address_player1 ; &81 address_player1_h ; &82 player1offsetx ; &83 player1offsety ; &84 view1x ; &85 view1y ; &86 address_view1 ; &87 address_view1_h ; &88 address_player2 ; &89 address_player2_h ; &8a player2offsetx ; &8b player2offsety ; &8c view2x ; &8d view2y ; &8e address_view2 ; &8f address_view2_h ; &90 currentplayer ; &91 otherplayerok ; &92 masktotal ; &93 maskcount ; &94 listlength ; &95 explosionnumber ; &96 switched ; &97 - ; &98 address_teleport1 ; &99 address_teleport1_h ; &9a teleport1offsetx ; &9b teleport1offsety ; &9c viewteleport1x ; &9d viewteleport1y ; &9e address_viewteleport1 ; &9f address_viewteleport1_h ; &a0 address_teleport2 ; &a1 address_teleport2_h ; &a2 teleport2offsetx ; &a3 teleport2offsety ; &a4 viewteleport2x ; &a5 viewteleport2y ; &a6 address_viewteleport2 ; &a7 address_viewteleport2_h ; &a8 address_mover ; &a9 address_mover_h ; &aa address_mover_new ; &ab address_mover_new_h ; &ac playermotion ; &ad address_teleport ; &ad address_teleport_h ; &af moverisdoll ; &b0 dolldirection ; &b1 isreplay ; &b2 movecount%2 ; &b3 replayaddr ; &b4 replayaddr_h ; &b5 tempreplay ; &b6 movetype ; addresses are as after memory shifting ; run length encoded screen background &0700 80 ff 80 ff 06 f8 80 ff 80 ff 06 f0 80 ff 80 ff &0710 06 f0 80 ff 80 ff 06 f0 80 ff 80 ff 06 f0 80 ff &0720 80 ff 06 f0 80 ff 80 ff 06 f0 80 ff 80 ff 06 f0 &0730 80 ff 80 ff 06 f0 8a ff ff f0 f0 77 77 bb bb ff &0740 ff f0 80 f0 06 ff 80 f0 80 f0 06 ff 80 f0 80 f0 &0750 06 ff 80 f0 80 f0 06 ff 80 f0 80 f0 06 ff 80 f0 &0760 80 f0 06 ff 80 f0 80 f0 06 ff 88 f0 f0 ff ff ee &0770 ee ff ff f0 80 f0 04 70 80 ff 80 ff 06 f0 80 ff &0780 80 ff 06 f0 80 ff 80 ff 06 f0 80 ff 80 ff 06 f0 &0790 80 ff 80 ff 06 f0 80 ff 80 ff 06 f0 80 ff 80 ff &07a0 06 f0 80 ff 80 ff 06 f0 80 ff 80 ff 06 f0 80 ff &07b0 80 ff 04 f0 82 ff f6 ff 80 ff 04 f0 82 ff f0 ff &07c0 80 ff 04 f0 82 ff f0 ff 80 ff 04 f0 82 ff f0 ff &07d0 80 ff 04 f0 82 fe fc ff 80 ff 06 f0 80 ff 80 ff &07e0 06 f0 80 ff 80 ff 06 f0 80 ff 80 ff 06 f0 80 ff &07f0 80 ff 06 f0 80 ff 80 ff 06 f0 80 ff 80 ff 06 f1 &0800 08 f8 40 f0 82 dd dd ee 80 ee 08 ff 82 77 77 cc &0810 80 cc 06 ff 80 00 80 00 06 ff 80 00 80 00 06 ff &0820 80 00 80 00 06 ff 80 00 80 00 06 ff 80 00 80 00 &0830 06 ff 84 11 11 cc cc 88 80 88 04 00 08 70 48 f0 &0840 84 f6 f3 f3 f1 f1 06 f0 84 f8 f8 fc fc f6 09 f0 &0850 92 f1 f1 f3 f3 f6 f6 fc fc f8 f8 f1 f1 f3 f3 f3 &0860 f0 f0 ff f8 80 f8 05 f0 88 f8 fc fc f6 f6 f6 f0 &0870 f0 f7 05 f3 82 f0 f0 ff 07 f0 84 f8 fc fc f6 f6 &0880 80 f6 08 f0 08 f1 04 f8 82 e8 e8 f9 80 f9 04 f0 &0890 82 ff ff 77 80 77 04 f0 04 ff 04 f0 04 ff 04 f0 &08a0 04 ff 04 f0 04 ff 04 f0 04 ff 04 f0 04 ff 04 f0 &08b0 08 ff 82 77 77 bb 80 bb 08 cc 28 00 08 11 08 00 &08c0 06 70 80 77 80 77 06 f0 80 ff 80 ff 06 f0 80 ff &08d0 80 ff 06 f0 80 ff 80 ff 06 f0 80 ff 80 ff 06 f0 &08e0 80 ff 80 ff 06 f0 80 ff 80 ff 06 f0 80 ff 80 ff &08f0 06 f0 80 ff 80 ff 06 f0 80 70 80 70 08 f0 84 f6 &0900 f3 f3 f1 f1 04 f0 88 f1 f1 fb ff fe fe f4 fc f8 &0910 80 f8 05 f0 08 f3 08 f0 08 f6 08 f3 07 f0 80 ff &0920 05 f6 82 fc fc f8 08 f0 08 f1 08 f9 84 bb bb dd &0930 dd ee 80 ee 09 ff 80 88 07 ff 80 00 07 ff 80 00 &0940 07 ff 80 00 07 ff 80 00 07 ff 80 00 07 ff 88 00 &0950 dd dd ee ee ff ff ff 00 04 cc 82 44 44 cc 29 00 &0960 07 11 88 00 00 00 11 11 33 ff ff 00 07 ff 80 00 &0970 07 ff 80 00 07 ff 80 00 07 ff 80 00 07 ff 80 00 &0980 07 ff 80 00 07 ff 80 00 07 ff 84 11 ee ee cc cc &0990 04 88 08 70 0a f0 8a f1 f1 f3 f3 f6 f6 fe fe ff &09a0 fb f1 80 f1 06 f0 82 f8 f8 fc 80 fc 08 f3 08 f0 &09b0 08 f6 08 f3 84 f6 f2 f3 f1 f1 80 f1 07 f0 82 f8 &09c0 f8 f8 08 f0 08 f1 08 f9 08 ff 08 88 7f 00 31 00 &09d0 08 11 08 88 08 70 8e f0 f0 f1 f1 f3 f3 f6 ff fc &09e0 fc f8 f8 f0 f0 f0 80 ff 07 f0 94 ff f6 f6 f3 f3 &09f0 f1 f1 f0 ff f3 f1 f1 f0 f8 f8 fc fe f0 f8 f8 ff &0a00 04 f0 82 f6 fc fc 80 f8 04 f0 82 f3 f3 f3 80 f7 &0a10 07 f0 80 f8 04 f0 82 fc f4 f6 80 f7 0c f0 08 f1 &0a20 08 f9 7f ff 49 ff 08 88 04 70 82 51 51 62 80 62 &0a30 04 f0 04 ff 04 f0 04 ff 04 f0 04 ff 04 f0 04 ff &0a40 04 f0 04 ff 04 f0 04 ff 04 f0 04 ff 04 f0 04 ff &0a50 04 f0 04 ff 04 f0 04 ff 04 f0 82 dc dc 98 80 98 &0a60 08 f1 08 f9 08 ff 7f 00 41 00 08 88 08 73 80 77 &0a70 80 77 06 88 80 ff 80 ff 06 00 80 ff 80 ff 06 00 &0a80 80 ff 80 ff 06 00 80 ff 80 ff 06 00 80 ff 80 ff &0a90 06 00 80 ff 80 ff 06 00 80 ff 80 ff 06 00 80 ff &0aa0 80 ff 06 00 80 ff 80 ff 06 11 08 10 08 f1 08 f9 &0ab0 08 ff 7f 00 41 00 08 88 08 73 08 88 40 00 08 11 &0ac0 08 10 08 f1 08 f9 08 ff 7f 00 41 00 08 88 08 73 &0ad0 08 88 40 00 08 11 08 10 08 f1 08 f9 08 ff 7f 00 &0ae0 41 00 08 88 08 73 08 88 40 00 08 11 08 10 08 f1 &0af0 08 f9 08 ff 7f 00 41 00 08 88 08 73 08 88 40 00 &0b00 08 11 08 10 08 f1 08 f9 08 ff 7f 00 41 00 08 88 &0b10 08 73 08 88 40 00 08 11 08 10 08 f1 08 f9 08 ff &0b20 7f 00 41 00 08 88 08 73 08 88 40 00 08 11 08 10 &0b30 08 f1 08 f9 08 ff 7f 00 41 00 08 88 08 73 08 88 &0b40 40 00 08 11 08 10 08 f1 08 f9 08 ff 7f 00 41 00 &0b50 08 88 08 73 08 88 40 00 08 11 08 10 08 f1 08 f9 &0b60 08 ff 7f 00 41 00 08 88 08 73 06 88 80 ff 80 ff &0b70 06 00 80 ff 80 ff 06 00 80 ff 80 ff 06 00 80 ff &0b80 80 ff 06 00 80 ff 80 ff 06 00 80 ff 80 ff 06 00 &0b90 80 ff 80 ff 06 00 80 ff 80 ff 06 00 80 ff 80 ff &0ba0 06 11 80 ff 80 ff 08 10 08 f1 08 f9 08 ff 7f 00 &0bb0 41 00 08 88 86 73 73 62 62 40 40 70 80 70 06 00 &0bc0 80 f0 80 f0 06 00 80 f0 80 f0 06 00 80 f0 80 f0 &0bd0 06 00 80 f0 80 f0 06 00 80 f0 80 f0 06 00 80 f0 &0be0 80 f0 06 00 80 f0 80 f0 06 00 80 f0 80 f0 06 00 &0bf0 80 f0 80 f0 06 00 88 f0 f0 98 98 54 54 32 32 f0 &0c00 80 f0 08 f1 08 f9 08 ff 7f 00 41 00 08 88 08 70 &0c10 58 f0 08 f1 08 f9 08 ff 7f 00 41 00 08 88 08 70 &0c20 58 f0 08 f1 08 f9 08 ff 7f 00 41 00 08 88 08 70 &0c30 86 b3 b3 d5 d5 e6 e6 f7 80 f7 06 ff 80 00 80 00 &0c40 06 ff 80 00 80 00 06 ff 80 00 80 00 06 ff 80 00 &0c50 80 00 06 ff 80 00 80 00 06 ff 80 00 80 00 06 ff &0c60 80 00 80 00 06 ff 80 00 80 00 06 ff 80 00 80 00 &0c70 04 ff 84 ee ee 22 22 b9 80 b9 06 31 08 f9 08 ff &0c80 7f 00 41 00 08 88 08 70 08 f7 48 00 08 22 08 31 &0c90 08 f9 08 ff 7f 00 41 00 08 88 08 70 08 f7 48 00 &0ca0 08 22 08 31 08 f9 08 ff 7f 00 41 00 08 88 08 70 &0cb0 08 f7 48 00 08 22 08 31 08 f9 08 ff 7f 00 41 00 &0cc0 08 88 08 70 04 f7 86 e6 e6 c4 c4 00 00 ff 80 ff &0cd0 06 00 80 ff 80 ff 06 00 80 ff 80 ff 06 00 80 ff &0ce0 80 ff 06 00 80 ff 80 ff 06 00 80 ff 80 ff 06 00 &0cf0 80 ff 80 ff 06 00 80 ff 80 ff 06 00 80 ff 80 ff &0d00 04 00 86 22 22 ee ee 11 11 00 80 00 06 31 80 b9 &0d10 80 b9 08 f9 08 ff 7f 00 41 00 08 88 08 70 80 80 &0d20 80 80 06 f0 80 00 80 00 06 f0 80 00 80 00 06 f0 &0d30 80 00 80 00 06 f0 80 00 80 00 06 f0 80 00 80 00 &0d40 06 f0 80 00 80 00 06 f0 80 00 80 00 06 f0 80 00 &0d50 80 00 06 f0 80 00 80 00 06 f0 80 00 80 00 06 f0 &0d60 80 75 80 75 06 f1 08 f9 08 ff 7f 00 41 00 08 88 &0d70 08 70 88 f0 b3 b3 d5 d5 e6 e6 f7 f0 06 ff 80 00 &0d80 80 f0 06 ff 80 00 80 f0 06 ff 80 00 80 f0 06 ff &0d90 80 00 80 f0 06 ff 80 00 80 f0 06 ff 80 00 80 f0 &0da0 06 ff 80 00 80 f0 06 ff 80 00 80 f0 06 ff 80 00 &0db0 80 f0 04 ff 84 ee ee 22 f1 b9 80 b9 05 31 08 f9 &0dc0 08 ff 7f 00 41 00 08 88 08 70 08 f7 48 00 08 22 &0dd0 08 31 08 f9 08 ff 7f 00 41 00 08 88 08 70 08 f7 &0de0 48 00 08 22 08 31 08 f9 08 ff 7f 00 41 00 08 88 &0df0 08 70 08 f7 48 00 08 22 08 31 08 f9 08 ff 7f 00 &0e00 41 00 08 88 08 70 8a f7 f7 f7 e6 e6 c4 c4 80 00 &0e10 ff ff 06 00 80 ff 80 ff 06 00 80 ff 80 ff 06 00 &0e20 80 ff 80 ff 06 00 80 ff 80 ff 06 00 80 ff 80 ff &0e30 06 00 80 ff 80 ff 06 00 80 ff 80 ff 06 00 80 ff &0e40 80 ff 05 00 86 22 ee ee 11 11 00 00 80 00 05 31 &0e50 82 b9 b9 75 08 f9 88 ff ff cc cc 88 88 00 00 ff &0e60 80 ff 06 00 80 ff 80 ff 06 00 80 ff 80 ff 06 00 &0e70 80 ff 80 ff 06 00 80 ff 80 ff 06 00 80 ff 80 ff &0e80 06 00 80 ff 80 ff 06 00 80 ff 80 ff 06 00 80 ff &0e90 80 ff 06 00 80 ff 80 ff 06 00 80 ff 80 ff 06 00 &0ea0 80 ff 80 ff 06 00 80 ff 80 ff 06 00 80 ff 80 ff &0eb0 06 00 80 ff 80 ff 06 00 80 ff 80 ff 06 00 80 ff &0ec0 80 ff 06 00 80 ff 80 ff 06 00 80 ff 80 ff 06 00 &0ed0 80 ff 80 ff 06 00 80 ff 80 ff 06 00 80 ff 80 ff &0ee0 06 00 80 ff 80 ff 06 00 80 ff 80 ff 06 00 86 88 &0ef0 88 44 44 22 22 11 80 11 08 70 80 80 07 f0 80 00 &0f00 07 f0 80 00 07 f0 80 00 07 f0 80 00 07 f0 80 00 &0f10 07 f0 80 00 07 f0 80 00 07 f0 80 00 07 f0 80 00 &0f20 07 f0 80 00 07 f0 80 75 07 f1 80 e8 80 e8 04 f8 &0f30 82 ff ff 00 80 00 04 f0 82 ff ff 00 80 00 04 f0 &0f40 82 ff ff 00 80 00 04 f0 82 ff ff 00 80 00 04 f0 &0f50 82 ff ff 00 80 00 04 f0 82 ff ff 00 80 00 04 f0 &0f60 82 ff ff 00 80 00 04 f0 82 ff ff 00 80 00 04 f0 &0f70 82 ff ff 00 80 00 04 f0 82 ff ff 00 80 00 04 f0 &0f80 82 ff ff 00 80 00 04 f0 82 ff ff 00 80 00 04 f0 &0f90 82 ff ff 00 80 00 04 f0 82 ff ff 00 80 00 04 f0 &0fa0 82 ff ff 00 80 00 04 f0 82 ff ff 00 80 00 04 f0 &0fb0 82 ff ff 00 80 00 04 f0 82 ff ff 00 80 00 04 f0 &0fc0 82 ff ff 00 80 00 04 f0 82 ff ff 00 80 00 04 f0 &0fd0 82 ff ff 00 80 00 04 f0 82 ff ff 00 80 00 04 f0 &0fe0 82 ff ff 00 80 00 04 f0 82 ff ff 00 80 00 04 f0 &0ff0 82 ff ff 00 80 00 04 f0 82 ff ff 00 80 00 04 f0 &1000 82 ff ff f8 80 f8 04 f0 80 ff 80 ff 06 f0 80 ff &1010 80 ff 06 f0 80 ff 80 ff 06 f0 80 ff 80 ff 06 f0 &1020 80 ff 80 ff 06 f0 80 ff 80 ff 06 f0 80 ff 80 ff &1030 06 f0 80 ff 80 ff 06 f0 80 ff 80 ff 06 f0 80 ff &1040 80 ff 06 f0 80 ff 80 ff 06 f0 80 ff 80 ff 06 f1 &1050 82 ff 00 00 80 00 04 f0 82 ff ff 00 80 00 04 f0 &1060 82 ff ff 00 80 00 04 f0 82 ff ff 00 80 00 04 f0 &1070 82 ff ff 00 80 00 04 f0 82 ff ff 00 80 00 04 f0 &1080 82 ff ff 00 80 00 04 f0 82 ff ff 00 80 00 04 f0 &1090 82 ff ff 00 80 00 04 f0 82 ff ff 00 80 00 04 f0 &10a0 82 ff ff 00 80 00 04 f0 82 ff ff 00 80 00 04 f0 &10b0 82 ff ff 00 80 00 04 f0 82 ff ff 00 80 00 04 f0 &10c0 82 ff ff 00 80 00 04 f0 82 ff ff 00 80 00 04 f0 &10d0 82 ff ff 00 80 00 04 f0 82 ff ff 00 80 00 04 f0 &10e0 82 ff ff 00 80 00 04 f0 82 ff ff 00 80 00 04 f0 &10f0 82 ff ff 00 80 00 04 f0 82 ff ff 00 80 00 04 f0 ; redraw() ; Redraw all pieces on screen &1100 redraw a2 00 LDX #&00 &1102 86 50 STX &50; screenlookupoffset &1104 a5 77 LDA &77; viewpointaddr_h &1106 85 54 STA &54; temp_h &1108 a5 76 LDA &76; viewpointaddr &110a 85 53 STA &53; temp ; (&53) = temporary viewpoint &110c a2 00 LDX #&00 &110e redrawloop1 a0 00 LDY #&00 &1110 redrawloop2 b1 53 LDA (&53),Y; temp ; get piece from viewpoint &1112 29 0f AND #&0f &1114 85 55 STA &55; redrawpiece &1116 86 5c STX &5c; redrawx &1118 84 5d STY &5d; redrawy &111a a4 50 LDY &50; screenlookupoffset &111c b1 56 LDA (&56),Y; screenlookupptr &111e c8 INY &111f 85 58 STA &58; screenaddr &1121 b1 56 LDA (&56),Y; screenlookupptr &1123 85 59 STA &59; screenaddr_h &1125 a5 55 LDA &55; redrawpiece &1127 20 2d 11 JSR &112d; plotpiece &112a 4c 5e 11 JMP &115e; redraw2 ; plotpiece(A = type of piece, (&58) = screen address) &112d plotpiece 0a ASL &112e a8 TAY &112f b1 5a LDA (&5a),Y; spritelookupptr ; get piece sprite address &1131 8d 3f 11 STA &113f ; store in self modifying code &1134 c8 INY &1135 b1 5a LDA (&5a),Y; spritelookupptr &1137 8d 40 11 STA &1140 &113a a2 00 LDX #&00 &113c plotpieceloop1 a0 00 LDY #&00 &113e plotpieceloop2 bd 00 80 LDA &8000,X ; self modifying code &1141 91 58 STA (&58),Y; screenaddr ; to screen address &1143 e8 INX &1144 c8 INY &1145 c0 18 CPY #&18 ; 24 bytes across &1147 d0 f5 BNE &113e; plotpieceloop2 &1149 e0 48 CPX #&48 ; 72 rows &114b f0 10 BEQ &115d; plotpieceend &114d a5 58 LDA &58; screenaddr &114f 18 CLC &1150 69 40 ADC #&40 ; add &140 for next row on screen &1152 85 58 STA &58; screenaddr &1154 a5 59 LDA &59; screenaddr_h &1156 69 01 ADC #&01 &1158 85 59 STA &59; screenaddr_h &115a 4c 3c 11 JMP &113c; plotpieceloop1 &115d plotpieceend 60 RTS &115e redraw2 a6 5c LDX &5c; redrawx &1160 a4 5d LDY &5d; redrawy &1162 c8 INY &1163 e6 50 INC &50; screenlookupoffset &1165 e6 50 INC &50; screenlookupoffset &1167 c0 08 CPY #&08 &1169 d0 a5 BNE &1110; redrawloop2 ; do next column &116b e8 INX &116c 18 CLC &116d a5 53 LDA &53; temp &116f 69 20 ADC #&20 ; increase viewpoint by one row &1171 85 53 STA &53; temp &1173 90 02 BCC &1177 &1175 e6 54 INC &54; temp_h &1177 e0 08 CPX #&08 ; do next row &1179 d0 93 BNE &110e; redrawloop1 &117b 60 RTS ; unused &117c 4c 87 11 JMP &1187; getplayerscraddr ; used for plotplayerline &117f ff 11 33 77 &1183 00 88 cc ee ; getplayerscraddr() ; Get screen address of player &1187 getplayerscraddr a5 73 LDA &73; playeryoffset &1189 0a ASL &118a 0a ASL &118b 0a ASL &118c 18 CLC &118d 65 72 ADC &72; playerxoffset &118f 0a ASL &1190 a8 TAY &1191 b1 56 LDA (&56),Y; screenlookupptr &1193 85 6a STA &6a; playerscreenaddr &1195 c8 INY &1196 b1 56 LDA (&56),Y; screenlookupptr &1198 85 6b STA &6b; playerscreenaddr_h &119a 60 RTS &119b plotplayer a5 6a LDA &6a; playerscreenaddr ; &6a-b = player screen address &119d 85 5e STA &5e &119f a5 6b LDA &6b; playerscreenaddr_h &11a1 85 5f STA &5f ; &5e-f = player screen address &11a3 a9 6d LDA #&6d &11a5 85 61 STA &61 &11a7 a9 12 LDA #&12 ; &61-2 = &126d &11a9 85 62 STA &62 ; = current player sprite &11ab a0 18 LDY #&18 &11ad plotplayerloop1 98 TYA &11ae 85 6c STA &6c &11b0 20 ba 11 JSR &11ba; plotplayerline &11b3 a5 6c LDA &6c &11b5 a8 TAY &11b6 88 DEY &11b7 d0 f4 BNE &11ad; plotplayerloop1 &11b9 60 RTS &11ba plotplayerline a0 00 LDY #&00 &11bc 8c 6d 12 STY &126d &11bf b1 61 LDA (&61),Y ; &61-2 = current player sprite &11c1 99 6a 12 STA &126a,Y &11c4 c8 INY &11c5 c0 03 CPY #&03 &11c7 d0 f6 BNE &11bf &11c9 a4 60 LDY &60 &11cb c0 00 CPY #&00 &11cd f0 3a BEQ &1209; isstep0 &11cf a9 00 LDA #&00 &11d1 85 66 STA &66 &11d3 b9 7f 11 LDA &117f,Y &11d6 85 65 STA &65 &11d8 98 TYA &11d9 49 03 EOR #&03 &11db a8 TAY &11dc c8 INY &11dd a2 00 LDX #&00 &11df 84 64 STY &64 &11e1 a5 65 LDA &65 &11e3 3d 6a 12 AND &126a,X &11e6 85 63 STA &63 &11e8 a5 65 LDA &65 &11ea 49 ff EOR #&ff &11ec 3d 6a 12 AND &126a,X &11ef a4 60 LDY &60 &11f1 4a LSR &11f2 88 DEY &11f3 d0 fc BNE &11f1 &11f5 05 66 ORA &66 &11f7 9d 6a 12 STA &126a,X &11fa a5 63 LDA &63 &11fc a4 64 LDY &64 &11fe 0a ASL &11ff 88 DEY &1200 d0 fc BNE &11fe &1202 85 66 STA &66 &1204 e8 INX &1205 e0 04 CPX #&04 &1207 d0 d8 BNE &11e1 &1209 isstep0 a6 60 LDX &60 &120b a0 00 LDY #&00 &120d bd 83 11 LDA &1183,X &1210 31 5e AND (&5e),Y ; player screen address &1212 0d 6a 12 ORA &126a &1215 8d 6a 12 STA &126a &1218 a0 18 LDY #&18 &121a bd 7f 11 LDA &117f,X &121d 31 5e AND (&5e),Y ; player screen address &121f 0d 6d 12 ORA &126d &1222 8d 6d 12 STA &126d &1225 a2 00 LDX #&00 &1227 a0 00 LDY #&00 &1229 loop1 bd 6a 12 LDA &126a,X &122c 91 5e STA (&5e),Y ; player screen address &122e a5 5e LDA &5e &1230 18 CLC &1231 69 08 ADC #&08 &1233 85 5e STA &5e &1235 90 02 BCC &1239 &1237 e6 5f INC &5f ; player screen address +=8 &1239 e8 INX &123a e0 04 CPX #&04 &123c d0 eb BNE &1229; loop1 &123e a5 5e LDA &5e &1240 38 SEC &1241 e9 1f SBC #&1f &1243 85 5e STA &5e &1245 a5 5f LDA &5f &1247 e9 00 SBC #&00 &1249 85 5f STA &5f &124b a5 5e LDA &5e &124d 29 07 AND #&07 &124f d0 0d BNE &125e &1251 a5 5e LDA &5e &1253 18 CLC &1254 69 38 ADC #&38 &1256 85 5e STA &5e &1258 a5 5f LDA &5f &125a 69 01 ADC #&01 &125c 85 5f STA &5f ; player screen address += &138 &125e a5 61 LDA &61 &1260 18 CLC &1261 69 03 ADC #&03 &1263 85 61 STA &61 ; current player sprite +=3 &1265 90 02 BCC &1269 &1267 e6 62 INC &62 &1269 60 RTS ; temporary line for currentplayersprite &126a 00 00 00 &126d currentplayersprite 00 00 70 &1270 f0 e2 70 f0 e2 70 f4 e2 70 fe e2 71 ff e2 73 fb &1280 ea 77 f1 ee 76 f0 ee 74 f0 e6 70 f0 e2 70 f4 e2 &1290 70 fe e2 71 ff e2 73 fb ea 77 f1 ee 76 f0 ee 74 &12a0 f0 e6 30 f0 c4 30 f0 c4 10 f0 88 00 f1 00 00 62 &12b0 00 00 00 00 00 &12b5 plotheromove 85 69 STA &69 ; direction of motion &12b7 20 87 11 JSR &1187; getplayerscraddr ; returns player screen address in &6a/b &12ba a9 00 LDA #&00 &12bc 85 60 STA &60 &12be a5 69 LDA &69 ; direction of motion &12c0 d0 04 BNE &12c6 ; &69 = 0 player swaps &12c2 20 9b 11 JSR &119b; plotplayer &12c5 60 RTS &12c6 c9 01 CMP #&01 ; &69 = 1 player moves down &12c8 d0 03 BNE &12cd &12ca 4c 39 13 JMP &1339; plotheromovedown &12cd c9 02 CMP #&02 ; &69 = 2 player moves up &12cf d0 03 BNE &12d4 &12d1 4c 5c 13 JMP &135c; plotheromoveup &12d4 c9 04 CMP #&04 ; &69 = 4 player moves right &12d6 d0 03 BNE &12db &12d8 4c e3 12 JMP &12e3; plotheromoveright &12db c9 08 CMP #&08 ; &69 = 8 player moves left &12dd d0 03 BNE &12e2 &12df 4c 0d 13 JMP &130d; plotheromoveleft &12e2 60 RTS &12e3 plotheromoveright a9 03 LDA #&03 &12e5 85 69 STA &69 ; frame count &12e7 plotheromoveright2 e6 60 INC &60 &12e9 20 9b 11 JSR &119b; plotplayer &12ec e6 60 INC &60 &12ee 20 9b 11 JSR &119b; plotplayer &12f1 e6 60 INC &60 &12f3 20 9b 11 JSR &119b; plotplayer &12f6 a5 6a LDA &6a; playerscreenaddr &12f8 18 CLC &12f9 69 08 ADC #&08 &12fb 85 6a STA &6a; playerscreenaddr &12fd 90 02 BCC &1301 &12ff e6 6b INC &6b; playerscreenaddr_h &1301 a9 00 LDA #&00 &1303 85 60 STA &60 &1305 20 9b 11 JSR &119b; plotplayer &1308 c6 69 DEC &69 &130a d0 db BNE &12e7; plotheromoveright2 &130c 60 RTS &130d plotheromoveleft a9 03 LDA #&03 &130f 85 69 STA &69 &1311 a5 6a LDA &6a; playerscreenaddr &1313 38 SEC &1314 e9 08 SBC #&08 &1316 85 6a STA &6a; playerscreenaddr &1318 c9 f8 CMP #&f8 &131a d0 02 BNE &131e &131c c6 6b DEC &6b; playerscreenaddr_h &131e a9 03 LDA #&03 &1320 85 60 STA &60 &1322 20 9b 11 JSR &119b; plotplayer &1325 c6 60 DEC &60 &1327 20 9b 11 JSR &119b; plotplayer &132a c6 60 DEC &60 &132c 20 9b 11 JSR &119b; plotplayer &132f c6 60 DEC &60 &1331 20 9b 11 JSR &119b; plotplayer &1334 c6 69 DEC &69 &1336 d0 d9 BNE &1311 &1338 60 RTS &1339 plotheromovedown a9 18 LDA #&18 &133b 85 69 STA &69 &133d e6 6a INC &6a; playerscreenaddr &133f a5 6a LDA &6a; playerscreenaddr &1341 29 07 AND #&07 &1343 d0 0f BNE &1354 &1345 c6 6a DEC &6a; playerscreenaddr &1347 18 CLC &1348 a5 6a LDA &6a; playerscreenaddr &134a 69 39 ADC #&39 &134c 85 6a STA &6a; playerscreenaddr &134e a5 6b LDA &6b; playerscreenaddr_h &1350 69 01 ADC #&01 &1352 85 6b STA &6b; playerscreenaddr_h &1354 20 9b 11 JSR &119b; plotplayer &1357 c6 69 DEC &69 &1359 d0 e2 BNE &133d &135b 60 RTS &135c plotheromoveup a9 18 LDA #&18 &135e 85 69 STA &69 &1360 c6 6a DEC &6a; playerscreenaddr &1362 a5 6a LDA &6a; playerscreenaddr &1364 29 07 AND #&07 &1366 c9 07 CMP #&07 &1368 d0 0f BNE &1379 &136a e6 6a INC &6a; playerscreenaddr &136c 38 SEC &136d a5 6a LDA &6a; playerscreenaddr &136f e9 39 SBC #&39 &1371 85 6a STA &6a; playerscreenaddr &1373 a5 6b LDA &6b; playerscreenaddr_h &1375 e9 01 SBC #&01 &1377 85 6b STA &6b; playerscreenaddr_h &1379 20 9b 11 JSR &119b; plotplayer &137c c6 69 DEC &69 &137e d0 e0 BNE &1360 &1380 60 RTS ; unused code? &1381 d0 cc BNE &134f &1383 c6 61 DEC &61 &1385 d0 c4 BNE &134b &1387 e6 75 INC &75; viewpointy &1389 c6 60 DEC &60 &138b d0 87 BNE &1314 &138d 60 RTS &138e 00 BRK &138f 00 BRK &1390 mainloop ad 54 1d LDA &1d54; gotmask &1393 f0 03 BEQ &1398 &1395 20 c3 18 JSR &18c3; updatemap &1398 a0 00 LDY #&00 &139a 4c af 1e JMP &1eaf; checkplayersok &139d a0 01 LDY #&01 &139f 4c af 1e JMP &1eaf; checkplayersok &13a2 a5 94 LDA &94; listlength ; are there movers? &13a4 f0 03 BEQ &13a9 &13a6 4c 61 19 JMP &1961; processmovers &13a9 a9 00 LDA #&00 &13ab 85 af STA ⁡ moverisdoll &13ad 8d 54 1d STA &1d54; gotmask &13b0 ea NOP &13b1 ea NOP &13b2 20 00 28 JSR &2800; getkey &13b5 ea NOP &13b6 ea NOP &13b7 ea NOP &13b8 ea NOP &13b9 ea NOP &13ba a6 b1 LDX &b1; isreplay &13bc f0 0e BEQ &13cc; premoves &13be c9 a2 CMP #&a2 ; &22 = E &13c0 f0 0e BEQ &13d0; premoves2 &13c2 c9 d4 CMP #&d4 ; &54 = H (pause) &13c4 f0 ec BEQ &13b2 &13c6 20 8b 22 JSR &228b; getreplaymove &13c9 4c d0 13 JMP &13d0; premoves2 &13cc premoves c9 00 CMP #&00 &13ce f0 c0 BEQ &1390; mainloop &13d0 premoves2 c9 e1 CMP #&e1 ; &61 = Z &13d2 f0 18 BEQ &13ec; moveleft &13d4 c9 c2 CMP #&c2 ; &42 = X &13d6 f0 30 BEQ &1408; moveright &13d8 c9 c8 CMP #&c8 ; &48 = : &13da f0 25 BEQ &1401; moveup &13dc c9 e8 CMP #&e8 ; &68 = / &13de f0 13 BEQ &13f3; movedown &13e0 c9 c9 CMP #&c9 ; &49 = RETURN &13e2 f0 16 BEQ &13fa; moveswap &13e4 c9 a2 CMP #&a2 ; &22 = E &13e6 f0 27 BEQ &140f; moveend &13e8 4c 90 13 JMP &1390; mainloop &13eb 60 RTS &13ec moveleft a2 03 LDX #&03 &13ee 86 b6 STX &b6; movetype &13f0 4c 1e 14 JMP &141e; moveleftmain &13f3 movedown a2 01 LDX #&01 &13f5 86 b6 STX &b6; movetype &13f7 4c 69 16 JMP &1669; movedownmain ; movedown &13fa moveswap a2 04 LDX #&04 &13fc 86 b6 STX &b6; movetype &13fe 4c 5f 17 JMP &175f; moveswap ; moveswap &1401 moveup a2 00 LDX #&00 &1403 86 b6 STX &b6; movetype &1405 4c a5 15 JMP &15a5; moveupmain ; moveup &1408 moveright a2 02 LDX #&02 &140a 86 b6 STX &b6; movetype &140c 4c e8 14 JMP &14e8; moverightmain ; moveright &140f moveend a6 b1 LDX &b1; isreplay &1411 d0 05 BNE &1418 &1413 a2 0f LDX #&0f &1415 20 4e 22 JSR &224e; storemove &1418 a9 00 LDA #&00 &141a 60 RTS &141b moveleftcant 4c 90 13 JMP &1390; mainloop &141e moveleftmain a0 1f LDY #&1f &1420 b1 70 LDA (&70),Y; playeraddr ; get piece to left of player &1422 20 f6 18 JSR &18f6; playercanmove &1425 e0 01 CPX #&01 ; can't move left if WALL, MAGUS or QUAESTOR &1427 f0 f2 BEQ &141b; moveleftcant &1429 e0 ff CPX #&ff ; have we finished? &142b d0 03 BNE &1430; moveleftnotsolved &142d 4c 3e 1d JMP &1d3e; levelsolved ; if so, return with A = 1 &1430 moveleftnotsolved c9 06 CMP #&06 ; can't move left if WAVES &1432 f0 e7 BEQ &141b; moveleftcant &1434 c9 08 CMP #&08 ; can't move left if CHICKEN &1436 f0 e3 BEQ &141b; moveleftcant &1438 c9 0a CMP #&0a ; can't move left if V_BOMB &143a f0 df BEQ &141b; moveleftcant &143c c9 07 CMP #&07 ; if it's a FISH... &143e d0 06 BNE &1446; moveleftnotfish &1440 20 55 1d JSR &1d55; canpushleft ; can we push it? &1443 4c 4d 14 JMP &144d; moveleftfish &1446 moveleftnotfish c9 09 CMP #&09 ; ...or an H_BOMB... &1448 d0 0a BNE &1454; moveleftnothbomb &144a 20 55 1d JSR &1d55; canpushleft ; can we push it? &144d moveleftfish e0 01 CPX #&01 ; can't move left if can't push it &144f f0 ca BEQ &141b; moveleftcant &1451 4c aa 14 JMP &14aa; moveleftdoit ; &1454 moveleftnothbomb c9 0e CMP #&0e ; if it's a TELEPORT... &1456 d0 35 BNE &148d; moveleftnotteleport &1458 20 4e 20 JSR &204e; canteleport ; check that there are two teleports &145b e0 01 CPX #&01 &145d f0 bc BEQ &141b; moveleftcant ; can't move left if there aren't &145f a9 1f LDA #&1f &1461 85 ac STA ∾ playermotion ; playermotion = &1f (left one space) &1463 a9 08 LDA #&08 &1465 20 b5 12 JSR &12b5; plotheromove &1468 20 39 1f JSR &1f39; doteleport ; check that there's a free exit space &146b e0 00 CPX #&00 &146d d0 ac BNE &141b; moveleftcant ; can't move left if there isn't &146f 20 05 21 JSR &2105; movecounter ; increment move counter &1472 a0 20 LDY #&20 &1474 a9 00 LDA #&00 &1476 91 60 STA (&60),Y ; blank original position &1478 20 2c 20 JSR &202c; storeplayerstate &147b 20 bf 1c JSR &1cbf; vacatedspaceleft &147e 20 3d 20 JSR &203d; restoreplayerstate &1481 a5 90 LDA &90; currentplayer &1483 a0 20 LDY #&20 &1485 91 70 STA (&70),Y; playeraddr ; store player in new position &1487 20 00 11 JSR &1100; redraw &148a 4c 90 13 JMP &1390; mainloop &148d moveleftnotteleport c9 0f CMP #&0f ; if it's a SWITCH... &148f d0 06 BNE &1497; moveleftnotswitch &1491 20 73 20 JSR &2073; pressswitch ; switch the lights &1494 4c aa 14 JMP &14aa; moveleftdoit &1497 moveleftnotswitch c9 0d CMP #&0d ; if it's a DOLL... &1499 d0 0f BNE &14aa; moveleftdoit &149b a9 1f LDA #&1f ; dolldirection = &1f (left one space) &149d 85 b0 STA &b0; dolldirection &149f a9 01 LDA #&01 &14a1 85 af STA ⁡ moverisdoll &14a3 20 55 1d JSR &1d55; canpushleft ; can we push it? &14a6 e0 01 CPX #&01 &14a8 f0 3b BEQ &14e5; moverightcant ; can't move left if can't push it &14aa moveleftdoit 20 bf 1c JSR &1cbf; vacatedspaceleft &14ad 20 05 21 JSR &2105; movecounter ; increment move counter &14b0 a9 00 LDA #&00 &14b2 a0 20 LDY #&20 &14b4 91 70 STA (&70),Y; playeraddr ; blank current space &14b6 a5 70 LDA &70; playeraddr &14b8 38 SEC &14b9 e9 01 SBC #&01 ; move current space left &14bb 85 70 STA &70; playeraddr &14bd a5 71 LDA &71; playeraddr_h &14bf e9 00 SBC #&00 &14c1 85 71 STA &71; playeraddr_h &14c3 a5 90 LDA &90; currentplayer &14c5 91 70 STA (&70),Y; playeraddr ; store current player in new space &14c7 ad f5 18 LDA &18f5; gotmap ; playercanmove sets gotmap = 1 if MAP &14ca f0 03 BEQ &14cf; moveleftnotmap ; if it's a MAP... &14cc 20 8a 18 JSR &188a; drawmap ; ...redraw the map. &14cf moveleftnotmap a5 72 LDA &72; playerxoffset ; X offset from viewpoint &14d1 c9 01 CMP #&01 ; do we need to scroll left? &14d3 f0 0a BEQ &14df; moveleftredraw ; redraw viewpoint if so &14d5 a9 08 LDA #&08 &14d7 20 b5 12 JSR &12b5; plotheromove &14da c6 72 DEC &72; playerxoffset ; shift player in viewpoint &14dc 4c 90 13 JMP &1390; mainloop &14df moveleftredraw 4c 2c 17 JMP &172c; redrawviewl &14e2 moverightredraw2 4c 33 17 JMP &1733; redrawviewr &14e5 moverightcant 4c 90 13 JMP &1390; mainloop &14e8 moverightmain a0 21 LDY #&21 &14ea b1 70 LDA (&70),Y; playeraddr ; get piece to right of player &14ec 20 f6 18 JSR &18f6; playercanmove &14ef e0 01 CPX #&01 ; can't move right if WALL, MAGUS or QUAESTOR &14f1 f0 e9 BEQ &14dc &14f3 e0 ff CPX #&ff ; have we finished? &14f5 d0 03 BNE &14fa; moverightnotsolved &14f7 4c 3e 1d JMP &1d3e; levelsolved ; if so, return with A = 1 &14fa moverightnotsolved c9 06 CMP #&06 ; can't move right if WAVES &14fc f0 e7 BEQ &14e5; moverightcant &14fe c9 08 CMP #&08 ; can't move right if CHICKEN &1500 f0 e3 BEQ &14e5; moverightcant &1502 c9 0a CMP #&0a ; can't move right if V_BOMB &1504 f0 df BEQ &14e5; moverightcant &1506 c9 07 CMP #&07 ; if it's a FISH.... &1508 d0 06 BNE &1510; moverightnotfish &150a 20 a0 1d JSR &1da0; canpushright ; can we push it? &150d 4c 17 15 JMP &1517; moverightfish &1510 moverightnotfish c9 09 CMP #&09 ; ...or an H_BOMB... &1512 d0 0a BNE &151e; moverightnothbomb &1514 20 a0 1d JSR &1da0; canpushright ; can we push it? &1517 moverightfish e0 01 CPX #&01 &1519 f0 ca BEQ &14e5; moverightcant ; can't move right if can't push it &151b 4c 74 15 JMP &1574; moverightdoit &151e moverightnothbomb c9 0e CMP #&0e ; if it's a TELEPORT... &1520 d0 35 BNE &1557; moverightnotteleport &1522 20 4e 20 JSR &204e; canteleport ; check that there are two teleports &1525 e0 01 CPX #&01 &1527 f0 bc BEQ &14e5; moverightcant ; can't move right if there aren't &1529 a9 21 LDA #&21 &152b 85 ac STA ∾ playermotion ; playermotion = &21 (right one space) &152d a9 04 LDA #&04 &152f 20 b5 12 JSR &12b5; plotheromove &1532 20 39 1f JSR &1f39; doteleport ; check that there's a free exit space &1535 e0 00 CPX #&00 &1537 d0 ac BNE &14e5; moverightcant ; can't move right if there isn't &1539 20 05 21 JSR &2105; movecounter ; increment move counter &153c a0 20 LDY #&20 &153e a9 00 LDA #&00 &1540 91 60 STA (&60),Y ; blank original position &1542 20 2c 20 JSR &202c; storeplayerstate &1545 20 ff 1c JSR &1cff; vacatedspaceright &1548 20 3d 20 JSR &203d; restoreplayerstate &154b a5 90 LDA &90; currentplayer &154d a0 20 LDY #&20 &154f 91 70 STA (&70),Y; playeraddr ; store player in new position &1551 20 00 11 JSR &1100; redraw &1554 4c 90 13 JMP &1390; mainloop &1557 moverightnotteleport c9 0f CMP #&0f ; if it's a SWITCH... &1559 d0 06 BNE &1561; moverightnotswitch &155b 20 73 20 JSR &2073; pressswitch ; switch the lights &155e 4c 74 15 JMP &1574; moverightdoit &1561 moverightnotswitch c9 0d CMP #&0d ; if it's a DOLL... &1563 d0 0f BNE &1574; moverightdoit &1565 a9 21 LDA #&21 ; dolldirection = &21 (right one space) &1567 85 b0 STA &b0; dolldirection &1569 a9 01 LDA #&01 &156b 85 af STA ⁡ moverisdoll &156d 20 a0 1d JSR &1da0; canpushright ; can we push it? &1570 e0 01 CPX #&01 &1572 f0 2b BEQ &159f; moveupcant ; can't move right if can't push it &1574 moverightdoit 20 ff 1c JSR &1cff; vacatedspaceright &1577 20 05 21 JSR &2105; movecounter ; increment move counter &157a a9 00 LDA #&00 &157c a0 20 LDY #&20 &157e 91 70 STA (&70),Y; playeraddr ; blank current position &1580 e6 70 INC &70; playeraddr &1582 d0 02 BNE &1586 &1584 e6 71 INC &71; playeraddr_h ; move current position right &1586 a5 90 LDA &90; currentplayer &1588 91 70 STA (&70),Y; playeraddr ; store player in new position &158a ad f5 18 LDA &18f5; gotmap ; playercanmove sets gotmap = 1 if MAP &158d f0 03 BEQ &1592; moverightnotmap ; if it's a MAP... &158f 20 8a 18 JSR &188a; drawmap ; redraw the map &1592 moverightnotmap a5 72 LDA &72; playerxoffset ; x offset from the viewpoint &1594 c9 06 CMP #&06 ; do we need to scroll right? &1596 f0 0a BEQ &15a2; moverightredraw ; redraw viewpoint if so &1598 a9 04 LDA #&04 &159a 20 b5 12 JSR &12b5; plotheromove &159d e6 72 INC &72; playerxoffset ; shift player in viewpoint &159f moveupcant 4c 90 13 JMP &1390; mainloop &15a2 moverightredraw 4c e2 14 JMP &14e2; moverightredraw2 &15a5 moveupmain a0 00 LDY #&00 &15a7 b1 70 LDA (&70),Y; playeraddr ; get piece above player &15a9 20 f6 18 JSR &18f6; playercanmove &15ac e0 01 CPX #&01 ; can't move up if WALL, MAGUS or QUAESTOR &15ae f0 ef BEQ &159f; moveupcant &15b0 e0 ff CPX #&ff ; have we finished? &15b2 d0 03 BNE &15b7; moveupnotsolved &15b4 4c 3e 1d JMP &1d3e; levelsolved ; if so, return with A = 1 &15b7 moveupnotsolved c9 05 CMP #&05 ; can't move up if DOTS &15b9 f0 e4 BEQ &159f; moveupcant &15bb c9 07 CMP #&07 ; can't move up if FISH &15bd f0 e0 BEQ &159f; moveupcant &15bf c9 09 CMP #&09 ; can't move up if H_BOMB &15c1 f0 dc BEQ &159f; moveupcant &15c3 c9 08 CMP #&08 ; if it's a FISH... &15c5 d0 06 BNE &15cd; moveupnotchicken &15c7 20 eb 1d JSR &1deb; canpushup ; can we push it? &15ca 4c d4 15 JMP &15d4; moveupchicken &15cd moveupnotchicken c9 0a CMP #&0a ; or a V_BOMB... &15cf d0 0a BNE &15db; moveupnotvbomb &15d1 20 eb 1d JSR &1deb; canpushup ; can we push it? &15d4 moveupchicken e0 01 CPX #&01 ; can't move up if we can't push it &15d6 f0 c7 BEQ &159f; moveupcant &15d8 4c 31 16 JMP &1631; moveupdoit &15db moveupnotvbomb c9 0e CMP #&0e ; if it's a TELEPORT... &15dd d0 35 BNE &1614; moveupnotteleport &15df 20 4e 20 JSR &204e; canteleport ; check that there are two teleports &15e2 e0 01 CPX #&01 &15e4 f0 b9 BEQ &159f; moveupcant ; can't move up if there aren't &15e6 a9 00 LDA #&00 &15e8 85 ac STA ∾ playermotion ; playermotion = &00 (up one space) &15ea a9 02 LDA #&02 &15ec 20 b5 12 JSR &12b5; plotheromove &15ef 20 39 1f JSR &1f39; doteleport ; check that there's a free exit space &15f2 e0 00 CPX #&00 &15f4 d0 a9 BNE &159f; moveupcant ; can't move up if there isn't &15f6 20 05 21 JSR &2105; movecounter ; increment move counter &15f9 a0 20 LDY #&20 &15fb a9 00 LDA #&00 &15fd 91 60 STA (&60),Y ; blank original player &15ff 20 2c 20 JSR &202c; storeplayerstate &1602 20 0f 1d JSR &1d0f; vacatedspaceup &1605 20 3d 20 JSR &203d; restoreplayerstate &1608 a5 90 LDA &90; currentplayer &160a a0 20 LDY #&20 &160c 91 70 STA (&70),Y; playeraddr ; store player in new position &160e 20 00 11 JSR &1100; redraw &1611 4c 90 13 JMP &1390; mainloop &1614 moveupnotteleport c9 0f CMP #&0f ; if it's a SWITCH... &1616 d0 06 BNE &161e; moveupnotswitch &1618 20 73 20 JSR &2073; pressswitch ; switch the lights &161b 4c 31 16 JMP &1631; moveupdoit &161e moveupnotswitch c9 0d CMP #&0d ; if it's a DOLL... &1620 d0 0f BNE &1631; moveupdoit &1622 a9 00 LDA #&00 ; doll direction = &00 (up one space) &1624 85 b0 STA &b0; dolldirection &1626 a9 01 LDA #&01 &1628 85 af STA ⁡ moverisdoll &162a 20 eb 1d JSR &1deb; canpushup ; can we push it? &162d e0 01 CPX #&01 &162f f0 32 BEQ &1663; movedowncant ; can't move up if we can't push it &1631 moveupdoit 20 0f 1d JSR &1d0f; vacatedspaceup &1634 20 05 21 JSR &2105; movecounter ; increment move counter &1637 a9 00 LDA #&00 &1639 a0 20 LDY #&20 &163b 91 70 STA (&70),Y; playeraddr ; blank current space &163d a5 70 LDA &70; playeraddr &163f 38 SEC &1640 e9 20 SBC #&20 ; move current space up &1642 85 70 STA &70; playeraddr &1644 a5 71 LDA &71; playeraddr_h &1646 e9 00 SBC #&00 &1648 85 71 STA &71; playeraddr_h &164a a5 90 LDA &90; currentplayer &164c 91 70 STA (&70),Y; playeraddr ; store current player in current space &164e ad f5 18 LDA &18f5; gotmap ; playercanmove sets gotmap = 1 if MAP &1651 f0 03 BEQ &1656; moveupnotmap ; if it's a MAP... &1653 20 8a 18 JSR &188a; drawmap ; ...redraw the map &1656 moveupnotmap a5 73 LDA &73; playeryoffset ; Y offset from viewpoint &1658 c9 01 CMP #&01 ; do we need to scroll up? &165a f0 0a BEQ &1666; moveupredraw ; redraw viewpoint if needed &165c a9 02 LDA #&02 &165e 20 b5 12 JSR &12b5; plotheromove &1661 c6 73 DEC &73; playeryoffset ; shift player in viewpoint &1663 movedowncant 4c 90 13 JMP &1390; mainloop &1666 moveupredraw 4c 3a 17 JMP &173a; redrawviewu &1669 movedownmain a0 40 LDY #&40 &166b b1 70 LDA (&70),Y; playeraddr ; get piece below player &166d 20 f6 18 JSR &18f6; playercanmove &1670 e0 01 CPX #&01 ; can't move down if WALL, MAGUS or QUAESTOR &1672 f0 ef BEQ &1663; movedowncant &1674 e0 ff CPX #&ff ; have we finished? &1676 d0 03 BNE &167b; movedownnotsolved &1678 4c 3e 1d JMP &1d3e; levelsolved ; if so, return with A = 1 &167b movedownnotsolved c9 05 CMP #&05 ; can't move down if DOTS &167d f0 e4 BEQ &1663; movedowncant &167f c9 07 CMP #&07 ; can't move down if FISH &1681 f0 e0 BEQ &1663; movedowncant &1683 c9 09 CMP #&09 ; can't move down if H_BOMB &1685 f0 dc BEQ &1663; movedowncant &1687 c9 08 CMP #&08 ; if it's a CHICKEN... &1689 d0 06 BNE &1691; movedownnotchicken &168b 20 55 1e JSR &1e55; canpushdown ; can we push it? &168e 4c 98 16 JMP &1698; movedownchicken &1691 movedownnotchicken c9 0a CMP #&0a ; ...or a V_BOMB... &1693 d0 0a BNE &169f; movedownnotvbomb &1695 20 55 1e JSR &1e55; canpushdown ; can we push it? &1698 movedownchicken e0 01 CPX #&01 &169a f0 c7 BEQ &1663; movedowncant ; can't move down if can't push it &169c 4c f5 16 JMP &16f5; movedowndoit &169f movedownnotvbomb c9 0e CMP #&0e ; if it's a TELEPORT... &16a1 d0 35 BNE &16d8 &16a3 20 4e 20 JSR &204e; canteleport ; check that there are two teleports &16a6 e0 01 CPX #&01 &16a8 f0 b9 BEQ &1663; movedowncant ; can't move down if there aren't &16aa a9 40 LDA #&40 &16ac 85 ac STA ∾ playermotion ; playermotion = &40 (down one space) &16ae a9 01 LDA #&01 &16b0 20 b5 12 JSR &12b5; plotheromove &16b3 20 39 1f JSR &1f39; doteleport ; check that there's a free exit space &16b6 e0 00 CPX #&00 &16b8 d0 a9 BNE &1663; movedowncant ; can't move down if there isn't &16ba 20 05 21 JSR &2105; movecounter ; increment move counter &16bd a0 20 LDY #&20 &16bf a9 00 LDA #&00 &16c1 91 60 STA (&60),Y ; blank original position &16c3 20 2c 20 JSR &202c; storeplayerstate &16c6 20 1f 1d JSR &1d1f; vacatedspacedown &16c9 20 3d 20 JSR &203d; restoreplayerstate &16cc a5 90 LDA &90; currentplayer &16ce a0 20 LDY #&20 &16d0 91 70 STA (&70),Y; playeraddr ; store player in new position &16d2 20 00 11 JSR &1100; redraw &16d5 4c 90 13 JMP &1390; mainloop &16d8 c9 0f CMP #&0f ; if it's a SWITCH... &16da d0 06 BNE &16e2; movedownnotswitch &16dc 20 73 20 JSR &2073; pressswitch ; switch the lights &16df 4c f5 16 JMP &16f5; movedowndoit &16e2 movedownnotswitch c9 0d CMP #&0d ; if it's a DOLL... &16e4 d0 0f BNE &16f5; movedowndoit &16e6 a9 40 LDA #&40 &16e8 85 b0 STA &b0; dolldirection ; dolldirection = &40 (down one space) &16ea a9 01 LDA #&01 &16ec 85 af STA ⁡ moverisdoll &16ee 20 55 1e JSR &1e55; canpushdown ; can we push it? &16f1 e0 01 CPX #&01 &16f3 f0 34 BEQ &1729 ; can't move down if we can't &16f5 movedowndoit 20 1f 1d JSR &1d1f; vacatedspacedown &16f8 20 05 21 JSR &2105; movecounter ; increment move counter &16fb a9 00 LDA #&00 &16fd a0 20 LDY #&20 &16ff 91 70 STA (&70),Y; playeraddr ; blank current space &1701 18 CLC &1702 a5 70 LDA &70; playeraddr &1704 18 CLC &1705 69 20 ADC #&20 ; move current space down &1707 85 70 STA &70; playeraddr &1709 90 02 BCC &170d &170b e6 71 INC &71; playeraddr_h &170d a5 90 LDA &90; currentplayer &170f 91 70 STA (&70),Y; playeraddr ; store current player in new space &1711 ad f5 18 LDA &18f5; gotmap ; playercanmove sets gotmap = 1 if MAP &1714 f0 03 BEQ &1719; movedownnotmap ; if it's a MAP... &1716 20 8a 18 JSR &188a; drawmap ; ...redraw the map &1719 movedownnotmap a5 73 LDA &73; playeryoffset &171b c9 06 CMP #&06 ; do we need to scroll down? &171d f0 2d BEQ &174c; redrawviewd ; redraw viewpoint if so &171f a9 01 LDA #&01 &1721 20 b5 12 JSR &12b5; plotheromove &1724 e6 73 INC &73; playeryoffset ; shift player in viewpoint &1726 4c 90 13 JMP &1390; mainloop &1729 4c 90 13 JMP &1390; mainloop &172c redrawviewl c6 74 DEC &74; viewpointx &172e c6 76 DEC &76; viewpointaddr &1730 4c 59 17 JMP &1759 &1733 redrawviewr e6 74 INC &74; viewpointx &1735 e6 76 INC &76; viewpointaddr &1737 4c 59 17 JMP &1759 &173a redrawviewu c6 75 DEC &75; viewpointy &173c 38 SEC &173d a5 76 LDA &76; viewpointaddr &173f e9 20 SBC #&20 &1741 85 76 STA &76; viewpointaddr &1743 a5 77 LDA &77; viewpointaddr_h &1745 e9 00 SBC #&00 &1747 85 77 STA &77; viewpointaddr_h &1749 4c 59 17 JMP &1759 &174c redrawviewd e6 75 INC &75; viewpointy &174e 18 CLC &174f a5 76 LDA &76; viewpointaddr &1751 69 20 ADC #&20 &1753 85 76 STA &76; viewpointaddr &1755 90 02 BCC &1759 &1757 e6 77 INC &77; viewpointaddr_h &1759 20 00 11 JSR &1100; redraw &175c 4c 90 13 JMP &1390; mainloop &175f moveswap a6 91 LDX &91; otherplayerok &1761 f0 51 BEQ &17b4 ; other player is dead &1763 20 05 21 JSR &2105; movecounter &1766 a5 90 LDA &90; currentplayer &1768 c9 02 CMP #&02 &176a d0 03 BNE &176f; isquaestor &176c 4c b7 17 JMP &17b7; ismagus &176f isquaestor a9 02 LDA #&02 &1771 85 90 STA &90; currentplayer &1773 a0 00 LDY #&00 &1775 b9 20 55 LDA &5520,Y ; copy block &5520 to &126d &1778 99 6d 12 STA &126d,Y &177b c8 INY &177c c0 48 CPY #&48 &177e d0 f5 BNE &1775 &1780 a0 00 LDY #&00 &1782 b9 70 00 LDA &0070,Y; playeraddr &1785 99 88 00 STA &0088,Y &1788 c8 INY &1789 c0 08 CPY #&08 &178b d0 f5 BNE &1782 &178d a0 00 LDY #&00 &178f b9 80 00 LDA &0080,Y &1792 99 70 00 STA &0070,Y; playeraddr &1795 c8 INY &1796 c0 08 CPY #&08 &1798 d0 f5 BNE &178f &179a forbothplayers a5 90 LDA &90; currentplayer &179c a2 e8 LDX #&e8 ; plot current player piece on right &179e 86 58 STX &58; screenaddr &17a0 a2 71 LDX #&71 ; screen address = &71e8 &17a2 86 59 STX &59; screenaddr_h &17a4 20 2d 11 JSR &112d; plotpiece &17a7 20 00 11 JSR &1100; redraw &17aa a9 00 LDA #&00 &17ac 20 b5 12 JSR &12b5; plotheromove &17af a9 3c LDA #&3c &17b1 20 a3 1e JSR &1ea3; sleep &17b4 4c 90 13 JMP &1390; mainloop &17b7 ismagus a9 03 LDA #&03 &17b9 85 90 STA &90; currentplayer &17bb a0 00 LDY #&00 &17bd b9 68 55 LDA &5568,Y ; copy block &5568 to &126d &17c0 99 6d 12 STA &126d,Y &17c3 c8 INY &17c4 c0 48 CPY #&48 &17c6 d0 f5 BNE &17bd &17c8 a0 00 LDY #&00 &17ca b9 70 00 LDA &0070,Y; playeraddr &17cd 99 80 00 STA &0080,Y &17d0 c8 INY &17d1 c0 08 CPY #&08 &17d3 d0 f5 BNE &17ca &17d5 a0 00 LDY #&00 &17d7 b9 88 00 LDA &0088,Y &17da 99 70 00 STA &0070,Y; playeraddr &17dd c8 INY &17de c0 08 CPY #&08 &17e0 d0 f5 BNE &17d7 &17e2 4c 9a 17 JMP &179a; forbothplayers &17e5 60 RTS ; part of draw map &17e6 a2 00 LDX #&00 &17e8 86 62 STX &62 &17ea 86 6c STX &6c &17ec 86 65 STX &65 &17ee loop2 a9 00 LDA #&00 &17f0 a0 00 LDY #&00 &17f2 91 60 STA (&60),Y &17f4 a2 00 LDX #&00 &17f6 loop1 a0 00 LDY #&00 ; default colour 0 &17f8 b1 5e LDA (&5e),Y ; get piece &17fa 29 0f AND #&0f &17fc a0 00 LDY #&00 &17fe c9 01 CMP #&01 ; is wall? &1800 d0 01 BNE &1803 &1802 c8 INY ; walls are colour 1 &1803 c9 0b CMP #&0b ; is mask? &1805 d0 02 BNE &1809 &1807 a0 02 LDY #&02 ; masks are colour 2 &1809 c9 0c CMP #&0c ; is door? &180b d0 02 BNE &180f &180d a0 03 LDY #&03 ; masks are colour 3 &180f bd 82 18 LDA &1882,X ; get pixels &1812 39 86 18 AND &1886,Y ; make the right colour &1815 a0 00 LDY #&00 &1817 11 60 ORA (&60),Y ; or with whatever's on screen &1819 91 60 STA (&60),Y &181b e6 5e INC &5e &181d a5 5e LDA &5e &181f d0 02 BNE &1823 &1821 e6 5f INC &5f &1823 e8 INX &1824 e0 04 CPX #&04 ; four lines per square &1826 d0 ce BNE &17f6; loop1 &1828 b1 60 LDA (&60),Y &182a c8 INY &182b 91 60 STA (&60),Y &182d a5 60 LDA &60 &182f 18 CLC &1830 69 08 ADC #&08 &1832 85 60 STA &60 &1834 90 02 BCC &1838 &1836 e6 61 INC &61 &1838 e6 62 INC &62 &183a a5 62 LDA &62 &183c c9 04 CMP #&04 &183e d0 ae BNE &17ee; loop2 &1840 a9 00 LDA #&00 &1842 85 62 STA &62 &1844 e6 6c INC &6c &1846 18 CLC &1847 a5 5e LDA &5e &1849 69 10 ADC #&10 &184b 85 5e STA &5e &184d 90 02 BCC &1851 &184f e6 5f INC &5f &1851 a5 6c LDA &6c &1853 c9 04 CMP #&04 &1855 f0 0e BEQ &1865 &1857 38 SEC &1858 a5 60 LDA &60 &185a e9 1e SBC #&1e &185c 85 60 STA &60 &185e b0 8e BCS &17ee; loop2 &1860 c6 61 DEC &61 &1862 4c ee 17 JMP &17ee; loop2 &1865 a2 00 LDX #&00 &1867 86 6c STX &6c &1869 e6 65 INC &65 &186b e6 61 INC &61 &186d 18 CLC &186e a5 60 LDA &60 &1870 69 1a ADC #&1a &1872 85 60 STA &60 &1874 90 02 BCC &1878 &1876 e6 61 INC &61 &1878 a5 65 LDA &65 &187a c9 04 CMP #&04 &187c f0 03 BEQ &1881 &187e 4c ee 17 JMP &17ee; loop2 &1881 60 RTS ; pixels for map &1882 88 44 22 11 ; colours for map &1886 00 0f ff f0 &188a drawmap a0 fe LDY #&fe &188c c8 INY &188d c8 INY &188e a5 70 LDA &70; playeraddr &1890 d9 78 00 CMP &0078,Y &1893 d0 f7 BNE &188c &1895 a5 71 LDA &71; playeraddr_h &1897 c8 INY &1898 d9 78 00 CMP &0078,Y &189b f0 04 BEQ &18a1 &189d 88 DEY &189e 4c 8c 18 JMP &188c &18a1 a9 00 LDA #&00 &18a3 99 78 00 STA &0078,Y &18a6 88 DEY &18a7 99 78 00 STA &0078,Y &18aa b9 e5 18 LDA &18e5,Y &18ad 85 60 STA &60 &18af b9 ed 18 LDA &18ed,Y &18b2 85 5e STA &5e &18b4 c8 INY &18b5 b9 e5 18 LDA &18e5,Y &18b8 85 61 STA &61 &18ba b9 ed 18 LDA &18ed,Y &18bd 85 5f STA &5f &18bf 20 e6 17 JSR &17e6 &18c2 60 RTS &18c3 updatemap a0 fe LDY #&fe &18c5 c8 INY &18c6 c8 INY &18c7 b9 78 00 LDA &0078,Y &18ca f0 03 BEQ &18cf &18cc 4c df 18 JMP &18df &18cf c8 INY &18d0 b9 78 00 LDA &0078,Y &18d3 88 DEY &18d4 c9 00 CMP #&00 &18d6 d0 07 BNE &18df &18d8 98 TYA &18d9 48 PHA &18da 20 aa 18 JSR &18aa &18dd 68 PLA &18de a8 TAY &18df c0 06 CPY #&06 &18e1 d0 e2 BNE &18c5 &18e3 60 RTS &18e4 60 RTS &18e5 a8 61 c8 61 a8 66 c8 66 ; map screen addresses &18ed 00 09 10 09 00 0b 10 0b ; map data addresses &18f5 gotmap ea NOP ; playercanmove ; returns X=1 if wall, magus, questor ; returns X=255 if finished ; returns Y=1 if map &18f6 playercanmove a2 00 LDX #&00 &18f8 a0 00 LDY #&00 &18fa c9 01 CMP #&01 ; WALL &18fc f0 26 BEQ &1924; playercanmovecant &18fe c9 02 CMP #&02 ; MAGUS &1900 f0 22 BEQ &1924; playercanmovecant &1902 c9 03 CMP #&03 ; QUAESTOR &1904 f0 1e BEQ &1924; playercanmovecant &1906 c9 0b CMP #&0b ; MASK &1908 d0 05 BNE &190f; playercanmovenotmask &190a e6 93 INC &93; maskcount ; increment collected mask count &190c 20 41 1d JSR &1d41; getmask &190f playercanmovenotmask c9 0c CMP #&0c ; DOOR &1911 d0 0e BNE &1921 &1913 a5 92 LDA &92; masktotal ; compare total number of masks &1915 c5 93 CMP &93; maskcount ; to number of masks collected &1917 d0 0b BNE &1924; playercanmovecant &1919 a6 b6 LDX &b6; movetype &191b 20 4e 22 JSR &224e; storemove &191e a2 ff LDX #&ff ; return X = &ff if finished &1920 60 RTS &1921 4c 25 19 JMP &1925; playercanmovenotdoor &1924 playercanmovecant e8 INX ; return X = &01 if can't move &1925 playercanmovenotdoor c9 04 CMP #&04 ; MAP &1927 d0 01 BNE &192a; playercanmovenotmap &1929 c8 INY ; gotmap = 1 if MAP &192a playercanmovenotmap 8c f5 18 STY &18f5; gotmap ; gotmap = 0 otherwise &192d 60 RTS ; addspacetolist ; adds space at &1cb7-8 to list, increases list length &192e addspacetolist a5 94 LDA &94; listlength &1930 0a ASL &1931 a8 TAY &1932 ad b7 1c LDA &1cb7 &1935 99 00 29 STA &2900,Y; setup &1938 c8 INY &1939 ad b8 1c LDA &1cb8 &193c 99 00 29 STA &2900,Y; setup &193f e6 94 INC &94; listlength &1941 60 RTS ; getspacefromlist ; get first piece from list into &a8-9, shuffle list left a place &1942 getspacefromlist ad 00 29 LDA &2900; setup &1945 85 a8 STA &a8 &1947 ad 01 29 LDA &2901 &194a 85 a9 STA &a9 &194c a0 02 LDY #&02 &194e b9 00 29 LDA &2900,Y; setup &1951 88 DEY &1952 88 DEY &1953 99 00 29 STA &2900,Y; setup &1956 c8 INY &1957 c8 INY &1958 c8 INY &1959 d0 f3 BNE &194e &195b c6 94 DEC &94; listlength &195d 60 RTS &195e leftmover_jmp 4c b2 1b JMP &1bb2; leftmover &1961 processmovers 20 42 19 JSR &1942; getspacefromlist &1964 a0 00 LDY #&00 &1966 b1 a8 LDA (&a8),Y ; address of moving piece &1968 c9 07 CMP #&07 ; fish &196a f0 1c BEQ &1988; downmover &196c c9 09 CMP #&09 ; h bomb &196e f0 18 BEQ &1988; downmover &1970 c9 08 CMP #&08 ; chicken &1972 f0 ea BEQ &195e; leftmover_jmp &1974 c9 0a CMP #&0a ; v bomb &1976 f0 e6 BEQ &195e; leftmover_jmp &1978 c9 0d CMP #&0d ; doll &197a f0 06 BEQ &1982; dollmover_jmp &197c 4c 90 13 JMP &1390; mainloop &197f explodehdown_jmp 4c e9 1a JMP &1ae9; explodehdown &1982 dollmover_jmp 4c 9e 20 JMP &209e; dollmover &1985 explodevdown_jmp 4c 57 1b JMP &1b57; explodevdown &1988 downmover a0 20 LDY #&20 &198a b1 a8 LDA (&a8),Y ; space &198c f0 1f BEQ &19ad; canmovedown &198e c9 06 CMP #&06 ; waves &1990 f0 1b BEQ &19ad; canmovedown &1992 c9 02 CMP #&02 ; magus &1994 d0 08 BNE &199e &1996 intoplayer a0 00 LDY #&00 &1998 99 09 1f STA &1f09,Y ; store killed player number &199b 4c ad 19 JMP &19ad; canmovedown &199e c9 03 CMP #&03 ; questor &19a0 f0 f4 BEQ &1996; intoplayer &19a2 c9 09 CMP #&09 ; h bomb &19a4 f0 d9 BEQ &197f; explodehdown_jmp &19a6 c9 0a CMP #&0a ; v bomb &19a8 f0 db BEQ &1985; explodevdown_jmp &19aa 4c 90 13 JMP &1390; mainloop &19ad canmovedown 20 4f 1a JSR &1a4f; considerdownmover &19b0 20 76 1a JSR &1a76; considerleftmover &19b3 a5 a8 LDA &a8 &19b5 18 CLC &19b6 69 20 ADC #&20 &19b8 85 aa STA &aa &19ba a5 a9 LDA &a9 &19bc 69 00 ADC #&00 &19be 85 ab STA &ab ; &aa-b = &a8-9 + 32 &19c0 20 f2 19 JSR &19f2; movemover &19c3 a0 20 LDY #&20 &19c5 b1 aa LDA (&aa),Y ; space two below original position &19c7 c9 06 CMP #&06 ; waves | &19c9 f0 17 BEQ &19e2; addpiecetolist &19cb c9 00 CMP #&00 ; space &19cd f0 13 BEQ &19e2; addpiecetolist &19cf c9 09 CMP #&09 ; h bomb &19d1 f0 0f BEQ &19e2; addpiecetolist &19d3 c9 02 CMP #&02 ; magus &19d5 f0 0b BEQ &19e2; addpiecetolist &19d7 c9 03 CMP #&03 ; questor &19d9 f0 07 BEQ &19e2; addpiecetolist &19db c9 0a CMP #&0a ; v bomb &19dd f0 03 BEQ &19e2; addpiecetolist &19df 4c 90 13 JMP &1390; mainloop &19e2 addpiecetolist a5 aa LDA &aa ; add piece at &aa-b to list &19e4 8d b7 1c STA &1cb7 &19e7 a5 ab LDA &ab &19e9 8d b8 1c STA &1cb8 &19ec 20 2e 19 JSR &192e; addspacetolist &19ef 4c 90 13 JMP &1390; mainloop ; movemover ; &a8-9 = old position ; &aa-b = new position &19f2 movemover a5 a8 LDA &a8 ; is the old position visible? &19f4 85 5e STA &5e &19f6 a5 a9 LDA &a9 &19f8 85 5f STA &5f &19fa 20 99 1a JSR &1a99; isitvisible &19fd a5 5e LDA &5e &19ff 8d b9 1c STA &1cb9 &1a02 a5 5f LDA &5f &1a04 8d ba 1c STA &1cba &1a07 a5 aa LDA &aa ; is the new position visible? &1a09 85 5e STA &5e &1a0b a5 ab LDA &ab &1a0d 85 5f STA &5f &1a0f 20 99 1a JSR &1a99; isitvisible &1a12 a5 5e LDA &5e &1a14 8d bb 1c STA &1cbb &1a17 a5 5f LDA &5f &1a19 8d bc 1c STA &1cbc &1a1c a0 00 LDY #&00 &1a1e b1 a8 LDA (&a8),Y ; move the mover to new address &1a20 91 aa STA (&aa),Y &1a22 98 TYA &1a23 91 a8 STA (&a8),Y ; blank the old address &1a25 ad ba 1c LDA &1cba &1a28 f0 0c BEQ &1a36; oldnotvisible &1a2a 85 59 STA &59; screenaddr_h ; plot space on old position &1a2c ad b9 1c LDA &1cb9 &1a2f 85 58 STA &58; screenaddr &1a31 a9 00 LDA #&00 ; space &1a33 20 2d 11 JSR &112d; plotpiece &1a36 oldnotvisible ad bc 1c LDA &1cbc &1a39 f0 13 BEQ &1a4e; newnotvisible &1a3b 85 59 STA &59; screenaddr_h &1a3d ad bb 1c LDA &1cbb &1a40 85 58 STA &58; screenaddr &1a42 a0 00 LDY #&00 &1a44 b1 aa LDA (&aa),Y ; plot piece on new position &1a46 20 2d 11 JSR &112d; plotpiece &1a49 a9 14 LDA #&14 &1a4b 20 a3 1e JSR &1ea3; sleep &1a4e newnotvisible 60 RTS ; considerdownmover ; if space above &a8-9 is a fish or h-bomb, add to stack &1a4f considerdownmover a5 a8 LDA &a8 &1a51 38 SEC &1a52 e9 20 SBC #&20 &1a54 85 52 STA &52 &1a56 a5 a9 LDA &a9 &1a58 e9 00 SBC #&00 &1a5a 85 53 STA &53; temp &1a5c a0 00 LDY #&00 &1a5e b1 52 LDA (&52),Y &1a60 c9 07 CMP #&07 ; fish &1a62 f0 04 BEQ &1a68 &1a64 c9 09 CMP #&09 ; h bomb &1a66 d0 0d BNE &1a75 &1a68 a5 52 LDA &52 &1a6a 8d b7 1c STA &1cb7 &1a6d a5 53 LDA &53; temp &1a6f 8d b8 1c STA &1cb8 &1a72 20 2e 19 JSR &192e; addspacetolist &1a75 60 RTS ; considerleftmover ; if space right of &a8-9 is a chicken or v-bomb, add to stack &1a76 considerleftmover a0 01 LDY #&01 &1a78 b1 a8 LDA (&a8),Y &1a7a c9 08 CMP #&08 ; chicken &1a7c f0 05 BEQ &1a83 &1a7e c9 0a CMP #&0a ; v bomb &1a80 f0 01 BEQ &1a83 &1a82 60 RTS &1a83 a6 a8 LDX &a8 &1a85 a5 a9 LDA &a9 &1a87 e8 INX &1a88 8e b7 1c STX &1cb7 &1a8b e0 00 CPX #&00 &1a8d d0 03 BNE &1a92 &1a8f aa TAX &1a90 e8 INX &1a91 8a TXA &1a92 8d b8 1c STA &1cb8 ; &1cb7-8 = space right of mover &1a95 20 2e 19 JSR &192e; addspacetolist &1a98 60 RTS ; piece address at &5e-f &1a99 isitvisible a5 5f LDA &5f ; calculate x and y of mover &1a9b 38 SEC &1a9c e9 09 SBC #&09 &1a9e 0a ASL &1a9f 0a ASL &1aa0 0a ASL &1aa1 8d bd 1c STA &1cbd &1aa4 a5 5e LDA &5e &1aa6 ee bd 1c INC &1cbd &1aa9 38 SEC &1aaa e9 20 SBC #&20 &1aac b0 f8 BCS &1aa6 &1aae ce bd 1c DEC &1cbd &1ab1 69 20 ADC #&20 &1ab3 8d be 1c STA &1cbe &1ab6 38 SEC ; determine whether it is on screen &1ab7 e5 74 SBC &74; viewpointx &1ab9 8d be 1c STA &1cbe &1abc 30 26 BMI &1ae4; notvisible &1abe c9 08 CMP #&08 &1ac0 10 22 BPL &1ae4; notvisible &1ac2 ad bd 1c LDA &1cbd &1ac5 38 SEC &1ac6 e5 75 SBC &75; viewpointy &1ac8 8d bd 1c STA &1cbd &1acb 30 17 BMI &1ae4; notvisible &1acd c9 08 CMP #&08 &1acf 10 13 BPL &1ae4; notvisible &1ad1 0a ASL ; it is on screen &1ad2 0a ASL &1ad3 0a ASL &1ad4 18 CLC &1ad5 6d be 1c ADC &1cbe &1ad8 0a ASL ; so find its screen address &1ad9 a8 TAY &1ada b1 56 LDA (&56),Y; screenlookupptr &1adc 85 5e STA &5e &1ade c8 INY &1adf b1 56 LDA (&56),Y; screenlookupptr &1ae1 85 5f STA &5f ; return screen address in &5e-f &1ae3 60 RTS &1ae4 notvisible a9 00 LDA #&00 ; return &5f = 0 &1ae6 85 5f STA &5f &1ae8 60 RTS ; explodehdown &1ae9 explodehdown a9 03 LDA #&03 &1aeb 8d 46 22 STA &2246 ; yellow explosion &1aee 20 4f 1a JSR &1a4f; considerdownmover ; is there a mover above the detonator? &1af1 a5 a8 LDA &a8 &1af3 85 aa STA &aa &1af5 a5 a9 LDA &a9 &1af7 85 ab STA &ab ; &aa-b = &a8-9 &1af9 a5 aa LDA &aa &1afb 18 CLC &1afc 69 1f ADC #&1f ; &a8-9 = left explosion &1afe 85 a8 STA &a8 &1b00 a5 ab LDA &ab &1b02 69 00 ADC #&00 &1b04 85 a9 STA &a9 &1b06 20 4f 1a JSR &1a4f; considerdownmover ; is there a mover above the left explosion? &1b09 a0 00 LDY #&00 &1b0b 20 0e 1f JSR &1f0e; doexplosion &1b0e a5 a8 LDA &a8 &1b10 18 CLC &1b11 69 02 ADC #&02 ; &a8-9 = right explosion &1b13 85 a8 STA &a8 &1b15 a5 a9 LDA &a9 &1b17 69 00 ADC #&00 &1b19 85 a9 STA &a9 &1b1b 20 4f 1a JSR &1a4f; considerdownmover ; is there a mover above the right explosion? &1b1e 20 76 1a JSR &1a76; considerleftmover ; is there a mover right of the right explosion? &1b21 a0 01 LDY #&01 &1b23 20 0e 1f JSR &1f0e; doexplosion &1b26 a0 00 LDY #&00 &1b28 98 TYA &1b29 91 aa STA (&aa),Y ; replace detonator with space &1b2b a0 20 LDY #&20 &1b2d 91 aa STA (&aa),Y ; replace bomb with space &1b2f a5 a8 LDA &a8 &1b31 29 1f AND #&1f &1b33 c9 1f CMP #&1f &1b35 f0 06 BEQ &1b3d ; if not right hand wall... &1b37 a9 00 LDA #&00 &1b39 a0 21 LDY #&21 &1b3b 91 aa STA (&aa),Y ; replace right with space &1b3d a5 aa LDA &aa &1b3f 18 CLC &1b40 69 1f ADC #&1f &1b42 29 1f AND #&1f &1b44 c9 00 CMP #&00 &1b46 f0 06 BEQ &1b4e ; if not left hand wall... &1b48 a9 00 LDA #&00 &1b4a a0 1f LDY #&1f ; replace left with space &1b4c 91 aa STA (&aa),Y &1b4e 20 c3 18 JSR &18c3; updatemap &1b51 20 00 11 JSR &1100; redraw &1b54 4c 90 13 JMP &1390; mainloop ; explodevdown &1b57 explodevdown a9 02 LDA #&02 &1b59 8d 46 22 STA &2246 &1b5c 20 4f 1a JSR &1a4f; considerdownmover ; is there a mover above the detonator? &1b5f 20 76 1a JSR &1a76; considerleftmover ; is there a mover to the right of the detonator? &1b62 a5 a8 LDA &a8 &1b64 85 aa STA &aa &1b66 a5 a9 LDA &a9 &1b68 85 ab STA &ab ; &aa-b = &a8-9 &1b6a a9 01 LDA #&01 &1b6c 85 6c STA &6c ; ? &1b6e a5 a8 LDA &a8 &1b70 18 CLC &1b71 69 20 ADC #&20 ; &a8 = centre explosion &1b73 85 a8 STA &a8 &1b75 a5 a9 LDA &a9 &1b77 69 00 ADC #&00 &1b79 85 a9 STA &a9 &1b7b 20 76 1a JSR &1a76; considerleftmover ; is there a mover in the centre explosion? &1b7e c6 6c DEC &6c &1b80 a5 6c LDA &6c &1b82 f0 ea BEQ &1b6e ; loop, consider bottom explosion &1b84 a0 00 LDY #&00 &1b86 20 0e 1f JSR &1f0e; doexplosion &1b89 a0 00 LDY #&00 &1b8b 98 TYA &1b8c 91 aa STA (&aa),Y ; replace top explosion with space &1b8e a0 20 LDY #&20 &1b90 91 aa STA (&aa),Y ; replace centre explosion with space &1b92 a5 a9 LDA &a9 &1b94 c9 0c CMP #&0c ; if not bottom row... &1b96 f0 0f BEQ &1ba7 &1b98 a9 00 LDA #&00 &1b9a a0 40 LDY #&40 &1b9c 91 aa STA (&aa),Y ; replace bottom explosion with space &1b9e 20 c3 18 JSR &18c3; updatemap &1ba1 20 00 11 JSR &1100; redraw &1ba4 4c 90 13 JMP &1390; mainloop &1ba7 a5 a8 LDA &a8 &1ba9 29 e0 AND #&e0 &1bab c9 e0 CMP #&e0 &1bad d0 e9 BNE &1b98 &1baf 4c 9e 1b JMP &1b9e &1bb2 leftmover a5 a8 LDA &a8 ; &a8-9 = mover &1bb4 38 SEC &1bb5 e9 01 SBC #&01 &1bb7 85 aa STA &aa &1bb9 a5 a9 LDA &a9 &1bbb e9 00 SBC #&00 &1bbd 85 ab STA &ab &1bbf a0 00 LDY #&00 &1bc1 b1 aa LDA (&aa),Y ; &aa-b = piece to left of mover &1bc3 f0 22 BEQ &1be7 &1bc5 c9 05 CMP #&05 ; dots - &1bc7 f0 1e BEQ &1be7 &1bc9 c9 02 CMP #&02 ; magus &1bcb d0 08 BNE &1bd5 &1bcd a0 00 LDY #&00 &1bcf 99 09 1f STA &1f09,Y &1bd2 4c e7 1b JMP &1be7 &1bd5 c9 03 CMP #&03 ; quaestor &1bd7 f0 f4 BEQ &1bcd &1bd9 c9 09 CMP #&09 ; h bomb &1bdb f0 2b BEQ &1c08; explodehleft &1bdd c9 0a CMP #&0a ; v bomb &1bdf f0 70 BEQ &1c51; explodevleft &1be1 4c 90 13 JMP &1390; mainloop &1be4 4c e2 19 JMP &19e2; addpiecetolist &1be7 20 76 1a JSR &1a76; considerleftmover &1bea 20 4f 1a JSR &1a4f; considerdownmover &1bed 20 f2 19 JSR &19f2; movemover &1bf0 a5 a8 LDA &a8 &1bf2 38 SEC &1bf3 e9 02 SBC #&02 &1bf5 85 a8 STA &a8 &1bf7 a5 a9 LDA &a9 &1bf9 e9 00 SBC #&00 &1bfb 85 a9 STA &a9 &1bfd a0 00 LDY #&00 &1bff b1 a8 LDA (&a8),Y &1c01 c9 05 CMP #&05 &1c03 f0 df BEQ &1be4 &1c05 4c cb 19 JMP &19cb &1c08 explodehleft a9 03 LDA #&03 &1c0a 8d 46 22 STA &2246 &1c0d 20 76 1a JSR &1a76; considerleftmover ; is there a left mover on the right explosion? &1c10 20 4f 1a JSR &1a4f; considerdownmover ; is there a down mover on the right explosion? &1c13 a9 01 LDA #&01 &1c15 85 6c STA &6c &1c17 38 SEC &1c18 a5 a8 LDA &a8 &1c1a e9 01 SBC #&01 &1c1c 85 a8 STA &a8 &1c1e a5 a9 LDA &a9 &1c20 e9 00 SBC #&00 &1c22 85 a9 STA &a9 &1c24 20 4f 1a JSR &1a4f; considerdownmover ; is there a down mover on the middle, then left explosion? &1c27 c6 6c DEC &6c &1c29 a5 6c LDA &6c &1c2b f0 ea BEQ &1c17 &1c2d a0 00 LDY #&00 &1c2f 20 0e 1f JSR &1f0e; doexplosion &1c32 a5 a8 LDA &a8 &1c34 29 1f AND #&1f &1c36 c9 00 CMP #&00 &1c38 f0 05 BEQ &1c3f &1c3a a9 00 LDA #&00 &1c3c a8 TAY &1c3d 91 a8 STA (&a8),Y &1c3f a9 00 LDA #&00 &1c41 a8 TAY &1c42 c8 INY &1c43 91 a8 STA (&a8),Y &1c45 c8 INY &1c46 91 a8 STA (&a8),Y &1c48 20 c3 18 JSR &18c3; updatemap &1c4b 20 00 11 JSR &1100; redraw &1c4e 4c 90 13 JMP &1390; mainloop &1c51 explodevleft a9 02 LDA #&02 &1c53 8d 46 22 STA &2246 &1c56 20 76 1a JSR &1a76; considerleftmover &1c59 20 4f 1a JSR &1a4f; considerdownmover &1c5c a5 a8 LDA &a8 ; &a8-9 = detonator &1c5e 18 CLC &1c5f 69 1f ADC #&1f &1c61 85 a8 STA &a8 &1c63 a5 a9 LDA &a9 &1c65 69 00 ADC #&00 &1c67 85 a9 STA &a9 &1c69 20 76 1a JSR &1a76; considerleftmover ; is there a left mover on the lower explosion? &1c6c a0 00 LDY #&00 &1c6e 20 0e 1f JSR &1f0e; doexplosion &1c71 a5 a8 LDA &a8 &1c73 38 SEC &1c74 e9 40 SBC #&40 &1c76 85 a8 STA &a8 &1c78 a5 a9 LDA &a9 &1c7a e9 00 SBC #&00 &1c7c 85 a9 STA &a9 &1c7e 20 76 1a JSR &1a76; considerleftmover ; is there a left mover on the upper explosion? &1c81 20 4f 1a JSR &1a4f; considerdownmover ; is there a down mover on the upper explosion? &1c84 a0 01 LDY #&01 &1c86 20 0e 1f JSR &1f0e; doexplosion &1c89 a0 00 LDY #&00 &1c8b a5 a9 LDA &a9 &1c8d c9 09 CMP #&09 &1c8f d0 06 BNE &1c97 &1c91 a5 a8 LDA &a8 &1c93 29 e0 AND #&e0 &1c95 f0 03 BEQ &1c9a &1c97 98 TYA &1c98 91 a8 STA (&a8),Y &1c9a a9 00 LDA #&00 &1c9c a0 20 LDY #&20 &1c9e 91 a8 STA (&a8),Y &1ca0 c8 INY &1ca1 91 a8 STA (&a8),Y &1ca3 a5 a8 LDA &a8 &1ca5 85 aa STA &aa &1ca7 18 CLC &1ca8 69 40 ADC #&40 &1caa 85 a8 STA &a8 &1cac a5 a9 LDA &a9 &1cae 85 ab STA &ab &1cb0 69 00 ADC #&00 &1cb2 85 a9 STA &a9 &1cb4 4c 92 1b JMP &1b92 ; list &1cb7 ea NOP &1cb8 ea NOP &1cb9 ea NOP &1cba ea NOP &1cbb ea NOP &1cbc ea NOP &1cbd ea NOP &1cbe ea NOP ; vacatedspaceleft ; the player has moved left; consider which movers to add to list &1cbf vacatedspaceleft a0 00 LDY #&00 ; space above player &1cc1 b1 70 LDA (&70),Y; playeraddr &1cc3 c9 07 CMP #&07 ; fish &1cc5 f0 04 BEQ &1ccb &1cc7 c9 09 CMP #&09 ; h-bomb &1cc9 d0 03 BNE &1cce &1ccb 20 de 1c JSR &1cde; addmoverabove &1cce a0 21 LDY #&21 ; space to right of player &1cd0 b1 70 LDA (&70),Y; playeraddr &1cd2 c9 08 CMP #&08 ; chicken &1cd4 f0 04 BEQ &1cda &1cd6 c9 0a CMP #&0a ; v-bomb &1cd8 d0 03 BNE &1cdd &1cda 20 ec 1c JSR &1cec; addmoverright &1cdd 60 RTS ; addmoverabove ; add a new mover above the player at &70-1 &1cde addmoverabove a5 70 LDA &70; playeraddr &1ce0 8d b7 1c STA &1cb7 &1ce3 a5 71 LDA &71; playeraddr_h &1ce5 8d b8 1c STA &1cb8 &1ce8 20 2e 19 JSR &192e; addspacetolist &1ceb 60 RTS ; addmoverright ; add a new mover to the right of the player at &70-1 &1cec addmoverright a5 70 LDA &70; playeraddr &1cee 18 CLC &1cef 69 21 ADC #&21 &1cf1 8d b7 1c STA &1cb7 &1cf4 a5 71 LDA &71; playeraddr_h &1cf6 69 00 ADC #&00 &1cf8 8d b8 1c STA &1cb8 &1cfb 20 2e 19 JSR &192e; addspacetolist &1cfe 60 RTS ; vacatedspaceright ; the player has moved right; consider which movers to add to list &1cff vacatedspaceright a0 00 LDY #&00 ; space above player &1d01 b1 70 LDA (&70),Y; playeraddr &1d03 c9 07 CMP #&07 ; fish &1d05 f0 04 BEQ &1d0b &1d07 c9 09 CMP #&09 ; h-bomb &1d09 d0 03 BNE &1d0e &1d0b 20 de 1c JSR &1cde; addmoverabove &1d0e 60 RTS ; vacatedspaceup ; the player has moved up; consider which movers to add to list &1d0f vacatedspaceup a0 21 LDY #&21 ; space to right of player &1d11 b1 70 LDA (&70),Y; playeraddr &1d13 c9 08 CMP #&08 ; chicken &1d15 f0 04 BEQ &1d1b &1d17 c9 0a CMP #&0a ; v-bomb &1d19 d0 03 BNE &1d1e &1d1b 20 ec 1c JSR &1cec; addmoverright &1d1e 60 RTS ; vacatedspacedown ; the player has moved down; consider which movers to add to list &1d1f vacatedspacedown a0 21 LDY #&21 ; space to right of player &1d21 b1 70 LDA (&70),Y; playeraddr &1d23 c9 08 CMP #&08 ; chicken &1d25 f0 04 BEQ &1d2b &1d27 c9 0a CMP #&0a ; v-bomb &1d29 d0 03 BNE &1d2e &1d2b 20 ec 1c JSR &1cec; addmoverright &1d2e a0 00 LDY #&00 ; space above player &1d30 b1 70 LDA (&70),Y; playeraddr &1d32 c9 07 CMP #&07 ; fish &1d34 f0 04 BEQ &1d3a &1d36 c9 09 CMP #&09 ; h-bomb &1d38 d0 03 BNE &1d3d &1d3a 20 de 1c JSR &1cde; addmoverabove &1d3d 60 RTS &1d3e levelsolved a9 01 LDA #&01 &1d40 60 RTS &1d41 getmask 48 PHA &1d42 98 TYA &1d43 48 PHA &1d44 8a TXA &1d45 48 PHA &1d46 20 f3 21 JSR &21f3; plotmaskcount &1d49 a9 01 LDA #&01 &1d4b 8d 54 1d STA &1d54; gotmask &1d4e 68 PLA &1d4f aa TAX &1d50 68 PLA &1d51 a8 TAY &1d52 68 PLA &1d53 60 RTS &1d54 gotmask ea NOP &1d55 canpushleft a0 1e LDY #&1e ; space two to left of origina &1d57 b1 70 LDA (&70),Y; playeraddr &1d59 f0 0b BEQ &1d66; canpushleft2 ; is it a SPACE? &1d5b a6 af LDX ⁡ moverisdoll ; is it a doll? &1d5d d0 04 BNE &1d63 &1d5f c9 05 CMP #&05 ; dots; dolls can't pass through &1d61 f0 03 BEQ &1d66; canpushleft2 &1d63 a2 01 LDX #&01 ; cannot push it &1d65 60 RTS &1d66 canpushleft2 c8 INY &1d67 b1 70 LDA (&70),Y; playeraddr ; get pushed piece &1d69 88 DEY &1d6a 91 70 STA (&70),Y; playeraddr ; move into new position &1d6c a9 00 LDA #&00 &1d6e c8 INY &1d6f 91 70 STA (&70),Y; playeraddr ; replace with space &1d71 a0 3e LDY #&3e ; if downer, two to left, one down &1d73 a5 af LDA ⁡ moverisdoll &1d75 f0 02 BEQ &1d79 &1d77 a0 1d LDY #&1d ; if doll, three to left &1d79 b1 70 LDA (&70),Y; playeraddr &1d7b f0 0b BEQ &1d88; addtolist ; add to list if space &1d7d a4 af LDY ⁡ moverisdoll &1d7f d0 19 BNE &1d9a &1d81 c9 06 CMP #&06 ; or waves, if not doll &1d83 f0 03 BEQ &1d88; addtolist &1d85 4c 9a 1d JMP &1d9a &1d88 addtolist a5 70 LDA &70; playeraddr &1d8a 18 CLC &1d8b 69 1e ADC #&1e ; add pushed piece to list &1d8d 8d b7 1c STA &1cb7 &1d90 a5 71 LDA &71; playeraddr_h &1d92 69 00 ADC #&00 &1d94 8d b8 1c STA &1cb8 &1d97 20 2e 19 JSR &192e; addspacetolist &1d9a 20 00 11 JSR &1100; redraw &1d9d a2 00 LDX #&00 ; pushed ok &1d9f 60 RTS &1da0 canpushright a0 22 LDY #&22 &1da2 b1 70 LDA (&70),Y; playeraddr &1da4 f0 0b BEQ &1db1 &1da6 a6 af LDX ⁡ moverisdoll &1da8 d0 04 BNE &1dae &1daa c9 05 CMP #&05 &1dac f0 03 BEQ &1db1 &1dae a2 01 LDX #&01 &1db0 60 RTS &1db1 88 DEY &1db2 b1 70 LDA (&70),Y; playeraddr &1db4 c8 INY &1db5 91 70 STA (&70),Y; playeraddr &1db7 88 DEY &1db8 a9 00 LDA #&00 &1dba 91 70 STA (&70),Y; playeraddr &1dbc a0 42 LDY #&42 &1dbe a5 af LDA ⁡ moverisdoll &1dc0 f0 02 BEQ &1dc4 &1dc2 a0 23 LDY #&23 ; &1dc4 b1 70 LDA (&70),Y; playeraddr &1dc6 f0 0b BEQ &1dd3 &1dc8 a6 af LDX ⁡ moverisdoll &1dca d0 19 BNE &1de5 &1dcc c9 06 CMP #&06 &1dce f0 03 BEQ &1dd3 &1dd0 4c e5 1d JMP &1de5 &1dd3 a5 70 LDA &70; playeraddr &1dd5 18 CLC &1dd6 69 22 ADC #&22 &1dd8 8d b7 1c STA &1cb7 &1ddb a5 71 LDA &71; playeraddr_h &1ddd 69 00 ADC #&00 &1ddf 8d b8 1c STA &1cb8 &1de2 20 2e 19 JSR &192e; addspacetolist &1de5 20 00 11 JSR &1100; redraw &1de8 a2 00 LDX #&00 &1dea 60 RTS &1deb canpushup a5 70 LDA &70; playeraddr &1ded 38 SEC &1dee e9 21 SBC #&21 &1df0 85 aa STA &aa &1df2 a5 71 LDA &71; playeraddr_h &1df4 e9 00 SBC #&00 &1df6 85 ab STA &ab &1df8 a0 01 LDY #&01 &1dfa b1 aa LDA (&aa),Y &1dfc f0 0b BEQ &1e09 &1dfe a6 af LDX ⁡ moverisdoll &1e00 d0 04 BNE &1e06 &1e02 c9 06 CMP #&06 &1e04 f0 03 BEQ &1e09 &1e06 a2 01 LDX #&01 &1e08 60 RTS &1e09 a0 21 LDY #&21 &1e0b b1 aa LDA (&aa),Y &1e0d a0 01 LDY #&01 &1e0f 91 aa STA (&aa),Y &1e11 a0 21 LDY #&21 &1e13 a9 00 LDA #&00 &1e15 91 aa STA (&aa),Y &1e17 a4 af LDY ⁡ moverisdoll &1e19 f0 16 BEQ &1e31 &1e1b a5 aa LDA &aa &1e1d 38 SEC &1e1e e9 20 SBC #&20 &1e20 85 a8 STA &a8 &1e22 a5 ab LDA &ab &1e24 e9 00 SBC #&00 &1e26 85 a9 STA &a9 &1e28 a0 01 LDY #&01 &1e2a b1 a8 LDA (&a8),Y &1e2c d0 21 BNE &1e4f &1e2e 4c 40 1e JMP &1e40 &1e31 b1 aa LDA (&aa),Y &1e33 f0 0b BEQ &1e40 &1e35 a6 af LDX ⁡ moverisdoll &1e37 d0 16 BNE &1e4f &1e39 c9 05 CMP #&05 &1e3b f0 03 BEQ &1e40 &1e3d 4c 4f 1e JMP &1e4f &1e40 a6 aa LDX &aa &1e42 e8 INX &1e43 8a TXA &1e44 8d b7 1c STA &1cb7 &1e47 a5 ab LDA &ab &1e49 8d b8 1c STA &1cb8 &1e4c 20 2e 19 JSR &192e; addspacetolist &1e4f 20 00 11 JSR &1100; redraw &1e52 a2 00 LDX #&00 &1e54 60 RTS &1e55 canpushdown a0 60 LDY #&60 &1e57 b1 70 LDA (&70),Y; playeraddr &1e59 f0 0b BEQ &1e66 &1e5b a6 af LDX ⁡ moverisdoll &1e5d d0 04 BNE &1e63 &1e5f c9 06 CMP #&06 &1e61 f0 03 BEQ &1e66 &1e63 a2 01 LDX #&01 &1e65 60 RTS &1e66 a0 40 LDY #&40 &1e68 b1 70 LDA (&70),Y; playeraddr &1e6a a0 60 LDY #&60 &1e6c 91 70 STA (&70),Y; playeraddr &1e6e a0 40 LDY #&40 &1e70 a9 00 LDA #&00 &1e72 91 70 STA (&70),Y; playeraddr &1e74 a0 5f LDY #&5f &1e76 a5 af LDA ⁡ moverisdoll &1e78 f0 02 BEQ &1e7c &1e7a a0 80 LDY #&80 &1e7c b1 70 LDA (&70),Y; playeraddr &1e7e f0 0b BEQ &1e8b &1e80 a6 af LDX ⁡ moverisdoll &1e82 d0 19 BNE &1e9d &1e84 c9 05 CMP #&05 &1e86 f0 03 BEQ &1e8b &1e88 4c 9d 1e JMP &1e9d &1e8b a5 70 LDA &70; playeraddr &1e8d 18 CLC &1e8e 69 60 ADC #&60 &1e90 8d b7 1c STA &1cb7 &1e93 a5 71 LDA &71; playeraddr_h &1e95 69 00 ADC #&00 &1e97 8d b8 1c STA &1cb8 &1e9a 20 2e 19 JSR &192e; addspacetolist &1e9d 20 00 11 JSR &1100; redraw &1ea0 a2 00 LDX #&00 &1ea2 60 RTS &1ea3 sleep a8 TAY &1ea4 a2 ff LDX #&ff &1ea6 ea NOP &1ea7 ea NOP &1ea8 ca DEX &1ea9 d0 fb BNE &1ea6 &1eab 88 DEY &1eac d0 f6 BNE &1ea4 &1eae 60 RTS ; gets called with y=0, y=1 &1eaf checkplayersok 84 95 STY &95; explosionnumber &1eb1 b9 09 1f LDA &1f09,Y ; player has been exploded by explosion Y? &1eb4 f0 3e BEQ &1ef4 &1eb6 a6 91 LDX &91; otherplayerok &1eb8 d0 06 BNE &1ec0 &1eba 20 a9 24 JSR &24a9; plotgotcha &1ebd 4c 0b 1f JMP &1f0b; gamefailed &1ec0 ca DEX &1ec1 86 91 STX &91; otherplayerok &1ec3 c9 02 CMP #&02 &1ec5 f0 13 BEQ &1eda &1ec7 a5 90 LDA &90; currentplayer &1ec9 c9 02 CMP #&02 &1ecb f0 20 BEQ &1eed &1ecd a9 00 LDA #&00 &1ecf a4 95 LDY &95; explosionnumber &1ed1 99 09 1f STA &1f09,Y &1ed4 20 c6 24 JSR &24c6; plotwhoops &1ed7 4c 6f 17 JMP &176f; isquaestor ; try to swap players &1eda a5 90 LDA &90; currentplayer &1edc c9 03 CMP #&03 &1ede f0 0d BEQ &1eed &1ee0 a9 00 LDA #&00 &1ee2 a4 95 LDY &95; explosionnumber &1ee4 99 09 1f STA &1f09,Y &1ee7 20 c6 24 JSR &24c6; plotwhoops &1eea 4c b7 17 JMP &17b7; ismagus ; try to swap players &1eed a9 00 LDA #&00 &1eef a4 95 LDY &95; explosionnumber &1ef1 99 09 1f STA &1f09,Y &1ef4 ad 04 21 LDA &2104 ; players ok, are we out of moves? &1ef7 f0 06 BEQ &1eff &1ef9 20 8a 24 JSR &248a; plottoomanymoves &1efc 4c 0b 1f JMP &1f0b; gamefailed &1eff a4 95 LDY &95; explosionnumber &1f01 f0 03 BEQ &1f06 &1f03 4c a2 13 JMP &13a2 &1f06 4c 9d 13 JMP &139d &1f09 00 BRK &1f0a 00 BRK &1f0b gamefailed a9 00 LDA #&00 &1f0d 60 RTS ; Y = number of explosion, 0 or 1 ; this allows two players to be killed with one bang &1f0e doexplosion 84 95 STY &95; explosionnumber &1f10 20 1e 22 JSR &221e; flashexplosion &1f13 a9 0f LDA #&0f &1f15 20 a3 1e JSR &1ea3; sleep &1f18 20 1e 22 JSR &221e; flashexplosion &1f1b a0 00 LDY #&00 &1f1d b1 a8 LDA (&a8),Y &1f1f c9 02 CMP #&02 ; magus &1f21 d0 05 BNE &1f28 &1f23 a4 95 LDY &95; explosionnumber ; magus has been exploded &1f25 99 09 1f STA &1f09,Y &1f28 c9 03 CMP #&03 ; quaestor &1f2a d0 05 BNE &1f31 &1f2c a4 95 LDY &95; explosionnumber ; quaestor has been exploded &1f2e 99 09 1f STA &1f09,Y &1f31 c9 0f CMP #&0f ; switch &1f33 d0 03 BNE &1f38 &1f35 20 73 20 JSR &2073; pressswitch ; switch has been exploded &1f38 60 RTS &1f39 doteleport a5 70 LDA &70; playeraddr &1f3b 18 CLC &1f3c 65 ac ADC ∾ playermotion &1f3e 85 ad STA &ad &1f40 a5 71 LDA &71; playeraddr_h &1f42 69 00 ADC #&00 &1f44 85 ae STA &ae &1f46 a2 00 LDX #&00 &1f48 b5 98 LDA &98,X &1f4a c5 ad CMP &ad &1f4c d0 0e BNE &1f5c &1f4e e8 INX &1f4f b5 98 LDA &98,X &1f51 c5 ae CMP &ae &1f53 d0 07 BNE &1f5c &1f55 a0 08 LDY #&08 ; second teleport &1f57 84 6c STY &6c &1f59 4c 60 1f JMP &1f60 &1f5c a0 00 LDY #&00 ; first teleport &1f5e 84 6c STY &6c &1f60 a6 6c LDX &6c &1f62 b5 98 LDA &98,X &1f64 38 SEC &1f65 e9 20 SBC #&20 &1f67 85 5e STA &5e &1f69 e8 INX &1f6a b5 98 LDA &98,X &1f6c e9 00 SBC #&00 &1f6e 85 5f STA &5f &1f70 a0 21 LDY #&21 ; right &1f72 b1 5e LDA (&5e),Y &1f74 f0 4d BEQ &1fc3; teleportdirok &1f76 a0 00 LDY #&00 ; up &1f78 b1 5e LDA (&5e),Y &1f7a f0 47 BEQ &1fc3; teleportdirok &1f7c a0 1f LDY #&1f ; left &1f7e b1 5e LDA (&5e),Y &1f80 f0 41 BEQ &1fc3; teleportdirok &1f82 a0 40 LDY #&40 ; down &1f84 b1 5e LDA (&5e),Y &1f86 f0 3b BEQ &1fc3; teleportdirok &1f88 a4 6c LDY &6c &1f8a a5 76 LDA &76; viewpointaddr &1f8c 8d 46 20 STA &2046 &1f8f a5 77 LDA &77; viewpointaddr_h &1f91 8d 47 20 STA &2047 &1f94 c0 08 CPY #&08 &1f96 f0 0b BEQ &1fa3 &1f98 a5 9e LDA &9e ; copy first teleport viewpoint to current view &1f9a 85 76 STA &76; viewpointaddr &1f9c a5 9f LDA &9f &1f9e 85 77 STA &77; viewpointaddr_h &1fa0 4c ab 1f JMP &1fab &1fa3 a5 a6 LDA &a6 ; copy second teleport viewpoint to current view &1fa5 85 76 STA &76; viewpointaddr &1fa7 a5 a7 LDA &a7 &1fa9 85 77 STA &77; viewpointaddr_h &1fab 20 00 11 JSR &1100; redraw &1fae a9 ff LDA #&ff &1fb0 20 a3 1e JSR &1ea3; sleep &1fb3 ad 46 20 LDA &2046 &1fb6 85 76 STA &76; viewpointaddr &1fb8 ad 47 20 LDA &2047 &1fbb 85 77 STA &77; viewpointaddr_h &1fbd 20 00 11 JSR &1100; redraw &1fc0 a2 01 LDX #&01 &1fc2 60 RTS &1fc3 teleportdirok 98 TYA &1fc4 aa TAX &1fc5 a5 70 LDA &70; playeraddr ; &60-1 = &70-1 = player address &1fc7 85 60 STA &60 &1fc9 a5 71 LDA &71; playeraddr_h &1fcb 85 61 STA &61 &1fcd 8e 48 20 STX &2048 &1fd0 a5 6c LDA &6c &1fd2 f0 0e BEQ &1fe2 &1fd4 a2 00 LDX #&00 &1fd6 b5 a0 LDA &a0,X &1fd8 95 70 STA &70,X; playeraddr &1fda e8 INX &1fdb e0 08 CPX #&08 &1fdd d0 f7 BNE &1fd6 &1fdf 4c ed 1f JMP &1fed &1fe2 a2 00 LDX #&00 &1fe4 b5 98 LDA &98,X &1fe6 95 70 STA &70,X; playeraddr &1fe8 e8 INX &1fe9 e0 08 CPX #&08 &1feb d0 f7 BNE &1fe4 &1fed a5 5e LDA &5e &1fef a2 00 LDX #&00 &1ff1 18 CLC &1ff2 6d 48 20 ADC &2048 &1ff5 95 70 STA &70,X; playeraddr &1ff7 e8 INX &1ff8 a5 5f LDA &5f &1ffa 69 00 ADC #&00 &1ffc 95 70 STA &70,X; playeraddr &1ffe a5 70 LDA &70; playeraddr &2000 38 SEC &2001 e9 20 SBC #&20 &2003 85 70 STA &70; playeraddr &2005 a5 71 LDA &71; playeraddr_h &2007 e9 00 SBC #&00 &2009 85 71 STA &71; playeraddr_h &200b ad 48 20 LDA &2048 &200e d0 04 BNE &2014 ; up &2010 c6 73 DEC &73; playeryoffset &2012 a5 6c LDA &6c &2014 c9 21 CMP #&21 ; right &2016 d0 02 BNE &201a &2018 e6 72 INC &72; playerxoffset &201a c9 1f CMP #&1f ; left &201c d0 05 BNE &2023 &201e c6 72 DEC &72; playerxoffset &2020 4c 29 20 JMP &2029 &2023 c9 40 CMP #&40 ; down &2025 d0 02 BNE &2029 &2027 e6 73 INC &73; playeryoffset &2029 a2 00 LDX #&00 &202b 60 RTS &202c storeplayerstate a5 70 LDA &70; playeraddr &202e 85 5e STA &5e &2030 a5 71 LDA &71; playeraddr_h &2032 85 5f STA &5f &2034 a5 60 LDA &60 &2036 85 70 STA &70; playeraddr &2038 a5 61 LDA &61 &203a 85 71 STA &71; playeraddr_h &203c 60 RTS &203d restoreplayerstate a5 5e LDA &5e &203f 85 70 STA &70; playeraddr &2041 a5 5f LDA &5f &2043 85 71 STA &71; playeraddr_h &2045 60 RTS ; used to store viewpoints &2046 ea NOP &2047 ea NOP &2048 ea NOP &2049 ea NOP &204a ea NOP &204b ea NOP &204c ea NOP &204d ea NOP ; returns X=1 if no good &204e canteleport a0 00 LDY #&00 &2050 b1 98 LDA (&98),Y &2052 c9 0e CMP #&0e ; is first teleport a teleport? &2054 f0 0a BEQ &2060 &2056 a9 01 LDA #&01 ; set second teleport to wall &2058 91 a0 STA (&a0),Y &205a 20 00 11 JSR &1100; redraw &205d a2 01 LDX #&01 ; can't move &205f 60 RTS &2060 b1 a0 LDA (&a0),Y &2062 c9 0e CMP #&0e ; is second teleport a teleport? &2064 d0 03 BNE &2069 &2066 a2 00 LDX #&00 ; can move &2068 60 RTS &2069 a9 01 LDA #&01 ; set first teleport to wall &206b 91 98 STA (&98),Y &206d 20 00 11 JSR &1100; redraw &2070 a2 01 LDX #&01 ; can't move &2072 60 RTS &2073 pressswitch a4 96 LDY &96; switched &2075 d0 12 BNE &2089 &2077 a0 00 LDY #&00 &2079 98 TYA &207a 99 48 50 STA &5048,Y; sprite_wall ; blank current wall &207d c8 INY &207e c0 48 CPY #&48 &2080 d0 f8 BNE &207a &2082 a0 01 LDY #&01 ; lights are off &2084 84 96 STY &96; switched &2086 4c 9a 20 JMP &209a &2089 a0 00 LDY #&00 &208b b9 b0 55 LDA &55b0,Y ; copy level wall into current wall &208e 99 48 50 STA &5048,Y; sprite_wall &2091 c8 INY &2092 c0 48 CPY #&48 &2094 d0 f5 BNE &208b &2096 a0 00 LDY #&00 ; lights are on &2098 84 96 STY &96; switched &209a 20 00 11 JSR &1100; redraw &209d 60 RTS &209e dollmover a5 a8 LDA &a8 ; &a8-9 = doll's current position - 32 &20a0 38 SEC &20a1 e9 20 SBC #&20 &20a3 85 a8 STA &a8 &20a5 a5 a9 LDA &a9 &20a7 e9 00 SBC #&00 &20a9 85 a9 STA &a9 &20ab a4 b0 LDY &b0; dolldirection &20ad b1 a8 LDA (&a8),Y ; piece in doll's direction &20af f0 03 BEQ &20b4 ; is it a space? &20b1 4c 90 13 JMP &1390; mainloop &20b4 a5 a8 LDA &a8 &20b6 18 CLC &20b7 65 b0 ADC &b0; dolldirection &20b9 85 aa STA &aa &20bb a5 a9 LDA &a9 &20bd 69 00 ADC #&00 &20bf 85 ab STA &ab ; &aa-b = doll's new position &20c1 a5 a8 LDA &a8 &20c3 18 CLC &20c4 69 20 ADC #&20 &20c6 85 a8 STA &a8 &20c8 a5 a9 LDA &a9 &20ca 69 00 ADC #&00 &20cc 85 a9 STA &a9 ; &a8-9 = doll's current position &20ce 20 f2 19 JSR &19f2; movemover &20d1 a5 aa LDA &aa &20d3 38 SEC &20d4 e9 20 SBC #&20 &20d6 85 aa STA &aa &20d8 a5 ab LDA &ab &20da e9 00 SBC #&00 &20dc 85 ab STA &ab ; &aa-b = doll's future position &20de a4 b0 LDY &b0; dolldirection &20e0 b1 aa LDA (&aa),Y ; what's next for the doll? &20e2 f0 03 BEQ &20e7 ; is it a space? &20e4 4c 90 13 JMP &1390; mainloop &20e7 a5 aa LDA &aa &20e9 18 CLC &20ea 69 20 ADC #&20 &20ec 85 aa STA &aa &20ee a5 ab LDA &ab &20f0 69 00 ADC #&00 &20f2 85 ab STA &ab &20f4 4c e2 19 JMP &19e2; addpiecetolist ; if so, add it to the list ; assembler fragment &20f7 6f 6b 33 20 43 4d 50 23 31 ; ok3 CMP#1 ; move counter digits &2100 ea ea ea ea ; out of moves? &2104 ea NOP &2105 movecounter a6 b1 LDX &b1; isreplay ; is replay &2107 d0 05 BNE &210e &2109 a6 b6 LDX &b6; movetype &210b 20 4e 22 JSR &224e; storemove &210e ee 00 21 INC &2100 &2111 ad 00 21 LDA &2100 &2114 c9 0a CMP #&0a &2116 d0 33 BNE &214b &2118 a9 00 LDA #&00 &211a 8d 00 21 STA &2100 &211d ee 01 21 INC &2101 &2120 ad 01 21 LDA &2101 &2123 c9 0a CMP #&0a &2125 d0 24 BNE &214b &2127 a9 00 LDA #&00 &2129 8d 01 21 STA &2101 &212c ee 02 21 INC &2102 &212f ad 02 21 LDA &2102 &2132 c9 0a CMP #&0a &2134 d0 15 BNE &214b &2136 a9 00 LDA #&00 &2138 8d 02 21 STA &2102 &213b ee 03 21 INC &2103 &213e ad 03 21 LDA &2103 &2141 c9 02 CMP #&02 &2143 d0 06 BNE &214b &2145 a9 01 LDA #&01 &2147 8d 04 21 STA &2104 &214a 60 RTS &214b 20 4f 21 JSR &214f &214e 60 RTS &214f a9 73 LDA #&73 &2151 8d 8c 21 STA &218c &2154 a9 68 LDA #&68 &2156 8d 8b 21 STA &218b &2159 ad 00 21 LDA &2100 &215c 20 81 21 JSR &2181; plotnumber &215f a9 60 LDA #&60 &2161 8d 8b 21 STA &218b &2164 ad 01 21 LDA &2101 &2167 20 81 21 JSR &2181; plotnumber &216a a9 58 LDA #&58 &216c 8d 8b 21 STA &218b &216f ad 02 21 LDA &2102 &2172 20 81 21 JSR &2181; plotnumber &2175 a9 50 LDA #&50 &2177 8d 8b 21 STA &218b &217a ad 03 21 LDA &2103 &217d 20 81 21 JSR &2181; plotnumber &2180 60 RTS &2181 plotnumber 0a ASL &2182 0a ASL &2183 0a ASL &2184 a8 TAY &2185 a2 00 LDX #&00 &2187 b9 f8 55 LDA &55f8,Y; sprites_numbers &218a 9d 00 80 STA &8000,X ; self modifying code &218d e8 INX &218e c8 INY &218f e0 08 CPX #&08 &2191 d0 f4 BNE &2187 &2193 60 RTS &2194 initcounters a9 00 LDA #&00 &2196 8d 00 21 STA &2100 ; reset move counter &2199 8d 01 21 STA &2101 &219c 8d 02 21 STA &2102 &219f 8d 03 21 STA &2103 &21a2 8d 04 21 STA &2104 &21a5 20 4f 21 JSR &214f &21a8 a9 80 LDA #&80 ; plot mask on right of screen &21aa 85 58 STA &58; screenaddr &21ac a9 79 LDA #&79 ; screen address = &7980 &21ae 85 59 STA &59; screenaddr_h &21b0 a9 0b LDA #&0b ; mask &21b2 20 2d 11 JSR &112d; plotpiece &21b5 a5 92 LDA &92; masktotal &21b7 a0 00 LDY #&00 &21b9 38 SEC &21ba c8 INY &21bb e9 0a SBC #&0a &21bd b0 fb BCS &21ba &21bf 69 0a ADC #&0a &21c1 8d 1d 22 STA &221d &21c4 88 DEY &21c5 a9 b0 LDA #&b0 &21c7 8d 8b 21 STA &218b &21ca a9 7a LDA #&7a &21cc 8d 8c 21 STA &218c &21cf 98 TYA &21d0 20 81 21 JSR &2181; plotnumber &21d3 a9 b8 LDA #&b8 &21d5 8d 8b 21 STA &218b &21d8 ad 1d 22 LDA &221d &21db 20 81 21 JSR &2181; plotnumber &21de a9 e0 LDA #&e0 &21e0 8d 8b 21 STA &218b &21e3 a9 00 LDA #&00 &21e5 20 81 21 JSR &2181; plotnumber &21e8 a9 e8 LDA #&e8 &21ea 8d 8b 21 STA &218b &21ed a9 00 LDA #&00 &21ef 20 81 21 JSR &2181; plotnumber &21f2 60 RTS &21f3 plotmaskcount a5 93 LDA &93; maskcount ; mask count &21f5 a0 00 LDY #&00 &21f7 38 SEC &21f8 c8 INY &21f9 e9 0a SBC #&0a &21fb b0 fb BCS &21f8 &21fd 69 0a ADC #&0a &21ff 8d 1d 22 STA &221d &2202 88 DEY &2203 a9 7a LDA #&7a &2205 8d 8c 21 STA &218c &2208 a9 e0 LDA #&e0 &220a 8d 8b 21 STA &218b &220d 98 TYA &220e 20 81 21 JSR &2181; plotnumber &2211 a9 e8 LDA #&e8 &2213 8d 8b 21 STA &218b &2216 ad 1d 22 LDA &221d &2219 20 81 21 JSR &2181; plotnumber &221c 60 RTS &221d ea NOP &221e flashexplosion a2 02 LDX #&02 &2220 ad 4a 22 LDA &224a &2223 ac 46 22 LDY &2246 &2226 8d 46 22 STA &2246 &2229 8c 4a 22 STY &224a &222c a0 06 LDY #&06 &222e b9 46 22 LDA &2246,Y &2231 20 ee ff JSR &ffee; OSWRCH ; change colour vdu 19,0,a,0,0,0,b &2234 88 DEY &2235 d0 f7 BNE &222e &2237 8e 4d 22 STX &224d &223a a9 0f LDA #&0f &223c 20 a3 1e JSR &1ea3; sleep &223f ae 4d 22 LDX &224d &2242 ca DEX &2243 d0 db BNE &2220 &2245 60 RTS ; table for colour change &2246 ea 00 00 00 00 00 13 ; counter for flash explosion &224d ea NOP &224e storemove a5 b2 LDA &b2; movecount &2250 f0 2c BEQ &227e &2252 8a TXA &2253 0a ASL &2254 0a ASL &2255 0a ASL &2256 0a ASL &2257 09 0f ORA #&0f &2259 85 b5 STA &b5; tempreplay &225b a9 00 LDA #&00 &225d 85 b2 STA &b2; movecount &225f a0 00 LDY #&00 &2261 b1 b3 LDA (&b3),Y; replayaddr ; get replay data &2263 09 f0 ORA #&f0 &2265 25 b5 AND &b5; tempreplay &2267 91 b3 STA (&b3),Y; replayaddr ; store replay data &2269 e6 b3 INC &b3; replayaddr &226b a5 b3 LDA &b3; replayaddr &226d d0 1b BNE &228a &226f e6 b4 INC &b4; replayaddr_h &2271 a5 b4 LDA &b4; replayaddr_h &2273 c9 08 CMP #&08 &2275 d0 13 BNE &228a &2277 a9 4c LDA #&4c &2279 85 b4 STA &b4; replayaddr_h &227b 4c 8a 22 JMP &228a &227e 86 b5 STX &b5; tempreplay &2280 a9 01 LDA #&01 &2282 85 b2 STA &b2; movecount &2284 a5 b5 LDA &b5; tempreplay &2286 a0 00 LDY #&00 &2288 91 b3 STA (&b3),Y; replayaddr ; store replay data &228a 60 RTS &228b getreplaymove c9 a2 CMP #&a2 &228d f0 58 BEQ &22e7 &228f a5 b2 LDA &b2; movecount &2291 f0 23 BEQ &22b6 &2293 a0 00 LDY #&00 &2295 84 b2 STY &b2; movecount &2297 b1 b3 LDA (&b3),Y; replayaddr ; get replay data &2299 29 f0 AND #&f0 &229b 4a LSR &229c 4a LSR &229d 4a LSR &229e 4a LSR &229f 85 b5 STA &b5; tempreplay &22a1 e6 b3 INC &b3; replayaddr &22a3 a5 b3 LDA &b3; replayaddr &22a5 d0 1a BNE &22c1 &22a7 e6 b4 INC &b4; replayaddr_h &22a9 a5 b4 LDA &b4; replayaddr_h &22ab c9 08 CMP #&08 &22ad d0 12 BNE &22c1 &22af a9 4c LDA #&4c &22b1 85 b4 STA &b4; replayaddr_h &22b3 4c c1 22 JMP &22c1 &22b6 a0 01 LDY #&01 &22b8 84 b2 STY &b2; movecount &22ba 88 DEY &22bb b1 b3 LDA (&b3),Y; replayaddr ; get replay data &22bd 29 0f AND #&0f &22bf 85 b5 STA &b5; tempreplay &22c1 a5 b5 LDA &b5; tempreplay &22c3 f0 1c BEQ &22e1 &22c5 c9 01 CMP #&01 &22c7 f0 15 BEQ &22de &22c9 c9 02 CMP #&02 &22cb f0 0e BEQ &22db &22cd c9 03 CMP #&03 &22cf f0 07 BEQ &22d8 &22d1 c9 04 CMP #&04 &22d3 f0 0f BEQ &22e4 &22d5 a9 a2 LDA #&a2 &22d7 60 RTS &22d8 a9 e1 LDA #&e1 &22da 60 RTS &22db a9 c2 LDA #&c2 &22dd 60 RTS &22de a9 e8 LDA #&e8 &22e0 60 RTS &22e1 a9 c8 LDA #&c8 &22e3 60 RTS &22e4 a9 c9 LDA #&c9 &22e6 60 RTS &22e7 60 RTS &22e8 copyleveldata a5 60 LDA &60 ; &60-1 contains leveldata &22ea 18 CLC &22eb 69 c2 ADC #&c2 ; &5e-f contains leveldata+&1c2 &22ed 85 5e STA &5e &22ef a5 61 LDA &61 ; msb of level data &22f1 69 01 ADC #&01 &22f3 85 5f STA &5f &22f5 a0 00 LDY #&00 &22f7 b1 5e LDA (&5e),Y ; copy block of &30 bytes to &78-&a7 &22f9 99 78 00 STA &0078,Y &22fc c8 INY &22fd c0 30 CPY #&30 &22ff d0 f6 BNE &22f7 &2301 a2 00 LDX #&00 &2303 b5 80 LDA &80,X ; copy &80-7 to &70-7, ie magus' data &2305 95 70 STA &70,X; playeraddr &2307 e8 INX &2308 e0 08 CPX #&08 &230a d0 f7 BNE &2303 &230c a9 00 LDA #&00 ; &62 = highnibble &230e 85 62 STA &62 &2310 a9 21 LDA #&21 ; &5e-f = &921 = start of inner map &2312 85 5e STA &5e &2314 a9 09 LDA #&09 &2316 85 5f STA &5f &2318 a0 00 LDY #&00 &231a b1 60 LDA (&60),Y &231c a6 62 LDX &62 &231e e0 01 CPX #&01 &2320 d0 04 BNE &2326 &2322 4a LSR ; shift high nibble into low nibble &2323 4a LSR &2324 4a LSR &2325 4a LSR &2326 29 0f AND #&0f &2328 91 5e STA (&5e),Y ; store in map data &232a a5 62 LDA &62 &232c 49 01 EOR #&01 &232e 85 62 STA &62 &2330 d0 06 BNE &2338 &2332 e6 60 INC &60 ; if high nibble, move to next data &2334 d0 02 BNE &2338 &2336 e6 61 INC &61 &2338 a5 5e LDA &5e &233a 29 1f AND #&1f &233c c9 1e CMP #&1e &233e d0 06 BNE &2346 &2340 20 59 23 JSR &2359; incmapdata ; if end of row, move to next row &2343 20 59 23 JSR &2359; incmapdata &2346 20 59 23 JSR &2359; incmapdata &2349 a5 5f LDA &5f &234b c9 0c CMP #&0c &234d d0 06 BNE &2355 &234f a5 5e LDA &5e &2351 c9 e1 CMP #&e1 &2353 f0 03 BEQ &2358 ; if last row (&ce1), return &2355 4c 18 23 JMP &2318 &2358 60 RTS &2359 incmapdata e6 5e INC &5e &235b d0 02 BNE &235f &235d e6 5f INC &5f &235f 60 RTS ; assembler fragment &2360 3a 68 65 72 6f 3d 32 0d 00 fa 29 68 65 72 6f 78 ; ":herox=&72:heroy=&73:?" &2370 3d 26 37 32 3a 68 65 72 6f 79 3d 26 37 33 3a 3f &2380 filllevel a9 09 LDA #&09 &2382 8d 8e 23 STA &238e &2385 a9 01 LDA #&01 &2387 a0 00 LDY #&00 &2389 8c 8d 23 STY &238d &238c 99 00 09 STA &0900,Y &238f c8 INY &2390 d0 fa BNE &238c &2392 ee 8e 23 INC &238e &2395 ae 8e 23 LDX &238e &2398 e0 0d CPX #&0d &239a d0 f0 BNE &238c &239c 60 RTS &239d initvars a9 80 LDA #&80 &239f 85 56 STA &56; screenlookupptr &23a1 a9 54 LDA #&54 &23a3 85 57 STA &57; screenlookupptr_h ; &5480 &23a5 a9 00 LDA #&00 &23a7 8d 09 1f STA &1f09 &23aa 8d 0a 1f STA &1f0a &23ad 85 5a STA &5a; spritelookupptr &23af 85 6e STA &6e ; unused? &23b1 85 b2 STA &b2; movecount &23b3 85 b3 STA &b3; replayaddr &23b5 a9 55 LDA #&55 &23b7 85 5b STA &5b; spritelookupptr_h ; &5500 &23b9 a9 ed LDA #&ed &23bb 85 6d STA &6d ; unused? &23bd a9 04 LDA #&04 &23bf 85 b4 STA &b4; replayaddr_h ; &0400 &23c1 60 RTS ; &53-4 = address of text to be plotted &23c2 plottext a9 00 LDA #&00 ; calculate screen memory address &23c4 85 5e STA &5e &23c6 a9 58 LDA #&58 &23c8 85 5f STA &5f &23ca a0 01 LDY #&01 &23cc b1 53 LDA (&53),Y; temp &23ce aa TAX &23cf e6 5f INC &5f &23d1 18 CLC &23d2 a5 5e LDA &5e &23d4 69 40 ADC #&40 &23d6 85 5e STA &5e &23d8 90 02 BCC &23dc &23da e6 5f INC &5f &23dc ca DEX &23dd d0 f0 BNE &23cf &23df 88 DEY &23e0 b1 53 LDA (&53),Y; temp &23e2 aa TAX &23e3 e0 00 CPX #&00 &23e5 f0 07 BEQ &23ee &23e7 ca DEX &23e8 20 4b 24 JSR &244b &23eb 4c e3 23 JMP &23e3 &23ee a0 02 LDY #&02 &23f0 84 60 STY &60 &23f2 a4 60 LDY &60 &23f4 b1 53 LDA (&53),Y; temp ; read next character &23f6 c9 20 CMP #&20 &23f8 d0 02 BNE &23fc &23fa a9 5b LDA #&5b ; if space, swap for [ &23fc c9 3f CMP #&3f &23fe d0 02 BNE &2402 &2400 a9 5c LDA #&5c ; if ?, swap for [ &2402 c9 0d CMP #&0d &2404 d0 01 BNE &2407 &2406 60 RTS ; if &0d, return &2407 38 SEC &2408 e9 41 SBC #&41 &240a aa TAX &240b c8 INY &240c 84 60 STY &60 &240e a0 00 LDY #&00 &2410 a9 00 LDA #&00 &2412 e0 00 CPX #&00 &2414 f0 07 BEQ &241d &2416 ca DEX &2417 18 CLC &2418 69 05 ADC #&05 &241a 4c 12 24 JMP &2412 &241d aa TAX &241e a0 00 LDY #&00 &2420 98 TYA &2421 91 5e STA (&5e),Y &2423 8a TXA &2424 a8 TAY &2425 a2 01 LDX #&01 &2427 b9 60 56 LDA &5660,Y; sprites_font ; get font data &242a 84 61 STY &61 &242c 86 62 STX &62 &242e a4 62 LDY &62 &2430 91 5e STA (&5e),Y &2432 a4 61 LDY &61 &2434 a6 62 LDX &62 &2436 c8 INY &2437 e8 INX &2438 e0 06 CPX #&06 &243a d0 eb BNE &2427 &243c 8a TXA &243d a8 TAY &243e a9 00 LDA #&00 &2440 91 5e STA (&5e),Y &2442 c8 INY &2443 91 5e STA (&5e),Y &2445 20 4b 24 JSR &244b &2448 4c f2 23 JMP &23f2 &244b a5 5e LDA &5e &244d 18 CLC &244e 69 08 ADC #&08 &2450 85 5e STA &5e &2452 90 02 BCC &2456 &2454 e6 5f INC &5f &2456 60 RTS &2457 clearmap a9 61 LDA #&61 &2459 8d 69 24 STA &2469 &245c a9 a8 LDA #&a8 &245e 8d 68 24 STA &2468 &2461 a9 00 LDA #&00 &2463 aa TAX &2464 a0 00 LDY #&00 &2466 98 TYA &2467 99 00 80 STA &8000,Y ; self modifying code &246a c8 INY &246b c0 40 CPY #&40 &246d d0 f8 BNE &2467 &246f e8 INX &2470 e0 08 CPX #&08 &2472 f0 14 BEQ &2488 &2474 ad 68 24 LDA &2468 &2477 18 CLC &2478 69 40 ADC #&40 &247a 8d 68 24 STA &2468 &247d ad 69 24 LDA &2469 &2480 69 01 ADC #&01 &2482 8d 69 24 STA &2469 &2485 4c 64 24 JMP &2464 &2488 60 RTS &2489 ea NOP &248a plottoomanymoves a9 96 LDA #&96 &248c 85 53 STA &53; temp &248e a9 24 LDA #&24 &2490 85 54 STA &54; temp_h &2492 20 c2 23 JSR &23c2; plottext &2495 60 RTS &2496 05 15 20 54 4f 4f 20 4d 41 4e 59 20 4d 4f 56 45 ; " TOO MANY MOVES " &24a6 53 20 0d &24a9 plotgotcha a9 b5 LDA #&b5 &24ab 85 53 STA &53; temp &24ad a9 24 LDA #&24 &24af 85 54 STA &54; temp_h &24b1 20 c2 23 JSR &23c2; plottext &24b4 60 RTS &24b5 06 15 20 20 20 20 47 4f 54 43 48 41 20 20 20 20 ; " GOTCHA " &24c5 0d &24c6 plotwhoops a9 dd LDA #&dd &24c8 85 53 STA &53; temp &24ca a9 24 LDA #&24 &24cc 85 54 STA &54; temp_h &24ce 20 c2 23 JSR &23c2; plottext &24d1 sleep3 a9 fa LDA #&fa &24d3 20 a3 1e JSR &1ea3; sleep &24d6 20 a3 1e JSR &1ea3; sleep &24d9 20 a3 1e JSR &1ea3; sleep &24dc 60 RTS &24dd 08 15 20 20 20 57 48 4f 4f 50 53 20 20 20 20 0d ; " WHOOPS " &24ed ea NOP &24ee playgame a9 00 LDA #&00 &24f0 8d 89 24 STA &2489 &24f3 20 2b 25 JSR &252b; setuplevel &24f6 8d ed 24 STA &24ed &24f9 c9 01 CMP #&01 &24fb f0 2d BEQ &252a &24fd a9 51 LDA #&51 ; plot "REPLAY ?" &24ff 85 53 STA &53; temp &2501 a9 25 LDA #&25 &2503 85 54 STA &54; temp_h &2505 20 c2 23 JSR &23c2; plottext &2508 a9 15 LDA #&15 ; flush buffer &250a a2 00 LDX #&00 &250c 20 f4 ff JSR &fff4; OSBYTE &250f 20 00 28 JSR &2800; getkey &2512 ea NOP &2513 ea NOP &2514 c9 c4 CMP #&c4 ; &44 = Y # replay &2516 f0 07 BEQ &251f &2518 c9 d5 CMP #&d5 ; &55 = N # no replay &251a f0 0e BEQ &252a &251c 4c fd 24 JMP &24fd &251f a9 01 LDA #&01 ; replay &2521 8d 89 24 STA &2489 &2524 20 2b 25 JSR &252b; setuplevel &2527 4c fd 24 JMP &24fd &252a 60 RTS &252b setuplevel 20 57 24 JSR &2457; clearmap &252e 20 80 23 JSR &2380; filllevel &2531 a9 00 LDA #&00 &2533 85 60 STA &60 ; level data offset &2535 20 60 25 JSR &2560; calcleveladdr &2538 20 9d 23 JSR &239d; initvars &253b ad 89 24 LDA &2489 &253e 85 b1 STA &b1; isreplay &2540 20 e8 22 JSR &22e8; copyleveldata &2543 a9 01 LDA #&01 &2545 85 91 STA &91; otherplayerok &2547 20 7b 27 JSR &277b; copywallsprite &254a 20 94 21 JSR &2194; initcounters &254d 20 b7 17 JSR &17b7; ismagus ; which eventually jumps to mainloop &2550 60 RTS &2551 08 18 20 20 52 45 50 4c 41 59 20 20 3f 20 0d ; " REPLAY ? " &2560 calcleveladdr ad 6e 25 LDA &256e &2563 0a ASL &2564 85 61 STA &61 &2566 a9 4c LDA #&4c &2568 38 SEC &2569 e5 61 SBC &61 &256b 85 61 STA &61 &256d 60 RTS ; main ; 256e is also levelnumber &256e main ea NOP &256f 20 5e 27 JSR &275e; startmusic &2572 a9 01 LDA #&01 &2574 8d 6e 25 STA &256e; main &2577 mainscreenloop2 ad 6e 25 LDA &256e; main &257a c9 0b CMP #&0b &257c 30 07 BMI &2585; nothiddenlevel &257e 29 01 AND #&01 &2580 f0 03 BEQ &2585; nothiddenlevel &2582 ce 6e 25 DEC &256e; main ; hide hidden levels &2585 nothiddenlevel 20 93 26 JSR &2693; blankplayarea &2588 20 1d 26 JSR &261d; mainscreensprites &258b mainscreenloop 20 40 57 JSR &5740; setlevelcolours &258e 20 00 2c JSR &2c00; plotleveltitle &2591 a9 15 LDA #&15 ; flush buffer &2593 a2 00 LDX #&00 &2595 20 f4 ff JSR &fff4; OSBYTE &2598 20 e0 ff JSR &ffe0; OSRDCH ; get key &259b 09 20 ORA #&20 ; lower case it &259d c9 66 CMP #&66 ; forte &259f d0 07 BNE &25a8 &25a1 38 SEC &25a2 20 15 28 JSR &2815; altervolume &25a5 4c 8b 25 JMP &258b; mainscreenloop &25a8 c9 70 CMP #&70 ; piano &25aa d0 07 BNE &25b3 &25ac 18 CLC &25ad 20 15 28 JSR &2815; altervolume &25b0 4c 8b 25 JMP &258b; mainscreenloop &25b3 c9 6c CMP #&6c ; level &25b5 d0 1c BNE &25d3 &25b7 ee 6e 25 INC &256e; main ; increase level number &25ba ad 6e 25 LDA &256e; main &25bd c9 0b CMP #&0b &25bf 30 06 BMI &25c7 &25c1 ee 6e 25 INC &256e; main ; by two if level 10 or above &25c4 ad 6e 25 LDA &256e; main &25c7 c5 3f CMP &3f &25c9 d0 05 BNE &25d0 &25cb a9 01 LDA #&01 &25cd 8d 6e 25 STA &256e; main ; reset level number to 1 &25d0 4c 8b 25 JMP &258b; mainscreenloop &25d3 c9 65 CMP #&65 &25d5 d0 01 BNE &25d8 &25d7 ea NOP ; mystery nop if 'e' pressed &25d8 c9 20 CMP #&20 &25da d0 af BNE &258b; mainscreenloop ; space to play! &25dc 20 1d 27 JSR &271d; facezoom &25df 20 ee 24 JSR &24ee; playgame &25e2 ad ed 24 LDA &24ed ; level solved? &25e5 f0 90 BEQ &2577; mainscreenloop2 ; if not, go back to main screen &25e7 ee 6e 25 INC &256e; main &25ea ad 6e 25 LDA &256e; main &25ed c9 0a CMP #&0a &25ef 30 04 BMI &25f5 &25f1 29 01 AND #&01 &25f3 d0 12 BNE &2607; randomscreen &25f5 20 a9 28 JSR &28a9; showcodeletter &25f8 ad 6e 25 LDA &256e; main &25fb c5 3f CMP &3f ; did we just finish level 15? &25fd d0 05 BNE &2604 &25ff a9 01 LDA #&01 &2601 8d 6e 25 STA &256e; main ; if so, reset to level 1 &2604 4c 77 25 JMP &2577; mainscreenloop2 ; back to main screen &2607 randomscreen a2 11 LDX #&11 &2609 86 77 STX &77; viewpointaddr_h &260b 8a TXA &260c 48 PHA &260d 20 00 11 JSR &1100; redraw &2610 68 PLA &2611 aa TAX &2612 e8 INX &2613 e0 25 CPX #&25 &2615 d0 f2 BNE &2609 &2617 20 00 2c JSR &2c00; plotleveltitle &261a 4c df 25 JMP &25df ; go back and play the next level ; setup various mainscreen stuff &261d mainscreensprites 20 7b 27 JSR &277b; copywallsprite &2620 20 57 24 JSR &2457; clearmap &2623 20 94 21 JSR &2194; initcounters &2626 20 43 2c JSR &2c43; alternativekeys &2629 a9 80 LDA #&80 ; plot a space over mask on right &262b 85 58 STA &58; screenaddr &262d a9 79 LDA #&79 &262f 85 59 STA &59; screenaddr_h &2631 a9 00 LDA #&00 &2633 20 2d 11 JSR &112d; plotpiece &2636 a9 e8 LDA #&e8 ; plot a space over player on right &2638 85 58 STA &58; screenaddr &263a a9 71 LDA #&71 &263c 85 59 STA &59; screenaddr_h &263e a9 00 LDA #&00 &2640 20 2d 11 JSR &112d; plotpiece &2643 a9 68 LDA #&68 &2645 85 58 STA &58; screenaddr &2647 a9 79 LDA #&79 &2649 85 59 STA &59; screenaddr_h &264b a9 00 LDA #&00 &264d 20 2d 11 JSR &112d; plotpiece &2650 a0 00 LDY #&00 &2652 b9 8a 26 LDA &268a,Y ; copy in main screen faces &2655 99 c5 26 STA &26c5,Y; data_plotface &2658 c8 INY &2659 c0 08 CPY #&08 &265b d0 f5 BNE &2652 &265d 20 d2 26 JSR &26d2; plotmainscreenface &2660 a9 f0 LDA #&f0 ; "P piano" &56f0 &2662 85 53 STA &53; temp &2664 a9 56 LDA #&56 &2666 85 54 STA &54; temp_h &2668 20 c2 23 JSR &23c2; plottext &266b a9 fe LDA #&fe ; "F forte" &56fe &266d 85 53 STA &53; temp &266f 20 c2 23 JSR &23c2; plottext &2672 a9 0d LDA #&0d ; " " &570d &2674 85 53 STA &53; temp &2676 e6 54 INC &54; temp_h &2678 20 c2 23 JSR &23c2; plottext &267b a9 1b LDA #&1b ; "L next level" &571b &267d 85 53 STA &53; temp &267f 20 c2 23 JSR &23c2; plottext &2682 a9 2b LDA #&2b ; "Space to play" &5743 &2684 85 53 STA &53; temp &2686 20 c2 23 JSR &23c2; plottext &2689 60 RTS ; data for main screen faces &268a ff ff 81 81 81 ff 81 ff ; unused? &2692 ea NOP &2693 blankplayarea a9 90 LDA #&90 &2695 8d a4 26 STA &26a4 &2698 a9 5f LDA #&5f &269a 8d a5 26 STA &26a5 &269d a9 00 LDA #&00 &269f aa TAX &26a0 a0 00 LDY #&00 &26a2 98 TYA &26a3 99 00 80 STA &8000,Y &26a6 c8 INY &26a7 c0 c0 CPY #&c0 &26a9 d0 f8 BNE &26a3 &26ab e8 INX &26ac e0 18 CPX #&18 &26ae f0 14 BEQ &26c4 &26b0 ad a4 26 LDA &26a4 &26b3 18 CLC &26b4 69 40 ADC #&40 &26b6 8d a4 26 STA &26a4 &26b9 ad a5 26 LDA &26a5 &26bc 69 01 ADC #&01 &26be 8d a5 26 STA &26a5 &26c1 4c a0 26 JMP &26a0 &26c4 60 RTS ; data for plotting faces on main screen &26c5 data_plotface ea NOP &26c6 ea NOP &26c7 ea NOP &26c8 ea NOP &26c9 ea NOP &26ca ea NOP &26cb ea NOP &26cc ea NOP &26cd ea NOP &26ce ea NOP &26cf ea NOP &26d0 ea NOP &26d1 ea NOP ; plot faces on main screen &26d2 plotmainscreenface a9 00 LDA #&00 &26d4 a8 TAY &26d5 aa TAX &26d6 8d cd 26 STA &26cd &26d9 a2 00 LDX #&00 &26db b9 c5 26 LDA &26c5,Y; data_plotface &26de c8 INY &26df 8c cf 26 STY &26cf &26e2 a0 0b LDY #&0b ; self-modifying code &26e4 2a ROL &26e5 b0 02 BCS &26e9 &26e7 a0 00 LDY #&00 &26e9 8c d0 26 STY &26d0 &26ec 8d d1 26 STA &26d1 &26ef e8 INX &26f0 8e ce 26 STX &26ce &26f3 ac cd 26 LDY &26cd &26f6 b9 80 54 LDA &5480,Y; screenlookuptable &26f9 85 58 STA &58; screenaddr &26fb c8 INY &26fc b9 80 54 LDA &5480,Y; screenlookuptable &26ff 85 59 STA &59; screenaddr_h &2701 c8 INY &2702 8c cd 26 STY &26cd &2705 ad d0 26 LDA &26d0 &2708 20 2d 11 JSR &112d; plotpiece &270b ad d1 26 LDA &26d1 &270e ae ce 26 LDX &26ce &2711 ac cf 26 LDY &26cf &2714 e0 08 CPX #&08 &2716 d0 ca BNE &26e2 &2718 c0 08 CPY #&08 &271a d0 bd BNE &26d9 &271c 60 RTS &271d facezoom a9 f7 LDA #&f7 &271f 8d 2c 27 STA &272c &2722 a9 27 LDA #&27 &2724 8d 2d 27 STA &272d &2727 a2 00 LDX #&00 &2729 a0 00 LDY #&00 &272b b9 40 1f LDA &1f40,Y ; self modifying code &272e 99 c5 26 STA &26c5,Y; data_plotface &2731 c8 INY &2732 c0 08 CPY #&08 &2734 d0 f5 BNE &272b &2736 48 PHA &2737 98 TYA &2738 48 PHA &2739 8a TXA &273a 48 PHA &273b 20 d2 26 JSR &26d2; plotmainscreenface &273e 68 PLA &273f aa TAX &2740 68 PLA &2741 a8 TAY &2742 68 PLA &2743 e8 INX &2744 e0 05 CPX #&05 &2746 f0 15 BEQ &275d &2748 ad 2c 27 LDA &272c &274b 38 SEC &274c e9 08 SBC #&08 &274e 8d 2c 27 STA &272c &2751 8a TXA &2752 48 PHA &2753 a9 7d LDA #&7d &2755 20 a3 1e JSR &1ea3; sleep &2758 68 PLA &2759 aa TAX &275a 4c 29 27 JMP &2729 &275d 60 RTS &275e startmusic a9 50 LDA #&50 &2760 8d 20 02 STA &0220 &2763 a9 4d LDA #&4d ; store notes in event interrupt &2765 8d 21 02 STA &0221 &2768 a9 0e LDA #&0e ; enable events &276a a2 05 LDX #&05 &276c 20 f4 ff JSR &fff4; OSBYTE &276f a9 00 LDA #&00 &2771 85 40 STA &40; channel3dataptr &2773 a9 4f LDA #&4f &2775 85 41 STA &41; channel3dataptr_h &2777 20 50 4d JSR &4d50; music &277a 60 RTS &277b copywallsprite a0 00 LDY #&00 &277d b9 b0 55 LDA &55b0,Y ; copy level wall into current wall &2780 99 48 50 STA &5048,Y; sprite_wall &2783 c8 INY &2784 c0 48 CPY #&48 &2786 d0 f5 BNE &277d &2788 a0 00 LDY #&00 ; lights are on &278a 84 96 STY &96; switched &278c 60 RTS ; unused code fragment? &278d 40 RTI &278e a9 10 LDA #&10 &2790 85 41 STA &41; channel3dataptr_h &2792 20 50 4d JSR &4d50; music &2795 60 RTS ; unused &2796 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &27a6 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &27b6 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &27c6 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &27d6 00 00 00 00 00 00 00 00 00 &27df facezoomdata ff 81 81 81 81 81 81 ff &27e7 00 7e 42 42 42 42 7e 00 &27ef 00 00 3c 24 24 3c 00 00 &27f7 00 00 00 18 18 00 00 00 ; unused &27ff 3f &2800 getkey a9 7a LDA #&7a ; keyboard scan &2802 20 f4 ff JSR &fff4; OSBYTE &2805 8a TXA &2806 09 80 ORA #&80 &2808 20 43 2c JSR &2c43; alternativekeys &280b c9 c3 CMP #&c3 ; &43 = F &280d f0 05 BEQ &2814 &280f c9 b7 CMP #&b7 ; &37 = P &2811 f0 04 BEQ &2817 &2813 60 RTS &2814 38 SEC &2815 setvolume b0 01 BCS &2818 ; carry set if forte, clear if piano &2817 18 CLC &2818 ae 5f 28 LDX &285f; currentvolume ; get current volume &281b 90 02 BCC &281f; volumedown &281d e8 INX &281e e8 INX ; increase volume by one if forte &281f volumedown ca DEX ; decrease volume by one if piano &2820 8a TXA &2821 c9 05 CMP #&05 &2823 d0 02 BNE &2827 &2825 a9 04 LDA #&04 ; maximum volume is 4 &2827 c9 ff CMP #&ff &2829 d0 02 BNE &282d &282b a9 00 LDA #&00 ; minimum volume is 0 &282d 8d 5f 28 STA &285f; currentvolume ; store new volume &2830 0a ASL &2831 aa TAX &2832 bd 60 28 LDA &2860,X &2835 8d 78 28 STA &2878 ; set target amplitude for envelopes 1 and 2 &2838 8d 86 28 STA &2886 ; (target amplitude at the end of the decay phase) &283b e8 INX &283c bd 60 28 LDA &2860,X &283f 8d 75 28 STA &2875 ; set change of amplitude for envelopes 1 and 2 &2842 8d 83 28 STA &2883 ; (change of amplitude per step in sustain phase) &2845 initenvelopes a2 79 LDX #&79 &2847 a0 28 LDY #&28 &2849 a9 08 LDA #&08 &284b 20 f1 ff JSR &fff1; OSWORD ; envelope2 &2879 &284e a2 6b LDX #&6b &2850 a0 28 LDY #&28 &2852 a9 08 LDA #&08 &2854 20 f1 ff JSR &fff1; OSWORD ; envelope1 &286b &2857 a9 fa LDA #&fa &2859 20 a3 1e JSR &1ea3; sleep &285c a9 00 LDA #&00 &285e 60 RTS &285f currentvolume 02 ; volumes &2860 volumetable 00 00 1f ff 3f fe 5f fe 7e fe ; unused ? &286a e5 ; 0 1 2 3 4 5 6 7 8 9 a b c d ; ** ** ; modified by setvolume &286b envelope1 01 01 00 00 00 01 01 01 3c fc fe ff 00 32 &2879 envelope2 02 01 00 00 00 01 01 01 9c 19 fe 01 00 32 ; unused? &2887 e5 e5 e5 e5 e5 e5 e5 e5 e5 &2890 codeletters 0a 7b 08 04 7b 12 65 0e 20 69 07 69 20 69 02 0d ; code letters (d = (e-1) ^ &45) ; L ? B F ? T ! H Z - C - Z - D \r &28a0 littleletter 46 ; 'F' &28a1 bigletterdata 7e 60 60 7c 60 60 60 00 ; font data for 'F' &28a9 showcodeletter ae 6e 25 LDX &256e; main ; use the current level &28ac ca DEX &28ad 8e e3 26 STX &26e3 ; to choose the sprite displayed &28b0 a9 41 LDA #&41 ; display letters from 'A' &28b2 8d a0 28 STA &28a0; littleletter &28b5 showcodeletterloop 20 e0 28 JSR &28e0; showbigletter &28b8 ee a0 28 INC &28a0; littleletter &28bb ac a0 28 LDY &28a0; littleletter &28be c0 5b CPY #&5b ; to 'Z' &28c0 d0 f3 BNE &28b5; showcodeletterloop &28c2 ae 6e 25 LDX &256e; main &28c5 ca DEX &28c6 bd 8f 28 LDA &288f,X ; get encoded letter for this level &28c9 aa TAX &28ca ca DEX ; subtract one &28cb 8a TXA &28cc 49 45 EOR #&45 ; exclusive-or with &45 &28ce 8d a0 28 STA &28a0; littleletter ; use decryped letter &28d1 a9 0b LDA #&0b &28d3 8d e3 26 STA &26e3 ; use MASK as the sprite &28d6 20 e0 28 JSR &28e0; showbigletter ; show the code letter &28d9 20 d1 24 JSR &24d1; sleep3 &28dc 20 19 4c JSR &4c19; savedata &28df 60 RTS &28e0 showbigletter a9 0a LDA #&0a &28e2 a2 a0 LDX #&a0 &28e4 a0 28 LDY #&28 ; littleletter &28a0 &28e6 20 f1 ff JSR &fff1; OSWORD ; read font data into &28a1 - &28a8 &28e9 a0 09 LDY #&09 &28eb b9 a0 28 LDA &28a0,Y; littleletter &28ee 99 c4 26 STA &26c4,Y ; and copy it into data_plotface &28f1 88 DEY &28f2 d0 f7 BNE &28eb &28f4 20 d2 26 JSR &26d2; plotmainscreenface &28f7 a9 64 LDA #&64 &28f9 20 a3 1e JSR &1ea3; sleep ; pause for a little while &28fc 60 RTS ; unused &28fd a3 1e 60 ; setup, also used as move stack &2900 setup a9 0e LDA #&0e &2901 a2 06 LDX #&06 &2904 20 f4 ff JSR &fff4; OSBYTE &2907 a9 04 LDA #&04 ; enable/disable cursor keys &2909 a2 01 LDX #&01 &290b 20 f4 ff JSR &fff4; OSBYTE &290e a9 00 LDA #&00 &2910 85 5a STA &5a; spritelookupptr &2912 a9 55 LDA #&55 &2914 85 5b STA &5b; spritelookupptr_h ; &5500 &2916 a9 80 LDA #&80 &2918 85 56 STA &56; screenlookupptr &291a a9 36 LDA #&36 &291c 85 57 STA &57; screenlookupptr_h ; &3680 ? &291e 20 30 29 JSR &2930; emptyfunction &2921 20 45 28 JSR &2845; initenvelopes &2924 20 6e 25 JSR &256e; main &2927 60 RTS ; unused &2928 00 00 00 00 00 00 00 00 &2930 emptyfunction 60 RTS ; unused &2931 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; &3340 - &337f is copied to &0500 - &053f &0500 16 07 17 00 0a 20 00 00 00 00 00 00 ff 00 00 00 ; mode 7, reprogram display character. &0510 16 05 17 00 0a 20 00 00 00 00 00 00 13 02 00 00 ; mode 5, reprogram display character, &0520 00 00 13 03 00 00 00 00 ff 00 00 00 00 00 00 00 ; define colours. &0530 42 45 45 42 53 4f 46 54 00 00 00 00 00 00 00 00 ; "BEEBSOFT" ; start is called prior to memory moving, hence at &3380 &3380 start a9 c8 LDA #&c8 &3382 a2 03 LDX #&03 &3384 a0 00 LDY #&00 &3386 20 f4 ff JSR &fff4; OSBYTE ; erase memory on break &3389 a9 8c LDA #&8c &338b a2 0c LDX #&0c &338d 20 f4 ff JSR &fff4; OSBYTE ; switch to tape filing system &3390 a9 00 LDA #&00 &3392 a0 0f LDY #&0f &3394 startloop1 99 a1 02 STA &02a1,Y ; zero &02a1 - &02b0 (rom table) &3397 88 DEY &3398 10 fa BPL &3394; startloop1 &339a c8 INY &339b startloop2 b9 00 35 LDA &3500,Y ; copy &3500-ff &339e 99 00 06 STA &0600,Y; prelude ; to &0600-ff &33a1 c8 INY &33a2 d0 f7 BNE &339b; startloop2 &33a4 a2 3f LDX #&3f &33a6 startloop3 bd 40 33 LDA &3340,X ; copy &3340-7f &33a9 9d 00 05 STA &0500,X ; to &0500-3f &33ac ca DEX &33ad 10 f7 BPL &33a6; startloop3 &33af 4c 00 06 JMP &0600; prelude ; unused &29b2 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &29c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &29d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &29e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &29f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; wall sprites &2a00 1d 1d dd 00 47 47 77 00 0f 0f ff 00 ; bricks &2a0c 1d 1d dd 00 47 47 77 00 0f 0f ff 00 &2a18 0e 0e ee 00 2b 2b bb 00 8f 8f ff 00 &2a24 0e 0e ee 00 1d 1d dd 00 8f 8f ff 00 &2a30 8f 8f ff 00 0f 0f ff 00 2b 2b bb 00 &2a3c 47 47 77 00 0e 0e ee 00 1d 1d dd 00 &2a48 0f 0f 07 07 0b 0b 0d 0d 0b 0b 0d 0d ; hatch &2a54 0e 0e 0f 0f 0e 0e 0f 0f 0f 0f 07 07 &2a60 0a 0a 07 07 0f 0f 0f 0f 0e 0e 05 05 &2a6c 0b 0b 07 07 0b 0b 0d 0d 0e 0e 0d 0d &2a78 0e 0e 0d 0d 0a 0a 07 07 0f 0f 0f 0f &2a84 0e 0e 05 05 0b 0b 07 07 0b 0b 0d 0d &2a90 00 26 1f 0f 0f 0f 0e 04 0e 04 00 88 ; stone &2a9c 08 02 17 07 0e 0e 04 01 03 07 07 02 &2aa8 00 01 03 03 8b 0b 09 00 02 88 4d 0d &2ab4 0c 0c 09 03 00 08 4c 0d 09 03 89 4d &2ac0 01 03 03 09 4c 0c 08 00 03 8b 0b 01 &2acc 04 2e 0e 0e 0c 0c 0c 08 01 01 04 2e &2ad8 choosewallsprite ae 6e 25 LDX &2ad8 &2ada ca DEX &2adc bd f0 2a LDA &2af0,X; wallspritetable &2adf 8d e6 2a STA &2ae6 &2ae2 a0 48 LDY #&48 &2ae4 88 DEY &2ae5 b9 00 2a LDA &2a00,Y ; self modifying code &2ae8 99 b0 55 STA &55b0,Y ; copy into level wall &2aeb c0 00 CPY #&00 &2aed d0 f5 BNE &2ae4 &2aef 60 RTS ; 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 &2af0 wallspritetable 00 48 90 00 48 90 00 48 90 90 90 48 48 00 00 00 ; &00 = bricks, &48 = hatch, &90 = stone ; &2b00 - &2bff is copied to &600 - &6ff &0600 prelude 20 50 06 JSR &0650; writeblock ; write characters at &0500 - &050b &0603 a9 62 LDA #&62 ; copy &400 bytes from &6200 - &65ff &0605 a2 04 LDX #&04 &0607 a0 00 LDY #&00 &0609 84 80 STY &80 &060b 85 81 STA &81 &060d a9 7c LDA #&7c ; to &7c00 - &7fff (screen memory) &060f 84 82 STY &82 &0611 85 83 STA &83 &0613 20 5c 06 JSR &065c; copyblock &0616 a9 15 LDA #&15 ; flush buffer &0618 20 f4 ff JSR &fff4; OSBYTE &061b 20 e0 ff JSR &ffe0; OSRDCH ; wait for keypress &061e 78 SEI &061f a9 11 LDA #&11 ; copy &5100 bytes from &1100 - &61ff &0621 a2 51 LDX #&51 &0623 85 81 STA &81 &0625 a9 07 LDA #&07 ; to &0700 - &57ff &0627 85 83 STA &83 &0629 20 5c 06 JSR &065c; copyblock &062c a0 10 LDY #&10 &062e 84 3f STY &3f &0630 20 50 06 JSR &0650; writeblock &0633 20 80 06 JSR &0680; layoutscreen &0636 a9 07 LDA #&07 ; blank &0a00 bytes from &0700 - &10ff &0638 a2 0a LDX #&0a &063a a0 00 LDY #&00 &063c 85 81 STA &81 &063e a9 00 LDA #&00 &0640 preludeloop 91 80 STA (&80),Y &0642 c8 INY &0643 d0 fb BNE &0640; preludeloop &0645 e6 81 INC &81 &0647 ca DEX &0648 d0 f6 BNE &0640; preludeloop &064a 58 CLI &064b 4c 00 29 JMP &2900; setup &064e 00 BRK &064f 00 BRK &0650 writeblock b9 00 05 LDA &0500,Y &0653 30 06 BMI &2b5b &0655 20 ee ff JSR &ffee; OSWRCH ; write character &0658 c8 INY &0659 d0 f5 BNE &2b50 &065b 60 RTS &065c copyblock b1 80 LDA (&80),Y &065e 91 82 STA (&82),Y &0660 c8 INY &0661 d0 f9 BNE &2b5c &0663 e6 81 INC &81 &0665 e6 83 INC &83 &0667 ca DEX &0668 d0 f2 BNE &2b5c &066a 60 RTS ; unused &066b 00 00 00 00 00 &0670 42 45 45 42 53 4f 46 54 ; "BEEBSOFT" &0678 00 00 00 00 00 00 00 00 &0680 layoutscreen a9 00 LDA #&00 &0682 85 70 STA &70; playeraddr &0684 a9 58 LDA #&58 &0686 85 71 STA &71; playeraddr_h &0688 a9 00 LDA #&00 &068a 85 72 STA &72; playerxoffset &068c a9 07 LDA #&07 &068e 85 73 STA &73; playeryoffset &0690 a0 00 LDY #&00 &0692 b1 72 LDA (&72),Y; playerxoffset &0694 85 74 STA &74; viewpointx &0696 d0 01 BNE &0699 &0698 60 RTS &0699 c8 INY &069a aa TAX &069b 30 28 BMI &06c5 &069d b1 72 LDA (&72),Y; playerxoffset &069f 88 DEY &06a0 91 70 STA (&70),Y; playeraddr &06a2 c8 INY &06a3 ca DEX &06a4 d0 fa BNE &06a0 &06a6 18 CLC &06a7 a5 70 LDA &70; playeraddr &06a9 65 74 ADC &74; viewpointx &06ab 85 70 STA &70; playeraddr &06ad a5 71 LDA &71; playeraddr_h &06af 69 00 ADC #&00 &06b1 85 71 STA &71; playeraddr_h &06b3 a5 72 LDA &72; playerxoffset &06b5 69 02 ADC #&02 &06b7 85 72 STA &72; playerxoffset &06b9 d0 d5 BNE &0690 &06bb 18 CLC &06bc a5 73 LDA &73; playeryoffset &06be 69 01 ADC #&01 &06c0 85 73 STA &73; playeryoffset &06c2 10 cc BPL &0690 &06c4 60 RTS &06c5 38 SEC &06c6 e9 7f SBC #&7f &06c8 88 DEY &06c9 aa TAX &06ca e6 72 INC &72; playerxoffset &06cc b1 72 LDA (&72),Y; playerxoffset &06ce 91 70 STA (&70),Y; playeraddr &06d0 18 CLC &06d1 a5 70 LDA &70; playeraddr &06d3 69 01 ADC #&01 &06d5 85 70 STA &70; playeraddr &06d7 a5 71 LDA &71; playeraddr_h &06d9 69 00 ADC #&00 &06db 85 71 STA &71; playeraddr_h &06dd e6 72 INC &72; playerxoffset &06df f0 06 BEQ &06e7 &06e1 ca DEX &06e2 d0 e8 BNE &06cc &06e4 f0 aa BEQ &0690 &06e6 18 CLC &06e7 a5 73 LDA &73; playeryoffset &06e9 69 01 ADC #&01 &06eb 85 73 STA &73; playeryoffset &06ed a0 00 LDY #&00 &06ef f0 f0 BEQ &06e1 &06f1 00 BRK &06f2 00 BRK &06f3 00 BRK &06f4 00 BRK &06f5 00 BRK &06f6 00 BRK &06f7 00 BRK &06f8 42 45 45 42 53 4f 46 54 ; "BEEBSOFT" &2c00 plotleveltitle a9 90 LDA #&90 &2c02 85 53 STA &53; temp &2c04 a9 2c LDA #&2c &2c06 85 54 STA &54; temp_h &2c08 ae 6e 25 LDX &256e; main &2c0b a5 53 LDA &53; temp &2c0d 18 CLC &2c0e 69 17 ADC #&17 &2c10 85 53 STA &53; temp &2c12 90 02 BCC &2c16 &2c14 e6 54 INC &54; temp_h &2c16 ca DEX &2c17 d0 f2 BNE &2c0b &2c19 20 c2 23 JSR &23c2; plottext &2c1c a9 5a LDA #&5a &2c1e 8d 8c 21 STA &218c &2c21 a9 e8 LDA #&e8 &2c23 8d 8b 21 STA &218b &2c26 ad 6e 25 LDA &256e; main &2c29 0a ASL &2c2a aa TAX &2c2b bd 87 2c LDA &2c87,X; level_numbers ; number table lookup &2c2e 20 81 21 JSR &2181; plotnumber &2c31 a9 f0 LDA #&f0 &2c33 8d 8b 21 STA &218b &2c36 ad 6e 25 LDA &256e; main &2c39 0a ASL &2c3a aa TAX &2c3b e8 INX &2c3c bd 87 2c LDA &2c87,X; level_numbers &2c3f 20 81 21 JSR &2181; plotnumber &2c42 60 RTS &2c43 alternativekeys c9 99 CMP #&99 ; &19 = cursor left &2c45 d0 02 BNE &2c49 &2c47 a9 e1 LDA #&e1 ; &61 = Z &2c49 c9 f9 CMP #&f9 ; &79 = cursor right &2c4b d0 02 BNE &2c4f &2c4d a9 c2 LDA #&c2 ; &42 = X &2c4f c9 b9 CMP #&b9 ; &39 = cursor up &2c51 d0 02 BNE &2c55 &2c53 a9 c8 LDA #&c8 ; &48 = : &2c55 c9 a9 CMP #&a9 ; &29 = cursor down &2c57 d0 02 BNE &2c5b &2c59 a9 e8 LDA #&e8 ; &68 = / &2c5b 60 RTS ; unused &2c5c 00 00 00 00 &2c60 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &2c70 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &2c80 00 00 00 00 00 00 00 &2c87 level_numbers 00 4d 00 01 00 02 00 03 00 04 00 05 00 06 00 07 &2c97 00 08 00 09 01 00 01 01 01 02 01 03 01 04 01 05 &2ca7 text_titles 04 04 20 20 20 44 4f 54 53 20 41 4e 44 20 57 41 ; " DOTS AND WAVES \r" &2cb7 56 45 53 20 20 20 0d &2cbe 04 04 20 20 20 53 4f 4d 45 54 48 49 4e 47 20 46 ; " SOMETHING FISHY \r" &2cce 49 53 48 59 20 20 0d &2cd5 04 04 20 20 43 48 49 43 4b 45 4e 20 53 55 50 52 ; " CHICKEN SUPREME \r" &2ce5 45 4d 45 20 20 20 0d &2cec 04 04 20 20 45 58 50 4c 4f 53 49 56 45 20 4d 49 ; " EXPLOSIVE MIXTURE \r" &2cfc 58 54 55 52 45 20 0d &2d03 04 04 20 20 20 48 45 4e 52 59 53 20 41 4e 47 55 ; " HENRYS ANGUISH \r" &2d13 49 53 48 20 20 20 0d &2d1a 04 04 20 20 20 54 48 45 20 44 4f 4c 4c 53 20 48 ; " THE DOLLS HOUSE \r" &2d2a 4f 55 53 45 20 20 0d &2d31 04 04 20 20 20 44 4f 4c 4c 59 53 20 52 45 56 45 ; " DOLLYS REVENGE \r" &2d41 4e 47 45 20 20 20 0d &2d48 04 04 20 20 20 45 4e 4c 49 47 48 54 45 4e 4d 45 ; " ENLIGHTENMENT \r" &2d58 4e 54 20 20 20 20 0d &2d5f 04 04 20 20 20 54 48 45 20 43 48 41 4c 4c 45 4e ; " THE CHALLENGE \r" &2d6f 47 45 20 20 20 20 0d &2d76 04 04 20 20 50 41 54 49 45 4e 43 45 20 50 45 4e ; " PATIENCE PENDING \r" &2d86 44 49 4e 47 20 20 0d &2d8d 04 04 20 20 20 20 20 52 41 5a 4f 52 20 45 44 47 ; " RAZOR EDGE \r" &2d9d 45 20 20 20 20 20 0d &2da4 04 04 20 20 20 54 48 45 20 48 41 50 50 59 20 48 ; " THE HAPPY HOUR \r" &2db4 4f 55 52 20 20 20 0d &2dbb 04 04 20 20 20 20 20 20 44 45 4a 41 20 56 55 20 ; " DEJA VU \r" &2dcb 20 20 20 20 20 20 0d &2dd2 04 04 20 20 20 20 50 45 4e 55 4c 54 49 4d 41 54 ; " PENULTIMATE \r" &2de2 45 20 20 20 20 20 0d &2de9 04 04 20 20 20 20 54 48 45 20 44 45 43 4f 44 45 ; " THE DECODER \r" &2df9 52 20 20 20 20 20 0d &2e00 level15data ; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% &2e00 00 00 00 00 00 11 11 01 00 00 01 00 00 00 00 ; % %%%%% % % &2e0f 10 11 10 0a 07 11 11 00 70 07 01 00 00 02 07 ; % %%% %Z v %%%% vv % 1 v % &2e1e 00 07 10 00 15 11 00 00 b0 01 01 00 00 30 0d ; % v % -%%% *% % 2o % &2e2d 11 05 10 08 00 01 00 00 00 00 01 00 00 00 00 ; %%%- %< % % % &2e3c e1 09 00 00 1d 11 19 11 11 01 a1 11 11 11 11 ; %%TX o%%%X%%%%%% %Z%%%%%%%%% &2e4b 11 01 00 01 50 91 01 00 c0 01 15 00 00 00 b0 ; %%%% % -%X% /% -% *% &2e5a 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 ; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% &2e69 11 00 07 01 00 00 00 00 00 00 00 00 00 00 00 ; %%% v % % &2e78 11 0d 05 01 10 11 11 00 00 00 00 10 11 11 00 ; %%%o - % %%%%% %%%%% % &2e87 e0 00 00 01 00 00 11 00 10 11 01 10 01 00 00 ; % T % %% %%%% %% % &2e96 10 10 78 01 00 10 01 00 00 00 00 10 11 01 00 ; % % %