A.N.A.L.O.G. ISSUE 10 / MARCH 1983 / PAGE 100
When looking over the reader survey cards sent in from A.N.A.L.O.G. #9, one quickly notices a common request: more assembly-language game programs. In an effort to satisfy those avid videogamers out there, I have written “Fill ’Er Up,” a public-domain assembly-language game.
This article contains two program listings. Listing #1 is a BASIC program which, when run, will build the machine-language game in memory and execute it. Listing #2 is the assembly-language source code for “Fill ’Er Up!,” for those who are interested in assembly-language programming.
To play the game, type listing #1 into your computer. I realize that those DATA statements aren’t fun to type in, but they are a necessary evil. This game differs from previous A.N.A.L.O.G. games in that this data is listed in hexadecimal (base 16). If I had listed it in decimal, “Fill ’Er Up!” would have required 24K memory on cassette. If you want to play the game, you have to pay the piper. . .
After typing the BASIC program into your computer, SAVE it. When the program is RUN, it will transfer control to the “Fill ’Er Up!” machine code, which will wipe out the BASIC program. If this happens, you’ll have to re-type the BASIC program. The program will warn you before it blows itself away.
After SAVEing the BASIC program, RUN it. The program will READ the data and check it to make sure it was typed in correctly. Two types of error messages may be displayed. A BAD DATA error means that the line indicated was mistyped. A MISSING LINE message indicates that you left a line out completely. It takes roughly 2 minutes for the program to check the DATA.
If the program is typed in correctly, it will warn you to SAVE it before it starts the game. Type “YES” to this message to continue.
You start out on the white border surrounding the planned reservoir area. You may move around on these white walls by moving your joystick in the desired direction. You can build a reservoir wall by moving into the black “uncharted” area while pressing your joystick button. The walls you make can be any length, and must be terminated at a white wall. When you finish a wall by hitting a white wall, the area you have enclosed will fill with water. Do NOT run into the wall you are building or you will be destroyed. If the starfish hits you or any part of the wall you are building before you complete it, you will be destroyed. On levels 1,2,4,7,12 and 13 you wil be safe from attack when standing on a white wall, but on other levels the starfish can destroy you on contact at any time!
At the bottom of the screen are several information displays. “TGT” indicates the TARGET area you must fill with water before you complete the level. “CUR” indicates the CURRENT area you have filled. Once CUR reaches TGT, you have completed the level and are awarded points. SCORE indicates the number of points you have gained. At the end of each level, the computer will give you 2 points for each unit over the target you have filled. If the TARGET amount is 8000 and you fill 9000 units, you receive 2000 points. “Fill ’Er Up” may be paused at any time by pressing the space bar.
This game contains 16 levels of difficulty. The level number is shown in the lower left corner of the screen.
You have 3 lives, shown in the lower right corner of the screen. Good luck!
1 REM *** FILL 'ER UP! *** 10 DATA 0,1,2,3,4,5,6,7,8,9,0,0,0,0,0,0,0,10,11,12,13,14,15 20 DIM PROG$(3240),DAT$(91),HEX(22):FO R X=0 TO 22:READ N:HEX(X)=N:NEXT X:LIN E=990:PNTR=1:TRAP 60 25 LINE=LINE+10:? "LINE:";LINE:READ DA T$:IF LEN(DAT$)<>90 THEN 110 28 DATLIN=PEEK(183)+PEEK(184)*256:IF D ATLIN<>LINE THEN ? "LINE ";LINE;" MISS ING!":END 30 FOR X=1 TO 89 STEP 2:D1=ASC(DAT$(X, X))-48:D2=ASC(DAT$(X+1,X+1))-48:BYTE=H EX(D1)*16+HEX(D2) 40 PROG$(PNTR)=CHR$(BYTE):PNTR=PNTR+1: TOTAL=TOTAL+BYTE:NEXT X:READ CHKSUM:IF TOTAL=CHKSUM THEN 25 50 GOTO 110 60 IF PEEK(195)<>6 THEN 110 70 ? "}WARNING: MAKE SURE PROGRAM IS S AVED!":? :? "READY TO RUN FILL 'ER UP" ;:DIM YN$(3):INPUT YN$ 80 IF YN$="YES" THEN A=USR(ADR(PROG$), ADR(PROG$)):END 90 END 110 ? "BAD DATA: LINE ";LINE:END 1000 DATA 68688581688580A9008582A91485 83A000B1809182A5801869018580A581690085 81A5821869018582A5836900,4894 1010 DATA 8583C920D0DEA582C989D0D82065 E4A9118D6F02A9018D2C208D442020E614A940 8DE71FA9808DE81FA9D0A204,10469 1020 DATA 9D241F9D2F1FCA10F7A2059D401F CA10FAA9008D442085D48D46208D1ED08D2F02 8D0ED48DA81F8D08D2A2059D,15237 1030 DATA 9D1FCA10FA8DA61FA9038DAC1F09 908D471FA90A8DC402A9248DC502A9948DC602 A9C48DC702A9008DC802A976,20370 1040 DATA 8DC302A9348DC002A9BB8D3002A9 1E8D3102A0BEA21DA906205CE4A9108D07D4A9 2E8D2F02A9038D1DD0A9408D,25144 1050 DATA 0ED44C4D15A900A27F9D80119D00 129D80129D00139D8013CAD0EE60A5CE0A85CB A90085CC06CB26CC06CBA5CB,30257 1060 DATA 85CF26CCA5CC85D006CB26CC06CB 26CCA5CB1865CF85CBA5CC65D085CCA9001865 CB85CBA93065CC85CCA5CD29,36605 1070 DATA 03AAA5CD4A4A1865CB85CBA5CC69 0085CC60A20086CDA20086CE20FD14A6CEA900 A02791CB8810FBE8E056D0EB,42651 1080 DATA A9038D2620AE2620BD122085CDBD 162085CEBD1A208D2720BD1E208D2820BD2220 8D292020FD14BDFE1FA00011,46785 1090 DATA CB91CBA5CD186D272085CDA5CE18 6D282085CECE2920D0DFCE262010BBA95085D5 A95485D6ADA61F1869018DA9,52357 1100 DATA 1FA9008DA41F8DA51F8DAA1FA9FF 8DA31F20E719AD7A2009908D371FAD79200990 8D381FAEA61FBD5C1F8DA91F,57057 1110 DATA BD6C1F8DAA1FBD7C1F8DFD1FA904 8DA31F20E719A9008D2C20AA9D89209D8921CA D0F78D50208D4F20ADA71FD0,62242 1120 DATA FBA9FD8D00D2A9FE8D02D2A9FF8D 04D2A9A38D01D28D03D28D05D2A900854DA5D4 F022AEA61FBD8C1FD017A5D5,68585 1130 DATA 85CDA5D685CE20FD14A000BD0A20 31CBDDFE1FF0034C7118A5D2F0064C3A1A4C18 16A90485D2AD78028D4820AA,73680 1140 DATA BD5120187D512085D7BD6120187D 612085D805D7F0DCA5D51865D78D2D20C99FB0 D085CD38FD51208D2A20A5D6,79251 1150 DATA 1865D88D2E20C955B0BB85CE38FD 61208D2B2020FD14A000BD0A2031CB8D4D208E 4E20AD2A2085CDAD2B2085CE,84075 1160 DATA 20FD14A000BD0A2031CB48AD8402 D00668D01E4C041768DDFE1FD015AD4D20AE4E 20DDFE1FD00AAD2D2085D5AD,88959 1170 DATA 2E2085D64C1816AD4F20D0278D50 20AD48208D8920A9018D4F208DA81FA5D58D2F 208D31208D3320A5D68D3020,93283 1180 DATA 8D32208D3420AD4D20AE4E20DD02 20D0034C7118AE5020AD4820DD8920F00CEE50 20E89D8920A9009D8921FE89,97976 1190 DATA 21A9038D2920A5D585CDA5D685CE 20FD14A000B1CB3D0E201D022091CBCE2920F0 19AC5020BE8920BD51201865,102806 1200 DATA CD85CDBD61201865CE85CE4C6517 A5CD85D5CD332090068D33204CA917CD3120B0 038D3120A5CE85D6CD342090,108021 1210 DATA 068D34204CC017CD3220B0038D32 20AE4E20AD4D20DDFE1FF0034C1816A9008D4F 2020AC1AADA41F8DA91FADA5,112367 1220 DATA 1F8DAA1FA90F8DA31F20E719A901 8D4920205019AEA61FADA41F38FD5C1F8DA91F ADA51FFD6C1F8DAA1F10034C,116810 1230 DATA 0316ADA61FC90FF003EEA61F0EA9 1F2EAA1FA9FF8DA31F20E719A205A000B97920 187D9D1FC90A300C38E90A9D,121336 1240 DATA 9D1FFE9C1F4C43189D9D1FC8CA10 E2A205BD9D1F09109D401FCA10F5A9018D4420 8D2C2020E614A9408DE71FA9,126120 1250 DATA 808DE81FA9008D44204C4D15A900 8D01D28D03D28D05D2A9018D4620A90F8D4720 A90585D3AD47208D01D2AD0A,130637 1260 DATA D2291F8D00D2AD0AD229F00D4720 8DC5028DC302A5D3D0E0CE472010D7CEAC1FAD AC1F09908D471FC990D025A9,136026 1270 DATA 488D181FA91F8D191FAD1FD02901 D0F9AD1FD02901F0F9A9208D181FA91F8D191F 4C3914A9018D2C20AD0AD229,140313 1280 DATA FEC99FB0F785CDAD0AD2297EC955 B0F785CE20FD14A000BD0A2031CBDDFE1FD0DB 20E614A5CD85D5A5CE85D6A9,147062 1290 DATA 008D4920ADA81FF01C205019AD2F 2085CDAD302085CE20FD14A000BD0E2031CB1D FE1F91CBA9248DC502A9008D,151736 1300 DATA 46208D1ED085D44C0316AD2F208D 3520AD30208D3620A9008D3720AE3720BD8920 8D4A20BD89218D4B20A9018D,155802 1310 DATA 3820A9038D4C20AD352085CDAD36 2085CE20FD14A000AD4920D010BD0E2031CB91 CB4CA819A9008D4F2060BD0E,160296 1320 DATA 2031CB1DFE1F91CBCE4C20F01AAE 4A20AD3520187D51208D3520AD3620187D6120 8D36204C7A19EE3820AD3820,164422 1330 DATA CD4B20F002B0034C7519EE3720AD 3720CD5020F002B0B44C6119A204A9009D7920 CA10FAA204ADAA1FDD7F20F0,169344 1340 DATA 04B0109008ADA91FDD8420B006CA 10E94C261AADA91F38FD84208DA91FADAA1FFD 7F208DAA1FFE79204CF319A2,174451 1350 DATA 04ACA31F300CBD792009D099201F C8CA10F460A5D1F0034C1816ADFD1F85D1ADE7 1F38E90D8DEA1FADE81F38E9,179820 1360 DATA 2C8DE91FAD0AD2C9F09008AD0AD2 29074C6A1AADEC1FAA8DEB1FADE91F187DED1F 85CDADEA1F187DF51F85CE20,185347 1370 DATA FD14A000BD0A2031CBF007A90F8D 4120D0CCA5CD18692C8DE81FA5CE18690D8DE7 1FADEB1F8DEC1F4C1816A901,190346 1380 DATA 8D4420A9008D4020ADE81F38E92C 8D3920ADE71F38E90D8D3A20AE4020AD392018 7D71208D392085CDAD3A2018,194641 1390 DATA 7D75208D3A2085CE20FD14A000B1 CB3D0A20DDFE1FF00DDD0220D0D1A9008D3F20 4C271BAD40208D3F2020061C,198982 1400 DATA 20B01BDDFE1FD00620E71B4CFF1A DD0220D00620E71B4C6D1B20FA1B4C081BA900 8D432020061C20B01BDD0220,202940 1410 DATA D00620E71B4C271BAD4320186901 8D4320C903F00620FA1B4C2F1BAD40208D3F20 20061C20B01BDDFE1FD00620,206695 1420 DATA E71B4CFF1A20FA1B4C591B20121C A9008D432020B01BDDFE1FD00620E71B4C6D1B AD43201869018D4320C904F0,210842 1430 DATA 0620FA1B4C751B20CB1BDD0220D0 0920521CA9008D44206020FA1B20B01B4C991B AE3F20AD3920187D71208D3B,214584 1440 DATA 2085CDAD3A20187D75208D3C2085 CEA5CDC99FB011A5CEC955B00B20FD14A000B1 CB3D0A2060A900A20060AD3F,219561 1450 DATA 208D4020AD3B208D3920AD3C208D 3A2060AD3F2018690129038D3F2060AD3F2038 E90129038D3F2060AD392085,223019 1460 DATA CDCD332090068D33204C2A1CCD31 20B0038D3120AD3A2085CECD342090068D3420 4C421CCD3220B0038D322020,226876 1470 DATA FD14A000BD0E2031CB1D022091CB 60A9008D03D28D05D2AD342038ED32208D4220 AD312038E9018D31208D3D20,231053 1480 DATA AD32208D3E2038E9018D3220AD33 201869018D3320AD34201869018D3420A9008D AB1FA9008D452020081DC902,234473 1490 DATA D0F9EE452020081DC902F0F62901 D0E6AD4520C901F005209C1DF0DAAD3D2085CD AD3E2085CE20FD14A000B1CB,239958 1500 DATA 1D062091CBEEAB1F20081DC900F0 E02901D0B6A9018D452020081DC900F00A2901 D0A6EE45204CE21CAD4520C9,244471 1510 DATA 01D0034C931C209C1DDD0A20F0B4 4C931CAD3D201869018D3D20CD3320D050ADA4 1F186DAB1F8DA41FADA51F69,248804 1520 DATA 008DA51FA9008DAB1FAD31208D3D 20A9008D4520A9868D01D2AD42208D00D2F003 CE4220AD3E201869018D3E20,253008 1530 DATA CD3420F00DAD3D20CD3120D00868 684C931C686860AD3D2085CDAD3E2085CE20FD 14A000BD0A2031CBDD0220D0,257702 1540 DATA 0DBD0A2011CB91CBEEAB1FA90260 DDFE1FD003A90160C900D00160A90360AD3D20 85CDAD3E2038E901CD3220F0,262666 1550 DATA 0D85CE20FD14A000BD0A2031CB60 A900A20060ADFC02C921D00DA9FF8DFC02ADA7 1F49FF8DA71FADA71FF0034C,267918 1560 DATA 5FE4AD4120300D09A08D07D2A980 8D06D2CE4120A5D3F002C6D3AD4420F0034C5F E4A90085D4AD0CD02908F002,273196 1570 DATA E6D4AD04D02902F002E6D48D1ED0 A5D2F002C6D2A5D1F002C6D1ADE51FF006CEE5 1F4C3E1EA9018DE51FADE61F,279495 1580 DATA 186901C907D002A9008DE61FACE6 1FAEE71FA9009DFF119D0812B9AD1F9D0012B9 B41F9D0112B9BB1F9D0212B9,284165 1590 DATA C21F9D0312B9C91F9D0412B9D01F 9D0512B9D71F9D0612B9DE1F9D0712ADE81F8D 00D0AD2C20D031A5D518692F,288845 1600 DATA 8D03D0A5D6186910AAA9009D7D13 9D7E139D82139D8313A9409D7F139D8113A9A0 9D8013AD4620D003EEC3024C,293747 1610 DATA 5FE47070704D00300D0D0D0D0D0D 0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D 0D0D0D0D0D0D0D0D0D0D0D0D,295012 1620 DATA 0D0D0D0D0D0D0D0D0D0D0D0D0D0D 0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D 0D0D0D0D0D0D0D0D0D0D0D0D,295597 1630 DATA 0D0D0D2046201F46341F41BB1E34 27341A000000000000002335321A0000000000 2C361A00000033232F32251A,296939 1640 DATA 0000000000000000000000000027 212D2500002F36253200000000004010E028F8 D41004F8E0D4E044A870D41F,299604 1650 DATA 272E232A3027292A2E302E2F2F30 30040404030303020202020201010101010000 010001010001010101000001,300310 1660 DATA 0101000000000000000000000000 000000000081402010080402424320100804C2 2424131008C82418181C1FF8,301660 1670 DATA 3818181838F81F1C182424C80810 132442C2040810204381020408102040000000 0000000000010100FFFFFF00,303935 1680 DATA 010001010001FFFFFF0440100401 80200802C0300C03C0300C033FCFF3FC009E9E 00000054540100FF00000100,306979 1690 DATA FF9F559F55000000000000000000 00000000000000000000000000000000000000 000000000000000000000000,307722 1700 DATA 0000000000000000000001000000 FF000000000000000000000000000000000001 FF00000100FFFF0001000000,308746 1710 DATA 000000000000000327010A64E810 00000000000000000000000000000000000000 000000000000000000000000,309147
1 DATA 23,955,92,427,745,192,706,445,496,94,229,259,150,587,331,5731 1020 DATA 494,554,427,296,789,628,347, 594,792,797,637,422,363,402,567,8109 1170 DATA 290,309,133,133,331,611,509, 408,221,397,339,747,344,149,294,5215 1320 DATA 85,256,474,378,896,521,202,2 95,122,168,204,58,362,981,960,5962 1470 DATA 938,873,363,75,335,219,140,2 99,489,89,576,361,363,130,239,5539 1620 DATA 463,372,423,86,20,366,693,89 3,961,810,5087
; ;FILL 'ER UP! ; ;BY TOM HUDSON ;A.N.A.L.O.G. COMPUTING #10 ; ; ;ALPHABETIC CONSTANTS ; CA = 'A'-$20 CB = 'B'-$20 CC = 'C'-$20 CD = 'D'-$20 CE = 'E'-$20 CF = 'F'-$20 CG = 'G'-$20 CH = 'H'-$20 CI = 'I'-$20 CJ = 'J'-$20 CK = 'K'-$20 CL = 'L'-$20 CM = 'M'-$20 CN = 'N'-$20 CO = 'O'-$20 CP = 'P'-$20 CQ = 'Q'-$20 CR = 'R'-$20 CS = 'S'-$20 CT = 'T'-$20 CU = 'U'-$20 CV = 'V'-$20 CW = 'W'-$20 CX = 'X'-$20 CY = 'Y'-$20 CZ = 'Z'-$20 CCOL = ':'-$20 ; ;PAGE ZERO ITEMS ; LO = $CB HI = $CC PLOTX = $CD PLOTY = $CE LOHLD = $CF HIHLD = $D0 SMTIM = $D1 MOVTIM = $D2 TIMER = $D3 DEADFG = $D4 PX = $D5 PY = $D6 XI = $D7 YI = $D8 ; ;MISCELLANEOUS MEMORY USAGE ; PMAREA = $1000 MISSLS = PMAREA+384 PL0 = PMAREA+512 PL1 = PMAREA+640 PL2 = PMAREA+768 PL3 = PMAREA+896 DISP = $3000 ; ;SYSTEM EQUATES ; KEY = $2FC CONSOL = $D01F PMBASE = $D407 CHBASE = $02F4 RANDOM = $D20A SETVBV = $E45C XITVBV = $E45F COLBK = $2C8 COLPF0 = $2C4 COLPF1 = $2C5 COLPF2 = $2C6 COLPF3 = $2C7 AUDC1 = $D201 AUDC2 = $D203 AUDC3 = $D205 AUDC4 = $D207 AUDF1 = $D200 AUDF2 = $D202 AUDF3 = $D204 AUDF4 = $D206 AUDCTL = $D208 PRIOR = $026F ATTRACT = $4D DMACTL = $22F DLISTL = $230 GRACTL = $D01D NMIEN = $D40E PCOLR0 = $D012 COLPM0 = $2C0 COLPM1 = $2C1 COLPM2 = $2C2 COLPM3 = $2C3 HPOSP0 = $D000 HPOSP1 = $D001 HPOSP2 = $D002 HPOSP3 = $D003 HPOSM0 = $D004 HITCLR = $D01E P0PF = $D004 P1PF = $D005 P2PF = $D006 P3PF = $D007 P0PL = $D00C P3PL = $D00F STICK = $278 STRIG = $284 ORG $6000 ;ASSEMBLER WILL ;PUT IT HERE LOC $1400 ;PROGRAM START ; ;THIS CODE, WHEN CALLED BY BASIC, WILL ;MOVE THE 'FILL 'ER UP!' CODE TO ITS ;PROPER LOCATION ($1400) AND EXECUTE IT. ; PROG PLA ;DISCARD PLA ;PULL THE STA $81 ;ADDRESS OF PLA ;THE HOLDING STA $80 ;STRING. LDA #$00 ;SET UP STA $82 ;DESTINATION LDA #$14 ;ADDRESS ON STA $83 ;PAGE ZERO. LDY #0 COPYLP LDA ($80),Y ;COPY THE BLOCK STA ($82),Y ;OF MEMORY. LDA $80 CLC ADC #1 STA $80 LDA $81 ADC #0 STA $81 LDA $82 CLC ADC #1 STA $82 LDA $83 ADC #0 STA $83 CMP #DIR/256 ;AT END YET? BNE COPYLP ;NO! LDA $82 ;WELL, MAYBE... CMP #DIR&255 ;AT END? BNE COPYLP ;NOPE! ; ;MAIN PROGRAM STARTS HERE ; START JSR $E465 ;INIT SOUNDS LDA #$11 ;P/M PRIORITY STA PRIOR LDA #1 ;DON'T SHOW STA SHOOFF ;PLAYER OR STAR STA FILLON ;WE STILL MUST JSR PMCLR ;CLEAR P/M AREA LDA #64 ;AND SET UP THE STA STRHGT ;STAR'S HEIGHT LDA #128 ;AND STA STRHOR ;HORIZONTAL POSITION LDA #$D0 ;NOW LET'S LDX #4 ;ZERO OUT ZSCLP STA SCOLIN+4,X ;THE SCORE STA SCOLIN+15,X ;AREAS! DEX BPL ZSCLP LDX #5 ZSCLP2 STA SCOLN2+12,X DEX BPL ZSCLP2 LDA #0 ;THESE ITEMS STA FILLON ;MUST BE SET STA DEADFG ;TO ZERO ON STA NOCCHG ;STARTUP OR STA HITCLR ;ELSE WE'LL STA DMACTL ;WIND UP WITH STA NMIEN ;NASTY THINGS STA HASDRN ;HAPPENING! STA AUDCTL LDX #5 ;LET'S ZERO CMSLP STA SCORE,X ;OUT THE SCORE DEX ;COUNTER... BPL CMSLP STA LEVEL ;AND LEVEL #! LDA #3 ;WE START WITH STA LIVES ;3 LIVES ORA #$90 ;AND PUT THEM IN STA SCOLN2+19 ;THE SCORE LINE LDA #$0A ;NEXT WE SET UP STA COLPF0 ;THE COLORS WE LDA #$24 ;WANT TO USE. STA COLPF1 LDA #$94 STA COLPF2 LDA #$C4 STA COLPF3 LDA #0 STA COLBK LDA #$76 STA COLPM3 LDA #$34 STA COLPM0 LDA #DLIST&255 ;WE'D BETTER TELL STA DLISTL ;THE COMPUTER WHERE LDA #DLIST/256 ;OUR DISPLAY LIST STA DLISTL+1 ;IS LOCATED! LDY #INTRPT&255 ;TELL WHERE THE LDX #INTRPT/256 ;VERTICAL BLANK LDA #6 ;INTERRUPT IS JSR SETVBV ;AND SET IT! LDA #PMAREA/256 ;HERE'S OUR P/M STA PMBASE ;GRAPHICS AREA! LDA #$2E ;TURN ON THE STA DMACTL ;DMA CONTROL LDA #$3 ;AND STA GRACTL ;GRAPHICS CONTROL! LDA #$40 ;ENABLE VBI STA NMIEN JMP CLRDSP PMCLR LDA #0 ;CLEAR OUT LDX #127 ;THE P/M AREA: PMICLR STA MISSLS,X ;MISSILES, STA PL0,X ;PLAYER 0, STA PL1,X ;PLAYER 1, STA PL2,X ;PLAYER 2, STA PL3,X ;AND PLAYER 3! DEX BNE PMICLR ;LOOP UNTIL DONE RETURN RTS ;WE'RE DONE! ; ;PLOT ADDRESS CALCULATOR ; ;MULTIPLY PLOTY BY 40, THEN CALCULATE ADDRESS ;OF THE SCREEN MEMORY TO BE ALTERED. ; PLOTCL LDA PLOTY ASL A STA LO LDA #0 STA HI ;*2 ASL LO ROL HI ;*4 ASL LO LDA LO STA LOHLD ROL HI ;*8 LDA HI STA HIHLD ASL LO ROL HI ;*16 ASL LO ROL HI ;*32 LDA LO CLC ADC LOHLD STA LO LDA HI ADC HIHLD STA HI ;+*8=*40 LDA #DISP&255 CLC ADC LO STA LO LDA #DISP/256 ADC HI STA HI ;+DISPLAY START LDA PLOTX ;MASK X POSITION AND #3 TAX LDA PLOTX LSR A LSR A CLC ADC LO STA LO LDA HI ADC #0 ;LO & HI NOW HOLD STA HI ;THE ADDRESS! RTS ;EXIT! ; ;CLEAR THE DISPLAY MEMORY ; CLRDSP LDX #0 ;THIS ROUTINE WILL STX PLOTX ;CLEAR THE SCREEN RAM. LDX #0 ;IT GETS THE ADDRESS DLOOP2 STX PLOTY ;OF THE BEGINNING OF JSR PLOTCL ;EACH GR.7 LINE LDX PLOTY ;THEN ZEROES OUT LDA #$00 ;EACH OF THE LDY #39 ;40 BYTES (0-39) DLOOP3 STA (LO),Y ;IN THE LINE. DEY BPL DLOOP3 INX CPX #86 BNE DLOOP2 ; ;DRAW THE COLOR 1 BORDER ; LDA #3 ;THIS ROUTINE STA BORNUM ;DRAWS THE 4 LINES BORDER LDX BORNUM ;THAT MAKE UP THE LDA BXSTRT,X ;WHITE GR.7 BORDER STA PLOTX ;ON THE SCREEN. LDA BYSTRT,X STA PLOTY LDA BXINC,X STA BDINCX LDA BYINC,X STA BDINCY LDA BORCNT,X STA BDCNT DRAWLN JSR PLOTCL LDA COLOR1,X LDY #0 ORA (LO),Y STA (LO),Y LDA PLOTX CLC ADC BDINCX STA PLOTX LDA PLOTY CLC ADC BDINCY STA PLOTY DEC BDCNT BNE DRAWLN DEC BORNUM BPL BORDER ; ;THIS SECTION STARTS OFF EACH LEVEL ; LDA #80 ;POSITION THE STA PX ;PLAYER LDA #84 STA PY LDA LEVEL ;INCREMENT THE CLC ;LEVEL NUMBER ADC #1 STA LOWK LDA #0 ;ZERO OUT STA CURLO ;CURRENT TALLY STA CURHI ;WORK AREA STA HIWK LDA #$FF ;TELL DECIMAL CONVERTER STA SLLOC ;NOT TO PLACE RESULT JSR CNVDEC ;CONVERT LEVEL # LDA DECIMAL+1 ;GET DECIMAL LEVEL # ORA #$90 ;ADD COLOR STA SCOLN2+3 ;PUT IN SCORE LINE LDA DECIMAL ;SAME FOR 2ND ORA #$90 ;LEVEL # STA SCOLN2+4 ;DIGIT LDX LEVEL ;GET THIS LEVEL'S LDA TGTLO,X ;PARAMETERS STA LOWK LDA TGTHI,X STA HIWK LDA STARSP,X STA STRSPD LDA #4 STA SLLOC JSR CNVDEC ;SHOW TARGET AMOUNT ; ;CLEAR OUT THE TRACKING TABLE THAT ;REMEMBERS WHERE THE PLAYER MOVED ; CLRTRK LDA #0 STA SHOOFF TAX CLRTLP STA DIR,X ;CLEAR DIRECTION STA LGTH,X ;AND LENGTH ENTRIES DEX BNE CLRTLP STA MOVIX ;CLEAR MOVEMENT INDEX STA DRAWFG ;AND DRAW FLAG GETSTK LDA PAUSE ;GAME PAUSED? BNE GETSTK ;YES, LOOP AND WAIT. LDA #$FD ;DO 'WARBLE' SOUND STA AUDF1 ;USING SOUND LDA #$FE ;CHANNELS 1-3 STA AUDF2 LDA #$FF STA AUDF3 LDA #$A3 STA AUDC1 STA AUDC2 STA AUDC3 LDA #0 ;NO ATTRACT MODE! STA ATTRACT LDA DEADFG ;DID STAR HIT US? BEQ ALIVE ;NO! LDX LEVEL ;IT HIT US-- LDA KILLFG,X ;UNCONDITIONAL KILL? BNE JCRSH ;YES! WE'RE DEAD!!! LDA PX ;NO, IF WE'RE ON A STA PLOTX ;WHITE LINE (COLOR 1) LDA PY ;THEN WE'RE ALIVE! STA PLOTY JSR PLOTCL LDY #0 LDA BITSON,X AND (LO),Y CMP COLOR1,X ;ON COLOR 1? BEQ ALIVE ;YES (WHEW!) JCRSH JMP CRASH ;GO KILL PLAYER. ALIVE LDA MOVTIM ;PLAYER MOVING? BEQ GOTSTK ;YES--GET STICK. JMP MOVSTR ;NO, MOVE STAR. JGSTK JMP GETSTK ;GO GET STICK GOTSTK LDA #4 ;SET UP THE STA MOVTIM ;MOVEMENT TIMER LDA STICK ;GET THE STICK STA STKHLD ;AND SAVE IT TAX ;THEN LOOK UP LDA XD,X ;X DIRECTION CLC ADC XD,X STA XI ;AND LDA YD,X ;Y DIRECTION CLC ADC YD,X STA YI ORA XI ;ANY MOVEMENT? BEQ JGSTK ;NO, TRY AGAIN. LDA PX ;INCREMENT CLC ;PLAYER X ADC XI ;POSITION AND STA CKX ;HOLD IT... CMP #159 ;OFFSCREEN? BCS JGSTK ;YES! STA PLOTX ;NO, SAVE IT SEC SBC XD,X STA PXWC LDA PY ;INCREMENT CLC ;PLAYER Y ADC YI ;POSITION AND STA CKY ;HOLD IT... CMP #85 ;OFFSCREEN? BCS JGSTK ;YES! STA PLOTY ;NO, SAVE IT SEC SBC YD,X STA PYWC JSR PLOTCL ;LOCATE NEW PLAYER LDY #0 ;POSITION. LDA BITSON,X AND (LO),Y STA CKV ;SAVE THE 'LOCATE'. STX CKVX LDA PXWC ;CHECK THE STA PLOTX ;POSITION NEXT LDA PYWC ;TO THE ONE WE'RE STA PLOTY ;NOW IN... JSR PLOTCL LDY #0 LDA BITSON,X AND (LO),Y PHA ;AND SAVE IT! LDA STRIG ;TRIGGER PRESSED? BNE NOTDRN ;NO! PLA ;OK TO DRAW? BNE JGS ;NO!! JMP DRAWIN ;YES, GO DRAW. NOTDRN PLA ;NOT DRAWING--ARE WE CMP COLOR1,X ;ON COLOR 1? BNE JGS ;NO, TRY AGAIN LDA CKV ;ARE WE MOVING LDX CKVX ;ONTO ANOTHER CMP COLOR1,X ;COLOR 1? BNE JGS ;NO! TRY AGAIN. LDA CKX ;ALL'S WELL... STA PX ;UPDATE PX LDA CKY ;AND STA PY ;PY, JGS JMP GETSTK ;GET STICK. ; ;THIS ROUTINE HANDLES THE DRAW FUNCTION. ; DRAWIN LDA DRAWFG ;ALREADY DRAWING? BNE DRAWOK ;YES! STA MOVIX ;NO, THIS IS THE LDA STKHLD ;FIRST TIME--SET UP STA DIR ;INITIAL DRAWING LDA #1 ;VARIABLES. STA DRAWFG STA HASDRN LDA PX STA INIX STA MINX STA MAXX LDA PY STA INIY STA MINY STA MAXY DRAWOK LDA CKV ;DID WE LDX CKVX ;RUN INTO ANOTHER CMP COLOR2,X ;COLOR 2? BNE NOCRSH ;NO, WE'RE OK. JMP CRASH ;CRRAAASSSHHH! NOCRSH LDX MOVIX ;UPDATE THE LDA STKHLD ;TRACKING CMP DIR,X ;TABLES WITH BEQ SAMDIR ;DIRECTION INC MOVIX ;INFORMATION. INX STA DIR,X LDA #0 STA LGTH,X SAMDIR INC LGTH,X LDA #3 STA BDCNT LDA PX ;NOW PLOT THE STA PLOTX ;LINE WE'RE LDA PY ;DRAWING... STA PLOTY CCLOOP JSR PLOTCL LDY #0 LDA (LO),Y AND BITOFF,X ORA COLOR2,X ;IN COLOR 2. STA (LO),Y DEC BDCNT BEQ CKCOLR LDY MOVIX LDX DIR,Y LDA XD,X CLC ADC PLOTX STA PLOTX LDA YD,X CLC ADC PLOTY STA PLOTY JMP CCLOOP CKCOLR LDA PLOTX ;UPDATE X POS. STA PX CMP MAXX ;CHECK MINIMUM BCC TMINX ;AND MAXIMUM STA MAXX ;X & Y VALUES JMP CHKYMM ;AND UPDATE IF TMINX CMP MINX ;NECESSARY BCS CHKYMM STA MINX CHKYMM LDA PLOTY STA PY CMP MAXY BCC TMINY STA MAXY JMP ENDMM TMINY CMP MINY BCS ENDMM STA MINY ENDMM LDX CKVX ;DID WE DRAW LDA CKV ;INTO CMP COLOR1,X ;COLOR 1? BEQ ENDLIN ;YES! END OF LINE! JMP GETSTK ;NO, GO GET STICK. ENDLIN LDA #0 ;WE AREN'T STA DRAWFG ;DRAWING ANYMORE JSR SEARCH ;SEARCH AND FILL!! LDA CURLO ;GET CURRENT VALUE STA LOWK LDA CURHI STA HIWK LDA #15 ;PUT AT 15TH STA SLLOC ;POS. IN SCOLIN JSR CNVDEC ;CONVERT TO DECIMAL LDA #1 ;NOW REDRAW THE STA RDRCOL ;PLAYER'S PATH IN JSR REDRAW ;COLOR 1 (WHITE). LDX LEVEL ;CHECK TO SEE LDA CURLO ;IF WE'VE HIT SEC ;THE TARGET. SBC TGTLO,X STA LOWK LDA CURHI SBC TGTHI,X STA HIWK ;HIT TARGET? BPL NEWLVL ;YES--NEW LEVEL! JMP CLRTRK ;NO, GO CLEAR TRACK NEWLVL LDA LEVEL ;IF LEVEL < 15 CMP #15 ;THEN BEQ NOLINC ;INCREMENT INC LEVEL ;LEVEL ; ;INCREASE SCORE HERE ; NOLINC ASL LOWK ;SCORE INC = ROL HIWK ;TGT-CUR * 2 LDA #$FF ;DON'T PLACE STA SLLOC ;THE RESULT! JSR CNVDEC ;CONVERT TO DECIMAL LDX #5 ;AND ADD TO SCORE LDY #0 SCOLP LDA DECIMAL,Y CLC ADC SCORE,X CMP #10 BMI NOCARY SEC SBC #10 STA SCORE,X INC SCORE-1,X JMP NXSPOS NOCARY STA SCORE,X NXSPOS INY DEX BPL SCOLP LDX #5 ;NOW PLACE THE SHSLP LDA SCORE,X ;SCORE IN ORA #$10 ;SCORE LINE #2 STA SCOLN2+12,X DEX BPL SHSLP LDA #1 ;STOP VBI FOR STA FILLON ;A MOMENT STA SHOOFF JSR PMCLR ;CLEAR P/M AREA LDA #64 ;INITIALIZE STA STRHGT ;THE LDA #128 ;STAR STA STRHOR ;POSITION LDA #0 ;VBI ON AGAIN STA FILLON JMP CLRDSP ;GO CLEAR DISPLAY! ; ;THIS SECTION HANDLES PLAYER'S DEATH ; CRASH LDA #0 ;NO WARBLE SOUND STA AUDC1 STA AUDC2 STA AUDC3 LDA #1 ;NO PLAYER COLOR STA NOCCHG ;CHANGE IN VBI LDA #15 ;SET BRIGHTNESS OF STA DEDBRT ;PLAYER DEATH. TIMRST LDA #5 ;SET DEATH TIMER STA TIMER ;TO 5 JIFFIES. DEADCC LDA DEDBRT ;MOVE BRIGHTNESS STA AUDC1 ;TO DEATH SOUND VOLUME LDA RANDOM ;GET RANDOM AND #$1F ;DEATH SOUND STA AUDF1 ;FREQUENCY LDA RANDOM ;GET RANDOM AND #$F0 ;DEATH COLOR ORA DEDBRT ;ADD BRITE STA COLPF1 ;PUT IN LINE COLOR STA COLPM3 ;AND PLAYER COLOR LDA TIMER ;TIMER DONE YET? BNE DEADCC ;NO, GO CHANGE COLOR. DEC DEDBRT ;DECREMENT BRIGHTNESS BPL TIMRST ;IF MORE, GO DO IT. DEC LIVES ;1 LESS LIFE LDA LIVES ;GET # LIVES ORA #$90 ;ADD COLOR STA SCOLN2+19 ;AND DISPLAY! CMP #$90 ;ZERO LIVES? BNE NOTDED ;NO! LDA #GOMSG&255 ;WE'RE COMPLETELY STA SCDL ;DEAD, SHOW LDA #GOMSG/256 ;'GAME OVER' STA SCDL+1 ;MESSAGE CKSTRT LDA CONSOL ;WAIT FOR START AND #1 ;KEY... BNE CKSTRT ;NOT PRESSED--LOOP. RELEAS LDA CONSOL ;KEY PRESSED, NOW AND #1 ;WAIT FOR RELEASE! BEQ RELEAS ;NOT RELEASED YET! LDA #SCOLIN&255 ;PUT SCORE STA SCDL ;LINE BACK LDA #SCOLIN/256 ;IN DISPLAY STA SCDL+1 ;LIST... JMP START ;AND START GAME! ; ;THIS SECTION PLACES PLAYER AT A RANDOM ;LOCATION IF THERE ARE MORE LIVES LEFT. ; NOTDED LDA #1 ;DON'T SHOW STA SHOOFF ;PLAYER NEWLOC LDA RANDOM ;GET RANDOM X AND #$FE ;MUST BE EVEN CMP #159 ;AND ON SCREEN BCS NEWLOC STA PLOTX CSHY LDA RANDOM ;GET RANDOM Y AND #$7E ;MUST BE EVEN CMP #85 ;AND ON SCREEN BCS CSHY STA PLOTY JSR PLOTCL LDY #0 LDA BITSON,X AND (LO),Y ;IS LOCATION ON CMP COLOR1,X ;COLOR 1? BNE NEWLOC ;NO, TRY AGAIN. JSR PMCLR ;IT'S OK, CLEAR P/M LDA PLOTX ;SAVE STA PX ;THE PLAYER'S LDA PLOTY ;NEW STA PY ;COORDINATES. LDA #0 ;REDRAW THE STA RDRCOL ;PLAYER'S TRACK LDA HASDRN ;IN COLOR 0 BEQ JCTRK JSR REDRAW LDA INIX ;THIS PART IS STA PLOTX ;NEEDED TO PLOT LDA INIY ;A COLOR 1 BLOCK STA PLOTY ;AT THE START OF JSR PLOTCL ;THE PLAYER'S TRACK LDY #0 ;AFTER IT IS ERASED. LDA BITOFF,X ;(NOBODY'S PERFECT!) AND (LO),Y ORA COLOR1,X STA (LO),Y JCTRK LDA #$24 ;RESTORE DRAW LINE STA COLPF1 ;COLOR LDA #0 STA NOCCHG STA HITCLR STA DEADFG JMP CLRTRK ;AND GO START NEW TRACK. ; ;THIS ROUTINE USES THE TRACKING TABLES, ;DIR AND LGTH, TO REDRAW THE LINE THE ;PLAYER DREW. RDRCOL INDICATES THE COLOR ;DESIRED. ; REDRAW LDA INIX STA REX LDA INIY STA REY LDA #0 STA X REDXLP LDX X LDA DIR,X STA REDIR LDA LGTH,X STA LGTHY LDA #1 STA Y REDYLP LDA #3 STA TIMES TIMES3 LDA REX STA PLOTX LDA REY STA PLOTY JSR PLOTCL LDY #0 LDA RDRCOL BNE RDC1 LDA BITOFF,X AND (LO),Y STA (LO),Y JMP SETNRP ENDRD LDA #0 STA DRAWFG RTS RDC1 LDA BITOFF,X AND (LO),Y ORA COLOR1,X STA (LO),Y SETNRP DEC TIMES BEQ NXTY LDX REDIR LDA REX CLC ADC XD,X STA REX LDA REY CLC ADC YD,X STA REY JMP TIMES3 NXTY INC Y LDA Y CMP LGTHY BEQ JNRD BCS NXTX JNRD JMP REDYLP NXTX INC X LDA X CMP MOVIX BEQ JRXLP BCS ENDRD JRXLP JMP REDXLP ; ;2-BYTE DECIMAL CONVERTER. CONVERTS ;A 2-BYTE BINARY NUMBER TO A 5-BYTE ;DECIMAL NUMBER. WILL PLACE THE ;DECIMAL NUMBER IN SCOLIN IF DESIRED ;(SLLOC DETERMINES POSITION). ; CNVDEC LDX #4 LDA #0 CDLP STA DECIMAL,X DEX BPL CDLP LDX #4 CKMAG LDA HIWK CMP HIVALS,X BEQ CKM2 BCS SUBEM BCC NOSUB CKM2 LDA LOWK CMP LOVALS,X BCS SUBEM NOSUB DEX BPL CKMAG JMP SHOWIT SUBEM LDA LOWK SEC SBC LOVALS,X STA LOWK LDA HIWK SBC HIVALS,X STA HIWK INC DECIMAL,X JMP CKMAG SHOWIT LDX #$4 LDY SLLOC BMI SHEND SHOLP LDA DECIMAL,X ORA #$D0 STA SCOLIN,Y INY DEX BPL SHOLP SHEND RTS ; ;THIS ROUTINE MOVES THE STAR AROUND ON ;THE PLAYFIELD. THE STAR IS ROTATED AND ;PLOTTED (IN A PLAYER) IN THE VBI. ; MOVSTR LDA SMTIM ;TIME TO MOVE? BEQ MSTR ;YES, GO DO IT JMP GETSTK ;NO, GET STICK MSTR LDA STRSPD ;SET MOVEMENT TIMER STA SMTIM ;WITH STAR SPEED LDA STRHGT ;ADJUST P/M SEC ;COORDINATES TO SBC #13 ;MATCH PLAYFIELD STA STRLY ;PLOTTING LDA STRHOR ;COORDINATES. SEC SBC #44 STA STRLX LDA RANDOM ;WANT TO CHANGE CMP #240 ;THE STAR'S DIRECTION? BCC SAMSTD ;NO, USE SAME. NEWDIR LDA RANDOM ;GET RANDOM AND #7 ;DIRECTION JMP DIRCHK SAMSTD LDA STRDIR ;GET OLD DIRECTION. DIRCHK TAX ;CHECK TO SEE STA TMPDIR ;IF STAR WILL LDA STRLX ;BUMP INTO ANY CLC ;PLAYFIELD ADC STRDTX,X ;OBJECT. STA PLOTX LDA STRLY CLC ADC STRDTY,X STA PLOTY JSR PLOTCL LDY #0 LDA BITSON,X AND (LO),Y ;ANY COLLISION? BEQ WAYCLR ;NO, ALL CLEAR! LDA #15 ;HIT SOMETHING, STA BSCNT ;START BUMP SOUND AND BNE NEWDIR ;GET NEW DIRECTION. WAYCLR LDA PLOTX ;ADJUST STAR CLC ;COORDINATES ADC #44 ;BACK TO P/M STA STRHOR ;COORDINATES LDA PLOTY ;FROM PLAYFIELD. CLC ADC #13 STA STRHGT LDA TMPDIR ;SET DIRECTION STA STRDIR JMP GETSTK ;AND LOOP ; ;SEARCH FOR FILLABLE AREA ; ;THIS SECTION SEARCHES FOR THE AREA TO ;BE FILLED. IT IS SO COMPLICATED THAT ;EXPLANATION OF ITS FINER DETAILS ;WOULD BE ALMOST IMPOSSIBLE WITHOUT ;WRITING ANOTHER COMPLETE ARTICLE. AT ;ANY RATE, IT WORKS. THOSE WITH ANY ;SPECIFIC QUESTIONS SHOULD WRITE ME, ;CARE OF A.N.A.L.O.G. ; SEARCH LDA #1 STA FILLON LDA #0 STA D LDA STRHOR SEC SBC #44 STA SX LDA STRHGT SEC SBC #13 STA SY FINDCL LDX D LDA SX CLC ADC SXD,X STA SX STA PLOTX LDA SY CLC ADC SYD,X STA SY STA PLOTY JSR PLOTCL LDY #0 LDA (LO),Y AND BITSON,X CMP COLOR1,X BEQ FINDC2 CMP COLOR2,X BNE FINDCL LDA #0 STA TD JMP FOUND2 FINDC2 LDA D STA TD JSR DECD FC2A JSR SRCHLC CMP COLOR1,X BNE FC2B JSR GRABEM JMP FINDC2 FC2B CMP COLOR2,X BNE FC2C JSR GRABEM JMP OUTLIN FC2C JSR INCD JMP FC2A FOUND2 LDA #0 STA TRIES JSR DECD FND2A JSR SRCHLC CMP COLOR2,X BNE FND2B JSR GRABEM JMP FOUND2 FND2B LDA TRIES CLC ADC #1 STA TRIES CMP #3 BEQ FINDC1 JSR INCD JMP FND2A FINDC1 LDA D STA TD JSR DECD FC1A JSR SRCHLC CMP COLOR1,X BNE FC1B JSR GRABEM JMP FINDC2 FC1B JSR INCD JMP FC1A OUTLIN JSR PLSXSY LDA #0 STA TRIES OUTLA JSR SRCHLC CMP COLOR1,X BNE OUTLB JSR GRABEM JMP OUTLIN OUTLB LDA TRIES CLC ADC #1 STA TRIES CMP #4 BEQ OUTLD JSR INCD JMP OUTLA OUTLD JSR LOCTXY OUTLD2 CMP COLOR2,X BNE OUTLE JSR FILL LDA #0 STA FILLON RTS OUTLE JSR INCD JSR SRCHLC JMP OUTLD2 SRCHLC LDX TD LDA SX CLC ADC SXD,X STA TX STA PLOTX LDA SY CLC ADC SYD,X STA TY STA PLOTY LOCTXY LDA PLOTX CMP #159 BCS NOREAD LDA PLOTY CMP #85 BCS NOREAD JSR PLOTCL LDY #0 LDA (LO),Y AND BITSON,X RTS NOREAD LDA #0 LDX #0 RTS GRABEM LDA TD STA D LDA TX STA SX LDA TY STA SY RTS INCD LDA TD CLC ADC #1 AND #3 STA TD RTS DECD LDA TD SEC SBC #1 AND #3 STA TD RTS PLSXSY LDA SX STA PLOTX CMP MAXX BCC TMINX2 STA MAXX JMP CKYMM2 TMINX2 CMP MINX BCS CKYMM2 STA MINX CKYMM2 LDA SY STA PLOTY CMP MAXY BCC TMINY2 STA MAXY JMP ENDMM2 TMINY2 CMP MINY BCS ENDMM2 STA MINY ENDMM2 JSR PLOTCL LDY #0 LDA BITOFF,X AND (LO),Y ORA COLOR2,X STA (LO),Y RTS ; ;FILL ROUTINE ; ;AS WITH THE 'SEARCH' SUBROUTINE, THE ;FILL SUBROUTINE IS FAR TOO COMPLEX TO ;EXPLAIN HERE. THIS FILL IS ENTIRELY ;DIFFERENT FROM THE SYSTEM'S FILL ;ROUTINE, AS IT WILL FILL ANY SHAPE ;THAT IS OUTLINED IN COLOR 2. ; FILL LDA #0 ;TURN OFF STA AUDC2 ;SOUND CHANNELS STA AUDC3 ;2 AND 3. LDA MAXY ;INITIALIZE SEC ;THE FILL SBC MINY ;SOUND STA FILFRQ ;FREQUENCY. LDA MINX SEC SBC #1 STA MINX STA FX LDA MINY STA FY SEC SBC #1 STA MINY LDA MAXX CLC ADC #1 STA MAXX LDA MAXY CLC ADC #1 STA MAXY LDA #0 STA SCTALY CLRC2T LDA #0 STA C2TALY LOCLP1 JSR LOCATE CMP #2 BNE LOCLP1 LOCLP2 INC C2TALY JSR LOCATE CMP #2 BEQ LOCLP2 AND #1 BNE CLRC2T LDA C2TALY CMP #1 BEQ FILLIT JSR LOCPRV BEQ CLRC2T FILLIT LDA FX STA PLOTX LDA FY STA PLOTY JSR PLOTCL LDY #0 LDA (LO),Y ORA COLOR3,X STA (LO),Y INC SCTALY JSR LOCATE CMP #0 BEQ FILLIT AND #1 BNE CLRC2T LDA #1 STA C2TALY FOLLOW JSR LOCATE CMP #0 BEQ LOCLP3 AND #1 BNE CLRC2T INC C2TALY JMP FOLLOW LOCLP3 LDA C2TALY CMP #1 BNE LOCLP4 JMP CLRC2T LOCLP4 JSR LOCPRV CMP BITSON,X BEQ FILLIT JMP CLRC2T LOCATE LDA FX CLC ADC #1 STA FX CMP MAXX BNE STOFX LDA CURLO CLC ADC SCTALY STA CURLO LDA CURHI ADC #0 STA CURHI LDA #0 STA SCTALY LDA MINX STA FX LDA #0 STA C2TALY LDA #$86 STA AUDC1 LDA FILFRQ STA AUDF1 BEQ NOFFDC DEC FILFRQ NOFFDC LDA FY CLC ADC #1 STA FY CMP MAXY BEQ FILEND LDA FX CMP MINX BNE STOFX PLA PLA JMP CLRC2T FILEND PLA PLA RTS STOFX LDA FX STA PLOTX LDA FY STA PLOTY JSR PLOTCL LDY #0 LDA BITSON,X AND (LO),Y CMP COLOR2,X BNE NOTC2 LDA BITSON,X ORA (LO),Y STA (LO),Y INC SCTALY LDA #2 RTS NOTC2 CMP COLOR1,X BNE NOTC1 LDA #1 RTS NOTC1 CMP #0 BNE C3 RTS C3 LDA #3 RTS LOCPRV LDA FX STA PLOTX LDA FY SEC SBC #1 CMP MINY BEQ NOLOCP STA PLOTY JSR PLOTCL LDY #0 LDA BITSON,X AND (LO),Y RTS NOLOCP LDA #0 LDX #0 RTS ; ;VBI ROUTINE ; INTRPT LDA KEY ;IS SPACE BAR CMP #$21 ;PRESSED? BNE NOPRES ;NO, CHECK FOR PAUSE. LDA #$FF ;CLEAR OUT STA KEY ;KEY CODE, LDA PAUSE ;COMPLEMENT EOR #$FF ;THE PAUSE STA PAUSE ;FLAG. NOPRES LDA PAUSE ;ARE WE PAUSED? BEQ NOPAUS ;NO! JMP XITVBV ;PAUSED, NO VBI! NOPAUS LDA BSCNT ;MORE BUMP SOUND? BMI NOBS ;NO, PROCESS TIMER. ORA #$A0 ;MIX VOLUME WITH STA AUDC4 ;PURE TONE, LDA #$80 ;SET UP BUMP STA AUDF4 ;SOUND FREQUENCY DEC BSCNT ;AND DECREMENT COUNT. NOBS LDA TIMER ;TIMER DOWN TO ZERO? BEQ NODEC ;YES, DON'T DECREMENT. DEC TIMER ;DECREMENT TIMER. NODEC LDA FILLON ;ARE WE FILLING? BEQ NOFILL ;NO, DO REST OF VBI. JMP XITVBV ;YES, EXIT VBI NOFILL LDA #0 ;CLEAR OUT STA DEADFG ;DEAD FLAG LDA P0PL ;HAS PLAYER 0 AND #$08 ;HIT PLAYER 3? BEQ NOHITP ;NO! INC DEADFG ;YES!!! NOHITP LDA P0PF ;HAS PLAYER 0 AND #$02 ;HIT COLOR 2? BEQ NOHITL ;NO! INC DEADFG ;YES!!! NOHITL STA HITCLR ;CLEAR COLLISION. LDA MOVTIM ;MOVEMENT TIMER ZERO? BEQ NOMDEC ;YES, DON'T DECREMENT. DEC MOVTIM ;DECREMENT TIMER. NOMDEC LDA SMTIM ;STAR MOVE TIMER ZERO? BEQ NMTDEC ;YES, DON'T DECREMENT. DEC SMTIM ;DECREMENT TIMER. NMTDEC LDA STARCT ;STAR ROT. TIMER ZERO? BEQ STAROT ;YES, ROTATE STAR! DEC STARCT ;DECREMENT TIMER JMP VBREST ;AND SKIP ROTATION. STAROT LDA #1 ;SET ROT. TIMER STA STARCT ;TO 1 LDA STRPOS ;INCREMENT CLC ;STAR ROTATION ADC #1 ;COUNTER, CMP #7 ;ALLOW ONLY 0-6. BNE STOSTP ;ROT. COUNT OK LDA #0 ;ZERO ROT. COUNTER. STOSTP STA STRPOS ;SAVE ROT. POS. VBREST LDY STRPOS ;THIS SECTION LDX STRHGT ;DRAWS THE STAR LDA #0 ;IN PLAYER 0 STA PL0-1,X ;MEMORY USING STA PL0+8,X ;THE TABLES LDA STARB1,Y ;'STARB1' THRU STA PL0,X ;'STARB8'. LDA STARB2,Y STA PL0+1,X LDA STARB3,Y STA PL0+2,X LDA STARB4,Y STA PL0+3,X LDA STARB5,Y STA PL0+4,X LDA STARB6,Y STA PL0+5,X LDA STARB7,Y STA PL0+6,X LDA STARB8,Y STA PL0+7,X LDA STRHOR ;SET STAR'S STA HPOSP0 ;HORIZ. POS. LDA SHOOFF ;OK TO SHOW PLAYER? BNE ENDVBI ;NO, EXIT VBI LDA PX ;SET PLAYER'S CLC ;HORIZONTAL ADC #47 ;POSITION STA HPOSP3 LDA PY ;DRAW PLAYER CLC ;IN PLAYER 3 ADC #$10 ;MEMORY TAX LDA #0 STA PL3-3,X STA PL3-2,X STA PL3+2,X STA PL3+3,X LDA #$40 STA PL3-1,X STA PL3+1,X LDA #$A0 STA PL3,X LDA NOCCHG ;COLOR CHANGE OK? BNE ENDVBI ;NO, EXIT VBI INC COLPM3 ;YES, CYCLE THE COLOR. ENDVBI JMP XITVBV ;DONE WITH VBI! ; ;DATA ; DLIST DB $70,$70,$70 DB $4D,DISP&255,DISP/256 DB $D,$D,$D,$D,$D,$D,$D,$D,$D,$D DB $D,$D,$D,$D,$D,$D,$D,$D,$D,$D DB $D,$D,$D,$D,$D,$D,$D,$D,$D,$D DB $D,$D,$D,$D,$D,$D,$D,$D,$D,$D DB $D,$D,$D,$D,$D,$D,$D,$D,$D,$D DB $D,$D,$D,$D,$D,$D,$D,$D,$D,$D DB $D,$D,$D,$D,$D,$D,$D,$D,$D,$D DB $D,$D,$D,$D,$D,$D,$D,$D,$D,$D DB $D,$D,$D,$D,$D,$20,$46 SCDL DW SCOLIN DB $46 DW SCOLN2 DB $41,DLIST&255,DLIST/256 SCOLIN DB CT,CG,CT,CCOL,0,0,0,0,0,0 DB 0,CC,CU,CR,CCOL,0,0,0,0,0 SCOLN2 DB CL,CV,CCOL,0,0,0,CS,CC,CO DB CR,CE,CCOL,0,0,0,0,0,0,0,0 GOMSG DB 0,0,0,0,0,CG,CA,CM,CE,0 DB 0,CO,CV,CE,CR,0,0,0,0,0 ; ;LEVEL TABLES ; TGTLO DB 64,16,224,40,248,212,16,4 DB 248,224,212,224,68,168,112,212 TGTHI DB 31,39,46,35,42,48,39,41,42 DB 46,48,46,47,47,48,48 STARSP DB 4,4,4,3,3,3,2,2,2,2,2,1,1 DB 1,1,1 KILLFG DB 0,0,1,0,1,1,0,1,1,1,1,0,0 DB 1,1,1 ZERO1 DB 0 SCORE DB 0,0,0,0,0,0 SLLOC DB 0 CURLO DB 0 CURHI DB 0 LEVEL DB 0 PAUSE DB 0 HASDRN DB 0 LOWK DB 0 HIWK DB 0 SCTALY DB 0 LIVES DB 0 ; ;STAR PLAYER-MISSILE IMAGES ; STARB1 DB $81,$40,$20,$10,$08,$04,$02 STARB2 DB $42,$43,$20,$10,$08,$04,$C2 STARB3 DB $24,$24,$13,$10,$08,$C8,$24 STARB4 DB $18,$18,$1C,$1F,$F8,$38,$18 STARB5 DB $18,$18,$38,$F8,$1F,$1C,$18 STARB6 DB $24,$24,$C8,$08,$10,$13,$24 STARB7 DB $42,$C2,$04,$08,$10,$20,$43 STARB8 DB $81,$02,$04,$08,$10,$20,$40 STARCT DB 0 STRPOS DB 0 STRHGT DB 0 STRHOR DB 0 STRLX DB 0 STRLY DB 0 TMPDIR DB 0 STRDIR DB 0 STRDTX DB 1,1,0,255,255,255,0,1 STRDTY DB 0,1,1,0,1,255,255,255 STRSPD DB 4 COLOR1 DB $40,$10,$04,$01 COLOR2 DB $80,$20,$08,$02 COLOR3 DB $C0,$30,$0C,$03 BITSON DB $C0,$30,$0C,$03 BITOFF DB $3F,$CF,$F3,$FC BXSTRT DB 0,158,158,0 BYSTRT DB 0,0,84,84 BXINC DB 1,0,255,0 BYINC DB 0,1,0,255 BORCNT DB 159,85,159,85 BORNUM DB 0 BDINCX DB 0 BDINCY DB 0 BDCNT DB 0 PXWC DB 0 PYWC DB 0 SHOOFF DB 0 CKX DB 0 CKY DB 0 INIX DB 0 INIY DB 0 MINX DB 0 MINY DB 0 MAXX DB 0 MAXY DB 0 REX DB 0 REY DB 0 X DB 0 Y DB 0 SX DB 0 SY DB 0 TX DB 0 TY DB 0 FX DB 0 FY DB 0 TD DB 0 D DB 0 BSCNT DB 0 FILFRQ DB 0 TRIES DB 0 FILLON DB 0 C2TALY DB 0 NOCCHG DB 0 DEDBRT DB 0 STKHLD DB 0 RDRCOL DB 0 REDIR DB 0 LGTHY DB 0 TIMES DB 0 CKV DB 0 CKVX DB 0 DRAWFG DB 0 MOVIX DB 0 XD DB 0,0,0,0 DB 0,0,0,1 DB 0,0,0,255 DB 0,0,0,0 YD DB 0,0,0,0 DB 0,0,0,0 DB 0,0,0,0 DB 0,1,255,0 SXD DB 0,1,0,255 SYD DB 255,0,1,0 DECIMAL DB 0,0,0,0,0 ZERO2 DB 0 HIVALS DB 0,0,0,3,39 LOVALS DB 1,10,100,232,16 DIR DS 256 LGTH DS 256 .END
THE A.N.A.L.O.G COMPENDIUM / PAGE 175
If you’ve ever typed in a game program from a computer magazine hoping for an arcade-quality masterpiece, you’ve probably been disappointed. Games written in BASIC are usually too slow to handle the complex graphics and game logic necessary for an entertaining arcade-style game. In an effort to satisfy those avid video-gamers out there, I have written Fill ’Er Up!, a public-domain assembly-language game.
Before tackling the program listings accompanying this article, let’s look at them and see what they do.
Listing 1 is the main data and data checking routine. This listing is used to create both tape and disk versions of Fill ’Er Up. The data that makes up the Fill ’Er Up program listed in hexadecimal (base 16). The program is listed this way so that it will run with 16K cassette systems. I realize that those DATA statements aren’t fun to type in, but they are a necessary evil.
Listing 2 should be added to Listing 1 if you are using an ATARI cassette recorder.
Listing 3 should be added to Listing 1 if you are using a disk drive.
Listing 4 is the assembly-language source code for Fill ’Er Up, created with the ATARI Macro Assembler editor. You DO NOT have to type in this listing to play the game! It is provided so that readers interested in assembly language can see how the program works.
Follow the instructions to make either a cassette or disk version of Fill ’Er Up.
You have been assigned to build a series of water reservoirs in uncharted territory. Unfortunately, an electrified starfish (don’t boggle; read on) is patrolling the area. Using your joystick, you must maneuver yourself around on the screen, building walls to hold the water, while avoiding the starfish.
You start out on the white border surrounding the planned resevoir area. You may move around on these white walls by moving your joystick in the desired direction. You can build a reservoir wall by moving into the black “uncharted” area while pressing your joystick button. The walls you make can be any length, and must be terminated at a white wall. When you finish a wall by hitting a white wall, the area you have enclosed will fill with water. Do NOT run into the wall you are building or you will be destroyed. If the starfish hits you or any part of the wall you are building before you complete it, you will be destroyed. On levels 1,2,4,7,12 and 13 you will be safe from attack when standing on a white wall, but on other levels the starfish can destroy you on contact at any time!
If you do not complete the levels in a certain time period, electrified sea urchins will begin appearing on the white walls, moving along it looking for YOU! These creatures prove fatal on contact, but they can be destroyed by trapping them inside a completed resevoir. The sea urchins have no sense of fair play, and will “gang up” against you whenever possible.
At the bottom of the screen are several information displays. “TGT” indicates the TARGET area you must fill with water before you complete the level. “CUR” indicates the CURRENT area you have filled. Once CUR reaches TGT, you have completed the level and are awarded points. SCORE indicates the number of points you have gained. At the end of each level, the computer will give you 2 points for each unit over the target you have filled. If the TARGET amount is 8000 and you fill 9000 units, you receive 2000 points. “Fill ’Er Up” may be paused at any time by pressing the space bar.
This game contains 16 levels of difficulty. The level number is shown in the lower left corner of the screen.
You have three lives, shown in the lower right corner of the screen. Good luck!
1 REM *** FILL 'ER UP! II *** 10 DATA 0,1,2,3,4,5,6,7,8,9,0,0,0,0,0,0,0,10,11,12,13,14,15 20 DIM DAT$(91),HEX(22):FOR X=0 TO 22: READ N:HEX(X)=N:NEXT X:LINE=990:RESTOR E 1000:TRAP 60:? "CHECKING DATA" 25 LINE=LINE+10:? "LINE:";LINE:READ DA T$:IF LEN(DAT$)<>90 THEN 110 28 DATLIN=PEEK(183)+PEEK(184)*256:IF D ATLIN<>LINE THEN ? "LINE ";LINE;" MISS ING!":END 30 FOR X=1 TO 89 STEP 2:D1=ASC(DAT$(X, X))-48:D2=ASC(DAT$(X+1,X+1))-48:BYTE=H EX(D1)*16+HEX(D2) 35 IF PASS=2 THEN PUT #1,BYTE:NEXT X:R EAD CHKSUM:GOTO 25 40 TOTAL=TOTAL+BYTE:NEXT X:READ CHKSUM :IF TOTAL=CHKSUM THEN 25 50 GOTO 110 60 IF PEEK(195)<>6 THEN 110 100 ? "WRITING FILE":PASS=2:LINE=990:R ESTORE 1000:TRAP 60:GOTO 25 110 ? "BAD DATA: LINE ";LINE:END 1000 DATA A9258581A9148592A90085808591 A000B1809191E680E691D004E681E692A592C9 23D0ECA591C909D0E64C2D14,6169 1010 DATA A9008D2F028D1DD08DC802A9748D C402A9C48DC502A90A8DC602A9348DC702A9F7 8D3002A9208D3102A92E8D2F,11064 1020 DATA 02A9038D1DD04C28192065E4A900 A27F9580CA10FB8D14228D15228D16228D1722 A9118D6F02A9018DAC228DC4,15402 1030 DATA 22202F15A9408D6722A9808D6822 A9D0A2049D19219D2421CA10F7A2059D3521CA 10FAA9008DC42285898DC622,20133 1040 DATA 8D1ED08D2F028D0ED48D2822858A 8D08D2A2059D1D22CA10FA8D2622A9038D2C22 09908D3C21A90A8DC402A924,24483 1050 DATA 8DC502A9948DC602A9C48DC702A9 008DC802A9768DC102A93F8DC2028DC302A934 8DC002A9928D3002A9208D31,29683 1060 DATA 02A00AA21FA906205CE4A9108D07 D4A92E8D2F02A9038D1DD0A9408D0ED44C9615 A900A27F9D80119D00129D80,34142 1070 DATA 129D00139D8013CAD0EE60A5830A 8580A9008581068026810680A58085842681A5 8185850680268106802681A5,38869 1080 DATA 801865848580A58165858581A900 1865808580A93065818581A5822903AAA5824A 4A1865808580A58169008581,43824 1090 DATA 60A2008682A2008683204615A683 A900A02791808810FBE8E056D0EBA9038DA622 AEA622BD92228582BD962285,49247 1100 DATA 83BD9A228DA722BD9E228DA822BD A2228DA922204615BD7E22A00011809180A582 186DA7228582A583186DA822,54123 1110 DATA 8583CEA922D0DFCEA62210BBA950 858BA954858CAD26221869018D2922A9008D14 228D15228D16228D17228D24,58606 1120 DATA 228D25228D2A22A9FF8D23222049 1AADFA2209908D2C21ADF92209908D2D21AE26 22BDA1218D2922BDB1218D2A,62917 1130 DATA 22BDC1218D7D22BDE12185958594 A9048D232220491AA9008DAC22AA9D09239D09 24CAD0F78DD0228DCF22AD27,67913 1140 DATA 22D0FBA9FD8D00D2A9FE8D02D2A9 FF8D04D2A9A38D01D28D03D28D05D2A900854D A58AD023A589F022AE2622BD,74064 1150 DATA D121D017A58B8582A58C85832046 15A000BD8A223180DD7E22F0034CD118A587F0 064C9C1A4C7416A9048587AD,79059 1160 DATA 78028DC822AABDD122187DD12285 8DBDE122187DE122858E058DF0DCA58B18658D 8DAD22C99FB0D0858238FDD1,85004 1170 DATA 228DAA22A58C18658E8DAE22C955 B0BB858338FDE1228DAB22204615A000BD8A22 31808DCD228ECE22ADAA2285,90224 1180 DATA 82ADAB228583204615A000BD8A22 318048AD8402D00668D01E4C641768DD7E22D0 15ADCD22AECE22DD7E22D00A,95090 1190 DATA ADAD22858BADAE22858C4C7416AD CF22D0278DD022ADC8228D0923A9018DCF228D 2822A58B8DAF228DB1228DB3,100339 1200 DATA 22A58C8DB0228DB2228DB422ADCD 22AECE22DD8222D0034CD118AED022ADC822DD 0923F00CEED022E89D0923A9,105890 1210 DATA 009D0924FE0924A9038DA922A58B 8582A58C8583204615A000B1803D8E221D8222 9180CEA922F019ACD022BE09,110621 1220 DATA 23BDD1221865828582BDE1221865 8385834CC517A582858BCDB32290068DB3224C 0918CDB122B0038DB122A583,115711 1230 DATA 858CCDB42290068DB4224C2018CD B222B0038DB222AECE22ADCD22DD7E22F0034C 7416A9008DCF2220F81BAD24,120720 1240 DATA 228D2922AD25228D2A22A90F8D23 2220491AA9018DC92220B219AE2622AD242238 FDA1218D2922AD2522FDB121,124652 1250 DATA 8D2A2210034C5F16AD2622C90FF0 03EE26220E29222E2A22A9FF8D232220491AA2 05A000B9F922187D1D22C90A,128289 1260 DATA 300C38E90A9D1D22FE1C224CA318 9D1D22C8CA10E2A205BD1D2209D09D3521CA10 F5A9018DC4228DAC22202F15,132641 1270 DATA A9408D6722A9808D6822A9008DC4 224C9615A9008D01D28D03D28D05D2A9018DC6 22A90F8DC722A9058588ADC7,137662 1280 DATA 228D01D2AD0AD2291F8D00D2AD0A D229F00DC7228DC5028DC102A588D0E0CEC722 10D7CE2C22AD2C2209908D3C,142752 1290 DATA 21C990D025A93D8DEF20A9218DF0 20AD1FD02901D0F9AD1FD02901F0F9A9158DEF 20A9218DF0204C6314A9018D,148209 1300 DATA AC22AD0AD229FEC99FB0F78582AD 0AD2297EC955B0F78583204615A000BD8A2231 80DD7E22D0DB202F15A58285,153839 1310 DATA 8BA583858CA9008DC922AD2822F0 1C20B219ADAF228582ADB0228583204615A000 BD8E2231801D7E229180A924,158626 1320 DATA 8DC502A9008DC6228D1ED0858985 8A4C5F16ADAF228DB522ADB0228DB622A9008D B722AEB722BD09238DCA22BD,163816 1330 DATA 09248DCB22A9018DB822A9038DCC 22ADB5228582ADB6228583204615A000ADC922 D010BD8E22318091804C0A1A,168465 1340 DATA A9008DCF2260BD8E2231801D7E22 9180CECC22F01AAECA22ADB522187DD1228DB5 22ADB622187DE1228DB6224C,173602 1350 DATA DC19EEB822ADB822CDCB22F002B0 034CD719EEB722ADB722CDD022F002B0B44CC3 19A204A9009DF922CA10FAA2,179464 1360 DATA 04AD2A22DDFF22F004B0109008AD 2922DD0423B006CA10E94C881AAD292238FD04 238D2922AD2A22FDFF228D2A,183980 1370 DATA 22FEF9224C551AA204AC2322300C BDF92209D0991521C8CA10F460A586F0034C9F 1BAD7D228586AD672238E90D,188874 1380 DATA 8D6A22AD682238E92C8D6922AD0A D2C9F09008AD0AD229074CCC1AAD6C22AA8D6B 22AD6922187D6D228582AD6A,193725 1390 DATA 22187D75228583204615A000BD8A 223180F007A90F8DC122D0CCA58218692C8D68 22A58318690D8D6722AD6B22,198132 1400 DATA 8D6C22A9038596A696BD1422F020 BD0C228582BD10228583204615A000BD8A2231 80DD7E22F00EA696A9009D14,202820 1410 DATA 22C69610D54C9F1BA9038DC322A6 96BD18228597A696A497BD0C2218790422C99F B01E8582BD102218790822C9,207587 1420 DATA 55B0118583204615A000BD8A2231 80DD7E22F015CEC32230B4AEC322A597187D01 22290385974C491BA696A582,212273 1430 DATA 9D0C22A5839D1022A5979D18224C 361BA594F0034C7416A5958594A203BD1422F0 06CA10F84C74168698AD0AD2,217045 1440 DATA C9A0B0F98582AD0AD2297FC955B0 F78583204615A000BD8A223180DD7E22D0DDA6 98A5829D0C22A5839D1022AD,222751 1450 DATA 0AD229039D1822A9019D14224C74 16A9018DC422A9008DC022AD682238E92C8DB9 22AD672238E90D8DBA22AEC0,227245 1460 DATA 22ADB922187DF1228DB9228582AD BA22187DF5228DBA228583204615A000B1803D 8A22DD7E22F00DDD8222D0D1,232421 1470 DATA A9008DBF224C731CADC0228DBF22 20521D20FC1CDD7E22D00620331D4C4B1CDD82 22D00620331D4CB91C20461D,236412 1480 DATA 4C541CA9008DC32220521D20FC1C DD8222D00620331D4C731CADC3221869018DC3 22C903F00620461D4C7B1CAD,240407 1490 DATA C0228DBF2220521D20FC1CDD7E22 D00620331D4C4B1C20461D4CA51C205E1DA900 8DC32220FC1CDD7E22D00620,244373 1500 DATA 331D4CB91CADC3221869018DC322 C904F00620461D4CC11C20171DDD8222D00920 9E1DA9008DC4226020461D20,248227 1510 DATA FC1C4CE51CAEBF22ADB922187DF1 228DBB228582ADBA22187DF5228DBC228583A5 82C99FB011A583C955B00B20,253777 1520 DATA 4615A000B1803D8A2260A900A200 60ADBF228DC022ADBB228DB922ADBC228DBA22 60ADBF2218690129038DBF22,258398 1530 DATA 60ADBF2238E90129038DBF2260AD B9228582CDB32290068DB3224C761DCDB122B0 038DB122ADBA228583CDB422,263511 1540 DATA 90068DB4224C8E1DCDB222B0038D B222204615A000BD8E2231801D8222918060A9 008D03D28D05D2ADB42238ED,268158 1550 DATA B2228DC222ADB12238E9018DB122 8DBD22ADB2228DBE2238E9018DB222ADB32218 69018DB322ADB4221869018D,273050 1560 DATA B422A9008D2B22A9008DC5222054 1EC902D0F9EEC52220541EC902F0F62901D0E6 ADC522C901F00520E81EF0DA,278385 1570 DATA ADBD228582ADBE228583204615A0 00B1801D86229180EE2B2220541EC900F0E029 01D0B6A9018DC52220541EC9,283210 1580 DATA 00F00A2901D0A6EEC5224C2E1EAD C522C901D0034CDF1D20E81EDD8A22F0B44CDF 1DADBD221869018DBD22CDB3,288351 1590 DATA 22D050AD2422186D2B228D2422AD 252269008D2522A9008D2B22ADB1228DBD22A9 008DC522A9868D01D2ADC222,292630 1600 DATA 8D00D2F003CEC222ADBE22186901 8DBE22CDB422F00DADBD22CDB122D00868684C DF1D686860ADBD228582ADBE,298112 1610 DATA 228583204615A000BD8A223180DD 8222D00DBD8A2211809180EE2B22A90260DD7E 22D003A90160C900D00160A9,302731 1620 DATA 0360ADBD228582ADBE2238E901CD B222F00D8583204615A000BD8A22318060A900 A20060ADFC02C921D00DA9FF,307760 1630 DATA 8DFC02AD272249FF8D2722AD2722 F0034C5FE4ADC122300D09A08D07D2A9808D06 D2CEC122A588F002C688A594,313096 1640 DATA F006C693D002C694ADC422F0034C 5FE4A9008589858AAD0DD0290CF002E68AAD0D D02901F002E689AD04D02902,318528 1650 DATA F002E6898D1ED0A587F002C687A5 86F002C686AD6522F006CE65224C9F1FA9018D 6522AD6622186901C907D002,323728 1660 DATA A9008D6622AC6622AE6722A9009D FF119D0812B92D229D0012B934229D0112B93B 229D0212B942229D0312B949,327636 1670 DATA 229D0412B950229D0512B957229D 0612B95E229D0712AD68228D00D0ADAC22D031 A58B18692F8D01D0A58C1869,331870 1680 DATA 10AAA9009D7D129D7E129D82129D 8312A9409D7F129D8112A9A09D8012ADC622D0 03EEC102E690A5904A2901A8,336924 1690 DATA B9FF21859AA5902901A8A9138592 A9808591A901858FB9F1218599A900A68FBCF3 21A2049191C8CA10FAA699BD,343010 1700 DATA 1422F027BD0C22BC102218692EA6 8F9D02D09818690E9DF321A8A69AA904859BBD F5219191C8CAC69B10F5C68F,348458 1710 DATA 3012A59138E9808591A592E90085 92E6994C3C204C5FE47070704D00300D0D0D0D 0D0D0D0D0D0D0D0D0D0D0D0D,351971 1720 DATA 0D0D0D0D0D0D0D0D0D0D0D0D0D0D 0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D 0D0D0D0D0D0D0D0D0D0D0D0D,352556 1730 DATA 0D0D0D0D0D0D0D0D0D0D0D0D0D0D 0D0D0D0D0D0D0D0D0D0D204615214629214192 207070707070707070703046,354537 1740 DATA 5121704765213046792170703046 8D2141F7203427341A00000000000000233532 1A00000000002C361A000000,356557 1750 DATA 33232F32251A0000000000000000 000000000027212D2500002F36253200000000 000000212E212C2F2700232F,357469 1760 DATA 2D303534292E2700000000006669 6C6C47657200757041006969000000000000A2 B90000B4AFAD00A8B5A4B3AF,360748 1770 DATA AE00000000000000F0F2E5F3F300 00F3F4E1F2F4000000004010E028F8D41004F8 E0D4E044A870D41F272E232A,365802 1780 DATA 3027292A2E302E2F2F3030040404 03030302020202020101010101000001000101 000101010100000101010707,366362 1790 DATA 0706060605050504040403030201 0002000088502050882020F820200409FF0201 000100FFFF00010000000000,368048 1800 DATA 0000000000000000000000000000 00000000000000000000000000000081402010 080402424320100804C22424,368762 1810 DATA 131008C82418181C1FF838181818 38F81F1C182424C80810132442C20408102043 810204081020400000000000,370904 1820 DATA 000000010100FFFFFF0001000101 0001FFFFFF044010040180200802C0300C03C0 300C033FCFF3FC009E9E0000,374290 1830 DATA 0054540100FF00000100FF9F559F 55000000000000000000000000000000000000 000000000000000000000000,375458 1840 DATA 0000000000000000000000000000 00000000000001000000FF0000000000000000 00000000000000000001FF00,375970 1850 DATA 000100FFFF000100000000000000 0000000327010A64E810000000000000000000 000000000000000000000000,376883
1 DATA 338,955,686,427,745,192,617,894,445,496,549,150,852,324,104,7774 1030 DATA 121,368,374,344,911,909,145, 258,276,448,489,547,207,532,414,6343 1180 DATA 279,391,340,36,11,311,87,57, 219,152,322,325,387,110,337,3364 1330 DATA 73,335,409,357,275,510,28,43 ,154,25,103,247,143,113,166,2981 1480 DATA 95,140,70,465,277,253,135,23 3,149,39,562,34,388,935,96,3811 1630 DATA 300,427,177,66,202,175,222,3 33,51,439,886,208,233,664,863,5246 1780 DATA 80,295,856,546,765,47,848,8, 3445
2 REM *** CASSETTE VERSION *** 65 IF PASS=2 THEN CLOSE #1:END 70 ? "READY CASSETTE AND PRESS RETURN";:OPEN #1,8,128,"C:":RESTORE 200:FOR X =1 TO 35:READ N:PUT #1,N:NEXT X 200 DATA 0,31,221,19,255,19,169,60,141 ,2,211,169,0,141,231,2,133,14,169,56,1 41,232,2,133,15,169,45 210 DATA 133,10,169,20,133,11,24,96 1860 DATA 0000000000000000000000000000 00000000000000000000000000000000000000 000000000000000000000000,376883 1870 DATA 0000000000000000000000000000 00000000000000000000000000000000000000 000000000000000000000000,376883
2 REM *** DISK VERSION *** 65 IF PASS=2 THEN PUT #1,224:PUT #1,2:PUT #1,225:PUT #1,2:PUT #1,0:PUT #1,37 :CLOSE #1:END 70 ? "INSERT DISK WITH DOS, PRESS RETU RN";:DIM IN$(1):INPUT IN$:OPEN #1,8,0, "D:AUTORUN.SYS" 90 PUT #1,255:PUT #1,255:PUT #1,0:PUT #1,37:PUT #1,29:PUT #1,52
; ;FILL 'ER UP! II ; ;BY TOM HUDSON ; ; ;ALPHABETIC CONSTANTS ; CA = 'A'-$20 CB = 'B'-$20 CC = 'C'-$20 CD = 'D'-$20 CE = 'E'-$20 CF = 'F'-$20 CG = 'G'-$20 CH = 'H'-$20 CI = 'I'-$20 CJ = 'J'-$20 CK = 'K'-$20 CL = 'L'-$20 CM = 'M'-$20 CN = 'N'-$20 CO = 'O'-$20 CP = 'P'-$20 CQ = 'Q'-$20 CR = 'R'-$20 CS = 'S'-$20 CT = 'T'-$20 CU = 'U'-$20 CV = 'V'-$20 CW = 'W'-$20 CX = 'X'-$20 CY = 'Y'-$20 CZ = 'Z'-$20 CCOL = ':'-$20 ; ;PAGE ZERO ITEMS ; ORG $80 LO DS 1 HI DS 1 PLOTX DS 1 PLOTY DS 1 LOHLD DS 1 HIHLD DS 1 SMTIM DS 1 MOVTIM DS 1 TIMER DS 1 DEADFG DS 1 HSHORT DS 1 PX DS 1 PY DS 1 XI DS 1 YI DS 1 DESTNM DS 1 SHFLIP DS 1 DESTLO DS 1 DESTHI DS 1 SHTIM1 DS 1 SHTIM2 DS 1 SHTIMI DS 1 SHORTN DS 1 DIRSAV DS 1 HOLDSX DS 1 VBXHLD DS 1 CPYST DS 1 CPYCNT DS 1 ; ;MISCELLANEOUS MEMORY USAGE ; PMAREA = $1000 MISSLS = PMAREA+384 PL0 = PMAREA+512 PL1 = PMAREA+640 PL2 = PMAREA+768 PL3 = PMAREA+896 DISP = $3000 ; ;SYSTEM EQUATES ; KEY = $2FC CONSOL = $D01F PMBASE = $D407 RANDOM = $D20A SETVBV = $E45C XITVBV = $E45F COLBK = $2C8 COLPF0 = $2C4 COLPF1 = $2C5 COLPF2 = $2C6 COLPF3 = $2C7 AUDC1 = $D201 AUDC2 = $D203 AUDC3 = $D205 AUDC4 = $D207 AUDF1 = $D200 AUDF2 = $D202 AUDF3 = $D204 AUDF4 = $D206 AUDCTL = $D208 PRIOR = $026F ATTRAC = $4D DMACTL = $22F DLISTL = $230 GRACTL = $D01D NMIEN = $D40E COLPM0 = $2C0 COLPM1 = $2C1 COLPM2 = $2C2 COLPM3 = $2C3 HPOSP0 = $D000 HPOSP1 = $D001 HPOSP2 = $D002 HITCLR = $D01E P0PF = $D004 P1PL = $D00D STICK = $278 STRIG = $284 ORG $6000 ;ASSEMBLE ADDR. LOC $1400 ;ACTUAL ADDRESS ; ;RELOCATE PROGRAM (DISK VERSION ONLY) ; MOVEPG LDA #$25 ;FOR DISK ONLY, STA HI ;THIS SECTION LDA #$14 ;MOVES THE STA DESTHI ;PROGRAM TO LDA #0 ;ITS OPERATIONAL STA LO ;MEMORY LOCATION STA DESTLO ;OF $1400. LDY #0 COPYLP LDA (LO),Y STA (DESTLO),Y INC LO INC DESTLO BNE INCEND INC HI INC DESTHI INCEND LDA DESTHI CMP #DIR/256 BNE COPYLP LDA DESTLO CMP #DIR&255 BNE COPYLP JMP FILLUP ; ;MAIN PROGRAM STARTS HERE ; FILLUP LDA #$00 ;TURN OFF... STA DMACTL ;DMA STA GRACTL ;GRAPHICS STA COLBK ;BLACK BACKGND LDA #$74 ;BLUE STA COLPF0 ;COLOR0 LDA #$C4 ;GREEN STA COLPF1 ;COLOR1 LDA #$0A ;WHITE STA COLPF2 ;COLOR2 LDA #$34 ;RED STA COLPF3 ;COLOR3 LDA #TITLDL&255 ;SETUP... STA DLISTL ;TITLE... LDA #TITLDL/256 ;DISPLAY... STA DLISTL+1 ;LIST! LDA #$2E ;TURN ON... STA DMACTL ;DMA LDA #3 ;TURN ON... STA GRACTL ;GRAPHICS JMP CKSTRT ;WAIT FOR START START JSR $E465 ;INIT SOUNDS LDA #0 ;CLEAR OUT LDX #127 ;ALL ZERO PAGE CLPG0 STA $80,X ;USER MEMORY DEX BPL CLPG0 STA SHORTF ;STOP SHORTS STA SHORTF+1 STA SHORTF+2 STA SHORTF+3 LDA #$11 ;P/M PRIORITY STA PRIOR LDA #1 ;DON'T SHOW STA SHOOFF ;PLAYER OR STAR STA FILLON ;WE STILL MUST JSR PMCLR ;CLEAR P/M AREA LDA #64 ;AND SET UP THE STA STRHGT ;STAR'S HEIGHT LDA #128 ;AND STA STRHOR ;HORIZONTAL POSITION LDA #$D0 ;NOW LET'S LDX #4 ;ZERO OUT ZSCLP STA SCOLIN+4,X ;THE SCORE STA SCOLIN+15,X ;AREAS! DEX BPL ZSCLP LDX #5 ZSCLP2 STA SCOLN2+12,X DEX BPL ZSCLP2 LDA #0 ;THESE ITEMS STA FILLON ;MUST BE SET STA DEADFG ;TO ZERO ON STA NOCCHG ;STARTUP OR STA HITCLR ;ELSE WE'LL STA DMACTL ;WIND UP WITH STA NMIEN ;NASTY THINGS STA HASDRN ;HAPPENING! STA HSHORT STA AUDCTL LDX #5 ;LET'S ZERO CMSLP STA SCORE,X ;OUT THE SCORE DEX ;COUNTER... BPL CMSLP STA LEVEL ;AND LEVEL #! LDA #3 ;WE START WITH STA LIVES ;3 LIVES ORA #$90 ;AND PUT THEM IN STA SCOLN2+19 ;THE SCORE LINE LDA #$0A ;NEXT WE SET UP STA COLPF0 ;THE COLORS WE LDA #$24 ;WANT TO USE. STA COLPF1 LDA #$94 STA COLPF2 LDA #$C4 STA COLPF3 LDA #0 STA COLBK LDA #$76 STA COLPM1 LDA #$3F STA COLPM2 STA COLPM3 LDA #$34 STA COLPM0 LDA #DLIST&255 ;WE'D BETTER TELL STA DLISTL ;THE COMPUTER WHERE LDA #DLIST/256 ;OUR DISPLAY LIST STA DLISTL+1 ;IS LOCATED! LDY #INTRPT&255 ;TELL WHERE THE LDX #INTRPT/256 ;VERTICAL BLANK LDA #6 ;INTERRUPT IS JSR SETVBV ;AND SET IT! LDA #PMAREA/256 ;HERE'S OUR P/M STA PMBASE ;GRAPHICS AREA! LDA #$2E ;TURN ON THE STA DMACTL ;DMA CONTROL LDA #$3 ;AND STA GRACTL ;GRAPHICS CONTROL! LDA #$40 ;ENABLE VBI STA NMIEN JMP CLRDSP PMCLR LDA #0 ;CLEAR OUT LDX #127 ;THE P/M AREA: PMICLR STA MISSLS,X ;MISSILES, STA PL0,X ;PLAYER 0, STA PL1,X ;PLAYER 1, STA PL2,X ;PLAYER 2, STA PL3,X ;AND PLAYER 3! DEX BNE PMICLR ;LOOP UNTIL DONE RETURN RTS ;WE'RE DONE! ; ;PLOT ADDRESS CALCULATOR ; ;MULTIPLY PLOTY BY 40, THEN CALCULATE ADDRESS ;OF THE SCREEN MEMORY TO BE ALTERED. ; PLOTCL LDA PLOTY ASL A STA LO LDA #0 STA HI ;*2 ASL LO ROL HI ;*4 ASL LO LDA LO STA LOHLD ROL HI ;*8 LDA HI STA HIHLD ASL LO ROL HI ;*16 ASL LO ROL HI ;*32 LDA LO CLC ADC LOHLD STA LO LDA HI ADC HIHLD STA HI ;+*8=*40 LDA #DISP&255 CLC ADC LO STA LO LDA #DISP/256 ADC HI STA HI ;+DISPLAY START LDA PLOTX ;MASK X POSITION AND #3 TAX LDA PLOTX LSR A LSR A CLC ADC LO STA LO LDA HI ADC #0 ;LO & HI NOW HOLD STA HI ;THE ADDRESS! RTS ;EXIT! ; ;CLEAR THE DISPLAY MEMORY ; CLRDSP LDX #0 ;THIS ROUTINE WILL STX PLOTX ;CLEAR THE SCREEN RAM. LDX #0 ;IT GETS THE ADDRESS DLOOP2 STX PLOTY ;OF THE BEGINNING OF JSR PLOTCL ;EACH GR.7 LINE LDX PLOTY ;THEN ZEROES OUT LDA #$00 ;EACH OF THE LDY #39 ;40 BYTES (0-39) DLOOP3 STA (LO),Y ;IN THE LINE. DEY BPL DLOOP3 INX CPX #86 BNE DLOOP2 ; ;DRAW THE COLOR 1 BORDER ; LDA #3 ;THIS ROUTINE STA BORNUM ;DRAWS THE 4 LINES BORDER LDX BORNUM ;THAT MAKE UP THE LDA BXSTRT,X ;WHITE GR.7 BORDER STA PLOTX ;ON THE SCREEN. LDA BYSTRT,X STA PLOTY LDA BXINC,X STA BDINCX LDA BYINC,X STA BDINCY LDA BORCNT,X STA BDCNT DRAWLN JSR PLOTCL LDA COLOR1,X LDY #0 ORA (LO),Y STA (LO),Y LDA PLOTX CLC ADC BDINCX STA PLOTX LDA PLOTY CLC ADC BDINCY STA PLOTY DEC BDCNT BNE DRAWLN DEC BORNUM BPL BORDER ; ;THIS SECTION STARTS OFF EACH LEVEL ; LDA #80 ;POSITION THE STA PX ;PLAYER LDA #84 STA PY LDA LEVEL ;INCREMENT THE CLC ;LEVEL NUMBER ADC #1 STA LOWK LDA #0 ;ZERO OUT STA SHORTF STA SHORTF+1 STA SHORTF+2 STA SHORTF+3 STA CURLO ;CURRENT TALLY STA CURHI ;WORK AREA STA HIWK LDA #$FF ;TELL DECIMAL CONVERTER STA SLLOC ;NOT TO PLACE RESULT JSR CNVDEC ;CONVERT LEVEL # LDA DECIMAL+1 ;GET DECIMAL LEVEL # ORA #$90 ;ADD COLOR STA SCOLN2+3 ;PUT IN SCORE LINE LDA DECIMAL ;SAME FOR 2ND ORA #$90 ;LEVEL # STA SCOLN2+4 ;DIGIT LDX LEVEL ;GET THIS LEVEL'S LDA TGTLO,X ;PARAMETERS STA LOWK LDA TGTHI,X STA HIWK LDA STARSP,X STA STRSPD LDA SHTIME,X STA SHTIMI STA SHTIM2 LDA #4 STA SLLOC JSR CNVDEC ;SHOW TARGET AMOUNT ; ;CLEAR OUT THE TRACKING TABLE THAT ;REMEMBERS WHERE THE PLAYER MOVED ; CLRTRK LDA #0 STA SHOOFF TAX CLRTLP STA DIR,X ;CLEAR DIRECTION STA LGTH,X ;AND LENGTH ENTRIES DEX BNE CLRTLP STA MOVIX ;CLEAR MOVEMENT INDEX STA DRAWFG ;AND DRAW FLAG GETSTK LDA PAUSE ;GAME PAUSED? BNE GETSTK ;YES, LOOP AND WAIT. LDA #$FD ;DO 'WARBLE' SOUND STA AUDF1 ;USING SOUND LDA #$FE ;CHANNELS 1-3 STA AUDF2 LDA #$FF STA AUDF3 LDA #$A3 STA AUDC1 STA AUDC2 STA AUDC3 LDA #0 ;NO ATTRACT MODE! STA ATTRAC LDA HSHORT ;DID SHORT HIT US? BNE JCRSH ;YES! WE'RE DEAD! LDA DEADFG ;DID STAR HIT US? BEQ ALIVE ;NO! LDX LEVEL ;IT HIT US-- LDA KILLFG,X ;UNCONDITIONAL KILL? BNE JCRSH ;YES! WE'RE DEAD!!! LDA PX ;NO, IF WE'RE ON A STA PLOTX ;WHITE LINE (COLOR 1) LDA PY ;THEN WE'RE ALIVE! STA PLOTY JSR PLOTCL LDY #0 LDA BITSON,X AND (LO),Y CMP COLOR1,X ;ON COLOR 1? BEQ ALIVE ;YES (WHEW!) JCRSH JMP CRASH ;GO KILL PLAYER. ALIVE LDA MOVTIM ;PLAYER MOVING? BEQ GOTSTK ;YES--GET STICK. JMP MOVSTR ;NO, MOVE STAR. JGSTK JMP GETSTK ;GO GET STICK GOTSTK LDA #4 ;SET UP THE STA MOVTIM ;MOVEMENT TIMER LDA STICK ;GET THE STICK STA STKHLD ;AND SAVE IT TAX ;THEN LOOK UP LDA XD,X ;X DIRECTION CLC ADC XD,X STA XI ;AND LDA YD,X ;Y DIRECTION CLC ADC YD,X STA YI ORA XI ;ANY MOVEMENT? BEQ JGSTK ;NO, TRY AGAIN. LDA PX ;INCREMENT CLC ;PLAYER X ADC XI ;POSITION AND STA CKX ;HOLD IT... CMP #159 ;OFFSCREEN? BCS JGSTK ;YES! STA PLOTX ;NO, SAVE IT SEC SBC XD,X STA PXWC LDA PY ;INCREMENT CLC ;PLAYER Y ADC YI ;POSITION AND STA CKY ;HOLD IT... CMP #85 ;OFFSCREEN? BCS JGSTK ;YES! STA PLOTY ;NO, SAVE IT SEC SBC YD,X STA PYWC JSR PLOTCL ;LOCATE NEW PLAYER LDY #0 ;POSITION. LDA BITSON,X AND (LO),Y STA CKV ;SAVE THE 'LOCATE'. STX CKVX LDA PXWC ;CHECK THE STA PLOTX ;POSITION NEXT LDA PYWC ;TO THE ONE WE'RE STA PLOTY ;NOW IN... JSR PLOTCL LDY #0 LDA BITSON,X AND (LO),Y PHA ;AND SAVE IT! LDA STRIG ;TRIGGER PRESSED? BNE NOTDRN ;NO! PLA ;OK TO DRAW? BNE JGS ;NO!! JMP DRAWIN ;YES, GO DRAW. NOTDRN PLA ;NOT DRAWING--ARE WE CMP COLOR1,X ;ON COLOR 1? BNE JGS ;NO, TRY AGAIN LDA CKV ;ARE WE MOVING LDX CKVX ;ONTO ANOTHER CMP COLOR1,X ;COLOR 1? BNE JGS ;NO! TRY AGAIN. LDA CKX ;ALL'S WELL... STA PX ;UPDATE PX LDA CKY ;AND STA PY ;PY, JGS JMP GETSTK ;GET STICK. ; ;THIS ROUTINE HANDLES THE DRAW FUNCTION. ; DRAWIN LDA DRAWFG ;ALREADY DRAWING? BNE DRAWOK ;YES! STA MOVIX ;NO, THIS IS THE LDA STKHLD ;FIRST TIME--SET UP STA DIR ;INITIAL DRAWING LDA #1 ;VARIABLES. STA DRAWFG STA HASDRN LDA PX STA INIX STA MINX STA MAXX LDA PY STA INIY STA MINY STA MAXY DRAWOK LDA CKV ;DID WE LDX CKVX ;RUN INTO ANOTHER CMP COLOR2,X ;COLOR 2? BNE NOCRSH ;NO, WE'RE OK. JMP CRASH ;CRRAAASSSHHH! NOCRSH LDX MOVIX ;UPDATE THE LDA STKHLD ;TRACKING CMP DIR,X ;TABLES WITH BEQ SAMDIR ;DIRECTION INC MOVIX ;INFORMATION. INX STA DIR,X LDA #0 STA LGTH,X SAMDIR INC LGTH,X LDA #3 STA BDCNT LDA PX ;NOW PLOT THE STA PLOTX ;LINE WE'RE LDA PY ;DRAWING... STA PLOTY CCLOOP JSR PLOTCL LDY #0 LDA (LO),Y AND BITOFF,X ORA COLOR2,X ;IN COLOR 2. STA (LO),Y DEC BDCNT BEQ CKCOLR LDY MOVIX LDX DIR,Y LDA XD,X CLC ADC PLOTX STA PLOTX LDA YD,X CLC ADC PLOTY STA PLOTY JMP CCLOOP CKCOLR LDA PLOTX ;UPDATE X POS. STA PX CMP MAXX ;CHECK MINIMUM BCC TMINX ;AND MAXIMUM STA MAXX ;X & Y VALUES JMP CHKYMM ;AND UPDATE IF TMINX CMP MINX ;NECESSARY BCS CHKYMM STA MINX CHKYMM LDA PLOTY STA PY CMP MAXY BCC TMINY STA MAXY JMP ENDMM TMINY CMP MINY BCS ENDMM STA MINY ENDMM LDX CKVX ;DID WE DRAW LDA CKV ;INTO CMP COLOR1,X ;COLOR 1? BEQ ENDLIN ;YES! END OF LINE! JMP GETSTK ;NO, GO GET STICK. ENDLIN LDA #0 ;WE AREN'T STA DRAWFG ;DRAWING ANYMORE JSR SEARCH ;SEARCH AND FILL!! LDA CURLO ;GET CURRENT VALUE STA LOWK LDA CURHI STA HIWK LDA #15 ;PUT AT 15TH STA SLLOC ;POS. IN SCOLIN JSR CNVDEC ;CONVERT TO DECIMAL LDA #1 ;NOW REDRAW THE STA RDRCOL ;PLAYER'S PATH IN JSR REDRAW ;COLOR 1 (WHITE). LDX LEVEL ;CHECK TO SEE LDA CURLO ;IF WE'VE HIT SEC ;THE TARGET. SBC TGTLO,X STA LOWK LDA CURHI SBC TGTHI,X STA HIWK ;HIT TARGET? BPL NEWLVL ;YES--NEW LEVEL! JMP CLRTRK ;NO, GO CLEAR TRACK NEWLVL LDA LEVEL ;IF LEVEL < 15 CMP #15 ;THEN BEQ NOLINC ;INCREMENT INC LEVEL ;LEVEL ; ;INCREASE SCORE HERE ; NOLINC ASL LOWK ;SCORE INC = ROL HIWK ;TGT-CUR * 2 LDA #$FF ;DON'T PLACE STA SLLOC ;THE RESULT! JSR CNVDEC ;CONVERT TO DECIMAL LDX #5 ;AND ADD TO SCORE LDY #0 SCOLP LDA DECIMAL,Y CLC ADC SCORE,X CMP #10 BMI NOCARY SEC SBC #10 STA SCORE,X INC SCORE-1,X JMP NXSPOS NOCARY STA SCORE,X NXSPOS INY DEX BPL SCOLP LDX #5 ;NOW PLACE THE SHSLP LDA SCORE,X ;SCORE IN ORA #$D0 ;SCORE LINE #2 STA SCOLN2+12,X DEX BPL SHSLP LDA #1 ;STOP VBI FOR STA FILLON ;A MOMENT STA SHOOFF JSR PMCLR ;CLEAR P/M AREA LDA #64 ;INITIALIZE STA STRHGT ;THE LDA #128 ;STAR STA STRHOR ;POSITION LDA #0 ;VBI ON AGAIN STA FILLON JMP CLRDSP ;GO CLEAR DISPLAY! ; ;THIS SECTION HANDLES PLAYER'S DEATH ; CRASH LDA #0 ;NO WARBLE SOUND STA AUDC1 STA AUDC2 STA AUDC3 LDA #1 ;NO PLAYER COLOR STA NOCCHG ;CHANGE IN VBI LDA #15 ;SET BRIGHTNESS OF STA DEDBRT ;PLAYER DEATH. TIMRST LDA #5 ;SET DEATH TIMER STA TIMER ;TO 5 JIFFIES. DEADCC LDA DEDBRT ;MOVE BRIGHTNESS STA AUDC1 ;TO DEATH SOUND VOLUME LDA RANDOM ;GET RANDOM AND #$1F ;DEATH SOUND STA AUDF1 ;FREQUENCY LDA RANDOM ;GET RANDOM AND #$F0 ;DEATH COLOR ORA DEDBRT ;ADD BRITE STA COLPF1 ;PUT IN LINE COLOR STA COLPM1 ;AND PLAYER COLOR LDA TIMER ;TIMER DONE YET? BNE DEADCC ;NO, GO CHANGE COLOR. DEC DEDBRT ;DECREMENT BRIGHTNESS BPL TIMRST ;IF MORE, GO DO IT. DEC LIVES ;1 LESS LIFE LDA LIVES ;GET # LIVES ORA #$90 ;ADD COLOR STA SCOLN2+19 ;AND DISPLAY! CMP #$90 ;ZERO LIVES? BNE NOTDED ;NO! LDA #GOMSG&255 ;WE'RE COMPLETELY STA SCDL ;DEAD, SHOW LDA #GOMSG/256 ;'GAME OVER' STA SCDL+1 ;MESSAGE CKSTRT LDA CONSOL ;WAIT FOR START AND #1 ;KEY... BNE CKSTRT ;NOT PRESSED--LOOP. RELEAS LDA CONSOL ;KEY PRESSED, NOW AND #1 ;WAIT FOR RELEASE! BEQ RELEAS ;NOT RELEASED YET! LDA #SCOLIN&255 ;PUT SCORE STA SCDL ;LINE BACK LDA #SCOLIN/256 ;IN DISPLAY STA SCDL+1 ;LIST... JMP START ;AND START GAME! ; ;THIS SECTION PLACES PLAYER AT A RANDOM ;LOCATION IF THERE ARE MORE LIVES LEFT. ; NOTDED LDA #1 ;DON'T SHOW STA SHOOFF ;PLAYER NEWLOC LDA RANDOM ;GET RANDOM X AND #$FE ;MUST BE EVEN CMP #159 ;AND ON SCREEN BCS NEWLOC STA PLOTX CSHY LDA RANDOM ;GET RANDOM Y AND #$7E ;MUST BE EVEN CMP #85 ;AND ON SCREEN BCS CSHY STA PLOTY JSR PLOTCL LDY #0 LDA BITSON,X AND (LO),Y ;IS LOCATION ON CMP COLOR1,X ;COLOR 1? BNE NEWLOC ;NO, TRY AGAIN. JSR PMCLR ;IT'S OK, CLEAR P/M LDA PLOTX ;SAVE STA PX ;THE PLAYER'S LDA PLOTY ;NEW STA PY ;COORDINATES. LDA #0 ;REDRAW THE STA RDRCOL ;PLAYER'S TRACK LDA HASDRN ;IN COLOR 0 BEQ JCTRK JSR REDRAW LDA INIX ;THIS PART IS STA PLOTX ;NEEDED TO PLOT LDA INIY ;A COLOR 1 BLOCK STA PLOTY ;AT THE START OF JSR PLOTCL ;THE PLAYER'S TRACK LDY #0 ;AFTER IT IS ERASED. LDA BITOFF,X ;(NOBODY'S PERFECT!) AND (LO),Y ORA COLOR1,X STA (LO),Y JCTRK LDA #$24 ;RESTORE DRAW LINE STA COLPF1 ;COLOR LDA #0 STA NOCCHG STA HITCLR STA DEADFG STA HSHORT JMP CLRTRK ;AND GO START NEW TRACK. ; ;THIS ROUTINE USES THE TRACKING TABLES, ;DIR AND LGTH, TO REDRAW THE LINE THE ;PLAYER DREW. RDRCOL INDICATES THE COLOR ;DESIRED. ; REDRAW LDA INIX STA REX LDA INIY STA REY LDA #0 STA X REDXLP LDX X LDA DIR,X STA REDIR LDA LGTH,X STA LGTHY LDA #1 STA Y REDYLP LDA #3 STA TIMES TIMES3 LDA REX STA PLOTX LDA REY STA PLOTY JSR PLOTCL LDY #0 LDA RDRCOL BNE RDC1 LDA BITOFF,X AND (LO),Y STA (LO),Y JMP SETNRP ENDRD LDA #0 STA DRAWFG RTS RDC1 LDA BITOFF,X AND (LO),Y ORA COLOR1,X STA (LO),Y SETNRP DEC TIMES BEQ NXTY LDX REDIR LDA REX CLC ADC XD,X STA REX LDA REY CLC ADC YD,X STA REY JMP TIMES3 NXTY INC Y LDA Y CMP LGTHY BEQ JNRD BCS NXTX JNRD JMP REDYLP NXTX INC X LDA X CMP MOVIX BEQ JRXLP BCS ENDRD JRXLP JMP REDXLP ; ;2-BYTE DECIMAL CONVERTER. CONVERTS ;A 2-BYTE BINARY NUMBER TO A 5-BYTE ;DECIMAL NUMBER. WILL PLACE THE ;DECIMAL NUMBER IN SCOLIN IF DESIRED ;(SLLOC DETERMINES POSITION). ; CNVDEC LDX #4 LDA #0 CDLP STA DECIMAL,X DEX BPL CDLP LDX #4 CKMAG LDA HIWK CMP HIVALS,X BEQ CKM2 BCS SUBEM BCC NOSUB CKM2 LDA LOWK CMP LOVALS,X BCS SUBEM NOSUB DEX BPL CKMAG JMP SHOWIT SUBEM LDA LOWK SEC SBC LOVALS,X STA LOWK LDA HIWK SBC HIVALS,X STA HIWK INC DECIMAL,X JMP CKMAG SHOWIT LDX #$4 LDY SLLOC BMI SHEND SHOLP LDA DECIMAL,X ORA #$D0 STA SCOLIN,Y INY DEX BPL SHOLP SHEND RTS ; ;THIS ROUTINE MOVES THE STAR AROUND ON ;THE PLAYFIELD. THE STAR IS ROTATED AND ;PLOTTED (IN A PLAYER) IN THE VBI. ; MOVSTR LDA SMTIM ;TIME TO MOVE? BEQ MSTR ;YES, GO DO IT JMP TRYSHO ;NO, GET STICK MSTR LDA STRSPD ;SET MOVEMENT TIMER STA SMTIM ;WITH STAR SPEED LDA STRHGT ;ADJUST P/M SEC ;COORDINATES TO SBC #13 ;MATCH PLAYFIELD STA STRLY ;PLOTTING LDA STRHOR ;COORDINATES. SEC SBC #44 STA STRLX LDA RANDOM ;WANT TO CHANGE CMP #240 ;THE STAR'S DIRECTION? BCC SAMSTD ;NO, USE SAME. NEWDIR LDA RANDOM ;GET RANDOM AND #7 ;DIRECTION JMP DIRCHK SAMSTD LDA STRDIR ;GET OLD DIRECTION. DIRCHK TAX ;CHECK TO SEE STA TMPDIR ;IF STAR WILL LDA STRLX ;BUMP INTO ANY CLC ;PLAYFIELD ADC STRDTX,X ;OBJECT. STA PLOTX LDA STRLY CLC ADC STRDTY,X STA PLOTY JSR PLOTCL LDY #0 LDA BITSON,X AND (LO),Y ;ANY COLLISION? BEQ WAYCLR ;NO, ALL CLEAR! LDA #15 ;HIT SOMETHING, STA BSCNT ;START BUMP SOUND AND BNE NEWDIR ;GET NEW DIRECTION. WAYCLR LDA PLOTX ;ADJUST STAR CLC ;COORDINATES ADC #44 ;BACK TO P/M STA STRHOR ;COORDINATES LDA PLOTY ;FROM PLAYFIELD. CLC ADC #13 STA STRHGT LDA TMPDIR ;SET DIRECTION STA STRDIR MOVESH LDA #3 ;CHECK ALL STA SHORTN ;4 SHORTS SHMVLP LDX SHORTN ;GET SHORT # LDA SHORTF,X ;SHORT ALIVE? BEQ NXTSM ;NO LDA SHORTX,X ;GET X STA PLOTX ;COORDINATE LDA SHORTY,X ;AND Y STA PLOTY ;COORDINATE JSR PLOTCL ;IS SHORT LDY #0 ;ON... LDA BITSON,X AND (LO),Y CMP COLOR1,X ;COLOR1? BEQ MOVEIT ;YUP! KILLSH LDX SHORTN ;STOP THIS SHORT LDA #0 ;BY TURNING STA SHORTF,X ;FUNCTION FLAG OFF NXTSM DEC SHORTN ;MORE SHORTS? BPL SHMVLP ;YES! JMP TRYSHO ;NO. MOVEIT LDA #3 ;TRY 4 STA TRIES ;DIRECTIONS LDX SHORTN ;GET SHORT # LDA SHORTD,X ;AND DIRECTION STA DIRSAV ;SAVE IT TRYMOV LDX SHORTN ;GET SHORT # LDY DIRSAV ;AND DIRECTION LDA SHORTX,X ;FIND OUT CLC ;WHERE THE ADC DIRX,Y ;SHORT WILL CMP #159 ;BE NEXT BCS NXTTRN ;POSITION, STA PLOTX LDA SHORTY,X CLC ADC DIRY,Y CMP #85 BCS NXTTRN STA PLOTY JSR PLOTCL LDY #0 LDA BITSON,X AND (LO),Y ;IS IT OVER CMP COLOR1,X ;COLOR 1? BEQ GOTDIR ;YES! IT'S OK! NXTTRN DEC TRIES ;MORE DIRECTIONS? BMI KILLSH ;NO! LDX TRIES ;GET NEXT LDA DIRSAV ;TRIAL DIRECTION CLC ADC DADD,X AND #3 STA DIRSAV JMP TRYMOV ;AND TRY TO MOVE! GOTDIR LDX SHORTN ;GET SHORT # LDA PLOTX ;SAVE ALL STA SHORTX,X ;NEW SHORT LDA PLOTY ;POSITION STA SHORTY,X ;AND DIRECTION LDA DIRSAV ;VALUES! STA SHORTD,X JMP NXTSM ;DO NEXT SHORT! ; THIS ROUTINE GENERATES NEW ; SHORTS AT THE PROPER TIME IF ; ANY ARE INACTIVE. TRYSHO LDA SHTIM2 ;READY TO START ONE? BEQ TRYSH2 ;YES! JMP GETSTK ;NO! TRYSH2 LDA SHTIMI ;RESET THE STA SHTIM2 ;SHORT TIMER LDX #3 ;SEARCH FOR SHSCAN LDA SHORTF,X ;INACTIVE SHORT BEQ STRTSH ;GOT ONE!!! DEX BPL SHSCAN JMP GETSTK ;NONE FOUN STRTSH STX HOLDSX STRTSX LDA RANDOM ;RANDOM SHORT X CMP #160 BCS STRTSX STA PLOTX STRTSY LDA RANDOM ;RANDOM SHORT Y AND #$7F CMP #85 BCS STRTSY STA PLOTY JSR PLOTCL LDY #0 LDA BITSON,X AND (LO),Y CMP COLOR1,X ;ON COLOR 1? BNE STRTSX ;NO, TRY AGAIN! LDX HOLDSX LDA PLOTX ;SAVE ALL STA SHORTX,X ;SHORT LDA PLOTY ;PARAMETERS STA SHORTY,X LDA RANDOM AND #3 STA SHORTD,X LDA #1 ;TELL PROGRAM STA SHORTF,X ;SHORT IS ALIVE! JMP GETSTK ;LOOP BACK ; ;SEARCH FOR FILLABLE AREA ; ;THIS SECTION SEARCHES FOR THE AREA TO ;BE FILLED. IT IS SO COMPLICATED THAT ;EXPLANATION OF ITS FINER DETAILS ;WOULD BE ALMOST IMPOSSIBLE WITHOUT ;WRITING ANOTHER COMPLETE ARTICLE. AT ;ANY RATE, IT WORKS. THOSE WITH ANY ;SPECIFIC QUESTIONS SHOULD WRITE ME, ;CARE OF A.N.A.L.O.G. ; SEARCH LDA #1 STA FILLON LDA #0 STA D LDA STRHOR SEC SBC #44 STA SX LDA STRHGT SEC SBC #13 STA SY FINDCL LDX D LDA SX CLC ADC SXD,X STA SX STA PLOTX LDA SY CLC ADC SYD,X STA SY STA PLOTY JSR PLOTCL LDY #0 LDA (LO),Y AND BITSON,X CMP COLOR1,X BEQ FINDC2 CMP COLOR2,X BNE FINDCL LDA #0 STA TD JMP FOUND2 FINDC2 LDA D STA TD JSR DECD FC2A JSR SRCHLC CMP COLOR1,X BNE FC2B JSR GRABEM JMP FINDC2 FC2B CMP COLOR2,X BNE FC2C JSR GRABEM JMP OUTLIN FC2C JSR INCD JMP FC2A FOUND2 LDA #0 STA TRIES JSR DECD FND2A JSR SRCHLC CMP COLOR2,X BNE FND2B JSR GRABEM JMP FOUND2 FND2B LDA TRIES CLC ADC #1 STA TRIES CMP #3 BEQ FINDC1 JSR INCD JMP FND2A FINDC1 LDA D STA TD JSR DECD FC1A JSR SRCHLC CMP COLOR1,X BNE FC1B JSR GRABEM JMP FINDC2 FC1B JSR INCD JMP FC1A OUTLIN JSR PLSXSY LDA #0 STA TRIES OUTLA JSR SRCHLC CMP COLOR1,X BNE OUTLB JSR GRABEM JMP OUTLIN OUTLB LDA TRIES CLC ADC #1 STA TRIES CMP #4 BEQ OUTLD JSR INCD JMP OUTLA OUTLD JSR LOCTXY OUTLD2 CMP COLOR2,X BNE OUTLE JSR FILL LDA #0 STA FILLON RTS OUTLE JSR INCD JSR SRCHLC JMP OUTLD2 SRCHLC LDX TD LDA SX CLC ADC SXD,X STA TX STA PLOTX LDA SY CLC ADC SYD,X STA TY STA PLOTY LOCTXY LDA PLOTX CMP #159 BCS NOREAD LDA PLOTY CMP #85 BCS NOREAD JSR PLOTCL LDY #0 LDA (LO),Y AND BITSON,X RTS NOREAD LDA #0 LDX #0 RTS GRABEM LDA TD STA D LDA TX STA SX LDA TY STA SY RTS INCD LDA TD CLC ADC #1 AND #3 STA TD RTS DECD LDA TD SEC SBC #1 AND #3 STA TD RTS PLSXSY LDA SX STA PLOTX CMP MAXX BCC TMINX2 STA MAXX JMP CKYMM2 TMINX2 CMP MINX BCS CKYMM2 STA MINX CKYMM2 LDA SY STA PLOTY CMP MAXY BCC TMINY2 STA MAXY JMP ENDMM2 TMINY2 CMP MINY BCS ENDMM2 STA MINY ENDMM2 JSR PLOTCL LDY #0 LDA BITOFF,X AND (LO),Y ORA COLOR2,X STA (LO),Y RTS ; ;FILL ROUTINE ; ;AS WITH THE 'SEARCH' SUBROUTINE, THE ;FILL SUBROUTINE IS FAR TOO COMPLEX TO ;EXPLAIN HERE. THIS FILL IS ENTIRELY ;DIFFERENT FROM THE SYSTEM'S FILL ;ROUTINE, AS IT WILL FILL ANY SHAPE ;THAT IS OUTLINED IN COLOR 2. ; FILL LDA #0 ;TURN OFF STA AUDC2 ;SOUND CHANNELS STA AUDC3 ;2 AND 3. LDA MAXY ;INITIALIZE SEC ;THE FILL SBC MINY ;SOUND STA FILFRQ ;FREQUENCY. LDA MINX SEC SBC #1 STA MINX STA FX LDA MINY STA FY SEC SBC #1 STA MINY LDA MAXX CLC ADC #1 STA MAXX LDA MAXY CLC ADC #1 STA MAXY LDA #0 STA SCTALY CLRC2T LDA #0 STA C2TALY LOCLP1 JSR LOCATE CMP #2 BNE LOCLP1 LOCLP2 INC C2TALY JSR LOCATE CMP #2 BEQ LOCLP2 AND #1 BNE CLRC2T LDA C2TALY CMP #1 BEQ FILLIT JSR LOCPRV BEQ CLRC2T FILLIT LDA FX STA PLOTX LDA FY STA PLOTY JSR PLOTCL LDY #0 LDA (LO),Y ORA COLOR3,X STA (LO),Y INC SCTALY JSR LOCATE CMP #0 BEQ FILLIT AND #1 BNE CLRC2T LDA #1 STA C2TALY FOLLOW JSR LOCATE CMP #0 BEQ LOCLP3 AND #1 BNE CLRC2T INC C2TALY JMP FOLLOW LOCLP3 LDA C2TALY CMP #1 BNE LOCLP4 JMP CLRC2T LOCLP4 JSR LOCPRV CMP BITSON,X BEQ FILLIT JMP CLRC2T LOCATE LDA FX CLC ADC #1 STA FX CMP MAXX BNE STOFX LDA CURLO CLC ADC SCTALY STA CURLO LDA CURHI ADC #0 STA CURHI LDA #0 STA SCTALY LDA MINX STA FX LDA #0 STA C2TALY LDA #$86 STA AUDC1 LDA FILFRQ STA AUDF1 BEQ NOFFDC DEC FILFRQ NOFFDC LDA FY CLC ADC #1 STA FY CMP MAXY BEQ FILEND LDA FX CMP MINX BNE STOFX PLA PLA JMP CLRC2T FILEND PLA PLA RTS STOFX LDA FX STA PLOTX LDA FY STA PLOTY JSR PLOTCL LDY #0 LDA BITSON,X AND (LO),Y CMP COLOR2,X BNE NOTC2 LDA BITSON,X ORA (LO),Y STA (LO),Y INC SCTALY LDA #2 RTS NOTC2 CMP COLOR1,X BNE NOTC1 LDA #1 RTS NOTC1 CMP #0 BNE C3 RTS C3 LDA #3 RTS LOCPRV LDA FX STA PLOTX LDA FY SEC SBC #1 CMP MINY BEQ NOLOCP STA PLOTY JSR PLOTCL LDY #0 LDA BITSON,X AND (LO),Y RTS NOLOCP LDA #0 LDX #0 RTS ; ;VBI ROUTINE ; INTRPT LDA KEY ;IS SPACE BAR CMP #$21 ;PRESSED? BNE NOPRES ;NO, CHECK FOR PAUSE. LDA #$FF ;CLEAR OUT STA KEY ;KEY CODE, LDA PAUSE ;COMPLEMENT EOR #$FF ;THE PAUSE STA PAUSE ;FLAG. NOPRES LDA PAUSE ;ARE WE PAUSED? BEQ NOPAUS ;NO! JMP XITVBV ;PAUSED, NO VBI! NOPAUS LDA BSCNT ;MORE BUMP SOUND? BMI NOBS ;NO, PROCESS TIMER. ORA #$A0 ;MIX VOLUME WITH STA AUDC4 ;PURE TONE, LDA #$80 ;SET UP BUMP STA AUDF4 ;SOUND FREQUENCY DEC BSCNT ;AND DECREMENT COUNT. NOBS LDA TIMER ;TIMER DOWN TO ZERO? BEQ NODEC ;YES, DON'T DECREMENT. DEC TIMER ;DECREMENT TIMER. NODEC LDA SHTIM2 BEQ NODEC2 DEC SHTIM1 BNE NODEC2 DEC SHTIM2 NODEC2 LDA FILLON ;ARE WE FILLING? BEQ NOFILL ;NO, DO REST OF VBI. JMP XITVBV ;YES, EXIT VBI NOFILL LDA #0 ;CLEAR OUT STA DEADFG ;DEAD FLAG STA HSHORT ;AND SHORT HIT. LDA P1PL ;HAS PLAYER 1 AND #$0C ;HIT PLAYER 2/3? BEQ NOHITS ;NO, IT'S OK INC HSHORT ;YES!!! NOHITS LDA P1PL ;HAS PLAYER 1 AND #$01 ;HIT PLAYER 0? BEQ NOHITP ;NO! INC DEADFG ;YES!!! NOHITP LDA P0PF ;HAS PLAYER 0 AND #$02 ;HIT COLOR 2? BEQ NOHITL ;NO! INC DEADFG ;YES!!! NOHITL STA HITCLR ;CLEAR COLLISION. LDA MOVTIM ;MOVEMENT TIMER ZERO? BEQ NOMDEC ;YES, DON'T DECREMENT. DEC MOVTIM ;DECREMENT TIMER. NOMDEC LDA SMTIM ;STAR MOVE TIMER ZERO? BEQ NMTDEC ;YES, DON'T DECREMENT. DEC SMTIM ;DECREMENT TIMER. NMTDEC LDA STARCT ;STAR ROT. TIMER ZERO? BEQ STAROT ;YES, ROTATE STAR! DEC STARCT ;DECREMENT TIMER JMP VBREST ;AND SKIP ROTATION. STAROT LDA #1 ;SET ROT. TIMER STA STARCT ;TO 1 LDA STRPOS ;INCREMENT CLC ;STAR ROTATION ADC #1 ;COUNTER, CMP #7 ;ALLOW ONLY 0-6. BNE STOSTP ;ROT. COUNT OK LDA #0 ;ZERO ROT. COUNTER. STOSTP STA STRPOS ;SAVE ROT. POS. VBREST LDY STRPOS ;THIS SECTION LDX STRHGT ;DRAWS THE STAR LDA #0 ;IN PLAYER 0 STA PL0-1,X ;MEMORY USING STA PL0+8,X ;THE TABLES LDA STARB1,Y ;'STARB1' THRU STA PL0,X ;'STARB8'. LDA STARB2,Y STA PL0+1,X LDA STARB3,Y STA PL0+2,X LDA STARB4,Y STA PL0+3,X LDA STARB5,Y STA PL0+4,X LDA STARB6,Y STA PL0+5,X LDA STARB7,Y STA PL0+6,X LDA STARB8,Y STA PL0+7,X LDA STRHOR ;SET STAR'S STA HPOSP0 ;HORIZ. POS. LDA SHOOFF ;OK TO SHOW PLAYER? BNE ENDVBI ;NO, EXIT VBI LDA PX ;SET PLAYER'S CLC ;HORIZONTAL ADC #47 ;POSITION STA HPOSP1 LDA PY ;DRAW PLAYER CLC ;IN PLAYER 3 ADC #$10 ;MEMORY TAX LDA #0 STA PL1-3,X STA PL1-2,X STA PL1+2,X STA PL1+3,X LDA #$40 STA PL1-1,X STA PL1+1,X LDA #$A0 STA PL1,X LDA NOCCHG ;COLOR CHANGE OK? BNE ENDVBI ;NO, EXIT VBI INC COLPM1 ;YES, CYCLE THE COLOR. ; THE FOLLOWING ROUTINE USES TWO ; PLAYERS (2 & 3) TO DISPLAY THE ; "SHORTS." EACH PLAYER IS USED ; TO SHOW 2 SHORTS, SO SOME ; FLICKER MAY BE OBSERVED. ENDVBI INC SHFLIP ;TOGGLE FLIP LDA SHFLIP ;MASK FLIP LSR A ;TO EITHER AND #1 ;0 OR 1 TAY ;PUT IN Y LDA CPYSTN,Y ;AND GET IMAGE STA CPYST ;TO USE (+/X) LDA SHFLIP ;GET FLIP, AND #1 ;MASK AND TAY ;PUT IN Y LDA #PL3/256 ;PUT PLAYER 3 STA DESTHI ;IN DESTINATION LDA #PL3&255 ;ADDRESS STA DESTLO ;HI & LO LDA #1 ;SET DEST # STA DESTNM LDA SHSTRT,Y ;GET START STA VBXHLD ;SHORT # SHORLP LDA #0 LDX DESTNM LDY SHYHLD,X ;GET LAST INDEX LDX #4 ;NOW ERASE ERSSHO STA (DESTLO),Y ;PREVIOUS INY ;SHORT DEX BPL ERSSHO LDX VBXHLD LDA SHORTF,X ;SHORT ALIVE? BEQ NXTSHO ;NO! LDA SHORTX,X ;GET SHORT'S LDY SHORTY,X ;COORDINATES, CLC ADC #46 LDX DESTNM STA HPOSP2,X ;SET HORIZ. POS. TYA CLC ADC #14 STA SHYHLD,X ;AND VERTICAL POS. TAY LDX CPYST LDA #4 ;NOW COPY STA CPYCNT ;SHORT IMAGE SHOCOP LDA SHOIMG,X ;TO THE STA (DESTLO),Y ;PLAYER INY DEX DEC CPYCNT BPL SHOCOP NXTSHO DEC DESTNM ;MORE? BMI VBEND ;NO, EXIT! LDA DESTLO ;POINT TO SEC ;NEXT PLAYER SBC #128 STA DESTLO LDA DESTHI SBC #0 STA DESTHI INC VBXHLD JMP SHORLP ;AND LOOP BACK. VBEND JMP XITVBV ;DONE WITH VBI! ; ;DATA ; DLIST DB $70,$70,$70 DB $4D,DISP&255,DISP/256 DB $D,$D,$D,$D,$D,$D,$D,$D,$D,$D DB $D,$D,$D,$D,$D,$D,$D,$D,$D,$D DB $D,$D,$D,$D,$D,$D,$D,$D,$D,$D DB $D,$D,$D,$D,$D,$D,$D,$D,$D,$D DB $D,$D,$D,$D,$D,$D,$D,$D,$D,$D DB $D,$D,$D,$D,$D,$D,$D,$D,$D,$D DB $D,$D,$D,$D,$D,$D,$D,$D,$D,$D DB $D,$D,$D,$D,$D,$D,$D,$D,$D,$D DB $D,$D,$D,$D,$D,$20,$46 SCDL DW SCOLIN DB $46 DW SCOLN2 DB $41,DLIST&255,DLIST/256 TITLDL DB $70,$70,$70,$70,$70,$70 DB $70,$70,$70,$30,$46 DW MAGMSG DB $70,$47 DW TITLE DB $30,$46 DW AUTHOR DB $70,$70,$30,$46 DW STMSG DB $41 DW TITLDL SCOLIN DB CT,CG,CT,CCOL,0,0,0,0,0,0 DB 0,CC,CU,CR,CCOL,0,0,0,0,0 SCOLN2 DB CL,CV,CCOL,0,0,0,CS,CC,CO DB CR,CE,CCOL,0,0,0,0,0,0,0,0 GOMSG DB 0,0,0,0,0,CG,CA,CM,CE,0 DB 0,CO,CV,CE,CR,0,0,0,0,0 MAGMSG DB 0,0,$21,$2E,$21,$2C,$2F,$27 DB 0,$23,$2F,$2D,$30,$35 DB $34,$29,$2E,$27,0,0 TITLE DB 0,0,0,$66,$69,$6C,$6C,$47 DB $65,$72,0,$75,$70,$41,0 DB $69,$69,0,0,0 AUTHOR DB 0,0,0,$A2,$B9,0,0,$B4 DB $AF,$AD,0,$A8,$B5,$A4,$B3,$AF DB $AE,0,0,0 STMSG DB 0,0,0,0,$F0,$F2,$E5,$F3 DB $F3,0,0,$F3,$F4,$E1,$F2,$F4 DB 0,0,0,0 ; ;LEVEL TABLES ; TGTLO DB 64,16,224,40,248,212,16,4 DB 248,224,212,224,68,168,112,212 TGTHI DB 31,39,46,35,42,48,39,41,42 DB 46,48,46,47,47,48,48 STARSP DB 4,4,4,3,3,3,2,2,2,2,2,1,1 DB 1,1,1 KILLFG DB 0,0,1,0,1,1,0,1,1,1,1,0,0 DB 1,1,1 SHTIME DB 7,7,7,6,6,6,5,5,5,4,4,4,3 DB 3,2,1 SHSTRT DB 0,2 SHYHLD DS 2 SHOIMG DB $88,$50,$20,$50,$88 DB $20,$20,$F8,$20,$20 CPYSTN DB 4,9 DADD DB $FF,2,1 DIRX DB 0,1,0,$FF DIRY DB $FF,0,1,0 SHORTX DS 4 SHORTY DS 4 SHORTF DS 4 SHORTD DS 4 ZERO1 DB 0 SCORE DB 0,0,0,0,0,0 SLLOC DB 0 CURLO DB 0 CURHI DB 0 LEVEL DB 0 PAUSE DB 0 HASDRN DB 0 LOWK DB 0 HIWK DB 0 SCTALY DB 0 LIVES DB 0 ; ;STAR PLAYER-MISSILE IMAGES ; STARB1 DB $81,$40,$20,$10,$08,$04,$02 STARB2 DB $42,$43,$20,$10,$08,$04,$C2 STARB3 DB $24,$24,$13,$10,$08,$C8,$24 STARB4 DB $18,$18,$1C,$1F,$F8,$38,$18 STARB5 DB $18,$18,$38,$F8,$1F,$1C,$18 STARB6 DB $24,$24,$C8,$08,$10,$13,$24 STARB7 DB $42,$C2,$04,$08,$10,$20,$43 STARB8 DB $81,$02,$04,$08,$10,$20,$40 STARCT DB 0 STRPOS DB 0 STRHGT DB 0 STRHOR DB 0 STRLX DB 0 STRLY DB 0 TMPDIR DB 0 STRDIR DB 0 STRDTX DB 1,1,0,255,255,255,0,1 STRDTY DB 0,1,1,0,1,255,255,255 STRSPD DB 4 COLOR1 DB $40,$10,$04,$01 COLOR2 DB $80,$20,$08,$02 COLOR3 DB $C0,$30,$0C,$03 BITSON DB $C0,$30,$0C,$03 BITOFF DB $3F,$CF,$F3,$FC BXSTRT DB 0,158,158,0 BYSTRT DB 0,0,84,84 BXINC DB 1,0,255,0 BYINC DB 0,1,0,255 BORCNT DB 159,85,159,85 BORNUM DB 0 BDINCX DB 0 BDINCY DB 0 BDCNT DB 0 PXWC DB 0 PYWC DB 0 SHOOFF DB 0 CKX DB 0 CKY DB 0 INIX DB 0 INIY DB 0 MINX DB 0 MINY DB 0 MAXX DB 0 MAXY DB 0 REX DB 0 REY DB 0 X DB 0 Y DB 0 SX DB 0 SY DB 0 TX DB 0 TY DB 0 FX DB 0 FY DB 0 TD DB 0 D DB 0 BSCNT DB 0 FILFRQ DB 0 TRIES DB 0 FILLON DB 0 C2TALY DB 0 NOCCHG DB 0 DEDBRT DB 0 STKHLD DB 0 RDRCOL DB 0 REDIR DB 0 LGTHY DB 0 TIMES DB 0 CKV DB 0 CKVX DB 0 DRAWFG DB 0 MOVIX DB 0 XD DB 0,0,0,0 DB 0,0,0,1 DB 0,0,0,255 DB 0,0,0,0 YD DB 0,0,0,0 DB 0,0,0,0 DB 0,0,0,0 DB 0,1,255,0 SXD DB 0,1,0,255 SYD DB 255,0,1,0 DECIMAL DB 0,0,0,0,0 ZERO2 DB 0 HIVALS DB 0,0,0,3,39 LOVALS DB 1,10,100,232,16 DIR DS 256 LGTH DS 256 END $6000