; ANGLEWORMS II› ; Stan Ockers 12/83› ; ÁÃÅ Îå÷óìåôôåò¬ ³¶¶² Öéîå Íáðìå› ; Åõçåî嬠Ïò ¹·´¸µ ¤±² ùåáò      › ;   ÆÅ ±¹¸´ ÁÃÔÉÏΡ Ìéóôéîç     ››MODULE ;Some global variables› BYTE ARRAY Xsave0 (200),Xsave1(200),› Ysave0(200),Ysave1 (200),xpos (2),› ypos(2),sndflg(3),pit(3),vol(3),› dur(3),sxpos(2),sypos(2),savestk(2)› BYTE head0,tail0,head1,tail1,stk,› consol=53279,txtrow=656,txtcol=657,› color1=709,color2=710,sflag0=[0],› sflag1=[0],x,y,longcnt,grow,plyrs,› level,shots0,shots1,win,del,tunepos› CARD cnt,speed,score0,score1,goal› INT ARRAY delx (2),dely (2),sdelx(2),› sdely(2)› BYTE ARRAY tunenote=[64 72 81 81 81› 128 121 108 108 108 81 72 64 64 64› 72 81 72 64 72 72 64 72 81 81 81› 128 121 108 108 108 81 72 64 53 53› 64 81 72 64 72 81 128 108 128 108› 128 121 108 108 121 96 121 96 121› 108 96 96 108 81 81 108 108 128› 128 144 81 72 64 53 53 64 81 72 64› 72 81]› BYTE ARRAY tunedur=[8 8 16 16 16 8 8› 16 16 16 8 8 16 16 8 8 8 8 16 16› 16 8 8 16 16 16 8 8 16 16 16 8 8› 16 16 8 8 8 8 16 16 32 16 16 16 16› 8 8 16 32 16 16 16 16 8 8 16 16 16› 16 16 16 16 16 16 16 8 8 16 16 8 8› 8 8 16 16 16]›PROC Init() ; Worms to starting pos.› FOR cnt=0 TO 199› DO› Xsave0(cnt)=10 Ysave0(cnt)=10› Xsave1(cnt)=10 Ysave1(cnt)=10› OD› FOR cnt=0 TO 4› DO› Xsave0(cnt)=9+cnt Xsave1(cnt)=70-cnt› OD› FOR cnt=0 to 3› DO › sndflg(cnt)=0 pit(cnt)=0 vol(cnt)=0› OD› xpos(0)=13 ypos(0)=10 delx(0)=1› dely(0)=0 xpos(1)=66 ypos(1)=10› delx(1)=-1 dely(1)=0 savestk(0)=15› savestk(1)=15 speed=2000/level grow=3› longcnt=grow head0=4 head1=4 tail0=0› tail1=0›RETURN››PROC Bkgd() ; Draw walls & rectangles› BYTE x,y,line,height,width› CARD dl› BYTE ARRAY dli=[72 138 72 152 72 169› 56 162 32 160 82 141 10 212 141 26› 208 142 22 208 140 23 208 104 168› 104 170 104 64]› Graphics(5) dl=Peek(560)› dl==+Peek(561)*256 Poke(dl+44,$8A)› Poke(dl+45,70) Poke(dl+48,6)› Poke(dl+49,6) Poke(dl+50,6)› Poke(708,138) Poke(709,202)› Poke(710,70) Poke(712,130)› txtrow=0 txtcol=0› FOR cnt=1 to shots0› DO› Put(42)› OD› IF plyrs=2 THEN txtcol=15› FOR cnt=1 to shots1› DO› Put(170)› OD› FI› txtrow=0 txtcol=6 Print("level ")› PrintB(level)› txtrow=1 txtcol=23 Print("plyr#1")› PokeC(512,dli) Poke(54286,192)› IF plyrs=2 THEN Print(" plyr#2")› ELSE Print(" computer")› FI› txtrow=1 txtcol=4 PrintC(score0)› txtcol=12 PrintC(score1)› color=1 Position(0,0) DrawTo(79,0)› DrawTo(79,39) DrawTo(0,39) DrawTo(0,0)› FOR cnt=1 to Rand(3)+2› DO› x=Rand(80) y=Rand(40)› height=Rand(10)+3 width=Rand(10)+3› IF x+width>79 THEN width=79-x› FI› IF y+height>39 THEN height=39-y› FI› color=1› FOR line=y to y+height› DO› Plot(x,line) DrawTo(x+width,line)› OD› OD› color=0 Plot(1,10) DrawTo(78,10)› FOR cnt=0 TO 4› DO› color=2› Plot(Xsave0(cnt),Ysave0(cnt))› color=3› Plot(Xsave1(cnt),Ysave1(cnt))› OD›RETURN››PROC Note (BYTE chan,pitch,duration)› IF sndflg(chan)=0 THEN› Poke($D200+2*chan,pitch)› pit(chan)=pitch vol(chan)=8› Poke($D201+2*chan,168)› sndflg(chan)=1 dur(chan)=duration› FI›RETURN› ›PROC Play(BYTE chan) ; Play tune› IF sndflg(chan)=1 THEN› IF dur(chan)>0 THEN dur(chan)==-1› ELSE vol(chan)==-1› Poke($D201+2*chan,160+vol(chan))› IF vol(chan)=0 THEN sndflg(chan)=0› FI› FI› FI›RETURN››PROC Stkupdate(BYTE stknum)› BYTE ARRAY clank› BYTE snd› clank="!%#29DLUfr" snd=clank(Rand(10))› stk=Stick(stknum)› IF stk<>savestk(stknum) THEN› Note(stknum,snd,1)› FI› savestk(stknum)=stk› IF stk=14 THEN› dely(stknum)=-1 delx(stknum)=0› ELSEIF stk=13 THEN› dely(stknum)=1 delx(stknum)=0› ELSEIF stk=7 THEN› dely(stknum)=0 delx(stknum)=1› ELSEIF stk=11 THEN› dely(stknum)=0 delx(stknum)=-1› FI› xpos(stknum)==+delx(stknum)› ypos(stknum)==+dely(stknum)›RETURN››PROC Lookfwd() ;For computers worm› IF Locate (xpos(1)+2*delx(1),› ypos(1)+2*dely(1))<>0 OR› Rand(100)<5 THEN› IF delx(1)<>0 THEN delx(1)=0› IF Rand(2)=0 THEN dely(1)=1› ELSE dely(1)=-1› FI› ELSEIF dely(1)<>0 THEN dely(1)=0› IF Rand(2)=0 THEN delx(1)=1› ELSE delx(1)=-1› FI› FI› IF Locate (xpos(1)+2*delx(1),› ypos(1)+2*dely(1))<>0 THEN› delx(1)=-delx(1)› dely(1)=-dely(1)› FI › FI› xpos(1)==+delx(1) ypos(1)==+dely(1)›RETURN››PROC Addhead0() ; Extend head› head0==+1› If head0=200 THEN head0=0› FI› Xsave0(head0)=xpos(0)› Ysave0(head0)=ypos(0)› color=2 Plot(xpos(0),ypos(0))›RETURN››PROC Addhead1()› head1==+1› IF head1=200 THEN head1=0› FI› Xsave1(head1)=xpos(1)› Ysave1(head1)=ypos(1)› color=3 Plot(xpos(1),ypos(1))›RETURN››PROC Erasetail0() ; Remove from tail› color=0 Plot(Xsave0(tail0),› Ysave0(tail0))› tail0==+1› IF tail0=200 THEN› tail0=0› FI›RETURN››PROC Erasetail1()› color=0 Plot(Xsave1(tail1),› Ysave1(tail1))› tail1==+1› If tail1=200 THEN› tail1=0› FI›RETURN››PROC Dly(CARD maxwait)› CARD wait› FOR wait=1 to maxwait› DO› OD›RETURN››PROC Title() ; Opening screen-choices› BYTE wait=[1],choice,ypos› CARD dl› BYTE ARRAY firstline(14)=[13 65 238› 103 76 197 247 79 210 109 83 32› 105 105]› DO› UNTIL consol<>6› OD› Graphics(17) Poke(712,64) tunepos=0› dl=Peek(560) dl==+Peek(561)*256› Poke(dl+12,7) Poke(dl+8,2)› Poke(dl+18,2)› Position(3,8) PrintD(6,firstline)› Position(4,10)› PrintD(6,"by S. OCKERS")› Position(11,14)› PrintD(6,"Written in ACTION!")› Position(3,23)› PrintD(6,"æéòå-start game") choice=17› DO› wait==-1› IF wait<=0 THEN wait=15› Position(7,17)› PrintBD(6,plyrs) PrintD(6," players")› Position(7,19) PrintD(6,"level ")› PrintBD(6,level)› Position(7,21) PrintD(6,"goal ")› PrintCD(6,goal)› FOR ypos=17 to 21 STEP 2› DO› Position(5,ypos) PutD(6,32)› OD› Position(5,choice) PutD(6,138)› stk=Stick(0)› IF stk=14 AND choice>17 THEN› choice==-2› ELSEIF stk=13 AND choice<21 THEN› choice==+2› ELSEIF choice=17 AND (stk=7 OR› stk=11) THEN› IF plyrs=1 THEN plyrs=2› ELSE plyrs=1› FI› ELSEIF stk=7 AND choice=19 AND› level<9 THEN level==+1› ELSEIF stk=11 AND choice=19 AND› level>1 THEN level==-1› ELSEIF stk=7 AND choice=21 AND› goal<9900 THEN goal==+100› ELSEIF stk=11 AND choice=21 AND› goal>1000 THEN goal==-100› FI› FI › Play(0) DLY(350)› IF sndflg(0)=0 THEN› Note(0,tunenote(tunepos),› tunedur(tunepos))› tunepos==+1› IF tunepos=77 THEN tunepos=0› FI› FI› UNTIL Strig(0)=0› OD› SndRst()›RETURN››PROC Flash0() ; Worm hit something› FOR cnt=1 to 10› DO› color1=color1+8› Sound(0,20+5*cnt,12,10) Dly(3000)› color1=color1-8 Sound(0,0,0,0)› Dly(3000)› OD›RETURN››PROC Flash1()› FOR cnt=1 to 10› DO› color2=color2+8› Sound(1,50+5*cnt,12,10) Dly(3000)› color2=color2-8 Sound(1,0,0,0)› Dly(3000)› OD›RETURN››PROC Sinit0() ; Set up shot movement› sflag0=1 sxpos(0)=xpos(0)+delx(0)› sypos(0)=ypos(0)+dely(0)› sdelx(0)=delx(0) sdely(0)=dely(0)› Poke(656,0) Poke(657,shots0-1)› Put(32) shots0==-1›RETURN››PROC Sinit1()› sflag1=1 sxpos(1)=xpos(1)+delx(1)› sypos(1)=ypos(1)+dely(1)› sdelx(1)=delx(1) sdely(1)=dely(1)› Poke(656,0) Poke(657,shots1+14)› Put(32) shots1==-1›RETURN››PROC Smove0() ; Move shot› color=0 Plot(sxpos(0),sypos(0))› Sound(0,60,2,10)› FOR cnt=1 to 2› DO› sxpos(0)==+sdelx(0) sypos(0)==+sdely(0)› color=0 Plot(sxpos(0),sypos(0))› IF sxpos(0)<=1 OR sxpos(0)>=78 OR› sypos(0)<=1 OR sypos(0)>=38 THEN› sflag0=0 Sound(0,0,0,0) EXIT› FI› OD› IF sflag0=0 THEN color=0› ELSE color=2› FI› Plot(sxpos(0),sypos(0))›RETURN››PROC Smove1()› color=0 Plot(sxpos(1),sypos(1))› Sound(1,70,2,10)› FOR cnt=1 to 2› DO› sxpos(1)==+sdelx(1) sypos(1)==+sdely(1)› color=0 Plot(sxpos(1),sypos(1))› IF sxpos(1)<=1 OR sxpos(1)>=78 OR› sypos(1)<=1 OR sypos(1)>=38 THEN› sflag1=0 Sound(1,0,0,0) EXIT› FI› OD› IF sflag1=0 THEN color=0› ELSE color=3› FI› Plot(sxpos(1),sypos(1))›RETURN››PROC Marque() ; Used in end display› FOR x=1+del TO 16+del STEP 3› DO› Play(0)› Position(x,1) PutD(6,170)› IF x<18 THEN Position(x+1,1)› PutD(6,42)› ELSE Position(1,1) PutD(6,42)› FI› OD› FOR y=2+del TO 20+del STEP 3› DO› Position(18,y) PutD(6,170)› IF y<22 THEN Position(18,y+1)› PutD(6,42)› ELSE Position(18,2) PutD(6,42)› FI› OD› FOR x=3-del TO 18-del STEP 3› DO› Position(x,23) PutD(6,170)› IF x>1 THEN Position(x-1,23)› PutD(6,42)› ELSE Position(18,23) PutD(6,42)› FI› OD› FOR y=4-del TO 22-del STEP 3› DO› Position(1,y) PutD(6,170)› IF y>2 THEN Position(1,y-1)› PutD(6,42)› ELSE Position(1,22) PutD(6,42)› FI› OD›RETURN››PROC Gameover() ; Ending screen› Graphics(17) Poke(712,32) tunepos=0› Position(3,5) PrintD(6,"the ÷éîîåò is")› Position(4,7)› IF score0>=goal THEN› PrintD(6," PLAYER #1")› ELSEIF plyrs=2 THEN› PrintD(6," PLAYER #2")› ELSE PrintD(6,"THE COMPUTER")› FI› Position(2,9)› PrintD(6,"×ÉÔÈ Á ÓÃÏÒÅ ÏÆ")› Position(4,11)› IF score0>=goal THEN PrintCD(6,score0)› ELSE PrintCD(6,score1)› FI› PrintD(6," VS ")› IF score0>=goal THEN PrintCD(6,score1)› ELSE PrintCD(6,score0)› FI› Position(4,13)› PrintD(6,"ÏÎ LEVEL# ") PrintBD(6,level)› Position(3,18) PrintD(6,"press START")› Position(4,19) PrintD(6,"to play again")› color=170 Plot(1,1) DrawTo(18,1)› DrawTo(18,23)› DrawTo(1,23) DrawTo(1,1) color=42› FOR x=1 TO 16 STEP 3› DO› Plot(x,1) Plot(x+2,23)› OD› FOR y=1 TO 22 STEP 3› DO› Plot(1,y) Plot(18,y+1)› OD› del=0 cnt=1› DO ; Flashing lights & music› Marque() del==+1› IF del=3 THEN del=0› FI› IF sndflg(0)=0 THEN› Note(0,tunenote(tunepos),› tunedur(tunepos)) tunepos==+1› IF tunepos=77 THEN tunepos=0 › FI› FI› UNTIL Consol=6› OD›RETURN››PROC Main() ; The game› BYTE next0=[0],next1=[0]› CARD time› DO ; This loop is endless› DO ; Restart game› plyrs=1 level=1 score0=0 score1=0› shots0=5 shots1=5 win=0 goal=1000› DO ; Get playing choices› Title()› DO ; Draw a new playfield› Init() Bkgd() time=0› DO ; Move worms until collision› Stkupdate(0)› IF plyrs=1 THEN Lookfwd()› ELSE stkupdate(1)› FI› Addhead0() Addhead1()› longcnt==-1› IF longcnt>0 THEN› Erasetail0() Erasetail1()› ELSE longcnt=grow› FI› IF sflag0=0 AND Strig(0)=0› AND shots0>0 THEN Sinit0()› FI› IF sflag1=0 AND Strig(1)=0› AND shots1>0 THEN Sinit1()› FI› IF sflag0=1 THEN Smove0()› FI› IF sflag1=1 THEN Smove1()› FI› Dly(speed) Play(0) Play(1)› time=time+1 txtrow=0 txtcol=29› IF time MOD 5=0 THEN› PrintC(time)› FI› txtrow=0 txtcol=6› IF time MOD 50=0 THEN› Print("level ")› PrintB(level) Print(" ")› ELSEIF time MOD 30=0 THEN› Print("win=") PrintC(goal)› FI› next0=Locate(xpos(0)+delx(0),› ypos(0)+dely(0))› next1=Locate(xpos(1)+delx(1),› ypos(1)+dely(1))› UNTIL next0>0 OR next1>0› OD› SndRst()› IF next0>0 THEN flash0()› ELSE flash1()› FI› time=time/5*5› DO ; Update score› time==-5› IF next0>0 THEN score1==+5› Note(0,50,6)› ELSEIF next1>0 THEN› score0==+5 Note(1,60,6)› FI› txtrow=1 txtcol=4 PrintC(score0)› txtcol=12 PrintC(score1) Poke(77,0)› txtrow=0 txtcol=29 PrintC(time)› Print(" ")› FOR cnt=1 TO 10› DO› Dly(200) Play(0) Play(1)› OD› UNTIL time<=0 OR time>64000› OD› SndRst()› IF score0>=goal OR score1>=goal› THEN win=1 EXIT› FI› DO› UNTIL Strig(0)=0 OR Strig(1)=0› OR consol=5 OR consol=3› OD› UNTIL consol=5 OR consol=3› ; Exit only if consol key pushed› OD› UNTIL win=1 OR consol=3› ; Exit on win or option key› OD› IF consol=3 THEN EXIT ; skip gameover› FI› Gameover()› OD› OD›RETURN›››