A.N.A.L.O.G. ISSUE 71 / APRIL 1989 / PAGE 16

Krazy Mazes

by Barry Kolbe

You and another adventurer are searching for the lost gold mines of Mazeaton. The mines are located in the midst of a large maze, well-protected by ghostly guardians. To reach the cache of gold, both of you must race through identical mazes while being hunted down by the guardians of the treasure. If you should happen to touch one of the guardians, you will be zapped back to the beginning of the maze. Whoever arrives at the end of the maze first receives 100 gold coins. This achievement also allows both of you to enter the middle maze where 277 gold pieces are kept—collect as much as you can. After this you must leave the maze city by racing through another maze like the first one. The victor (or Victoria) again receives 100 gold coins.

After the third maze your accumulated wealth is displayed and immediately phoned into the IRS. Pressing Start permits you to play again and add to your riches. Option resets your bank to zero. Unfortunately, this will not deceive the IRS in the least. While you are mazing, press Select to abort the game and return to this screen.

Typing It In

Krazy Mazes is an all-machine-language game and must be typed in using the M/L Editor found elsewhere in this issue. Load and run the game by using the Binary Load option for your DOS.

Author’s Notes

I have always been intrigued with mazes. I think it started with the Atari 2600 game called Maze Craze where two players raced through the same maze. The maze was small because of the large images on the screen (like GRAPHICS 2). Krazy Mazes is done in GRAPHICS 5 and ANTIC Mode 5. These were chosen for their colors, size and visibility. The randomly generated maze is formed in memory and then copied to either the GRAPHICS 5 or ANTIC 5 screen.

Most people who make maze games use one of two possible maze generators. They often start the maze generation in the upper left-hand corner and these mazes tend to be quite simple as there is usually only one path from beginning to end. I suggest starting the generation from the center as it makes for more interesting mazes.

Anyway, don’t get lost in the mazes!

Barry Kolbe and his wife, Linda, live in the country with their children, Philip and Audra. The household uses time-sharing because the Atari 800 and the Nintendo Entertainment System are hooked up to the same TV.

Listing 1: M/L Editor Data

1000 DATA 255,255,0,48,51,60,32,85,59,169,0,133,179,169,16,162,4818
1010 DATA 2,157,222,58,157,242,58,202,16,247,169,80,141,244,2,32,7707
1020 DATA 174,53,169,7,162,55,160,27,32,92,228,169,0,133,180,32,5129
1030 DATA 200,54,32,51,54,169,0,133,156,169,128,133,157,169,2,133,6649
1040 DATA 181,169,1,133,179,32,39,59,32,92,48,32,88,58,169,0,537
1050 DATA 141,47,2,32,108,55,32,88,58,32,92,48,32,88,58,76,9381
1060 DATA 3,48,169,0,141,47,2,32,143,50,32,132,52,32,168,50,1090
1070 DATA 32,16,51,32,41,52,169,40,141,196,2,169,202,141,197,2,6301
1080 DATA 169,148,141,198,2,32,56,50,32,200,54,32,51,54,169,2,1006
1090 DATA 133,181,169,1,133,179,133,180,169,69,141,48,2,169,50,141,5942
1100 DATA 49,2,169,62,141,47,2,165,152,133,168,165,154,133,169,169,9858
1110 DATA 1,133,176,169,0,133,177,169,152,133,178,32,199,51,169,3,6894
1120 DATA 133,176,165,153,133,168,165,155,133,169,169,0,133,177,169,155,748
1130 DATA 133,178,32,199,51,169,0,133,156,169,128,133,157,173,120,2,7237
1140 DATA 201,15,208,3,76,119,49,201,7,208,25,165,152,201,79,240,9265
1150 DATA 103,32,169,52,176,98,32,85,49,230,152,32,112,49,32,132,3935
1160 DATA 50,76,82,49,201,11,208,25,165,152,201,1,240,74,32,178,7243
1170 DATA 52,176,69,32,85,49,198,152,32,112,49,32,132,50,76,82,2429
1180 DATA 49,201,14,208,25,165,154,201,1,240,45,32,186,52,176,40,6020
1190 DATA 32,85,49,198,154,32,112,49,32,132,50,76,82,49,201,13,2514
1200 DATA 208,22,165,154,201,21,240,16,32,195,52,176,11,32,85,49,3074
1210 DATA 230,154,32,112,49,32,132,50,76,119,49,169,0,133,176,165,5636
1220 DATA 152,133,168,165,154,133,169,169,0,133,177,169,152,133,178,141,974
1230 DATA 30,208,32,199,51,96,169,1,133,176,76,89,49,173,121,2,4357
1240 DATA 201,15,240,98,201,7,208,25,165,153,201,79,240,88,32,32,6804
1250 DATA 53,176,83,32,13,50,230,153,32,37,50,32,132,50,76,224,3963
1260 DATA 49,201,11,208,19,165,153,201,1,240,59,32,41,53,176,54,4561
1270 DATA 32,13,50,198,153,76,146,49,201,14,208,19,165,155,201,1,6716
1280 DATA 240,36,32,50,53,176,31,32,13,50,198,155,76,146,49,201,5320
1290 DATA 13,208,19,165,155,201,21,240,13,32,60,53,176,8,32,13,1305
1300 DATA 50,230,155,76,146,49,32,103,53,176,39,141,30,208,32,219,6295
1310 DATA 54,165,156,201,218,144,3,32,51,54,165,157,201,218,144,3,7768
1320 DATA 32,238,53,173,31,208,201,5,208,5,104,104,76,3,48,76,2809
1330 DATA 215,48,96,165,153,133,168,165,155,133,169,169,0,133,177,169,481
1340 DATA 155,133,178,169,0,133,176,32,199,51,96,165,153,133,168,165,9605
1350 DATA 155,133,169,169,3,133,176,141,30,208,32,199,51,96,169,1,5775
1360 DATA 133,152,133,153,169,11,133,154,133,155,96,112,112,112,74,0,5163
1370 DATA 152,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,2872
1380 DATA 10,10,10,10,10,10,10,70,168,58,74,0,155,10,10,10,7591
1390 DATA 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,2750
1400 DATA 10,10,10,65,69,50,169,254,208,2,169,255,133,20,165,20,7195
1410 DATA 208,252,133,77,96,169,0,133,144,169,144,133,145,162,7,160,8371
1420 DATA 0,169,0,145,144,136,208,251,230,145,202,16,242,96,169,0,297
1430 DATA 133,144,169,144,133,145,162,22,160,12,169,128,145,144,200,192,707
1440 DATA 65,208,249,165,144,24,105,80,133,144,165,145,105,0,133,145,7439
1450 DATA 202,16,229,169,0,24,105,32,133,144,169,144,105,3,133,145,6128
1460 DATA 162,2,160,0,169,128,145,144,200,192,79,208,249,165,144,24,1062
1470 DATA 105,80,133,144,165,145,105,0,133,145,202,16,229,96,169,125,9057
1480 DATA 133,144,169,145,133,145,162,15,189,183,51,149,186,202,16,248,1111
1490 DATA 169,6,133,175,208,22,169,133,133,144,169,147,133,145,162,15,8878
1500 DATA 189,167,51,149,186,202,16,248,169,128,133,175,169,5,160,0,8041
1510 DATA 145,144,173,10,210,41,3,133,170,133,171,165,170,10,170,165,9144
1520 DATA 144,24,117,186,133,148,165,145,117,187,133,149,177,148,197,175,2977
1530 DATA 208,38,165,170,10,170,165,144,24,117,194,133,146,165,145,117,9737
1540 DATA 195,133,147,169,0,145,146,230,170,165,170,145,148,165,148,133,2222
1550 DATA 144,165,149,133,145,76,44,51,230,170,165,170,41,3,133,170,7815
1560 DATA 197,171,208,183,160,0,177,144,133,170,169,0,145,144,165,170,498
1570 DATA 201,5,208,1,96,230,170,165,170,41,3,10,170,24,165,144,6197
1580 DATA 117,186,133,144,165,145,117,187,133,145,76,44,51,2,0,96,3292
1590 DATA 255,254,255,160,0,1,0,176,255,255,255,80,0,2,0,176,6626
1600 DATA 255,254,255,80,0,1,0,216,255,255,255,40,0,165,169,10,8317
1610 DATA 133,150,169,0,42,133,151,6,150,38,151,165,150,133,165,165,8961
1620 DATA 151,133,166,6,150,38,151,6,150,38,151,165,150,24,101,165,6454
1630 DATA 133,150,165,151,101,166,133,151,165,177,24,101,150,133,150,165,235
1640 DATA 178,101,151,133,151,165,168,41,3,170,165,168,74,74,24,101,5786
1650 DATA 150,133,144,165,151,105,0,133,145,164,176,189,165,52,57,157,8996
1660 DATA 52,133,165,189,161,52,160,0,49,144,5,165,145,144,96,169,7427
1670 DATA 0,133,174,133,168,169,2,133,176,169,0,133,177,169,152,133,9867
1680 DATA 178,169,0,133,148,169,144,133,149,160,0,177,148,240,9,132,9150
1690 DATA 168,165,174,133,169,32,199,51,230,168,164,168,192,80,208,235,4146
1700 DATA 230,174,165,174,201,23,240,16,165,148,24,105,80,133,148,165,8671
1710 DATA 149,105,0,133,149,76,67,52,160,0,185,0,152,153,0,155,4760
1720 DATA 185,0,153,153,0,156,200,208,241,96,169,152,133,145,169,0,82
1730 DATA 133,144,162,2,160,0,169,0,145,144,200,208,251,230,145,202,3959
1740 DATA 16,242,96,0,85,170,255,63,207,243,252,192,48,12,3,165,9108
1750 DATA 154,166,152,232,32,204,52,96,165,154,166,152,202,76,174,52,9943
1760 DATA 166,154,202,138,166,152,76,174,52,166,154,232,138,166,152,76,1278
1770 DATA 174,52,10,133,165,169,0,42,133,166,160,2,6,165,38,166,5040
1780 DATA 136,16,249,165,165,133,150,165,166,133,151,160,1,6,165,38,6933
1790 DATA 166,136,16,249,165,165,24,101,150,133,150,165,166,101,151,133,338
1800 DATA 151,169,0,24,101,150,133,146,169,144,101,151,133,147,138,24,8014
1810 DATA 101,146,133,146,165,147,105,0,133,147,160,0,177,146,201,128,9463
1820 DATA 208,2,56,96,24,96,165,155,166,153,232,32,204,52,96,165,9095
1830 DATA 155,166,153,202,32,204,52,96,166,155,202,138,166,153,32,204,1066
1840 DATA 52,96,166,155,232,138,166,153,32,204,52,96,112,112,112,68,7420
1850 DATA 0,144,4,4,4,4,4,4,4,4,4,4,4,4,4,4,2670
1860 DATA 4,4,4,4,4,4,4,70,189,58,65,70,53,165,152,201,4863
1870 DATA 77,240,8,165,153,201,77,240,10,24,96,238,222,58,32,21,6297
1880 DATA 60,56,96,238,242,58,32,26,60,56,96,32,143,50,169,0,2916
1890 DATA 133,144,169,144,133,145,162,20,160,0,169,6,145,144,200,192,9567
1900 DATA 39,208,249,165,144,24,105,40,133,144,165,145,105,0,133,145,7553
1910 DATA 202,16,229,96,169,62,141,47,2,169,1,141,111,2,169,102,4844
1920 DATA 141,192,2,169,38,141,193,2,169,14,141,194,2,141,195,2,6027
1930 DATA 169,0,141,0,208,141,1,208,141,2,208,169,1,141,8,208,7119
1940 DATA 141,9,208,141,10,208,141,11,208,169,3,141,29,208,169,136,8947
1950 DATA 141,7,212,96,32,144,54,173,10,210,41,31,24,105,71,133,3899
1960 DATA 164,162,0,168,189,167,54,153,0,141,153,100,141,200,153,0,7890
1970 DATA 141,153,100,141,200,232,224,12,208,234,164,164,169,20,153,4,157
1980 DATA 143,153,5,143,153,104,143,153,105,143,169,28,153,10,143,153,7922
1990 DATA 11,143,153,110,143,153,111,143,96,32,121,54,173,10,210,41,6098
2000 DATA 31,24,105,32,133,163,162,0,164,163,189,167,54,153,0,140,7572
2010 DATA 153,100,140,200,153,0,140,153,100,140,200,232,224,12,208,234,3780
2020 DATA 169,20,164,163,153,4,142,153,5,142,153,104,142,153,105,142,8611
2030 DATA 169,28,153,10,142,153,11,142,153,110,142,153,111,142,96,162,8933
2040 DATA 23,169,0,164,163,153,0,140,153,0,142,153,100,140,153,100,7840
2050 DATA 142,200,202,16,240,96,162,23,169,0,164,164,153,0,141,153,8201
2060 DATA 100,141,153,0,143,153,100,143,200,202,16,240,96,28,62,107,7536
2070 DATA 127,127,99,127,127,127,127,218,0,230,156,230,157,165,156,141,3009
2080 DATA 0,208,141,2,208,165,157,141,1,208,141,3,208,96,162,0,7338
2090 DATA 138,157,0,140,157,0,141,157,0,142,157,0,143,232,208,241,1360
2100 DATA 96,173,4,208,133,158,41,1,240,15,32,85,49,169,1,133,4122
2110 DATA 152,169,11,133,154,32,112,49,96,165,158,41,4,240,15,32,4196
2120 DATA 13,50,169,1,133,153,169,11,133,155,32,37,50,96,173,5,3810
2130 DATA 208,133,158,41,1,240,3,76,228,54,165,158,41,4,208,223,8896
2140 DATA 96,165,179,208,10,169,0,141,0,210,141,1,210,240,64,32,7352
2150 DATA 179,54,230,167,165,167,41,3,170,134,167,189,160,58,141,192,987
2160 DATA 2,189,164,58,141,193,2,165,180,240,3,32,219,54,198,181,367
2170 DATA 165,181,208,27,238,34,59,173,34,59,41,3,141,34,59,170,3917
2180 DATA 169,2,133,181,189,35,59,141,0,210,169,166,141,1,210,76,8336
2190 DATA 98,228,169,70,141,48,2,169,53,141,49,2,32,123,58,169,4052
2200 DATA 148,141,196,2,169,246,141,197,2,169,68,141,198,2,32,133,7468
2210 DATA 53,32,248,50,32,154,55,169,62,141,47,2,32,223,55,96,4500
2220 DATA 169,0,133,144,169,144,133,145,169,0,133,159,133,160,162,18,8743
2230 DATA 165,144,24,105,40,133,144,165,145,105,0,133,145,160,1,177,7424
2240 DATA 144,208,12,169,7,145,144,230,159,165,159,208,2,230,160,200,3437
2250 DATA 192,38,208,235,202,16,217,165,159,56,233,2,133,159,165,160,1595
2260 DATA 233,0,133,160,96,169,1,133,152,169,10,133,154,32,93,57,5618
2270 DATA 169,37,133,153,169,10,133,155,32,107,57,169,0,162,3,149,5310
2280 DATA 182,202,16,251,162,2,169,16,157,199,58,157,205,58,202,16,8739
2290 DATA 247,32,93,57,173,120,2,201,15,240,86,201,7,208,22,32,6053
2300 DATA 242,56,176,77,32,192,57,32,66,57,230,152,32,93,57,32,4060
2310 DATA 128,50,76,107,56,201,11,208,16,32,6,57,176,51,32,192,4189
2320 DATA 57,32,66,57,198,152,76,38,56,201,14,208,16,32,14,57,2547
2330 DATA 176,31,32,192,57,32,66,57,198,154,76,38,56,201,13,208,6506
2340 DATA 16,32,23,57,176,11,32,192,57,32,66,57,230,154,76,38,4560
2350 DATA 56,32,107,57,173,121,2,201,15,240,86,201,7,208,22,32,5970
2360 DATA 32,57,176,77,32,12,58,32,80,57,230,153,32,107,57,32,3173
2370 DATA 128,50,76,203,56,201,11,208,16,32,40,57,176,51,32,12,2127
2380 DATA 58,32,80,57,198,153,76,134,56,201,14,208,16,32,48,57,3934
2390 DATA 176,31,32,12,58,32,80,57,198,155,76,134,56,201,13,208,7111
2400 DATA 16,32,57,57,176,11,32,12,58,32,80,57,230,155,76,134,4995
2410 DATA 56,165,182,24,101,184,133,161,165,183,101,185,133,162,197,160,3424
2420 DATA 208,7,165,161,197,159,208,1,96,173,31,208,201,5,208,5,8498
2430 DATA 104,104,76,3,48,76,11,56,165,154,166,152,232,32,121,57,7069
2440 DATA 160,0,177,146,201,6,240,2,24,96,56,96,165,154,166,152,8619
2450 DATA 202,76,247,56,164,154,136,152,166,152,76,247,56,164,154,200,3029
2460 DATA 152,166,152,76,247,56,165,155,166,153,232,76,247,56,165,155,3108
2470 DATA 166,153,202,76,247,56,164,155,136,152,166,153,76,247,56,164,2127
2480 DATA 155,200,152,166,153,76,247,56,165,154,166,152,32,121,57,160,9753
2490 DATA 0,169,0,145,146,96,165,155,166,153,32,121,57,160,0,152,7350
2500 DATA 145,146,96,165,154,166,152,32,121,57,160,0,169,8,145,146,7210
2510 DATA 96,165,155,166,153,32,121,57,160,0,169,9,145,146,96,10,5261
2520 DATA 133,165,169,0,42,133,166,6,165,38,166,6,165,38,166,165,7278
2530 DATA 165,133,150,165,166,133,151,6,165,38,166,6,165,38,166,165,8374
2540 DATA 165,24,101,150,133,150,165,166,101,151,133,151,169,0,24,101,7571
2550 DATA 150,133,146,169,144,101,151,133,147,138,24,101,146,133,146,165,296
2560 DATA 147,105,0,133,147,96,201,7,240,1,96,32,15,59,230,182,7216
2570 DATA 208,2,230,183,162,2,254,199,58,189,199,58,201,26,144,17,9102
2580 DATA 169,16,157,199,58,202,48,9,254,199,58,189,199,58,76,214,1103
2590 DATA 57,32,253,59,162,2,254,222,58,189,222,58,201,26,144,17,9041
2600 DATA 169,16,157,222,58,202,48,9,254,222,58,189,222,58,76,246,2256
2610 DATA 57,96,201,7,240,1,96,32,15,59,230,184,208,2,230,185,229
2620 DATA 162,2,254,205,58,189,205,58,201,26,144,17,169,16,157,205,9604
2630 DATA 58,202,48,9,254,205,58,189,205,58,76,34,58,32,31,60,3986
2640 DATA 162,2,254,242,58,189,242,58,201,26,144,17,169,16,157,242,623
2650 DATA 58,202,48,9,254,242,58,189,242,58,76,66,58,96,169,136,9127
2660 DATA 141,48,2,169,58,141,49,2,32,123,58,173,132,2,208,6,4266
2670 DATA 173,132,2,240,251,96,173,133,2,208,240,173,133,2,240,251,4366
2680 DATA 96,169,0,133,179,162,3,157,0,208,202,16,250,96,112,112,9350
2690 DATA 112,112,112,112,71,210,58,112,112,112,71,230,58,112,112,112,8190
2700 DATA 71,250,58,65,136,58,68,68,74,74,36,36,42,42,0,0,9121
2710 DATA 0,0,235,114,33,250,121,128,173,161,186,165,179,0,0,0,6927
2720 DATA 0,0,0,0,115,99,111,114,101,115,0,17,26,16,16,16,8899
2730 DATA 0,18,26,16,16,16,0,0,0,0,0,51,35,47,50,37,6151
2740 DATA 0,17,26,0,16,16,16,0,0,0,0,0,0,0,0,51,3956
2750 DATA 35,47,50,37,0,18,26,0,16,16,16,0,0,0,0,0,3947
2760 DATA 0,0,0,0,240,242,229,243,243,128,230,233,242,229,0,0,4104
2770 DATA 0,0,0,0,0,169,23,141,0,210,162,170,142,1,210,32,6517
2780 DATA 132,50,169,0,141,1,210,96,0,132,0,143,0,169,99,141,5611
2790 DATA 48,2,169,59,141,49,2,165,156,201,218,144,3,32,51,54,5574
2800 DATA 165,157,201,218,144,3,32,238,53,173,31,208,201,6,208,1,8497
2810 DATA 96,201,3,208,226,32,85,59,76,49,59,169,16,162,4,157,5437
2820 DATA 237,59,157,247,59,202,16,247,96,112,112,112,112,71,133,59,8178
2830 DATA 7,112,112,70,173,59,112,112,112,112,70,193,59,112,70,213,8583
2840 DATA 59,112,112,112,112,70,233,59,65,99,59,0,0,0,0,114,1038
2850 DATA 0,0,0,186,0,0,0,0,0,0,0,0,0,0,0,0,3594
2860 DATA 0,43,0,0,0,225,0,0,0,121,0,0,237,225,250,229,9151
2870 DATA 243,0,0,0,0,0,162,185,128,162,161,178,178,185,128,171,1966
2880 DATA 175,172,162,165,0,0,0,0,0,0,115,116,97,114,116,0,1799
2890 DATA 0,0,0,112,108,97,121,0,0,0,0,0,0,0,111,112,8764
2900 DATA 116,105,111,110,0,0,0,115,99,111,114,101,115,0,0,0,881
2910 DATA 17,26,0,16,16,16,16,16,0,0,18,26,0,16,16,16,4689
2920 DATA 16,16,0,162,4,254,237,59,189,237,59,201,26,144,11,169,9646
2930 DATA 16,157,237,59,202,16,238,189,237,59,96,162,2,76,255,59,73
2940 DATA 162,2,76,33,60,162,4,254,247,59,189,247,59,201,26,144,929
2950 DATA 8,169,16,157,247,59,202,16,238,96,0,80,255,81,0,0,5614
2960 DATA 0,0,0,0,0,0,56,56,56,56,56,0,56,0,102,102,9370
2970 DATA 102,0,0,0,0,0,0,102,255,102,102,255,102,0,24,62,4063
2980 DATA 96,60,6,124,24,0,0,102,108,24,48,102,70,0,223,253,5913
2990 DATA 223,253,223,253,223,253,0,40,170,190,190,170,40,0,0,40,7073
3000 DATA 0,105,40,40,65,65,0,20,0,150,20,20,130,130,0,102,1467
3010 DATA 60,255,60,102,0,0,0,24,24,126,24,24,0,0,0,0,6388
3020 DATA 0,0,0,24,24,48,0,0,0,126,0,0,0,0,0,0,4784
3030 DATA 0,0,0,24,24,0,0,6,12,24,48,96,64,0,124,206,1310
3040 DATA 198,198,198,230,124,0,56,56,24,24,24,24,24,0,124,230,3468
3050 DATA 12,24,48,96,254,0,126,12,24,12,6,102,60,0,12,28,8920
3060 DATA 60,108,204,254,12,0,126,96,124,6,6,102,60,0,124,198,4948
3070 DATA 192,252,206,230,124,0,126,6,12,24,48,48,48,0,124,206,4086
3080 DATA 230,124,206,230,124,0,124,206,198,230,126,12,24,48,0,56,5724
3090 DATA 56,0,0,56,56,0,0,0,24,24,0,24,24,48,6,12,5660
3100 DATA 24,48,24,12,6,0,0,0,126,0,0,126,0,0,96,48,8224
3110 DATA 24,12,24,48,96,0,60,102,102,12,24,0,24,0,0,60,7712
3120 DATA 102,110,110,96,62,0,120,156,60,54,62,102,102,195,238,115,9006
3130 DATA 99,99,110,99,99,222,60,102,204,192,192,192,230,124,238,115,5524
3140 DATA 99,99,99,99,99,222,254,102,96,120,96,99,102,124,254,102,1363
3150 DATA 96,120,96,96,96,96,60,102,198,192,222,198,102,60,198,198,3274
3160 DATA 198,206,254,230,198,198,48,24,24,24,24,24,24,12,30,12,288
3170 DATA 12,12,12,28,56,96,198,108,108,120,120,108,108,198,224,96,320
3180 DATA 96,96,96,102,126,120,198,238,254,214,198,198,198,198,198,198,9268
3190 DATA 230,246,222,206,198,198,124,206,198,198,198,198,230,124,124,102,6630
3200 DATA 102,102,108,96,96,192,124,230,198,198,198,198,206,127,238,115,6736
3210 DATA 102,108,102,102,99,195,58,102,96,60,6,6,102,92,254,48,5923
3220 DATA 96,192,192,194,198,124,230,102,102,102,102,102,110,63,195,102,365
3230 DATA 102,102,102,102,60,24,195,195,195,211,203,223,119,98,195,195,5357
3240 DATA 102,60,60,102,195,195,195,102,102,60,24,24,24,24,126,198,6152
3250 DATA 12,24,254,96,195,254,0,30,24,24,24,24,30,0,0,64,9617
3260 DATA 96,48,24,12,6,0,0,120,24,24,24,24,120,0,0,8,7258
3270 DATA 28,54,99,0,0,0,0,0,0,0,0,0,255,0,226,2,440
3280 DATA 227,2,0,48,0,0,0,0,0,0,0,0,0,0,0,0,3703

Listing 2: Assembly

;SAVE#D:KRAZYMZE.M65
;5-28-88 9:00 P.M.
;
	.OPT	NOLIST
	*=	$90
LO	.DS	1
HI	.DS	1
I	.DS	2
J	.DS	2
ML	.DS	1
MH	.DS	1
;
D1X	.DS	1
D2X	.DS	1
D1Y	.DS	1
D2Y	.DS	1
GX	.DS	1
GX1	.DS	1
COLS	.DS	1
GOLD	.DS	2
TOTL	.DS	2
P0YP	.DS	1
P1YP	.DS	1
LHD	.DS	1
HHD	.DS	1
GCNT	.DS	1
PX	.DS	1
PY	.DS	1
XHD	.DS	1
JHD	.DS	1
HS1	.DS	1
HS2	.DS	1
LINES	.DS	1
MZNUM	.DS	1
COLOR	.DS	1
WSCN	.DS	2	;gr5 a or b
VFLG	.DS	1
TFLG	.DS	1
TIM	.DS	1
SCR1	.DS	2
SCR2	.DS	2
TB1	.DS	8
TB2	.DS	8
	.OPT	LIST
	.OPT	NOLIST
;
RANDOM	=	$D20A
HPOSP0	=	$D000
HPOSP1	=	$D001
HITCLR	=	$D01E
MYSET	=	$5000
;
PMB	=	$8800
PLR0	=	$8C00
PLR1	=	$8D00
PLR2	=	$8E00
PLR3	=	$8F00
MAZE0	=	$9000
GR5A	=	$9800
GR5B	=	$9B00
;
	*=	$3000
BEGIN	JSR	ZHSC	;0 scores
START	LDA	#0
	STA	VFLG	;vbi flag
	LDA	#$10
	LDX	#2	;set final
FSLP	STA	FSC1,X	;scores
	STA	FSC2,X
	DEX
	BPL	FSLP
	LDA	#>MYSET	;chr set
	STA	756
	JSR	SETPMG	;PMG setup
	LDA	#7	;install vbi
	LDX	#>VBI
	LDY	#<VBI
	JSR	$E45C
	LDA	#0
	STA	TFLG	;title flag
	JSR	CLPLRS	;clear plyrs
	JSR	DEFP0	;define p0
	LDA	#0
	STA	GX	;set ghost
	LDA	#$80	;positions
	STA	GX1
	LDA	#2
	STA	TIM	;timer
	LDA	#1
	STA	VFLG	;turn on vbi
	JSR	INTRO	;what it says
	JSR	GAME1	;play 1st game
	JSR	NTRMSS	;intermission
	LDA	#0
	STA	$022F	;screen off
	JSR	GAME2	;middle game
	JSR	NTRMSS
	JSR	GAME1	;1st again
	JSR	NTRMSS
	JMP	START	;do again
;
GAME1	LDA	#0
	STA	$022F
	JSR	CLR0	;clear maze
	JSR	CLRGR5	;clear gr5
	JSR	PRPMZE	;prepare maze
	JSR	GENMZ5	;generate it
	JSR	COPYTO5	;to gr 5
	LDA	#$28	;colors
	STA	$02C4
	LDA	#$CA
	STA	$02C5
	LDA	#$94
	STA	$02C6
	JSR	SETUP	;set up screen
	JSR	CLPLRS	;clear & define
	JSR	DEFP0
	LDA	#2
	STA	TIM	;ghost timer
	LDA	#1
	STA	VFLG	;vbi flags
	STA	TFLG
	LDA	#<DL5	;gr5 dlist
	STA	$0230
	LDA	#>DL5
	STA	$0231
	LDA	#62	;screen on
	STA	$022F
	LDA	D1X	;dot positions
	STA	PX
	LDA	D1Y
	STA	PY
	LDA	#1	;plot color
	STA	COLOR
	LDA	#<GR5A	;top half
	STA	WSCN
	LDA	#>GR5A
	STA	WSCN+1
	JSR	PLOT5
	LDA	#3	;plot color
	STA	COLOR
	LDA	D2X	;dot pos
	STA	PX
	LDA	D2Y
	STA	PY
	LDA	#<GR5B	;bottom half
	STA	WSCN
	LDA	#>GR5B
	STA	WSCN+1
	JSR	PLOT5
	LDA	#0	;ghosties again
	STA	GX
	LDA	#$80
	STA	GX1
;
;move 1st dot,then 2nd
;
STC1	LDA	632	;stick 0
	CMP	#$0F
	BNE	ST1
	JMP	STC2
ST1	CMP	#7	;right?
	BNE	TRL
	LDA	D1X
	CMP	#79
	BEQ	PJ1
	JSR	LOKR	;look right
	BCS	PJ1
	JSR	ERSD1	;erase dot
	INC	D1X
	JSR	SHWD1	;plot it in
	JSR	WAIT	;new position
	JMP	PJ1
TRL	CMP	#11	;left?
	BNE	TRU
	LDA	D1X
	CMP	#1
	BEQ	PJ1
	JSR	LOKL
	BCS	PJ1
	JSR	ERSD1
	DEC	D1X
	JSR	SHWD1
	JSR	WAIT
	JMP	PJ1
TRU	CMP	#14
	BNE	TRD
	LDA	D1Y
	CMP	#1
	BEQ	PJ1
	JSR	LOKU
	BCS	PJ1
	JSR	ERSD1
	DEC	D1Y
	JSR	SHWD1
	JSR	WAIT
	JMP	PJ1
TRD	CMP	#13
	BNE	PJ1
	LDA	D1Y
	CMP	#21
	BEQ	PJ1
	JSR	LOKD
	BCS	PJ1
	JSR	ERSD1
	INC	D1Y
	JSR	SHWD1
	JSR	WAIT
PJ1	JMP	STC2
;
;erase top dot
;
ERSD1	LDA	#0
	STA	COLOR
SED1	LDA	D1X
	STA	PX
	LDA	D1Y
	STA	PY
	LDA	#<GR5A
	STA	WSCN
	LDA	#>GR5A
	STA	WSCN+1
	STA	HITCLR
	JSR	PLOT5
	RTS
;
;plot top dot
;
SHWD1	LDA	#1
	STA	COLOR
	JMP	SED1
;
;move the 2nd dot
;
STC2	LDA	$0279	;stick 1
	CMP	#$0F
	BEQ	PSJ
	CMP	#7	;left
	BNE	T2L
	LDA	D2X
	CMP	#79
	BEQ	PSJ
	JSR	L2R	;look right
	BCS	PSJ
	JSR	ERSD2	;erase dot
	INC	D2X
L2L	JSR	SHWD2	;plot dot
	JSR	WAIT
	JMP	PSJ
T2L	CMP	#11
	BNE	T2U
	LDA	D2X
	CMP	#1
	BEQ	PSJ
	JSR	L2F
	BCS	PSJ
	JSR	ERSD2
	DEC	D2X
	JMP	L2L
T2U	CMP	#14
	BNE	T2D
	LDA	D2Y
	CMP	#1
	BEQ	PSJ
	JSR	L2U
	BCS	PSJ
	JSR	ERSD2
	DEC	D2Y
	JMP	L2L
T2D	CMP	#13
	BNE	PSJ
	LDA	D2Y
	CMP	#21
	BEQ	PSJ
	JSR	L2D
	BCS	PSJ
	JSR	ERSD2
	INC	D2Y
	JMP	L2L
;
;is there a winner
;
PSJ	JSR	WINER?
	BCS	NXGME
	STA	HITCLR
	JSR	CHKCOL
;
	LDA	GX	;reset ghosts
	CMP	#$DA
	BCC	FOK
	JSR	DEFP0
FOK	LDA	GX1
	CMP	#$DA
	BCC	SOK
	JSR	DEFP1
SOK	LDA	53279	;chk for
	CMP	#5	;select
	BNE	SSK
	PLA
	PLA
	JMP	START
SSK	JMP	STC1
;
NXGME	RTS		;someone won
;
;erase bottom dot
;
ERSD2	LDA	D2X
	STA	PX
	LDA	D2Y
	STA	PY
	LDA	#<GR5B
	STA	WSCN
	LDA	#>GR5B
	STA	WSCN+1
	LDA	#0
	STA	COLOR
	JSR	PLOT5
	RTS
;
;plot bottom dot
;
SHWD2	LDA	D2X
	STA	PX
	LDA	D2Y
	STA	PY
	LDA	#3
	STA	COLOR
	STA	HITCLR
	JSR	PLOT5
	RTS
;
;setup dots
;
SETUP	LDA	#1
	STA	D1X
	STA	D2X
	LDA	#11
	STA	D1Y
	STA	D2Y
	RTS
;
;display list for gr 5
;
DL5	.BYTE	$70,$70,$70,$4A
	.WORD	GR5A
	.BYTE	$0A,$0A,$0A,$0A,$0A
	.BYTE	$0A,$0A,$0A,$0A,$0A
	.BYTE	$0A,$0A,$0A,$0A,$0A
	.BYTE	$0A,$0A,$0A,$0A,$0A
	.BYTE	$0A,$0A,$46
	.WORD	TITLE
	.BYTE	$4A
	.WORD	GR5B
	.BYTE	$0A,$0A,$0A,$0A,$0A
	.BYTE	$0A,$0A,$0A,$0A,$0A
	.BYTE	$0A,$0A,$0A,$0A,$0A
	.BYTE	$0A,$0A,$0A,$0A,$0A
	.BYTE	$0A,$0A,$41
	.WORD	DL5
;
WAITL	LDA	#$FE
	BNE	WT1
WAIT	LDA	#$FF
WT1	STA	$14
WLP	LDA	$14
	BNE	WLP
	STA	77
	RTS
;
;clear maze
;
CLR0	LDA	#<MAZE0
	STA	LO
	LDA	#>MAZE0
	STA	HI
C03	LDX	#7	;7.5 pages
C02	LDY	#0
	LDA	#0
C01	STA	(LO),Y
	DEY
	BNE	C01
	INC	HI
	DEX
	BPL	C02
	RTS
;
;prepare maze for generation
;
PRPMZE	LDA	#<MAZE0
	STA	LO
	LDA	#>MAZE0
	STA	HI
	LDX	#22	;23 lines
PR2	LDY	#12
	LDA	#$80
PR1	STA	(LO),Y
	INY
	CPY	#65
	BNE	PR1
	LDA	LO
	CLC
	ADC	#80
	STA	LO
	LDA	HI
	ADC	#0
	STA	HI
	DEX
	BPL	PR2
	LDA	#<MAZE0
	CLC
	ADC	#<800
	STA	LO
	LDA	#>MAZE0
	ADC	#>800
	STA	HI
	LDX	#2	;3 lines
TUN	LDY	#0
	LDA	#$80
TUP	STA	(LO),Y
	INY
	CPY	#79
	BNE	TUP
	LDA	LO
	CLC
	ADC	#80
	STA	LO
	LDA	HI
	ADC	#0
	STA	HI
	DEX
	BPL	TUN
	RTS
;
;generate the middle maze
;in Antic mode 4
;
GENMZ4	LDA	#<[MAZE0+381]
	STA	LO
	LDA	#>[MAZE0+381]
	STA	HI
	LDX	#15
MVU	LDA	TB41,X
	STA	TB1,X
	DEX
	BPL	MVU
	LDA	#6
	STA	MZNUM
	BNE	SMZ
;
;generate a maze for gr. 5
;
GENMZ5	LDA	#<[MAZE0+901]
	STA	LO
	LDA	#>[MAZE0+901]
	STA	HI
	LDX	#15
MVT	LDA	TB51,X
	STA	TB1,X
	DEX
	BPL	MVT
	LDA	#$80
	STA	MZNUM
;
;the maze generation is
;is done here
;
SMZ	LDA	#5
	LDY	#0
	STA	(LO),Y	;start of maze
GN1	LDA	RANDOM	;get rand direct
	AND	#3	;0-3
	STA	XHD	;save it
	STA	JHD	;twice
GN3	LDA	XHD	;get direct
	ASL	A	;x 2
	TAX		;0=rt, 1= up
	LDA	LO	;2=lft, 3=dn
	CLC		;find new pos
	ADC	TB1,X	;2 away from
	STA	J	;where we are
	LDA	HI
	ADC	TB1+1,X
	STA	J+1
	LDA	(J),Y	;what's there
	CMP	MZNUM	;a wall?
	BNE	GN2	;no
	LDA	XHD	;yes so erase
	ASL	A	;it
	TAX
	LDA	LO
	CLC
	ADC	TB2,X	;get inbetween
	STA	I	;location
	LDA	HI
	ADC	TB2+1,X
	STA	I+1
	LDA	#0	;zero it
	STA	(I),Y
	INC	XHD	;store next
	LDA	XHD	;direction
	STA	(J),Y	;in new spot
	LDA	J	;reset current
	STA	LO	;location to
	LDA	J+1	;new pos
	STA	HI
	JMP	GN1	;again
GN2	INC	XHD	;try next
	LDA	XHD	;direction
	AND	#3
	STA	XHD	;if same as
	CMP	JHD	;old-go back
	BNE	GN3	;try this direct
	LDY	#0	;going back
	LDA	(LO),Y
	STA	XHD
	LDA	#0
	STA	(LO),Y
	LDA	XHD	;have we come
	CMP	#5	;back to begin?
	BNE	GN4	;no
	RTS		;yes-done!
GN4	INC	XHD	;try next direct
	LDA	XHD	;and see if it
	AND	#3	;will work
	ASL	A
	TAX
	CLC
	LDA	LO
	ADC	TB1,X
	STA	LO
	LDA	HI
	ADC	TB1+1,X
	STA	HI
	JMP	GN1
;
;tables to got rt,lf,up,dn
;for gr5 and antic 5
;
TB51	.BYTE	2,0,96,255
	.BYTE	254,255,160,0
TB52	.BYTE	1,0,176,255
	.BYTE	255,255,80,0
TB41	.BYTE	2,0,176,255
	.BYTE	254,255,80,0
TB42	.BYTE	1,0,216,255
	.BYTE	255,255,40,0
;
;plot routine for gr. 5
;
PLOT5	LDA	PY
	ASL	A
	STA	ML
	LDA	#0
	ROL	A
	STA	MH
	ASL	ML
	ROL	MH	;X4
	LDA	ML
	STA	LHD
	LDA	MH
	STA	HHD
	ASL	ML
	ROL	MH	;X8
	ASL	ML
	ROL	MH	;X16
	LDA	ML
	CLC
	ADC	LHD
	STA	ML
	LDA	MH
	ADC	HHD
	STA	MH
	LDA	WSCN
	CLC
	ADC	ML
	STA	ML
	LDA	WSCN+1
	ADC	MH
	STA	MH
	LDA	PX
	AND	#3
	TAX
	LDA	PX
	LSR	A
	LSR	A
	CLC
	ADC	ML
	STA	LO
	LDA	MH
	ADC	#0
	STA	HI
	LDY	COLOR
	LDA	BMASK2,X
	AND	COLORS,Y
	STA	LHD
	LDA	BMASK1,X
	LDY	#0
	AND	(LO),Y
	ORA	LHD
	STA	(LO),Y
	RTS
;
;copy maze to gr5 screen
;
COPYTO5	LDA	#0	;24 lines
	STA	LINES
	STA	PX	;reset px
	LDA	#2
	STA	COLOR
	LDA	#<GR5A
	STA	WSCN
	LDA	#>GR5A
	STA	WSCN+1
	LDA	#<MAZE0
	STA	J
	LDA	#>MAZE0
	STA	J+1
NLN	LDY	#0
NXY	LDA	(J),Y
	BEQ	NEXB
	STY	PX
	LDA	LINES
	STA	PY
	JSR	PLOT5
NEXB	INC	PX
	LDY	PX
	CPY	#80
	BNE	NXY
	INC	LINES
	LDA	LINES
	CMP	#23
	BEQ	CDON
	LDA	J
	CLC
	ADC	#80
	STA	J
	LDA	J+1
	ADC	#0
	STA	J+1
	JMP	NLN
CDON	LDY	#0
MAB	LDA	GR5A,Y
	STA	GR5B,Y
	LDA	GR5A+$0100,Y
	STA	GR5B+$0100,Y
	INY
	BNE	MAB
	RTS
;
;clear out gr5 screen memry
;
CLRGR5	LDA	#>GR5A
	STA	HI
	LDA	#<GR5A
	STA	LO
	LDX	#2
L5A	LDY	#0
	LDA	#0
L5	STA	(LO),Y
	INY
	BNE	L5
	INC	HI
	DEX
	BPL	L5A
	RTS
;
COLORS	.BYTE	$00,$55,$AA,$FF
BMASK1	.BYTE	$3F,$CF,$F3,$FC
BMASK2	.BYTE	$C0,$30,$0C,$03
;
;look for walls
;to see if movement
;is ok
;
LOKR	LDA	D1Y
	LDX	D1X
	INX
LLL	JSR	MUL80
	RTS
;
LOKL	LDA	D1Y
	LDX	D1X
	DEX
	JMP	LLL
LOKU	LDX	D1Y
	DEX
	TXA
	LDX	D1X
	JMP	LLL
;
LOKD	LDX	D1Y
	INX
	TXA
	LDX	D1X
	JMP	LLL
;
;multiply by 80 for gr5 screen
;
MUL80	ASL	A
	STA	LHD	;x2
	LDA	#0
	ROL	A
	STA	HHD
	LDY	#2
M8A	ASL	LHD
	ROL	HHD	;x16
	DEY
	BPL	M8A
	LDA	LHD
	STA	ML
	LDA	HHD
	STA	MH
	LDY	#1
M8B	ASL	LHD
	ROL	HHD	;x64
	DEY
	BPL	M8B
	LDA	LHD	;16+64=X80
	CLC
	ADC	ML
	STA	ML
	LDA	HHD
	ADC	MH
	STA	MH
	LDA	#<MAZE0
	CLC
	ADC	ML
	STA	I
	LDA	#>MAZE0
	ADC	MH
	STA	I+1
	TXA
	CLC
	ADC	I
	STA	I
	LDA	I+1
	ADC	#0
	STA	I+1
	LDY	#0
	LDA	(I),Y
	CMP	#$80
	BNE	LOK
	SEC
	RTS
LOK	CLC
	RTS
;
;look routines for 2nd player
;
L2R	LDA	D2Y
	LDX	D2X
	INX
	JSR	MUL80
	RTS
;
L2F	LDA	D2Y
	LDX	D2X
	DEX
	JSR	MUL80
	RTS
;
L2U	LDX	D2Y
	DEX
	TXA
	LDX	D2X
	JSR	MUL80
	RTS
;
L2D	LDX	D2Y
	INX
	TXA
	LDX	D2X
	JSR	MUL80
	RTS
;
;display list for antic 4 scrn
;
DL4	.BYTE	$70,$70,$70,$44
	.WORD	MAZE0
	.BYTE	$04,$04,$04,$04,$04
	.BYTE	$04,$04,$04,$04,$04
	.BYTE	$04,$04,$04,$04,$04
	.BYTE	$04,$04,$04,$04,$04
	.BYTE	$04,$46
	.WORD	SCRTXT
	.BYTE	$41
	.WORD	DL4
;
;see if there's a winner
;add 100 to winner's score
;
WINER?	LDA	D1X
	CMP	#77
	BEQ	MZ1
	LDA	D2X
	CMP	#77
	BEQ	MZ2
	CLC
	RTS
MZ1	INC	FSC1
	JSR	AHUN1
	SEC
	RTS
MZ2	INC	FSC2
	JSR	AHUN2
	SEC
	RTS
;
;set up for middle maze
;
PRPMID	JSR	CLR0
	LDA	#<MAZE0
	STA	LO
	LDA	#>MAZE0
	STA	HI
	LDX	#20
PMA	LDY	#0
	LDA	#6
PMC	STA	(LO),Y
	INY
	CPY	#39
	BNE	PMC
	LDA	LO
	CLC
	ADC	#40
	STA	LO
	LDA	HI
	ADC	#0
	STA	HI
	DEX
	BPL	PMA
	RTS
;
;setup player graphics
;
SETPMG	LDA	#62	;single line res
	STA	$022F
	LDA	#1
	STA	$026F
	LDA	#$66	;colors
	STA	$02C0
	LDA	#$26
	STA	$02C1
	LDA	#$0E
	STA	$02C2
	STA	$02C3
	LDA	#0
	STA	HPOSP0
	STA	HPOSP1
	STA	HPOSP0+2
	LDA	#1	;width
	STA	$D008
	STA	$D009
	STA	$D00A
	STA	$D00B
	LDA	#3
	STA	$D01D
	LDA	#>PMB
	STA	$D407
	RTS
;
;put player at random vertical
;position on screen within
;a certain range
;
DEFP1	JSR	CLRP1	;does bottom
	LDA	RANDOM	;ghost
	AND	#$1F
	CLC
	ADC	#$47
	STA	P1YP
	LDX	#0
	TAY
P1L	LDA	PDF1,X
	STA	PLR1,Y
	STA	PLR1+$64,Y
	INY
	STA	PLR1,Y
	STA	PLR1+$64,Y
	INY
	INX
	CPX	#12
	BNE	P1L
	LDY	P1YP
	LDA	#$14
	STA	PLR3+4,Y
	STA	PLR3+5,Y
	STA	PLR3+$68,Y
	STA	PLR3+$69,Y
	LDA	#$1C
	STA	PLR3+$0A,Y
	STA	PLR3+$0B,Y
	STA	PLR3+$6E,Y
	STA	PLR3+$6F,Y
	RTS
;
;place top ghost on screen
;
DEFP0	JSR	CLRP0
	LDA	RANDOM
	AND	#$1F
	CLC
	ADC	#$20
	STA	P0YP
	LDX	#0
	LDY	P0YP
P0L	LDA	PDF1,X
	STA	PLR0,Y
	STA	PLR0+$64,Y
	INY
	STA	PLR0,Y
	STA	PLR0+$64,Y
	INY
	INX
	CPX	#12
	BNE	P0L
	LDA	#$14
	LDY	P0YP
	STA	PLR2+4,Y
	STA	PLR2+5,Y
	STA	PLR2+$68,Y
	STA	PLR2+$69,Y
	LDA	#$1C
	STA	PLR2+$0A,Y
	STA	PLR2+$0B,Y
	STA	PLR2+$6E,Y
	STA	PLR2+$6F,Y
	RTS
;
;erase players 0 & 2
;
CLRP0	LDX	#23
	LDA	#0
	LDY	P0YP
C0L	STA	PLR0,Y
	STA	PLR2,Y
	STA	PLR0+$64,Y
	STA	PLR2+$64,Y
	INY
	DEX
	BPL	C0L
	RTS
;
;erase players 1 & 3
;
CLRP1	LDX	#23
	LDA	#0
	LDY	P1YP
C1L	STA	PLR1,Y
	STA	PLR1+$64,Y
	STA	PLR3,Y
	STA	PLR3+$64,Y
	INY
	DEX
	BPL	C1L
	RTS
;
;the ghosties
;
PDF1	.BYTE	$1C,$3E,$6B,$7F
	.BYTE	$7F,$63,$7F,$7F
	.BYTE	$7F,$7F,$DA,$00
;
;move the ghosts
;
MGHOST	INC	GX
	INC	GX1
	LDA	GX
	STA	HPOSP0
	STA	HPOSP0+2
	LDA	GX1
	STA	HPOSP1
	STA	HPOSP1+2
	RTS
;
;clear out all plyrs
;
CLPLRS	LDX	#0
	TXA
CP1	STA	PLR0,X
	STA	PLR1,X
	STA	PLR2,X
	STA	PLR3,X
	INX
	BNE	CP1
	RTS
;
;chekc for collisions
;send anyone hit back to
;beginning of maze
;
CHKCOL	LDA	$D004
	STA	COLS
	AND	#1
	BEQ	KB
FIR	JSR	ERSD1
	LDA	#1
	STA	D1X
	LDA	#11
	STA	D1Y
	JSR	SHWD1
	RTS
KB	LDA	COLS
	AND	#4
	BEQ	TRP1
SCD	JSR	ERSD2
	LDA	#1
	STA	D2X
	LDA	#11
	STA	D2Y
	JSR	SHWD2
	RTS
;
TRP1	LDA	$D005
	STA	COLS
	AND	#1
	BEQ	KC
	JMP	FIR
KC	LDA	COLS
	AND	#4
	BNE	SCD
	RTS
;
;the vertical blank interrupt
;make some sounds,move the
;ghosts, & change their
;luminance
;
VBI	LDA	VFLG	;off or
	BNE	VVV	;on
	LDA	#0	;no sound
	STA	$D200
	STA	$D201
	BEQ	NOV
VVV	JSR	MGHOST
	INC	GCNT
	LDA	GCNT	;for luminance
	AND	#3	;changes in
	TAX		;color
	STX	GCNT
	LDA	VP1,X
	STA	$02C0
	LDA	VP2,X
	STA	$02C1
	LDA	TFLG	;title flag
	BEQ	NOCHK	;don't chk for
	JSR	CHKCOL	;collisions
;
NOCHK	DEC	TIM	;on title
	LDA	TIM	;screen
	BNE	NOV
	INC	NTX
	LDA	NTX
	AND	#3	;play notes
	STA	NTX
	TAX
	LDA	#2
	STA	TIM
	LDA	NOTE,X
	STA	$D200
	LDA	#$A6
	STA	$D201
NOV	JMP	$E462	;xit
;
;the middle maze
;
GAME2	LDA	#<DL4	;new
	STA	$0230	;display list
	LDA	#>DL4
	STA	$0231
	JSR	STOPAL	;no ghosts
	LDA	#$94	;screen colrs
	STA	$02C4
	LDA	#$F6
	STA	$02C5
	LDA	#$44
	STA	$02C6
	JSR	PRPMID	;prepare middle
	JSR	GENMZ4	;maze & generate
	JSR	PUTGLD	;fill w/gold
	LDA	#62
	STA	$022F	;screen on
	JSR	COLLECT	;go for gold!
	RTS
;
;fill the maze with gold
;
PUTGLD	LDA	#<MAZE0
	STA	LO
	LDA	#>MAZE0
	STA	HI
	LDA	#0
	STA	GOLD
	STA	GOLD+1
	LDX	#18
GLL	LDA	LO
	CLC
	ADC	#40
	STA	LO
	LDA	HI
	ADC	#0
	STA	HI
	LDY	#1
GLP	LDA	(LO),Y
	BNE	GNY
	LDA	#7	;gold
	STA	(LO),Y
	INC	GOLD
	LDA	GOLD
	BNE	GNY
	INC	GOLD+1
GNY	INY
	CPY	#38
	BNE	GLP
	DEX
	BPL	GLL
	LDA	GOLD
	SEC
	SBC	#2
	STA	GOLD
	LDA	GOLD+1
	SBC	#0
	STA	GOLD+1
	RTS
;
;here's where we fight over
;the gold coins
;
COLLECT	LDA	#1	;staring pos.
	STA	D1X
	LDA	#10
	STA	D1Y
	JSR	MCH1	;show man
	LDA	#37	;2nd man
	STA	D2X
	LDA	#10
	STA	D2Y
	JSR	MCH2	;show him
	LDA	#0	;zero scores
	LDX	#3
SCC	STA	SCR1,X
	DEX
	BPL	SCC
	LDX	#2	;screen scores
	LDA	#$10
SCF	STA	SCRTXT+10,X
	STA	SCRTXT+16,X
	DEX
	BPL	SCF
;
CS1	JSR	MCH1	;show 1st man
	LDA	$0278	;stick 0
	CMP	#$0F
	BEQ	CS2
	CMP	#7
	BNE	CTL	;move right?
	JSR	CLR	;chk 4 wall,etc
	BCS	CS2
	JSR	CHGLD1	;chk for gold
	JSR	PCHR1
	INC	D1X
CGEN	JSR	MCH1	;show move
	JSR	WAITL	;delay
	JMP	CS2	;plyr 2
;
CTL	CMP	#11	;left?
	BNE	CTU
	JSR	CLF
	BCS	CS2
	JSR	CHGLD1
	JSR	PCHR1
	DEC	D1X
	JMP	CGEN
;
CTU	CMP	#14	;up
	BNE	CTD
	JSR	CLU
	BCS	CS2
	JSR	CHGLD1
	JSR	PCHR1
	DEC	D1Y
	JMP	CGEN
CTD	CMP	#13	;down?
	BNE	CS2
	JSR	CLD
	BCS	CS2
	JSR	CHGLD1
	JSR	PCHR1
	INC	D1Y
	JMP	CGEN
;
CS2	JSR	MCH2	;repeat for
	LDA	$0279	;2nd palyr
	CMP	#$0F
	BEQ	MWIN
	CMP	#7
	BNE	ELF
	JSR	C2R
	BCS	MWIN
	JSR	CHGLD2
	JSR	PCH2
	INC	D2X
EGEN	JSR	MCH2
	JSR	WAITL
	JMP	MWIN
;
ELF	CMP	#11
	BNE	ELU
	JSR	C2L
	BCS	MWIN
	JSR	CHGLD2
	JSR	PCH2
	DEC	D2X
	JMP	EGEN
;
ELU	CMP	#14
	BNE	ELD
	JSR	C2U
	BCS	MWIN
	JSR	CHGLD2
	JSR	PCH2
	DEC	D2Y
	JMP	EGEN
;
ELD	CMP	#13
	BNE	MWIN
	JSR	C2D
	BCS	MWIN
	JSR	CHGLD2
	JSR	PCH2
	INC	D2Y
	JMP	EGEN
	;
;has anyone won?
;
MWIN	LDA	SCR1	;get sum
	CLC
	ADC	SCR2
	STA	TOTL
	LDA	SCR1+1
	ADC	SCR2+1
	STA	TOTL+1
	CMP	GOLD+1	;does sum =
	BNE	FLIP	;total gold?
	LDA	TOTL
	CMP	GOLD
	BNE	FLIP
	RTS		;somebody won
;
FLIP	LDA	$D01F	;select?
	CMP	#5
	BNE	FFP
	PLA
	PLA
	JMP	START	;yes,start ovr
FFP	JMP	CS1
;
;chk for walls
;
CLR	LDA	D1Y
	LDX	D1X
	INX
CLLL	JSR	MUL40
	LDY	#0
	LDA	(I),Y
	CMP	#6
	BEQ	WALL
GG	CLC
	RTS
WALL	SEC
	RTS
;
CLF	LDA	D1Y
	LDX	D1X
	DEX
	JMP	CLLL
;
CLU	LDY	D1Y
	DEY
	TYA
	LDX	D1X
	JMP	CLLL
;
CLD	LDY	D1Y
	INY
	TYA
	LDX	D1X
	JMP	CLLL
;
;chks for wall for man 2
;
C2R	LDA	D2Y
	LDX	D2X
	INX
	JMP	CLLL
;
C2L	LDA	D2Y
	LDX	D2X
	DEX
	JMP	CLLL
;
C2U	LDY	D2Y
	DEY
	TYA
	LDX	D2X
	JMP	CLLL
;
C2D	LDY	D2Y
	INY
	TYA
	LDX	D2X
	JMP	CLLL
;
;zero out top
;
PCHR1	LDA	D1Y
	LDX	D1X
	JSR	MUL40
	LDY	#0
	LDA	#0
	STA	(I),Y
	RTS
;
;zero out bot man
;
PCH2	LDA	D2Y
	LDX	D2X
	JSR	MUL40
	LDY	#0
	TYA
	STA	(I),Y
	RTS
;
;show top man
;
MCH1	LDA	D1Y
	LDX	D1X
	JSR	MUL40
	LDY	#0
	LDA	#8
	STA	(I),Y
	RTS
;
;show bot man
;
MCH2	LDA	D2Y
	LDX	D2X
	JSR	MUL40
	LDY	#0
	LDA	#9
	STA	(I),Y
	RTS
;
;mult x 40 to get screen pos
;
MUL40	ASL	A
	STA	LHD
	LDA	#0
	ROL	A
	STA	HHD
	ASL	LHD	;x4
	ROL	HHD
	ASL	LHD	;x8
	ROL	HHD
	LDA	LHD
	STA	ML
	LDA	HHD
	STA	MH
	ASL	LHD	;x16
	ROL	HHD
	ASL	LHD	;32
	ROL	HHD
	LDA	LHD
	CLC
	ADC	ML
	STA	ML
	LDA	HHD
	ADC	MH
	STA	MH
	LDA	#<MAZE0
	CLC
	ADC	ML
	STA	I
	LDA	#>MAZE0
	ADC	MH
	STA	I+1
	TXA
	CLC
	ADC	I
	STA	I
	LDA	I+1
	ADC	#0
	STA	I+1
	RTS
;
;is it gold we are moving
;onto- for top man
;
CHGLD1	CMP	#7	;gold?
	BEQ	GD1	;yes
	RTS
GD1	JSR	BELL	;sounds
	INC	SCR1	;inc. score
	BNE	DGA
	INC	SCR1+1
DGA	LDX	#2	;show score
	INC	SCRTXT+10,X
	LDA	SCRTXT+10,X
DGC	CMP	#$1A
	BCC	FST
	LDA	#$10
	STA	SCRTXT+10,X
	DEX
	BMI	FST
	INC	SCRTXT+10,X
	LDA	SCRTXT+10,X
	JMP	DGC
;
FST	JSR	ADDH1	;add 1 to hi
	LDX	#2	;scores
	INC	FSC1,X
	LDA	FSC1,X
FSR	CMP	#$1A
	BCC	DGB
	LDA	#$10
	STA	FSC1,X
	DEX
	BMI	DGB
	INC	FSC1,X
	LDA	FSC1,X
	JMP	FSR
DGB	RTS
;
;do same for bottom man
;
CHGLD2	CMP	#7
	BEQ	EG1
	RTS
EG1	JSR	BELL
	INC	SCR2
	BNE	EGA
	INC	SCR2+1
EGA	LDX	#2
	INC	SCRTXT+16,X
	LDA	SCRTXT+16,X
EGC	CMP	#$1A
	BCC	FSU
	LDA	#$10
	STA	SCRTXT+16,X
	DEX
	BMI	FSU
	INC	SCRTXT+16,X
	LDA	SCRTXT+16,X
	JMP	EGC
;
FSU	JSR	ADDH2
	LDX	#2
	INC	FSC2,X
	LDA	FSC2,X
FSV	CMP	#$1A
	BCC	EGB
	LDA	#$10
	STA	FSC2,X
	DEX
	BMI	EGB
	INC	FSC2,X
	LDA	FSC2,X
	JMP	FSV
EGB	RTS
;
;intermission time
;show current scores
;
NTRMSS	LDA	#<ILST
	STA	$0230
	LDA	#>ILST
	STA	$0231
	JSR	STOPAL
SS1	LDA	$0284
	BNE	SS2
RR1	LDA	$0284
	BEQ	RR1
	RTS
SS2	LDA	$0285
	BNE	SS1
RR2	LDA	$0285
	BEQ	RR2
	RTS
;
;stop vbi & remove players
;
STOPAL	LDA	#0
	STA	VFLG
	LDX	#3
STP	STA	HPOSP0,X
	DEX
	BPL	STP
	RTS
;
;intermission display list
;
ILST	.BYTE	$70,$70,$70,$70
	.BYTE	$70,$70,$47
	.WORD	PS1
	.BYTE	$70,$70,$70,$47
	.WORD	PS2
	.BYTE	$70,$70,$70,$47
	.WORD	FIRMS
	.BYTE	$41
	.WORD	ILST
;
;misc. data & tables
;
VP1	.BYTE	$44,$44,$4A,$4A
VP2	.BYTE	$24,$24,$2A,$2A
TITLE	.SBYTE	"    krAzy MAZES      "
SCRTXT	.SBYTE	" scores 1:000 2:000  "
PS1	.SBYTE	"   SCORE 1: "
FSC1	.SBYTE	"000     "
PS2	.SBYTE	"   SCORE 2: "
FSC2	.SBYTE	"000     "
FIRMS	.SBYTE	"    press fire       "
;
;bell sound for middle maze
;
BELL	LDA	#23
	STA	$D200
	LDX	#$AA
	STX	$D201
	JSR	WAIT
	LDA	#0
	STA	$D201
	RTS
;
;frequencies for bell
;
NTX	.BYTE	0
NOTE	.BYTE	132,0,143,0
;
;introduction screen w/ghosts
;
INTRO	LDA	#<INTL
	STA	$0230
	LDA	#>INTL
	STA	$0231
CCC	LDA	GX
	CMP	#$DA
	BCC	IIA
	JSR	DEFP0
IIA	LDA	GX1
	CMP	#$DA
	BCC	IIB
	JSR	DEFP1
IIB	LDA	$D01F
	CMP	#6
	BNE	IIC
	RTS
IIC	CMP	#3
	BNE	CCC
	JSR	ZHSC
	JMP	CCC
;
;zero out high scores
;
ZHSC	LDA	#$10
	LDX	#4
IIL	STA	HSC1,X
	STA	HSC2,X
	DEX
	BPL	IIL
	RTS
;
;introduction display list
;
INTL	.BYTE	$70,$70,$70
	.BYTE	$70,$47
	.WORD	INTIL
	.BYTE	$07
	.BYTE	$70,$70,$46
	.WORD	CREDIT
	.BYTE	$70,$70,$70,$70,$46
	.WORD	PST
	.BYTE	$70,$46
	.WORD	PRSRES
	.BYTE	$70,$70,$70,$70,$46
	.WORD	HISC
	.BYTE	$41
	.WORD	INTL
;
;screen data
;
INTIL	.SBYTE	"    r   Z           "
	.SBYTE	"  K   a   y  mazes  "
CREDIT	.SBYTE	"   BY BARRY KOLBE   "
PST	.SBYTE	"   start    play    "
PRSRES	.SBYTE	"   option   scores  "
HISC	.SBYTE	" 1: "
HSC1	.SBYTE	"00000  2: "
HSC2	.SBYTE	"00000 "
;
;add 1 to high score top man
;
ADDH1	LDX	#4
AA1	INC	HSC1,X
	LDA	HSC1,X
	CMP	#$1A
	BCC	AAE
	LDA	#$10
	STA	HSC1,X
	DEX
	BPL	AA1
	LDA	HSC1,X
AAE	RTS
;
;add 100 to top man
;
AHUN1	LDX	#2
	JMP	AA1
;
;add 100 to bottom man
;
AHUN2	LDX	#2
	JMP	BB1
;
;add 1 to high score bot man
;
ADDH2	LDX	#4
BB1	INC	HSC2,X
	LDA	HSC2,X
	CMP	#$1A
	BCC	BBE
	LDA	#$10
	STA	HSC2,X
	DEX
	BPL	BB1
BBE	RTS
;
;the characer set
;
	*=	MYSET
	.BYTE	$00,$00,$00,$00
	.BYTE	$00,$00,$00,$00
	.BYTE	$38,$38,$38,$38
	.BYTE	$38,$00,$38,$00
	.BYTE	$66,$66,$66,$00
	.BYTE	$00,$00,$00,$00
	.BYTE	$00,$66,$FF,$66
	.BYTE	$66,$FF,$66,$00
	.BYTE	$18,$3E,$60,$3C
	.BYTE	$06,$7C,$18,$00
	.BYTE	$00,$66,$6C,$18
	.BYTE	$30,$66,$46,$00
	.BYTE	$DF,$FD,$DF,$FD
	.BYTE	$DF,$FD,$DF,$FD
	.BYTE	$00,$28,$AA,$BE
	.BYTE	$BE,$AA,$28,$00
	.BYTE	$00,$28,$00,$69
	.BYTE	$28,$28,$41,$41
	.BYTE	$00,$14,$00,$96
	.BYTE	$14,$14,$82,$82
	.BYTE	$00,$66,$3C,$FF
	.BYTE	$3C,$66,$00,$00
	.BYTE	$00,$18,$18,$7E
	.BYTE	$18,$18,$00,$00
	.BYTE	$00,$00,$00,$00
	.BYTE	$00,$18,$18,$30
	.BYTE	$00,$00,$00,$7E
	.BYTE	$00,$00,$00,$00
	.BYTE	$00,$00,$00,$00
	.BYTE	$00,$18,$18,$00
	.BYTE	$00,$06,$0C,$18
	.BYTE	$30,$60,$40,$00
	.BYTE	$7C,$CE,$C6,$C6
	.BYTE	$C6,$E6,$7C,$00
	.BYTE	$38,$38,$18,$18
	.BYTE	$18,$18,$18,$00
	.BYTE	$7C,$E6,$0C,$18
	.BYTE	$30,$60,$FE,$00
	.BYTE	$7E,$0C,$18,$0C
	.BYTE	$06,$66,$3C,$00
	.BYTE	$0C,$1C,$3C,$6C
	.BYTE	$CC,$FE,$0C,$00
	.BYTE	$7E,$60,$7C,$06
	.BYTE	$06,$66,$3C,$00
	.BYTE	$7C,$C6,$C0,$FC
	.BYTE	$CE,$E6,$7C,$00
	.BYTE	$7E,$06,$0C,$18
	.BYTE	$30,$30,$30,$00
	.BYTE	$7C,$CE,$E6,$7C
	.BYTE	$CE,$E6,$7C,$00
	.BYTE	$7C,$CE,$C6,$E6
	.BYTE	$7E,$0C,$18,$30
	.BYTE	$00,$38,$38,$00
	.BYTE	$00,$38,$38,$00
	.BYTE	$00,$00,$18,$18
	.BYTE	$00,$18,$18,$30
	.BYTE	$06,$0C,$18,$30
	.BYTE	$18,$0C,$06,$00
	.BYTE	$00,$00,$7E,$00
	.BYTE	$00,$7E,$00,$00
	.BYTE	$60,$30,$18,$0C
	.BYTE	$18,$30,$60,$00
	.BYTE	$3C,$66,$66,$0C
	.BYTE	$18,$00,$18,$00
	.BYTE	$00,$3C,$66,$6E
	.BYTE	$6E,$60,$3E,$00
	.BYTE	$78,$9C,$3C,$36
	.BYTE	$3E,$66,$66,$C3
	.BYTE	$EE,$73,$63,$63
	.BYTE	$6E,$63,$63,$DE
	.BYTE	$3C,$66,$CC,$C0
	.BYTE	$C0,$C0,$E6,$7C
	.BYTE	$EE,$73,$63,$63
	.BYTE	$63,$63,$63,$DE
	.BYTE	$FE,$66,$60,$78
	.BYTE	$60,$63,$66,$7C
	.BYTE	$FE,$66,$60,$78
	.BYTE	$60,$60,$60,$60
	.BYTE	$3C,$66,$C6,$C0
	.BYTE	$DE,$C6,$66,$3C
	.BYTE	$C6,$C6,$C6,$CE
	.BYTE	$FE,$E6,$C6,$C6
	.BYTE	$30,$18,$18,$18
	.BYTE	$18,$18,$18,$0C
	.BYTE	$1E,$0C,$0C,$0C
	.BYTE	$0C,$1C,$38,$60
	.BYTE	$C6,$6C,$6C,$78
	.BYTE	$78,$6C,$6C,$C6
	.BYTE	$E0,$60,$60,$60
	.BYTE	$60,$66,$7E,$78
	.BYTE	$C6,$EE,$FE,$D6
	.BYTE	$C6,$C6,$C6,$C6
	.BYTE	$C6,$C6,$E6,$F6
	.BYTE	$DE,$CE,$C6,$C6
	.BYTE	$7C,$CE,$C6,$C6
	.BYTE	$C6,$C6,$E6,$7C
	.BYTE	$7C,$66,$66,$66
	.BYTE	$6C,$60,$60,$C0
	.BYTE	$7C,$E6,$C6,$C6
	.BYTE	$C6,$C6,$CE,$7F
	.BYTE	$EE,$73,$66,$6C
	.BYTE	$66,$66,$63,$C3
	.BYTE	$3A,$66,$60,$3C
	.BYTE	$06,$06,$66,$5C
	.BYTE	$FE,$30,$60,$C0
	.BYTE	$C0,$C2,$C6,$7C
	.BYTE	$E6,$66,$66,$66
	.BYTE	$66,$66,$6E,$3F
	.BYTE	$C3,$66,$66,$66
	.BYTE	$66,$66,$3C,$18
	.BYTE	$C3,$C3,$C3,$D3
	.BYTE	$CB,$DF,$77,$62
	.BYTE	$C3,$C3,$66,$3C
	.BYTE	$3C,$66,$C3,$C3
	.BYTE	$C3,$66,$66,$3C
	.BYTE	$18,$18,$18,$18
	.BYTE	$7E,$C6,$0C,$18
	.BYTE	$FE,$60,$C3,$FE
	.BYTE	$00,$1E,$18,$18
	.BYTE	$18,$18,$1E,$00
	.BYTE	$00,$40,$60,$30
	.BYTE	$18,$0C,$06,$00
	.BYTE	$00,$78,$18,$18
	.BYTE	$18,$18,$78,$00
	.BYTE	$00,$08,$1C,$36
	.BYTE	$63,$00,$00,$00
	.BYTE	$00,$00,$00,$00
	.BYTE	$00,$00,$FF,$00
;
	*=	$02E0
	.WORD	BEGIN