REM Acorn Invaders REM Packed by Make v1.41 15/5/08 On 19 Jun 2008 ONERRORPROCw:END MODE28:OFF:a$="Acorn Invaders. (c)2008 DynaByte Software":PRINTa$:PRINTSTRING$(LEN(a$),"-"):PRINT:aa%=FALSE:b$=".Resources.":PRINT"Checking files...":IFNOTFNi(b$+"Gfx0","Sprites")THENaa%=TRUE IFNOTFNi(b$+"Gfx1","Charset")THENaa%=TRUE IFNOTFNi(b$+"Intro","Music")THENaa%=TRUE IFNOTFNi(b$+"Creds","Credits")THENaa%=TRUE IFNOTFNi(b$+"Msg","Messages")THENaa%=TRUE IFNOTFNi(b$+"ImgLUT","Lookups")THENaa%=TRUE IFNOTFNi(b$+"SWIs","Lookups")THENaa%=TRUE IFaa%THENERROR255,"File Missing!!" PRINT:PRINT"Loading Messages...";:ba%=FNr(b$+"Msg","SGSM"):DIMf%(ba%),b$(ba%):PROCi(b$+"Msg","SGSM",f%(),b$()):PRINTFNa(14):PRINTFNa(3);:ca%=FNr(b$+"ImgLUT","TULI"):DIMg%(ca%),c$(ca%):PROCi(b$+"ImgLUT","TULI",g%(),c$()):PRINTFNa(14) PRINTFNa(13);:da%=FNr(b$+"SWIs","TULS"):DIMh%(da%),d$(da%):PROCi(b$+"SWIs","TULS",h%(),d$()):PRINTFNa(14):PRINTFNa(1):OSCLI"PlayVolume 0":OSCLI"Playmod "+b$+"Intro":OSCLI"PlayPause":aa%=FALSE:ea%=0:fa%=1:ga%=TRUE:ha%=0:DIMa$(10),c%(10):DIMd%(10):PRINTFNa(2) PROCx:SYSFNe(1),,FNe(2)TOia%:PRINTFNa(4);:ja%=FNu(b$+"Gfx0"):PRINTFNa(14):PRINTFNa(5);:ka%=FNu(b$+"Gfx1"):PRINTFNa(14):la%=ja%:PRINTFNa(6);:ma%=OPENIN(b$+"Creds"):INPUT#ma%,h$:IFh$<>"DERC"THEN CLOSE#ma%:ERROR255,FNa(101):END ENDIF INPUT#ma%,ha%:DIMe$(ha%),e%(ha%):FORi%=1TOha%:INPUT#ma%,e%(i%),e$(i%):NEXTi%:CLOSE#ma%:PRINTFNa(14):PRINTFNa(7);:l$=b$+"HiTable":IFFNv(l$)<>1THEN IFNOTFNw(0,b$)THEN ga%=FALSE:PRINTFNa(8) ELSE:PRINTFNa(9) ENDIF PROCy(ga%) ELSE:IFNOTFNw(1,l$)THEN ga%=FALSE:PRINTFNa(10) ELSE:PRINTFNa(11) ENDIF PROCz ENDIF PRINTFNa(12):PROCe(150):b%=0:a%=4:f%=8:m%=12:L%=16:M%=20:q%=24:U%=28:na%=32:oa%=36:pa%=40:qa%=44:ra%=48:sa%=52:ta%=56:ua%=60:va%=64:wa%=16:xa%=20:ya%=24:W%=28:T%=32:za%=16:Aa%=20:h%=FNd(36):P%=FNd(24):J%=FNd(16) CLS:PROCm:h%!W%=FNc(8,1):h%!T%=FNc(8,2)+7:P%!f%=FNc(6,1):P%!m%=FNc(6,2):P%!za%=h%!m%-50:P%!Aa%=30:OSCLI"PlayVolume 127":OSCLI"PlayStart":WHILENOTFNz:CLS:PROCA:ENDWHILE:CLS:J%!f%=220:J%!m%=40:J%=FNs(J%,h%):J%!a%-=3:PROCj(J%):PROCn(FNa(31),10):IFfa%=1THEN FORi%=127TO1STEP-2:OSCLI"PlayVolume "+STR$(i%):PROCe(4):NEXTi%:OSCLI"PlayStop":OSCLI"PlayVolume 127" ENDIF PROCo:END DEFFNz:LOCALi%,G%,H%,B%,N%,d%,V%,Ba%,o%:LOCALCa%,Q%,Da%,Ea%,Fa%,Ga%,x%,y%,I%,s$,a$:G%=FNj(FNd(16),0):H%=FNj(FNd(16),0):B%=FNj(FNd(16),0):d%=FNj(FNd(16),0):V%=FNj(FNd(16),0):Q%=FNj(FNd(16),0):o%=FNj(FNd(16),0) G%!f%=FNc(100,1):G%!m%=FNc(40,2):G%!b%=FNf(G%,h%):G%!a%=800:H%!f%=FNc(150,1):H%!m%=FNc(40,2):H%!b%=FNf(H%,h%):H%!a%=G%!a%-H%!m%:B%!f%=640:B%!m%=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a$):y%=B%!a%+B%!m%-20:PROCb(x%,y%,a$,0):a$=FNa(35):y%-=h%!T%:x%=FNg(a$):PROCb(x%,y%,a$,0):x%=d%!b%+d%!f%+10:PROCa(FNb(11),d%!b%,d%!a%):a$=FNa(36)+" "+FNa(40):PROCb(x%,d%!a%+10,a$,0) PROCa(FNb(24),Ca%!b%,Ca%!a%):a$=FNa(37)+" "+FNa(40):PROCb(x%,Ca%!a%+12,a$,0):PROCa(FNb(22),Ba%!b%,Ba%!a%):a$=FNa(38)+" "+FNa(40):PROCb(x%,Ba%!a%+12,a$,0):PROCa(FNb(20),V%!b%,V%!a%):a$=FNa(39)+" "+FNa(40):PROCb(x%,V%!a%+12,a$,0) N%=o%!f%/h%!W%+2:s$=FNa(66):a$=s$+STRING$(N%," ")+FNa(67):x%=FNg(a$):y%=V%!a%-(3*h%!T%):PROCb(x%,y%,a$,0):o%!b%=x%+7+(LEN(s$)*h%!W%):o%!a%=y%:PROCa(FNb(1),o%!b%,o%!a%):I%=FNq:IFI%=1THEN=TRUE IFI%=2THEN=FALSE PROCd(B%):a$=FNa(41):x%=FNg(a$):y%=B%!a%+B%!m%-20:PROCb(x%,y%,a$,0):x%=Q%!b%+Q%!f%+10:PROCa(FNb(102),Q%!b%,Q%!a%):a$=FNa(42)+" "+FNa(43):PROCb(x%,Q%!a%+12,a$,0):PROCa(FNb(103),Da%!b%,Da%!a%):a$=FNa(42)+" "+FNa(44):PROCb(x%,Da%!a%+12,a$,0) PROCa(FNb(104),Ea%!b%,Ea%!a%):PROCb(x%,Ea%!a%+12,FNa(45),0):PROCa(FNb(105),Ha%!b%,Ha%!a%):a$=FNa(46)+" "+FNa(49):PROCb(x%,Ha%!a%+12,a$,0):PROCa(FNb(106),Ga%!b%,Ga%!a%):PROCb(x%,Ga%!a%+12,FNa(47),0):PROCa(FNb(107),Fa%!b%,Fa%!a%) a$=FNa(48)+" "+FNa(49):PROCb(x%,Fa%!a%+12,a$,0):I%=FNq:IFI%=1THEN=TRUE IFI%=2THEN=FALSE PROCd(B%):a$=FNa(50):IFga%THENa$=FNa(51) x%=FNg(a$):y%=B%!a%+B%!m%-20:PROCb(x%,y%,a$,0):a$=FNa(58)+" "+FNa(52):x%=FNg(a$):y%-=h%!T%:PROCb(x%,y%,a$,0):y%=(B%!a%+B%!m%)-100:a$=" "+FNa(68)+" "+FNa(69):a$+=STRING$(12," ")+FNa(57)+".":a$+=STRING$(3," ")+FNa(60)+".":x%=FNg(a$):PROCb(x%,y%,a$,0):y%-=2*h%!T% FORi%=1TO10:IFi%<10THEN a$=" "+STR$(i%)+". " ELSE:a$=" "+STR$(i%)+". " ENDIF s$=FNo(a$(i%)):a$+=FNm(s$,8," ",FALSE):a$+=" .... ":a$+=FNx(STR$(c%(i%)),10):a$+=" ... "+FNx(STR$(d%(i%)),3):x%=FNg(a$):PROCb(x%,y%-(i%*(h%!T%+5)),a$,0):NEXTi%:I%=FNq:IFI%=1THEN=TRUE IFI%=2THEN=FALSE PROCd(B%):ENDWHILE:ERROR255,FNa(102):=FALSE DEFFNq:LOCALt%,I%:t%=TIME+750:I%=FALSE:REPEAT:IFINKEY(-82)THENPROCp IFINKEY(-102)THENPROCq UNTILTIME>=t%ORINKEY(-17)ORINKEY(-99):IFINKEY(-17)THENI%=1 IFINKEY(-99)THENI%=2 IFI%THEN PROCc(G%):PROCc(H%):PROCc(B%):PROCc(d%):PROCc(V%):PROCc(Ba%):PROCc(Ca%):PROCc(Q%):PROCc(Da%):PROCc(Ea%):PROCc(Fa%):PROCc(Ga%):PROCc(Ha%):PROCc(o%) ENDIF =I% DEFFNg(a$):LOCALN%:N%=LEN(a$)*h%!W%:=B%!b%+FNl(N%,B%!f%) DEFPROCA:LOCALo%,p%,d%,e%,k%:LOCALD%:LOCALb%(),a%():LOCAL_%,X%,Ia%,Ja%:LOCALKa%,La%,Ma%,Na%:LOCALOa%,Pa%,Qa%,Ra%,Sa%:LOCALTa%,N%,a$,x%,y%,i%,j%:LOCALO%:o%=FNd(32):p%=FNd(40):d%=FNd(48):e%=FNd(68):D%=FNd(16):k%=FNd(40):DIMb%(10,6),a%(7) _%=0:X%=4:Ia%=8:Ja%=12:Ka%=16:La%=20:Ma%=24:Na%=28:Ua%=32:Va%=36:Oa%=oa%:Pa%=pa%:Qa%=qa%:Ra%=ta%:Sa%=ua%:o%!f%=FNc(30,1):o%!m%=FNc(15,2):o%!b%=FNf(o%,h%):o%!a%=50:o%!M%=6:o%!L%=o%!M% D%!f%=FNc(20,1):D%!m%=FNc(20,2):d%!f%=FNc(40,1):d%!m%=FNc(20,2):d%!a%=P%!za%-(10+d%!m%):d%!M%=5:d%!q%=FALSE:d%!pa%=1:p%!f%=FNc(5,1):p%!m%=FNc(20,2):p%!q%=FALSE:p%!M%=10:k%!Ia%=1:k%!X%=0:k%!_%=3:k%!Ja%=FALSE:k%!Ka%=0:k%!Va%=0:k%!Ma%=k%!X%:k%!Na%=-1 e%!Oa%=FNc(20,1):e%!Pa%=10:e%!Qa%=6:e%!q%=TRUE:e%!Sa%=4:FORi%=1TO7:a%(i%)=FNd(44):PROCr(a%(i%),0):a%(i%)!f%=FNc(5,1):a%(i%)!m%=FNc(20,2):NEXTi%:PROCf(P%!za%):PROCf(P%!Aa%):PROCB(0,c%(1),k%!_%,k%!Ia%):PROCC:PROCa(FNb(1),o%!b%,o%!a%) O%=0:WHILEk%!_%>0:Ta%=FALSE:IFk%!Ka%=0THEN IFINKEY(-74)THENPROCD(o%!b%,o%!a%) IFINKEY(-98)THENPROCE:Ta%=TRUE IFINKEY(-67)THENPROCF:Ta%=TRUE IFINKEY(-17)THENPROCG ENDIF IFINKEY(-102)THENPROCq IFINKEY(-82)THENPROCp IFINKEY(-56)THENPROCH IFk%!Ka%=0THEN IFTa%THEN o%!b%+=o%!L%:PROCa(FNb(1),o%!b%,o%!a%) ENDIF ENDIF O%+=1:IFO%>=10000THENO%=0 IFk%!Ka%=0THEN PROCI:PROCJ:PROCK:PROCL:PROCM ELSE:PROCN ENDIF WAIT:ENDWHILE:J%!f%=240:J%!m%=40:J%=FNs(J%,h%):J%!a%-=3:PROCd(J%):PROCj(J%):a$=FNa(49)+" "+FNa(53):PROCn(a$,11):PROCe(750):IFNOTk%!Ja%THEN IFk%!X%>=c%(10)THEN PROCO(k%) ENDIF ENDIF PROCc(o%):PROCc(e%):PROCc(d%):PROCc(p%):PROCc(k%):PROCc(D%):FORi%=1TO7:PROCc(a%(i%)):NEXTi%:ENDPROC DEFPROCE:IFo%!b%<=0THEN o%!b%=0 ELSE:o%!L%=0-o%!M% ENDIF ENDPROC DEFPROCF:IFo%!b%>=h%!f%-o%!f%THEN o%!b%=h%!f%-o%!f% ELSE:o%!L%=0+o%!M% ENDIF ENDPROC DEFPROCD(x%,y%):IFNOTp%!q%THEN p%!q%=TRUE:p%!b%=x%+(o%!f%/2):p%!a%=y%+o%!m% ENDIF ENDPROC DEFPROCp:REPEAT:UNTILNOTINKEY(-82):OSCLI"ScreenSave .Dump"+STR$(ea%):ea%+=1:ENDPROC DEFPROCG:LOCALi%:FORi%=1TO7:a%(i%)!q%=FALSE:NEXTi%:k%!_%=0:k%!Ja%=TRUE:ENDPROC DEFPROCq:REPEAT:UNTILNOTINKEY(-102):fa%=FNk(fa%):IFfa%=1THENOSCLI"PlayStart"ELSEOSCLI"PlayPause" ENDPROC DEFPROCH:REPEATUNTILNOTINKEY(-56):k%!Ka%=FNk(k%!Ka%):k%!La%=k%!Ka%:IFk%!Ka%=1THEN k%!Va%=O% ELSE:O%=k%!Va% ENDIF ENDPROC DEFPROCT:REPEAT:UNTILNOTINKEY():IFd%!q%THEN IFNOTd%!U%THEN d%!U%=TRUE:d%!na%=O%:PROCa(FNb(12),d%!b%,d%!a%) ENDIF ENDIF ENDPROC DEFPROCI:LOCALWa%,Xa%:Wa%=na%:IFp%!q%THEN p%!Wa%=FALSE:IFp%!a%>=P%!za%-p%!m%THEN p%!q%=FALSE:p%!Wa%=TRUE ENDIF IFp%!Wa%THEN Xa%=FNh(p%):Xa%!a%-=2:PROCd(Xa%):PROCc(Xa%) ELSE:PROCa(FNb(5),p%!b%,p%!a%) ENDIF p%!a%+=p%!M% ENDIF ENDPROC DEFPROCJ:LOCALYa%,Za%,_a%,d$:Ya%=na%:Za%=oa%:_a%=pa%:IFNOTd%!q%THEN IFFNn(4)ANDFNn(5)THEN d%!q%=TRUE:d%!U%=FALSE:d%!Za%=0:d%!_a%=0:IFFNn(50)THEN d%!L%=0-d%!M%:d%!b%=h%!f% ELSE:d%!L%=0+d%!M%:d%!b%=0-d%!f% ENDIF ENDIF ELSE:d%!Za%+=1:IFd%!b%<=0-d%!f%ANDSGN(d%!L%)=-1THEN d%!Ya%=FALSE:d%!q%=FALSE:ENDPROC ENDIF IFd%!b%>h%!f%ANDSGN(d%!L%)=1THEN d%!Ya%=FALSE:d%!q%=FALSE:ENDPROC ENDIF IFNOTd%!U%THEN IFFNp(p%,d%)THEN PROCd(p%):PROCa(FNb(12),d%!b%,d%!a%):d%!Ya%=O%:d%!U%=TRUE:p%!q%=FALSE:PROCg(500) ENDIF ELSE:IFFNp(p%,d%)THEN PROCd(p%):p%!q%=FALSE ENDIF ENDIF IFNOTd%!U%THEN IFd%!Za%>=1000THENd%!Za%=0 IFd%!Za%MOD10=0THEN d%!_a%=FNk(d%!_a%) ENDIF d$=FNb(10)+STR$(d%!_a%):PROCa(d$,d%!b%,d%!a%):d%!b%+=d%!L% ELSE:IFO%>=d%!Ya%+80THEN PROCd(d%):d%!q%=FALSE:d%!Ya%=FALSE:O%=0:d%!_a%=TRUE ELSE:IFO%>=d%!Ya%+60THEN PROCa(FNb(15),d%!b%,d%!a%) ELSE:IFO%>=d%!Ya%+40THEN PROCa(FNb(14),d%!b%,d%!a%) ELSE:IFO%>=d%!Ya%+20THEN PROCa(FNb(13),d%!b%,d%!a%) ENDIF ENDIF ENDIF ENDIF ENDIF ENDIF ENDPROC DEFPROCK:LOCAL`a%,z%,E%,K%,ab%,bb%,cb%,Y%:LOCALF%,db%,eb%:F%=na%:db%=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a%(i%)!gb%=O% ENDIF ENDIF PROCd(p%):p%!q%=FALSE ENDIF IFa%(i%)!U%THEN IFO%-a%(i%)!gb%>=5THEN PROCd(a%(i%)):a%(i%)!q%=FALSE ENDIF ENDIF ENDIF NEXTi%:ENDPROC DEFPROCN:LOCALa$:IFO%MOD50=0THEN k%!La%=FNk(k%!La%) ENDIF a$=FNa(49)+" "+FNa(61):IFk%!La%=0ORk%!Ka%=0THEN a$=STRING$(LEN(a$)," ") ENDIF PROCu(a$):ENDPROC DEFPROCM:LOCALa$:IFk%!Na%>=0THEN a$=FNa(66)+" "+FNa(72):IFO%MOD10=0THEN k%!Ua%=FNk(k%!Ua%):IFk%!Ua%=1THENk%!Na%+=1 ENDIF IFk%!Ua%=0THEN a$=STRING$(LEN(a$)," ") ENDIF IFk%!Na%>5THEN a$=STRING$(LEN(a$)," "):k%!Na%=-1 ENDIF PROCu(a$) ENDIF ENDPROC DEFPROCy(lb%):LOCALi%,n$:FORi%=1TO10:IFi%MOD2=0THENn$=FNa(71)ELSEn$=FNa(70) a$(i%)=FNo(n$):c%(i%)=(11-i%)*1000:d%(i%)=0:NEXTi%:IFlb%THENPROCv ENDPROC DEFPROCz:LOCALi%,R%:R%=OPENIN".Resources.HiTable":FORi%=1TO10:INPUT#R%,a$(i%),c%(i%):INPUT#R%,d%(i%):NEXTi%:CLOSE#R%:ENDPROC DEFPROCv:LOCALi%,R%:R%=OPENOUT".Resources.HiTable":FORi%=1TO10:PRINT#R%,a$(i%),c%(i%):PRINT#R%,d%(i%):NEXTi%:CLOSE#R%:ENDPROC DEFPROCO(k%):LOCALH%,G%,mb%,g%,i%,nb%,N%,x%,y%,a$:G%=FNd(16):H%=FNd(16):G%!f%=FNc(100,1):G%!m%=FNc(40,2):G%!b%=FNf(G%,h%):G%!a%=800:H%!f%=FNc(150,1):H%!m%=FNc(40,2):H%!b%=FNf(H%,h%):H%!a%=G%!a%-H%!m%:nb%=0:FORi%=10TO1STEP-1 IFk%!X%>=c%(i%)THENnb%=i% NEXTi%:FORi%=9TOnb%STEP-1:a$(i%+1)=a$(i%):c%(i%+1)=c%(i%):d%(i%+1)=d%(i%):NEXTi%:c%(nb%)=k%!X%:d%(nb%)=k%!Ia%:CLS:PROCf(P%!za%):PROCf(P%!Aa%):PROCa(FNb(100),G%!b%,G%!a%):PROCa(FNb(101),H%!b%,H%!a%):a$=FNa(54)+" "+STR$(k%!X%) a$+=" "+FNa(55)+" "+STR$(nb%)+FNA(nb%):N%=LEN(a$)*h%!W%:x%=FNl(N%,h%!f%):y%=H%!a%-170:PROCb(x%,y%,a$,0):PROCc(G%):PROCc(H%):J%!f%=165:J%!m%=40:J%=FNs(J%,h%):PROCj(J%):x%=J%!b%+20:y%=J%!a%+12:a$="":i%=1:mb%=FALSE OSCLI"FX 21,0":REPEAT:g%=GET:CASEg%OF WHEN13:mb%=TRUE WHEN8:i%-=1:a$=LEFT$(a$,i%-1) OTHERWISE:IFi%<9ANDFNB(g%)THENi%+=1:a$+=CHR$(g%) ENDCASE IFi%<1THENi%=1 PROCb(x%,y%,STRING$(8," "),0):IFa$=""THEN PROCb(x%,y%," ",0) ELSE:PROCb(x%,y%,a$,0) ENDIF UNTILmb%:IFa$=""ORa$=" "THENa$=FNa(56) a$(nb%)=FNo(a$):IFga%THENPROCv ENDPROC DEFFNB(ob%):LOCALWa%:Wa%=FALSE:IFob%>=32ANDob%<=126THENWa%=TRUE =Wa% DEFPROCB(pb%,qb%,l%,r%):LOCALx%,a$:a$=FNa(57)+FNm(STR$(pb%),10," ",TRUE):PROCb(0,h%!m%-h%!T%,a$,0):a$=FNa(58)+" "+FNa(57):a$+=" "+FNa(59)+FNm(STR$(qb%),10," ",TRUE):x%=h%!f%-LEN(a$)*h%!W%:PROCb(x%,h%!m%-h%!T%,a$,0):PROCh(l%):PROCk(r%):ENDPROC DEFPROCh(rb%):LOCALa$:PROCa(FNb(1),0,0):a$=" = "+STR$(rb%):PROCb(o%!f%,0,a$,0):ENDPROC DEFPROCk(rb%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THEN CASESGN(b%(K%,E%))OF WHEN-1:PROCQ(x%,y%,K%,E%) WHEN1:PROCa(FNb(27)+STR$(b%(K%,E%)),x%,y%) ENDCASE ELSE:v%!b%=x%:v%!a%=y%:v%!f%=D%!f%:v%!m%=D%!m%:PROCd(v%) ENDIF NEXTE%:NEXTK%:PROCc(v%):ENDPROC DEFPROCQ(x%,y%,r%,c%):LOCALtb%:tb%=FNd(16):b%(r%,c%)+=1:PROCa(FNb(26),x%,y%):IFb%(r%,c%)=0THEN tb%!b%=x%:tb%!a%=y%:tb%!f%=D%!f%:tb%!m%=D%!m%:PROCd(tb%) ENDIF PROCc(tb%):ENDPROC DEFPROCs:LOCALv%,i%:v%=FNd(16):FORi%=1TO3:e%!a%-=D%!m%/3:PROCl:NEXTi%:v%!b%=e%!b%:v%!a%=e%!a%+e%!m%:v%!f%=e%!f%:v%!m%=D%!m%:PROCd(v%):PROCc(v%):ENDPROC DEFPROCP:LOCALS%,Z%,F%,ub%,M%,i%,j$:M%=1:vb%=24:S%=FNd(28):Z%=FNd(28):PROCd(e%):PROCd(o%):IFp%!q%THEN PROCd(p%):p%!q%=FALSE ENDIF IFd%!q%THEN PROCd(d%):d%!q%=FALSE ENDIF FORi%=1TO7:IFa%(i%)!q%THEN PROCd(a%(i%)):a%(i%)!q%=FALSE ENDIF NEXTi%:o%!b%=FNf(o%,h%):S%!b%=0-D%!f%:S%!a%=o%!a%:S%!L%=M%:Z%!b%=h%!f%:Z%!a%=o%!a%:Z%!L%=0-M%:k%!_%=0:PROCf(P%!Aa%):PROCh(k%!_%):PROCk(k%!Ia%):PROCa(FNb(1),o%!b%,o%!a%):F%=0:ub%=FALSE:REPEAT:S%!b%+=S%!L%:S%!vb%=S%!b%+D%!f%:Z%!b%+=Z%!L%:F%+=1 IFF%MOD20=0THENub%=FNk(ub%) IFF%>1000THENF%=0 IFub%THENj$=FNb(21)ELSEj$=FNb(20) PROCa(j$,S%!b%,S%!a%):PROCa(j$,Z%!b%,Z%!a%):PROCe(2):WAIT:UNTILS%!vb%>=o%!b%:FORi%=1TO10:PROCa(FNb(20),S%!b%,S%!a%):PROCa(FNb(20),Z%!b%,Z%!a%):PROCe(20):PROCa(FNb(21),S%!b%,S%!a%):PROCa(FNb(21),Z%!b%,Z%!a%):PROCe(20):WAIT:NEXTi%:FORi%=1TO3 PROCa(FNb(2)+STR$(i%),o%!b%,o%!a%):PROCe(20):WAIT:NEXTi%:PROCe(20):PROCd(o%):PROCc(S%):PROCc(Z%):ENDPROC DEFFNu(e$):LOCALwb%,C%:C%=FNC(e$)+256:wb%=FNd(C%):!wb%=C%:wb%!4=0:wb%!8=16:wb%!12=16:SYSia%,256+10,wb%,e$:SYSia%,256+17,wb%:=wb% DEFPROCb(x%,y%,a$,xb%):LOCALi%,yb%:la%=ka%:yb%=h%!W%:FORi%=1TOLEN(a$):PROCa(STR$(ASC(MID$(a$,i%,1))),x%+((i%-1)*yb%),y%):IFxb%>0THENPROCe(xb%) NEXTi%:la%=ja%:ENDPROC DEFPROCa(r$,x%,y%):LOCALzb%:SYSia%,256+24,la%,r$TO,,zb%:SYSia%,512+34,la%,zb%,x%,y%,0:ENDPROC DEFPROCd(w%):GCOL0,0TINT0:RECTANGLEFILLw%!b%,w%!a%,w%!f%,w%!m%:ENDPROC DEFFNl(Ab%,h%):=(h%/2)-(Ab%/2) DEFPROCn(a$,Bb%):LOCALN%,y%:N%=LEN(a$)*h%!W%:y%=(h%!m%/2)-(h%!T%/2):PROCb(FNl(N%,h%!f%),y%,a$,Bb%):ENDPROC DEFFNf(Cb%,Db%):=(Db%!f%/2)-(Cb%!f%/2) DEFFNs(Cb%,Db%):LOCALx%,y%:Cb%!b%=(Db%!f%/2)-(Cb%!f%/2):Cb%!a%=(Db%!m%/2)-(Cb%!m%/2):=Cb% DEFPROCf(a%):LOCALi%,Eb%:Eb%=h%!f%/P%!f%:FORi%=1TOEb%+1:PROCa(FNb(108),(i%-1)*P%!f%,a%):NEXTi%:ENDPROC DEFPROCj(w%):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!8=11:v%!12=12:v%!16=-1:SYSFNe(5),v%,v%:h%!wa%=v%!0:h%!xa%=v%!4:h%!f%=(v%!8)+1<h%!ya%THENPROCm CASEOb%OF WHEN1:Pb%=C%<>h%!wa% WHEN4:Pb%=C%>>h%!xa% OTHERWISE:ERROR255,FNa(103)+" "+STR$(Ob%) ENDCASE =Pb% DEFFNp(w%,Rb%):LOCALSb%,Tb%,Ub%,Vb%:Ub%=FALSE:Vb%=FALSE:IFw%!q%ANDRb%!q%THEN Sb%=Rb%!b%+Rb%!f%:Tb%=Rb%!a%+Rb%!m%:IFw%!b%>=Rb%!b%ANDw%!b%=Rb%!a%ANDw%!a%=t%:ENDPROC DEFFNk(n%):=n%EOR1 DEFFNA(n%):LOCALc$,u%:u%=VAL(RIGHT$(STR$(n%),1)):c$=FNa(65):IFu%>=1ANDu%<=3THENc$=FNa(u%+61) =c$ DEFFNm(a$,Xb%,q$,Yb%):LOCALZb%,c$:Zb%=Xb%-LEN(a$):IFZb%<=0THEN c$=LEFT$(a$,Xb%) ELSE:IFYb%THEN c$=STRING$(Xb%,q$):RIGHT$(c$,LEN(a$))=a$ ELSE:c$=a$+STRING$(Zb%,q$) ENDIF ENDIF =c$ DEFFNx(a$,Xb%):LOCALc$:c$=STRING$(Xb%," "):RIGHT$(c$,LEN(a$))=a$:=c$ DEFFNv(g$):LOCALNb%:SYS"XOS_File",17,g$TONb%:=Nb% DEFFNC(g$):LOCALC%:SYSFNe(3),5,g$TO,,,,C%:=C% DEFFNw(Ob%,g$):LOCALR%,_b%,`b%,ac%:ac%=FALSE:CASEOb%OF WHEN0:R%=OPENUP(g$+"chkfile") WHEN1:R%=OPENUP(g$) OTHERWISE:ERROR255,FNa(104)+" "+STR$(Ob%) ENDCASE IFR%<>0THEN SYSFNe(4),254,R%TO`b%;_b%:IF(_b%AND1)THEN CLOSE#R%:ERROR255,FNa(105) ENDIF IF((`b%AND(1<<7))<>0)THENac%=TRUE CLOSE#R% ENDIF =ac% DEFPROCx:LOCALbc%:cc%=0:dc%=0:SYSFNe(10),-1,-1TOec%:SYSFNe(11)TOfc%;bc%:IFbc%AND1THENfc%=16384 PROCR(fc%):ENDPROC DEFPROCo:IFcc%THEN SYSFNe(10),cc%-32768,-1TOec%:cc%=0:dc%=0 ENDIF ENDPROC DEFFNd(gc%):LOCALA%,C%:C%=(gc%+15)AND-4:A%=FND(C%):IFA%ELSEERROR254,FNa(111) A%!0=&DEADDEAD:A%!4=gc%:!(A%-8+(A%!-4))=&DEADDEAD:=A%+8 DEFPROCc(RETURNA%):A%-=8:IFA%!0<>&DEADDEADTHENERROR254,FNa(112) IF!(A%-8+(A%!-4))<>&DEADDEADTHEN ERROR254,FNa(113) ENDIF dc%-=A%!-4:SYSFNe(12),3,cc%,A%:A%=0:ENDPROC DEFFNy(A%):LOCALv%:v%=A%-4:=v%!0 DEFFNj(A%,sb%):PROCr(A%,sb%):=A% DEFPROCr(A%,sb%):LOCALY%,C%:C%=FNy(A%):FORY%=0TOC%-4STEP4:A%!Y%=sb%:NEXTY%:ENDPROC DEFFNh(A%):LOCALhc%,Y%,C%:C%=FNy(A%):hc%=FNd(C%):FORY%=0TOC%-4STEP4:hc%!Y%=A%!Y%:NEXTY%:=hc% DEFPROCR(C%):IFcc%THENERROR254,FNa(115) C%=(C%+fc%-1)ANDNOT(fc%-1):cc%=HIMEM:SYSFNe(10),ec%+C%,-1TOec%:C%=ec%+32768-cc%:IFC%<1THEN cc%=0:ERROR254,FNa(116) ELSE:SYSFNe(12),0,cc%,,C% ENDIF dc%=0:ENDPROC DEFPROCS(gc%):LOCALic%:ic%=ec%:SYSFNe(10),ec%+gc%,-1TOec%:gc%=ec%-ic%:IFgc%THENSYSFNe(12),5,cc%,,gc%TO,,,gc% ENDPROC DEFFND(gc%):LOCALA%,bc%:SYSFNe(13),2,cc%,,gc%TO,,A%;bc%:IFbc%AND1THEN PROCS((gc%+fc%)ANDNOT(fc%-1)):SYSFNe(13),2,cc%,,gc%TO,,A%;bc%:IFbc%AND1THEN=0 ENDIF dc%+=A%!-4:=A%