home *** CD-ROM | disk | FTP | other *** search
- 1 ifag=0thenag=1:load"c64 dir.reader",8,1
- 2 dir=49152
- 3 :
- 5 gosub51000
- 10 rem *** macro processor ***
- 12 dir=49152
- 30 n0$=chr$(0):quote$=chr$(34):true=1:false=0:dim parm$(20)
- 40 gt$=chr$(137):gs$=chr$(141)
- 50 poke53281,1:poke53280,5:poke646,0
- 55 print"[147] [192][192][192][192][192][192][192] [194][193][211][201][195] [205]acro [208]rocessor[146] [192][192][192][192][192][192]"
- 57 print" by [205]ichael [204]eidel"
- 60 print"[197]nter name of host program (source file)";
- 62 print"<[208]ress [210][197][212][213][210][206] for a directory>"
- 63 print"<[197]nter '[209]' to return to [204][207][193][196][211][212][193][210]>"
- 65 gosub61000
- 66 ifp$="dir"orp$="[196][201][210]"orp$=""then62000
- 67 ifp$="q"orp$="quit"orp$="[209][213][201][212]"then50000
- 70 print"[208]rocessing..."p$:print:macro=false:ch=2
- 75 li=11:poke1,55:gosub63000
- 80 open1,8,15:open2,8,2,"0:"+p$+",p,r":input#1,e,e$:ife=0then100
- 90 close2:close1:printe,e$:goto50000
- 100 open3,8,3,"0:"+p$+".exp,p,w":input#1,e,e$:ife=0then120
- 110 close3:print#1,"s0:"+p$+".exp":input#1,e,e$,e:printe$,e:goto 100
- 120 print#3,chr$(1);chr$(8);:gosub240:gosub240
- 130 rem **** main processing logic ****
- 140 gosub240:d$=c$:gosub240:ifd$=n0$andc$=n0$then460
- 150 gosub260:gosub240
- 160 if c$="[" thengosub360:l$="":goto140
- 170 if c$="!" then if macro then gosub650:goto140
- 180 if exclude or c$=quote$ then if macro then gosub1210:goto140
- 190 if c$="_" then if macro then gosub1130
- 200 if c$=gt$orc$=gs$then if macro then gosub 1480
- 210 l$=l$+c$:if c$=n0$ then gosub300:l$="":goto140
- 220 gosub240:goto190
- 230 rem * closed subroutines follow *
- 240 get#ch,c$:ifc$=""thenc$=n0$
- 250 return
- 260 get#ch,ln$,hn$:ifln$=""thenln$=n0$
- 270 if hn$=""thenhn$=n0$
- 280 if macro then lm=lm+1:iflm>255thenhm=hm+1:lm=0
- 290 return
- 300 ifw=0thenw=len(l$)+5:goto320
- 310 w=len(l$)+4
- 320 wt=wt+w:x=int(wt/256):hp$=chr$(x+8):x=(wt-(x*256)):lp$=chr$(x)
- 330 ifmacrothenln$=chr$(lm):hn$=chr$(hm)
- 340 print#3,lp$;hp$;ln$;hn$;l$;:return
- 350 rem *** open macro file ***
- 360 lf$="":l$="":if macro then print"[195]annot nest macros":goto780
- 370 gosub240:ifc$<>chr$(34)thenprint#1,"i":print"[205]issing quotes":goto 780
- 380 gosub240:ifc$=","then gosub490:print:goto 410
- 390 ifc$=quote$ then gosub240:gosub240:goto 410
- 400 lf$=lf$+c$:printc$;:goto380
- 410 open5,8,5,"0:"+lf$+",p,r":input#1,e,e$:ife=0then 430
- 420 print"[147][198]ile error";e;lf$;e$:goto780
- 430 macro=true:ch=5:gosub240:gosub240
- 440 lm=asc(ln$):hm=asc(hn$):mb=hm*256+lm
- 450 l$=chr$(143)+" "+lf$+" macro"+n0$:gosub300:return
- 460 if macro then close5:macro=false:ch=2:goto130
- 470 print#3,chr$(0);chr$(0);:close2:close3:close1
- 480 print"*** [208]rocessing complete ***":print:goto50000
- 490 rem collect parameters
- 500 for x=1to20:parm$(x)="":nextx:x=1
- 510 if x>20 then 580
- 520 gosub 240
- 530 if c$=n0$thenprint"[147][205]issing quote in macro line":goto780
- 540 if c$=quote$then 610
- 550 if c$="," then x=x+1:goto 510
- 560 parm$(x)=parm$(x)+c$
- 570 goto 510
- 580 if x>20 then pc=20:goto 610
- 590 pc=x
- 600 rem 610 checks for closing ] null
- 610 gosub240:ifc$<>"]"then630
- 620 gosub240:ifc$=n0$ then return
- 630 print"[147] [201]nvalid macro syntax":goto780
- 640 rem ** handle macro directive **
- 650 d1$=""
- 660 gosub240
- 670 if c$=" "orc$=n0$ then 700
- 680 d1$=d1$+c$
- 690 goto660
- 700 if asc(d1$)=128thenexclude=false:return
- 710 if len(d1$)=2 thengosub820:return
- 720 if exclude then gosub 1220:return
- 730 if d1$="err[176]"then 1240
- 740 if d1$="message"thengosub1310:return
- 750 if d1$="set" thengosub1370:return
- 760 if d1$="exit" or d1$=chr$(237) then close5:macro=false:ch=2:return
- 770 print"[147]invalid macro directive ";d1$:goto780
- 780 rem *** abort routine ***
- 790 if macro then close5
- 800 close2:close3:close1:print"[213]nable to continue at line ";
- 810 print(asc(hn$)*256)+asc(ln$):print:goto50000
- 820 rem * handle conditional dir *
- 830 agnbr=val(d1$)
- 840 if agnbr<0 or agnbr>20 then print"[147][201]nvalid argument number ";d1$:goto780
- 850 d2$=""
- 860 for x=1to3:gosub240:d2$=d2$+c$:next x
- 870 gosub240:gosub240
- 880 if c$<>quote$ then print"[147][205]issing value quote on !_#":goto780
- 890 d3$=""
- 900 gosub240:ifc$=n0$thenprint"[147][205]issing quote on !_#":goto780
- 910 if c$<>quote$thend3$=d3$+c$:goto900
- 920 gosub240:rem get last null
- 930 if c$<>n0$ then print"[147]invalid conditional line in macro":goto780
- 940 if d2$="eql"then gosub1010:return
- 950 if d2$="lss"then gosub1030:return
- 960 if d2$="gtr"then gosub1050:return
- 970 if d2$="leq"then gosub1070:return
- 980 if d2$="neq"then gosub1090:return
- 990 if d2$="geq"then gosub1110:return
- 1000 print"[147][201]nvalid conditional operator ";d2$:goto780
- 1010 if parm$(agnbr)=d3$ then exclude=0:return
- 1020 exclude=1:return
- 1030 if parm$(agnbr)<d3$ then exclude=0:return
- 1040 exclude=1:return
- 1050 if parm$(agnbr)>d3$ then exclude=0:return
- 1060 exclude=1:return
- 1070 if parm$(agnbr)<=d3$ thenexclude=0:return
- 1080 exclude=1:return
- 1090 if parm$(agnbr)<>d3$ thenexclude=0:return
- 1100 exclude=1:return
- 1110 if parm$(agnbr)=>d3$ thenexclude=0:return
- 1120 exclude=1:return
- 1130 rem * handle parameter replacement
- 1140 gosub240:d1$=c$:gosub240:d1$=d1$+c$
- 1150 agnbr=val(d1$)
- 1160 if agnbr<0 or agnbr>20 then print"[147][201]nvalid argument ";d1$:goto 780
- 1170 l$=l$+parm$(agnbr)
- 1180 gosub 240:rem get byte after [back arrow]arg
- 1190 return
- 1200 rem * handle macro comment *
- 1210 gosub 240
- 1220 if c$<>n0$ then 1210
- 1230 return
- 1240 rem * handle error abort *
- 1250 e$="":gosub240:rem read quote
- 1260 gosub240:ifc$=quote$then1290
- 1270 ifc$=n0$then1300
- 1280 e$=e$+c$:goto1260
- 1290 gosub240:rem read null
- 1300 print"[147]";e$:goto 780
- 1310 rem * handle warning msg *
- 1320 print"[205]> ";
- 1330 gosub240:rem get quote
- 1340 gosub240:ifc$=quote$thengosub240:print:return
- 1350 if c$=n0$ then print:return
- 1360 print c$;:goto 1340
- 1370 rem * handle set directive *
- 1380 gosub240:d2$=c$:gosub240:d2$=d2$+c$
- 1390 argnbr=val(d2$)
- 1400 ifargnbr<1orargnbr>20thenprint"[147][201]nvalid argument number ";d2$:goto780
- 1410 gosub240:gosub240
- 1415 ifc$<>quote$thenprint"[147][205]issing quote on !set":goto780
- 1420 d3$=""
- 1430 gosub240:ifc$=n0$thenprint"[147][205]issing quote on !set":goto780
- 1440 ifc$<>quote$thend3$=d3$+c$:goto1430
- 1450 gosub240:rem get last null
- 1460 parm$(argnbr)=d3$
- 1470 return
- 1480 rem handle macro branch
- 1490 b$="":l$=l$+c$
- 1500 gosub240:ifc$=" "then1500
- 1510 ifc$="#"then gosub 240:return
- 1520 b$=b$+c$:gosub240
- 1530 ifc$=":"orc$=n0$orc$=","then1550
- 1540 goto1520
- 1550 bo=val(b$):b$=str$(mb+bo)
- 1560 ifc$=n0$orc$=":"thenl$=l$+b$:return
- 1570 l$=l$+b$+c$:b$="":gosub240:goto1530
- 5000 :
- 50000 rem error or done
- 50005 print
- 50010 print" [208]ress [[210][197][212][213][210][206]] to compile another"
- 50012 printspc(17)"-or-"
- 50014 print" [208]ress [[211][208][193][195][197]] to return to [204][207][193][196][211][212][193][210]."
- 50020 poke198,0:wait198,1:geta$
- 50030 ifa$=chr$(13)thenrun10
- 50040 ifa$=chr$(32)then60000
- 50050 goto50020
- 50060 :
- 51000 print"[147][144][176][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][174]";
- 51005 fora=1to23:print"[221]"spc(38)"[221]";:next
- 51010 print"[173][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192]":poke53281,1
- 51015 poke2023,125:poke2023+54272,.
- 51020 print"[204][207][193][196][211][212][193][210] [208]resents:"
- 51030 print"[194]asic [205]acro [208]rocessor"
- 51040 print"by [205]ichael [204]eidel"
- 51045 print"(c) [195]opyright 1987"
- 51050 print"[144][208]ress any key to continue."
- 51060 poke198,.:wait 198,1:geta$
- 51070 return
- 59999 stop
- 60000 print
- 60001 print" [193]re you sure you want to quit"
- 60002 print" and return to [204][207][193][196][211][212][193][210]?"
- 60004 poke198,0:wait198,1:geta$
- 60006 ifa$="n"ora$="[206]"then50000
- 60008 ifa$="y"ora$="[217]"then60010
- 60009 goto60004
- 60010 poke1,55
- 60020 open15,8,15,"r0:hello connect=hello connect":input#15,er:close15
- 60030 ifer<>63thenend
- 60040 load "hello connect",8
- 60050 :
- 61000 rem input name
- 61002 p$="":ls=16:cr$="[164]"
- 61010 print">";
- 61020 printcr$"[157]";
- 61030 poke198,0:wait198,1:geta$
- 61040 ifa$=chr$(13)thenreturn
- 61050 ifa$<>"[157]"anda$<>chr$(20)then61060
- 61055 l=len(p$):ifl>0thenp$=left$(p$,l-1):print" [157][157] [157]";:goto61020
- 61057 goto61030
- 61060 fl=0:if(a$>="a"anda$<="z")or(a$>="[193]"anda$<="[218]")ora$=" "ora$="."thenfl=1
- 61062 iffl=0thenif((a$>="0"anda$<="9"))ora$="?"ora$="*"ora$="_"ora$="^"thenfl=1
- 61064 iffl=0thenifa$=">"ora$="<"ora$="-"thenfl=1
- 61070 iffl=0then61030
- 61080 iflen(p$)<>lsthenp$=p$+a$:printa$;:goto61020
- 61090 goto61030
- 62000 rem directory
- 62002 li=14:gosub63000
- 62008 print" <[208]ress [[211][208][193][195][197]] to pause>
- 62009 [153]"----------------------------------------";
- 62010 [158]dir
- 62020 [153]:[153][166]7)"(NULL)ress [(NULL)val(NULL)(NULL)(NULL)(NULL)] to continue"
- 62030 [146]197,64:[151]198,0:[146]198,1:[161]a$:[139]a$[179][177][199](13)[167]62030
- 62040 [151]1,55:[138]10
- 63000 [143] window stuff
- 63002 [151]770,131:[151]771,164:[151]88,0:[151]89,192:[151]90,0:[151]91,192
- 63003 [151]781,33:[151]782,0:[158]41964
- 63004 [151]88,254:[151]89,255:[151]90,254:[151]91,255
- 63005 [151]781,33:[151]782,0:[158]41964
- 63007 [151]59639,li:[151]1,53
- 63008 [142]
-