0000- 4 ; ***************************************************************************** 0000- 5 ;Maze 0000- 6 ;Mr. G.PHILLIPS 0000- 7 ;from Computing Today - May 1979 0000- 8 0000- 9 ;The program is developed to run on an MK/14 but could be 0000- 10 ;easily altered to suit any machine. The idea is to negotiate a 0000- 11 ;maze without being eaten on falling down holes etc. To code 0000- 12 ;your own mazes draw them out complete with the obstacles 0000- 13 ;and code from start to finishe including the comments on any 0000- 14 ;obstacles etc. After hazards you can either return to the start 0000- 15 ;or kill off the victim in an endless loop. 0000- 16 0000- 17 ;POINTERS 0000- 18 ;P1 Current message 0000- 19 ;P2 Maze position 0000- 20 ;P3 Keyboard/display 0000- 21 ;Note: Abort will not work as the monitor routine is not 0000- 22 ; used. Maze frm 0F80 onwards, could be relocated. 0000- 23 ; Messages from 0B00 to 0BF8 as required 0000- 24 0000- 25 ;From Complement and Add - Issue 4 0000- 26 ;Mr Phillips was the editor of this User Group Magazine for the MK14 0000- 27 0000- 28 ;Also, since no rules were published about Maze in CT, here is a brief summary 0000- 29 ;When a question is asked, e.g. 'Ford lft?' you must reply 0 for the first 0000- 30 ;option, 1 for the second option. So in this example, 1 would mean that you 0000- 31 ;wanted to go left whereas in the question 'Left-rt?’ it would mean go right. The 0000- 32 ;game ends when "END" is displayed. Comments are displayed E.g. ‘Bench’ that 0000- 33 ;require no answer. 0000- 34 ; 0000- 35 ;Dissasembled and Typed in for SBASM by T.J.Gilberts July 2020 0000- 36 0F10- 37 .OR 0x0F10 0F10- 38 0F10-00 39 COUNT1 .DB 0 0F11-00 40 COUNT .DB 0 0F12- 41 0F12- 42 ENTER: 0F12-C4 00 43 ( 10) LDI 0x00 ;Initialise count 1 to zero 0F14-C8 FB 44 ( 18) ST COUNT1-$-1(P0) 0F16- 45 0F16- 46 BEGIN: 0F16-C4 0F 47 ( 10) LDI 0x0F ;Load maze address to P2 0F18-36 48 ( 8) XPAH P2 0F19-C4 80 49 ( 10) LDI 0x80 0F1B-32 50 ( 8) XPAL P2 0F1C- 51 0F1C-C4 0D 52 ( 10) LDI 0x0D ;Load display address to P3 0F1E-37 53 ( 8) XPAH P3 0F1F-C4 00 54 ( 10) LDI 0x00 0F21-33 55 ( 8) XPAL P3 0F22- 56 LOOP2: 0F22-C4 0B 57 ( 10) LDI 0x0B ;Load message address to P1 0F24-35 58 ( 8) XPAH P1 ;Relies on P1L being 0 on RESET 0F25-C6 01 59 ( 18) LD @0x01(P2) ;Get first maze section 0F27-01 60 ( 7) XAE 0F28-40 61 ( 6) LDE 0F29-31 62 ( 8) XPAL P1 ;Also use as message pointer 0F2A- 63 0F2A- 64 LOOP8: 0F2A-C4 08 65 ( 10) LDI 0x08 ;Let count=8 0F2C-C8 E4 66 ( 18) ST COUNT-$-1(P0) 0F2E- 67 0F2E- 68 LOOP1: 0F2E-C5 01 69 ( 18) LD @0x01(P1) ;Load one character, display 0F30-CF 01 70 ( 18) ST @0x01(P3) 0F32- 71 SHINEIT: 0F32-8F 01 72 ( 13+) DLY 0x01 ;Shine it 0F34-B8 DC 73 ( 22) DLD COUNT-$-1(P0) 0F36-9C F6 74 (9/11) JNZ LOOP1 0F38- 75 0F38-C2 FF 76 ( 18) LD -1(P2) ;Restore P1 0F3A-31 77 ( 8) XPAL P1 0F3B-C4 00 78 ( 10) LDI 0x00 ;Restore P3 0F3D-33 79 ( 8) XPAL P3 0F3E-C2 00 80 ( 18) LD 0(P2) ;Is second part of maze code 0F40-9C 08 81 (9/11) JNZ FOR8 0F42- 82 0F42-B8 CD 83 ( 22) DLD COUNT1-$-1(P0) 0F44-9C E4 84 (9/11) JNZ LOOP8 ;00, if not display message 0F46- 85 0F46-C6 01 86 ( 18) LD @0x01(P2) ;Next part of maze 0F48-90 D8 87 ( 11) JMP LOOP2 ;Go to 0F22 0F4A- 88 0F4A- 89 FOR8: 0F4A-C2 FF 90 ( 18) LD -1(P2) ;If code positive jump 2 0F4C-94 02 91 (9/11) JP FOR2 0F4E- 92 0F4E-90 04 93 ( 11) JMP FOR4 ;If code negative jump 4 0F50- 94 0F50- 95 FOR2: 0F50-D4 01 96 ( 10) ANI 0x01 ;Odd or even, if even jump 6 0F52-98 06 97 (9/11) JZ FOR1 0F54- 98 0F54- 99 FOR4: 0F54-C6 80 100 ( 18) LD @E(P2) ;Alter P2 accordingly 0F56-C6 FF 101 ( 18) LD @-1(P2) 0F58- 102 0F58-90 C8 103 ( 11) JMP LOOP2 0F5A- 104 0F5A- 105 FOR1: 0F5A-40 106 ( 6) LDE ;If code 00xx back to start 0F5B-98 B9 107 (9/11) JZ BEGIN 0F5D- 108 0F5D-AB 00 109 ( 22) ILD 0x00(P3) ;Input 0? INC P3, load 0F5F-98 04 110 (9/11) JZ SKIP4 0F61- 111 0F61-C6 01 112 ( 18) LD @0x01(P2) ;Continue in maze 0F63-90 06 113 ( 11) JMP SKIP2 ;Jump 6 0F65- 114 0F65- 115 SKIP4: 0F65-AB 01 116 ( 22) ILD 0x01(P3) ;Input 1? 0F67-9C 02 117 (9/11) JNZ SKIP2 ;Jump 2 0F69- 118 0F69-90 BF 119 ( 11) JMP LOOP8 0F6B- 120 0F6B- 121 SKIP2: 0F6B-8F FF 122 ( 13+) DLY 0xFF 0F6D-90 B3 123 ( 11) JMP LOOP2 0F6F- 124 0F6F- 125 0F6F- 126 ;EXAMPLE MAZE 0F6F- 127 ;This would fit in the IO chip giving quite a bit of space for the above 0F6F- 128 ;interpreter to do more 'game play' of wanted... 0F6F- 129 0F80- 130 .OR 0x0F80 0F80- 131 0F80-80 00 18 41 A0 00 18 45 132 .DB 0x80,0x00,0x18,0x41,0xA0,0x00,0x18,0x45 0F88-68 00 10 55 88 00 90 00 133 .DB 0x68,0x00,0x10,0x55,0x88,0x00,0x90,0x00 0F90-18 0F 10 09 C0 00 C8 00 134 .DB 0x18,0x0F,0x10,0x09,0xC0,0x00,0xC8,0x00 0F98-D0 00 00 01 20 E7 E2 01 135 .DB 0xD0,0x00,0x00,0x01,0x20,0xE7,0xE2,0x01 0FA0-20 35 88 00 98 00 10 35 136 .DB 0x20,0x35,0x88,0x00,0x98,0x00,0x10,0x35 0FA8-58 00 18 F7 20 E5 60 00 137 .DB 0x58,0x00,0x18,0xF7,0x20,0xE5,0x60,0x00 0FB0-18 2F 68 00 10 17 A8 00 138 .DB 0x18,0x2F,0x68,0x00,0x10,0x17,0xA8,0x00 0FB8-88 00 90 00 A0 00 60 00 139 .DB 0x88,0x00,0x90,0x00,0xA0,0x00,0x60,0x00 0FC0-10 03 BE 01 20 03 CE 01 140 .DB 0x10,0x03,0xBE,0x01,0x20,0x03,0xCE,0x01 0FC8-10 D7 E4 01 20 03 DA 01 141 .DB 0x10,0xD7,0xE4,0x01,0x20,0x03,0xDA,0x01 0FD0- 142 0FD0- 143 ;LITERAL POOL FOR MESSAGES 0FD0- 144 ;Note: Not all of these are used in the example program, 0FD0- 145 ; but should you wish to invent your own maze you 0FD0- 146 ; could use them where you like. The ones used in 0FD0- 147 ; the example are marked * 0FD0- 148 0B00- 149 .OR 0x0B00 0B00- 150 0B00-00 00 00 00 00 00 00 00 151 .DB 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 ;Not used 0B08-00 76 76 76 76 76 76 77 152 .DB 0x00,0x76,0x76,0x76,0x76,0x76,0x76,0x77 ;'ahhhhhh'* 0B10-53 78 71 38 40 5E 50 71 153 .DB 0x53,0x78,0x71,0x38,0x40,0x5E,0x50,0x71 ;'frd-lft?'* 0B18-53 78 50 40 5E 50 3F 71 154 .DB 0x53,0x78,0x50,0x40,0x5E,0x50,0x3F,0x71 ;'ford-rt?'* 0B20-53 78 50 40 78 71 79 38 155 .DB 0x53,0x78,0x50,0x40,0x78,0x71,0x79,0x38 ;'left-rt?'* 0B28-00 00 79 38 5E 5E 1C 73 156 .DB 0x00,0x00,0x79,0x38,0x5E,0x5E,0x1C,0x73 ;'puddle'* 0B30-5E 54 79 40 5E 77 79 5E 157 .DB 0x5E,0x54,0x79,0x40,0x5E,0x77,0x79,0x5E ;'dead-end' 0B38-6E 50 79 73 73 06 38 6D 158 .DB 0x6E,0x50,0x79,0x73,0x73,0x06,0x38,0x6D ;'slippery' 0B40-73 1C 40 79 73 3F 38 6D 159 .DB 0x73,0x1C,0x40,0x79,0x73,0x3F,0x38,0x6D ;'slope-up' 0B48-00 38 38 06 76 73 1C 00 160 .DB 0x00,0x38,0x38,0x06,0x76,0x73,0x1C,0x00 ;'uphill' 0B50-00 7C 1C 50 76 6D 00 00 161 .DB 0x00,0x7C,0x1C,0x50,0x76,0x6D,0x00,0x00 ;'shrub' 0B58-00 78 50 5E 54 79 7C 00 162 .DB 0x00,0x78,0x50,0x5E,0x54,0x79,0x7C,0x00 ;'bendrt'* 0B60-78 71 79 38 5E 54 79 7C 163 .DB 0x78,0x71,0x79,0x38,0x5E,0x54,0x79,0x7C ;'bendleft'* 0B68-00 79 1C 78 77 78 6D 00 164 .DB 0x00,0x79,0x1C,0x78,0x77,0x78,0x6D,0x00 ;'statue'* 0B70-00 5E 54 79 00 79 76 78 165 .DB 0x00,0x5E,0x54,0x79,0x00,0x79,0x76,0x78 ;'the end'* 0B78-00 76 39 54 79 7C 00 00 166 .DB 0x00,0x76,0x39,0x54,0x79,0x7C,0x00,0x00 ;'bench' 0B80-00 00 78 50 77 78 6D 00 167 .DB 0x00,0x00,0x78,0x50,0x77,0x78,0x6D,0x00 ;'start'* 0B88-79 76 78 5E 54 1C 3F 50 168 .DB 0x79,0x76,0x78,0x5E,0x54,0x1C,0x3F,0x50 ;'roundthe'* 0B90-00 50 79 54 50 3F 39 00 169 .DB 0x00,0x50,0x79,0x54,0x50,0x3F,0x39,0x00 ;'corner'* 0B98-00 00 5E 54 79 7C 00 00 170 .DB 0x00,0x00,0x5E,0x54,0x79,0x7C,0x00,0x00 ;'bend'* 0BA0-54 06 77 78 54 1C 3F 71 171 .DB 0x54,0x06,0x77,0x78,0x54,0x1C,0x3F,0x71 ;'fountain'* 0BA8-00 6F 54 06 54 50 1C 78 172 .DB 0x00,0x6F,0x54,0x06,0x54,0x50,0x1C,0x78 ;'turning'* 0BB0-00 00 5E 54 1C 3F 50 00 173 .DB 0x00,0x00,0x5E,0x54,0x1C,0x3F,0x50,0x00 ;'round'* 0BB8-00 50 79 6F 06 78 00 77 174 .DB 0x00,0x50,0x79,0x6F,0x06,0x78,0x00,0x77 ;'A tiger' 0BC0-54 3F 06 38 00 79 76 78 175 .DB 0x54,0x3F,0x06,0x38,0x00,0x79,0x76,0x78 ;'the lion'* 0BC8-1C 3F 6E 00 6D 78 77 79 176 .DB 0x1C,0x3F,0x6E,0x00,0x6D,0x78,0x77,0x79 ;'eats you'* 0BD0-79 6D 3F 38 00 1C 3F 6E 177 .DB 0x79,0x6D,0x3F,0x38,0x00,0x1C,0x3F,0x6E ;'you lose'* 0BD8-00 5E 54 1C 3F 50 6F 00 178 .DB 0x00,0x5E,0x54,0x1C,0x3F,0x50,0x6F,0x00 ;'ground' 0BE0-00 00 6E 5E 5E 1C 55 00 179 .DB 0x00,0x00,0x6E,0x5E,0x5E,0x1C,0x55,0x00 ;'muddy' 0BE8-00 6D 6D 79 38 5E 54 79 180 .DB 0x00,0x6D,0x6D,0x79,0x38,0x5E,0x54,0x79 ;'endless'* 0BF0-00 00 00 78 06 73 00 00 181 .DB 0x00,0x00,0x00,0x78,0x06,0x73,0x00,0x00 ;'pit'* 0BF8- 182 0BF8- 183 ; Add code to hex for SH PI-Programmer to auto execute after load... 0BF8- 184 FFFE- 185 .ORG 0xFFFE FFFE-0F 186 .DB ENTER/256 FFFF-12 187 .DB ENTER&255 010000- 188 010000- 189 .EN