Classic Computer Magazine Archive A.N.A.L.O.G. ISSUE 59 / APRIL 1988 / PAGE 81

Labyrinths

An aMAZE-ing 3-D adventure game

by Steven Lashower

    Finally, some time to yourself-the first time in many days. You sit down at your computer for a nice intellectual game of Star Raiders. Just as you're ready to zap some Zylons, the doorbell rings.
    "Somebody better have a very good reason for this," you mumble as you go to the door and open it.
    On the other side of the door is an alien. "Hello, earthling," he says. "My name is Beef Strovanoff and I'm from the planet of Argonia."
    The alien continues: "You have been selected to represent your local star system in the Labyrinths of Argonia. If you accomplish this impossible task, you will be rewarded with treasures beyond your wildest dreams. But if you fail, you will be disposed of ... We love incentive."
    The alien then raises what looks like a "Kill-O-Zap" brand atomic teleport gun. He fires it at you.

Playing Labyrinths
    Labyrinths is a one-player maze game written in 100 percent machine language and will run on all 8-bit Atari computers. It features colorful first perspective graphics that really place you in the maze. Type in Listing 1 using M/L Editor (see page 80) to create your copy of the game. Load the game using option L from the Atari DOS menu.
    When the game boots up, you're presented with the title page. Here, you can select between several options.
    Pressing OPTION will change the number of "Argonian Patrollers" that are in the maze with you. You can choose from 0 to 6 Patrollers. The more Patrollers in the maze, the more difficult the game is. Pressing SELECT will determine whether the game is played in a "daytime" or "nightime" atmosphere and pressing START will, of course, begin the game. At any point during the game, pressing ESC will return you to the title page.
    You-the flashing blue dot-appear in the upper-left corner of the maze. The object, simple enough, is to escape from the maze. The exit is in the lower-right corner of the maze. In the center of the screen is a graphic window of what appears in the maze. To the right of this is a black area that will fill up with the maze as you explore new areas of it. If you're playing with Argonian Patrollers, they will also appear in this area as white dots.
    At the bottom of the screen is a timer that displays how long you've been in the maze. There's also a compass to show which direction you're facing.
    You move through the maze by using a joystick plugged into port 1. Pushing the stick forward will move you in the direction the compass is facing. Pulling back on the stick will move you backward (away from the direction the compass is facing). Pushing the stick to the left or right will turn you in the appropriate direction.
    If you happen to come across a Patroller in the maze, it will appear as a pulsing square in the graphic window. The size of this square depends on how close the Patroller is to you. Coming in contact with a Patroller means immediate destruction for you (these things really are mean).
    So, what are you waiting for? Get lost in Labyrinths.

    Steven Lashower, a high school senior, has owned an Atari for seven years. He's been programming in assembly language for almost two years. Labyrinths is his first major machine language project. He also has a part-time job at Disneyland.


Listing 1
"M/L. Editor" Data

1000 DATA 255,255,0,128,251,120,169,0,
141,47,2,133,138,169,255,133,8873
1010 DATA 154,32,42,128,169,92,133,132
169,135,133,133,32,147,132,169,8338
1020 DATA 197,141,47,142,169,65,141,15
9,126,169,129,141,160,126,169,0,8016
1030 DATA 162,0,149,148,232,224,5,208,
249,133,147,169,60,141,28,2,6856
1040 DATA 160,186,162,120,169,7,32,92,
228,169,1,133,140,169,2,133,6078
1050 DATA 141,169,3,133,144,169,50,133
142,32,206,125,76,160,122,72,6792
1060 DATA 138,72,166,147,224,0,208,25,
232,134,147,162,144,142,23,208,9726
1070 DATA 232,232,141,10,212,224,160,2
08,244,169,10,141,23,208,76,182,368
1080 DATA 120,169,10,141,24,208,169,4,
141,23,208,166,147,165,155,201,256
1090 DATA 0,208,6,189,78,124,76,150,12
6,189,96,124,141,20,208,141,8149
1100 DATA 21,208,232,134,147,224,17,20
8,19,169,0,133,147,169,248,141,341
1110 DATA 22,208,169,10,141,23,208,169
0,141,24,208,104,170,104,64,6232
1120 DATA 238,192,2,238,193,2,173,193,
2,261,159,208,5,169,144,141,9552
1130 DATA 193,2,165,187,201,0,240,2,19
8,187,165,138,201,255,208,3,1745
1140 DATA 76,98,228,173,28,2,201,0,208
,27,169,60,141,28,2,230,5003
1150 DATA 148,162,0,181,148,221,36,134
208,6,169,0,149,148,246,149,9610
1160 DATA 232,224,252,120,247,121,5,20
8,238,162,0,181,148,24,105,16,6761
1170 DATA 188,31,134,153,147,129,232,2
24,5,208,240,165,154,201,255,240,6585
1180 DATA 8,198,154,24,101,158,141,1,2
10,162,8,181,223,201,69,240,860
1190 DATA 17,201,160,208,8,169,0,142,0
,208,76,98,228,232,224,5,8855
1200 DATA 208,233,189,41,134,141,0,208
189,47,134,141,8,208,189,62,7965
1210 DATA 134,133,157,160,0,169,0,153,
0,116,200,208,250,189,57,134,9710
1220 DATA 168,189,52,134,153,0,116,200
196,157,208,245,76,98,228,169,2681
1230 DATA 92,133,132,169,135,133,133,1
36,192,0,240,8,165,142,32,124,7213
1240 DATA 122,76,109,121,138,32,124,12
2,162,0,165,144,201,1,208,46,6535
1250 DATA 165,142,32,124,122,160,8,177
132,133,146,165,142,24,105,1,5154
1260 DATA 32,134,122,160,0,177,132,149
203,200,177,132,149,193,200,177,3573
1270 DATA 132,149,213,232,165,142,32,1
34,122,224,8,208,230,96,165,144,1275
1280 DATA 201,3,208,46,160,0,165,142,3
2,134,122,177,132,133,146,165,8888
1290 DATA 142,56,233,1,32,124,122,160,
0,177,132,149,213,200,177,132,631
1300 DATA 149,193,200,177,132,149,203,
232,165,142,32,124,122,224,8,208,889
1310 DATA 230,96,165,144,201,4,208,64,
160,0,177,132,153,193,0,208,8662
1320 DATA 192,8,248,121,243,122,208,24
6,160,0,169,1,32,134,122,177,8392
1330 DATA 132,133,146,169,1,32,124,122
165,142,32,134,122,177,132,153,8240
1340 DATA 203,0,200,192,8,208,246,165,
142,24,101,142,32,124,122,168,8116
1350 DATA 0,177,132,153,213,0,200,192,
8,208,246,96,160,0,162,0,7233
1360 DATA 177,132,149,193,169,1,32,134
122,232,224,0,208,242,169,9,9916
1370 DATA 32,124,122,177,132,133,146,1
69,1,24,101,142,32,134,122,162,6334
1380 DATA 8,177,132,149,213,169,1,32,1
34,122,232,224,8,208,242,169,2084
1390 DATA 8,24,101,142,101,142,32,124,
122,162,0,177,132,149,203,169,9283
1400 DATA 1,32,134,122,232,224,8,208,2
42,96,24,101,132,133,132,144,9055
1410 DATA 16,230,133,96,133,143,56,165
132,229,143,133,132,176,2,198,9929
1420 DATA 133,96,160,32,160,32,197,197
,0,0,10,10,0,10,164,141,1386
1430 DATA 166,140,32,101,121,32,244,13
3,160,0,132,138,185,193,8,162,8192
1440 DATA 0,201,197,208,5,133,138,76,1
14,124,201,160,208,3,76,114,7769
1450 DATA 124,152,24,133,159,125,154,1
22,168,185,203,0,201,69,208,2,8407
1468 DATA 169,32,134,153,221,148,122,2
08,7,164,159,134,138,32,43,123,7133
1470 DATA 166,153,232,164,159,224,6,20
8,216,200,192,5,208,190,169,7,1266
1480 DATA 133,85,244,122,239,123,169,2
133,145,164,145,169,0,133,143,8806
1490 DATA 32,219,126,230,145,165,145,2
01,12,208,239,160,5,185,193,0,9883
1500 DATA 200,201,160,208,5,169,5,76,3
5,123,201,197,208,5,169,0,6525
1510 DATA 76,35,123,169,7,133,143,32,2
19,126,76,195,124,132,134,185,9628
1520 DATA 162,127,170,202,165,138,201,
3,240,8,201,5,240,4,201,2,7072
1530 DATA 208,12,169,12,56,229,134,133
,135,160,0,76,85,123,169,2,5094
1540 DATA 24,101,134,133,135,160,0,232
200,152,24,105,4,133,84,165,6849
1550 DATA 135,133,85,165,138,201,0,240
,29,201,2,240,19,201,3,240,8801
1560 DATA 9,201,1,240,5,169,0,76,135,1
23,189,13,124,76,135,123,5930
1570 DATA 189,214,123,76,135,123,189,1
59,123,134,136,132,137,133,143,32,8695
1580 DATA 219,126,166,136,164,137,192,
11,208,189,164,134,169,0,133,138,9741
1590 DATA 96,6,1,1,1,1,1,1,1,1,1,3,0,6
,1,1,1912
1600 DATA 1,1,1,1,1,3,0,0,0,6,1,1,1,1,
1,3,1806
1610 DATA 0,0,0,0,0,6,1,1,1,3,0,0,0,0,
0,0,1700
1620 DATA 0,6,1,3,0,0,0,0,4,1,1,1,1,1,
1,1,1774
1630 DATA 1,1,2,0,4,1,1,1,1,1,1,1,2,0,
0,0,1748
1640 DATA 4,1,240,123,235,124,1,1,1,1,
2,0,0,0,0,8,4833
1650 DATA 4,1,1,1,2,0,0,0,0,0,0,0,4,1,
2,0,1769
1660 DATA 0,0,0,0,5,5,5,5,5,5,5,5,5,0,
0,0,2065
1670 DATA 5,5,5,5,5,5,5,0,0,0,0,0,5,5,
5,5,2100
1680 DATA 5,0,0,0,0,0,0,0,5,5,5,0,0,0,
0,0,1835
1690 DATA 8,0,0,0,5,0,0,0,0,0,9,7,5,3,
1,3,2068
1700 DATA 4,5,6,7,0,159,157,155,153,15
1,149,147,145,240,242,244,4122
1710 DATA 246,248,250,252,0,8,0,0,0,0,
0,0,0,0,0,0,4210
1720 DATA 0,2,4,6,8,10,0,0,136,132,134
,185,68,124,133,139,4937
1730 DATA 185,73,124,133,85,185,162,12
7,170,202,133,134,166,134,160,0,9705
1740 DATA 152,133,84,230,84,230,84,200
232,132,137,134,136,165,138,201,3205
1750 DATA 197,208,5,169,0,76,165,124,1
89,13,124,133,143,164,84,32,6375
1760 DATA 219,126,164,137,166,136,192,
10,208,214,198,139,165,139,240,9,2034
1770 DATA 230,85,166,134,160,0,76,138,
124,32,221,127,165,194,133,163,495
1780 DATA 165,146,133,164,165,155,201,
1,240,33,32,70,128,162,0,169,6780
1790 DATA 0,157,0,117,232,208,248,165,
140,24,105,145,141,1,208,24,7782
1800 DATA 165,141,236,124,231,125,24,1
05,74,168,169,1,153,0,117,162,6917
1810 DATA 1,189,137,132,56,233,128,188
142,132,153,147,129,232,224,5,1616
1820 DATA 208,259,164,144,185,137,132,
190,142,132,157,147,129,169,62,141,108
3
1830 DATA 47,2,32,170,126,166,140,164,
141,32,101,121,32,244,133,173,9322
1840 DATA 120,2,281,15,240,236,173,120
,2,201,14,208,40,165,163,201,583
1850 DATA 32,240,14,201,69,240,10,201,
197,208,3,76,67,134,76,112,7148
1860 DATA 125,166,144,202,189,12,134,1
68,24,185,148,8,125,4,134,153,6601
1878 DATA 140,0,76,185,125,201,13,208,
43,165,164,201,32,240,17,201,64
1880 DATA 69,240,13,201,197,208,3,76,6
7,134,32,178,127,76,24,125,5640
1890 DATA 166,144,202,189,12,134,168,2
4,185,140,0,125,8,134,153,140,7018
1900 DATA 0,76,185,125,201,11,208,18,3
2,207,127,230,144,165,144,201,1851
1910 DATA 5,208,32,169,1,133,144,76,18
5,125,201,7,248,3,76,24,5418
1920 DATA 125,32,207,127,198,144,165,1
44,201,0,208,7,169,4,133,144,8132
1930 DATA 76,185,125,32,191,125,76,160
122,169,0,133,20,32,170,126,6054
1940 DATA 165,20,56,233,6,144,246,96,1
69,13,141,199,2,169,0,141,6867
1950 DATA 198,2,133,189,169,4,141,196,
2,169,144,141,193,2,169,2,6819
1960 DATA 141,111,232,125,227,126,2,16
9,52,141,48,2,169,126,141,49,6066
1970 DATA 2,169,120,141,1,2,169,89,141
,0,2,169,192,141,14,212,6537
1980 DATA 169,3,141,10,208,141,11,208,
169,104,141,2,208,169,116,141,9447
1990 DATA 3,208,162,0,169,0,157,0,116,
157,0,117,169,255,157,0,6979
2000 DATA 118,157,0,119,232,208,237,16
9,112,141,7,212,169,2,141,29,8170
2010 DATA 208,96,112,112,240,70,188,13
4,12,32,2,0,2,2,48,128,474
2020 DATA 78,0,144,14,14,14,14,14,14,1
4,14,14,142,14,14,14,6014
2030 DATA 14,14,14,14,14,142,14,14,14,
14,14,14,14,142,14,14,6494
2040 DATA 14,14,14,142,14,14,14,142,14
,14,142,14,142,14,142,142,2528
2850 DATA 14,14,142,14,142,14,14,14,14
2,14,14,14,14,14,142,14,8050
2060 DATA 14,14,14,14,14,14,142,14,14,
14,14,14,14,14,14,142,6908
2070 DATA 14,14,14,14,14,14,14,14,14,1
4,142,112,66,0,0,2,6636
2080 DATA 2,2,2,2,2,65,52,126,32,0,103
,162,255,165,191,240,9567
2090 DATA 17,232,181,165,197,140,208,6
181,172,197,141,240,5,228,191,3977
2100 DATA 208,239,96,169,113,141,159,1
26,169,131,141,160,126,169,69,133,751
2110 DATA 223,169,0,141,0,210,76,79,13
4,185,86,127,133,128,169,8,7241
2120 DATA 133,129,228,126,223,127,6,12
,80,38,129,6,128,38,129,165,128,6699
2130 DATA 24,105,0,133,130,165,129,105

,88,133,131,6,128,38,129,6,4069
2140 DATA 128,38,129,165,128,24,181,13
0,133,130,165,129,101,131,133,131,9020
2150 DATA 165,130,24,101,85,105,12,133
130,144,2,230,131.114,143,185,9750
2160 DATA 169,127;--_,128,169,0,133,12
9,133,162,24,105,127,133,129,165,8731
2170 DATA 128,E4,105,98,133,128,144,2,
236,129,164,162,177,128,160,0,9111
2180 DATA 145,130,230,162,165,162,201,
8,240,13,165,138,24,105,20,133,7066
2190 DATA 130,144,231,230,131,208,227,
96,1,5,13,21,29,37,45,53,1353
2200 DATA 61,69,77,85,0,0,0,0,0,0,0,0,
255,191,255,247,6736
2210 DATA 255,255,223,255,255,127,63,3
1,15,7,3,1,255,254,254,248,2289
2220 DATA 240,224,192,128,1,3,7,15,31,
63,127,255,87,255,213,213,858
2230 DATA 213,255,87,87,128,192,224,24
0,248,252,254,255,0,129,227,255,8739
2240 DATA 255,195,129,0,0,11,22,33,44,
55,66,0,8,16,24,32,6628
2250 DATA 48,48,56,64,169,70,141,0,210
,169,15,133,154,169,0,133,6899
2260 DATA 158,173,120,2,133,188,32,170
126,165,188,205,120,2,240,246,2945
2270 DATA 96,169,8,141,0,210,169,8,133
,154,169,32,133,158,96,169,8840
2280 DATA 0,133,224,127,219,128,128,16
9,80,133,129,169,0,133,138,169,9850
2290 DATA 144,133,131,165,128,24,105,8
0,133,128,144,2,230,129,160,14,7417
2300 DATA 169,89,133,143,162,32,177,12
8,145,130,200,192,25,208,247,160,3494
2310 DATA 14,165,128,24,105,20,133,128
144,2,230,129,165,130,24,105,7133
2320 DATA 40,133,130,144,2,230,131,198
143,165,143,201,0,208,215,96,2078
2330 DATA 169,137,133,129,169,0,133,12
8,160,0,169,0,145,128,208,192,9536
2340 DATA 0,208,249,230,129,165,129,20
1,160,208,237,96,165,140,133,160,4508
2350 DATA 165,141,133,161,169,2,133,15
6,162,8,169,16,133,132,169,144,8801
2360 DATA 133,133,164,144,134,136,165,
144,201,1,248,9,201,4,240,5,8536
2370 DATA 138,24,105,10,170,181,203,20
1,160,208,11,185,26,134,170,214,1925
2380 DATA 160,32,194,128,246,160,166,1
36,165,144,201,2,240,9,201,3,9607
2390 DATA 240,5,138,24,105,10,170,181,
203,201,160,208,11,185,26,134,9733
2400 DATA 170,246,160,32,194,128,214,1
60,166,136,181,193,201,160,240,20,4120
2410 DATA 24,185,21,134,170,181,160,12
1,16,134,149,160,166,136,232,224,3596
2420 DATA 6,208,161,96,32,194,128,96,7
2,138,72,152,72,165,161,10,7162
2430 DATA 133,128,169,0,42,133,129,6,1
28,38,129,6,128,165,128,133,6330
2440 DATA 130,38,220,128,215,129,129,1
65,129,133,131,6,128,38,129,6,6121
2450 DATA 128,38,129,165,128,24,101,13
0,133,128,165,129,101,131,133,129,9278
2460 DATA 165,132,24,105,10,24,101,128
133,128,165,133,101,129,133,129,8372
2470 DATA 165,160,41,3,170,165,160,74,
74,24,101,128,133,128,165,129,8255
2480 DATA 105,0,133,129,164,156,189,61
129,57,53,129,133,159,189,57,8631
2490 DATA 129,168,0,49,128,5,159,145,1
28,104,168,104,170,104,96,0,6472
2500 DATA 85,170,255,63,207,243,252,19
2,48,12,3,0,0,81,82,82,3996
2510 DATA 82,82,82,82,82,82,82,82,82,8
2,69,8,0,0,0,0,7779
2520 DATA 0,0,0,0,0,0,0,35,111,109,112
,97,115,115,0,0,390
2530 DATA 0,0,0,0,0,124,52,105,109,101
,8,37,108,97,112,115,3195
2540 DATA 101,100,124,0,0,0,0,0,0,0,0,
0,0,0,0,0,3213
2550 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,12
4,0,16,4542
2560 DATA 26,16,16,26,16,16,14,16,16,0
,124,0,0,0,0,0,4680
2570 DATA 0,0,0,0,0,0,0,0,L6,111,114,1
16,104,0,0,0,8892
2580 DATA 0,0,0,0,0,90,82,82,82,82,82,
82,82,82,82,82,2558
2590 DATA 82,82,67,0,0,0,0,0,0,0,0,0,0
,0,0,0,3037
2600 DATA 0,0,216,129,211,138,92,0,0,0
,0,0,0,0,0,0,6243
2610 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,2610
2620 DATA 0,0,0,0,0,0,0,0,55,181,115,1
16,0,94,8,95,9618
2630 DATA 8,37,97,115,116,0,0,0,0,0,0,
0,0,0,0,0,4035
2640 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,2648
2650 DATA 0,0,0,0,0,0,93,0,0,0,0,0,0,0
,0,0,3301
2666 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,8,2660
2670 DATA 0,0,0,0,0,0,0,0,0,0,0,0,51,1
11,117,116,8498
2680 DATA 104,0,0,0,0,0,0,0,0,0,0,0,0,
35,111,110,6699
2690 DATA 163,114,97,116,117,108,97,11
6,105,111,110,115,0,48,97,116,5244
2700 DATA 104,102,105,118,100,181,114,
1,1,0,0,0,0,0,0,0,5684
2710 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,2710
2720 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,8,2728
2730 DATA 0,0,0,0,0,0,0,0,0,0,0,30,57,
111,117,8,7140
2740 DATA 104,97,118,181,0,181,115,99,
97,112,101,180,8,116,104,181,5103
2750 DATA 8,44,97,98,121,114,105,118,1
16,104,28,0,0,8,0,8,8817
2760 DATA 0,0,212,138,287,131,0,0,0,0,
0,0,0,0,0,0,5737
2770 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,2770
2780 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,2780
2790 DATA 0,0,0,57,111,117,114,0,116,1
05,109,101,0,119,97,115,4539
2800 DATA 0,16,26,16,16,26,16,16,14,16
,16,0,0,0,0,0,3912
2810 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,2810
2820 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,2820
2830 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,2830
2840 DATA 0,0,48,114,181,115,115,0,214
180,242,233,231,231,229,242,8168
2850 DATA 194,0,116,111,0,50,181,115,1
16,97,114,116,0,0,0,0,423
2860 DATA 0,0,0,0,0,0,0,0,0,0,0,0,57,1
11,117,0,6910
2870 DATA 104,97,118,181,0,98,181,101,
110,8,99,97,112,116,117,114,5931
2880 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,3181
2890 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,2890
2900 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,2900
2910 DATA 0,0,0,0,0,0,0,0,57,111,117,0
,119,105,188,108,2185
2920 DATA 0,98,208,131,203,132,101,0,1
00,105,115,112,111,115,101,108,7505
2930 DATA 0,111,102,0,97,116,0,116,104
,101,0,0,0,0,0,0,7513
2940 DATA 0,0,0,0,0,118,181,128,116,0,
116,185,109,101,0,99,3262
2950 DATA 111,118,118,105,181,110,181,
110,116,0,102,111,114,0,121,111,5378
2960 DATA 117,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,57,3989
2970 DATA 111,117,114,0,116,185,189,18
1,0,119,97,115,8,16,26,16,945
2980 DATA 16,26,16,16,14,16,16,0,0,0,0
,0,0,0,0,0,3438
2990 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,2990
3000 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,3000
3810 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,
48,114,5554
3820 DATA 101,115,115,0,214,180,242,23
3,231,231,229,242,194,8,116,111,5254
3030 DATA 0,50,101,115,116,97,114,116,
0,0,0,0,0,0,0,0,6781
3040 DATA 228,222,221,223,0,69,108,149
110,165,132,133,128,165,133,133,1406
3050 DATA 129,162,8,160,0,169,160,145,
128,208,192,49,208,249,169,8,2014
3060 DATA 145,128,24,165,128,185,50,13
3,128,144,2,238,129,232,224,35,1096
3070 DATA 288,225,169,0,133,130,165,13
2,133,128,165,133,133,129,24,165,314
3080 DATA 128,185,284,132,199,133,53,1
33,128,144,2,230,129,160,0,169,9781
3090 DATA 5,145,128,173,10,210,41,7,13
3,153,165,153,56,233,4,176,9358
3100 DATA 242,165,153,133,143,165,128,
133,130,165,129,133,131,165,153,281,36
87
3110 DATA 0,208,14,24,165,138,105,2,13
3,130,144,62,230,131,76,64,7833
3120 DATA 133,165,153,201,1,288,14,56,
165,138,233,108,133,130,176,42,54
3130 DATA 198,131,76,64,133,165,153,28
1,2,268,14,56,165,130,233,2,8824
3140 DATA 133,130,176,22,198,131,76,64
133,165,153,201,3,208,11,24,7411
3150 DATA 165,130,105,100,133,130,144,
2,238,131,168,8,177,130,201,160,1595
3160 DATA 208,35,165,153,24,105,1,168,
0,201,8,208,2,169,32,145,6280
3170 DATA 138,32,166,133,160,0,169,32,
145,128,165,130,133,128,165,131,685
3180 DATA 133,129,76,217,132,165,153,2
01,3,208,7,169,0,133,153,76,8581
3190 DATA 122,133,230,153,165,153,197,
143,248,3,76,235,132,160,0,177,1780
3200 DATA 128,133,153,169,32,145,128,1
65,153,56,233,5,176,95,198,153,1571
3210 DATA 166,153,189,8,134,133,153,32
166,133,32,166,133,76,217,132,372
3220 DATA 165,153,261,8,288,14,24,165,
128,105,1,133,128,144,62,236,9085
3230 DATA 129,76,243,133,165,153,281,1
288,14,56,165,128,233,50,133,342
3240 DATA 128,176,280,133,195,134,42,1
98,129,76,243,133,165,153,201,2,2833
3250 DATA 288,14,56,165,128,233,1,133,
128,176,22,198,129,76,243,133,1467
3260 DATA 165,153,201,3,208,11,24,165,
128,105,50,133,128,144,2,238,8678
3270 DATA 129,96,162,8,181,193,149,223
,232,224,7,208,247,96,2,3,501
3280 DATA 0,1,255,255,1,1,1,1,255,255,
1,0,1,8,0,255,4042
3290 DATA 255,1,1,0,1,0,1,0,0,0,1,0,1,
8,7,5,3883
3300 DATA 4,2,18,6,18,6,18,118,110,118
,110,122,8,3,3,3,9297
3310 DATA 3,8,255,126,60,24,24,84,92,1
08,108,116,154,146,138,130,8470
3320 DATA 122,169,89,141,159,126,169,1
30,141,160,126,133,131,173,160,126,277
7
3330 DATA 133,131,173,159,126,24,105,1
80,133,130,144,2,230,131,162,0,9188
3340 DATA 165,223,201,69,240,42,169,25
5,133,138,169,3,141,8,208,141,1298
3350 DATA 9,208,32,22,126,162,166,169,
255,232,157,0,116,157,8,117,9995
3360 DATA 224,229,208,245,169,32,141,0
208,169,192,141,1,208,162,0,391
3370 DATA 181,148,24,105,16,188,31,134
145,130,232,224,5,208,241,165,3913
3380 DATA 223,201,69,240,11,173,10,210
141,18,208,141,19,208,230,159,2597
3390 DATA 173,132,2,201,1,240,232,76,0
,105,0,0,0,0,0,188,1892
3400 DATA 97,98,196,134,91,135,121,114
,105,110,116,104,115,0,0,0,3905
3410 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,3410
3420 DATA 0,0,0,0,0,0,0,0,0,0,52,104,1
01,0,53,108,9076
3430 DATA 116,105,109,97,116,101,0,19,
13,36,0,45,97,122,101,0,1310
3440 DATA 0,33,188,118,181,118,116,117
,114,101,0,0,0,0,0,0,9227
3450 DATA 0,0,0,0,35,9,0,17,25,24,23,0
,0,33,114,103,8385
3460 DATA 111,51,111,102,116,0,48,114,
111,lO8,117,99,116,105,111,110,7119
3470 DATA 115,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,3585
3480 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,3480
3490 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,103,5138
3500 DATA 251,183,173,252,2,201,28,208
,3,76,0,105,165,187,281,0,8385
3510 DATA 240,3,76,106,lO3,169,16,133,
187,166,189,169,0,133,156,32,9277
3520 DATA 228,183,165,144,133,186,166,
189,181,179,133,144,181,172,168,181,62
59
3530 DATA 165,170,169,32,133,198,32,43
104,166,189,181,172,168,181,165,3833
3540 DATA 170,32,181,121,166,189,165,1
86,133,144,165,194,281,32,288,58,3857
3550 DATA 32,246,103,166,189,169,3,133
156,230,189,164,189,136,196,191,6199
3560 DATA 240,6,32,220,103,76,19,103,1
69,0,133,189,169,69,133,190,166
3570 DATA 166,189,228,191,240,15,181,1
72,168,181,165,170,32,43,104,238,2930
3580 DATA 189,197,191,288,231,169,0,13
3,189,96,173,10,210,24,105,128,174
3590 DATA 144,18,165,203,281,168,248,3
76,188,103,165,213,281,160,240,6246
3600 DATA 21,76,204,103,165,213,201,16
0,240,3,76,204,183,165,283,201,4971
3610 DATA 160,240,3,76,188,103,173,10,
210,24,105,128,144,16,181,179,9908
3620 DATA 168,185,199,103,149,179,76,8
1,103,0,2,3,4,1,181,179,4796
3630 DATA 168,185,215,103,149,179,76,8
1,103,0,4,1,2,3,181,165,4630
3640 DATA 133,160,181,172,133,161,169,
16,133,132,169,144,133,133,165,155,291
6
3650 DATA 281,0,208,3,32,194,128,96,16
6,189,181,179,170,202,252,103,5464
3660 DATA 74,104,189,18,104,24,101,189
168,24,185,165,0,125,14,104,6855
3670 DATA 153,165,0,96,255,255,1,1,7,0
,7,0,20,48,48,2,9181
3680 DATA 48,9,11,20,34,2,20,20,2,2,4,
4,4,1,4,3,4645
3690 DATA 3,169,92,133,132,169,135,133
133,136,192,0,240,8,169,50,9758
3700 DATA 32,124,122,76,51,104,138,32,
124,122,160,0,165,190,145,132,9939
3710 DATA 96,0,105,251,105,169,64,141,
14,212,169,0,141,6,212,141,9614
3720 DATA 1,218,162,0,142,8,208,142,9,
208,149,223,232,224,6,208,4023
3730 DATA 249,142,0,208,142,1,208,162,
0,189,22,184,149,165,232,224,3254
3740 DATA 20,208,246,169,255,133,138,1
69,0,133,145,133,192,76,149,105,1977
3750 DATA 72,138,72,152,72,165,192,201
0,208,16,162,144,142,22,208,942
3760 DATA 232,141,10,212,224,159,208,2
45,76,131,105,201,1,240,4,201,2852
3770 DATA 2 ,208,17,162,0,142,22,208,23
2,232,141,10,212,224,16,208,3096
3780 DATA 244,76,131,105,164,145,185,7
6,108,141,24,208,230,145,165,145,3539
3790 DATA 201,6,208,4,169,0,133,145,23
0,192,165,192,201,9,208,4,1611
3800 DATA 169,0,133,192,104,168,104,17
0,104,64,169,91,141,48,2,169,8518
3810 DATA 186,141,49,2,169,59,141,0,2,
169,105,141,1,2,169,192,6742
3820 DATA 141,14,212,169,0,141,198,2,1
69,34,141,47,2,165,155,76,7482
3830 DATA 48,106,164,191,162,0,185,144
108,168,185,82,108,201,91,240,3697
3840 DATA 8,157,242,107,200,232,76,197
105,165,191,24,105,16,141,167,1176
3850 DATA 107,173,31,208,201,5,208,7,1
69,1,133,159,76,0,106,201,8471
3860 DATA 3,240,18,201,6,208,226,169,0
,141,252,2,169,0,133,138,19
3870 DATA 133,252,105,247,106,159,76,0
120,169,48,141,0,210,169,15,8531
3880 DATA 141,28,2,173,28,2,24,105,160
,141,1,210,201,160,208,243,3177
3890 DATA 141,1,210,165,159,201,0,240,
41,169,0,133,159,230,155,165,3151
3900 DATA 155,201,2,208,4,169,0,133,15
5,168,162,0,185,169,108,168,1329
3910 DATA 185,151,188,201,91,208,3,76,
189,105,157,194,107,200,232,76,3550
3920 DATA 55,106,230,191,165,191,201,7
,240,3,76,189,105,169,0,133,228
3930 DATA 191,76,189,105,112,112,112,6
6,128,106,2,240,7,8,240,6,6705
3940 DATA 128,6,112,2,112,2,112,2,112,
240,0,130,0,138,112,112,6056
3950 DATA 130,8,130,0,138,8,65,91,106,
0,0,0,0,0,33,114,9576
3960 DATA 103,111,51,111,102,116,0,51,
111,102,116,119,97,114,101,0,5591
3970 DATA 48,114,111,100,117,99,116,10
5,111,110,115,0,0,0,0,0,1174
3980 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,48
,114,111,8138
3990 DATA 117,100,108,121,0,48,114,101
,115,181,110,116,115,0,0,0,3151
4000 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,
44,33,5188
4010 DATA 34,57,50,41,46,52,40,51,0,0,
0,0,0,0,0,52,6534
4020 DATA 40,37,0,53,44,52,41,45,33,52
,37,0,19,13,36,0,7718
4830 DATA 0,248,106,243,107,0,0,0,45,3
3,58,37,0,33,36,54,34
4040 DATA 37,46,52,53,58,37,0,0,0,0,0,
0,0,0,0,0,5009
4050 DATA 0,0,33,14,46,14,33,14,44,14,
47,14,39,14,0,35,7346
4060 DATA 111,109,112,117,116,105,110,
103,0,0,0,0,0,0,8,8,7997
4070 DATA 8,8,8,8,8,0,48,114,111,183,1
14,97,109,109,101,100,5823
4080 DATA 0,0,34,121,0,51,116,101,118,
101.110,0,44,97,115,104.5193
4090 DATA 111,119,101,114,0,0,0,8,8,8,
8,35,9,0,17,25,6478
4100 DATA 24,23,0,33,114,103,111,51,11
1,102,116,0,51,111,102,116,5573
4110 DATA 119,97,114,101,0,48,114,111,
100,117,99,116,185,111,110,115,8183
4120 DATA 0,0,0,0,0,46,117,109,98,101,
114,0,111,102,0,33,2632
4130 DATA 114,103,111,110,105,97,110,0
48,97,116,114,111,108,108,101,7337
4140 DATA 114,115,13,30,16,0,0,0,0,0,8
,0,57,111,117,0,8773
4150 DATA 55,105,108,108,0,33,116,116,
101,109,112,116,0,33,0,0,2194
4160 DATA 0,0,0,0,0,0,0,0,37,115,99,97
,112,101,0,0,766
4170 DATA 0,0,0,214,175,240,244,233,23
9,238,194,0,36,105,102,102,2678
4180 DATA 105,99,117,108,116,121,0,44,
181,118,101,108,0,13,0,0,1602
4190 DATA 0,244,107,170,108,0,0,0,0,0,
0,0,0,0,0,214,9643
4200 DATA 179,229,236,229,227,244,194,
0,36,97,121,116,105,109,101,0,8841
4210 DATA 111,114,0,46,105,103,104,116
105,189,101,0,37,115,99,97,5806
4220 DATA 112,101,0,0,0,0,0,214,179,24
4,225,242,244,128,194,0,3550
4230 DATA 37,110,116,101,114,0,116,104
101,0,44,97,98,121,114,185,6368
4240 DATA 110,116,104,8,8,8,8,0,0,0,0,
0,0,194,178,162,2872
4250 DATA 146,130,0,34,101,103,105,110
110,101,114,91,37,97,115,121,7376
4260 DATA 0,0,0,8,91,45,111,100,101,11
4,97,116,101,91,40,97,5809
4270 DATA 114,100,0,0,0,0,91,52,114,10
5,118,105,97,108,91,51,5225
4280 DATA 97,100,105,115,116,105,99,91
,41,110,115,97,110,101,0,0,4725
4290 DATA 91,0,9,18,27,36,44,53,36,97,
121,108,105,103,104,116,5707
4300 DATA 91,46,105,183,104,116,105,10
9,101,91,0,9,226,2,227,2,6363
4310 DATA 0,185,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,4520


Listing 2
Assembly listing

.OPT NO LIST
.OPT OBJ
;-----------------------------
;Labyrinths: Revision 09/15/87
;Programmed By Steven Lashower
;C0 1987 Arqosoft Productions
;-----------------------------
*= $80
;-------------------
;Page Zero Variables
;-------------------
LO         .DS 2     ;jSrce Copy adrs
DESTLO     .DS 2     ;jDest Copy adrs
MTEMP      .DS 2     ;Maze location
YTEMP      .DS 1     ;Y Coord Temp
COLTMP     .DS 1     ;X Coord Temp
XTMP       .DS 1     ;X Coord Temp
YTMP       .DS 1     ;Y Coord Temp
FLAG       .DS 1     ;Variable Flag
LEN        .DS 1     ;Maze Draw Lngth
H          .DS 1     ;Player X Coord
V          .DS 1     ;Player Y Coord
W          .DS 1     ;Maze width
TEMP       .DS 1     ;Temporary Data
DIRECTION  .DS 1     ;Player Drection
DUMMY      .DS 1     ;Temporary Data
BACK       .DS 1     ;Behnd plyr data
COUNTR     .DS 1     ;Main DLI point r
SEC1       .DS 5     ;Time "h:mm:ss"
J          .DS 1     ;Maze gem varble
VOLUMI     .DS 1     ;Sound volume
TIME       .DS 1     ;Day/Night Flag
COLOR      .DS 1     ;Draw/Plot Color
OFF        .DS 1     ;Patroler Bottom
TONE       .DS 1     ;Tone for sound
HOLD       .DS 1     ;Temp storage
PLOTX      .DS 1     ;X Coord Value
PLOTY      .DS 1     ;Y Coord Value
COPCNT     .DS 1     ;Byte copy count
FRONT2     .DS 1     ;Center cpy byte
BACK2      .DS 1     ;COPY of BACK
H2         .DS 7     ;Patrol X Coords
V2         .DS 7     ;Patrol Y Coords
DIR2       .DS 7     ;Patrol Drection
DIRTMP     .DS 1     ;Temp. DIRECTION
CDTMV4     .DS 1     ;Patrol Move Chk
OLDSTK     .DS 1     ;StiCk 0 Copy
MNUM       .DS 1     ;Patroller H
PAT        .DS 1     ;Patrol Plot Var
DIFLEV     .DS 1     ;DiffcultY level
POINTER    .DS 1     ;Title DLI pntr
CENTER     .DS $0A   ;Center data
LEFT       .DS $0A   ;Left side data
RIGHT      .DS $0A   ;Right side data
CENTER2    .DS $0A   ;Copy Of CENTER
RTCLOK     =   $14
ROWCRS     =   $54
COLORS     =   $55
VDSLST     =   $0208
CDTMV3     =   $021C
SDMCTL     =   $022F
SDLSTL     =   $0238
GPRIOR     =   $026F
STICK0     =   $0278
STRIG0     =   $0284
PCOLR0     =   $02C8
COLOR0     =   $02C4
COLOR2     =   $02C6
COLOR3     =   $02C7
CH         =   $02FC
HPOSP0     =   $D000
HP05P1     =   $D001
SIZEP0     =   $D008
51ZEP1     =   $D009
SIZEP2     =   $D00A
SIZEP3     =   $D00B
COLPM0     =   $D012
COLPM1     =   $D013
COLPM2     =   $D014
COLPM3     =   $D015
COLPF0     =   $D016
COLPF1     =   $D017
COLPF2     =   $D018
GRACTL     =   $D01D
CONSOL     =   $D01F
AUDF1      =   $D200
AUDC1      =   $D201
RANDOM     =   $D20A
DMACTL     =   $D400
PMBASE     =   $D407
WSYNC      =   $D40A
NMIEN      =   $040E
SETVBV     =   $E45C
XITVBV     =   $E462
DISP       =   $9000
SCREEN     =   $5000
TIMSC      =   BOTTOM+$52
PRINT1     =   TEXT+$0172
PRINT2     =   TEXT+$0127
PRINT3     =   TEXT+$0142
PMG        =   $7000
PL1        =   $7500
           *=  $7800
;-------------------
;Get things ready...
;-------------------
LABYRINTHS LDA #$00    ;Turn screen
           STA SDMCTL  ;off.
           STA FLAG
           LDA #$FF
           STA VOLUM1
           JSR CLSCN   ;Clear screen.
           LDA # <MAZE
           STA #TEMP   ;Copy maze
           LDA # >MAZE ;Addresss.
           STA #TEMP+1
           JSR GENMZE ;Generate Maze!
           LDA #$C5   ;Exit in lower
           STA MAZE+$06D ;right corner
           LDA # <BOTTOM
           STA TEXTB  ;Print timer &
          
LDA # >BOTTOM ;compass at
           STA TEXTS+1 ;screen bottom.
           LDA #$00
           LDX #$00
CLTIME     STA SEC1,X  ;set elapsed
           INX        
;time to 0:00:00
           CPX #$05
           BNE CLTIME
           STA COUNTR
           LDA #$3C    ;Set timer for 1
           STA CDTMV3  ;Second.
           LDY # <VBI
           LDX # >VBI
           LDA #$07    ;Initialize VBI.
           JSR SETVBV
           LDA #$01    ;Player starts
           STA H       ;game at 01,2).
           LDA #$02
           STA V
           LDA #S03    ;Player's facing
           STA DIRECTION ;south,
           LDA #$32    ;Maze Width = 50
           STA W
           JSR SETUP    ;Set up screen.
           JMP MAINPROG ;Main Program.
;----------------------
;Display List Interrupt
;----------------------
DLI        PHA        ;Save Accum and

           TXA        ;X Register.
           PHA
           LDX COUNTR ;Which DLI?
           CPX #$00
           BNE DLI1
           INX        ;Point to next
           STX COUNTR ;DLI.
           LDX #$90
DLI0       STX COLPF1 ;Shade game
           INX        ;title in 8
           INX        ;shades of blue.
           STA WSYNC  ;Wait for SYNC.
           CPX #$A0   ;Shaded yet?
           BNE DLI0   ;Hope...
           LDA #$0A   ;Set Text Luma.
           STA COLPF1
           JMP ENDDLI ;Return from DLI
DLI1       LDA #$0A   ;Set maze wall
           STA COLPF2 ;colors to
           LDA #$04   ;shades of grey.
           STA COLPF1
           LDX COUNTR
           LDA TIME   ITS
           CMP #$00   ;Daytime?
           BNE DLI2   ;Nope...
           LDA COLORS,X ;Yep! Dayglow
           JMP DLI3    ;colors.
DLI2       LDA COLORS2,X ;Night colors
DLI3       STA COLPM2    ;Store colors
           STA COLPM3    ;in players 2&3.
DLI3B      INX           ;Point to next
           STX COUNTR    ;DLI...
           CPX #$11      ;All colors yet?
           BNE ENDDLI    ;Nope! Exit DLI.
           LDA #$00      ;Reset pointer
           STA COUNTR    ;to screen top.
           LDA #$F8
           STA COLPF0    ;Set all colors
           LDA #$0A      ;for bottom
           STA COLPF1    ;of screen.
           LDA #$00
           STA COLPF2
ENDDLI     PLA           ;Restore X reg.
           TAX
           PLA           ;Restore Accum.
           RTI
;------------------------
;Vertical Blank Interrupt
;------------------------
VBI       INC PCOLR0    ;Increase
          INC PCOLR0+1  ;Patroller and
          LDA PCOLR0+l  ;player in maze
          CMP #$9F
          BNE XXl       ;Make sure
          LDA #$90      ;player flashes
          STA PCOLR0+1  ;blue.
xxl       LDA CDTMV4    ;Decrease timer
          CMP #$00      ;if and only if
          BEQ XX2       ;not zero.
          DEC CDTMV4
XX2       LDA FLAG      ;Flag set?
          CMP #$FF
          BNE XX3      ;Yep. Exit VBI!
          JMP XITVBV
XX3       LDA CDTMV3   ;Second elapsed?
          CMP #$00
          BNE X1       ;Mope...
          LDA #$3C     ;Ya! Reset
          STA CDTMV3   ;timer!
          INC SEC1     ;Increase second
          LDX #$00     ;digit.
X0l       LDA SEC1,X   ;Check digits
         
CMP COMP,X   ;for carry.
          BNE X0       ;No carry.
          LDA #$00     ;Carry! Zero
          STA
SEC1,X   ;digit. Inc next
          INC SEC1+1,X ;digit.
X0        INX
          CPX #$05     ;Done checking?
          BNE X01      ;Nope...
X1        LDX #$00     ;Ya! print time.
PRTIME    LDA SECI,X   ;Load digit to
          CLC          ;print and add
          ADC #$10     ;ATASCII offset.
          LDY YVAL,X   ;Add offset and
          STA TIMSC,Y  ;print it!
          INX
          CPX #$05     ;All printed?
          BNE PRTIME   ;Nope...
          LDA VOLUM1   ;Play a sound?
          CMP #$FF
          BEQ X2       ;Nope...
          DEC VOLUM1   ;Yes! Decrease
          CLC          ;Volume of sound
          ADC TONE     ;and add
          STA AUDC1    ;distortion.
XZ        LDX #$00
DI1       LDA CENTER2,X ;Can player
          CMP #$45     ;View patroller?
          BEQ DI2      ;Yes...
          CMP #$A0     ;Is a wall in
          BNE DL1A     ;the way?
          LDA #$00     ;If one is, then
          STX HPOSP0   ;don't display
          JMP XITVBV   ;it so exit VBI.
DLlA      INX
          CPX #$05     ;All view check?
          BNE DI1      ;Nope...
DI2       LDA HARGO,X  ;Set horizontal
          STA HPOSP0   ;position 3 size
          LDA SARGO,X  ;depending its
          STA SIZEP0   ;distance "X".
          LDA OFARG,X  ;Where's its
          STA OFF     
;bottom?
          LDY #$00
          LDA #$00     ;Erase player's
VB1       STA PMG+$0400,Y ;bytes.
          INY
          BNE VBl
          LDA ONARG,X  ;Find patrollers
          TAY          ;top and put
VB2       LDA BARGO,X  ;bytes into
          STA
PMG+$0400,Y ;PMAREA.
          INY
          CPY OFF      ;Bottom reached?
          BNE VB2      ;NO, next byte.
          JMP XITVBV   ;Ya, exit VBI
;--------------------------
;Read Surrounding Maze Data
;--------------------------
START     LDA # <MAZE  ;Get maze
          STA MTEMP    ;address and
          LDA # >MAZE  ;copy it.
          STA MTEMP+1
S0        DEY          ;Decrease "Y"
          CPY #$00     ;Zero yet?
          BEQ S1       ;Yep.
          LDA W        ;Add maze width.
         
JSR ADD
          JMP S0       ;Do it again.
S1        TXA          ;Add horizontal.
          JSR ADD
          LDX A #$00

          LDA DIRECTION ;Facing north?
          CMP #$01
          BNE T1       ;Nope...
          LDA W        ;By adding maze
          JSR ADD      ;width, we can
          LDY #$00     ;get the space
          LDA (MTEMP),Y ;in back of
          STA BACK     ;player.
          LDA W
          CLC          ;Subtract width.
          ADC #$01
          JSR SUBTRACT
S45       LDY #$00     ;Get 8 bytes
          LDA (MTEMP),Y ;for
          STA LEFT,X   ;left
          INY
          LDA (MTEMP),Y
          STA CENTER,X ;center
          INY
          LDA (MTEMP),Y
          STA RIGHT,X  ;& right walls.
          INX
          LDA W        ;Get ready
          JSR SUBTRACT ;for next.
          CPX #$00     ;Add 8 bytes?
          BNE S45      ;Nope...
          RTS          ;
T1        LDA DIRECTION ;Facing south
          CMP #$03
          BNE T2
          LDY #$00
          LDA W
          JSR SUBTRACT
          LDA (MTEMP),Y
          STA BACK
          LDA W
          SEC
          SBC #$01
          JSR ADD
T45       LDY #$00
          LDA (MTEMP),Y
          STA RIGHT,X
          INY
          LDA (MTEMP),Y
          STA CENTER,X
          INY
          LDA (MTEMP),Y
          STA LEFT,X
          INX
          LDA W
          JSR ADD
          CPX #$00
          BNE T45
          RTS
T2        LDA DIRECTION ;Facing east
          CMP #$04
          BNE T3
          LDY #$00
U1        LDA (MTEMP),Y
          STA CENTER,Y
          INY
          CPY #$00
          BNE U1
          LDY #S00
          LDA #$01
          JSR SUBTRACT
          LDA (MTEMP),Y
          STA BACK
          LDA #$01
          JSR ADD
          LDA W
          JSR SUBTRACT
U4        LDA (MTEMP),Y
          STA LEFT,Y
          INY
          CPY #$08
          BNE U4
          LDA W
          CLC
          ADC W
          JSR ADD
          LDY #$00
          LDA (MTEMP),Y

          STA RIGHT,Y
          INY
          CPY #$08
          BNE U6
          RTS
T3        LDY #$00
          LDX #$00
V1        LDA (MTEMP),Y ;Facing West
          STA CENTER,x
          LDA #$01
          JSR SUBTRACT
          INX
          CPX #$08
          BNE V1
          LDA #$09
          JSR ADD
          LDA (MTEMP),Y
          STA BACK
          LDA #$01
          CLC
          ADC W
          JSR SUBTRACT
          LDX #$00
V4        LDA (MTEMP),Y
          STA RIGHT,X
          LDA #$01
          JSR SUBTRACT
          INX
          CPX #$08
          BNE V4
          LDA #$08
          CLC
          ADC W
          ADC W
          JSR ADD
          LDX #$00
V6        LDA (MTEMP),Y
          STA LEFT,X
          LDA #$01
          JSR SUBTRACT
          INX
          CPX #$08
          BNE V6
          RTS
ADD       CLC          ;Add Accumulator
          ADC MTEMP    ;to MTEMP with
          STA MTEMP    ;carry.
          BCC SUB2
          INC MTEMP+1
          RTS
SUBTRACT  STA TEMP     ;Subtracts
          SEC          ;TEMP from
          LDA MTEMP    ;MTEMP with
          SBC TEMP     ;carry.
          STA MTEMP
          BCS SUB2
          DEC MTEMP+1
SUB2      RTS
WCOMP     .BYTE $A0,$20,$A0,$20
          .BYTE $C5,$C5
WALO      .BYTE $00,$00,$0A,$0A
          .BYTE $00,$0A
;---------------------------
;WALL DATA/VIEWING PROCESSOR
;---------------------------
MAINPROG  LDY V        ;Get player's
          LDX H        ;coords and pass
          JSR START    ;to routine.
          JSR COPCEN   ;Copy CENTER.
          LDY #$00
          STY FLAG
LOOP      LDA CENTER,Y ;Get byte in
          LDX #$00     ;front of player
          CMP #$C5     ;Is it an exit?
          BNE LO0      ;No ...
          STA FLAG     ;Yes, set flag
          JMP FRONTWALL ;AND DRAW IT!
LO0       CMP #$A0     ;is it a wall?
          BNE N1A2     ;No.
          JMP FRONTWALL ;Yes! Draw it!
1IA2      TYA
          CLC
          STA HOLD
          ADC WALO,X   ;Offset for LEFT
          TAY          ;and RIGHT side.
          LDA LEFT,Y   ;Get side wall.
          CMP #$45     ;Patrolir there?
          BNE N1A25    ;NO.
          LDA #$20     ;Yes ... Print
N1A25     STX J        ;passage there.
          CMP NCOMP,X
          BNE N1A3
          LDY HOLD
          STX FLAG
          JSR LEFTWALL
NIA3      LDX J
          INX
          LDY HOLD
          CPX #$06
          BNE N1A2
          INY
          CPY #$05
          BNE LOOP
          LDA #$07
          STA COLCRS
          LDA #$02
          STA DUMMY
N22       LDY DUMMY
          LDA #$00
          STA TEMP
          JSR PRINT
          INC DUMMY
          LDA DUMMY
          CMP #$0C
          BNE N22
          LDY #$05
          LDA CENTER,Y
          INY
          CMP #$A0
          BNE N3
          LDA #$05
          JMP N4
N3        CMP #$C5
          BNE N3A
          LDA #$00
          JMP N4
N3A       LDA #$07
N4        STA TEMP
          JSR PRINT
          JMP LINE139
LEFTWALL  STY YTEMP
          LDA MULTI,Y
          TAX
          DEX
          LDA FLAG
          CMP #$03
          BEQ L3
          CMP #$05
          BEQ L3
          CMP #$02
          BNE L1
L3        LDA #$0C
          SEC
          SBC YTEMP
          STA COLTMP
          LDY #$00
          JMP DOWALL
LI        LDA #$02
          CLC
          ADC YTEMP
          STA COLTMP
          LDY #$00
DOWALL    INX
          INY
          TYA
          CLC
          ADC #$04
          STA ROWCRS
          LDA COLTMP
          STA COLORS
          LDA FLAG
          CMP #$00
          BEQ D3
          CMP #$02
          BEQ D
          CMP #$03
          BEQ D4
          CMP #$01
          BEQ D4
          LDA #$00
          JMP D2
D4        LDA PASS,X
          JMP D2
D1        LDA RWAL,X
          JMP D2
D3        LDA LWAL,X
D2        STX XTMP
          STY YTMP
          STA TEMP
          JSR PRINT
          LDX XTMP
          LDY YTMP
          CPY #$0B
          BNE DOWALL
          LDY YTEMP
          LDA #$00
          STA FLAG
          RTS
;-----------------------------
;Character bytes for left wall
;-----------------------------

LWAL     .BYTE
$06,$01,$01,$01,$01
         .BYTE
$01,$01,$01,$01,$01,$03
         .BYTE $00,
$06,$01,$01,$01,$01
         .BYTE
$01,$01,$01,$03,$00
         .BYTE
$00,$00 $06,$01,$01,$01
         .BYTE
$01,$01,$03,$00,$00
         .BYTE $00,
$00,$00,$06,$01,$01
         .BYTE $01,
$03,$00,$00,$00
         .BYTE
$00,$00,$00,$00,$06,$01
         .BYTE
$03,$00,$00,$00,$00
;------------------------------
;Character bytes for right wall
;------------------------------

RHAL     .BYTE
$04,$01,V01,$01,$01,$01
         .BYTE
$01,$0l,$01,$01,$01,$02
         .BYTE $00,
$04,$01,$01,$01,$01
         .BYTE $01,
$01,$01,$02,$00
         .BYTE
$00,$00,$04,$01,$01,$01
         .BYTE $01,
$01,$02,$00,$00
         .BYTE
$00,$00,$00,$04,$01,$01
         .BYTE
$0l,$02,$00,$00,$00
         .BYTE $00,
$00,$00,$00,$04,$01
         .BYTE
$02,$00,$00,$00,$00
;-------------------------------
;Character bytes for passageways
;-------------------------------
PASS     .BYTE
$00,$05,$05,$05,$05
         .BYTE $05,
$05,$05,$05,$05,$00
         .BYTE $00,
$00,$05,$05,$05,$05
         .BYTE $05,$05,
$05,$00,$00
         .BYTE $00,$00,
$00,$05,$05,$05
         .BYTE $05,
$05,$00,$00,$00
         .BYTE
$00,$00,$00,$00,$05,$05
         .BYTE $05,
$00,$00,$00,$00
         .BYTE
$00,$00,$00,$00,$00,$05
         .BYTE $00,
$00,$00,$00,$00
LENGTH   .BYTE $09,
$07,$05,$03,$01
HORIZ    .BYTE
$03,$04,$05,$06,$07
;----------------
;Day/Night Colors
;----------------
COLORS   .BYTE $00,
$9F,$9D,$9B,$99
         .BYTE
$97,$95,$93,$91,$F8,$F2
         .BYTE
$F4,$F6,$F8,$FA,$FC
         .BYTE
$00,$00
COLORS2  .BYTE
$00,$00,$00,$00,$00
         .BYTE $00,
$00,$00,$00,$00
         .BYTE
$00,$02,$04,$06,$08
         .BYTE $0A,$00,
$00
;------------------------
;Print Front Wall Routine
;------------------------
FRONTWALL DEV
          STY YTEMP
          LDA LENGTH,Y
          STA LEN
          LDA HORIZ,Y
          STA COLORS
          LDA MULTI,V
          TAX
          DEX
          STA YTEMP
          LDX YTEMP
          LDY #$00
F1        TYA
          STA ROWCRS
          INC ROWCRS
          INC ROWCRS
          INY
          INX
          STY YTMP
          STX XTMP
          LDA FLAG
          CMP #$C5
          BNE F1A
          LDA #$00
          JMP F1B
F1A       LDA PASS,X
F1B       STA TEMP
          LDY ROWCRS
          JSR PRINT
          LDY YTMP
          LDX XTMP
          CPY #$0A
          BNE F1
          DEC LEN
          LDA LEN
          BEQ LINE139
          INC COLORS
          LDX YTEMP
          LDY #$00
          JMP F1
;--------------------
;Main Display Routine
;---------------------
LINE139   JSR MOVE    ;Print Screen!
          LDA CENTER+1 ;Copy center.
          STA FRONT2
          LDA BACK    ;Copy back.
          STA BACK2
          LDA TIME
          CMP #$01    ;Is it night?
          BEQ CE      ;Yes...
          JSR POSITION ;No..Draw maze.
          LDX #S00
PL1CL1    LDA #0      ;Clear PMAREA
          STA PL1,X   ;[Player Maze
          INX         ;Position]
          BNE PL1CL1
          LDA H       ;Add Offset for
          CLC         ;Gr. $E to
          ADC #$91    ;player horiz
          STA HPOSP1  ;position!
          CLC
          LDA V       ;Add offset to
          CLC         ;vent position
          ADC #$4A    ;to plot on a
          TAY         ;Gr. $E screen.
          LDA ##$01
          STA PL1.Y   ;And store!
CE        LDX #$01

CE1       LDA DIRCHAR,X ;Let's clear
          SEC         ;the compass
          SBC #$80    ;arrows.
          LDY OFFSETT,X
          STA TIMSC,Y
          INX
          CPX #$05
          BNE CE1
CE2       LDY DIRECTION  ;Inverse the
          LDA DIRCHAR,Y  ;compass arrow
          LDX OFFSETT,Y  ;in the dirctn
          STA TIMSC,X ;player's facing
          LDA #$3E
          STA SDMCTL  ;Turn on screen.
;-------------------------
;Joystick/Movement Routine
;-------------------------
LINE140   JSR MVCHK   ;Patrol move.
          LDX H       ;Get Player's
          LDY V       ;coordinates.
          JSR START
          JSR COPCEN
          LDA STICK0
          CMP #$0F
          BEQ LINE140
          LDA STICK0
          CMP #$0E
          BNE LINE190
          LDA FRONT2
          CMP #$20
          BEQ LINE1401
          CMP #$45
          BEQ LINE1401
          CMP #$C5
          BNE LINE140A
          JMP ESCAPE
LIKE140A  JMP LINE1901
LINE1401  LDX DIRECTION
          DEX
          LDA WHICH,X
          TAY
          CLC
          LDA H,Y
          ADC TABLE,X
          STA H,Y
          JMP LINE275
LINE190   CMP #$0D
          BNE LINE230
          LDA BACK2
          CMP #$20
         
BEG LINE190A
          CMP #S45
          BEQ LINE190A
          CMP #$C5
          BNE LINE1901
          JMP ESCAPE
LINE1901  JSR THUMP
          JMP LINE140
LINE190A  LDX DIRECTION
          DEX
          LDA WHICH,X
          TAY
          CLC
          LDA H,Y
          ADC TABLE2,X
          STA H,Y
          JMP LINE275
LINE230   CMP #$08
          BNE LINE250
          JSR RAZZ
          INC DIRECTION
          LDA DIRECTION
          CMP #$05
          BNE LINE275
          LDA #$01
          STA DIRECTION
          JMP LINE275
LINE258   CMP #$07
          BEQ LINE260
          JMP LINE140
LINE260   JSR RAZZ
LINE265A  DEC DIRECTION
          LDA DIRECTION
          CMP #$00
          BNE LINE275
          LDA #$04
          STA DIRECTION
          JMP LINE275
LINE275   JSR PAUSE
          JMP MAINPROG
;-------------
;Delay Routine
;-------------

PAUSE     LDA #$00      ;Zero System
          STA RTCLOK    ;Timer.
P1        JSR MVCHK     ;Check for
          LDA RTCLOK    ;Patrol move and
          SEC           ;wait for timer
          SBC #$06      ;goes past 6.
          BCC P1
          RTS          ;Pause finished!
;--------------
;Set up display
;--------------
SETUP     LDA #$0D
          STA COLOR3
          LDA #$00     ;Background's
          STA COLOR2   ;black.
          STA MNUM
          LDA #$04
          STA COLOR0
          LDA #$90
          STA PCOLR0+1
          LDA #$02     ;Set P/M Prior.
          STA GPRIOR
          LDA # <DLIST ;Tell ANTIC
          STA SDLSTL   ;where the D/L
          LDA # >DLIST ;is.
          STA SDLSTL+1
          LDA # >DLI   ;Point System
          STA VD5LST+l ;to My DLI.
          LDA # <DLI
          STA VDSLST
          LDA #$C0     ;Allow for DLIs.
          STA NMIEN
          LDA #$03     ;Set players
          STA SIZEP2   ;2 d 3 to quad
          STA SIZEP3   ;size.
          LDA #$60     ;Set Player's
          STA HPOSP0+2 ;2&3 horiz
          LDA #$74     ;position.
          STA HPOSP0+3
          LDX #0
PL1CL     LDA #$00     ;Clear and init
         
STA PMG+$0400,X ;PMAREA.
          STA PMG+$0500,X
          LDA #$FF
          STA PMG+$0600,X
          STA PMG+$0700,X
          INX          ;Copy 255 Bytes.
          BNE PL1CL
          LDA #PMG/256 ;Store P/M
          STA PMBASE   ;Address.
          LDA #$02     ;Enable P/M
          STA GRACTL   ;Graphics
          RTS
;----------------------
;Main Game Display List
;----------------------
DLIST     .BYTE $70,$70,$F,$46
          .WORD TOP
          .BYTE $0C,$20,$02,$00,$02
          .BYTE $02,$30
          .BYTE $00,$4E
          .WORD DISP
          .BYTE $0E
          .BYTE $0E,$0E,$0E,$0E,$0E,$0E
          .BYTE $0E,$0E,$8E
          .BYTE $0E,$0E,$0E,$0E,$0E,$0E
          .BYTE $0E,$0E,$8E
          .BYTE $0E,$0E,$0E,$0E,$0E,$0E
          .BYTE $0E,$8E,$0E
          .BYTE
$0E,$0E,$0E,$0E,$8E,$0E
          .BYTE $0E,$0E,$8E
          .BYTE
$0E,$0E,$8E,$0E,$8E,$0E
          .BYTE $8E,$8E,$0E
          .BYTE
$0E,$8E,$0E,$8E,$0E,$0E
          .BYTE $0E,$8E,$0E
          .BYTE
$0E,$0E,$0E,$0E,$8E,$0E
          .BYTE $0E,$0E,$0E
          .BYTE
$0E,$0E,$0E,$8E,$0E,$0E
          .BYTE $0E,$0E,$0E
          .BYTE
$0E,$0E,$0E,$8E,$0E,$0E
          .BYTE $0E $0E,$0E
          .BYTE
$0E,$0E,$0E,$0E,$0E,$8E
          .BYTE $70,$42
TEXTB     .WORD $00
          .BYTE $02,$02,$02,$02,$02
          .BYTE $02,$41
          .WORD DLIST
;------------------------
;Check for patroller move
;------------------------
MVCHK     JSR $6700    ;Check for move.
          LDX #$FF
          LDA DIFLEV   ;Difficulty=O?
          BEQ MV25     ;Yes...
MV1       INX
          LDA H2,X     ;Check if there
          CMP H        ;are any patrols
          BNE MV2      ;occuping the
          LDA V2,X     ;same place
          CMP V        ;where the
          BEQ MV3      ;player is.
MV2       CPX DIFLEV   ;More patrols?
          BNE MV1      ;YA...
MV25      RTS
MV3       LDA # <CAPTXT ;Print Player
          STA TEXTB    ;capture text on
          LDA # >CAPTXT ;screen bottom
          STA TEXTB+1
          LDA #$45     ;Put patroler in
          STA CENTER2  ;front of player
          LDA #$00     ;Zero all audio.
          STA AUDF1
          JMP EX1      ;End routine
;-------------------------------
;Routine to Print to Graphics $E
;Adapted from Retrofire!
;-------------------------------
PRINT     LDA YPOS,Y
          STA LO       ;Save Y Position
          LDA #$00
          STA LO+1
          ASL LO       ;*16
          ROL LO+1
          ASL LO       ;*32
          ROL LO+1
          LDA LO
          CLC
          ADC # <SCREEN ;Add Display
          STA DESTLO   ;Start
          LDA LO+1
          ADC # >SCREEN
          STA DESTLO+1.
          ASL LO       ;*16
          ROL L0+1
          ASL LO       ;*32
          ROL LO+1
          LDA LO
          CLC
          ADC DESTLO   ;Get character's
          STA DESTLO   ;screen address
          LDA LO+1
          ADC DESTLO+1
          STA DESTLO+1
          LDA DESTLO   ;Add X Offset
          CLC          ;for final
          ADC COLCRS   ;address.
          ADC #$0C
         
STA DESTLO
          BCC NODHIN
          INC DESTLO+1
NODHIN    LDY TEMP     ;Get offset into
          LDA MULTB,Y  ;character set.
          STA LO
          LDA #$00
          STA LO+1
          STA COPCNT   ;Zero copy count
          CLC
          ADC # >CHARSET ;get info
          STA LO+1     ;from char set.
          LDA LO
          CLC
          ADC # <CHARSET
          STA LO
          BCC COPNUM
          INC LO+1
COPNUM    LDY COPCNT
          LDA (LO),Y  ;Get character
          LDY #$00    ;image byte.
          STA (DESTLO),Y ;To screen...
          INC COPCNT  ;Next char byte.
          LDA COPCNT  ;Are all 8 bytes
          CMP #$08    ;in char moved?
          BEG FINISH  ;Ya!
          LDA DESTLO  ;Add 20 bytes to
          CLC         ;point to next
          ADC #20     ;line on screen.
          STA DESTLO
          BCC COPNUM
          INC DESTLO+1
          BNE COPNUM
FINISH    RTS         ;All done!
YPOS      .BYTE $01,$05,$0D,$15,$1D
          .BYTE $25,$2D,$35,$3D,$45
          .BYTE $4D,$55
;----------------------
;Character Set for Maze
;----------------------
CHARSET
          .BYTE $00,$00,$00,$00,$00,$00
          .BYTE $00,$00
          .BYTE $FF,$8F,$FF,$F7,$FF,$FF
          .BYTE $DF,$FF
          .BYTE $FF,$7F,$3F,$1F,$0F,$07
          .BYTE $03,$01
          .BYTE $FF,$FE,$FE,$F8,$F0,$E0
          .BYTE $C0,$80
          .BYTE $01,$03,$07,$0F,$1F,$3F
          .BYTE $7F,$FF
          .BYTE $57,$FF,$D5,$D5,$D5,$FF
          .BYTE $57,$57
          .BYTE $80,$C0,$E0,$F0,$F8,$FC
          .BYTE $FE,$FF
          .BYTE $00,129,227,$FF,$FF,$C3
          .BYTE $81,$00
MULTI     .BYTE $00,$00,$16,$21,$2C
          .BYTE $37,$42
MULT8     .BYTE $00,$00,$10,$10,$20
          .BYTE $28,$30,$38,$40
;--------------
;Sound Routines
;--------------
THUMP     LDA #$46    ;Pitch for THUMP
          STA AUDF1
          LDA #$0F    ;THUMP volume.
          STA VOLUM1
          LDA #$00    ;THMP distortion
          STA TONE
          LDA STICK0  ;Load joystick
          STA OLDSTK  ;and save.
TH1       JSR MVCHK   ;Patrol move...
          LDA OLDSTK  ;Stick changed
          CMP STICK0  ;direction yet?
          BEQ TH1     ;No, check again
RAZZ      LDA #$00
    ;Patch for TURN
          STA AUDF1
          LDA #$00    ;Volume for TURN
          STA VOLUM1
          LDA #$20    ;TURN distortion
          STA TONE
          RTS
;-------------------------------
;Move newly drawn maze to screen
;-------------------------------
MOVE      LDA # <SCREEN ;MOVE source
          STA LO
          LDA # >SCREEN
          STA LO+1
          LDA # <DISP ;MOVE dstination
          STA DESTLO
          LDA # >DISP
          STA DESTLO+1
          LDA LO
          CLC
          ADC #$50
          STA LO
          BCC MB
          INC LO+1
MB        LDY #$0E
          LDA #$59
          STA TEMP
          LDX #$20
M0        LDA (LO),Y   ;Get FROM byte
          STA (DESTLO),Y  ;and MOVE it!
          INY
          CPY #$19     ;Line finished?
          BNE M0       ;No!
          LDY #$0E
          LDA LO       ;Point SOURCE to
          CLC          ;next line.
          ADC #$14
          STA LO
          BCC M1
          INC LO+1
M1        LDA DESTLO   ;Point DEST. to
          CLC          ;next line.
          ADC #$28
          STA DESTLO
          BCC M2
          INC DESTL0+1
M2        DEC TEMP
          LDA TEMP     ;Any lines left?
          CMP #$00     ;
          BNE M0       ;Yes,do it again
          RTS          ;Nope, done!
;---------------------------
;Clear Screen/Memory Routine
;---------------------------
CLSCN     LDA #$89     ;Start clearing
          STA LO+1     ;at $8900
          LDA #$00
          STA LO
LX2       LDY #$00
          LDA #$00     ;Erase BYTE
LX1       STA 1L0),Y
          INY
          CPY #$00
          BNE LX1
          INC LO+1
          LDA LO+1
          CMP #$A0     ;At $A000 yet?
          BNE LX2      ;No,more to copy
          RTS          ;Done!
POSITION  LDA H        ;Get X b Y cords
          STA PLOTX    ;and store them.
          LDA V
          STA PLOTY
          LDA #$02     ;Dark Grey color
          STA COLOR
          LDX #$00
          LDA #$10     ;Store screen
          STA MTEMP    ;address of maze
          LDA #$90     ;in MTEMP.
          STA MTEMP+1
          LDY DIRECTION
P01       STX XTMP
          LDA DIRECTION
          CMP #$01     ;The rest of
          DEC PLEFT    ;this routine
          CMP #$04     ;draws the maze
          DEC PLEFT    ;on the right
          TXA          ;of the screen.
          CLC
          ADC #$0A
          TAX
PLEFT     LDA LEFT,X
          CMP #$A0
          BNE P01A
          LDA DRAW2X,V
          TAX
          DEC PLOTX,X
          JSR PLOTCL
          INC PLOTX,X
P01A      LDX XTMP
          LDA DIRECTION
          CMP #$02
          BEQ PRIGHT
          CMP #$03
          BEQ PRIGHT
          TXA
          CLC
          ADC #$0A
          TAX
PRIGHT    LDA LEFT,X
          CMP #$A0
          BNE P01B
          LDA DRAW2X,Y
          TAX
          INC PLOTX,X
          J5R PLOTCL
          DEC PLOTX,X
P01B      LDX XTMP
          LDA CENTER,X
          CMP #$A0
          DEC P02
          CLC
          LDA DRAWX,Y
          TAX
          LDA PLOTX,X
          ADC DRAWY,Y
          STA PLOTX,X
          LDX XTMP
          INX
          CPX #$06
          BNE P01
          RTS
P02       JSR PLOTCL
          RTS
;-----------------------
;Plot Calculator
;Adapted from Retrofire!
;-----------------------
PLOTCL    PHA        ;Save accum.
          TXA        ;Save X register
          PHA
          TYA        ;Save Y Register
          PHA
          LDA PLOTY
          ASL A
          STA LO
          LDA #$00
          ROL A
          STA LO+1    ;*2
          ASL LO
          ROL LO+1    ;*4
          ASL LO
          LDA LO
          STA DESTLO
          ROL LO+1
          LDA LO+1
          STA DESTLO+1 ;*8
          ASL LO
          ROL LO+1     ;*16
          ASL LO
          ROL LO+1     ;*32
          LDA LO
          CLC
          ADC DESTLO
          STA LO
          LDA LO+1
          ADC DESTLO+1
          STA LO+1
          LDA MTEMP    ;Add the display
          CLC          ;address to get
          ADC #$0A     ;the actual
          CLC          ;address of the
          ADC LO       ;byte that will
          STA LO       ;be altered for
          LDA MTEMP+1  ;the plot.
          ADC LO+1
          STA LO+1
          LDA PLOTX    ;Mask PLOTX for
          AND #$03     ;plot index.
          TAX
          LDA PLOTX    ;Get PLOTX and
          LSR A        ;divide
          LSR A        ;by 4.
          CLC          ;Add to plot
          ADC LO       ;address for
          STA LO       ;final plot
          LDA L0+1     ;address.
          ADC #$00
          STA LO+1
          LDY COLOR    ;Get color
          LDA BMASK2,X ;and mask off
          AND COLRS,Y  ;pixel position.
          STA HOLD     ;Save it.
          LDA BMASK1,X ;Mask off pixel
          LDY #$00     ;of the address
          AND (LO),Y   ;to be altered.
          ORA MOLD     ;Set the plot
          STA (LO),Y   ;bits and store!
          PLA
          TAY          ;Restore Y Reg
          PLA
          TAX          ;Restore X Reg
          PLA          ;Restore accum
          RTS          ;Finished!
COLRS    .BYTE $00,$55,$AA,$FF
BMASK1   .BYTE $3F,$CF,$F3,$FC
BMASK2   .BYTE $C0,$30,$0C,$03
;---------------
;Screen Displays
;---------------
BOTTOM
         .SBYTE "     "
         .SBYTE "       Compass    "
         .SBYTE "  Time Elapsed  "
         .SBYTE "                  "
         .SBYTE "  0:00:00.00   "
         .SBYTE "         North    "
         .SBYTE "     "
         .SBYTE "         
       "
         .SBYTE "                  "
         .SBYTE "    West ← → East "
         .SBYTE "                  "
         .SBYTE "          ↓       "
         .SBYTE "                  "
         .SBYTE "        South     "
ESCTXT
         .SBYTE "    Congratulation"
         .SBYTE "S Pathfinder!!    "
         .SBYTE "                  "
         .SBYTE "                  "
         .SBYTE "  >You have escape"
         .SBYTE "d the Labyrinth<  "
         .SBYTE "                  "
         .SBYTE "                  "
         .SBYTE "      Your time wa"
         .SBYTE "s 0:00:00.00      "
         .SBYTE "                  "
         .SBYTE "                  "
         .SBYTE "     Press "
         .SBYTE " to Restart     "
CAPTXT
         .SBYTE "       You have be"
         .SBYTE "en captured       "
         .SBYTE "                  "
         .SBYTE "                  "
         .SBYTE "   You will be dis"
         .SBYTE "posed of at the   "
         .SBYTE "    next time conv"
         .SBYTE "ienent for you    "
         .SBYTE "      Your time wa"
         .SBYTE "s 0:00:00.80      "
         .SBYTE "                  "
         .SBYTE "                  "
         .SBYTE "     Press "
         .SBYTE " to Restart     "
DIRCHAR  .BYTE $00,$DC,$DE,$DD,$DF
OFFSETT  .BYTE $00,$45,$6C,$95,$6E
;---------------------
;Random Maze Generator
;---------------------
GENMZE   LDA MTEMP    ;This routine,
         STA LO       ;taken from a
         LDA MTEMP+1  ;BASIC routine,
         STA LO+1     ;generates a
         LDX #$00     ;
maze with only
L0       LDY #$00     ;
one correct
         LDA #$A0     ;path to the
MLOOP    STA (LO),Y   ;exit.
         INY
         CPY #$31
         BNE MLOOP
         LDA #$00
         STA (LO),Y
         CLC
         LDA LO
         ADC #$32
         STA LO
         BCC L2
         INC LO+1
L2       INX
         CPX #$23
         BNE L0
LINE20   LDA #$00
         STA DESTLO
LINE30   LDA MTEMP
         STA LO
         LDA MTEMP+1
         STA LO+1
         CLC
         LDA LO
         ADC #$35    ; Start gen here
         STA LO
         BCC LINE50
         INC LO+1
LINE50   LDY #$00
         LDA #$05
         STA (LO),Y
LXNE60   LDA RANDOM
         AND #$07
         STA J
         LDA J
         SEC
         SBC #$04
         BCS LINE60
LINE70   LDA J
         STA TEMP
LINE80   LDA LO
         STA DESTLO
         LDA LO+1
         STA DESTLO+1
         LDA J
         CMP #$00
         BNE LINE801
         CLC
         LDA DESTLO
         ADC #$02
         STA DESTLO
         BCC LINE90
         INC DESTLO+1
         JMP LINE90
LINE801  LDA J
         CMP #$01
         BNE LINE802
         SEC
         LDA DESTLO
         SBC #$64
         STA DESTLO
         BCS LINE90
         DEC DESTLO+1
         JMP LINE90
LINE802  LDA J
         CMP #$02
         BNE LINE803
         SEC
         LDA DESTLO
         SBC #$02
         STA DESTLO
         BCS LINE90
         DEC DESTLO+1
         JMP LINE90
LINE803  LDA J
         CMP #$03
         BNE LINE90
         CLC
         LDA DESTLO
        
ADC #$64
         STA DESTLO
         BCC LINE90
         INC DE5TLO+1
LINE90   LDY 13500
         LDA (DESTLO),Y
         CMP #$A0
         BNE LINE100
         LDA J
         CLC
         ADC #$01
         LDY #$00
         CMP #$00
         BNE LINE90A.
         LDA #$20
LINE90A  STA (DESTLO),Y
         JSR LINE200
         LDY #$00
         LDA #$20
         STA (LO),Y
         LDA DESTLO
         STA LO
         LDA DESTLO+1
         STA LO+1
         JMP LINE60
LINE100  LDA J
         CMP #$03
         BNE LINE101A
         LDA #$00
         STA J
         JMP LINE110
LINE101A INC J
LINE110  LDA J
         CMP TEMP
         BEQ LINE110A
         JMP LINE80
LINE110A LDY #$00
LINE120  LDA (LO),Y
         STA J
LINE130  LDA #$20
         STA (LO),Y
         LDA J
         SEC
         SBC #$05
         BCS LINE210
         DEC J
         LDX J
         LDA NEWJ,X
         STA J
         JSR LINE200
         JSR LINE200
         JMP LINE60
LINE200  LDA J
         CMP #$00
         BNE LINE2001
         CLC
         LDA LO
         ADC #$01
         STA LO
         BCC LINE210
         INC LO+1
         JMP LINE210
LINE2001 LDA J
         CMP #$01
         BNE LINE2002
         SEC
         LDA LO
         SBC #$32
         STA LO
         BCS LINE210
         DEC LO+1
         JMP LINE210
LINE2002 LDA J
         CMP #$02
         BNE LINE2003
         SEC
         LDA LO
         SBC #$01
         STA LO
         BCS LINE210
         DEC LO+1
         JMP LINE210
LINE2003 LDA J
         CMP #$03
         BNE LINE210
         CLC
         LDA LO
         ADC #$32
         STA LO
         BCC LINE210
         INC LO+l
LINE210  RTS
COPGEN   LDX #$00
COP2     LDA CENTER,X
         STA CENTER2,X
         INX
         CPX #$07
         BNE COP2
         RTS
;-------------------------
;Miscellaneous Data Tables
;-------------------------
NEWJ     .BYTE $02,$03,$00,$01
TABLE    .BYTE $FF,$FF,$01,$01
TABLE2   .BYTE $01,$01,$FF,$FF
WHICH    .BYTE $01,$00,$01,$00
DRAWY    .BYTE $00,$FF,$FF,$01,$01
DRAHX    .BYTE $00,$01,$00,$01,$00
DRAW2X   .BYTE $00,$00,$01,$001$01
YVAL     .BYTE $08,$07,$05,$04,$02
COMP     .BYTE $0A,$06,$0A,$06,$0A
HARGO    .BYTE $6E,$6E,$6E,$6E
         .BYTE $7A,$00
SARGO    .BYTE $03,$03,$03,$03,$00
BARGO    .BYTE $FF,$7E,$3C,$18,$18
ONARG    .BYTE $54 $5C,$64,$6C,$74
OFARG    .BYTE $9A,$92,$8A,$82,$7A
;------------------------------
;Escape from Maze/Death Routine
;------------------------------
ESCAPE   LDA # <ESCTXT ;Print
         STA TEXTS    ;"Escape from
         LDA # >ESCTXT ;Maze" text at
         STA TEXTS+1  ;screen bottom.
         STA DESTLO+1
EX1      LDA TEXTB+l
         STA DESTLO+1
         LDA TEXTB
         CLC         ;Point DESTLO to
         ADC #$84    ;proper place on
         STA DESTLO  ;screen to print
         BCC EX2     ;final time.
         INC DESTLO+1
EX2      LDX #$00
         LDA CENTER2 ;Check if player
         CMP #$45    ;is dead.
         BEG EX3     ;yep...
EX21     LDA #$FF    ;Turn of timer.
         STA FLAG
         LDA #$03    ;Quadruple Player
         STA SIZEP0  ;Width for
         STA SIZEP1  ;Players 0 & 1.
         JSR PLlCL
         LDX #$A6
         LDA #$FF    ;Display Players
EX25     INX         ;on bottom 1/3rd
         STA PMG+$0400,X ;of screen.
         STA PMG+$0500,X
         CPX #$E5
         BNE EX25
         LDA #$20    ;Display players
         STA HPOSPB  ;in left and
         LDA #$C0    ;right margin of
         STA HPOSP0+l ;the screen.
         LDX #$80
EM3      LDA SEC1,X  ;Print elapsed
         CLC         ;time, one
         ADC #$10    ;character at a
         LDY YVAL,X  ;time in proper
         STA (DESTLO),Y ;space at the
         INX         ;bottom of the
         CPX #$05    ;screen.
         BNE EX3
ES1      LDA CENTER2 ;Are Patroller &
         CMP #$45    ;player together?
         BEQ ES2     ;YES ... Captured!
         LDA RANDOM  ;Not Captured...
         STA COLPM0  ;Change PM Colors
         STA COLPM1  ;for Victory
         INC HOLD    ;display.
E52      LDA STRIG0  ;Trigger Pressed?
         CMP #$01
         BEQ ES1     ;Nope...
         JMP $6900   ;Yes ... Restart!
TOP
         .SBYTE "    labyrinths      "
         .SBYTE "                    "
         .SBYTE "    The Ultimate 3-D"
         .SBYTE " Maze  Adventure    "
         .SBYTE "     (C) 1987  Argo5"
         .SBYTE "oft Productions     "
         .5BYTE "                    "
         .SBYTE "                    "
MAZE     .DS $0400
         *=  $6700
;--------------------------
;Patroller Movement Routine
;--------------------------
         .LOCAL
?BEGIN   LDA CH      ;[ESC] pressed?
         CMP #$1C
         BNE BEG     ;Nope...
         JMP $6900   ;Yes...Restart!
BEG1     LDA CDTMV4  ;Timer counted
         CMP #$00    ;down to 0 yet?
         BEQ B15     ;Yes...
         JMP RET2    ;Nope...
B15      LDA #$10    ;Reset Timer.
         STA CDTMV4
         LDX MNUM
         LDA #$80    ;Erase patroller
         STA COLOR   ;position on maze
         JSR EDOT    ;drawing.
B2       LDA DIRECTION ;Save player
         STA DIRTMP  ;direction.
         LDA MNUM    ;Which patroller?
         LDA DIR2,X  ;Get its dirction
         STA DIRECTION ;and store it!
         LDA V2,X    ;Get "Y" Coord.
         TAY         ;and put it in Y.
         LDA H2,X    ;Get "X" Coord.
         TAX         ;and put it in X.
         LDA #$20    ;Put "Space" in
         STA PAT     ;patroller pos.
         JSR PUTPT   ;in memory maze.
         LDX MNUM    ;Which patroller?
         LDA V2,X    ;Transfer the
         TAY         ;"X" and "Y"
         LDA H2,X    ;coords again.
         TAX
         JSR START   ;Get local walls.
         LDX MNUM    ;Which patroller?
         LDA DIRTMP  ;Transfer temp.
         STA DIRECTION ;back to orig.
         LDA CENTER+1 ;Space in front
         CMP #$20    ;of patroller?
         BNE TURN    ;Nope. Turn
         JSR ?LINE1401 ;Ya. Staight.
RET      LDX MNUM    ;Get patroller 13.
         LDA #$03    ;White color for
         STA COLOR   ;plot.
         INC MNUM    ;Point next one.
         LDY MNUM    ;Check to see if
         DEY         ;all patrollers
         CPY DIFLEV  ;have moved.
         BEQ B15X    ;Yep...
         JSR EDOT    ;Nope. Replot.
         JMP B15     ;Next move...
B15X     LDA #$00    ;Reset patroller
         STA MNUM    ;number.
RET2     LDA #$45    ;Replot all
         STA PAT     ;patrollers
         LDX MNUM    ;in memory maze.
         CPX DIFLEV  ;All ploted?
         BEQ RET3    ;Yep...
         LDA V2,M    ;Get "X" coord
         TAY         ;and
         LDA H2,X    ;"Y" coordinate
         TAX         ;and
         JSR PUTPT   ;print in maze/
         INC MNUM
         CMP DIFLEV  ;All ploted?
         BNE RET2    ;Nope...
RET3     LDA #$00    ;Reset Patroller13
         STA MNUM
         RTS         ;Back to program!
TURN     LDA RANDOM  ;Get a random #.
         CLC
         ADC #$80    ;If number>128,
         BCC PTR     ;turn right.
PTL      LDA LEFT    ;Is there a wall
         CMP #$80    ;to the left?
         BEQ PTL1    ;Yep. Right turn.
         JMP TLEFT   ;Nope. Left turn.
PTL1     LDA RIGHT   ;Is there a wall
         CMP #$A0    ;to the right?
         BEQ RNDTURN ;Ya. Random turn.
         JMP TRIGHT  ;NO. Right turn.
PTR      LDA RIGHT   ;Is there a wall
         CMP #$A0    ;to the right?
         BEQ PTR1    ;Yep. Left turn.
         JMP TRIGHT  ;No. Right turn.
PTR1     LDA LEFT    ;Is there a wall
         CMP #$A0    ;to the left?
         BEQ RNDTURN ;Ya. Random turn.
         JMP TLEFT   ;No. Turn left.
RNDTURN  LDA RANDOM  ;Get Random #.
         CLC
         ADC #$80    ;If <128 then
         BCC TRIGHT  ;turn right.
TLEFT    LDA DIR2,M  ;Load current
         TAY         ;direction of
         LDA LTDIR,Y ;patroller and
         STA DIR2,X  ;change with
         JMP RET     ;new value.
LTDIR    .BYTE $00,$02,$03,$04,$01
TRIGHT   LDA DIR2,X  ;Load current
         TAY         ;direction of
         LDA RTDIR,Y ;patroller and
         STA DIR2,X  ;change with
         JMP RET     ;new value.
RTDIR    .BYTE $00,$04,$01,$02,$03
EDOT     LDA H2,X    ;Get "X" and "Y"
         STA PLOTX   ;coords from
         LDA V2,X    ;patroller.
         STA PLOTY
         LDA #$10    ;Set MTEMP to
         STA MTEMP   ;point to maze
         LDA #$90    ;on screen
         STA MTEMP+1
         LDA TIME    ;What time is it?
         CMP #$00    ;Daytime?
         BNE ED01    ;Nope...
         JSR PLOTCL  ;Yes, plot point.
ED01     RTS
?LINE1401 LDX MNUM   ;Patroller 13.
         LDA DIR2,X  ;Find direction
         TAX         ;its moving.
         DEX
         LDA ?WHICH,X ;Add to Horiz
         CLC         ;or vert.
         ADC MNUM    ;Offset to
         TAY         ;proper
         CLC         ;patroller #.
         LDA H2,Y    ;Add or Subtrct
         ADC ?TABLE,X ;from horiz or
         STA H2,Y    ;vert.
         RTS
?TABLE   .BYTE $FF,$FF,$01,$01
?WHICH   .BYTE $07,$08,$07,$00
SPOS     .BYTE $14,$30,$30,$02,$30
         .BYTE ""
         .BYTE $l4,$22,$02,$14,$l4
         .BYTE ""
         .BYTE $04,$04,$04,$01,$04
         .BYTE ""
PUTPT    LDA # <MAZE  ;Copy Maze
         STA MTEMP    ;address to
         LDA # >MAZE  ;MTEMP
         STA MTEMP+1
?50      DEY          ;Decrease "Y"
         CPY #$00     ;until zero to
         BEQ ?51      ;find Vert pos.
         LDA #$32     ;Add maze width.
         JSR ADD
         JMP ?50
?51      TXA          ;Add horiz Val.
         J5R ADD
         LDY #$00
         LDA PAT      ;Store
         STA (MTEMP),Y ;plot/erase
         RTS          ;here.
;------------------------------
Title-Page-and-Option-Selection
;------------------------------
         *= $6900
         LDA #$40     ;Disable DLIs.
         STA NMIEN
         LDA #$00     ;Turn off Screen
         STA DMACTL
         STA AUDCl    ;and sounds.
         LDX #$00
         STX SIZEP0   ;Zero P/M sizes.
         STX S1ZEP1
SUB3     STA CENTER2,X ;Erase
         INX          ;CENTER2.
         CPX #$06
         BNE SUB3
         STX HPOSP0   ;Position PM0 &
         STX HPOSP1   ;PM1 off screen.
         LDX #$00
SUB4     LDA SPOS,X   ;Reset
         STA H2,X     ;Patrollers'
         INX          ;starting
         CPX #$14     ;positions.
         BNE SUB4
         LDA #$FF     ;Turn off timer.
         STA FLAG
         LDA #$00     ;Zero Dummy and
         STA DUMMY    ;pointer
         STA POINTER
         JMP ?DLINIT  ;Init.
;--------------
;Title Page DLI
;--------------
?DLI     PHA          ;Save Accumulator
         TXA
         PHA          ;Save X register
         TYA
         PHA          ;Save Y register
         LDA POINTER  ;Which DLI?
         CMP #$00
         BNE ?DLOOP2
         LDX #S90
?DLOOP1  STX COLPF0   ;Shade line
         INX          ;in 16 shades
         STA WSYNC    ;of blue
         CPX #$9F
         BNE ?DLOOP1
         JMP ?DRTS
?DLOOP2  CMP #$01     ;2nd DLI?
         BEQ ?DLOOP25
         CMP #$02     ;3rd DLI?
         BNE ?DLOOP5
?DLOOP25 LDX #$00     ;2nd DLI...
?DLOOP3  STX COLPF0   ;Shade
         INX          ;in 8 colors
         INX          ;Of grey.
         STA WSYNC
         CPX #$10
         BNE ?DLOOP3
         JMP ?DRTS
?DLOOP5  LDY DUMMY    ;Change colors
         LDA ?COLORS,Y ;on bottom
         STA COLPF2   ;of titles.
         INC DUMMY
         LDA DUMMY    ;All colors
         CMP #$06     ;displayed?
         BNE ?DRTS    ;nope..
         LDA #$00     ;Set color pntr
         STA DUMMY    ;to start color.
?DRTS    INC POINTER
         LDA POINTER  ;All DLI$
         CMP #$09     ;done?
         BNE ?DR1     ;Nope...
         LDA #$00     ;Set pointer
         STA POINTER  ;to 1st DLI.
?DR1     PLA          ;Restore Y Reg
         TAY
         PLA          ;Restore X Reg
         TAX
         PLA          ;Restore A
         RTI
;-------------------------
;Title Page Initialization
;-------------------------
?DLINIT  LDA #?DLIST&255 ;Set D/L
         STA SDLSTL   ;address to
         LDA #?DLIST/256 ;pointer.
         STA SDLSTL+1
         LDA #?DLI&255 ;Set DLI
         STA VDSLST   ;address
         LDA #?DLI/256 ;to pointer.
         STA VDSLST+1
         LDA #$C0     ;Enable DLIs.
         STA NMIEN
         LDA #$00
         STA COLOR2   ;Black Background
         LDA #$22     ;Turn on Screen
         STA SDMCTL   ;Display.
         LDA TIME     ;Load time and
         JMP E4       ;print it.
PLV      LDY DIFLEV   ;Load dificulty
         LDX #$00     ;level.
         LDA POINT,Y  ;Get offset
         TAY          ;pointer.
PLV1     LDA LEVELS,Y ;Get Character
         CMP #$5B     ;My EOL Char?
         BEQ END      ;Ya...
         STA PRINTl,X ;Nope print
         INY          ;character.
         INX          ;Inc POINTERS.
         JMP PLV1     ;Print next.
END      LDA DIFLEV
         CLC          ;Print level #
         ADC #$10     ;in proper spot
         STA PRINT2   ;of screen.
         LDA CONSOL
         CMP #$05     ;SELECT pressd?
         BNE END1
         LDA #$01     ;Yes ... Set    flag
         STA HOLD
         JMP E3       ;Beep!
END1     CMP #$03    
;OPTION pressd?
         BEQ E3      
;Beep!
         CMP #$06    
;START Pressed?
         BNE END      :nope...
         LDA #$00     ;Zero last key
         STA CH       ;pressed and
         LDA #$00     ;flags.
         STA FLAG
         STA HOLD
         JMP $7800    ;Main program!
E3       LDA #$30
         STA AUDF1    ;Frequency
         LDA #$0F     ;Store volume
         STA CDTMV3   ;in timer.
E1       LDA CDTMV3   ;Add an offset
         CLC          ;to timer for
         ADC #$A0     ;note volume.
         STA AUDC1
         CMP #$A0
         BNE El
         STA AUDC1
         LDA HOLD     ;SELECT pressed?
         CMP #$00
         BEQ E5       ;Nope...
         LDA #$00
         STA HOLD
         INC TIME     ;Toggle between
         LDA TIME     ;Day and Night
         CMP #$02     ;TIME=0 ; Daytime
         BNE E4       ;TIME=1 ; Night
         LDA #$00
         STA TIME
E4       TAY
         LDX #$00
         LDA TPOINT,V ;Get offset for
         TAY          ;Time Print
PLV3     LDA TPRINT,Y ;Print until
         CMP #$5B     ;My EOL
         BNE PLV4
         JMP PLV
PLV4     STA PRINT3,X
         INY
         INX
         JMP PLV3
E5       INC DIFLEV   ;Increase
         LDA DIFLEV   ;difficulty
         CMP #$07     ;level (0-6)
         BEQ PLV5
         JMP PLV      ;and print it.
PLV5     LDA #$00
         STA DIFLEV
         JMP PLV
;-----------------------
;Title Page Display List
;-----------------------
?DLIST   .BYTE $70,$70,$70
         .BYTE $42
         .WORD TEXT
         .BYTE $02,$F0,$07,$00,$F0
         .BYTE $06,$80,$06
         .BYTE $70,$2,$70,$02,$70,$02
         .BYTE S70,SF0,$08,$82,$00,$82
         .BYTE $70,$70,$82,$00,$02,$00
         .BYTE $82,$00,$41
         .WORD ?DLIST
;-----------------------------
;Title Page and Selection Data
;-----------------------------
TEXT
         .SBYTE "     Argo5oft Softwa"
         .SBYTE "re Productions      "
         .SBYTE "            Proudly "
         .SBYTE "Presents            "
         .SBYTE "     LABYRIN"
         .SBYTE "THS       THE ULTIMA"
         .SBYTE "TE 3-D     MAZE ADVE"
         .SBYTE "NTURE            A.N"
         .SBYTE ".A.L.O.G.  Computing"
         .SBYTE "              Progra"
         .S8YTE "mined By Steven Lash"
         .SBYTE "lower"
         .SBYTE "      (C) 1987 ArgoS"
         .SBYTE "oft Software Product"
         .SBYTE "ions"
         .SBYTE "     Number of Argon"
         .SBYTE "ian Patrollers->0"
         .SBYTE "       You Will Atte"
         .SBYTE "mpt A          "
         .SBYTE "Escape"
         .SBYTE "     Diffic"
         .SBYTE "ulty Level -        "
         .SBYTE "     Daytim"
         .SBYTE "e or Nightime "
         .SBYTE "Escape "
         .SBYTE "    Enter t"
         .SBYTE "he Labyrinth        "
         .SBYTE "  "
?COLORS  .BYTE $C2,$B2,$A2,$92
         .BYTE $82,$00
LEVELS   .SBYTE "BeginnerEasy    "
         .SBYTE "MOderateHard    T"
         .SBYTE "rivialSadisticInsa"
         .SBYTE "ne "
POINT    .BYTE $00,$09,$l2,$lB
         .BYTE $24,$2C,$35
TPRINT   .SBYTE "Daylight"
         .SBYTE "Nightime"
TPOINT   .BYTE $00,$09
         *= $02E0
         .WORD $6900