A.N.A.L.O.G. ISSUE 47 / OCTOBER 1986 / PAGE 22

Deathzone

32K Cassette or Diskette

by Steven Hiller

Suddenly, your scanner detects the presence of an alien. Moments later it screams into view, charging headlong at you. In desperation, you back off, firing salvos of raw energy bolts at your attacker. One strikes home, and the alien pod disintegrates into scintillating dust. You were lucky that time, but how much longer will you be able to survive in the Deathzone?

Deathzone is a fast-moving, 3-dimensional arcade game that will work on all 8-bit Atari micros.

Typing It in.

Listing 1 is the BASIC data used to create both cassette and disk versions of Deathzone. Those readers who are interested in how the game works may obtain the assembly listing on either the magazine disk version or the ANALOG Computing Atari Users’ Group on Delphi.

Disk users should refer to the M/L Editor article on page 11 for typing instructions.

If you have a cassette system, type in Listing 1, then add the lines shown in Listing 2. Type RUN and press RETURN. The program will begin checking the data statements, printing the line numbers as it goes. It will alert you to any problems. Fix any incorrect lines and rerun the program until all errors are eliminated.

When all your data lines are correct, the computer will beep twice and prompt you to READY CASSETTE AND PRESS RETURN. Now, insert a blank cassette in your recorder, press the RECORD and PLAY buttons simultaneously, and hit RETURN. The message WRITING FILE will appear, and the program will create a machine language boot tape version of Deathzone, printing each data line number as it goes. When the READY prompt appears, the game is recorded and ready to play. CSAVE the BASIC program onto a separate tape before continuing.

To play the game, rewind the tape created with the BASIC program to the beginning. Turn your computer off and remove all cartridges. Press the PLAY button on your recorder and turn on your computer, while holding down the START key. If you have an XL or XE series computer, you must hold the START and OPTION keys when you turn on the power. The computer will beep once. Hit the RETURN key, and Deathzone will load and run automatically.

Playing Deathzone.

If you’ve followed the instructions correctly, you will now be looking at the title page for Deathzone. Both the lowest (L) and highest (H) scores are shown. You can start the game either by pressing the trigger of joystick 1, or be pressing the START key. If you should wish to abort a game before completion, either the SELECT or OPTION keys will bring you back to the title page.

When you begin the game, you’ll notice that the screen is divided into sections. At the very top is a horizontal line whose length indicates how close the alien is. Two sets of directional arrows at either end of the line indicate whether the alien is to your front, left, right, or rear. The next line is the status line, showing your score from left to right, lives remaining and current level of play. Further down, there’s a standard radar scanner superimposed on the sky. The white central dot represents your own position, of course.

By using the joystick, you can move in and out of the screen, or swivel on the spot. You must do your best to avoid both the aliens themselves and the energy bolts they fire. Each time you’re hit, you’ll lose a life. You’ll need to dodge, reverse away and fire rapidly, in order to destroy the aliens before they reach you. Incidentally, you can pause the game with the SPACE BAR and continue it by moving the joystick.

Every so often, an alien pod with rather different characteristics will attack you. If you should succeed in destroying it, you’ll receive an extra life and move up to the next level of play. If not, you’ll have to restart that level. There are a total of six levels, each progressively more difficult than the last. Should you complete the last level, well…wait and see!

Last, a word of thanks to my brother for writing a “blackbox” 16-bit math package, around which the game was based.

Listing 1.
BASIC listing.

1000 DATA 255,255,0,31,128,59,112,112,112,112,112,240,71,0,27,7,2243
1010 DATA 112,2,112,112,6,112,112,2,112,112,65,0,31,0,151,79,187
1020 DATA 80,76,77,78,0,203,79,80,76,77,78,0,152,65,66,67,1466
1030 DATA 68,69,70,71,72,0,137,79,80,133,76,77,78,0,143,79,1914
1040 DATA 80,83,0,136,73,74,75,69,70,71,72,0,134,79,80,76,1112
1050 DATA 77,78,0,137,65,66,67,68,69,70,71,72,0,137,79,80,914
1060 DATA 133,76,77,78,0,143,79,80,65,66,67,68,136,69,70,71,1657
1070 DATA 72,0,131,79,80,138,76,77,78,65,66,67,68,81,82,0,357
1080 DATA 132,79,80,131,83,0,132,73,74,75,135,69,70,71,72,79,2034
1090 DATA 80,133,76,77,78,0,130,65,66,67,68,136,69,70,71,72,1530
1100 DATA 0,131,79,80,138,76,77,78,65,66,67,68,81,82,0,132,1339
1110 DATA 79,80,130,14,143,69,84,80,139,1,2,3,4,134,81,82,9926
1120 DATA 79,80,134,83,73,74,75,142,5,6,7,8,134,76,85,14,9146
1130 DATA 143,69,84,80,139,1,2,3,4,134,81,82,79,80,133,12,307
1140 DATA 13,14,139,15,28,140,4,140,29,30,132,9,10,11,158,12,8753
1150 DATA 13,14,139,15,28,140,4,140,29,30,176,29,207,29,131,0,1703
1160 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,85,85,3795
1170 DATA 85,85,85,85,90,165,85,85,85,85,90,165,85,85,85,85,4250
1180 DATA 90,165,85,85,85,85,90,165,85,85,85,85,85,85,165,90,4860
1190 DATA 85,85,85,85,85,85,85,85,165,90,85,85,85,85,85,85,3520
1200 DATA 85,85,165,90,85,85,85,85,85,85,85,85,165,90,85,85,4130
1210 DATA 85,85,85,86,105,149,85,85,85,86,105,149,85,85,86,105,4591
1220 DATA 149,85,85,85,85,85,149,105,86,85,85,85,85,85,85,85,3461
1230 DATA 85,149,105,86,85,85,85,85,85,85,85,149,105,86,85,85,4024
1240 DATA 85,85,86,89,101,149,0,60,102,110,118,102,60,0,0,24,9692
1250 DATA 56,24,24,24,126,0,0,60,102,12,24,48,126,0,0,126,8164
1260 DATA 12,24,12,102,60,0,0,12,28,60,108,126,12,0,0,126,7884
1270 DATA 96,124,6,102,60,0,0,60,96,124,102,102,60,0,0,126,66
1280 DATA 6,12,24,48,48,0,0,60,102,60,102,102,60,0,0,60,7898
1290 DATA 102,62,6,12,56,0,0,0,0,240,240,0,0,0,0,0,6902
1300 DATA 0,15,15,0,0,0,86,89,101,149,85,85,85,85,149,101,3189
1310 DATA 89,86,85,85,85,85,85,85,85,85,149,101,89,86,0,0,1203
1320 DATA 0,255,255,0,0,0,0,0,63,63,60,60,60,60,0,0,6792
1330 DATA 192,224,240,120,60,28,60,60,60,60,63,63,0,0,28,60,8507
1340 DATA 120,240,224,192,0,0,0,0,63,63,60,60,63,63,0,0,7658
1350 DATA 252,252,0,0,240,240,60,60,60,60,63,63,0,0,0,0,8235
1360 DATA 0,0,252,252,0,0,0,1,3,7,15,30,60,60,0,128,7422
1370 DATA 192,224,240,120,60,60,60,60,63,63,60,60,0,0,60,60,9207
1380 DATA 252,252,60,60,0,0,0,0,63,63,3,3,3,3,0,0,3903
1390 DATA 252,252,192,192,192,192,3,3,3,3,3,3,0,0,192,192,1725
1400 DATA 192,192,192,192,0,0,0,0,60,60,60,60,63,63,0,0,7541
1410 DATA 60,60,60,60,252,252,60,60,60,60,60,60,0,0,60,60,62
1420 DATA 60,60,60,60,0,0,0,0,63,63,0,0,1,3,0,0,3272
1430 DATA 252,252,120,240,224,192,7,15,30,60,63,63,0,0,128,0,186
1440 DATA 0,0,252,252,0,0,0,0,15,31,60,60,60,60,0,0,6649
1450 DATA 240,248,60,60,60,60,60,60,60,60,31,15,0,0,60,60,7687
1460 DATA 60,60,248,240,0,0,0,0,60,62,63,63,63,63,0,0,7654
1470 DATA 60,60,60,188,252,252,63,61,60,60,60,60,0,0,252,252,6615
1480 DATA 252,124,60,60,0,0,85,85,85,85,85,85,85,85,0,0,9540
1490 DATA 0,0,0,0,10,165,0,0,0,0,10,165,85,85,0,0,6915
1500 DATA 10,165,85,85,85,85,10,165,85,85,85,85,85,85,160,90,4465
1510 DATA 85,85,85,85,85,85,0,0,160,90,85,85,85,85,0,0,9885
1520 DATA 0,0,160,90,85,85,0,0,0,0,0,0,160,90,0,0,6635
1530 DATA 0,0,0,2,41,149,0,0,0,2,41,149,85,85,2,41,7877
1540 DATA 149,85,85,85,85,85,128,104,86,85,85,85,85,85,0,0,991
1550 DATA 0,128,104,86,85,85,0,0,0,0,0,128,104,86,0,0,7489
1560 DATA 0,0,2,9,37,149,2,9,37,149,85,85,85,85,128,96,2296
1570 DATA 88,86,85,85,85,85,0,0,0,0,128,96,88,86,128,128,2236
1580 DATA 96,96,88,88,86,86,0,0,160,90,86,89,101,149,10,165,3973
1590 DATA 149,101,89,86,85,85,170,255,255,170,255,255,255,255,255,255,1367
1600 DATA 170,255,255,255,255,255,255,255,255,255,255,255,255,255,255,170,4835
1610 DATA 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,6290
1620 DATA 255,255,126,24,30,0,0,24,60,126,24,24,24,0,0,24,6249
1630 DATA 24,24,126,60,24,0,0,24,48,126,48,24,0,0,0,24,5524
1640 DATA 12,126,12,24,0,0,8,24,56,120,56,24,8,0,0,96,6532
1650 DATA 96,96,96,96,126,0,0,60,96,60,6,6,60,0,16,24,6726
1660 DATA 28,30,28,24,16,0,112,112,194,160,27,130,112,96,112,112,5163
1670 DATA 112,112,112,112,112,240,240,240,212,0,28,212,128,28,212,0,8386
1680 DATA 29,84,128,29,84,0,30,212,128,30,68,0,18,4,132,4,9237
1690 DATA 4,65,32,35,104,24,105,1,141,0,2,104,105,0,141,1,9502
1700 DATA 2,104,64,72,169,6,141,10,212,141,23,208,169,152,133,202,9957
1710 DATA 32,78,35,72,169,0,141,23,208,141,10,212,173,194,2,141,7494
1720 DATA 25,208,165,202,56,233,16,141,26,208,133,202,201,56,240,2,9612
1730 DATA 104,64,32,78,35,72,141,30,208,165,203,141,10,212,141,8,6992
1740 DATA 208,165,200,141,0,208,165,201,141,18,208,32,78,35,72,169,6862
1750 DATA 182,141,10,212,141,23,208,169,178,141,24,208,169,0,141,26,7243
1760 DATA 208,32,78,35,72,169,15,141,18,208,169,120,141,10,212,141,7963
1770 DATA 0,208,169,1,141,8,208,173,8,208,13,11,208,41,1,13,2218
1780 DATA 12,208,41,13,133,172,104,64,216,169,64,141,14,212,169,6,7131
1790 DATA 162,228,160,95,32,92,228,169,32,141,244,2,169,34,141,47,6874
1800 DATA 2,169,0,141,29,208,162,4,157,13,208,202,16,250,32,36,6282
1810 DATA 38,169,18,133,129,169,0,133,128,160,0,162,13,152,145,128,6711
1820 DATA 200,208,251,230,129,202,240,8,224,3,208,242,169,64,208,238,4969
1830 DATA 162,255,232,188,100,38,192,255,240,15,232,189,100,38,201,155,2519
1840 DATA 240,240,153,0,27,200,232,208,242,169,0,141,198,2,141,200,1119
1850 DATA 2,133,130,141,4,212,133,187,169,17,141,251,27,32,13,39,4663
1860 DATA 169,15,141,197,2,169,54,141,196,2,169,62,141,47,2,169,5412
1870 DATA 31,141,49,2,169,0,141,48,2,32,12,38,169,38,141,1,340
1880 DATA 2,169,52,141,0,2,169,192,141,14,212,169,128,133,213,169,865
1890 DATA 3,133,196,9,16,141,226,27,248,162,2,181,190,213,193,144,2204
1900 DATA 16,208,5,202,16,245,48,9,162,2,181,190,149,193,202,16,8787
1910 DATA 249,216,160,0,162,2,181,193,32,19,38,153,93,27,165,163,6106
1920 DATA 153,94,27,200,200,202,16,238,169,0,162,2,149,190,202,16,8580
1930 DATA 251,169,8,141,31,208,173,31,208,201,6,240,15,173,16,208,8982
1940 DATA 208,244,32,12,38,173,16,208,240,251,208,15,32,12,38,169,6780
1950 DATA 8,141,31,208,173,31,208,201,6,240,249,169,28,133,129,169,1366
1960 DATA 0,133,128,162,0,160,0,189,23,31,48,26,208,20,232,189,6575
1970 DATA 23,31,41,127,168,169,0,145,128,136,16,251,189,23,31,200,7844
1980 DATA 240,4,145,128,169,1,41,127,24,101,128,133,128,144,2,230,6949
1990 DATA 129,232,224,225,144,209,160,47,169,86,24,153,0,18,105,1,3949
2000 DATA 153,48,18,105,1,153,96,18,105,1,153,144,18,105,1,153,2995
2010 DATA 192,18,136,16,227,132,197,169,30,133,164,169,0,133,132,169,9346
2020 DATA 1,133,198,32,208,45,198,164,208,245,169,17,133,174,141,111,1458
2030 DATA 2,169,15,141,192,2,169,255,133,138,141,158,20,141,208,20,8872
2040 DATA 169,129,141,157,20,141,209,20,169,1,133,139,141,8,208,169,8518
2050 DATA 120,141,0,208,162,4,169,24,157,62,20,202,16,250,169,0,6413
2060 DATA 141,47,2,141,243,2,169,16,160,6,153,215,27,153,157,38,6622
2070 DATA 136,16,247,162,98,142,213,27,202,142,224,27,142,249,27,32,8951
2080 DATA 226,55,169,3,141,29,208,169,16,141,7,212,169,32,141,244,9461
2090 DATA 2,169,18,141,196,2,169,12,141,197,2,162,38,160,218,169,9232
2100 DATA 6,32,92,228,169,35,141,1,2,169,93,141,0,2,169,192,5466
2110 DATA 141,14,212,169,35,141,49,2,169,32,141,48,2,169,63,141,4532
2120 DATA 47,2,169,112,141,19,31,169,255,141,252,2,32,174,54,76,6893
2130 DATA 1,53,165,20,197,20,240,252,96,72,41,15,9,16,133,163,4772
2140 DATA 104,74,74,74,74,41,15,9,16,96,169,3,141,15,210,169,4599
2150 DATA 0,162,8,157,0,210,202,16,250,96,72,138,72,152,72,164,8354
2160 DATA 176,166,177,169,31,133,175,141,10,212,140,24,208,142,25,208,9614
2170 DATA 200,232,198,175,16,241,230,176,198,177,169,0,141,24,208,169,2076
2180 DATA 224,141,9,212,104,168,104,170,104,64,1,224,225,164,165,232,2860
2190 DATA 233,172,173,240,241,180,181,248,249,188,189,228,229,155,21,226,7796
2200 DATA 227,166,167,234,235,174,175,242,243,182,183,250,251,190,191,230,1064
2210 DATA 231,155,53,34,121,0,51,14,0,40,105,108,108,101,110,155,3919
2220 DATA 80,44,0,16,16,16,16,16,16,16,0,0,40,0,16,16,4188
2230 DATA 16,16,16,16,16,155,102,0,0,0,8,35,9,0,0,17,5011
2240 DATA 25,24,22,0,0,0,33,110,97,108,111,103,0,35,111,109,1799
2250 DATA 112,117,116,105,110,103,0,0,0,155,148,225,227,229,155,255,2972
2260 DATA 169,35,141,1,2,169,93,141,0,2,165,130,141,4,212,165,6833
2270 DATA 240,32,238,44,165,186,48,2,198,186,230,169,165,169,201,16,1739
2280 DATA 144,14,173,243,2,73,2,141,243,2,169,0,133,169,133,77,6921
2290 DATA 76,95,228,169,95,133,157,133,225,133,156,133,224,96,32,49,9539
2300 DATA 40,162,16,6,140,38,141,38,142,38,143,6,148,38,149,144,5253
2310 DATA 17,165,150,24,101,140,133,140,165,151,101,141,133,141,144,2,8292
2320 DATA 230,142,202,208,222,76,107,40,32,49,40,165,148,5,149,208,7662
2330 DATA 3,76,23,40,165,150,5,151,208,3,76,32,40,162,0,134,3736
2340 DATA 144,134,145,134,146,134,147,165,150,56,229,148,133,155,165,151,2601
2350 DATA 229,149,176,8,232,6,150,38,151,76,97,39,5,155,208,3,5044
2360 DATA 76,12,40,224,0,240,35,70,151,102,150,165,148,56,229,150,273
2370 DATA 72,165,149,229,151,72,176,4,104,104,144,7,104,133,149,104,7343
2380 DATA 133,148,56,38,142,38,143,202,208,221,162,16,70,151,102,150,9694
2390 DATA 102,147,102,146,165,148,56,229,150,133,155,72,165,149,229,151,2944
2400 DATA 72,144,66,5,155,208,28,165,144,56,229,146,72,165,145,229,1729
2410 DATA 147,72,144,47,104,133,145,104,133,144,104,133,149,104,133,148,9619
2420 DATA 56,176,37,104,133,149,104,133,148,165,144,56,229,146,133,144,1264
2430 DATA 165,145,229,147,133,145,176,8,165,148,208,2,198,149,198,148,2266
2440 DATA 56,176,5,104,104,104,104,24,38,140,38,141,202,208,157,76,8304
2450 DATA 107,40,232,56,38,142,38,143,202,208,249,240,242,165,150,5,3312
2460 DATA 151,208,2,230,142,96,162,128,160,0,165,149,69,151,48,2,6203
2470 DATA 202,136,134,143,132,142,96,165,149,69,151,133,154,165,149,16,9513
2480 DATA 9,166,148,32,92,40,134,148,133,149,165,151,16,9,166,150,7753
2490 DATA 32,92,40,134,150,133,151,169,0,133,140,133,141,133,142,133,9738
2500 DATA 143,96,133,153,134,152,169,0,56,229,152,170,169,0,229,153,1197
2510 DATA 96,165,140,16,10,230,141,208,6,230,142,208,2,230,143,165,1944
2520 DATA 154,16,16,160,0,56,169,0,249,140,0,153,140,0,200,192,8282
2530 DATA 4,208,243,96,56,233,0,133,148,165,149,56,233,64,133,149,402
2540 DATA 169,0,133,154,165,149,16,9,166,148,32,92,40,134,148,133,6801
2550 DATA 149,165,149,41,192,240,17,169,0,56,229,148,133,148,169,128,750
2560 DATA 229,149,133,149,169,255,133,154,6,148,38,149,38,148,38,149,7880
2570 DATA 176,40,38,148,144,4,230,149,240,32,166,149,189,70,41,24,7608
2580 DATA 105,1,133,142,169,0,105,0,133,143,165,154,16,11,165,143,6649
2590 DATA 166,142,32,92,40,134,142,133,143,96,169,0,133,142,133,143,8672
2600 DATA 96,169,0,133,154,166,148,165,149,16,5,133,154,32,92,40,5310
2610 DATA 189,70,42,72,189,70,43,170,104,164,154,16,3,32,92,40,3348
2620 DATA 133,143,134,142,96,166,143,232,224,2,176,15,202,138,69,142,359
2630 DATA 48,9,165,142,133,143,165,141,133,142,96,162,127,160,255,165,3538
2640 DATA 143,48,5,134,143,132,142,96,232,200,240,247,255,255,255,255,1181
2650 DATA 255,255,255,255,255,255,255,254,254,254,254,254,254,254,253,253,7191
2660 DATA 253,253,253,252,252,252,252,251,251,251,251,250,250,250,249,249,6729
2670 DATA 249,248,248,248,247,247,247,246,246,245,245,244,244,244,243,243,5973
2680 DATA 242,242,241,241,240,240,239,238,238,237,237,236,236,235,234,234,4873
2690 DATA 233,232,232,231,230,230,229,228,228,227,226,226,225,224,223,223,3458
2700 DATA 222,221,220,219,219,218,217,216,215,214,214,213,212,211,210,209,1739
2710 DATA 208,207,206,206,205,204,203,202,201,200,199,198,197,196,195,194,9768
2720 DATA 193,192,191,190,189,188,187,185,184,183,182,181,180,179,178,177,7500
2730 DATA 176,174,173,172,171,170,169,167,166,165,164,163,161,160,159,158,5005
2740 DATA 156,155,154,153,151,150,149,148,146,145,144,143,141,140,139,137,2296
2750 DATA 136,135,133,132,131,129,128,127,125,124,122,121,120,118,117,116,9406
2760 DATA 114,113,111,110,108,107,106,104,103,101,100,98,97,96,94,93,6345
2770 DATA 91,90,88,87,85,84,82,81,79,78,76,75,73,72,70,69,3142
2780 DATA 67,66,64,63,61,60,58,57,55,54,52,50,49,47,46,44,9846
2790 DATA 43,41,40,38,37,35,33,32,30,29,27,26,24,23,21,19,6491
2800 DATA 18,16,15,13,12,10,8,7,5,4,2,1,0,0,0,0,3298
2810 DATA 0,0,0,1,1,1,1,1,1,2,2,2,2,2,2,3,3047
2820 DATA 3,3,3,3,3,3,4,4,4,4,4,4,5,5,5,5,3401
2830 DATA 5,5,6,6,6,6,6,6,6,7,7,7,7,7,7,8,3750
2840 DATA 8,8,8,8,8,8,9,9,9,9,9,9,9,10,10,10,4088
2850 DATA 10,10,10,11,11,11,11,11,11,11,12,12,12,12,12,12,4421
2860 DATA 12,13,13,13,13,13,13,13,14,14,14,14,14,14,14,15,4743
2870 DATA 15,15,15,15,15,15,15,16,16,16,16,16,16,16,17,17,5049
2880 DATA 17,17,17,17,17,17,18,18,18,18,18,18,18,19,19,19,5352
2890 DATA 19,19,19,19,19,20,20,20,20,20,20,20,20,20,21,21,5626
2900 DATA 21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,23,5887
2910 DATA 23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,6138
2920 DATA 24,25,25,25,25,25,25,25,25,25,26,26,26,26,26,26,6400
2930 DATA 26,26,26,26,27,27,27,27,27,27,27,27,27,27,27,28,6608
2940 DATA 28,28,28,28,28,28,28,28,28,29,29,29,29,29,29,29,6839
2950 DATA 29,29,29,29,29,30,30,30,30,30,30,30,30,30,30,30,7015
2960 DATA 31,31,31,31,31,31,31,31,31,31,31,31,0,41,81,122,9119
2970 DATA 163,204,244,29,70,111,151,192,233,17,58,98,139,180,220,5,9786
2980 DATA 45,86,126,167,207,247,32,72,112,153,193,233,17,57,97,137,9683
2990 DATA 177,217,1,41,81,120,160,200,239,23,62,102,141,181,220,3,9615
3000 DATA 42,81,120,159,198,237,20,59,97,136,174,213,251,34,72,110,506
3010 DATA 148,186,224,6,44,81,119,157,194,231,13,50,87,124,161,198,270
3020 DATA 235,16,52,89,125,162,198,234,15,51,86,122,158,194,229,9,58
3030 DATA 44,80,115,150,185,220,255,33,68,103,137,171,206,240,18,52,814
3040 DATA 86,119,153,187,220,253,31,64,97,130,163,195,228,5,37,69,8917
3050 DATA 102,134,166,198,230,5,37,68,100,131,162,193,224,255,30,61,909
3060 DATA 91,122,152,183,213,243,17,47,76,106,136,165,194,224,253,26,2690
3070 DATA 55,84,112,141,170,198,226,254,27,55,83,110,138,166,193,221,3420
3080 DATA 248,19,46,73,100,127,154,180,207,233,4,30,56,82,108,134,7813
3090 DATA 159,185,211,236,5,31,56,81,106,131,156,180,205,229,254,22,2620
3100 DATA 46,70,94,118,142,166,190,213,237,4,27,51,74,97,120,142,8254
3110 DATA 165,188,211,233,255,22,44,66,88,110,132,154,176,197,219,240,4822
3120 DATA 6,27,48,69,90,111,132,153,174,195,215,236,169,1,133,226,3399
3130 DATA 173,0,211,201,255,208,4,169,0,240,54,41,8,208,3,32,5702
3140 DATA 175,44,173,0,211,41,4,208,3,32,143,44,173,0,211,41,5433
3150 DATA 2,208,8,32,15,45,198,226,32,168,45,173,0,211,41,1,5383
3160 DATA 208,8,32,3,45,230,226,32,168,45,169,80,141,2,210,169,9431
3170 DATA 34,141,3,210,96,166,130,224,3,208,12,162,255,172,51,35,9744
3180 DATA 208,2,160,80,136,132,240,232,134,130,230,200,230,200,169,0,4961
3190 DATA 162,128,76,207,44,166,130,208,14,162,4,172,51,35,192,79,7605
3200 DATA 208,2,160,255,200,132,240,202,134,130,198,200,198,200,169,0,4993
3210 DATA 162,128,32,92,40,133,163,36,186,16,24,138,24,101,158,133,6497
3220 DATA 158,165,159,101,163,133,159,138,24,101,222,133,222,165,223,101,3840
3230 DATA 163,133,223,96,141,51,35,141,57,35,141,63,35,73,128,141,5919
3240 DATA 54,35,141,60,35,141,66,35,96,169,1,32,208,45,32,143,4841
3250 DATA 45,169,0,240,10,169,255,32,208,45,32,143,45,169,128,133,9087
3260 DATA 160,36,186,16,227,165,220,133,148,165,221,133,149,32,154,40,1187
3270 DATA 32,185,45,165,143,166,142,36,160,48,3,32,92,40,133,163,6156
3280 DATA 138,24,101,218,133,218,165,163,101,219,133,219,165,220,133,148,5851
3290 DATA 165,221,133,149,32,147,40,32,185,45,165,218,133,150,165,219,2824
3300 DATA 133,151,165,142,133,148,165,143,133,149,32,66,39,32,31,41,4557
3310 DATA 165,142,133,148,165,143,133,149,32,251,40,166,142,165,143,36,663
3320 DATA 160,16,3,32,92,40,133,163,138,24,101,220,133,220,165,221,2637
3330 DATA 101,163,133,221,96,169,0,133,182,169,1,133,183,165,156,133,1690
3340 DATA 218,165,157,133,219,165,158,133,220,165,159,133,221,96,165,220,6333
3350 DATA 133,158,165,221,133,159,165,218,133,156,165,219,133,157,96,165,4903
3360 DATA 142,133,148,165,143,133,149,165,182,133,150,165,183,133,151,32,2364
3370 DATA 24,39,32,31,41,96,133,131,197,198,240,12,133,198,165,197,3117
3380 DATA 73,85,133,197,169,0,133,131,165,132,24,101,131,48,14,201,7716
3390 DATA 20,144,18,165,197,73,85,133,197,169,0,240,8,165,197,73,374
3400 DATA 85,133,197,169,19,133,132,170,165,197,157,202,34,73,85,168,1228
3410 DATA 138,74,170,152,157,192,34,138,74,170,152,157,180,34,162,0,9261
3420 DATA 165,132,201,3,144,5,233,3,232,208,247,165,197,157,185,34,3812
3430 DATA 162,0,165,132,201,5,144,5,233,5,232,208,247,165,197,157,4881
3440 DATA 176,34,96,198,139,208,16,169,2,133,139,165,138,16,25,173,8189
3450 DATA 16,208,240,4,32,170,46,96,169,15,133,138,169,3,133,203,9160
3460 DATA 169,112,133,200,169,16,133,137,32,170,46,165,138,170,74,24,8162
3470 DATA 169,15,133,201,224,14,208,11,169,1,133,203,165,200,24,105,35
3480 DATA 8,133,200,224,12,208,11,169,0,133,203,165,200,24,105,4,8105
3490 DATA 133,200,169,2,141,6,210,164,137,240,2,136,136,132,137,140,1259
3500 DATA 7,210,169,20,133,129,169,0,133,128,32,183,46,198,138,96,9137
3510 DATA 169,0,160,159,153,0,20,200,192,208,144,248,96,169,1,133,1425
3520 DATA 134,224,12,144,23,240,19,138,56,233,13,170,188,248,46,189,2153
3530 DATA 251,46,133,134,189,254,46,170,208,10,162,15,138,74,73,255,898
3540 DATA 24,105,184,168,134,164,189,22,50,170,165,134,133,136,189,142,2464
3550 DATA 49,145,128,200,198,136,208,249,232,198,164,16,237,96,172,168,6084
3560 DATA 159,2,2,4,11,15,11,165,157,48,33,201,96,144,12,165,6039
3570 DATA 159,73,128,133,159,169,95,133,157,133,156,165,157,201,2,144,1957
3580 DATA 11,165,225,48,16,201,2,144,12,76,180,47,169,2,133,156,7368
3590 DATA 133,157,32,180,47,169,0,133,229,32,135,52,133,137,141,7,7530
3600 DATA 210,32,246,52,169,255,133,138,32,170,46,32,36,38,162,38,6146
3610 DATA 165,20,133,163,160,4,173,10,210,153,22,208,192,4,208,1,8827
3620 DATA 136,136,16,242,173,10,210,141,18,208,173,10,210,141,25,208,1239
3630 DATA 141,20,208,141,21,208,173,10,210,141,19,208,9,16,141,1,6120
3640 DATA 210,165,20,197,163,240,205,202,16,198,32,13,39,198,196,208,2513
3650 DATA 5,104,104,76,226,35,206,226,27,32,36,38,32,163,47,165,6527
3660 DATA 238,208,3,32,226,55,76,174,54,169,0,162,223,202,157,0,37
3670 DATA 21,157,0,22,157,0,23,208,244,96,32,163,47,166,157,224,1041
3680 DATA 2,144,13,165,156,16,1,232,224,64,144,5,169,0,133,217,9372
3690 DATA 96,189,62,49,133,217,170,224,16,176,46,165,165,56,253,126,2625
3700 DATA 49,141,2,208,169,0,141,10,208,134,164,138,74,133,163,169,1426
3710 DATA 183,56,229,163,56,229,208,168,189,22,50,170,189,142,49,153,1937
3720 DATA 0,22,200,232,198,164,16,244,96,224,22,176,99,138,56,233,2575
3730 DATA 16,170,134,168,165,165,56,253,38,50,141,2,208,24,105,8,6551
3740 DATA 141,3,208,169,0,141,10,208,141,11,208,189,50,50,56,229,9556
3750 DATA 208,168,189,44,50,133,166,189,201,50,170,189,56,50,240,28,682
3760 DATA 153,0,23,134,163,162,0,134,167,166,166,74,38,167,202,16,9372
3770 DATA 250,166,163,165,167,153,0,22,200,232,208,223,166,168,165,165,6139
3780 DATA 56,253,186,51,72,188,180,51,189,192,51,170,104,76,18,49,7952
3790 DATA 138,56,233,22,170,134,168,189,207,50,141,11,208,189,215,50,2590
3800 DATA 141,12,208,189,211,50,141,10,208,165,165,56,253,223,50,141,3193
3810 DATA 7,208,24,125,219,50,141,6,208,125,219,50,141,5,208,125,389
3820 DATA 219,50,141,4,208,125,227,50,141,2,208,125,231,50,141,3,9300
3830 DATA 208,188,164,51,189,235,50,56,229,208,170,185,239,50,240,31,4397
3840 DATA 133,164,185,240,50,157,0,19,185,241,50,157,0,22,185,242,624
3850 DATA 50,157,0,23,232,198,164,208,233,200,200,200,200,208,220,136,9151
3860 DATA 136,136,136,185,239,50,240,31,133,164,185,240,50,157,0,19,9743
3870 DATA 185,241,50,157,0,22,185,242,50,157,0,23,232,224,223,240,4311
3880 DATA 6,198,164,208,229,240,216,166,168,188,168,51,165,165,24,125,3698
3890 DATA 172,51,72,189,176,51,170,104,141,1,208,173,194,2,24,105,8577
3900 DATA 2,141,19,208,141,193,2,134,164,152,56,229,208,168,169,0,1973
3910 DATA 141,9,208,189,22,50,170,189,142,49,153,0,21,200,232,198,1733
3920 DATA 164,16,244,96,0,0,25,24,23,22,21,20,19,18,17,16,7507
3930 DATA 15,14,13,12,11,10,10,9,9,8,8,7,7,7,6,6,5025
3940 DATA 6,6,5,5,5,5,5,4,4,4,4,4,3,3,3,3,4457
3950 DATA 3,2,2,2,2,2,2,1,1,1,1,1,1,0,0,0,4070
3960 DATA 0,0,0,0,5,5,4,4,5,5,4,4,5,5,4,4,4521
3970 DATA 5,5,4,4,8,8,8,24,24,24,24,24,24,24,8,28,6573
3980 DATA 28,28,8,8,28,28,28,28,8,24,24,60,60,60,24,24,8508
3990 DATA 24,24,60,60,60,60,24,24,8,28,28,62,62,62,28,28,9448
4000 DATA 8,8,28,28,62,62,62,62,28,28,8,24,60,60,126,126,2266
4010 DATA 126,126,126,60,60,24,24,60,60,126,126,126,126,126,126,60,7048
4020 DATA 60,24,28,62,62,127,127,127,127,127,127,127,62,62,28,28,5313
4030 DATA 62,62,127,127,127,127,127,127,127,127,62,62,28,24,60,126,5862
4040 DATA 126,255,255,255,255,255,255,255,126,126,60,24,24,60,126,126,1491
4050 DATA 126,255,255,255,255,255,255,126,126,126,60,24,0,1,3,6,5566
4060 DATA 10,15,21,28,36,45,55,66,78,91,105,120,9,8,9,8,337
4070 DATA 8,8,6,7,6,7,7,7,175,174,173,171,170,167,192,224,2599
4080 DATA 224,240,240,240,248,248,248,248,248,240,240,240,224,224,192,0,1992
4090 DATA 192,224,224,240,240,240,248,248,248,248,248,248,248,240,240,240,7162
4100 DATA 224,224,192,0,128,224,240,240,248,248,248,252,252,252,252,252,6012
4110 DATA 252,252,248,248,248,240,240,224,128,0,128,224,224,240,240,248,1842
4120 DATA 248,248,252,252,252,252,252,252,252,252,248,248,248,240,240,224,7440
4130 DATA 224,128,0,128,224,240,248,248,252,252,252,254,254,254,254,254,6742
4140 DATA 254,254,254,254,254,254,252,252,252,248,248,240,224,128,0,128,362
4150 DATA 240,248,248,252,252,254,254,254,254,255,255,255,255,255,255,255,8723
4160 DATA 255,255,255,255,255,254,254,254,254,252,252,248,248,240,128,0,2377
4170 DATA 18,38,60,85,113,0,0,0,1,0,0,1,1,0,0,0,5383
4180 DATA 85,2,2,2,4,13,12,16,24,2,2,2,4,8,8,16,5415
4190 DATA 16,165,160,152,136,0,0,0,0,1,0,62,0,1,0,127,9104
4200 DATA 0,1,0,255,128,1,1,255,192,2,3,255,224,3,7,255,9895
4210 DATA 240,4,15,255,248,6,31,255,252,0,0,0,0,1,0,126,3354
4220 DATA 0,1,0,255,0,1,1,255,128,1,3,255,192,1,7,255,8245
4230 DATA 224,2,15,255,240,2,31,255,248,3,63,255,252,5,127,255,4338
4240 DATA 254,7,255,255,255,0,0,0,0,1,0,24,0,1,0,60,8840
4250 DATA 0,2,0,126,0,1,0,255,0,1,1,255,128,2,3,255,5702
4260 DATA 192,2,7,255,224,3,15,255,240,3,31,255,248,3,63,255,2662
4270 DATA 252,6,127,255,254,7,255,255,255,0,0,0,0,1,0,60,4341
4280 DATA 0,1,0,126,0,2,0,255,0,2,1,255,128,2,3,255,5746
4290 DATA 192,3,7,255,224,3,15,255,240,4,31,255,248,5,63,255,2732
4300 DATA 252,10,127,255,254,15,255,255,255,0,4,40,84,136,171,167,2210
4310 DATA 160,151,255,0,1,2,9,11,13,15,179,178,177,176,175,173,235
4320 DATA 3,3,3,3,2,1,2,3,4,5,6,7,169,97,56,229,2699
4330 DATA 157,133,163,41,7,170,165,163,74,74,74,168,189,217,52,141,1687
4340 DATA 219,32,141,220,32,189,226,52,141,211,32,141,212,32,132,171,2561
4350 DATA 162,23,169,31,153,184,27,157,160,27,202,136,16,246,164,171,2915
4360 DATA 169,27,157,161,27,169,26,153,184,27,169,0,153,185,27,157,9534
4370 DATA 160,27,202,200,192,15,144,244,165,159,24,105,32,42,42,42,6905
4380 DATA 41,3,170,208,19,165,159,24,105,32,201,54,144,4,162,1,6657
4390 DATA 208,6,201,12,176,2,162,3,188,235,52,185,243,52,160,3,480
4400 DATA 153,164,27,136,16,250,188,239,52,185,243,52,160,3,153,200,3546
4410 DATA 27,136,16,250,166,157,165,156,16,1,232,224,6,144,58,162,882
4420 DATA 0,32,152,52,74,102,150,133,151,32,24,39,32,31,41,169,4824
4430 DATA 127,24,101,143,133,241,162,1,32,152,52,133,151,32,24,39,6104
4440 DATA 32,31,41,169,64,56,229,143,133,174,96,169,3,164,174,153,2150
4450 DATA 255,18,153,0,19,153,1,19,96,169,0,133,174,96,165,159,9147
4460 DATA 133,149,165,158,133,148,224,1,240,6,32,147,40,76,173,52,8494
4470 DATA 32,154,40,165,142,133,148,165,143,133,149,165,156,133,150,165,4470
4480 DATA 157,74,102,150,74,102,150,96,24,105,32,201,64,176,13,133,8140
4490 DATA 149,165,158,162,6,70,149,106,202,208,250,96,169,0,96,0,9869
4500 DATA 1,3,7,15,31,63,127,255,0,128,192,224,240,248,252,254,8566
4510 DATA 255,1,1,0,0,1,2,2,1,224,0,227,162,47,169,0,5078
4520 DATA 157,160,27,202,16,250,96,32,12,38,169,0,162,223,202,157,1511
4530 DATA 0,19,208,250,141,12,208,165,186,16,12,165,174,240,8,165,2073
4540 DATA 241,141,4,208,32,133,52,32,1,47,32,94,53,32,61,46,2232
4550 DATA 32,70,44,165,186,16,30,32,157,54,32,102,53,32,198,51,5458
4560 DATA 173,252,2,201,33,208,14,164,19,32,36,38,173,0,211,201,8843
4570 DATA 255,240,249,132,19,169,255,141,252,2,173,31,208,201,7,240,4628
4580 DATA 166,76,226,35,165,159,32,194,52,133,165,96,165,172,240,27,2621
4590 DATA 165,138,73,15,133,163,165,157,74,74,56,229,163,24,105,2,8196
4600 DATA 201,2,144,12,16,5,173,194,2,208,2,169,15,133,201,96,8914
4610 DATA 230,237,169,0,32,135,52,32,36,38,32,246,52,133,137,133,8140
4620 DATA 234,169,255,133,138,32,170,46,169,30,133,239,173,194,2,133,2204
4630 DATA 199,32,180,47,32,94,53,169,135,56,229,208,168,185,0,19,9936
4640 DATA 45,10,210,153,0,19,185,0,21,45,10,210,153,0,21,185,5889
4650 DATA 0,22,45,10,210,153,0,22,185,0,23,45,10,210,153,0,4836
4660 DATA 23,200,192,223,144,215,165,239,74,170,133,163,144,4,169,0,1876
4670 DATA 240,6,165,199,41,240,5,163,160,2,153,193,2,153,19,208,437
4680 DATA 136,16,247,138,9,128,141,1,210,138,74,9,128,141,5,210,9214
4690 DATA 169,128,141,0,210,141,4,210,32,70,44,165,157,201,2,176,295
4700 DATA 6,169,2,133,157,133,156,198,239,240,6,32,12,38,76,171,9406
4710 DATA 53,32,36,38,32,13,39,165,238,208,29,32,226,55,165,187,1018
4720 DATA 201,5,144,10,169,6,141,19,31,104,104,76,226,35,230,187,668
4730 DATA 238,251,27,230,196,238,226,27,248,173,10,210,41,112,240,248,6938
4740 DATA 24,101,190,133,190,165,191,101,187,133,191,165,192,105,0,133,3341
4750 DATA 192,216,162,2,160,0,181,190,32,19,38,153,215,27,153,157,167
4760 DATA 38,200,165,163,153,215,27,153,157,38,200,202,16,232,76,174,3610
4770 DATA 54,173,10,210,41,240,201,176,240,247,9,6,141,194,2,141,2136
4780 DATA 195,2,96,165,238,208,3,76,220,56,201,1,208,3,76,57,8555
4790 DATA 57,76,21,55,169,45,133,186,165,237,197,236,144,3,76,199,3908
4800 DATA 55,173,10,210,197,213,176,3,76,237,55,165,213,24,105,10,69
4810 DATA 133,213,169,0,133,180,133,181,164,187,173,10,210,41,3,201,1934
4820 DATA 3,240,247,133,188,201,2,240,17,169,1,190,169,55,44,10,8577
4830 DATA 210,48,3,32,92,40,133,181,134,180,32,139,54,165,188,208,2538
4840 DATA 4,192,2,176,8,173,10,210,41,31,56,233,15,133,159,32,7811
4850 DATA 13,39,169,0,133,158,169,2,133,238,96,164,187,165,156,56,2838
4860 DATA 249,163,55,133,156,165,157,233,1,133,157,165,188,240,67,165,5360
4870 DATA 159,16,3,32,157,55,217,175,55,144,31,165,188,201,1,240,2601
4880 DATA 9,190,187,55,185,193,55,76,73,55,190,169,55,169,1,36,8123
4890 DATA 159,48,3,32,92,40,134,180,133,181,165,188,201,2,208,18,1487
4900 DATA 165,159,16,3,32,157,55,217,181,55,176,6,169,0,133,180,9925
4910 DATA 133,181,165,158,24,101,180,133,158,165,159,101,181,133,159,169,4919
4920 DATA 4,141,8,210,169,96,24,101,157,141,0,210,56,233,1,141,71
4930 DATA 4,210,169,96,56,229,157,74,74,74,9,160,141,1,210,141,268
4940 DATA 5,210,96,73,255,24,105,1,96,40,56,72,80,104,112,0,5027
4950 DATA 0,32,64,64,64,8,12,16,16,16,16,4,6,8,12,15,7180
4960 DATA 15,128,192,216,0,128,0,0,0,1,1,2,2,32,237,55,2393
4970 DATA 185,220,55,133,189,169,255,133,231,133,159,133,235,169,0,133,5403
4980 DATA 238,96,6,5,4,3,3,3,169,12,133,236,169,0,133,237,9451
4990 DATA 133,208,96,32,139,54,164,187,173,10,210,41,15,24,121,178,9271
5000 DATA 56,133,189,169,0,133,19,133,156,133,158,169,75,133,157,173,3020
5010 DATA 10,210,133,159,32,39,56,32,74,56,32,127,56,169,1,133,5856
5020 DATA 238,169,3,133,228,165,213,56,233,10,133,213,96,173,10,210,3602
5030 DATA 41,128,133,210,164,187,173,10,210,57,190,56,217,196,56,176,4242
5040 DATA 245,133,180,169,0,133,181,173,10,210,57,184,56,133,211,96,2532
5050 DATA 173,10,210,41,128,133,209,164,187,173,10,210,57,214,56,133,2998
5060 DATA 179,173,10,210,57,184,56,133,212,192,4,144,10,165,238,240,4750
5070 DATA 6,169,0,133,179,160,3,173,10,210,57,202,56,217,208,56,2229
5080 DATA 176,245,133,178,96,164,187,173,10,210,57,153,56,24,105,1,8322
5090 DATA 133,230,185,159,56,133,231,32,165,56,169,0,133,229,96,255,4184
5100 DATA 127,255,127,63,31,1,1,0,0,0,0,169,0,162,143,157,5491
5110 DATA 0,21,232,224,223,144,248,96,15,13,11,9,7,6,255,255,9801
5120 DATA 127,127,127,127,63,127,127,255,255,255,64,96,128,160,192,255,7961
5130 DATA 127,127,255,255,63,63,96,128,192,255,32,64,0,0,0,0,5083
5140 DATA 1,1,165,169,208,9,173,194,2,24,105,16,32,150,54,164,7726
5150 DATA 217,185,77,59,133,149,169,0,133,148,133,151,230,235,165,235,7413
5160 DATA 201,50,144,4,169,0,133,235,201,25,144,4,169,49,229,235,3334
5170 DATA 170,189,103,59,141,0,210,56,233,4,141,4,210,169,96,141,1414
5180 DATA 8,210,165,217,74,24,105,2,9,32,141,1,210,141,5,210,8339
5190 DATA 189,52,59,133,150,32,24,39,32,31,41,165,143,133,208,164,108
5200 DATA 187,165,229,208,32,165,19,197,189,144,26,169,255,133,230,165,6817
5210 DATA 156,56,249,163,55,133,156,165,157,233,1,133,157,165,238,240,7473
5220 DATA 3,32,121,55,96,198,211,208,15,165,238,208,8,165,235,240,7357
5230 DATA 4,230,211,208,3,32,39,56,165,159,16,3,32,157,55,217,8285
5240 DATA 6,59,144,8,165,159,41,128,73,128,133,210,198,212,208,15,3740
5250 DATA 165,238,208,8,165,235,240,4,230,212,208,3,32,74,56,165,1940
5260 DATA 157,197,228,176,4,169,0,240,7,217,12,59,144,4,169,128,9737
5270 DATA 133,209,198,230,208,6,165,231,240,9,198,231,169,3,133,228,6496
5280 DATA 76,152,58,230,230,165,229,208,32,169,15,133,228,133,234,197,7388
5290 DATA 157,176,237,165,157,133,225,165,156,133,224,165,158,133,222,165,8712
5300 DATA 159,133,223,133,232,169,40,133,229,198,229,208,9,32,165,56,3436
5310 DATA 32,127,56,76,152,58,165,234,240,4,198,234,9,128,141,5,1493
5320 DATA 210,169,10,141,4,210,166,226,224,1,240,11,165,232,24,105,2943
5330 DATA 64,16,4,138,73,2,170,134,183,169,64,133,182,165,224,133,4430
5340 DATA 218,165,225,133,219,165,222,133,220,165,223,133,221,165,232,24,8524
5350 DATA 105,64,41,128,32,25,45,165,218,133,224,165,219,133,225,165,6623
5360 DATA 220,133,222,165,221,133,223,32,194,52,133,233,165,225,16,4,3016
5370 DATA 169,1,133,225,201,96,144,13,32,165,56,169,0,133,229,32,9924
5380 DATA 127,56,76,152,58,201,64,176,53,74,74,32,157,55,24,105,7073
5390 DATA 15,170,160,2,217,43,59,176,3,136,16,248,165,233,56,249,4167
5400 DATA 46,59,141,1,208,185,49,59,141,9,208,169,15,141,193,2,9727
5410 DATA 141,19,208,169,21,133,129,169,0,133,128,32,183,46,165,209,2011
5420 DATA 240,16,165,156,56,229,178,133,156,165,157,229,179,133,157,76,6064
5430 DATA 185,58,165,156,24,101,178,133,156,165,157,101,179,133,157,165,5063
5440 DATA 210,240,16,165,158,56,229,180,133,158,165,159,229,181,133,159,7557
5450 DATA 76,218,58,165,158,24,101,180,133,158,165,159,101,181,133,159,4763
5460 DATA 165,238,240,39,198,216,16,35,166,215,165,217,74,9,96,141,2502
5470 DATA 1,210,169,64,141,8,210,189,18,59,141,0,210,189,30,59,9462
5480 DATA 133,216,232,224,12,144,2,162,0,134,215,96,24,32,40,48,6856
5490 DATA 64,96,70,75,80,85,90,95,150,130,135,150,145,160,130,135,2726
5500 DATA 150,130,140,145,3,2,3,4,3,4,5,4,2,3,4,2,7320
5510 DATA 0,0,13,15,4,8,16,0,1,3,0,56,72,89,102,114,2036
5520 DATA 125,135,145,154,162,170,177,185,191,198,205,211,217,223,229,235,3139
5530 DATA 240,246,251,3,4,8,10,12,14,16,20,26,30,33,36,39,95
5540 DATA 42,45,48,51,57,60,66,72,78,85,100,120,110,240,232,224,3649
5550 DATA 216,208,200,192,184,176,168,160,152,144,136,128,120,112,108,104,4234
5560 DATA 100,96,94,92,92,92,0,224,2,225,2,226,35,0,0,0,4763

Listing 2.
BASIC listing.

10 REM *** DEATHZONE ***
20 REM CASSETTE MAKER PROGRAM
40 DIM DAT(16):LINE=990:RESTORE 1000:TRAP 120:? "CHECKING DATA"
50 LINE=LINE+10:? "LINE:";LINE:FOR X=1 TO 16:READ DAT:IF DAT<0 OR DAT>255 THEN 220
60 DAT(X)=DAT:NEXT X:DATLIN=PEEK(183)+PEEK(184)*256:IF DATLIN<>LINE THEN ? "LINE ";LINE;" MISSING!":END
70 TOTAL=LINE:FOR K=1 TO 16
80 IF PASS=2 THEN PUT #1,DAT(X):NEXT X:READ CHKSUM:GOTO 50
90 TOTAL=TOTAL+DAT(X)*X:IF TOTAL>9999 THEN TOTAL=TOTAL−10000
100 NEXT X:READ CHKSUM:IF TOTAL=CHKSUM THEN 50
110 GOTO 220
120 IF PEEK(195)<>6 THEN 226
130 IF PASS=0 THEN 200
160 FOR X=1 TO 128:PUT #1,0:NEXT X:CLOSE #1:END
200 ? "READY CASSETTE AND PRESS RETURN";:OPEN #1,8,128,"C:":RESTORE 230:FOR X=1 TO 40:READ N:PUT #1,N:NEXT X
210 ? :? "WRITING FILE":PASS=2:LINE=990:RESTORE 1000:TRAP 120:GOTO 50
220 ? "BAD DATA: LINE ";LINE:END
230 DATA 0,58,210,30,249,30,169,0,234,234,234,169,60,141,2,211,169,0,141,231,2,133,14,169,64,141,232,2
240 DATA 133,15,169,226,133,10,169,35,133,11,24,96

Listing 3.
Assembly listing.

;Deathzone
;
         .LI OFF
;
PMAREA   .EQ $1000
CHAR.SET .EQ $2000
         .OR $80
;
;Equates.
;
RTCLOCK  .EQ $12
ATRACT   .EQ $4D
;
VDSLST   .EQ $200
SDMCTL   .EQ $22F
SDLSTL   .EQ $230
GPRIOR   .EQ $26F
PCOLOR0  .EQ $2C0
PCOLOR1  .EQ $2C1
PCOLOR2  .EQ $2C2
PCOLOR3  .EQ $2C3
COLOR0   .EQ $2C4
COLOR1   .EQ $2C5
COLOR2   .EQ $2C6
COLOR3   .EQ $2C7
COLOR4   .EQ $2C8
CHACT    .EQ $2F3
CHBAS    .EQ $2F4
CH       .EQ $2FC
;
GTIA     .EQ $D000
HPOSP0   .EQ GTIA+0
HPOSP1   .EQ GTIA+1
HPOSP2   .EQ GTIA+2
HPOSP3   .EQ GTIA+3
HPOSM0   .EQ GTIA+4
HPOSM1   .EQ GTIA+5
HPOSM2   .EQ GTIA+6
HPOSM3   .EQ GTIA+7
SIZEP0   .EQ GTIA+8
M0PL     .EQ GTIA+8
SIZEP1   .EQ GTIA+9
M1PL     .EQ GTIA+9
SIZEP2   .EQ GTIA+$A
M2PL     .EQ GTIA+$A
SIZEP3   .EQ GTIA+$B
M3PL     .EQ GTIA+$B
SIZEM    .EQ GTIA+$C
P0PL     .EQ GTIA+$C
TRIG0    .EQ GTIA+$10
COLPM0   .EQ GTIA+$12
COLPM1   .EQ GTIA+$13
COLPM2   .EQ GTIA+$14
COLPM3   .EQ GTIA+$15
COLPF0   .EQ GTIA+$16
COLPF1   .EQ GTIA+$17
COLPH2   .EQ GTIA+$18
COLPH3   .EQ GTIA+$19
COLBK    .EQ GTIA+$1A
PRIOR    .EQ GTIA+$1B
GRACTL   .EQ GTIA+$1D
HITCLR   .EQ GTIA+$1E
CONSOL   .EQ GTIA+$1F
;
POKEY    .EQ $D200
AUDF1    .EQ POKEY+0
AUDC1    .EQ POKEY+1
AUDF2    .EQ POKEY+2
AUDC2    .EQ POKEY+3
AUDF3    .EQ POKEY+4
AUDC3    .EQ POKEY+5
AUDF4    .EQ POKEY+6
AUDC4    .EQ POKEY+7
AUDCTL   .EQ POKEY+8
RANDOM   .EQ POKEY+$A
IRQEN    .EQ POKEY+$E
SKCTL    .EQ POKEY+$F
;
PIA      .EQ $D300
PORTA    .EQ PIA+0
;
ANTIC    .EQ $D400
DMACTL   .EQ ANTIC+0
HSCROL   .EQ ANTIC+4
PMBASE   .EQ ANTIC+7
CHBASE   .EQ ANTIC+9
WSYNC    .EQ ANTIC+$A
NMIEN    .EQ ANTIC+$E
;
CIOV     .EQ $E456
SETVBV   .EQ $E45C
SYSVBV   .EQ $E45F
XITVBV   .EQ $E462
COLDSV   .EQ $E477
;
;
;Working Variables.
;
TO       .BS 2
S.HSCROL .BS 1
INTS.DIR .BS 1
INTS.POS .BS 1
INTS.DEL .BS 1
REPEAT   .BS 1
ITEMS    .BS 1
S.REPEAT .BS 1
FIREC1   .BS 1
BULLET   .BS 1
DLY      .BS 1
RESLO    .BS 2
RESHI    .BS 2
TEMP1    .BS 2
TEMP2    .BS 2
MATH1    .BS 2
MATH2    .BS 2
MTEMP    .BS 2
MSIGN    .BS 1
HOLD     .BS 1
R        .BS 2
THETA    .BS 2
FBFLAG   .BS 1
SINETHETA .BS 2
TEMP     .BS 1
COUNT    .BS 1
XPOS     .BS 1
SHRPT    .BS 1
BYTE     .BS 1
XSTORE   .BS 1
VBCOUNT  .BS 1
DLI2COUNT .BS 1
YTEMP    .BS 1
S.PPL    .BS 1
TIME     .BS 1
YSCAN    .BS 1
TCOUNT   .BS 1
COLUP    .BS 1
COLDOWN  .BS 1
EN.D.R   .BS 2
EN.D.T   .BS 2
DELTAR   .BS 2
TEMPR    .BS 2
TIMER    .BS 1
LEVEL    .BS 1
ENFLAG   .BS 1
E.TIME   .BS 1
SCORE    .BS 3
HISCORE  .BS 3
LIVES    .BS 1
COLOUR   .BS 1
LAST.DIR .BS 1
PCOL     .BS 1
P0.POS   .BS 1
PCOL.DLI .BS 1
SUNSET   .BS 1
PSIZ.DLI .BS 1
EXPLFG   .BS 1
EX.COUNT .BS 1
EXP.RPT  .BS 1
Y.HOLD   .BS 1
JUMP     .BS 1
R.DIR    .BS 1
T.DIR    .BS 1
T.TIME   .BS 1
R.TIME   .BS 1
PROB     .BS 1
RTSAVE   .BS 1
SNDPTR   .BS 1
S.DELAY  .BS 1
SPHKIND  .BS 1
WORK.R   .BS 2
WORK.THETA .BS 2
EB.THETA .BS 2
EB.R     .BS 2
EB.D.R   .BS 1
EB.D.T   .BS 1
MINR     .BS 1
SETFLAG  .BS 1
F.TIME   .BS 2
DIR      .BS 1
EB.XPOS  .BS 1
FIREC2   .BS 1
BOUNCE   .BS 1
NECC     .BS 1
DEAD     .BS 1
KFLAG    .BS 1
EXPTIM   .BS 1
LMSCHG   .BS 1
SCANPOS  .BS 1
;
INTS.DELAY .EQ $1
HORIZON  .EQ $B7
M        .EQ PMAREA+$300
P0       .EQ PMAREA+$400
P1       .EQ PMAREA+$500
P2       .EQ PMAREA+$600
P3       .EQ PMAREA+$700
TSCREEN  .EQ PMAREA+$B00
GROUND   .EQ PMAREA+$200
MOUNTAIN .EQ PMAREA+$C00
SCANLINE .EQ TSCREEN+140+20
C.SCORE  .EQ SCANLINE+48+7
C.LIVES  .EQ C.SCORE+11
C.LEVEL  .EQ SCANLINE+48+43
CHAR22   .EQ CHAR.SET+688
CHARL    .EQ CHAR.SET+216
CHARR    .EQ CHARL-8
YOUR.D.R .EQ $100
BULL.DELAY .EQ 2
OSCAN    .EQ 64
YOUR.D.T .EQ $80

         .OR $1F00
         .TF "D:DZONE.OBJ"
;
;=======================
;Title page display list
;=======================
;
TDLIST   .HS 7070707070F047
         .DA TSCREEN
         .HS 07700270700670700270
ACE      .HS 7041
         .DA TDLIST
;
;===========================
;Compressed data for the
;mountains.
;===========================
;
MTAIN.DATA
         .HS 00974F504C4D4E00CB
         .HS 4F504C4D4E009841
         .HS 42434445464748
         .HS 00894F50854C4D4E
         .HS 008F4F50530088494A
         .HS 4B4546474800864F
         .HS 504C4D4E00894142
         .HS 4344454647480089
         .HS 4F50854C4D4E008F
         .HS 4F504142434488
         .HS 4546474800834F50
         .HS 8A4C4D4E414243
         .HS 44515200844F5083
         .HS 530084494A4B8745
         .HS 4647484F50854C
         .HS 4D4E008241424344
         .HS 884546474800834F
         .HS 508A4C4D4E4142
         .HS 4344515200844F50
         .HS 820E8F4554508B
         .HS 01020304865152
         .HS 4F508653494A4B
         .HS 8E05060708864C
         .HS 550E8F4554508B
         .HS 01020304865152
         .HS 4F50850C0D0E8B
         .HS 0F1C8C048C1D1E
         .HS 84090A0B9E0C0D
         .HS 0E8B0F1C8C048C
         .HS 1D1EB01DCF1D83
LEN.MTN  .EQ *-MTAIN.DATA-1
         .BS CHAR.SET-*
;
;==========================
;Character set data
;==========================
;
CSET     .HS 0000000000000000
         .HS 5555555555555AA5
         .HS 555555555AA55555
         .HS 55555AA555555555
         .HS 5AA5555555555555
         .HS A55A555555555555
         .HS 5555A55A55555555
         .HS 55555555A55A5555
         .HS 555555555555A55A
         .HS 5555555555566995
         .HS 5555555669955555
         .HS 5669955555555555
         .HS 9569565555555555
         .HS 5555559569565555
         .HS 5555555555956956
         .HS 5555555556596595
         .HS 003C666E76663C00
         .HS 0018381818187E00
         .HS 003C660C18307E00
         .HS 007E0C180C663C00
         .HS 000C1C3C6C7E0C00
         .HS 007E607C06663C00
         .HS 003C607C66663C00
         .HS 007E060C18303000
         .HS 003C663C66663C00
         .HS 003C663E060C3800
         .HS 000000F0F0000000
         .HS 0000000F0F000000
         .HS 5659659555555555
         .HS 9565595655555555
         .HS 5555555595655956
         .HS 000000FFFF000000
         .HS 00003F3F3C3C3C3C
         .HS 0000C0E0F0783C1C
         .HS 3C3C3C3C3F3F0000
         .HS 1C3C78F0E0C00000
         .HS 00003F3F3C3C3F3F
         .HS 0000FCFC0000F0F0
         .HS 3C3C3C3C3F3F0000
         .HS 00000000FCFC0000
         .HS 000103070F1E3C3C
         .HS 0080C0E0F0783C3C
         .HS 3C3C3F3F3C3C0000
         .HS 3C3CFCFC3C3C0000
         .HS 00003F3F03030303
         .HS 0000FCFCC0C0C0C0
         .HS 0303030303030000
         .HS C0C0C0C0C0C00000
         .HS 00003C3C3C3C3F3F
         .HS 00003C3C3C3CFCFC
         .HS 3C3C3C3C3C3C0000
         .HS 3C3C3C3C3C3C0000
         .HS 00003F3F00000103
         .HS 0000FCFC78F0E0C0
         .HS 070F1E3C3F3F0000
         .HS 80000000FCFC0000
         .HS 00000F1F3C3C3C3C
         .HS 0000F0F83C3C3C3C
         .HS 3C3C3C3C1F0F0000
         .HS 3C3C3C3CF8F00000
         .HS 00003C3E3F3F3F3F
         .HS 00003C3C3CBCFCFC
         .HS 3F3D3C3C3C3C0000
         .HS FCFCFC7C3C3C0000
         .HS 5555555555555555
         .HS 0000000000000AA5
         .HS 000000000AA55555
         .HS 00000AA555555555
         .HS 0AA5555555555555
         .HS A05A555555555555
         .HS 0000A05A55555555
         .HS 00000000A05A5555
         .HS 000000000000A05A
         .HS 0000000000022995
         .HS 0000000229955555
         .HS 0229955555555555
         .HS 8068565555555555
         .HS 0000008068565555
         .HS 0000000000806856
         .HS 0000000002092595
         .HS 0209259555555555
         .HS 8060585655555555
         .HS 0000000080605856
         .HS 8080606058585656
         .HS 0000A05A56596595
         .HS 0AA5956559565555
         .HS AAFFFFAAFFFFFFFF
         .HS FFFFAAFFFFFFFFFF
         .HS FFFFFFFFFFFFFFFF
         .HS FFAAFFFFFFFFFFFF
         .HS FFFFFFFFFFFFFFFF
         .HS FFFFFFFF7E181E00
         .HS 00183C7E18181800
         .HS 001818187E3C1800
         .HS 0018307E30180000
         .HS 00180C7E0C180000
         .HS 0818387838180800
         .HS 0060606060607E00
         .HS 003C603C06063C00
         .HS 10181C1E1C181000
;
;===========================
;Display list data
;===========================
;
D.LIST
         .HS 7070C2
         .DA SCANLINE
         .HS 8270
         .HS 607070707070
         .HS 7070F0F0F0D4
MT.LMS   .DA MOUNTAIN,#$D4
         .DA MOUNTAIN+$80,#$D4
         .DA MOUNTAIN+$100,#$54
         .DA MOUNTAIN+$180,#$54
         .DA MOUNTAIN+$200,#$D4
         .DA MOUNTAIN+$280,#$44
         .DA GROUND
         .HS 0484040441
         .DA D.LIST
;
;==========================
;Main screen Display List
;Interrupts to multiplex
;players and change colours
;==========================
;
NEWDLI
         PLA
         CLC
         ADC #1
         STA VDSLST
         PLA
         ADC #0
         STA VDSLST+1
         PLA
         RTI
;
DLI      PHA
         LDA #6
         STA WSYNC
         STA COLPF1
         LDA #$98
         STA SUNSET
         JSR NEWDLI
;
         PHA
         LDA #0
         STA COLPF1
         STA WSYNC
         LDA PCOLOR2
         STA COLPH3
         LDA SUNSET
         SEC
         SBC #$10
         STA COLBK
         STA SUNSET
         CMP #$38
         BEQ .1
         PLA
         RTI
.1       JSR NEWDLI
;
         PHA
         STA HITCLR
         LDA PSIZ.DLI
         STA WSYNC
         STA SIZEP0
         LDA P0.POS
         STA HPOSP0
         LDA PCOL.DLI
         STA COLPM0
         JSR NEWDLI
;
         PHA
         LDA #$B6
         STA WSYNC
         STA COLPF1
         LDA #$B2
         STA COLPH2
         LDA #0
         STA COLBK
         JSR NEWDLI
;
         PHA
         LDA #15
         STA COLPM0
         LDA #$78
         STA WSYNC
         STA HPOSP0
         LDA #1
         STA SIZEP0
         LDA M0PL
         ORA M3PL
         AND #1
         ORA P0PL
         AND #$0D
         STA S.PPL
         PLA
         RTI
;
;==========================
;Intro routine
;==========================
;
START
         CLD
         LDA #$40
         STA NMIEN
         LDA #6
         LDX /SYSVBV
         LDY #SYSVBV
         JSR SETVBV
;
         LDA /CHAR.SET
         STA CHBAS
         LDA #34
         STA SDMCTL
         LDA #0
         STA GRACTL
         LDX #4
NOPM     STA P0PL+1,X
         DEX
         BPL NOPM
;
         JSR NOSOUND
;
;==========================
;Clear out rubbish from
;player area, etc.
;==========================
;
ERASE.PLAYERS
         LDA /GROUND
         STA TO+1
         LDA #GROUND
         STA TO
         LDY #0
         LDX #13
         TYA
.1       STA (TO),Y
         INY
         BNE .1
         INC TO+1
         DEX
         BEQ ERADONE
         CPX #3
         BNE .1
         LDA #64
         BNE .1
;
ERADONE
         LDX #$FF
.1       INX
         LDY TMESS,X
         CPY #$FF
         BEQ .3
         INX
.2       LDA TMESS,X
         CMP #$9B
         BEQ .1
         STA TSCREEN,Y
         INY
         INX
         BNE .2
.3
         LDA #0
         STA COLOR2
         STA COLOR4
         STA S.HSCROL
         STA HSCROL
         STA LEVEL
         LDA #$11
         STA C.LEVEL
         JSR SETR
         LDA #$F
         STA COLOR1
         LDA #$36
         STA COLOR0
         LDA #62
         STA SDMCTL
         LDA /TDLIST
         STA SDLSTL+1
         LDA #TDLIST
         STA SDLSTL
         JSR DEBOUNCE
         LDA /TDLI
         STA VDSLST+1
         LDA #TDLI
         STA VDSLST
         LDA #$C0
         STA NMIEN
         LDA #$80
         STA PROB
;
         LDA #3
         STA LIVES
         ORA #$10
         STA C.LIVES
;
HIGHSCORE
         SED
         LDX #2
.1       LDA SCORE,X
         CMP HISCORE,X
         BCC NOTHIGH
         BNE HIGH
         DEX
         BPL .1
         BMI NOTHIGH
HIGH     LDX #2
.1       LDA SCORE,X
         STA HISCORE,X
         DEX
         BPL .1
NOTHIGH  CLD
;
         LDY #0
         LDX #2
.2       LDA HISCORE,X
         JSR SPLIT
         STA TSCREEN+93,Y
         LDA TEMP
         STA TSCREEN+94,Y
         INY
         INY
         DEX
         BPL .2
;
         LDA #0
         LDX #2
.3       STA SCORE,X
         DEX
         BPL .3
;
         LDA #8
         STA CONSOL
READ     LDA CONSOL
         CMP #6
         BEQ .3
         LDA TRIG0
         BNE READ
         JSR DEBOUNCE
.1       LDA TRIG0
         BEQ .1
         BNE EXPAND
.3       JSR DEBOUNCE
         LDA #8
         STA CONSOL
.4       LDA CONSOL
         CMP #6
         BEQ .4
;
;===========================
;Block in the mountains by
;expanding the data
;===========================
;
EXPAND
         LDA /MOUNTAIN
         STA TO+1
         LDA #MOUNTAIN
         STA TO
         LDX #0
         LDY #0
.0       LDA MTAIN.DATA,X
         BMI .1
         BNE .3
         INX
         LDA MTAIN.DATA,X
         AND #$7F
         TAY
         LDA #0
.4       STA (TO),Y
         DEY
         BPL .4
         LDA MTAIN.DATA,X
         INY
         BEQ .1
;
.3       STA (TO),Y
         LDA #1
.1       AND #$7F
         CLC
         ADC TO
         STA TO
         BCC .2
         INC TO+1
.2       INX
         CPX #LEN.MTN
         BCC .0
;
;============================
;Fill in the ground with one
;character repeated per line.
;============================
;
FILL.GROUND
         LDY #47
.1       LDA #22+$40
         CLC
         STA GROUND,Y
         ADC #1
         STA GROUND+$30,Y
         ADC #1
         STA GROUND+$60,Y
         ADC #1
         STA GROUND+$90,Y
         ADC #1
         STA GROUND+$C0,Y
         DEY
         BPL .1
;
;=========================
;Now set the alternate lines
;on the ground by altering
;the character set.
;=========================
;
INIT.GROUND
         STY COLOUR  Y=FF
         LDA #30
         STA COUNT
         LDA #0
         STA INTS.POS
FILLINTS LDA #1
         STA LAST.DIR
         JSR MOVE.INTS
         DEC COUNT
         BNE FILLINTS
;
;=========================
;Draw into player 0 the
;crosshair and central dot
;of the overhead scanner.
;=========================
;
DO.CROSSHAIR
         LDA #17
         STA YSCAN
         STA GPRIOR
         LDA #$0F
         STA PCOLOR0
         LDA #$FF
         STA BULLET
         STA P0+HORIZON-25
         STA P0+HORIZON+25
         LDA #$81
         STA P0+HORIZON-26
         STA P0+HORIZON+26
         LDA #1
         STA DLY
         STA SIZEP0
         LDA #$80-8
         STA HPOSP0
;
         LDX #4
         LDA #$18
SCANLP   STA P0+OSCAN-2,X
         DEX
         BPL SCANLP
;
;=========================
;Enable PMG, set colours
;and other variables etc.
;=========================
;
SET.SCREEN
         LDA #0
         STA SDMCTL
         STA CHACT
;
         LDA #$10
         LDY #6
.1       STA C.SCORE,Y
         STA TSCORES+2,Y
         DEY
         BPL .1
;
         LDX #'b
         STX C.SCORE-2
         DEX
         STX C.LIVES-2
         STX C.LEVEL-2
;
         JSR RESET
         LDA #3
         STA GRACTL
         LDA /PMAREA
         STA PMBASE
         LDA /CHAR.SET
         STA CHBAS
         LDA #$12
         STA COLOR0
         LDA #12
         STA COLOR1
         LDX /VBI
         LDY #VBI
         LDA #6
         JSR SETVBV
         LDA /DLI
         STA VDSLST+1
         LDA #DLI
         STA VDSLST
         LDA #192
         STA NMIEN
         LDA /D.LIST
         STA SDLSTL+1
         LDA #D.LIST
         STA SDLSTL
         LDA #63
         STA SDMCTL
         LDA #$70
         STA ACE
         LDA #$FF
         STA CH
         JSR CHOOSE
;
         JMP MAINLOOP
;
DEBOUNCE LDA RTCLOCK+2
.1       CMP RTCLOCK+2
         BEQ .1
         RTS
;
SPLIT    PHA
         AND #$0F
         ORA #$10
         STA TEMP
         PLA
         LSR
         LSR
         LSR
         LSR
         AND #$0F
         ORA #$10
         RTS
;
NOSOUND  LDA #3
         STA SKCTL
         LDA #0
         LDX #8
.1       STA AUDF1,X
         DEX
         BPL .1
         RTS
;
;===========================
;Title DLI
;===========================
;
TDLI     PHA
         TXA
         PHA
         TYA
         PHA
         LDY COLUP
         LDX COLDOWN
         LDA #31
         STA TCOUNT
.1       STA WSYNC
         STY COLPH2
         STX COLPH3
         INY
         INX
         DEC TCOUNT
         BPL .1
         INC COLUP
         DEC COLDOWN
         LDA #0
         STA COLPH2
         LDA #$E0
         STA CHBASE
         PLA
         TAY
         PLA
         TAX
         PLA
         RTI
;
;=========================
;Title messages
;=========================
;
TMESS    .DA #1
         .DA #96+$80
         .AT -"aDEhiLMpqTUxy\]de"
         .DA #$9B,#1+20
         .AT -"bcFGjkNOrsVWz"
         .DA #$80+123
         .AT -"^_fg"
         .DA #$9B,#20+13+20
         .AT "By S. Hillen"
         .DA #$9B,#20+40+20
TSCORES  .AT "L 0000000  H 0000000"
         .DA #$9B,#20+40+20+20+2
         .AT "   (C)  1986   Analog Computing   "
         .DA #$9B,#20+40+20+20+40+8
         .AT -"ace"
         .HS 9BFF
;
VBI
         LDA /DLI
         STA VDSLST+1
         LDA #DLI
         STA VDSLST
         LDA S.HSCROL
         STA HSCROL
         LDA LMSCHG
         JSR CHANGELMS
         LDA TIMER
         BMI NODEC
         DEC TIMER
NODEC
         INC VBCOUNT
         LDA VBCOUNT
         CMP #16
         BCC .1
         LDA CHACT
         EOR #2
         STA CHACT
         LDA #0
         STA VBCOUNT
         STA ATRACT
.1       JMP SYSVBV
;
;
SETR     LDA #95
         STA R+1
         STA EB.R+1
         STA R
         STA EB.R
         RTS

;
;  Maths routines
;
;    14/5/85
;  Updated 9/6/85
;
;  Storage in page 0
;
;  16 BIT MULTIPLY
;
;  MATH1 * MATH2
;
MULT16
         JSR SET.POS make both ops +ve
         LDX #16
MULT     ASL RESLO
         ROL RESLO+1
         ROL RESHI
         ROL RESHI+1
;
         ASL MATH1
         ROL MATH1+1
         BCC NO.ADD
;
         LDA MATH2
         CLC
         ADC RESLO
         STA RESLO
         LDA MATH2+1
         ADC RESLO+1
         STA RESLO+1
         BCC NO.ADD
;
         INC RESHI
;
NO.ADD   DEX
         BNE MULT
;
         JMP COMP.RES if needed
;
;16 BIT DIVIDE
;
; MATH1/MATH2
;
DIV16    JSR SET.POS
         LDA MATH1
         ORA MATH1+1
         BNE .1      math1<>0
         JMP RES01
;
.1       LDA MATH2
         ORA MATH2+1
         BNE .2      math2<>0
         JMP RESINF
;
.2       LDX #0
         STX TEMP1
         STX TEMP1+1
         STX TEMP2
         STX TEMP2+1
;
COMPARE  LDA MATH2
         SEC
         SBC MATH1
         STA HOLD
         LDA MATH2+1
         SBC MATH1+1
         BCS TWOGT
;
TIMES2   INX
         ASL MATH2
         ROL MATH2+1
         JMP COMPARE
;
;
TWOGT    ORA HOLD
         BNE .1
         JMP POWER2
;
.1       CPX #0
         BEQ ONLYREM
;
DIVIDE   LSR MATH2+1
         ROR MATH2
         LDA MATH1
         SEC
         SBC MATH2
         PHA
         LDA MATH1+1
         SBC MATH2+1
         PHA
;
         BCS OK
         PLA
         PLA
         BCC ITOVFLOW
;
OK       PLA
         STA MATH1+1
         PLA
         STA MATH1
         SEC
;
ITOVFLOW ROL RESHI
         ROL RESHI+1
         DEX
         BNE DIVIDE
;
;
ONLYREM
         LDX #16
DIVREM   LSR MATH2+1
         ROR MATH2
         ROR TEMP2+1
         ROR TEMP2
;
         LDA MATH1
         SEC
         SBC MATH2
         STA HOLD
         PHA
         LDA MATH1+1
         SBC MATH2+1
         PHA
         BCC TOTOBIG
;
         ORA HOLD
         BNE MUCHSMAL
;
         LDA TEMP1
         SEC
         SBC TEMP2
         PHA
         LDA TEMP1+1
         SBC TEMP2+1
         PHA
         BCC TOBIG
;
         PLA
         STA TEMP1+1
         PLA
         STA TEMP1
         PLA
         STA MATH1+1
         PLA
         STA MATH1
         SEC
         BCS CONTDIV
;
MUCHSMAL PLA
         STA MATH1+1
         PLA
         STA MATH1
         LDA TEMP1
         SEC
         SBC TEMP2
         STA TEMP1
         LDA TEMP1+1
         SBC TEMP2+1
         STA TEMP1+1
         BCS NOTOVFL
;
         LDA MATH1
         BNE .1
         DEC MATH1+1
.1       DEC MATH1
;
NOTOVFL  SEC
         BCS CONTDIV
;
TOBIG    PLA
         PLA
TOTOBIG  PLA
         PLA
         CLC
;
CONTDIV  ROL RESLO
         ROL RESLO+1
         DEX
         BNE DIVREM
;
SETSGN   JMP COMP.RES
;
POWER2   INX
         SEC
.1       ROL RESHI
         ROL RESHI+1
         DEX
         BNE .1
         BEQ SETSGN
;
RES01    LDA MATH2
         ORA MATH2+1
         BNE RES0
         INC RESHI
RES0     RTS
;
RESINF   LDX #$80
         LDY #0
         LDA MATH1+1
         EOR MATH2+1
         BMI STORE
;
         DEX
         DEY
STORE    STX RESHI+1
         STY RESHI
         RTS
;
SET.POS
         LDA MATH1+1
         EOR MATH2+1
         STA MSIGN
         LDA MATH1+1
         BPL .1
         LDX MATH1
         JSR COMPL16
         STX MATH1
         STA MATH1+1
;
.1       LDA MATH2+1
         BPL .2
         LDX MATH2
         JSR COMPL16
         STX MATH2
         STA MATH2+1
;
.2       LDA #0
         STA RESLO
         STA RESLO+1
         STA RESHI
         STA RESHI+1
         RTS
;
COMPL16
         STA MTEMP+1
         STX MTEMP
         LDA #0
         SEC
         SBC MTEMP
         TAX
         LDA #0
         SBC MTEMP+1
         RTS
;
COMP.RES
         LDA RESLO
         BPL .1
         INC RESLO+1
         BNE .1
         INC RESHI
         BNE .1
         INC RESHI+1
.1       LDA MSIGN
         BPL POS.RES
;
         LDY #0
         SEC
.2       LDA #0
         SBC RESLO,Y
         STA RESLO,Y
         INY
         CPY #$4
         BNE .2
;
POS.RES  RTS
;
         SEC
         SBC #0
         STA MATH1
SINE     LDA MATH1+1
         SEC
         SBC #$40
         STA MATH1+1
COSINE   LDA #0
         STA MSIGN
         LDA MATH1+1
         BPL .1
         LDX MATH1
         JSR COMPL16
         STX MATH1
         STA MATH1+1
;
.1       LDA MATH1+1
         AND #$C0
         BEQ LOOK.COS
;
         LDA #0
         SEC
         SBC MATH1
         STA MATH1
         LDA #$80
         SBC MATH1+1
         STA MATH1+1
         LDA #$FF
         STA MSIGN
;
LOOK.COS
         ASL MATH1
         ROL MATH1+1
         ROL MATH1
         ROL MATH1+1
         BCS ZRES
;
         ROL MATH1
         BCC NORDUP
         INC MATH1+1
         BEQ ZRES
;
NORDUP   LDX MATH1+1
         LDA COS.TABLE,X
         CLC
         ADC #$1
         STA RESHI
         LDA #0
         ADC #0
         STA RESHI+1
;
.0       LDA MSIGN
         BPL .1
;
         LDA RESHI+1
         LDX RESHI
         JSR COMPL16
         STX RESHI
         STA RESHI+1
;
.1       RTS
;
ZRES     LDA #0
         STA RESHI
         STA RESHI+1
         RTS
;
INVTAN
         LDA #0
         STA MSIGN
         LDX MATH1
         LDA MATH1+1
         BPL .1
         STA MSIGN
         JSR COMPL16
.1       LDA INV.TAN.HI,X
         PHA
         LDA INV.TAN.LO,X
         TAX
         PLA
         LDY MSIGN
         BPL .2
         JSR COMPL16
.2       STA RESHI+1
         STX RESHI
         RTS
;
SET256   LDX RESHI+1
         INX
         CPX #2
         BCS SET.INF
;
         DEX
         TXA
         EOR RESHI
         BMI SET.INF
;
         LDA RESHI
         STA RESHI+1
         LDA RESLO+1
         STA RESHI
         RTS
;
SET.INF  LDX #$7F
         LDY #$FF
         LDA RESHI+1
         BMI NEG.INF
;
SAVE     STX RESHI+1
         STY RESHI
         RTS
;
NEG.INF  INX
         INY
         BEQ SAVE
;
COS.TABLE
      .HS FFFFFFFFFFFFFFFFFF
      .HS FFFFFEFEFEFEFEFEFE
      .HS FDFDFDFDFDFCFCFCFC
      .HS FBFBFBFBFAFAFAF9F9
      .HS F9F8F8F8F7F7F7F6F6
      .HS F5F5F4F4F4F3F3F2F2
      .HS F1F1F0F0EFEEEEEDED
      .HS ECECEBEAEAE9E8E8E7
      .HS E6E6E5E4E4E3E2E2E1
      .HS E0DFDFDEDDDCDBDBDA
      .HS D9D8D7D6D6D5D4D3D2
      .HS D1D0CFCECECDCCCBCA
      .HS C9C8C7C6C5C4C3C2C1
      .HS C0BFBEBDBCBBB9B8B7
      .HS B6B5B4B3B2B1B0AEAD
      .HS ACABAAA9A7A6A5A4A3
      .HS A1A09F9E9C9B9A9997
      .HS 9695949291908F8D8C
      .HS 8B8988878584838180
      .HS 7F7D7C7A7978767574
      .HS 72716F6E6C6B6A6867
      .HS 65646261605E5D5B5A
      .HS 5857555452514F4E4C
      .HS 4B494846454342403F
      .HS 3D3C3A393736343231
      .HS 2F2E2C2B2928262523
      .HS 21201E1D1B1A181715
      .HS 1312100F0D0C0A0807
      .HS 05040201
;
INV.TAN.HI
      .HS 00000000000000010101010101020202
      .HS 02020203030303030303040404040404
      .HS 05050505050506060606060606070707
      .HS 07070708080808080808090909090909
      .HS 090A0A0A0A0A0A0B0B0B0B0B0B0B0C0C
      .HS 0C0C0C0C0C0D0D0D0D0D0D0D0E0E0E0E
      .HS 0E0E0E0F0F0F0F0F0F0F0F1010101010
      .HS 10101111111111111111121212121212
      .HS 12131313131313131314141414141414
      .HS 14141515151515151515161616161616
      .HS 16161617171717171717171718181818
      .HS 18181818181919191919191919191A1A
      .HS 1A1A1A1A1A1A1A1A1B1B1B1B1B1B1B1B
      .HS 1B1B1B1C1C1C1C1C1C1C1C1C1C1D1D1D
      .HS 1D1D1D1D1D1D1D1D1D1E1E1E1E1E1E1E
      .HS 1E1E1E1E1F1F1F1F1F1F1F1F1F1F1F1F
;
INV.TAN.LO
      .HS 0029517AA3CCF41D466F97C0E9113A62
      .HS 8BB4DC052D567EA7CFF720487099C1E9
      .HS 11396189B1D901295178A0C8EF173E66
      .HS 8DB5DC032A51789FC6ED143B6188AED5
      .HS FB22486E94BAE0062C51779DC2E70D32
      .HS 577CA1C6EB1034597DA2C6EA0F33567A
      .HS 9EC2E5092C507396B9DCFF21446789AB
      .HS CEF01234567799BBDCFD1F406182A3C3
      .HS E40525456686A6C6E60525446483A2C1
      .HS E0FF1E3D5B7A98B7D5F3112F4C6A88A5
      .HS C2E0FD1A3754708DAAC6E2FE1B37536E
      .HS 8AA6C1DDF8132E49647F9AB4CFE9041E
      .HS 38526C869FB9D3EC051F38516A839CB4
      .HS CDE5FE162E465E768EA6BED5ED041B33
      .HS 4A61788EA5BCD3E9FF162C42586E849A
      .HS B0C5DBF0061B30455A6F8499AEC3D7EC

;
;==========================
;Read the joystick and act
;accordingly!
;==========================
;
JOYSTICK
         LDA #1
         STA EB.D.R
         LDA PORTA
         CMP #$FF
         BNE .0
         LDA #0
         BEQ ENGINE
;
.0       AND #8
         BNE .1
         JSR RIGHT.MOVE
.1       LDA PORTA
         AND #4
         BNE .2
         JSR LEFT.MOVE
.2       LDA PORTA
         AND #2
         BNE .3
         JSR BACK.MOVE
         DEC EB.D.R
         JSR RESTORE
.3       LDA PORTA
         AND #1
         BNE .4
         JSR FWD.MOVE
         INC EB.D.R
         JSR RESTORE
.4       LDA #$50
         STA AUDF2
         LDA #$22
ENGINE   STA AUDC2
         RTS
;
;=========================
;Scroll mountains, move
;enemy and bullet to left
;=========================
;
LEFT.MOVE
         LDX S.HSCROL
         CPX #3
         BNE .1
         LDX #$FF
         LDY MT.LMS
         BNE .2
         LDY #80
.2       DEY
         STY LMSCHG
.1       INX
         STX S.HSCROL
         INC P0.POS
         INC P0.POS
;
         LDA /YOUR.D.T
         LDX #YOUR.D.T
         JMP ADDTHETA
;
;=========================
;Move mountains, enemy and
;bullet to right.
;=========================
;
RIGHT.MOVE
         LDX S.HSCROL
         BNE .1
         LDX #4
         LDY MT.LMS
         CPY #79
         BNE .2
         LDY #$FF
.2       INY
         STY LMSCHG
.1       DEX
         STX S.HSCROL
         DEC P0.POS
         DEC P0.POS
;
         LDA /YOUR.D.T
         LDX #YOUR.D.T
         JSR COMPL16
ADDTHETA STA TEMP
         BIT TIMER
         BPL .1
         TXA
         CLC
         ADC THETA
         STA THETA
         LDA THETA+1
         ADC TEMP
         STA THETA+1
         TXA
         CLC
         ADC EB.THETA
         STA EB.THETA
         LDA EB.THETA+1
         ADC TEMP
         STA EB.THETA+1
.1       RTS
;
CHANGELMS
         STA MT.LMS
         STA MT.LMS+6
         STA MT.LMS+12
         EOR #$80
         STA MT.LMS+3
         STA MT.LMS+9
         STA MT.LMS+15
NORCHG   RTS
;
;==========================
;Move forward, ie move lines
;down and calculate new R
;and theta for enemy.
;==========================
;
FWD.MOVE
         LDA #1
         JSR MOVE.INTS
         JSR SETDELTA
;
EN.FWD   LDA #0
         BEQ BKDSKIP
;
;==========================
;Move backward ie move lines
;up and calculate new R
;and theta for enemy.
;==========================
;
BACK.MOVE
         LDA #$FF
         JSR MOVE.INTS
         JSR SETDELTA
;
EN.BKD   LDA #$80
;
;==========================
;Now do the maths to find
;new R and new theta.
;==========================
;
BKDSKIP  STA FBFLAG
         BIT TIMER
         BPL NORCHG
         LDA WORK.THETA
         STA MATH1
         LDA WORK.THETA+1
         STA MATH1+1
         JSR COSINE
         JSR MULT.DELTA
;
INFRONT  LDA RESHI+1
         LDX RESHI
         BIT FBFLAG
         BMI .1
         JSR COMPL16
.1       STA TEMP
         TXA
         CLC
         ADC WORK.R
         STA WORK.R
         LDA TEMP
         ADC WORK.R+1
         STA WORK.R+1
;
;Now got R+-D.R*cos.th
;
ONWARD
         LDA WORK.THETA
         STA MATH1
         LDA WORK.THETA+1
         STA MATH1+1
         JSR SINE
         JSR MULT.DELTA
;
         LDA WORK.R
         STA MATH2
         LDA WORK.R+1
         STA MATH2+1
         LDA RESHI
         STA MATH1
         LDA RESHI+1
         STA MATH1+1
         JSR DIV16
         JSR SET256
;
;Done D.R*sin.th/R+-D.R*cos.th
;
         LDA RESHI
         STA MATH1
         LDA RESHI+1
         STA MATH1+1
         JSR INVTAN
;
         LDX RESHI
         LDA RESHI+1
;
;Just done arctan for phi
;
         BIT FBFLAG
         BPL .1
         JSR COMPL16
.1       STA TEMP
         TXA
         CLC
         ADC WORK.THETA
         STA WORK.THETA
         LDA WORK.THETA+1
         ADC TEMP
         STA WORK.THETA+1
;
NOWEXIT  RTS
;
SETDELTA LDA #YOUR.D.R
         STA DELTAR
         LDA /YOUR.D.R
         STA DELTAR+1
         LDA R
         STA WORK.R
         LDA R+1
         STA WORK.R+1
         LDA THETA
         STA WORK.THETA
         LDA THETA+1
         STA WORK.THETA+1
         RTS
;
RESTORE  LDA WORK.THETA
         STA THETA
         LDA WORK.THETA+1
         STA THETA+1
         LDA WORK.R
         STA R
         LDA WORK.R+1
         STA R+1
         RTS
;
MULT.DELTA
         LDA RESHI
         STA MATH1
         LDA RESHI+1
         STA MATH1+1
         LDA DELTAR
         STA MATH2
         LDA DELTAR+1
         STA MATH2+1
         JSR MULT16
         JSR SET256
         RTS
;
;==========================
;Move the black lines on
;the ground up or down.
;==========================
;
MOVE.INTS
         STA INTS.DIR
         CMP LAST.DIR
         BEQ NOEOR
         STA LAST.DIR
         LDA COLOUR
         EOR #$55
         STA COLOUR
         LDA #0
         STA INTS.DIR
;
NOEOR
         LDA INTS.POS
         CLC
         ADC INTS.DIR
         BMI .1
         CMP #20
         BCC .2
         LDA COLOUR
         EOR #$55
         STA COLOUR
         LDA #0
         BEQ .2
.1       LDA COLOUR
         EOR #$55
         STA COLOUR
         LDA #19
.2       STA INTS.POS
         TAX
         LDA COLOUR
         STA CHAR22+4+5+7+10,X
         EOR #$55
         TAY
         TXA
         LSR
         TAX
         TYA
         STA CHAR22+4+5+7,X
         TXA
         LSR
         TAX
         TYA
         STA CHAR22+4,X
;
         LDX #0
         LDA INTS.POS
DIV3     CMP #3
         BCC .1
         SBC #3
         INX
         BNE DIV3
.1       LDA COLOUR
         STA CHAR22+4+5,X
;
         LDX #0
         LDA INTS.POS
DIV5     CMP #5
         BCC .1
         SBC #5
         INX
         BNE DIV5
.1       LDA COLOUR
         STA CHAR22,X
         RTS
;
;=========================
;Fire a bullet if the
;trigger's pressed.
;=========================
;
FIRE
         DEC DLY
         BNE .1
         LDA #BULL.DELAY
         STA DLY
         LDA BULLET
         BPL DO.ALREADY
         LDA TRIG0
         BEQ FIRED
         JSR B.CLEAR
.1       RTS
;
FIRED    LDA #15
         STA BULLET
         LDA #3
         STA PSIZ.DLI
         LDA #$70
         STA P0.POS
         LDA #$10
         STA FIREC1
;
DO.ALREADY
         JSR B.CLEAR
;
         LDA BULLET
         TAX
         LSR
         CLC
         LDA #$F
         STA PCOL.DLI
;
         CPX #14
         BNE .1
         LDA #1
         STA PSIZ.DLI
         LDA P0.POS
         CLC
         ADC #8
         STA P0.POS
;
.1       CPX #12
         BNE NOISE1
         LDA #0
         STA PSIZ.DLI
         LDA P0.POS
         CLC
         ADC #4
         STA P0.POS
;
NOISE1
         LDA #2
         STA AUDF4
         LDY FIREC1
         BEQ .1
         DEY
         DEY
.1       STY FIREC1
         STY AUDC4
;
NEW.BULLET
         LDA /P0
         STA TO+1
         LDA #P0
         STA TO
         JSR BULLETLOAD
         DEC BULLET
;
FIRE.EXIT
         RTS
;
B.CLEAR  LDA #0
         LDY #HORIZON-24
.1       STA P0,Y
         INY
         CPY #HORIZON+25
         BCC .1
         RTS
;
;==========================
;Bullet load- passed size
;0 to 15 inclusive in X
;===========================
;
BULLETLOAD
         LDA #1
         STA REPEAT
;
         CPX #12
         BCC .1
         BEQ .2
;
         TXA
         SEC
         SBC #13
         TAX
         LDY L3BOFFS,X
         LDA REPTL3B,X
         STA REPEAT
         LDA L3BTYPE,X
         TAX
         BNE BSKIP
;
.2       LDX #15
.1       TXA
         LSR
         EOR #$FF
         CLC
         ADC #HORIZON+1
         TAY
BSKIP    STX COUNT
         LDA SMSPOFFS,X
         TAX
BLOOP
         LDA REPEAT
         STA S.REPEAT
         LDA SMSPDATA,X
.1       STA (TO),Y
         INY
         DEC S.REPEAT
         BNE .1
         INX
         DEC COUNT
         BPL BLOOP
;
         RTS
;
L3BOFFS  .DA #HORIZON-11,#HORIZON-15,#HORIZON-24
REPTL3B  .HS 020204
L3BTYPE  .DA #11,#15,#11

;
;==========================
;Rangecheck looks for a hit
;by the enemy, and if
;necessary draws in the
;sphere.Also does wrapround.
;==========================
;
RANGECHECK
         LDA R+1
         BMI YOUREHIT
;
         CMP #96
         BCC NOWRAP
         LDA THETA+1
         EOR #$80
         STA THETA+1
         LDA #95
         STA R+1
         STA R
;
NOWRAP   LDA R+1
         CMP #2
         BCC YOUREHIT
;
         LDA EB.R+1
         BMI YOUREHIT2
         CMP #2
         BCC YOUREHIT2
;
         JMP DRAWING
;
;=========================
;Nasty colours as you've
;been hit!
;=========================
;
YOUREHIT
         LDA #2
         STA R
         STA R+1
         JSR DRAWING
;
YOUREHIT2
         LDA #0
         STA SETFLAG
         JSR SCANFILL
         STA FIREC1
         STA AUDC4
         JSR SCANERA
         LDA #$FF
         STA BULLET
         JSR B.CLEAR
         JSR NOSOUND
         LDX #38
.1       LDA RTCLOCK+2
         STA TEMP
.2       LDY #4
.3       LDA RANDOM
         STA COLPF0,Y
         CPY #4
         BNE .4
         DEY
.4       DEY
         BPL .3
         LDA RANDOM
         STA COLPM0
         LDA RANDOM
         STA COLPH3
         STA COLPM2
         STA COLPM3
         LDA RANDOM
         STA COLPM1
         ORA #$10
         STA AUDC1
         LDA RTCLOCK+2
         CMP TEMP
         BEQ .2
         DEX
         BPL .1
;
         JSR SETR
         DEC LIVES
         BNE LIVESLEFT
         PLA
         PLA
         JMP START
LIVESLEFT
         DEC C.LIVES
         JSR NOSOUND
         JSR ERASE
         LDA KFLAG
         BNE .1
         JSR RESET
.1       JMP CHOOSE
;
;============================
;Drawing in the players
;============================
;
ERASE
         LDA #0
         LDX #HORIZON+40
.1       DEX
         STA P1,X
         STA P2,X
         STA P3,X
         BNE .1
         RTS
;
DRAWING
         JSR ERASE
;
;Just erased the old sphere.
;
FINDSIZE
         LDX R+1
         CPX #2
         BCC .0
         LDA R
         BPL .1
         INX
.1       CPX #64
         BCC .2
         LDA #0
         STA SPHKIND
.0       RTS    Not there.
;
.2       LDA SPHERETYPE,X
         STA SPHKIND
         TAX
         CPX #16
         BCS MIDDLE
;
;Draw in the 1 player wide one.
;
         LDA XPOS
         SEC
         SBC SMSPHADJ,X
         STA HPOSP2
         LDA #0
         STA SIZEP2
         STX COUNT
;
         TXA
         LSR
         STA TEMP
         LDA #HORIZON
         SEC
         SBC TEMP
         SEC
         SBC JUMP
         TAY  Get player tab offset.
         LDA SMSPOFFS,X
         TAX
;
SMLOOP   LDA SMSPDATA,X
         STA P2,Y
         INY
         INX
         DEC COUNT
         BPL SMLOOP
SLEAVE   RTS
;
MIDDLE
         CPX #22
         BCS LARGE
         TXA
         SEC
         SBC #16
         TAX
         STX XSTORE
         LDA XPOS
         SEC
         SBC MSPHADJ,X
         STA HPOSP2
         CLC
         ADC #8
         STA HPOSP3
         LDA #0
         STA SIZEP2
         STA SIZEP3
;
         LDA MSPPOFF,X
         SEC
         SBC JUMP
         TAY
         LDA SHRPTS,X
         STA SHRPT
         LDA MSPOFFS,X
         TAX
;
MLOOP    LDA MSPDATA,X
         BEQ MEXIT
;
         STA P3,Y
         STX TEMP
         LDX #0
         STX BYTE
         LDX SHRPT
REVERSE  LSR
         ROL BYTE
         DEX
         BPL REVERSE
         LDX TEMP
;
         LDA BYTE
         STA P2,Y
         INY
         INX
         BNE MLOOP
MEXIT
         LDX XSTORE
         LDA XPOS
         SEC
         SBC MHADJ,X
         PHA
         LDY MHOFFS,X
         LDA MHTYPE,X
         TAX
         PLA
         JMP HIGHLIGHT
;
LARGE
         TXA
         SEC
         SBC #22
         TAX
         STX XSTORE
         LDA LSPS1,X
         STA SIZEP3
         LDA LSPSM,X
         STA SIZEM
         LDA LSPS2,X
         STA SIZEP2
;
         LDA XPOS
         SEC
         SBC LSPHADJ1,X
         STA HPOSM3
         CLC
         ADC LSPADD,X
         STA HPOSM2
         ADC LSPADD,X
         STA HPOSM1
         ADC LSPADD,X
         STA HPOSM0
         ADC LSPHADJ2,X
         STA HPOSP2
         ADC LSPHADJ3,X
         STA HPOSP3
;
         LDY LSPOFFS,X
         LDA LSPSTART,X
         SEC
         SBC JUMP
         TAX
;
.0       LDA LSPDATA,Y
         BEQ HALFWAY
         STA COUNT
.1       LDA LSPDATA+1,Y
         STA M,X
         LDA LSPDATA+2,Y
         STA P2,X
         LDA LSPDATA+3,Y
         STA P3,X
         INX
         DEC COUNT
         BNE .1
         INY
         INY
         INY
         INY
         BNE .0
;
HALFWAY
         DEY
         DEY
         DEY
         DEY
.0       LDA LSPDATA,Y
         BEQ LEXIT
         STA COUNT
.1       LDA LSPDATA+1,Y
         STA M,X
         LDA LSPDATA+2,Y
         STA P2,X
         LDA LSPDATA+3,Y
         STA P3,X
         INX
         CPX #HORIZON+40
         BEQ LEXIT
         DEC COUNT
         BNE .1
         BEQ HALFWAY
;
LEXIT
         LDX XSTORE
         LDY LHOFFS,X
         LDA XPOS
         CLC
         ADC LHADJ,X
         PHA
         LDA LHTYPE,X
         TAX
         PLA
;
HIGHLIGHT
         STA HPOSP1
         LDA PCOLOR2
         CLC
         ADC #2
         STA COLPM1
         STA PCOLOR1
         STX COUNT
         TYA
         SEC
         SBC JUMP
         TAY
         LDA #0
         STA SIZEP1
         LDA SMSPOFFS,X
         TAX
HI.LOOP
         LDA SMSPDATA,X
         STA P1,Y
         INY
         INX
         DEC COUNT
         BPL HI.LOOP
         RTS
;
SPHERETYPE .BS 2
         .HS 19181716
         .HS 151413121110
         .HS 0F0E0D0C0B0A0A09090808070707060606060505050505
         .HS 04040404040303030303020202020202010101010101
         .HS 00000000000000
;
;
SMSPHADJ .HS 05050404050504040505040405050404
;
SMSPDATA
E0       .HS 08
E1       .HS 0808
E2       .HS 181818
E3       .HS 18181818
E4       .HS 081C1C1C08
E5       .HS 081C1C1C1C08
E6       .HS 18183C3C3C1818
E7       .HS 18183C3C3C3C1818
E8       .HS 081C1C3E3E3E1C1C08
E9       .HS 081C1C3E3E3E3E1C1C08
E10      .HS 183C3C7E7E7E7E7E3C3C18
E11      .HS 183C3C7E7E7E7E7E7E3C3C18
E12      .HS 1C3E3E7F7F7F7F7F7F7F3E3E1C
E13      .HS 1C3E3E7F7F7F7F7F7F7F7F3E3E1C
E14      .HS 183C7E7EFFFFFFFFFFFFFF7E7E3C18
E15      .HS 183C7E7E7EFFFFFFFFFFFF7E7E7E3C18
;
;
SMSPOFFS .DA #0,#E1-E0,#E2-E0,#E3-E0,#E4-E0,#E5-E0,#E6-E0
         .DA #E7-E0,#E8-E0,#E9-E0,#E10-E0,#E11-E0,#E12-E0
         .DA #E13-E0,#E14-E0,#E15-E0
;
;
;Middle size data.
;
MSPHADJ  .HS 090809080808
;
SHRPTS   .HS 060706070707
;
MSPPOFF  .DA #HORIZON-8,#HORIZON-9,#HORIZON-10,#HORIZON-12
         .DA #HORIZON-13,#HORIZON-16
;
MSPDATA
;
E16      .HS C0E0E0F0F0F0F8F8F8F8F8F0F0F0E0E0C000
E17      .HS C0E0E0F0F0F0F8F8F8F8F8F8F8F0F0F0E0E0C000
E18      .HS 80E0F0F0F8F8F8FCFCFCFCFCFCFCF8F8F8F0F0E08000
E19      .HS 80E0E0F0F0F8F8F8FCFCFCFCFCFCFCFCF8F8F8F0F0E0E08000
E20      .HS 80E0F0F8F8FCFCFCFEFEFEFEFEFEFEFEFEFEFEFCFCFCF8F8
         .HS F0E08000
E21      .HS 80F0F8F8FCFCFEFEFEFEFFFFFFFFFFFFFFFFFFFFFFFF
         .HS FEFEFEFEFCFCF8F8F080
;
;
MSPOFFS  .DA #0,#E17-E16,#E18-E16,#E19-E16,#E20-E16,#E21-E16
;
;
LSPS1    .HS 00000001
LSPS2    .HS 00000101
LSPSM    .HS 00000055
;
LSPADD   .DA #2,#2,#2,#4
LSPHADJ1 .DA #13,#12,#16,#24
LSPHADJ2 .DA #2,#2,#2,#4
LSPHADJ3 .DA #8,#8,#16,#16
;
LSPSTART .DA #HORIZON-18,#HORIZON-23,#HORIZON-31,#HORIZON-47
;
LSPDATA
         .HS 00000000
;
E22      .HS 01003E0001007F00
         .HS 0100FF800101FFC0
         .HS 0203FFE00307FFF0
         .HS 040FFFF8061FFFFC
         .HS 00000000
;
E23      .HS 01007E000100FF00
         .HS 0101FF800103FFC0
         .HS 0107FFE0020FFFF0
         .HS 021FFFF8033FFFFC
         .HS 057FFFFE07FFFFFF
         .HS 00000000
;
E24      .HS 0100180001003C00
         .HS 02007E000100FF00
         .HS 0101FF800203FFC0
         .HS 0207FFE0030FFFF0
         .HS 031FFFF8033FFFFC
         .HS 067FFFFE07FFFFFF
         .HS 00000000
;
E25      .HS 01003C0001007E00
         .HS 0200FF000201FF80
         .HS 0203FFC00307FFE0
         .HS 030FFFF0041FFFF8
         .HS 053FFFFC0A7FFFFE
         .HS 0FFFFFFF00
;
;
LSPOFFS  .DA #E22-LSPDATA,#E23-LSPDATA,#E24-LSPDATA,#E25-LSPDATA
;
;
;Highlight data.
;
;
LHOFFS   .DA #HORIZON-12,#HORIZON-16,#HORIZON-23,#HORIZON-32
;
LHADJ    .DA #$FF,#0,#1,#2
LHTYPE   .DA #9,#11,#13,#15
;
;
MHOFFS   .DA #HORIZON-4,#HORIZON-5,#HORIZON-6,#HORIZON-7
         .DA #HORIZON-8,#HORIZON-10
;
MHADJ    .DA #3,#3,#3,#3,#2,#1
MHTYPE   .DA #2,#3,#4,#5,#6,#7
;
;==========================
;Do all the bits to the
;scanner-the first is to
;draw the horizontal bar.
;==========================
;
DOSCANLN
         LDA #97
         SEC
         SBC R+1
;
         STA TEMP
         AND #7      X=REM
         TAX
         LDA TEMP
         LSR
         LSR
         LSR
         TAY         Y=QUOT
         LDA BYTEL,X
         STA CHARL+3
         STA CHARL+4
         LDA BYTER,X
         STA CHARR+3
         STA CHARR+4
;
         STY YTEMP
         LDX #23
         LDA #$1F       ?
SCLOOP   STA SCANLINE+24,Y
         STA SCANLINE,X
         DEX
         DEY
         BPL SCLOOP
;
         LDY YTEMP
         LDA #27        ;
         STA SCANLINE+1,X
         LDA #26        :
         STA SCANLINE+24,Y
;
         LDA #$00
.1       STA SCANLINE+25,Y
         STA SCANLINE,X
         DEX
         INY
         CPY #15
         BCC .1
;
;========================
;Now show the chevrons
;at either edge.
;========================
;
         LDA THETA+1
         CLC
         ADC #$20   45 DEG
         ROL
         ROL
         ROL
         AND #3
         TAX
         BNE LRSKIP
         LDA THETA+1
         CLC
         ADC #$20
         CMP #$16+$20
         BCC .5
         LDX #1
         BNE LRSKIP
.5       CMP #$EC+$20
         BCS LRSKIP
         LDX #3
;
LRSKIP
         LDY LEFTRIGHT1,X
         LDA LRDATA,Y
         LDY #3
LRLOOP1  STA SCANLINE+4,Y
         DEY
         BPL LRLOOP1
;
         LDY LEFTRIGHT2,X
         LDA LRDATA,Y
         LDY #3
LRLOOP2  STA SCANLINE+40,Y
         DEY
         BPL LRLOOP2
;
;=========================
;Now the plan view scanner,
;calculating Rcos and Rsin
;=========================
;
;
         LDX R+1
         LDA R
         BPL .1
         INX
.1       CPX #6
         BCC NOSCAN
;
         LDX #0
         JSR SCANSUB
         LSR
         ROR MATH2
         STA MATH2+1
         JSR MULT16
         JSR SET256
         LDA #$7F
         CLC
         ADC RESHI+1
         STA SCANPOS
;
         LDX #1
         JSR SCANSUB
         STA MATH2+1
         JSR MULT16
         JSR SET256
         LDA #OSCAN
         SEC
         SBC RESHI+1
         STA YSCAN
         RTS
;
SCANPUT  LDA #$3
SCANFILL LDY YSCAN
         STA M-1,Y
         STA M,Y
         STA M+1,Y
         RTS
;
NOSCAN   LDA #0
         STA YSCAN
         RTS
;
SCANSUB
         LDA THETA+1
         STA MATH1+1
         LDA THETA
         STA MATH1
         CPX #1
         BEQ .1
         JSR SINE
         JMP .2
.1       JSR COSINE
.2       LDA RESHI
         STA MATH1
         LDA RESHI+1
         STA MATH1+1
;
         LDA R
         STA MATH2
         LDA R+1
         LSR
         ROR MATH2
         LSR
         ROR MATH2
         RTS
;
;========================
;Is the enemy at an angle
;to be displayed yet?
;Theta+1 passed in A.
;========================
;
ENEMYSHOW
         CLC
         ADC #$20
         CMP #$40
         BCS NOTON
;
         STA MATH1+1
         LDA THETA
         LDX #6
.1       LSR MATH1+1
         ROR
         DEX
         BNE .1
         RTS
;
NOTON    LDA #0
         RTS
;
BYTEL    .HS 000103070F1F3F7FFF
BYTER    .HS 0080C0E0F0F8FCFEFF
LEFTRIGHT1 .HS 01010000
LEFTRIGHT2 .HS 01020201
LRDATA   .DA #$80+96,#0,#$80+99
;
SCANERA  LDX #47
         LDA #0
.1       STA SCANLINE,X
         DEX
         BPL .1
         RTS

;
;======================
;The main loop!
;======================
;
MAINLOOP
         JSR DEBOUNCE
         LDA #0
         LDX #HORIZON+40
.1       DEX
         STA M,X
         BNE .1
;
         STA SIZEM
         LDA TIMER
         BPL .2
         LDA YSCAN
         BEQ .2
         LDA SCANPOS
         STA HPOSM0
         JSR SCANPUT
.2
         JSR RANGECHECK
         JSR ESHOW
;
NOSCYET  JSR FIRE
         JSR JOYSTICK
;
.1       LDA TIMER
         BPL NOPAUSE
;
         JSR DOENEMY
         JSR HITDETECT
         JSR DOSCANLN
;
         LDA CH
         CMP #$21
         BNE NOPAUSE
         LDY RTCLOCK+1
         JSR NOSOUND
;
.2       LDA PORTA
         CMP #$FF
         BEQ .2
         STY RTCLOCK+1
;
NOPAUSE  LDA #$FF
         STA CH
;
         LDA CONSOL
         CMP #7
         BEQ MAINLOOP
         JMP START
;
ESHOW    LDA THETA+1
         JSR ENEMYSHOW
         STA XPOS
         RTS
;
;======================
;Hit detection.Did you get it?
;======================
;
HITDETECT
         LDA S.PPL
         BEQ .1
;
         LDA BULLET
         EOR #$0F
         STA TEMP
         LDA R+1
         LSR
         LSR     0 to 15
         SEC
         SBC TEMP
         CLC
         ADC #2
         CMP #2
         BCC EXPLODE
         BPL .1
         LDA PCOLOR2
         BNE .2
;
.1       LDA #$0F
.2       STA PCOL.DLI
         RTS
;
EXPLODE
;========================
;It's the explosion folks!
;========================
;
         INC DEAD
         LDA #0
         JSR SCANFILL
;
         JSR NOSOUND
         JSR SCANERA
         STA FIREC1
         STA FIREC2
         LDA #$FF
         STA BULLET
         JSR B.CLEAR
;
;Turn off bullet
;
         LDA #30
         STA EXPTIM
         LDA PCOLOR2
         STA PCOL
;
ENEXPL
         JSR DRAWING
         JSR ESHOW
;
         LDA #HORIZON-48
         SEC
         SBC JUMP
         TAY
.0       LDA M,Y
         AND RANDOM
         STA M,Y
         LDA P1,Y
         AND RANDOM
         STA P1,Y
         LDA P2,Y
         AND RANDOM
         STA P2,Y
         LDA P3,Y
         AND RANDOM
         STA P3,Y
         INY
         CPY #HORIZON+40
         BCC .0
;
         LDA EXPTIM
         LSR
         TAX
         STA TEMP
         BCC NOWHITE
         LDA #$00
         BEQ SCOLS
NOWHITE  LDA PCOL
         AND #$F0
         ORA TEMP
SCOLS    LDY #2
FADE     STA PCOLOR1,Y
         STA COLPM1,Y
         DEY
         BPL FADE
         TXA
         ORA #$80
         STA AUDC1
         TXA
         LSR
         ORA #$80
         STA AUDC3
         LDA #$80
         STA AUDF1
         STA AUDF3
;
         JSR JOYSTICK
         LDA R+1
         CMP #2
         BCS .0
         LDA #2
         STA R+1
         STA R
.0       DEC EXPTIM
         BEQ DONEXPL
         JSR DEBOUNCE
         JMP ENEXPL
;
DONEXPL  JSR NOSOUND
         JSR SETR
;
DOSCORE
         LDA KFLAG
         BNE SCORS
         JSR RESET
         LDA LEVEL
         CMP #5
         BCC .1
         LDA #$06
         STA ACE
         PLA
         PLA
         JMP START
;
.1       INC LEVEL
         INC C.LEVEL
         INC LIVES
         INC C.LIVES
;
SCORS    SED
         LDA RANDOM
         AND #$70
         BEQ SCORS
         CLC
         ADC SCORE
         STA SCORE
         LDA SCORE+1
         ADC LEVEL
         STA SCORE+1
         LDA SCORE+2
         ADC #0
         STA SCORE+2
         CLD
         LDX #2
         LDY #0
.2       LDA SCORE,X
         JSR SPLIT
         STA C.SCORE,Y
         STA TSCORES+2,Y
         INY
         LDA TEMP
         STA C.SCORE,Y
         STA TSCORES+2,Y
         INY
         DEX
         BPL .2
         JMP CHOOSE

         .IN "D:DZONE8.SYN"
         .EN