A.N.A.L.O.G. ISSUE 36 / NOVEMBER 1985 / PAGE 39
Maze War
24K Cassette or Disk
by Mark Price
Our story so far…The evil Mage Roklar must have
more backing than you thought, because somehow
he captured you and, the other members of the Circle
of Wizards. You really don’t know how long you
were out, but when you awoke, you found yourselves
in a tenuous construct.
From its mazelike pattern, it was immediately recognized
to be one of Roklar’s favorite disposal places,
a pocket dimension bridging between the elemental
planes of fire and ice. It was then that Roklar made
his projected appearance before the group.
His image said, “You have all stood in my way too
long. Now it is my turn to stand in yours. This area
will not last long, and there is only enough magical
energy here to carry but one of you away! Knowing
how you always so adamantly refuse to part company,
though, I doubt that any of you will escape.” The
image laughed wickedly as it faded away.
After a quick survey of the area, you found that
Roklar had spoken the truth for once. The place itself
was beginning to fray at the edges as its remaining
magic seeped away. Very soon, there wouldn’t
be enough to take any of you back home.
Obviously, only one of you would be able to escape
to make Roklar pay, so it was decided to hold
a quick tourney to find which it would be. It was lucky
that you had finished constructing your Wands of
Havoc before being captured. They would serve excellently
for the tourney. You all drew them from your
vests and prepared.
Then Roklar reappeared. This time he said, “I
never thought I’d see you so prepared to abandon and
certainly not threaten violence to each other. No matter.
Since you are being so amiable, I’ll make this a
little more interesting…”
There was a low rumble some distance away in
the maze, and then the slow shuffling of feet coming
your way. You looked at each other and, all at the
same moment, said, “Zombies?”
Roklar never did have a sense of humor.
Typing it in.
Before typing anything, look at the listings accompanying
this article.
Listing 1 is the BASIC data and data checking
routine. This listing is used to create both cassette
and disk versions of Maze War. The data
statements are listed in hexadecimal (base 16),
so the program will fit in 16K cassette systems.
Listing 2 is the assembly language source code
for the game of Maze War, created with the OSS
MAC/65 assembler. You don’t have to type this
listing to play the game! It is included for those
readers interested in assembly language.
Follow the instructions below to make either a cassette
or disk version of Maze War.
Cassette instructions.
- Type Listing 1 into your computer using the
BASIC cartridge and verify your typing with
Unicheck (see page 16).
- Type RUN and press RETURN. The program
will begin and ask:
MAKE CASSETTE (0) OR DISK (1)?
Type 0 and press RETURN. The program will
begin checking the DATA statements, printing
the line number of each as it goes. It will alert
you if it finds any problems. Fix any incorrect
lines and re-RUN the program, if necessary, until
all errors are eliminated.
- When all of 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 Maze
War, 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, rewind the tape created by 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 a 600 or 800XL 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 Maze War will
load and run automatically.
Disk instructions.
- Type Listing 1 into your computer, using the
BASIC cartridge and verify your typing with
Unicheck (see page 16).
- Type RUN and press RETURN. The program
will ask:
MAKE CASSETTE (0) OR DISK (1)?
Type 1 and press RETURN. The program will
begin checking the DATA lines, printing the line
number of each statement as it goes. It will alert
you if it finds any problems. Fix incorrect lines
and re-RUN the program, if necessary, until all
errors are eliminated.
- When all the DATA lines are correct, you
will be prompted to INSERT DISK WITH DOS,
PRESS RETURN. Put a disk containing DOS 2.0S
into drive #1 and press RETURN. The message
WRITING FILE will appear, and the program
will create an AUTORUN.SYS file on the disk,
displaying each DATA line number as it goes.
When the READY prompt appears, the game is
ready to play. Be sure the BASIC program is
SAVEd before continuing.
- To play the game, insert the disk containing
the AUTORUN.SYS file into drive #1. Turn
your computer OFF, remove all cartridges and
turn the computer back ON. Maze War will load
and run automatically.
Playing Maze War.
Maze War was written using the OSS MAC/65 assembler.
It’s a game for one to four players. If played on an
XL computer with more than two players selected,
stick 1 will control Wizards 1 and 3, while stick 2
controls Wizards 2 and 4. The number of players is
chosen with the SELECT key, and the number of
Zombies with the OPTION key. The speed of the
Zombies is selected by pressing a key from 1 to 9.
You start the game somewhere in Roklar’s maze,
Havoc Wand in hand. You move about in the maze
by pushing your joystick in the desired direction. If
the stick is held diagonally, the Wizard will alternate
moving between the two directions.
The Wand fires off a magic chain when you hold
down the fire button while moving the joystick. The
magic chain fired by the Wand is capable of vaporizing
man or wall at fifty paces. Once vaporized, a Wizard
or Zombie will automatically coalesce back into
a whole at a random point somewhere in the maze.
Moving about in the maze will attune you more
to its energies, thus making the point value for a hit
worth more. In the same fashion, using the Havoc
Wand uses up energy, and overuse will bring the
point value down. Once a Wizard or Zombie has
tapped into 100 points of energy, the spell to return
to Earth is cast. Then, the pocket dimension will become
unstable and dissolve.
Maze War will go into an automatic demo mode
with three Zombies going at it after thirty seconds.
This can be seen earlier if you press the D key. Once
the game has started, it can be paused by hitting any
key Unpause by pressing a key again. The game can
be aborted at any time by hitting one of the console
keys.
All right, face the magic.
Mark Price lives in Los Angeles, where he’s studying
computer science. A telecommunications enthusiast,
he participates in several local BBSs. He likes
to program games in cooperation with his living computer,
Fred, and has been working with computers
since 1979.
Listing 1.
BASIC Listing
10 REM *** MAZE WAR ***
20 GRAPHICS 0:TRAP 20:? "MAKE CASSETTE (0), OR DISK (1)";:INPUT DSK:IF DSK>1 THEN 20
30 TRAP 40000:DATA 0,1,2,3,4,5,6,7,8,9,0,0,0,0,0,0,0,10,11,12,13,14,15
40 DIM DAT$(91),HEX(22):FOR X=0 TO 22:READ N:HEX(X)=N:NEXT X:LINE=990:RESTORE 1000:TRAP 120:? "CHECKING DATA"
50 LINE=LINE+10:? "LINE:";LINE:READ DAT$:IF LEN(DAT$)<>90 THEN 220
60 DATLIN=PEEK(183)+PEEK(184)*256:IF DATLIN<>LINE THEN ? "LINE ";LINE;" MISSING!":END
70 FOR X=1 TO 89 STEP 2:D1=ASC(DAT$(X,X))-48:D2=ASC(DAT$(X+1,X+1))-48:BYTE=HEX(D1)*16+HEX(D2)
80 IF PASS=2 THEN PUT #1,BYTE:NEXT X:READ CHKSUM:GOTO 50
90 TOTAL=TOTAL+BYTE:IF TOTAL>999 THEN TOTAL=TOTAL-1000
100 NEXT X:READ CHKSUM:IF TOTAL=CHKSUM THEN 50
110 GOTO 220
120 IF PEEK(195)<>6 THEN 220
130 IF PASS=0 THEN 170
140 IF NOT DSK THEN 160
150 PUT #1,224:PUT #1,2:PUT #1,225:PUT #1,2:PUT #1,207:PUT #1,36:CLOSE #1:END
160 FOR X=1 TO 57:PUT #1,0:NEXT X:CLOSE #1:END
170 IF NOT DSK THEN 200
180 ? "INSERT DISK WITH DOS, PRESS RETURN";:DIM IN$(1):INPUT IN$:OPEN #1,8,0,"D:AUTORUN.SYS"
190 PUT #1,255:PUT #1,255:PUT #1,0:PUT #1,32:PUT #1,158:PUT #1,53:GOTO 210
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,44,216,31,255,31,169,0,141,47,2,169,60,141,2,211,169,0,141,231,2,133,14,169,56,141,232,2
240 DATA 133,15,169,207,133,10,169,36,133,11,24,96
1000 DATA 00000000000000000028561400000000003CBF28000000000000000020BCBC301058582020BCBC301058582000,797
1010 DATA 0000000303033F3303030FC0C00FFCC0C0303C0000000000000000000000000000000000000000000000000000,84
1020 DATA 0000000000000000000000000000000000000000000000000000000000000000000000000000007E666666667E,744
1030 DATA 000018181818181800007E067E60667E00007E061E06667E0000606C6C7E0C0C00007E607E06667E00007E607E,258
1040 DATA 66667E00007E060C18181800007E667E66667E00007E667E06667E0000001818001818008D366C492CD2B64B00,59
1050 DATA 0000002CD2B64B8D366C4900000000000000020A2BAF3C00028AABEFCC00005E5B5E55E5B5E55500183C66667E,492
1060 DATA 66E700FC66667C66667C007EC6C0C0C0C67E00FC6666666666FC00FE6660786066FE80B0B0B0B2BAAB3F007EC6,573
1070 DATA C0CEC6C67E020A2AAEAAFEC200003C18181818183C2ACFC0C2CAEBEACF00CED8F0FCCCCCCE00F06060606066FE,600
1080 DATA 0063777F6B63636300C666767E7E6EE6007CC6C6C6C6C67C00FC66667C6060F0A8EBAFBEF0C0A8FF00FC66667C,812
1090 DATA 6C6CE6007EC6C07C06C6FC007E5A181818183C00E766666666663C0A2BAFAAAF280A03006363636B7F776300C0,94
1100 DATA 0000C00000C000E7663C1818183C00FECC183060C6FE80B0B2BAAAAEBE3000020AEBAFBEFAC3A0BEFAEBAABFF0,824
1110 DATA C088BABABBBABBBB33000080A0BCA0280F030303153101010AC0C0055C404010283C3C30141434102803030315,115
1120 DATA 1111010AC0C00C5440401028C0C0C0544C10280000000303031511040000C0C0C0544C40280000000000000040,571
1130 DATA A0000000000000000000000303031500000000C0C0C0541111010A000000004C10280000000000000000000000,598
1140 DATA 0303000000000000C0C00315110428000000C0544C4040A000000303503501010428C0C0C0544C4040A03C3C0C,54
1150 DATA 14141C04280303301501010428C0C0C054444440A001153104280000004054444040A0000000000000C0C44454,466
1160 DATA 3101010A00000000401028000000000000000303011531040000C0C040544440C0C44454401028000000000000,52
1170 DATA 000000030F3FFFFEFCFCFFFFFFFF80000000FFFFFFFF0F0F0F0FCF00C0C0C0C0C0C0C0FFFFFFFFFFFEFEFFF0F8,451
1180 DATA FCFE3F1F0F07070F0F0F0F8FCFEF80C0C0C0C0C0C0C0F8FCFCFCFCFEFFFF00000000000000803FFFFFFFFEFCFC,935
1190 DATA FEFFFFFF8000000000FFFFFF0F0F0F0F0FFFFFFF800000000FFFFFFF00000000FF00C0C00000000000FFFFFFFF,254
1200 DATA FFFFFF3FFFFFC0E0F0F8F8F0EFCF0F0F0F0C0C07C0C0C0C0C0C0C08083C1E0E0E0E0E080FFFFFF7F3F1C0C07C0,744
1210 DATA E0F0F8FCFFFFFF0000000000FFFCFF000000000080C0800080C0E0F0FFFFFF0F0F0F0F0FFCFCFF0783C0E0F0FF,115
1220 DATA FFFFFFFF0F0F0FFCFCFFAAFEFEAAEFEFAAFEFEAAEFEFAAFEFEAAEFEFAAFEFEAAEFEF0000007C18181400000000,435
1230 DATA 18180810000000007E1818140000000018180810000000007E181410000000007E182808000000007E18141000,343
1240 DATA 0000007E182808000000003E1818280000000018181008000000007E1818280000000018181008000000187E18,223
1250 DATA 1410000000187E182808000000187E181410000000187E1828080000007C181814000000030000000000000000,108
1260 DATA 000000003618181002400000001C66751C0C180C00386ED7FE181018003C7EFFFFDB1818183C7EFFFFFF3C3C3C,432
1270 DATA 003C7E7E7E3C3C7EC8865828962A0034A579057AD006A9FE8579857AA900A2039D08D0CA10FA8D08D28DC802A9,427
1280 DATA 388D07D4A93E8D2F02A9038D1DD08D0FD2A9018D6F02A9208DF402A9408D0ED4A94C8D0002A9318D0102A9408D,916
1290 DATA 0ED4A90E8D3002A9328D3102A007B9C72499C0028810F7A900A899003C99003D99003E99003F88D0F18D01D28D,533
1300 DATA 03D28D05D28D07D285868587A90A8588A9F4859CA9328598A91A859DA9338599A9028595A90085948590859185,231
1310 DATA AC85AD85A0A91385A1A90F85A485A5A90A85A885A9204E26C686D008C687D004C688F053A586D032A5872903D0,52
1320 DATA 2C8D01D28D03D2A5872907D020A201B5ACF00620F82D4CCA25D6A8D00AB59449029594A90995A820D12DCA10E2,318
1330 DATA ACFC02A9FF8DFC02B179C931900BC93BB007291F8DAF33D012C964D00EA900858DA903858E4C79264C8B25AD84,579
1340 DATA 02F060AD2E02D0F3AD1FD0C906F05429064906F0E6C906F0E2C902F015EE8E3318AD8E336D7A33C9A59023A950,162
1350 DATA 8D8E33D01CEE7A33AD7A33C9559007A9518D7A33D00B186D8E33C9A59003CE8E33204E264C8B25A905A028A200,883
1360 DATA 205CE4A9018D2E0260204E26AD7A33290F858DAD8E33290F858E18658DC901D004858EA9028589C689A20020E4,364
1370 DATA 2FE820E42FA95A8582A9338583A90A8584A9358585A201A084B1829184E684D002E6859184C8D0F1E683E685CA,714
1380 DATA 10EAA9868584A9388585A04FA90091848810FBA900858AA98A8584A9388585A58DF00D858CA95A8582A9358583,454
1390 DATA 20C528A58EF00D858CA9728582A935858320C528A689A90095D095B89590A90395B0A90595B4200E2FE48D900B,929
1400 DATA A91BEDAF3395B0A90195D0CA10DBA58DD004A903858D20FF28A9BC8D3002A9338D3102A9C08D0ED4AD2E02D019,310
1410 DATA AD1FD0C907F012200529AD1FD0C907D0F9AD8402F0F44C1625A689B5B8F039BC9A3118799138999138A90095B8,827
1420 DATA A901858BB99138F022C9DA9019E90A99913888C68B3049B99138D002A9D0186901999138D0DEC8E68BD0D9CA10,807
1430 DATA C0ADFC02C9FFD0034C3027200529A9FF8DFC02A9008D01D28D03D28D05D28D07D2ADFC02C9FFF0F920FF28A9FF,865
1440 DATA 8DFC024C3027868E200529A9008D01D28D03D28D05D28D07D2A68EA003BD9A311869908584A93885859002E685,767
1450 DATA B98A3591848810F8A9009590868EA689E48EF00B20E42FA9029590A90995ACCA10EEA514C514F0FCA900858AA6,708
1460 DATA 89A58A187590858A20B830CA10F3A58AC589D0E1A68E20E42FBDC0028DC002A9968DC102A92A8DC202A9348DC3,592
1470 DATA 02A97F8582A9248583B5A40A0A0A1869208584A93C8585A903858AA007B18291848810F9B5A00A0A0A186930A4,225
1480 DATA 8A9900D0A58218690885829002E683E685C68A10D9A910858AA203BDC402290FD0059DC402F003DEC402A414C8,537
1490 DATA C8C414D0FCCA10E6C68A10E0A907858CA2FFA0FFAD1FD0C907D00A88D0F6CAD0F1C68C10EB4C1625A900858BE6,192
1500 DATA 8BA206A48AB1829184C8CAD0F8C8A58B09D09184C8C8C8C8A9D09184A58A186906858AA58418690E85849002E6,485
1510 DATA 85A58BC58CD0CB60A00EA229D004A062A2E4A9074C5CE4A5142907D026AE0021A001B900210A2A858C2901658C,248
1520 DATA 88990021C8C8C008D0EB8A0A2A858C2901658C8D0721A689B5902903F0034C2D2AD6A8F00FB590D0088A0AA8A9,281
1530 DATA 009901D24C2D2AB5B095A8B5ACF00620F82D4C2D2AB5D0F0034CF82CBD7802490FD0034C2D2AA8B97731C904D0,276
1540 DATA 1E848C98B494399231A8B977319594202630F00DA58CB494399231A8B977319594A900854DBD8402F01D202630,291
1550 DATA F00620912E4C2D2A20D12DB4B4C8C0179002A0169895B44C2D2AB59029F0D06220912EB4B48888C005B002A005,263
1560 DATA 9895B4B59495BC202630D028A58495C4A58595C0B59009809590A90095C8A90C95CCB4BCB982311869DE8582A9,379
1570 DATA 3120002F4C162BC986B00EA58495C4A58595C0200D314C162BB59C95C48584B59895C085854CA42AB59030034C,310
1580 DATA 162BB5C8D005201930D05ED6C8B5C8290195C8F011B4BCB5C41879733195C4B5C079693195C0B5C48584B5C085,355
1590 DATA 85B5C80A0A75BC0A0A69DE8582A93169008583B5BC20682EB5C8D00EB4BCB5C41879713195C49002F6C0F6CC8A,114
1600 DATA 0AA8B5CC9900D2A9C69901D24C162BB590297F959020B72FB4BC201930C9FD9024A000B184297F9184C8B18429,531
1610 DATA 7F9184B59009209590A93695CCA58495C4A58595C04C162BC9869002B034200D31868CA689B5901021B5C48582,986
1620 DATA B5C08583B5C8F00A209130F00AB4BC209C30209130D00620B72F200D31CA10D8A68C4C162BC9C09007C9E0B003,157
1630 DATA 204730A5142901F0034CEF2CB5902901D0034CD42B8A0A0A0A6940858269208580A92085838581B5A8858CA008,561
1640 DATA 88AD0AD23930209182AD0AD23938209180C48CD0EBB5AC2908D030B5AC858CA00888B900229182B908229180C4,870
1650 DATA 8CD0F1B5A40A0A0A692085848A18693C8585A00888B900249184C48CD0F6B5A8F002D6A88A0AA8B5AC2901F009,354
1660 DATA B5AC0A0A0A0980D005B5AC0A6906189900D2B5AC1001386A492769019901D2D6ACD01A20912E8A0AA8A9009901,544
1670 DATA D2B59029FE9590B5B095A8D00320B830B5902910D0034CA82CB5C810034C662C8A0AA8B5C849030A0A0A0A6910,253
1680 DATA 9900D2B5C80A0A69029901D2A903858FB5BC858E468E9056202431203F30F032C99B9004C99E902AA48FB99631,312
1690 DATA 490F35BC95BC204730A48FA58438F96D318584A585F969318585A900A00191848810FBD01CB5C829010A0A058F,265
1700 DATA 0A69FE8582A93169008583A001B18291848810F9C68F10A2F6C8B5C82905D01BA903858FB5BC858E468E900B20,748
1710 DATA 2431A900A89184C89184C68F10EDD6C8D6C8B5C8C9FEF004B5BCD00E8A0AA8A9009901D2B590290F95904CEF2C,899
1720 DATA B5902920F0418A0AA8F6CCB5CC8DC602290FF0160A0A493C69209900D2B5CC290F4A1869209901D2D01DA90099,664
1730 DATA 01D2A8B5C48584B5C08585989184C89184200D31B5BC490F95BCCA30034C3C294C62E4868CA48DB5A4883016C4,276
1740 DATA 8CF0F9D9A400D0F4B5A0D9A000A900901FA902D01BA48DB5A0883021C48CF0F9D9A000D0F4B5A4D9A400A90190,763
1750 DATA 02A9039594B59C8584B59885854CC529A9FF858FA48D883014C48CF0F920B42D18658EC58FB0EF858F848A90E9,985
1760 DATA A48A20B42DC58EB01620942DF027A48A20A42DF020A48A20942DB5944C322D20A42DF011A48A20942DF00AA48A,4
1770 DATA 20A42DB5944C322D4CB329B5A0D9A000A9009002A90295944C2630B5A4D9A400A9019002A90395944C2630B5A0,718
1780 DATA 38F9A000100549FF186901858EB5A438F9A400100549FF18690160B49418B59C797331959CB5987969319598B5,695
1790 DATA A01879663195A0B5A41879653195A49829020A95ACB5942902D004F6ACD002D6ACB59C8584B5988585B5AC2903,135
1800 DATA 0A0A75940A0A699E8582A93169008583B59420682E20A82EB5AC290395ACD01EB494B59C18797131959C9002F6,935
1810 DATA 98B5A01879643195A0B5A41879633195A4B59029B0D0138A0AA8B5AC2901F00AA9049901D2A9209900D260858C,182
1820 DATA A000B1829184C8B1829184A58C2901F00BA58418692685849002E685C8B1829184C8B182918460B59C8584B598,145
1830 DATA 8585B494B9823118699E8582A93120002FB5AC2903186A6A15946A6A6A6A8582A9248583B5A40A0A0A18692085,577
1840 DATA 84B5942901F008B5AC0A18658485848A18693C8585A008B18291848810F9B5A00A0A0A1869308584B5942901D0,351
1850 DATA 08B5AC0A1865848584A5849D00D06069008583A001B18291848810F960AD0AD2291FC913B0F795A0AD0AD2291F,495
1860 DATA C912B0EC95A48582A900858485858583A9288580A0064680900DA5841865828584A585658385850682268388D0,919
1870 DATA E8B5A00A65849002E68518698E8584A58569358585203F30D0A9A584959CA5859598A90095948A0A0A0A694085,159
1880 DATA 8269208580A92085838581A900A007918291808810F98A186908A0009184C869049184B5A00A0A0A1869309D00,702
1890 DATA D0B59029FD09019590A90F95ACA90795A860B5C48580B5C08581A900A89180C89180B5C8F010B5BC2901F004A0,734
1900 DATA 27A900C89180C891808A0AA8A9009901D260B59C8580B5988581A900A89180C89180B5ACF010B5942901F004A0,493
1910 DATA 27A900C89180C891808A18693C8581A9008580A8918088D0FB60B5C48584B5C08585B4BC4C3030B59C8584B598,554
1920 DATA 8585B494A58418796D318584A5857969318585A000B184C8118460868CA689B590290FD03AB59C8582B5988583,187
1930 DATA B5ACF00A209130F00AB494209C30209130D01F20E42FB59009029590A90995ACE48CF00DA68CB5B81875B495B8,674
1940 DATA A90595B460CA10BDA68C60A584C582D004A585C58360A58238F973318582A583F969318583A582187971318582,495
1950 DATA 9002E68360B5902902D00160B5A40A0A0A692085848A18693C85858A0AA8D6AC3029A90A9900D2848CB4ACB986,417
1960 DATA 31A48C9901D2B5AC290E0A0A699F8582A9248583A007B18291848810F960A9009901D2A00791848810FB4C0E2F,323
1970 DATA B590290F09109590B5BC4902A8B9963195BCA90395C860B5C84A4901186901858AB5C48584B5C08585A48FA584,787
1980 DATA 18796D318584A5857969318585C68AD0ED6048A9C88D16D0A9868D17D0A9588D18D0A9288D19D0684000010000,940
1990 DATA 00FF0000FFFF0228FED802280000FED804030104020404040004040206080C040608080606040404020202030C,862
2000 DATA 030C0804020104182C400000C0C10000C3C5D2D30000C0DE0000DFC2DFDFC6C7C8C9DFD4DFDFDCDDC8C9DFC3C4,638
2010 DATA DFCACBCCCDDFD5D6DFCAD9DADBDFDFC2DFCECFD0D1DFDFD4DFCECFD7D800008182000084008182000000840000,604
2020 DATA 00828100830085000082810000830085009B9C9C9B009D9D9B009D9D009B9C9C7070707070422C320202700670,476
2030 DATA 7005707006700404047006067002410E320000000000000000606162636465666760616263686900006A6B6C63,129
2040 DATA 6A6D6E6F000000000000000000000000000000007071727370747573707172737076777870797A73707B7C7300,346
2050 DATA 00000000000000000000000000000000000000000000232F2D303534292E270000000000000000000000000000,752
2060 DATA 0000000000000000F0F2E5F3E5EEF4F3808080000000000000000000000000000000009E9FA6A8AAB1B6B880BB,723
2070 DATA BCBDBEBF00000000000000000000000000000000223900002D21322B0030322923250000000000000000000000,954
2080 DATA 0000000000000000000000000000000000000000000000000000000000000000FDFDFDFDFDFDFDFDFDFDFDFDFD,243
2090 DATA FDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFE,646
2100 DATA FEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFE8080808080F7E9FAE1F2E4F3DA00510000000000000000,841
2110 DATA 00003A2F2D222925331A005000000000000000000000000000000000003A2F2D2229250033302525241A000015,778
2120 DATA 000000000000000000000000707070448E35040404040404040404040404040404040404F046863806060641BC,220
2130 DATA 33A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0000000FDFD00000000000000000000000000A0A000FE00,711
2140 DATA 00FE00FEFEFEFE00FEFEFEFE00FEFEA0A000FF00FFFF000000FF000000FF000000FF00A0A000FD00000000FD00,181
2150 DATA 0000FD000000FD00FD00A0A0FEFE00FEFEFEFEFEFEFEFE00FEFEFE00FE00A0A0000000FF000000000000FF0000,646
2160 DATA 0000000000A0A000FDFDFD00FDFD00FD00FD00FDFDFDFDFDFDA0A0000000000000FE00FE000000FE0000000000,337
2170 DATA A0A0FFFF00FFFF00FF00FF00FFFFFF00FFFFFFFFA0A00000000000000000000000000000FD000000A0A000FEFE,373
2180 DATA FE00FEFEFEFE00FEFEFE00FEFEFE00A0A000FF0000000000000000FF0000000000FF00A0A000FD00FDFDFDFDFD,90
2190 DATA FD000000FDFDFD000000A0A000FE0000FE000000FE00FE0000000000FEFEA0A000FF00FFFF00FF00FF00FFFFFF,306
2200 DATA FFFF000000A0A000FD0000FD00FD00FD00FD000000FDFDFD00A0A0000000000000000000000000FE0000000000,734
2210 DATA A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A037293A21322477697A617264B7A9BAA1B2A4F7E9FAE1F2E4,490
2220 DATA 3A2F2D2229257A6F6D626965BAAFADA2A9A5FAEFEDE2E9E537292E330000000000000000000000000000000000,35
2230 REM * 5535 BYTES
Listing 2.
Assembly Listing.
********************
* *
* 'MAZE WAR' *
* By *
* Mark Price *
* *
********************
;
;SYSTEM EQUATES
;--------------
;
ATRACT = $4D
AUDCTL = $D208
AUDC1 = $D201
AUDC2 = $D203
AUDC3 = $D205
AUDC4 = $D207
AUDF1 = $D200
CHBASE = $02F4
COLOR0 = $02C4
COLOR1 = $02C5
COLOR2 = $02C6
COLOR3 = $02C7
COLOR4 = $02C8
COLPF0 = $D016
COLPF1 = $D017
COLPF2 = $D018
COLPF3 = $D019
CONSOL = $D01F
DLIST = $0230
DMACTL = $022F
GPRIOR = $026F
GRACTL = $D01D
HPOSP0 = $D000
KEYCODES = $79
KEYIN = $02FC
NMIEN = $D40E
PCOLR0 = $02C0
PCOLR1 = $02C1
PCOLR2 = $02C2
PCOLR3 = $02C3
PMBASE = $D407
RANDOM = $D20A
RTCLOK = $14
SIZEP0 = $D008
SKCTL = $D20F
STICK0 = $0278
STRIG0 = $0284
VDSLST = $0200
CDTMF5 = $022E
SETVBV = $E45C
XITVBV = $E462
;
;PM GRAPHICS
;
*= $3800
;
PMAREA .DS $0400
PL0 .DS $0100
PL1 .DS $0100
PL2 .DS $0100
PL3 .DS $0100
;
;COLORS
;
PFCOL0 = $96
PFCOL1 = $2A
PFCOL2 = $00
PFCOL3 = $34
PLR0COL = $C8
PLR1COL = $86
PLR2COL = $58
PLR3COL = $28
;
;ZERO PAGE ALLOCATION
;--------------------
;
*= $80
;
;POINTERS
;
POINTR0 .DS 2 ;GENL PURPOSE
POINTER .DS 2
SCRPTR .DS 2 ;SCREEN POINTER
;
;VARIABLES
;
COUNTER .DS 3 ;AUTO DEMO COUNTER
ACTIVE .DS 1 ;NUMBER IN USE
NEAREST ; ZOMBIE MOVE CLOSE MAN'S #
COUNT .DS 1 ;GENL PURPOSE
DIGITNO ; SCORE KEEPING
CURLINE .DS 1 ;BOTSCRN LINE NO
HOLDIT .DS 1 ;GENL PURPOSE
PLYRS .DS 1 ;# OF PLAYERS
DIRSHFT ; BACKLASH DIRECTION REG
DX ; ZOMBIE MOVE X DIST
SAVEIT ; WINNER # SAVE
ZMBYS .DS 1 ;# OF ZOMBIES
DIST ; ZOMBIE MOVE CRNT SHORT DIST
DIREC .DS 1 ;BACKLASH DIRECTION
;
;DATA FOR EACH PLAYER
;
ACTFLAG .DS 4 ;WHAT HE'S DOING
DIR .DS 4 ;DIRECTION POINTING/MOVING
LOCHI .DS 4 ;ABSOLUTE MEM LOC HI
LOCLO .DS 4 ;ABSOLUTE MEM LOC LO
LOCX .DS 4 ;X LOCATION (0-19)
LOCY .DS 4 ;Y LOCATION (0-18)
MOVCLOK .DS 4 ;TIME TILL NEXT MOVE
MOVEST .DS 4 ;STATUS IN MOVE
MOVRATE .DS 4 ;MOVEMENT RATE
NXTSCR .DS 4 ;SCORE FOR NEXT KILL
SCRPND .DS 4 ;SCORE WAITING ADDITION
SHOTDIR .DS 4 ;SHOT MOVE DIRECTION
SHOTHI .DS 4 ;SHOT ABS MEM LOC HI
SHOTLO .DS 4 ;SHOT ABS MEM LOC LO
SHOTMST .DS 4 ;SHOT STATUS IN MOVE
SOUND .DS 4 ;SOUND HOLDING REGISTER
TYPE .DS 4 ;WIZARD=0, ZOMBIE=1
;
*= $2000
;
;CHARACTER SET DATA
;------------------
;
CHRSET .BYTE 0,0,0,0,0,0,0,0 ;SPACE
.BYTE 0,40,86,20,0,0,0,0 ;SHOTS
.BYTE 0,60,191,40,0,0,0,0
.BYTE 0,0,0,0,32,188,188,48
.BYTE 16,88,88,32
.BYTE 32,188,188,48
.BYTE 16,88,88,32,0,0,0,0
MASKL .BYTE 3,3,3,63,51
.BYTE 3,3,15 ;COALESCE MASKS
MASKR .BYTE 192,192,15,252
.BYTE 192,192,48,60
PL0CHR .BYTE 0,0,0,0,0,0,0,0
.BYTE 0,0,0,0,0,0,0,0
.BYTE 0,0,0,0,0,0,0,0
.BYTE 0,0,0,0,0,0,0,0
.BYTE 0,0,0,0,0,0,0,0
.BYTE 0,0,0,0,0,0,0,0
.BYTE 0,0,0,0,0,0,0,0
.BYTE 0,0,0,0,0,0,0,0
.BYTE 0,126,102,102,102
.BYTE 102,126,0 ;NUMBERS 0
.BYTE 0,24,24,24
.BYTE 24,24,24,0 ;1
.BYTE 0,126,6,126
.BYTE 96,102,126,0 ;2
.BYTE 0,126,6,30
.BYTE 6,102,126,0 ;3
.BYTE 0,96,108,108
.BYTE 126,12,12,0 ;4
.BYTE 0,126,96,126
.BYTE 6,102,126,0 ;5
.BYTE 0,126,96,126
.BYTE 102,102,126,0 ;6
.BYTE 0,126,6,12
.BYTE 24,24,24,0 ;7
.BYTE 0,126,102,126
.BYTE 102,102,126,0 ;8
.BYTE 0,126,102,126
.BYTE 6,102,126,0 ;9
.BYTE 0,0,24,24
.BYTE 0,24,24,0 ;COLON
.BYTE 141,54,108,73,44,210
.BYTE 182,75 ;EXPLOSION CHARS
.BYTE 0,0,0,0,44,210,182,75
.BYTE 141,54,108,73,0,0,0,0
.BYTE 0,0,0,2,10
.BYTE 43,175,60 ;TITLE CHAR
.BYTE 0,2,138,171
.BYTE 239,204,0,0 ;TITLE CHAR
OUTWALL .BYTE 94,91,94,85,229
.BYTE 181,229,85 ;OUTER WALL
.BYTE 0,24,60,102,102
.BYTE 126,102,231 ;LETTERS A
.BYTE 0,252,102,102
.BYTE 124,102,102,124 ;B
.BYTE 0,126,198,192
.BYTE 192,192,198,126 ;C
.BYTE 0,252,102,102
.BYTE 102,102,102,252 ;D
.BYTE 0,254,102,96
.BYTE 120,96,102,254 ;E
.BYTE 128,176,176,176,178
.BYTE 186,171,63 ;TITLE CHAR
.BYTE 0,126,198,192
.BYTE 206,198,198,126 ;G
.BYTE 2,10,42,174,170
.BYTE 254,194,0 ;TITLE CHAR
.BYTE 0,60,24,24
.BYTE 24,24,24,60 ;I
.BYTE 42,207,192,194,202
.BYTE 235,234,207 ;TITLE CHAR
.BYTE 0,206,216,240
.BYTE 252,204,204,206 ;K
.BYTE 0,240,96,96
.BYTE 96,96,102,254 ;L
.BYTE 0,99,119,127
.BYTE 107,99,99,99 ;M
.BYTE 0,198,102,118
.BYTE 126,126,110,230 ;N
.BYTE 0,124,198,198
.BYTE 198,198,198,124 ;O
.BYTE 0,252,102,102
.BYTE 124,96,96,240 ;P
.BYTE 168,235,175,190,240
.BYTE 192,168,255 ;TITLE CHAR
.BYTE 0,252,102,102
.BYTE 124,108,108,230 ;R
.BYTE 0,126,198,192
.BYTE 124,6,198,252 ;S
.BYTE 0,126,90,24
.BYTE 24,24,24,60 ;T
.BYTE 0,231,102,102
.BYTE 102,102,102,60 ;U
.BYTE 10,43,175,170
.BYTE 175,40,10,3 ;TITLE CHAR
.BYTE 0,99,99,99
.BYTE 107,127,119,99 ;W
.BYTE 0,192,0,0
.BYTE 192,0,0,192 ;TITLE CHAR
.BYTE 0,231,102,60
.BYTE 24,24,24,60 ;Y
.BYTE 0,254,204,24
.BYTE 48,96,198,254 ;Z
.BYTE 128,176,178,186,170
.BYTE 174,190,48 ;TITLE CHAR
.BYTE 0,2,10,235,175
.BYTE 190,250,195 ;TITLE CHAR
.BYTE 160,190,250,235,170
.BYTE 191,240,192 ;TITLE CHAR
.BYTE 136,186,186,187,186
.BYTE 187,187,51 ;TITLE CHAR
.BYTE 0,0,128,160,188
.BYTE 160,40,15 ;TITLE CHAR
STLCHR .BYTE 3,3,3,21,49
.BYTE 1,1,10 ;PLAYERS/ZOMBIES
STRCHR .BYTE 192,192,5,92
.BYTE 64,64,16,40
.BYTE 60,60,48,20,20,52,16,40
.BYTE 3,3,3,21,17,17,1,10
.BYTE 192,192,12,84
.BYTE 64,64,16,40
.BYTE 192,192,192,84
.BYTE 76,16,40,0
.BYTE 0,0,3,3,3,21,17,4
.BYTE 0,0,192,192
.BYTE 192,84,76,64
.BYTE 40,0,0,0,0,0,0,0
.BYTE 64,160,0,0,0,0,0,0
.BYTE 0,0,0,0,3,3,3,21
.BYTE 0,0,0,0,192,192,192,84
.BYTE 17,17,1,10,0,0,0,0
.BYTE 76,16,40,0,0,0,0,0
.BYTE 0,0,0,0,0,0,3,3
.BYTE 0,0,0,0,0,0,192,192
.BYTE 3,21,17,4,40,0,0,0
.BYTE 192,84,76,64,64,160,0,0
.BYTE 3,3,80,53,1,1,4,40
.BYTE 192,192,192,84
.BYTE 76,64,64,160
.BYTE 60,60,12,20,20,28,4,40
.BYTE 3,3,48,21,1,1,4,40
.BYTE 192,192,192,84
.BYTE 68,68,64,160
.BYTE 1,21,49,4,40,0,0,0
.BYTE 64,84,68,64,64,160,0,0
.BYTE 0,0,0,0,192,196,68,84
.BYTE 49,1,1,10,0,0,0,0
.BYTE 64,16,40,0,0,0,0,0
.BYTE 0,0,3,3,1,21,49,4
.BYTE 0,0,192,192,64,84,68,64
.BYTE 192,196,68,84
.BYTE 64,16,40,0
.BYTE 0,0,0,0,0,0,0,0
.BYTE 3,15,63,255,254,252
.BYTE 252,255 ;A.N.A.L.O.G.
.BYTE 255,255,255,128,0
.BYTE 0,0,255 ;CHARACTERS
.BYTE 255,255,255,15
.BYTE 15,15,15,207
.BYTE 0,192,192,192
.BYTE 192,192,192,192
.BYTE 255,255,255,255
.BYTE 255,254,254,255
.BYTE 240,248,252,254
.BYTE 63,31,15,7
.BYTE 7,15,15,15
.BYTE 15,143,207,239
.BYTE 128,192,192,192
.BYTE 192,192,192,192
.BYTE 248,252,252,252
.BYTE 252,254,255,255
.BYTE 0,0,0,0,0,0,0,128
.BYTE 63,255,255,255
.BYTE 254,252,252,254
.BYTE 255,255,255,128
.BYTE 0,0,0,0
.BYTE 255,255,255,15
.BYTE 15,15,15,15
.BYTE 255,255,255,128
.BYTE 0,0,0,15
.BYTE 255,255,255,0
.BYTE 0,0,0,255
.BYTE 0,192,192,0,0,0,0,0
.BYTE 255,255,255,255
.BYTE 255,255,255,63
.BYTE 255,255,192,224
.BYTE 240,248,248,240
.BYTE 239,207,15,15
.BYTE 15,12,12,7
.BYTE 192,192,192,192
.BYTE 192,192,192,128
.BYTE 131,193,224,224
.BYTE 224,224,224,128
.BYTE 255,255,255,127
.BYTE 63,28,12,7
.BYTE 192,224,240,248
.BYTE 252,255,255,255
.BYTE 0,0,0,0,0,255,252,255
.BYTE 0,0,0,0,0,128,192,128
.BYTE 0,128,192,224
.BYTE 240,255,255,255
.BYTE 15,15,15,15
.BYTE 15,252,252,255
.BYTE 7,131,192,224
.BYTE 240,255,255,255
.BYTE 255,255,15,15
.BYTE 15,252,252,255
.BYTE 170,254,254,170
.BYTE 239,239,170,254 ;WALLS
.BYTE 254,170,239,239
.BYTE 170,254,254,170
.BYTE 239,239,170,254
.BYTE 254,170,239,239
;
;PM IMAGE DATA
;-------------
;
;WIZARD/ZOMBIE "SUITS"
;
SUITS .BYTE 0,0,0,124,24,24,20,0
.BYTE 0,0,0,24,24,8,16,0
.BYTE 0,0,0,126,24,24,20,0
.BYTE 0,0,0,24,24,8,16,0
.BYTE 0,0,0,126,24,20,16,0
.BYTE 0,0,0,126,24,40,8,0
.BYTE 0,0,0,126,24,20,16,0
.BYTE 0,0,0,126,24,40,8,0
.BYTE 0,0,0,62,24,24,40,0
.BYTE 0,0,0,24,24,16,8,0
.BYTE 0,0,0,126,24,24,40,0
.BYTE 0,0,0,24,24,16,8,0
.BYTE 0,0,24,126,24,20,16,0
.BYTE 0,0,24,126,24,40,8,0
.BYTE 0,0,24,126,24,20,16,0
.BYTE 0,0,24,126,24,40,8
;
;WINNING PLAYER ALL IN PM
;
WINPLYR .BYTE 0,0,0,124,24,24,20,0
.BYTE 0,0,3,0,0,0,0,0
.BYTE 0,0,0,0,0,0,0,54
.BYTE 24,24,16,2,64,0,0,0
;
;EVAPORATION DATA
;
SMOKE .BYTE $1C,$66,$75,$1C
.BYTE $0C,$18,$0C,0
.BYTE $38,$6E,$D7,$FE
.BYTE $18,$10,$18,0
.BYTE $3C,$7E,$FF,$FF
.BYTE $DB,$18,$18,$18
.BYTE $3C,$7E,$FF,$FF
.BYTE $FF,$3C,$3C,$3C
.BYTE 0,$3C,$7E,$7E
.BYTE $7E,$3C,$3C,$7E
;
;COLOR DATA
;
COLTBL .BYTE $C8,$86,$58,$28
.BYTE $96,$2A,$00,$34
;
;
;******************
;** MAIN PROGRAM **
;******************
;
;INITIALIZATIONS
;---------------
;
INIT LDA KEYCODES ;CHECK ATASCII
ORA KEYCODES+1 ;CONVERT TABLE
BNE INITPLR ;IF SET, GO ON
LDA #$FE ;INIT TO $FEFE
STA KEYCODES
STA KEYCODES+1
;
INITPLR LDA #0 ;INIT PLAYERS
LDX #3
STWIDTH STA SIZEP0,X ;SET WIDTHS
DEX
BPL STWIDTH
STA AUDCTL
STA COLOR4 ;COLOR 4=BLACK
LDA # >PMAREA ;SET PMBASE,
STA PMBASE ; DMACTL, GRACTL,
LDA #$3E ; AND GPRIOR
STA DMACTL
LDA #$03
STA GRACTL
STA SKCTL ;INIT SOUND
LDA #$01
STA GPRIOR
LDA # >CHRSET ;SET CHRSET
STA CHBASE
LDA #$40 ;DISABLE DLI
STA NMIEN
LDA # <DLI ;SET DLI VECTOR
STA VDSLST
LDA # >DLI
STA VDSLST+1
;
;TITLES/GAME OVER ENTRY
;----------------------
;
RESTART LDA #$40 ;DISABLE DLI
STA NMIEN
LDA # <TITLDISP ;TURN ON THE
STA DLIST ;TITLE DISPLAY
LDA # >TITLDISP
STA DLIST+1
LDY #7 ;SET COLORS
SCOL LDA COLTBL,Y
STA PCOLR0,Y
DEY
BPL SCOL
LDA #0 ;CLR PM GRAPHICS
TAY
CLEARPM STA PL0,Y
STA PL1,Y
STA PL2,Y
STA PL3,Y
DEY
BNE CLEARPM
STA AUDC1 ;TURN OFF SOUND
STA AUDC2
STA AUDC3
STA AUDC4
STA COUNTER ;INITIALIZE DEMO
STA COUNTER+1 ;WAIT COUNTER
LDA #10 ;FOR 30 SECONDS
STA COUNTER+2
;
;SETUP TITLE WALKERS
;
LDA # <WLKLINE ;SET MEM LOCS
STA LOCLO
LDA # >WLKLINE
STA LOCHI
LDA # <WLKLINE+38
STA LOCLO+1
LDA # >WLKLINE+38
STA LOCHI+1
LDA #2 ;SET DIRECTIONS
STA DIR+1
LDA #0
STA DIR
STA ACTFLAG ;SET ACTIONS
STA ACTFLAG+1
STA MOVEST ;CLR MOVE STATUS
STA MOVEST+1
STA LOCX ;SET X-LOCATIONS
LDA #19
STA LOCX+1
LDA #15 ;AND Y-LOCATIONS
STA LOCY
STA LOCY+1
LDA #10 ;SET # OF STEPS
STA MOVCLOK
STA MOVCLOK+1
JSR STIMER
;
;TITLE SCREEN LOOP FOR SELECTIONS
;--------------------------------
;
SELOOP DEC COUNTER ;COUNTDOWN TO
BNE MVWLKRS ;AUTO DEMO START
DEC COUNTER+1
BNE MVWLKRS
DEC COUNTER+2
BEQ STDEMO ;=0 START UP DEMO
;
MVWLKRS LDA COUNTER ;MOVE WALKERS
BNE CHKKEYS ;EVERY 8TH PASS
LDA COUNTER+1
AND #$03 ;TURN OFF SOUND
BNE CHKKEYS ;EVERY 4TH PASS
STA AUDC1
STA AUDC2
LDA COUNTER+1
AND #$07
BNE CHKKEYS
LDX #1 ;TWO TO MOVE
MVWLKLP LDA MOVEST,X ;GET MOVE STATUS
BEQ STWLKMV ;ZERO? START NEW
JSR MOVEIM ;ELSE CONTINUE
JMP DNXWLKR ;DO NEXT
STWLKMV DEC MOVCLOK,X ;COUNT OFF STEP
BNE WKSMDIR ;IF >0, SKIP
LDA DIR,X ;REVERSE DIR
EOR #$02
STA DIR,X
LDA #9 ;RESET STEP CNT
STA MOVCLOK,X
WKSMDIR JSR INITMVE ;START NEW MOVE
DNXWLKR DEX ;DO NEXT WALKER
BPL MVWLKLP
;
CHKKEYS LDY KEYIN ;GET KBD INPUT
LDA #$FF ;CLR REG FOR NEXT
STA KEYIN
LDA (KEYCODES),Y ;ATASCII
CMP #49 ;"1".."9"?
BCC CKDEMO
CMP #59
BCS CKDEMO
AND #$1F ;YES, SET ZOMBIE
STA ZOMSPD ;SPEED AND
BNE GTCNSL ;CHECK CONSOL
CKDEMO CMP #'d ;CHECK FOR "D"
BNE GTCNSL ;NO, CHECK CONSOL
STDEMO LDA #0 ;YES, START DEMO
STA PLYRS ;PLAYERS=0
LDA #3 ;ZOMBIES=3
STA ZMBYS
JMP SETACT ;AND GO
SEJUMP JMP SELOOP
;
GTCNSL LDA STRIG0 ;START GAME IF
BEQ START ;STRIG 0 PRESSED
LDA CDTMF5 ;SYS TIMER FLAG
BNE SEJUMP ;BOUNCE OVER? NO
LDA CONSOL ;GET CONSOL KEY
CMP #6 ;IF START, DO IT
BEQ START
AND #$06
EOR #$06 ;INVERT THE REST
BEQ SEJUMP ;IF NONE OR BOTH
CMP #6 ;KEYS PRESSED,
BEQ SEJUMP ;LOOP BACK
CMP #2 ;SELECT PRESSED?
BEQ CNGPLYR ;CLANGE #PLYRS
;
INC ZOMBIES ;ADD 1 TO # OF
CLC ;ZOMBIES
LDA ZOMBIES ;IF TOTAL ZOMBIES
ADC PLAYERS ;AND PLAYERS <5,
CMP #$A5 ;WE'RE DONE
BCC WTCNSL
LDA #$50 ;ELSE, SET # OF
STA ZOMBIES ;ZOMBIES TO ZERO,
BNE WTCNSL ;WAIT FOR RELEASE
;
CNGPLYR INC PLAYERS ;ADD 1 TO # OF
LDA PLAYERS ;PLAYERS
CMP #$55 ;IF <5, CHECK ON
BCC CKZMBIE ;# OF ZOMBIES
LDA #$51 ;SET # PLAYERS TO
STA PLAYERS ;1 AND WAIT FOR
BNE WTCNSL ;CONSOL RELEASED
CKZMBIE CLC ;IF ZOMBIES PLUS
ADC ZOMBIES ;PLAYERS>5, WAIT
CMP #$A5 ;CONSOL RELEASE
BCC WTCNSL ;ELSE, DEC # OF
DEC ZOMBIES ;ZOMBIES
WTCNSL JSR STIMER
JMP SELOOP ;GOTO TOP OF LOOP
;
STIMER LDA #5 ;SET TIMER 5
LDY # <40 ;2/3 SEC DELAY
LDX # >40
JSR SETVBV
LDA #1 ;SET FLAG FOR
STA CDTMF5 ;TIMER #5
RTS
;
;GAME START SETUP
;----------------
;
START JSR STIMER
LDA PLAYERS ;SET PLYRS
AND #$0F
STA PLYRS
LDA ZOMBIES
AND #$0F
STA ZMBYS ;AND ZMBYS
CLC
ADC PLYRS
CMP #1 ;IF TOTAL=1,
BNE SETACT
STA ZMBYS ;SET ZOMBIES TO 1
LDA #2 ;AND UP TOTAL
SETACT STA ACTIVE ;SET # OF ACTIVE
DEC ACTIVE ;PARTICAPANTS
;
LDX #0 ;ERASE WALKERS
JSR ERASMAN
INX
JSR ERASMAN
;
;SETUP GAME SCREEN
;
LDA # <[MAZEDAT-$84]
STA POINTER
LDA # >[MAZEDAT-$84] ;SOURCE
STA POINTER+1
LDA # <[GAMESCR-$84]
STA SCRPTR
LDA # >[GAMESCR-$84] ;DEST
STA SCRPTR+1
LDX #1
LDY #$84
STSCRLP LDA (POINTER),Y ;GET A BYTE
STA (SCRPTR),Y ;SAVE IT ONCE
INC SCRPTR ;ADD 1 TO DEST
BNE STSCP2
INC SCRPTR+1
STSCP2 STA (SCRPTR),Y ;SAVE TWICE +
INY ;COPY THE NXT ONE
BNE STSCRLP
INC POINTER+1
INC SCRPTR+1
DEX
BPL STSCRLP
;
;ERASE SCREEN BOTTOM
;
LDA # <BOTSCRN
STA SCRPTR
LDA # >BOTSCRN
STA SCRPTR+1
LDY #79
LDA #0
ERASBOT STA (SCRPTR),Y
DEY
BPL ERASBOT
;
;SET SCREEN BOTTOM
;
LDA #0 ;SET COLOR COUNT
STA COUNT
LDA # <[BOTSCRN+4] ;INIT SCRN
STA SCRPTR
LDA # >[BOTSCRN+4] ;PNTR
STA SCRPTR+1
LDA PLYRS ;GET # OF PLAYERS
BEQ STZMTXT ;IF 0(DEMO), SKIP
STA HOLDIT ;SAVE IT
LDA # <PLRTXT ;SET PTR TO
STA POINTER ;"WIZARD" TEXT
LDA # >PLRTXT
STA POINTER+1
JSR SETBOTM ;AND SET 'EM
STZMTXT LDA ZMBYS GET # OF ZOMBIES
BEQ PUTMIN ;IF 0, SKIP
STA HOLDIT ;ELSE, SAVE IT
LDA # <ZOMTXT ;SET PTR TO
STA POINTER ;"ZOMBIE" TEXT
LDA # >ZOMTXT
STA POINTER+1
JSR SETBOTM ;AND SET 'EM
;
;INITIALIZE ACTIVE PARTICIPANTS
;
PUTMIN LDX ACTIVE ;SET ALL ACTIVE
SETALLP LDA #0 ;TYPE = PLAYER
STA TYPE,X
STA SCRPND,X ;0 SCORE TO ADD
STA ACTFLAG,X ;ACTION TO NONE
LDA #3 ;MOVE RATE =3
STA MOVRATE,X ;(PLR DEFAULT)
LDA #5 ;NEXT HIT SCORE=5
STA NXTSCR,X
JSR FNDSPOT ;SET 'IM ON SCRN
CPX PLYRS ;IF THIS IS A
BCC STNXPLR ;PLAYER, SKIP
LDA #$1B ;SET MOVE RATE
SBC ZOMSPD ;BY ZOMBIE SPEED
STA MOVRATE,X
LDA #1 ;TYPE = ZOMBIE
STA TYPE,X
STNXPLR DEX ;DO NEXT
BPL SETALLP
;
LDA PLYRS ;PLAYERS=0? THIS
BNE PUTINVB ;IS A DEMO, SET
LDA #3 ;PLYRS=3 TO FOOL
STA PLYRS ;ZOMBIES
;
PUTINVB JSR STGAMVB ;INSTALL GAME VBI
LDA # <GAME ;PUT UP GAME SCRN
STA DLIST
LDA # >GAME
STA DLIST+1
LDA #$C0 ;ENABLE DLI
STA NMIEN
;
;MAIN PROGRAM LOOP
;-----------------
;
STRTCN LDA CDTMF5 ;CHECK CONSOL
BNE CHKSCRS ;AFTER 2/3 SEC
LDA CONSOL ;IF CONSOL KEY
CMP #$07 ;NOT PRESSED,
BEQ CHKSCRS ;KEEP PLAYING
JSR VBIOFF ;TURN OFF VBI
EXITLP LDA CONSOL ;WAIT FOR CONSOL
CMP #$07 ;KEY AND STRIG 0
BNE EXITLP ;TO BE RELEASED
LDA STRIG0
BEQ EXITLP
JMP RESTART ;AND GOTO TITLES
;
CHKSCRS LDX ACTIVE ;GET # TO DO
UDSCORS LDA SCRPND,X ;GET # TO ADD
BEQ DONXSCR ;IF =0, DO NEXT
LDY SCRINDX,X ;GET BASE INDEX
CLC ;TO SCORE AND ADD
ADC SCORE,Y ;TO SCORE
STA SCORE,Y
LDA #0 ;CLR SCORE TO ADD
STA SCRPND,X
LDA #1 ;DIGIT # FOR END
STA DIGITNO ;GAME DETECTION
ADDSCR LDA SCORE,Y ;DONE?
BEQ DONXSCR ;YES, DO NEXT
CMP #$DA ;THIS DIGIT >10?
BCC SCUNDX ;NO, GO TO RIGHT
SBC #10 ;YES, SUBTRACT 10
STA SCORE,Y ;FROM THIS DIGIT
DEY ;POINT TO NEXT
DEC DIGITNO
BMI GAMEOVR ;OVER 100! END IT
LDA SCORE,Y ;GET NEW DIGIT
BNE SCDGTNZ ;IF BLANK,
LDA #$D0 ;SET TO ZERO
SCDGTNZ CLC ;ADD 1 TO IT
ADC #1
STA SCORE,Y ;SAVE IT
BNE ADDSCR ;AND LOOP
SCUNDX INY ;GO RIGHT 1 DIGIT
INC DIGITNO
BNE ADDSCR ;CHECK NEXT ONE
DONXSCR DEX ;TRY ADD TO
BPL UDSCORS ;NEXT SCORE
;
;CHECK FOR AND PAUSE GAME
;
LDA KEYIN ;CHECK KBD
CMP #255 ;ANY PRESSED?
BNE PAUSE ;GO TO TOP OF
JMP STRTCN ;MAIN LOOP
PAUSE JSR VBIOFF ;TURN OFF VBI
LDA #255 ;CLEAR KBD INPUT
STA KEYIN
LDA #0 ;TURN OFF SOUND
STA AUDC1
STA AUDC2
STA AUDC3
STA AUDC4
HLDPTRN LDA KEYIN ;AND WAIT FOR
CMP #255 ;A KEY TO BE
BEQ HLDPTRN ;PRESSED
JSR STGAMVB ;RE-SET GAME VBI
LDA #255 ;CLEAR KBD INPUT
STA KEYIN
JMP STRTCN ;GOTO TOP OF LOOP
;
;GAME END HANDLING ROUTINES
;--------------------------
;
GAMEOVR STX SAVEIT
JSR VBIOFF ;TURN OFF VBI
LDA #0 ;AND ALL SOUND
STA AUDC1
STA AUDC2
STA AUDC3
STA AUDC4
;
;SET WINNER MESSAGE
;
LDX SAVEIT
LDY #3 ;INDEX - TEXT SET
LDA SCRINDX,X ;SET POINTER TO
CLC ;WINNER'S SCORE
ADC # <SCORE-1
STA SCRPTR
LDA # >SCORE-1
STA SCRPTR+1
BCC STENDTX
INC SCRPTR+1
STENDTX LDA ENDTXT,Y ;AND SET IT
STA (SCRPTR),Y ;TO "WINS"
DEY
BPL STENDTX
;
;EVAPORATE ALL LOSERS
;
LDA #0 ;CLEAR
STA ACTFLAG,X ;WINNER ACTION
STX SAVEIT ;SAVE WINNER #
LDX ACTIVE ;GET # TO DO
STALLEV CPX SAVEIT ;IF =WINNER,
BEQ STNXTEV ;DO NEXT ONE
JSR ERASMAN ;ELSE ERASE 'IM
LDA #2 ;ACTION=EVAPORATE
STA ACTFLAG,X
LDA #9 ;MOVEST FOR EVAP
STA MOVEST,X
STNXTEV DEX ;DO THE NEXT ONE
BPL STALLEV
;
DOALLEV LDA RTCLOK
DOAL2 CMP RTCLOK
BEQ DOAL2
LDA #0 ;INIT END COUNT=0
STA COUNT
LDX ACTIVE ;LOOP FOR ALL
EVAPEM LDA COUNT ;ADD THIS ACTFLAG
CLC ;TO COUNT
ADC ACTFLAG,X ;(FOR END CHK)
STA COUNT
JSR EVAPRTE ;AND DO EVAP
DEX
BPL EVAPEM ;DO NEXT
LDA COUNT ;IF COUNT=ACTIVE,
CMP ACTIVE ;WE'RE DONE,
BNE DOALLEV ;OTHERWISE LOOP
;
;SET WINNER AS ALL PM
;
LDX SAVEIT ;GET WINNER #
JSR ERASMAN ;ERASE 'IM + SET
LDA PCOLR0,X ;1ST PM COLOR
STA PCOLR0 ;TO WINNING COLOR
LDA #PFCOL0 ;AND OTHERS TO
STA PCOLR1 ;NORMAL PF COLORS
LDA #PFCOL1
STA PCOLR2
LDA #PFCOL3
STA PCOLR3
LDA # <WINPLYR ;SET POINTER
STA POINTER ;TO ALL PM IMAGES
LDA # >WINPLYR
STA POINTER+1
LDA LOCY,X ;SET SCRPTR
ASL A ;TO LOC
ASL A
ASL A
CLC
ADC #$20
STA SCRPTR
LDA # >PL0
STA SCRPTR+1
LDA #3 ;COUNT THRU
STA COUNT ;ALL 3 PLYRS
SETWINR LDY #7 ;SET ONE COLOR
SETPRTS LDA (POINTER),Y
STA (SCRPTR),Y
DEY
BPL SETPRTS
LDA LOCX,X ;SET HORIZ LOC
ASL A ;TO XLOC*8+48
ASL A
ASL A
CLC
ADC #48
LDY COUNT
STA HPOSP0,Y
LDA POINTER ;POINT TO NEXT
CLC ;COLOR'S IMAGES
ADC #8
STA POINTER
BCC UDWNSCP
INC POINTER+1
UDWNSCP INC SCRPTR+1 ;POINT TO NEXT
DEC COUNT ;PLAYER
BPL SETWINR ;AND DO IT
;
;FADE ALL COLORS TO BLACK
;
LDA #16 ;SET COLOR LUM
STA COUNT ;LEVELS TO 16
FADEALL LDX #3 ;FADE COLRS=0..3
FADACOL LDA COLOR0,X ;GET THE COLOR
AND #$0F ;IF LUM <>0, CUT
BNE CUTCOLR ;IT DOWN
STA COLOR0,X ;SET TO BLACK
BEQ FADNXCL
CUTCOLR DEC COLOR0,X
FADNXCL LDY RTCLOK ;WAIT FOR A BIT
INY
INY
FADN2 CPY RTCLOK
BNE FADN2
DEX
BPL FADACOL ;FADE NEXT COLOR
DEC COUNT
BPL FADEALL ;AND DO NEXT LUM
;
;WAIT A BIT TO SHOW OFF SCORES
;
LDA #7
STA HOLDIT
WAIT0 LDX #$FF
WAIT1 LDY #$FF
WAIT2 LDA CONSOL ;END DELAY EARLY
CMP #7 ;IF A CONSOL KEY
BNE ENDGOBK ;HAS BEEN PRESSED
DEY
BNE WAIT2
DEX
BNE WAIT1
DEC HOLDIT
BPL WAIT0
ENDGOBK JMP RESTART ;GOTO TITLES
;
;MAIN PROGRAM SUBROUTINES
;------------------------
;
;SET SCREEN BOTTOM LINES (1 TYPE ONLY)
SETBOTM LDA #0 ;SET TYPE'S LINE
STA CURLINE ;COUNT TO 0
SETLNLP INC CURLINE ;ADD 1 TO LINE
LDX #6 ;GET LENGTH INDEX
LDY COUNT ;GET COLOR INDEX
SETALIN LDA (POINTER),Y ;SET TYPE
STA (SCRPTR),Y ;TEXT LINE
INY
DEX
BNE SETALIN
INY ;SET TYPE NUMBER
LDA CURLINE
ORA #$D0
STA (SCRPTR),Y
INY ;INIT SCORE FOR
INY ;'IM TO ZERO
INY
INY
LDA #$D0
STA (SCRPTR),Y
LDA COUNT ;ADD 6
CLC ;TO COLOR INDEX
ADC #6
STA COUNT
LDA SCRPTR ;POINT TO NEXT
CLC ;LINE
ADC #14
STA SCRPTR
BCC CHKDONL
INC SCRPTR+1
CHKDONL LDA CURLINE ;IF WE'VE GOT
CMP HOLDIT ;MORE LINES TO
BNE SETLNLP ;DO? DO 'EM
RTS ;RETURN
;
;INSTALL GAME VBI
;
STGAMVB LDY # <VBI
LDX # >VBI
BNE VBI1
;
;TURN OFF VBI
;
VBIOFF LDY # <XITVBV
LDX # >XITVBV
VBI1 LDA #7
JMP SETVBV
;
;****************************
;** VERTICAL BLANK ROUTINE **
;****************************
;(All of the game but scoring)
;
;MOVE OUTER WALL
;---------------
;
VBI LDA RTCLOK ;TIME TO MOVE?
AND #$07
BNE MOVGUYS ;NO, MOVE PLAYERS
LDX OUTWALL ;SAVE FIRST BYTE
LDY #1 ;OF WALL AND LOOP
MOVWALL LDA OUTWALL,Y ;CHANGING REST
ASL A ;GET BYTE + SHIFT
ROL A ;IT LEFT 1 PIXEL
STA HOLDIT
AND #$01
ADC HOLDIT
DEY ;AND MOVE IT UP
STA OUTWALL,Y ;1 LINE
INY
INY
CPY #8
BNE MOVWALL ;LOOP FOR NEXT
TXA ;GET BACK FIRST
ASL A ;SHIFT OVER FIRST
ROL A
STA HOLDIT
AND #$01
ADC HOLDIT
STA OUTWALL+7 ;SAVE AT END
;
;MOVE PLAYERS/ZOMBIES
;--------------------
;(Includes shot initialization)
;
MOVGUYS LDX ACTIVE ;INIT LOOP COUNT
CKMVLP LDA ACTFLAG,X ;IF HE IS
AND #$03 ;EVAPORATING OR
BEQ CHKTIME ;COALESCING, SKIP
JMP CHKSHOT ;MOVE + DO SHOTS
;
;CHECK TIME TO MOVE
;
CHKTIME DEC MOVCLOK,X ;TIME TO MOVE?
BEQ SETIME ;YES, RESET TIME
LDA ACTFLAG,X ;IF NO SOUND
BNE CKTIMND ;MAKING THING IS
TXA ;GOING ON, TURN
ASL A ;OFF THE SOUND
TAY ;(THIS FOR BETTER
LDA #0 ;SOUNDING WALK)
STA AUDC1,Y
CKTIMND JMP CHKSHOT ;AND DO SHOTS
;
;RESET MOVE TIMER AND PARSE
;TO MOVE ROUTINES
;
SETIME LDA MOVRATE,X ;RESET MOVE
STA MOVCLOK,X ;TIMER
LDA MOVEST,X ;NOT MOVING? TRY
BEQ STRTMOV ;MOVING SOMETHING
JSR MOVEIM ;ELSE, UPDATE
JMP CHKSHOT ;AND DO SHOTS
;
STRTMOV LDA TYPE,X ;IF ZOMBIE THEN
BEQ PLRMVE ;JUMP TO THEIR
JMP ZOMOVE ;MOVE ROUTINES
;
;READ STICK AND SET DIRECTION IF
;IT HAS BEEN MOVED. ALSO, DO ZIGZAG
;
PLRMVE LDA STICK0,X ;READ THE STICK
EOR #$0F ;IF IT IS MOVED,
BNE TRYDIR ;DO IT
JMP CHKSHOT ;ELSE, DO SHOTS
;
TRYDIR TAY ;CONVERTED DIR
LDA CONVERT,Y
CMP #4 ;IS IT DIAGONAL?
BNE SETDIR ;NO, SET IT
STY HOLDIT ;SAVE IT
TYA ;GET LAST DIR
LDY DIR,X ;FOR ZIGZAG MASK
AND XYMASK,Y ;TRY IT ON NEW
TAY ;CONVERT TO NORM
LDA CONVERT,Y
STA DIR,X ;SAVE IT + CHECK
JSR GETAHEDM ;IF THERE'S ROOM
BEQ CHKTRIG ;YES, LOOK TRIG
LDA HOLDIT ;USE OTHER DIR
LDY DIR,X
AND XYMASK,Y
TAY
LDA CONVERT,Y ;CONVERT IT
SETDIR STA DIR,X ;AND SET IT
;
;READ TRIGGER AND PARSE TO INIT
;SHOT OR MOVE ROUTINES
;
CHKTRIG LDA #0 ;CLR ATRACT SINCE
STA ATRACT ;STICK WAS MOVED
LDA STRIG0,X ;TRIG PRESSED?
BEQ INITSHOT ;YES, START SHOT
JSR GETAHEDM ;LOOK FOR ROOM
BEQ INITMOVE ;FOUND, DO MOVE
JSR SETSTIL ;NONE. POINT 'IM
JMP CHKSHOT ;AND DO SHOTS
;
;BEGIN A MOVE CYCLE
;
INITMOVE JSR INITMVE ;DO LOC ADDS AND
LDY NXTSCR,X ;START IT OFF.
INY ;ADD 1 TO NEXT
CPY #23 ;NEXT KILL VALUE
BCC STNXSC
LDY #22
STNXSC TYA
STA NXTSCR,X
JMP CHKSHOT ;DO SHOTS
;
;FIRE OFF A SHOT IF WE CAN
;
INITSHOT LDA ACTFLAG,X ;ARE WE BEING
AND #$F0 ;PREVENTED FROM
BNE CHKSHOT ;FIRING? YES.
JSR SETSTIL ;SET PLYRS DIR
LDY NXTSCR,X ;SUBTRACT 2 FROM
DEY ;NEXT KILL VALUE
DEY
CPY #5
BCS STNSCDN
LDY #5
STNSCDN TYA
STA NXTSCR,X
LDA DIR,X ;SET SHOT DIR
STA SHOTDIR,X
JSR GETAHEDM ;ANYTHING THERE?
BNE FSKILL ;YES, KILL IT
LDA SCRPTR ;SET SHOT'S
STA SHOTLO,X ;LOCATION
LDA SCRPTR+1
STA SHOTHI,X
LDA ACTFLAG,X ;SET ACTION
ORA #$80 ;SHOOT FLAG ON
STA ACTFLAG,X
LDA #0 ;INIT SHOT
STA SHOTMST,X ;MOVE STATUS
LDA #$0C ;BEGIN SOUND
STA SOUND,X
LDY SHOTDIR,X ;SET SHOT
LDA SHSTOFS,Y ;ON SCREEN
CLC
ADC # <SHOTSHP
STA POINTER
LDA # >SHOTSHP
JSR SHRTSET ;EXIT TO SPECIAL
JMP COLESCE ;EFFECTS ROUTINES
;
;SHOT IMMEDIATE HIT
;
FSKILL CMP #$86 ;DID IT HIT
BCS FSKNRM ;ANOTHER SHOT?
LDA SCRPTR ;YES, START OFF
STA SHOTLO,X ;A BACKLASH AND
LDA SCRPTR+1 ;JUMP TO SPFX
STA SHOTHI,X ;ROUTINES
JSR STBKLSH
JMP COLESCE
FSKNRM LDA LOCLO,X ;NO, SET SHOT LOC
STA SHOTLO,X ;AND JUMP TO HIT
STA SCRPTR ;CHECK ROUTINES
LDA LOCHI,X
STA SHOTHI,X
STA SCRPTR+1
JMP CHKWALL
;
;MOVE SHOTS
;----------
;
CHKSHOT LDA ACTFLAG,X ;IS THERE ONE
BMI CHKHITS ;OUT THERE?
JMP COLESCE ;NO. DO SPFX
CHKHITS LDA SHOTMST,X ;IF MOVE STAT=0
BNE MOVSHOT ;THEN LOOK AHEAD
JSR GETAHEDS ;ANYTHING THERE?
BNE SHOTHIT ;GOTO SHOT HITS
MOVSHOT DEC SHOTMST,X ;UPDATE SHOT
LDA SHOTMST,X ;MOVE STATUS
AND #$01
STA SHOTMST,X ;<>0?
BEQ SETSHOT ;YES, WE CROSSED
LDY SHOTDIR,X ;A LOCATION, SO
LDA SHOTLO,X ;UPDATE IT.
CLC
ADC PRVADLO,Y
STA SHOTLO,X
LDA SHOTHI,X
ADC PRVADHI,Y
STA SHOTHI,X
SETSHOT LDA SHOTLO,X ;SET POINTERS
STA SCRPTR ;TO SHOT ON SCRN
LDA SHOTHI,X ;AND SHOT IMAGES
STA SCRPTR+1
LDA SHOTMST,X
ASL A
ASL A
ADC SHOTDIR,X
ASL A
ASL A
ADC # <SHOTSHP
STA POINTER
LDA # >SHOTSHP
ADC #0
STA POINTER+1
LDA SHOTDIR,X ;SET THE NEW
JSR SETMOVE ;IMAGE
LDA SHOTMST,X ;IF SHOT MOVE
BNE SHOTSND ;STATUS=0, THEN
LDY SHOTDIR,X ;UPDATE LOC
LDA SHOTLO,X ;(PART 2)
CLC
ADC AFTRADD,Y
STA SHOTLO,X
BCC SHOTSND
INC SHOTHI,X
SHOTSND INC SOUND,X ;UPDATE SOUND
TXA
ASL A
TAY
LDA SOUND,X
STA AUDF1,Y
LDA #$C6
STA AUDC1,Y
JMP COLESCE ;EXIT TO SPFX
;
;SHOT HIT CHECKS/HANDLING
;------------------------
;
SHOTHIT LDA ACTFLAG,X ;CLEAR SHOOTING
AND #$7F ;FLAG.
STA ACTFLAG,X
JSR ERASHOT ;ERASE SHOT
;
;CHECK HIT ON WALL
;
CHKWALL LDY SHOTDIR,X ;GET CHR WE
JSR GETAHEDS ;RAN INTO
CMP #$FD ;IF NOT WALL,
BCC CHKHSHT ;TRY SHOT
LDY #$00 ;CHANGE WALL'S
LDA (SCRPTR),Y ;BRICK COLOR
AND #$7F
STA (SCRPTR),Y
INY
LDA (SCRPTR),Y
AND #$7F
STA (SCRPTR),Y
LDA ACTFLAG,X ;SET
ORA #$20 ;EXPLODE FLAG
STA ACTFLAG,X
LDA #$36
STA SOUND,X ;INIT FOR SOUND
LDA SCRPTR ;SAVE WALL'S LOC
STA SHOTLO,X ;FOR EXPLOSION
LDA SCRPTR+1
STA SHOTHI,X
JMP COLESCE ;EXIT TO SPFX
;
;CHECK HIT ON ANOTHER SHOT
;
CHKHSHT CMP #$86 ;DID IT HIT SHOT?
BCC STSHBKL ;IF NO, CHECK
BCS CHKHMAN ;AGAINST A MAN
STSHBKL JSR STBKLSH ;SET FOR BACKLASH
STX HOLDIT ;SAVE LOOP CNTR
LDX ACTIVE ;FIND WHO WE HIT
CHKSHLP LDA ACTFLAG,X ;IF NO SHOT
BPL CHKNSHT ;FIRED, TRY NEXT
LDA SHOTLO,X ;SEE IF THEY
STA POINTER ;ARE IN THE SAME
LDA SHOTHI,X ;POSITION
STA POINTER+1 ;(TRY UP/LEFT)
LDA SHOTMST,X
BEQ CKSHT2
JSR SCPCMP
BEQ FNDSHOT ;SAME! KILL IT
LDY SHOTDIR,X ;(TRY DN/RT)
JSR SETPTR
CKSHT2 JSR SCPCMP
BNE CHKNSHT ;TRY NEXT
FNDSHOT JSR ERASHOT ;SAME, ERASE IT
JSR STBKLSH ;SET FOR BACKLASH
CHKNSHT DEX ;TRY NEXT ONE
BPL CHKSHLP
LDX HOLDIT ;RESTORE CNTR
JMP COLESCE ;EXIT TO SPFX
;
;CHECK SHOT HIT PLAYER/ZOMBIE
;
CHKHMAN CMP #$C0 ;IF CHR HIT IS IT
BCC COLESCE ;IN RANGE, CHECK
CMP #$E0 ;FOR A HIT.
BCS COLESCE ;(SUBR BELOW)
JSR MNHTCHK
;
;SPECIAL EFFECTS
;---------------
;
;PLAYER/ZOMBIE RE-INTEGRATION
;
COLESCE LDA RTCLOK ;TIME TO DO IT
AND #$01 ;YET? NO, THEN DO
BEQ CHKCOLS ;NEXT PLAYER/
JMP DONXTMN ;ZOMBIE
CHKCOLS LDA ACTFLAG,X ;IF HE ISN'T
AND #$01 ;COALESCING, TRY
BNE SETFUZZ ;FOR EVAPORATION
JMP TRYEVAP
SETFUZZ TXA ;SET PNTRS TO
ASL A ;EACH OF THE
ASL A ;COALESCING CHARS
ASL A
ADC # <PL0CHR
STA POINTER
ADC #32
STA POINTR0
LDA # >PL0CHR
STA POINTER+1
STA POINTR0+1
LDA MOVCLOK,X ;GET FUZZ TOP
STA HOLDIT ;AND SET A CNTR
LDY #8
DOFUZZ DEY ;FUZZ UP TO IT
LDA RANDOM ;MASKED INTO THE
AND MASKL,Y ;CORRECT SHAPE
STA (POINTER),Y
LDA RANDOM
AND MASKR,Y
STA (POINTR0),Y
CPY HOLDIT
BNE DOFUZZ
LDA MOVEST,X ;NOT YET TIME
AND #$08 ;FOR THE NORMAL
BNE UDCPTRS ;PART, SKIP TO
; UPDATE COUNTERS
LDA MOVEST,X ;GET NORM TOP
STA HOLDIT ;AND SET A CNTR
LDY #8
SETNORM DEY ;SET THE NORMAL
LDA STLCHR,Y ;IMAGE TO THAT
STA (POINTER),Y ;POINT IN
LDA STRCHR,Y ;CHAR
STA (POINTR0),Y
CPY HOLDIT
BNE SETNORM
LDA LOCY,X
ASL A
ASL A
ASL A
ADC #$20
STA SCRPTR
TXA
CLC
ADC # >PL0
STA SCRPTR+1
LDY #8
SETCOAT DEY ;AND IN
LDA SUITS,Y ;PM OVERCOAT
STA (SCRPTR),Y
CPY HOLDIT
BNE SETCOAT
UDCPTRS LDA MOVCLOK,X ;IF PART 1
BEQ CLSCSND ;COUNTR<>0, SUB
DEC MOVCLOK,X ;1 FROM IT
CLSCSND TXA ;SET SOUND. (IN
ASL A ;TWO ALTERNATING,
TAY ;INDEPENDENT
LDA MOVEST,X ;RANGES OF
AND #$01 ;FREQUENCY...
BEQ CLSTYP2
LDA MOVEST,X
ASL A
ASL A
ASL A
ORA #$80
BNE CLSVOLM
CLSTYP2 LDA MOVEST,X
ASL A
ADC #6
CLSVOLM CLC
STA AUDF1,Y ;...AND TONE)
LDA MOVEST,X
BPL CLS01
SEC
CLS01 ROR A
EOR #$27
ADC #1
STA AUDC1,Y
DEC MOVEST,X ;COUNTDOWN CNTR2
BNE BCKLASH ;<>0? EXIT.
JSR SETSTIL ;COLS OVER, SET
TXA ;NORMAL AND
ASL A ;TURN OFF SOUND
TAY
LDA #0
STA AUDC1,Y
LDA ACTFLAG,X ;CLR COALESCE
AND #$FE ;FLAG
STA ACTFLAG,X
LDA MOVRATE,X ;RESET
STA MOVCLOK,X ;MOVE TIMER
BNE BCKLASH ;GOTO SPFX PART 2
;
;ZOMBIE/PLAYER EVAPORATION
;
TRYEVAP JSR EVAPRTE
;
;SHOT BACKLASH + WALL EXPLOSION PART 2
;
BCKLASH LDA ACTFLAG,X ;IF IT ISN'T
AND #$10 ;BACKLASHING,
BNE DOBKLSH ;EXIT TO CHK FOR
JMP WLXPLOD ;WALL EXPLODING
DOBKLSH LDA SHOTMST,X ;IF BCKLASH
BPL BKLSND ;OVER, ERASE IT
JMP ERBKLSH ;AND LEAVE
BKLSND TXA ;SET BACKLASH
ASL A ;SOUND
TAY
LDA SHOTMST,X
EOR #$03
ASL A
ASL A
ASL A
ASL A
ADC #16
STA AUDF1,Y
LDA SHOTMST,X
;
ASL A
ASL A
ADC #2
STA AUDC1,Y
LDA #3 ;INIT DIRECT
STA DIREC ;LOOP CNTR
LDA SHOTDIR,X ;AND DIR FLAGS
STA DIRSHFT
STBKSLP LSR DIRSHFT ;BACKLASH IN THIS
BCC STBKNDR ;DIR? NO.
JSR ADBLOFS ;ADD DIR OFFSET +
JSR GETHERE ;LOOK FOR <>EMPTY
BEQ STNRGBL ;IF EMPTY, SET IT
CMP #$9B ;ELSE, AS LONG AS
BCC NRGBLHT ;IT IS A BCKLASH
CMP #$9E ;CHR, SET IT.
BCC STNRGBL
NRGBLHT LDY DIREC ;OTHERWISE, CLR
LDA DIRBIT,Y ;THIS DIR BIT
EOR #$0F
AND SHOTDIR,X
STA SHOTDIR,X
JSR MNHTCHK ;CHECK FOR HIT
LDY DIREC ;A GUY. ERASE THE
LDA SCRPTR ;BACKLASH IMAGE
SEC
SBC DIRADLO,Y
STA SCRPTR
LDA SCRPTR+1
SBC DIRADHI,Y
STA SCRPTR+1
LDA #0
LDY #1
ERBLHT STA (SCRPTR),Y
DEY
BPL ERBLHT
BNE STBKNDR ;AND DO NEXT DIR
STNRGBL LDA SHOTMST,X ;SET THE
AND #$01 ;BACKLASH CHARS
ASL A
ASL A
ORA DIREC
ASL A
ADC # <EXPLSHP
STA POINTER
LDA # >EXPLSHP
ADC #0
STA POINTER+1
LDY #1
STBKLP LDA (POINTER),Y
STA (SCRPTR),Y
DEY
BPL STBKLP
STBKNDR DEC DIREC ;DO NEXT DIR
BPL STBKSLP
ERBKLSH INC SHOTMST,X
LDA SHOTMST,X ;TIME TO ERASE?
AND #$05
BNE UDBKLST ;NO. UPDATE STAT
LDA #3 ;SET LOOP COUNTER
STA DIREC
LDA SHOTDIR,X ;AND DIR FLAGS
STA DIRSHFT
ERBKSLP LSR DIRSHFT ;GOING THIS WAY?
BCC ERBKNDR ;NO, DO NEXT
JSR ADBLOFS ;YES, ADD OFFSET
LDA #0 ;AND ERASE IT
TAY
STA (SCRPTR),Y
INY
STA (SCRPTR),Y
ERBKNDR DEC DIREC ;DO NEXT DIR
BPL ERBKSLP
UDBKLST DEC SHOTMST,X ;UPDATE STATUS
DEC SHOTMST,X
LDA SHOTMST,X
CMP #-2 ;IF AT END, OR
BEQ NRGBLND
LDA SHOTDIR,X ;NO DIRS LEFT
BNE BKLEXIT
NRGBLND TXA ;TURN OFF SOUND,
ASL A
TAY
LDA #$00
STA AUDC1,Y
LDA ACTFLAG,X ;AND CLR ACTION
AND #$0F ;BACKLASH FLAG
STA ACTFLAG,X
BKLEXIT JMP DONXTMN ;EITHER WAY, EXIT
;
;WALL EXPLOSION PART 1. BUILD UP
;
WLXPLOD LDA ACTFLAG,X ;IF WALL IS NOT
AND #$20 ;EXPLODING, DO
BEQ DONXTMN ;NEXT PLAYER/
TXA ;ZOMBIE, GET
ASL A ;SOUND INDEX
TAY
INC SOUND,X
LDA SOUND,X
STA COLOR2 ;AND UPDATE COLOR
AND #$0F
BEQ STFBLEX ;IF NOT AT END,
ASL A ;SET SOUND
ASL A
EOR #$3C
ADC #$20
STA AUDF1,Y
LDA SOUND,X
AND #$0F
LSR A
CLC
ADC #$20
STA AUDC1,Y
BNE DONXTMN ;AND EXIT
STFBLEX LDA #0 ;TURN OFF SOUND
STA AUDC1,Y
TAY
LDA SHOTLO,X ;ERASE THE WALL
STA SCRPTR
LDA SHOTHI,X
STA SCRPTR+1
TYA
STA (SCRPTR),Y
INY
STA (SCRPTR),Y
JSR STBKLSH ;INIT BACKLASH
LDA SHOTDIR,X ;(ALL DIRS BUT
EOR #$0F ;FROM SHOT)
STA SHOTDIR,X
;
;DO NEXT PLAYER/ZOMBIE
;
DONXTMN DEX
BMI EXIT
JMP CKMVLP
EXIT JMP XITVBV
;
;
;ZOMBIE MOVEMENT HANDLING
;------------------------
;
ZOMOVE STX HOLDIT ;SAVE IDENTITY
;
;SHOOT AT ANYONE IN A STRAIGHT LINE
;AWAY FROM THE ZOMBIE
;
LDY PLYRS
LDA LOCY,X
ZCKYSHL DEY ;IS THERE ANYBODY
BMI ZSHDOY ;IN A STRAIGHT
CPY HOLDIT ;LINE FROM THE
BEQ ZCKYSHL ;ZOMBIE IS THE X
CMP LOCY,Y ;DIRECTION?
BNE ZCKYSHL
LDA LOCX,X ;SHOOT AT HIM
CMP LOCX,Y
LDA #0
BCC ZMSHOOT
LDA #2
BNE ZMSHOOT
;
ZSHDOY LDY PLYRS ;OTHERWISE, WE'LL
LDA LOCX,X ;TRY UP AND DOWN.
ZCKXSHL DEY ;IS THERE ANYBODY
BMI ZMTRYMV ;IN A STRAIGHT
CPY HOLDIT ;LINE AWAY IN
BEQ ZCKXSHL ;THE Y DIRECTION?
CMP LOCX,Y
BNE ZCKXSHL ;IF NO, THEN TRY
LDA LOCY,X ;MOVING
CMP LOCY,Y
LDA #1
BCC ZMSHOOT
LDA #3
;
ZMSHOOT STA DIR,X ;ELSE, SET UP
LDA LOCLO,X ;AND SHOOT
STA SCRPTR
LDA LOCHI,X
STA SCRPTR+1
JMP INITSHOT
;
;FIND NEAREST PLAYER
;
ZMTRYMV LDA #255 ;SET DIST TO MAX
STA DIST
LDY PLYRS
ZMCKNXM DEY
BMI ZMFDIR
CPY HOLDIT ;IF ON SELF, SKIP
BEQ ZMCKNXM
JSR GETDXDY ;GET DISTANCE
CLC
ADC DX
CMP DIST ;IF <CURRENT, SET
BCS ZMCKNXM ;AS THE NEW LOW
STA DIST
STY NEAREST
BCC ZMCKNXM ;AND DO NEXT
;
;AND MOVE TO HIM, IF POSSIBLE
;CLEAR AWAY A WALL IF NOT.
;
ZMFDIR LDY NEAREST ;FIND LONGER DIR
JSR GETDXDY
CMP DX ;IF Y IS LONG
BCS CKYLONG ;DIR, SKIP TO IT.
JSR CHKXDIR ;IS AREA BLANK?
BEQ ZMMOVE ;IF YES, MOVE
LDY NEAREST ;OTHERWISE, CHECK
JSR CHKYDIR ;Y (SHORT)
BEQ ZMMOVE ;IF BLANK, MOVE
LDY NEAREST ;ELSE, SHOOT OUT
JSR CHKXDIR ;THE X-WALL
LDA DIR,X
JMP ZMSHOOT
;
CKYLONG JSR CHKYDIR ;IF LONG Y IS
BEQ ZMMOVE ;BLANK, THEN MOVE
LDY NEAREST ;ELSE, CHECK X
JSR CHKXDIR
BEQ ZMMOVE ;IF BLANK, MOVE
LDY NEAREST ;ELSE SHOOT OUT
JSR CHKYDIR ;THE Y-WALL
LDA DIR,X
JMP ZMSHOOT
ZMMOVE JMP INITMOVE
;
;ZOMBIE MOVE SUBROUTINES
;-----------------------
;
;IS THERE AN OPENING IN THE X DIR
;
CHKXDIR LDA LOCX,X ;FIRST, SET LEFT
CMP LOCX,Y ;OR RIGHT
LDA #0
BCC STXDIR
LDA #2
STXDIR STA DIR,X
JMP GETAHEDM ;THEN LOOK
;
;IS THERE AN OPENING IN THE Y DIR
;
CHKYDIR LDA LOCY,X ;FIRST, SET DIR
CMP LOCY,Y ;UP OR DOWN
LDA #1
BCC STYDIR
LDA #3
STYDIR STA DIR,X
JMP GETAHEDM ;THEN GO LOOK
;
;GET X & Y DISPLACEMENTS
;
GETDXDY LDA LOCX,X ;SUBTRACT TARGET
SEC ;X FROM ZOMBIE X
SBC LOCX,Y
BPL SAVEDX ;AND TAKE
EOR #$FF ;ABSOLUTE VALUE
CLC
ADC #1
SAVEDX STA DX ;SAVE IT IN DX
LDA LOCY,X ;THEN, SUBTRACT
SEC ;TARGET Y FROM
SBC LOCY,Y ;ZOMBIE Y
BPL DXDYEND ;AND TAKE THE
EOR #$FF ;ABSOLUTE VALUE
CLC
ADC #1
DXDYEND RTS
;
;*****************
;** SUBROUTINES **
;*****************
;
;MOVEMENT RELATED
;----------------
;
;BEGIN MOVE
;
INITMVE LDY DIR,X ;ADD ON THE
CLC ;MOVE PRECEDED
LDA LOCLO,X ;LOCATION CHANGES
ADC PRVADLO,Y ;TO THE ACTUAL
STA LOCLO,X ;ADDRESS,
LDA LOCHI,X
ADC PRVADHI,Y
STA LOCHI,X
LDA LOCX,X ;THE X-LOCATION,
CLC
ADC PRVXADD,Y
STA LOCX,X
LDA LOCY,X ;THE Y-LOCATION
CLC
ADC PRVYADD,Y
STA LOCY,X
TYA ;INIT MOVE STATUS
AND #$02
ASL A
STA MOVEST,X
;
;CYCLE PLAYER/ZOMBIE MOVE
;
MOVEIM LDA DIR,X ;UPDATE MOVE STAT
AND #$02 ;(UP FOR RT/DN,
BNE MVRGDN ;DOWN FOR LF/UP)
INC MOVEST,X
BNE SETPLR
MVRGDN DEC MOVEST,X
SETPLR LDA LOCLO,X ;SET POINTER TO
STA SCRPTR ;SCREEN IMAGE
LDA LOCHI,X
STA SCRPTR+1
LDA MOVEST,X ;AND ANOTHER TO
AND #$03 ;THE SHAPE TABLE
ASL A ;SOURCE
ASL A
ADC DIR,X
ASL A
ASL A
ADC # <SHAPES
STA POINTER
LDA # >SHAPES
ADC #0
STA POINTER+1
LDA DIR,X
JSR SETMOVE ;SET NEW IMAGE
JSR SETSUIT ;(CHAR & PM)
LDA MOVEST,X ;KEEP STATUS IN
AND #$03 ;THE 0-3 RANGE
STA MOVEST,X
BNE MOVSND ;<>0, DO SOUND
LDY DIR,X ;THIS MOVE'S OVER
LDA LOCLO,X ;SO DO THE POST-
CLC ;MOVE LOC CHANGES
ADC AFTRADD,Y ;FOR ABS MEM
STA LOCLO,X ;LOCATIONS
BCC UDTLOCS
INC LOCHI,X
UDTLOCS LDA LOCX,X ;X-LOCATION
CLC
ADC AFTXADD,Y
STA LOCX,X
LDA LOCY,X ;Y-LOCATION
CLC
ADC AFTYADD,Y
STA LOCY,X
MOVSND LDA ACTFLAG,X ;IF SOME OTHER
AND #$B0 ;SOUND IS ON
BNE MOVMXIT ;RETURN
TXA ;SET SHUFFLE
ASL A ;NOISE ON AN
TAY ;EVEN MOVE STATUS
LDA MOVEST,X
AND #$01
BEQ MOVMXIT
LDA #$04
STA AUDC1,Y
LDA #$20
STA AUDF1,Y
MOVMXIT RTS
;
;
;PLACEMENT
;---------
;
;SET THE CHR IMAGE FOR PLAYER OR SHOT
;
SETMOVE STA HOLDIT ;SAVE DIRECTION
LDY #0 ;SET BYTES 1,2
LDA (POINTER),Y
STA (SCRPTR),Y
INY
LDA (POINTER),Y
STA (SCRPTR),Y
LDA HOLDIT ;IF DIR IS UP OR
AND #$01 ;DOWN THEN ADD TO
BEQ SETMOV2 ;SCRN PNTR TO GO
LDA SCRPTR ;DOWN 1 LINE
CLC
ADC #$26
STA SCRPTR
BCC SETMOV2
INC SCRPTR+1
SETMOV2 INY ;SET NEXT 2 BYTES
LDA (POINTER),Y
STA (SCRPTR),Y
INY
LDA (POINTER),Y
STA (SCRPTR),Y
RTS
;
;SET STATIONARY PLAYER/ZOMBIE
;
SETSTIL LDA LOCLO,X ;SET POINTER
STA SCRPTR ;TO SCREEN FOR
LDA LOCHI,X ;SUBROUTINE
STA SCRPTR+1
LDY DIR,X ;SET POINTER TO
LDA SHSTOFS,Y ;APPROPRIATE
CLC ;IMAGE IN THE
ADC # <SHAPES ;SHAPE TABLE
STA POINTER
LDA # >SHAPES
JSR SHRTSET ;AND SET AWAY...
;
;SET PM PORTION OF PLAYER/ZOMBIE
;
SETSUIT LDA MOVEST,X ;FIND WHAT SUIT
AND #$03 ;IMAGE TO USE AND
CLC ;POINT TO IT
ROR A
ROR A
; ADC # <SUITS
ORA DIR,X
ROR A
ROR A
ROR A
ROR A
STA POINTER
LDA # >SUITS
STA POINTER+1
LDA LOCY,X ;CALC PM Y START
ASL A ;BASE=Y*8+32
ASL A
ASL A
CLC
ADC #32
STA SCRPTR
LDA DIR,X ;IF GOING UP/DN,
AND #$01 ;ADD ON MOVE
BEQ FNDDHI ;STATUS *2
LDA MOVEST,X
ASL A
CLC
ADC SCRPTR
STA SCRPTR
FNDDHI TXA
CLC
ADC # >PL0
STA SCRPTR+1
LDY #$08 ;SET THE IMAGE
READPIC LDA (POINTER),Y ;(DATA HAS
STA (SCRPTR),Y ;0'S IN IT TO
DEY ;ERASE OLD IMAGE)
BPL READPIC
LDA LOCX,X ;SET HORIZ LOC
ASL A ;BASE=X*8+48
ASL A
ASL A
CLC
ADC #48
STA SCRPTR
LDA DIR,X ;IF GOING LF/RT,
AND #$01 ;ADD ON MOVE
BNE STHORZ ;STATUS*2
LDA MOVEST,X
ASL A
CLC
ADC SCRPTR
STA SCRPTR
STHORZ LDA SCRPTR
STA HPOSP0,X
RTS
;
;SET SHOT/PLAYER USING PRESET POINTERS
;
SHRTSET ADC #0 ;FINISH SETTING
STA POINTER+1 ;SOURCE PNTR
LDY #1
SETLP LDA (POINTER),Y ;AND SET IT
STA (SCRPTR),Y
DEY
BPL SETLP
RTS
;
;FIND A RANDOM PLACE TO PUT A
;PLAYER/ZOMBIE ON THE SCREEN AND
;SET FOR COALESCE
;
FNDSPOT LDA RANDOM ;GET A RANDOM X
AND #$1F ;MASK UPPER BITS
CMP #19 ;IF NOT IN RANGE,
BCS FNDSPOT ;TRY AGAIN
STA LOCX,X
LDA RANDOM ;GET A RANDOM Y
AND #$1F ;MASK UPPER BITS
CMP #18 ;IF NOT IN RANGE
BCS FNDSPOT ;TRY AGAIN
STA LOCY,X
STA POINTER ;GET Y*40
LDA #0
STA SCRPTR
STA SCRPTR+1
STA POINTER+1
LDA #$28
STA POINTR0
LDY #6
MULTPLY LSR POINTR0
BCC FNDSPT2
LDA SCRPTR
CLC
ADC POINTER
STA SCRPTR
LDA SCRPTR+1
ADC POINTER+1
STA SCRPTR+1
FNDSPT2 ASL POINTER
ROL POINTER+1
DEY
BNE MULTPLY
LDA LOCX,X ;ADD X*2
ASL A
ADC SCRPTR
BCC ADDSCRN
INC SCRPTR+1
ADDSCRN CLC ;ADD SCREEN ADDR
ADC # <GAMESCR
STA SCRPTR
LDA SCRPTR+1
ADC # >GAMESCR
STA SCRPTR+1
JSR GETHERE ;SEE IF IT IS
BNE FNDSPOT ;EMPTY? NO, AGAIN
LDA SCRPTR ;YES, SET LOC
STA LOCLO,X ;TO IT
LDA SCRPTR+1
STA LOCHI,X
LDA #0
STA DIR,X ;DIRECTION TO RT
TXA ;CLR COALESCE
ASL A ;CHARS FOR THIS
ASL A ;PLAYER
ASL A
ADC # <PL0CHR
STA POINTER
ADC #32
STA POINTR0
LDA # >PL0CHR
STA POINTER+1
STA POINTR0+1
LDA #0
LDY #7
CLRCLCH STA (POINTER),Y
STA (POINTR0),Y
DEY
BPL CLRCLCH
TXA ;SET SCRN TO THEM
CLC
ADC #8
LDY #0
STA (SCRPTR),Y
INY
ADC #4
STA (SCRPTR),Y
LDA LOCX,X ;PLR HORIZ POS
ASL A
ASL A
ASL A
CLC
ADC #48
STA HPOSP0,X
LDA ACTFLAG,X ;COALESCE FLAG
AND #$FD ;TO TRUE
ORA #$01
STA ACTFLAG,X
LDA #$0F ;SET ITS CNTRS
STA MOVEST,X
LDA #7
STA MOVCLOK,X
RTS
;
;ERASURE
;-------
;
;ERASE A SHOT
;
ERASHOT LDA SHOTLO,X ;SET POINTER TO
STA POINTR0 ;THE SHOT LOC
LDA SHOTHI,X
STA POINTR0+1
LDA #0 ;ERASE 2 BYTES
TAY
STA (POINTR0),Y
INY
STA (POINTR0),Y
LDA SHOTMST,X ;MOVE STAT=0?
BEQ ERSHXIT ;YES. DONE
LDA SHOTDIR,X ;ADD A LINE
AND #$01 ;IF UP/DOWN
BEQ ERSHOT2
LDY #$27
LDA #0
ERSHOT2 INY ;ERASE 2 BYTES
STA (POINTR0),Y
INY
STA (POINTR0),Y
ERSHXIT TXA ;TURN OFF SOUND
ASL A
TAY
LDA #0
STA AUDC1,Y
RTS
;
;ERASE PLAYER/ZOMBIE
;
ERASMAN LDA LOCLO,X ;SET A POINTER
STA POINTR0 ;TO THE SCREEN
LDA LOCHI,X ;CHR IMAGE
STA POINTR0+1
LDA #0 ;ERASE 2 CHARS
TAY
STA (POINTR0),Y
INY
STA (POINTR0),Y
LDA MOVEST,X ;IF MOVEST=0,
BEQ ERMNXIT ;CHARS DONE,
; ERASE PM
LDA DIR,X ;ADD 1 LINE IF
AND #$01 ;GOING UP/DOWN
BEQ ERSMAN2
LDY #$27
LDA #0
ERSMAN2 INY ;ERASE 2 CHARS
STA (POINTR0),Y
INY
STA (POINTR0),Y
ERMNXIT TXA ;ERASE PLAYER'S
CLC ;ENTIRE PM
ADC # >PL0
STA POINTR0+1
LDA #0
STA POINTR0
TAY
ERSUTLP STA (POINTR0),Y
DEY
BNE ERSUTLP
RTS
;
;COLLISION DETECTION
;-------------------
;
;LOOK AHEAD SUBS
;
GETAHEDS LDA SHOTLO,X ;GET WHAT'S IN
STA SCRPTR ;FRONT OF A SHOT.
LDA SHOTHI,X ;SET PNTRS, DIR
STA SCRPTR+1 ;& GOTO GETAHED
LDY SHOTDIR,X
JMP GETAHED
;
GETAHEDM LDA LOCLO,X ;GET WHAT'S IN
STA SCRPTR ;FRONT OF PLAYER.
LDA LOCHI,X ;SET PNTRS, DIR
STA SCRPTR+1
LDY DIR,X
;
GETAHED LDA SCRPTR ;ADD ON TO PNTR
CLC ;BY DIR PASSED
ADC DIRADLO,Y ;IN Y REG
STA SCRPTR
LDA SCRPTR+1
ADC DIRADHI,Y
STA SCRPTR+1
GETHERE LDY #0 ;FIND WHAT'S TO
LDA (SCRPTR),Y ;BY THE SCREEN
INY ;POINTER
ORA (SCRPTR),Y
RTS
;
;CHECK FOR HITS ON PLAYERS/ZOMBIES
;
MNHTCHK STX HOLDIT ;SAVE WHO WE ARE
LDX ACTIVE ;LOOP TO CHK ALL
CHKMNLP LDA ACTFLAG,X ;IF PLAYER NOT
AND #$0F ;ON, DO NEXT
BNE CHKNMAN
LDA LOCLO,X ;SET POINTER
STA POINTER ;TO COMPARE
LDA LOCHI,X
STA POINTER+1
LDA MOVEST,X ;IF NOT MOVING,
BEQ CKMAN2 ;CHECK IT ONCE
JSR SCPCMP ;TRY ONCE,
BEQ FNDMAN ;IF FOUND, DO IT!
LDY DIR,X ;MOVE TO OTHER
JSR SETPTR ;POSSIBILITY
CKMAN2 JSR SCPCMP ;IS IT THERE?
BNE CHKNMAN ;NO, DO NEXT
FNDMAN JSR ERASMAN ;ELSE, ERASE 'IM
LDA ACTFLAG,X ;SET TO
ORA #$02 ;EVAPORATE
STA ACTFLAG,X
LDA #9 ;SET EVAP COUNTER
STA MOVEST,X
CPX HOLDIT ;IF HIT SELF
BEQ CHKHMND ;(LIKE IN BACK-
; LASH) NO SCORE
LDX HOLDIT ;SCORE PENDING
LDA SCRPND,X ;TO NEXT SCORE
CLC
ADC NXTSCR,X
STA SCRPND,X
LDA #5 ;RESET NEXT SCORE
STA NXTSCR,X ;TO 5
CHKHMND RTS
;
CHKNMAN DEX ;CHECK NEXT
BPL CHKMNLP
LDX HOLDIT ;IF NONE FOUND,
RTS ;GET BACK SELF ID
;
;SEE IF POINTER=SCRPTR (USED ABOVE
;AND IN SHOT VS SHOT CHECKS)
;
SCPCMP LDA SCRPTR ;CHECK LO
CMP POINTER
BNE SCPGBK ;IF <>, EXIT
LDA SCRPTR+1 ;ELSE, TRY HIGH
CMP POINTER+1
SCPGBK RTS
;
;CHANGE POINTER TO OTHER POSSIBLE
;LOCATION ON COLLISION (USED ABOVE
;AND IN SHOT VS SHOT CHECKS)
;
SETPTR LDA POINTER ;SUB PRIOR TO
SEC ;MOVE ADD AMOUNT
SBC PRVADLO,Y
STA POINTER
LDA POINTER+1
SBC PRVADHI,Y
STA POINTER+1
LDA POINTER ;ADD AFTER MOVE
CLC ;ADD AMOUNT
ADC AFTRADD,Y ;WEIRD, BUT...
STA POINTER
BCC STPTRND
INC POINTER+1
STPTRND RTS
;
;SPECIAL EFFECTS
;---------------
;
;EVAPORATION OF PLAYER/ZOMBIE
;
EVAPRTE LDA ACTFLAG,X ;SEE IF HE IS
AND #$02 ;EVAPORATING
BNE DOEVAP ;IF NOT, RETURN
RTS
;
DOEVAP LDA LOCY,X ;ELSE, SET PNTR
ASL A ;INTO PLAYER X
ASL A
ASL A
ADC #32
STA SCRPTR
TXA
CLC
ADC # >PL0
STA SCRPTR+1
TXA ;SET SOUND INDEX
ASL A
TAY
DEC MOVEST,X ;UPDATE COUNTER
BMI ENDEVAP ;IF AT END
LDA #10 ;ELSE, SET SOUND
STA AUDF1,Y
STY HOLDIT
LDY MOVEST,X
LDA EXPNVLP,Y
LDY HOLDIT
STA AUDC1,Y
LDA MOVEST,X ;FIND WHAT CLOUD
AND #$0E ;STATE TO USE
ASL A
ASL A
ADC # <SMOKE
STA POINTER
LDA # >SMOKE
STA POINTER+1
LDY #7 ;AND SET IT
READSMK LDA (POINTER),Y
STA (SCRPTR),Y
DEY
BPL READSMK
RTS ;AND RETURN
;
ENDEVAP LDA #0 ;EVAP DONE, TURN
STA AUDC1,Y ;OFF SOUND
LDY #7 ;ERASE CLOUD
CLRSMOK STA (SCRPTR),Y
DEY
BPL CLRSMOK
JMP FNDSPOT ;FIND SPOT TO
; PUT HIM BACK IN
;
;SETUP A SHOT FOR BACKLASH
;
STBKLSH LDA ACTFLAG,X ;SET FLAG =TRUE
AND #$0F
ORA #$10
STA ACTFLAG,X
LDA SHOTDIR,X ;TURN SHOT DIR
EOR #$02 ;THE OTHER WAY
TAY
LDA DIRBIT,Y ;SET IN BACKLASH
STA SHOTDIR,X ;FASHION
LDA #3 ;SET SHRAPNEL
STA SHOTMST,X ;DISTANCE TO 3
RTS
;
;SET POINTER OFFSET FROM BACKLASH BASE
;
ADBLOFS LDA SHOTMST,X ;FIGURE OUT HOW
LSR A ;MANY LOCATIONS
EOR #$01 ;AWAY IT IS
CLC
ADC #1
STA COUNT ;AND SAVE IT
LDA SHOTLO,X ;SET BASE
STA SCRPTR
LDA SHOTHI,X
STA SCRPTR+1
LDY DIREC ;ADD DIRECTION
ADOFSLP LDA SCRPTR ;OFFSET AS MANY
CLC ;PLACES AWAY AS
ADC DIRADLO,Y ;WE HAD TO GO
STA SCRPTR
LDA SCRPTR+1
ADC DIRADHI,Y
STA SCRPTR+1
DEC COUNT
BNE ADOFSLP
RTS
;
;*****************
;** DLI ROUTINE **
;*****************
;
DLI PHA
LDA #PLR0COL ;SET COLORS FOR
STA COLPF0 ;BOTTOM OF SCREEN
LDA #PLR1COL ;TO THOSE OF
STA COLPF1 ;PLAYER/ZOMBIE
LDA #PLR2COL ;SUIT COLORS
STA COLPF2
LDA #PLR3COL
STA COLPF3
PLA
RTI
;
;
;**********************
;** PROGRAM DATABASE **
;**********************
;
;NUMERICAL DATA
;--------------
;
;LOCATION ADDITIONS TO GET NEW
;LOCATIONS (SEPARATED BY DIR)
;
AFTYADD .BYTE 0 ;1,0,0
AFTXADD .BYTE 1 ;0,0,0
PRVYADD .BYTE 0 ;0,0,-1
PRVXADD .BYTE 0,0,-1 ;0
DIRADHI .BYTE 0,0,-1,-1
DIRADLO .BYTE 2,40,-2,-40
AFTRADD .BYTE 2,40 ;0,0
PRVADHI = DIRADHI
PRVADLO .BYTE 0,0,-2,-40
;
;JOYSTICK TO INTERNAL DIR CONVERSION
;
CONVERT .BYTE 4,3,1,4,2,4,4,4,0,4,4
;
;OFFSET FOR STILL IMAGE INTO SHAPES
;
SHSTOFS .BYTE 2,6,8,12
;
;EVAPORATION VOLUMES
;
EXPNVLP .BYTE 4,6,8,8,6,6,4,4,4,2,2,2
;
;ZIGZAG DIRECTION MASKS
;
XYMASK .BYTE $03,$0C,$03,$0C
;
;BACKLASH DIRECTION BITS
;
DIRBIT .BYTE 8,4,2,1
;
;SCREEN INDEX TO SCORES
;
SCRINDX .BYTE 4,24,44,64
;
;SHAPE TABLES
;------------
;
;PLAYER/ZOMBIES
;
SHAPES .BYTE $00,$00,$C0,$C1 ;R4
.BYTE $00,$00,$C3,$C5 ;D4
.BYTE $D2,$D3,$00,$00 ;L0
.BYTE $C0,$DE,$00,$00 ;U0
.BYTE $DF,$C2,$DF,$DF ;R1
.BYTE $C6,$C7,$C8,$C9 ;D1
.BYTE $DF,$D4,$DF,$DF ;L1
.BYTE $DC,$DD,$C8,$C9 ;U1
.BYTE $DF,$C3,$C4,$DF ;R2
.BYTE $CA,$CB,$CC,$CD ;D2
.BYTE $DF,$D5,$D6,$DF ;L2
.BYTE $CA,$D9,$DA,$DB ;U2
.BYTE $DF,$DF,$C2,$DF ;R3
.BYTE $CE,$CF,$D0,$D1 ;D3
.BYTE $DF,$DF,$D4,$DF ;L3
.BYTE $CE,$CF,$D7,$D8 ;U3
;
;SHOTS
;
SHOTSHP .BYTE $00,$00,$81,$82 ;R2
.BYTE $00,$00,$84,$00 ;D2
.BYTE $81,$82,$00,$00 ;L0
.BYTE $00,$84,$00,$00 ;U0
.BYTE $00,$82,$81,$00 ;R1
.BYTE $83,$00,$85,$00 ;D1
.BYTE $00,$82,$81,$00 ;L1
.BYTE $00,$83,$00,$85 ;U1
;
;BACKLASH SHRAPNEL
;
EXPLSHP .BYTE $00,$9B,$9C,$9C ;R&D0
.BYTE $9B,$00,$9D,$9D ;L&U0
.BYTE $9B,$00,$9D,$9D ;R&D1
.BYTE $00,$9B,$9C,$9C ;L&U1
;
;TITLE SCREEN
;------------
;
;DISPLAY LIST
;
TITLDISP .BYTE $70,$70,$70,$70,$70,$42
.WORD TITLES
.BYTE 2,2,$70,6,$70,$70,5,$70
.BYTE $70,6,$70,4,4,4,$70,6,6
.BYTE $70,2,$41
.WORD TITLDISP
;
;TITLE SCREEN DISPLAY DATA
;
TITLES .BYTE 0,0,0,0,0,0,0,0,96
.SBYTE "abcdefg"
.BYTE 96
.SBYTE "abchi jklcjmno"
.SBYTE " "
.SBYTE "pqrsptuspqr"
.SBYTE "spvwxpyzsp"
.BYTE 123,124,115,0,0
.BYTE 0,0,0,0,0,0
.SBYTE " "
.SBYTE "COMPUTING "
.SBYTE " "
.SBYTE +$80,"presents "
.SBYTE " "
.SBYTE +$80,">?FHJQVX [\]^_"
.SBYTE " "
.SBYTE "BY MARK PRICE "
WLKLINE .SBYTE " "
.SBYTE " "
.BYTE 253,253,253,253,253
.BYTE 253,253,253,253,253
.BYTE 253,253,253,253,253
.BYTE 253,253,253,253,253
.BYTE 253,253,253,253,253
.BYTE 253,253,253,253,253
.BYTE 253,253,253,253,253
.BYTE 253,253,253,253,253
.BYTE 254,254,254,254,254
.BYTE 254,254,254,254,254
.BYTE 254,254,254,254,254
.BYTE 254,254,254,254,254
.BYTE 254,254,254,254,254
.BYTE 254,254,254,254,254
.BYTE 254,254,254,254,254
.BYTE 254,254,254,254,254
.SBYTE +$80," wizards"
.BYTE 218,0
PLAYERS .BYTE 81
.SBYTE " ZOMBIES: "
ZOMBIES .BYTE 80,0,0,0,0,0
.SBYTE " "
.SBYTE "ZOMBIE SPEED: "
ZOMSPD .SBYTE "5 "
;
;GAME DISPLAY DATA
;-----------------
;
;DISPLAY LIST
;
GAME .BYTE $70,$70,$70,$44
.WORD GAMESCR
.BYTE 4,4,4,4,4,4,4,4,4,4,4
.BYTE 4,4,4,4,4,4,4,$F0,$46
.WORD BOTSCRN
.BYTE 6,6,6,$41
.WORD GAME
;
;MAZE DATA
;
MAZEDAT .SBYTE +$80,"@@@@@@@@@@"
.SBYTE +$80,"@@@@@@@@@@"
.BYTE 160,0,0,0,253
.BYTE 253,0,0,0,0
.BYTE 0,0,0,0,0
.BYTE 0,0,0,0,160
.BYTE 160,0,254,0,0
.BYTE 254,0,254,254,254
.BYTE 254,0,254,254,254
.BYTE 254,0,254,254,160
.BYTE 160,0,255,0,255
.BYTE 255,0,0,0,255
.BYTE 0,0,0,255,0
.BYTE 0,0,255,0,160
.BYTE 160,0,253,0,0
.BYTE 0,0,253,0,0
.BYTE 0,253,0,0,0
.BYTE 253,0,253,0,160
.BYTE 160,254,254,0,254
.BYTE 254,254,254,254,254
.BYTE 254,254,0,254,254
.BYTE 254,0,254,0,160
.BYTE 160,0,0,0,255
.BYTE 0,0,0,0,0
.BYTE 0,255,0,0,0
.BYTE 0,0,0,0,160
.BYTE 160,0,253,253,253
.BYTE 0,253,253,0,253
.BYTE 0,253,0,253,253
.BYTE 253,253,253,253,160
.BYTE 160,0,0,0,0
.BYTE 0,0,254,0,254
.BYTE 0,0,0,254,0
.BYTE 0,0,0,0,160
.BYTE 160,255,255,0,255
.BYTE 255,0,255,0,255
.BYTE 0,255,255,255,0
.BYTE 255,255,255,255,160
.BYTE 160,0,0,0,0
.BYTE 0,0,0,0,0
.BYTE 0,0,0,0,0
.BYTE 253,0,0,0,160
.BYTE 160,0,254,254,254
.BYTE 0,254,254,254,254
.BYTE 0,254,254,254,0
.BYTE 254,254,254,0,160
.BYTE 160,0,255,0,0
.BYTE 0,0,0,0,0
.BYTE 0,255,0,0,0
.BYTE 0,0,255,0,160
.BYTE 160,0,253,0,253
.BYTE 253,253,253,253,253
.BYTE 0,0,0,253,253
.BYTE 253,0,0,0,160
.BYTE 160,0,254,0,0
.BYTE 254,0,0,0,254
.BYTE 0,254,0,0,0
.BYTE 0,0,254,254,160
.BYTE 160,0,255,0,255
.BYTE 255,0,255,0,255
.BYTE 0,255,255,255,255
.BYTE 255,0,0,0,160
.BYTE 160,0,253,0,0
.BYTE 253,0,253,0,253
.BYTE 0,253,0,0,0
.BYTE 253,253,253,0,160
.BYTE 160,0,0,0,0
.BYTE 0,0,0,0,0
.BYTE 0,0,0,254,0
.BYTE 0,0,0,0,160
.SBYTE +$80,"@@@@@@@@@@"
.SBYTE +$80,"@@@@@@@@@@"
;
;TEXT MESSAGES
;-------------
;
PLRTXT .SBYTE "WIZARDwizard"
.SBYTE +$80,"WIZARDwizard"
ZOMTXT .SBYTE "ZOMBIEzombie"
.SBYTE +$80,"ZOMBIEzombie"
ENDTXT .SBYTE "WINS"
;
;GAME SCREEN SPACE
;-----------------
;
GAMESCR .DS 760
BOTSCRN .DS 11
SCORE .DS 69
;
*= $02E0
.WORD INIT
;
.END