10
20
30
40
50 grog%=FALSE:A%=INKEY(100):vdu%=INKEY-1
60 MODE 7:PRINTTAB(8,12)"Watch the LCD screen...!";:VDU23,1;0;0;0;0;
70
80 os%=FNosb(0,1,0):IFHIMEM<&FFFF:HIMEM=FNosb(132,0,0) ELSE vdu%=TRUE:IF PAGE<&FFFF:SYS"OS_GetEnv"TO,A%:HIMEM=A%
90 edstart%=HIMEM-&A00:memstart%=edstart%+&200:HIMEM=edstart%:noprogs%=16
100 VERS$="0.02"
110 DIM ctrl% 19,data% 19,file$(31),load%(31),exec%(31),attr%(31),progpos%(noprogs%)
120 rst%=16:cls%=1:home%=2:rtn%=3:fwd%=4:rev%=5:right%=6:left%=7
130 doff%=12:don%=13:del$=CHR$(127):upkey$=CHR$&8A:dnkey$=CHR$&8B
140 lft$=del$:rgt$="~":IFvdu%:lft$="[":rgt$="]"
150 arrow$=" "+lft$+"-- --"+rgt$+" ":gap$=" ___ "
160 k0%=0-grog%-(os%>5):FORa%=0 TO 7:OSCLI"KEY "+STR$(k0%+a%)+CHR$(65+a%):NEXT:OSCLI"KEY "+STR$(k0%+8)+" Y"
170 IF grog%:OSCLI"KEY 0 N" ELSE OSCLI"KEY "+STR$(k0%+9)+" N"
180 ON ERROR REPORT:PRINT:OSCLI"FX4":IFERR<128 END ELSE PROCerr(FNerr)
190 *FX4,1
210 :
220
230 PROCc(rst%,0):PROCc(rst%,1):PROCc(cls%,0):PROCc(cls%,1)
240 PROCpr(0,0,"* M-8000 * v"+VERS$+" (c)1991 HCE & GrogSOFT")
250 PROCmsg(2,"Initialising")
260 :
270 b1%=memstart%:FORprogno%=0 TO noprogs%-1
280 $b1%=FNpad("Program_"+STR$(progno%),10):b1%?11=1:b1%!12=18
290 b1%!14=&101:
300 progpos%(progno%)=b1%:b1%=b1%+18
310 NEXT:progpos%(progno%)=b1%
320 :
330 maxped%=-1:REPEAT:maxped%=maxped%+1:READ A$:UNTILA$="*":RESTORE
340 DIM ped$(maxped%):FOR pa%=0 TO maxped%:READ ped$(pa%):NEXT
350
360 DATA Off,Prog Up,Prog Down,Flush,*
370 a%=INKEY(200)
380 progno%=0
390 :
400 ON ERROR REPORT:PRINT:OSCLI"FX4":IFERR<128 END ELSE PROCerr(FNerr)
410
420 REPEAT
430 PROCc(cls%,0):PROCc(cls%,1):PROCpr(0,0,"MENU:")
440 REPEAT:PROCprog:PROCprProg(0,0,0,0)
450 prot%=progstart%?11:PROCpr(15,3,"Prot")
460 IF prot% PROCpr(25,3,gap$+" File") ELSE PROCpr(25,3,"Edit File")
470 REPEAT K$=GET$:IF K$>"_" K$=CHR$(ASC(K$)-32)
480 IF K$="A" progno%=(progno%+noprogs%-1)MOD noprogs%
490 IF K$="B" progno%=(progno%+1)MOD noprogs%
500 IF K$<>"D" ELSE prot%=prot%EOR 1:progstart%?11=prot%
510 IF K$<>"F" ELSE IF prot% K$="*" ELSE PROCedit
520 IF K$="H" PROCfile
530 UNTILINSTR("ABDFH",K$)
540 UNTILINSTR("FH",K$)
550 UNTIL 0
560 END
570 :
580 DEFPROCedit:LOCAL K$,linkno%,outno%,inno%,ptr%
590 PROCc(cls%,1):PROCpr(0,0,"EDIT:")
600 progstart%=progpos%(progno%):PROCcopy(progstart%,edstart%)
610 noconn%=edstart%?17:edfin%=edstart%+(edstart%!12 AND &FFFF)
620 REPEAT:PROCpr(4,0,": "):PROCclr(2):PROCsh_link(linkno%,ptr%)
630 IF noconn% PROCpr(0,2,"Connection"):PROCpr(0,3,arrow$) ELSE PROCpr(0,3,gap$+gap$)
640 PROCpr(10,3," Add "):IF linkno% PROCpr(15,3,"Del.") ELSE PROCpr(15,3,gap$)
650 PROCpr(20,3,"Link Pedl Name Copy")
660 REPEAT K$=GET$
670 IF K$="A" ANDnoconn% PROCdn_link
680 IF K$="B" ANDnoconn% PROCup_link
690 IF K$="C" PROCad_link:PROCed_link
700 IF K$<>"D" ELSE IF linkno% PROCdl_link ELSE K$="*"
710 IF K$="E" PROCed_link
720 IF K$="F" PROCpd_edit
730 IF K$<>"G" ELSE PROCpr(4,0,"/NAME:"):PROCc(cls%,1):A$=FNinp($edstart%,20,0,10,""" "):IF A$<>"" $edstart%=FNpad(A$,10) ELSE PROCpr(20,0,FNpad($edstart%,10))
740
750 UNTIL INSTR("CDEFGYN",K$)
760 UNTIL K$="Y" OR K$="N"
770 IF K$="Y" PROCupdate(progno%)
780 ENDPROC:edit
790 :
800 DEFPROCfile:LOCAL K$
810 REPEAT:PROCc(cls%,0):PROCc(cls%,1):PROCpr(0,0,"FILE:")
820 PROCpr(12,0,"__% free")
830 PROCpr(0,3,"Load Save Del. Ren. Fmt. Name ")
840 free%=FNfree:size%=FNused+free%:IFsize%:free%=free%*100/size% ELSE free%=0
850 PROCpr(11,0,FNnpad(free%,3))
860 MNAME$=FNpad(FNtitle,16):PROCpr(0,1,MNAME$+" -"+rgt$)
870 PROCrd_cat
880 ptr%=1:IFfiles%=0:kbd$="BGHN" ELSE kbd$="ABDEGHN"
890 REPEAT:PROCpr(0,3,"Load Save Del. Ren. Fmt. Name ")
900 IF files%=0 PROCpr(25,1,"--No files--") ELSE PROCprF(1,ptr%):PROCprF(0,ptr%-1):PROCprF(2,ptr%+1)
910 K$=GET$
920 IFK$=upkey$ ANDptr%<files% ptr%=ptr%+1
930 IFK$=dnkey$ ANDptr%>1 ptr%=ptr%-1
940 IFK$<>"D" ELSE IF FNf_delt K$="" ELSE K$="*"
950 UNTILINSTR(kbd$,K$):quit%=0:IFK$<>"N"AND K$<>"":quit%=EVAL("FNf_"+MID$("loadsave........renm....formname",(ASCK$-65)*4+1,4))
960 UNTILK$="N" ORquit%:ENDPROC
970 DEFPROCpd_edit:LOCAL K$,pa%:pa%=edstart%?16
980 PROCpr(4,0,"/PEDAL:"):PROCclr(1):PROCc(cls%,1):PROCpr(5,2,"Pedal function:")
990 REPEAT:PROCpr(23,2,FNnpad(pa%,12)+" "+FNpad(ped$(pa%),10))
1000 REPEAT:K$=GET$:UNTILINSTR("YN"+upkey$+dnkey$,K$)
1010 IF K$=dnkey$ OR K$=upkey$ pa%=(maxped%+pa%+2*(K$=upkey$)+1)MODmaxped%
1020 UNTILK$="Y" OR K$="N"
1030 IF K$="Y" edstart%?16=pa%
1040 ENDPROC:pd_edit
1050 DEFPROCup_link:ENDPROC
1060 DEFPROCdn_link:ENDPROC
1070 DEFPROCad_link:
1080 edfin%!00=&01FF0000:
1090 edfin%!04=&7F000000:
1100 edfin%!08=&80807F00:
1110 edfin%!12=&0000FF00:
1120 edfin%!16=&00000000:
1130 ptr%=edfin%:edfin%=edfin%+19
1140 ENDPROC
1150 DEFPROCed_link:
1160 PROCc(cls%,1):IF linkno% PROCpr(0,2,"----Destination-----"):PROCpr(0,3," Skt Chan Cue ")
1170 PROCpr(30,2,"--Source--"):PROCpr(30,3," Skt Chan ")
1180 K$=GET$
1190 ENDPROC
1200 DEFFNf_load:PROCmsg(3,"Loading"):K$=INKEY$(200):K$="":=0
1210 DEFFNf_save:LOCAL K$,multi%,which%,progno2%,temp%:REPEAT
1220 PROCc(cls%,0):PROCc(cls%,1)
1230 PROCpr(0,0,"FILE/SAVE:"):PROCprog
1240 PROCprProg(0,0,0,0):PROCpr(15,3,gap$+"Multi")
1250 REPEAT:K$=GET$
1260 IF K$="A" progno%=(progno%+noprogs%-1)MODnoprogs%:PROCprogX(progno%,which%)
1270 IF K$="B" progno%=(progno%+1)MODnoprogs%:PROCprogX(progno%,which%)
1280 IFmulti%ANDNOTwhich%ANDprogno%>progno2% progno2%=progno%:PROCprogX(progno2%,TRUE)
1290 IFmulti%ANDwhich%ANDprogno%<progno2% progno2%=progno%:PROCprogX(progno2%,FALSE)
1300 IF K$="D" PROCpr(15,3,gap$+"Multi"+STRING$(15," ")):PROCpr(9,1,STRING$(30," ")):PROCpr(36,0," "):multi%=FALSE
1310 IF K$="E" PROCpr(15,3," One "+gap$+" "+gap$+"Last"):multi%=TRUE:PROCpr(36,0,del$+"-"):PROCpr(9,1,"...to"):PROCprogX(progno2%,TRUE):which%=FALSE
1320 IF K$="G" ANDwhich%ANDmulti% which%=FALSE:PROCpr(30,3,gap$+"Last"):PROCpr(36,1," "):PROCpr(36,0,del$+"-"):temp%=progno2%:progno2%=progno%:progno%=temp%
1330 IF K$="H" ANDmulti%ANDNOTwhich% which%=TRUE:PROCpr(30,3,"First"+gap$):PROCpr(36,0," "):PROCpr(36,1,del$+"-"):temp%=progno2%:progno2%=progno%:progno%=temp%
1340 UNTILINSTR("YN",K$)
1350 IFK$="N" ELSE PROCc(cls%,1):IFFNyn("save program(s)") K$="Y" ELSE K$=""
1360 IFK$="Y" PROCmsg(3,"Saving"):K$=INKEY$(200):K$=""
1370 UNTILK$="N":=0
1380 DEFFNf_delt:IF(attr%(ptr%)AND8)<>0 PROCerr("File is locked"):PROCpr(0,2,STRING$(14," ")):K$="":=FALSE
1390 IF NOT FNyn("delete file") :=0
1400 PROCmsg(3,"Deleting"):K$=INKEY$(200):=TRUE
1410 DEFFNf_form:LOCAL a%
1420 IFNOTFNyn("format disk"):=0
1430 PROCc(cls%,0):PROCpr(0,0,"FILE/FORMAT:"):PROCc(cls%,1):PROCmsg(3,"Formatting")
1440 PROCpr(4,1,"|"+STRING$(26,"-")+"|")
1450 FORa%=0 TO 100:PROCpr(5+a%/4,1,"*"):PROCpr(33,1,FNnpad(a%,3)+"%")
1460 NEXT:PROCmsg(3,"Formatting complete"):K$=INKEY$(200):K$=""
1470 =0
1480 DEFFNf_name:LOCAL A$:A$=MNAME$
1490 PROCpr(4,0,"/NAME:"):A$=FNinp(A$,0,1,15,""" ")
1500 IF A$="" :=0
1510 IFFNstrip(A$)<>FNstrip(MNAME$) MNAME$=A$:A%=&FE:Y%=0:A$=STR$((USR&FFDA)AND&FF)+" "+A$:OSCLI"INSTALL "+A$
1520 =0
1530 DEFFNf_renm:=0
1540 ENDPROC
1550 DEFPROCprogX(progno%,which%):IFNOTwhich% PROCprog:ENDPROC
1560 progno$=RIGHT$("0"+STR$(progno%),2):progstart%=progpos%(progno%):progname$=FNpad($progstart%,10)
1570 IF progstart%?11 prot$="*" ELSE prot$=" "
1580 PROCpr(15,1,progno$+" "+prot$+" "+progname$)
1590 ENDPROC
1600 DEFPROCprog
1610 progstart%=progpos%(progno%):progname$=FNpad($progstart%,10)
1620 IF progstart%?11 prot$="*" ELSE prot$=" "
1630 PROCpr(15,0,FNnpad(progno%,12)+" "+prot$+" "+progname$)
1640 ENDPROC
1650 DEFPROCprF(l%,p%)
1660 IFp%<1 PROCpr(22,l%,"-----Catalog-----"):ENDPROC
1670 IFp%>files% PROCpr(22,l%,"--No-More-Files--"):ENDPROC
1680 PROCpr(22,l%,FNpad(file$(p%),15)):IF(attr%(p%)AND8)<>0 PROCpr(37,l%,"* ") ELSE PROCpr(37,l%," ")
1690 ENDPROC
1700 DEFPROCsh_link(link%,ptr%)
1710 PROCclr(1):PROCpr(0,1,"Link "+FNnpad(link%,13)+":")
1720 PROCpr(32,1,"In:"):IF link%=0 PROCpr(12,1,"--System--"):PROCpr(36,1,FNch(edstart%?14,edstart%?15)):ENDPROC
1730 PROCpr(11,1,"Out: "+FNch(ptr%?0,ptr%?1)+" Cue"):IFptr%?2>127 PROCpr(22,1,"---") ELSE PROCpr(22,1,FNnpad(ptr%?2,13))
1740 PROCpr(36,1,FNch(ptr?4,ptr%?5)):ENDPROC
1750 DEFFNch(A%,B%):LOCAL A$:IF A%=0 A$="*" ELSE A$=STR$~A%
1760 IF B%=0 =A$+"/**" ELSE =A$+"/"+FNnpad(B%,12)
1770 DEFPROCprProg(D,D,D,D):PROCpr(0,2,"Program.No"):PROCpr(0,3,arrow$):ENDPROC
1780 DEFPROCupdate(no%):LOCAL len%,offset%,b1%
1790 len%=edstart%!12 AND&FFFF:offset%=progpos%(no%+1)-progpos%(no%)-len%
1800 PROCmove(progpos%(no%+1),progpos%(no%)+len%,progpos%(noprogs%)-progpos%(no%+1))
1810 PROCcopy(edstart%,progpos%(no%))
1820 FOR b1%=no%+1 TO noprogs%
1830 progpos%(b1%)=progpos%(b1%)-offset%
1840 NEXT:ENDPROC
1850 DEFPROCcopy(src%,dst%)
1860 PROCmove(src%,dst%,src%!12 AND&FFFF):ENDPROC
1870 DEFPROCmove(src%,dst%,len%):LOCAL b1%
1880 IF dst%>src% FORb1%=len%-1 TO 0 STEP-1:dst%?b1%=src%?b1%:NEXT:ENDPROC
1890 FORb1%=0 TO len%-1:dst%?b1%=src%?b1%:NEXT:ENDPROC
1900 DEFPROCrd_cat:LOCAL A%,X%,p%,r%:files%=1
1910 X%=ctrl%:Y%=X%DIV256
1920 REPEAT:A%=8:ctrl%!9=p%
1930 ctrl%!1=data%:ctrl%!5=1:CALL &FFD1
1940 r%=ctrl%!5:p%=ctrl%!9
1950 IF r%<>1 THEN ?(data%+?data%+1)=13:file$(files%)=$(data%+1):PROCdo_file
1960 UNTILr%=1:files%=files%-1:ENDPROC
1970 DEFPROCdo_file
1980 $data%=file$(files%):!ctrl%=data%:A%=5:A%=(USR&FFDD)AND&FF:IF A%<>1 ENDPROC
1990 load%(files%)=ctrl%!2:exec%(files%)=ctrl%!6:attr%(files%)=ctrl%!14
2000 files%=files%+1:ENDPROC
2010 :
2020 DEFFNfree:LOCAL A%,X%,Y%,E%:A%=5:IFos%=6:SYS "XOS_FSControl",49,0 TO A%:=A%
2030 X%=&70:CALL &FFDA:=!&70:ENDPROC
2040 DEFFNused:LOCAL A%,X%,Y%,E%:A%=4:IFos%=6:SYS "XOS_FSControl",49,0 TO A%,,E%:=E%-A%
2050 X%=&70:CALL &FFDA:=!&70:ENDPROC
2060 DEFFNtitle:LOCAL A%,X%,Y%
2070 ctrl%!1=data%:X%=ctrl%:Y%=X%DIV256:A%=5:CALL &FFD1
2080 ?(data%+1+?data%)=13:=$(data%+1)
2090 DEFFNyn(A$):LOCAL K$:PROCpr(0,3,FNpad(FNpad("OK to "+A$+"?",26)+"Yes No",40)):REPEATK$=GET$:UNTILK$="F"OR K$="G":PROCclr(3):=K$="F"
2100 DEFFNinp(A$,X%,Y%,L%,R$):LOCAL K$,B$,p%
2110 p%=1:A$=FNpad(A$,L%):B$=A$
2120 PROCpr(0,3,arrow$+" Beg End Ins Del ")
2130 REPEAT PROCpr(X%,Y%,B$):REPEAT K$=FNget
2140 UNTIL INSTR("ABDEGHYN"+CHR$&8A+CHR$&8B,K$)
2150 IF K$=dnkey$ B$=FNmid(B$,p%,-1)
2160 IF K$=upkey$ B$=FNmid(B$,p%,1)
2170 IF K$="A" AND p%>1 p%=p%-1
2180 IF K$="B" AND p%<L% p%=p%+1
2190 IF K$="D" p%=1
2200 IF K$="E" p%=L%
2210 IF K$="G" B$=LEFT$(LEFT$(B$,p%-1)+" "+MID$(B$,p%),L%)
2220 IF K$="H" B$=LEFT$(B$,p%-1)+MID$(B$,p%+1)+" "
2230 IF K$="N" B$=""
2240 UNTIL K$="Y"ORK$="N":PROCclr(3):=B$
2250 DEFFNget:LOCAL K$
2260 REPEAT
2270 PROCpr(X%+p%-1,Y%,CHR$0):IF K$="" K$=INKEY$(50)
2280 PROCpr(X%+p%-1,Y%,MID$(B$,p%,1)):IF K$="" K$=INKEY$(50)
2290 UNTIL K$<>"":=K$
2300 DEFFNmid(A$,p%,i%)
2310 C%=ASC(MID$(A$,p%,1)):REPEAT
2320 C%=C%+i%:IF INSTR(R$,CHR$(C%)) THEN C%=C%+i%
2330 IF C%<32 C%=126
2340 IF C%>126 C%=32
2350 UNTIL INSTR(R$,CHR$(C%))=0
2360 =LEFT$(A$,p%-1)+CHR$(C%)+MID$(A$,p%+1)
2370 DEFFNosb(A%,X%,Y%):=(USR&FFF4 AND&FFFF00)DIV256
2380 DEFPROCmsg(l%,A$):PROCcent(l%,">>> "+A$+" <<<"):ENDPROC
2390 DEFPROCerr(A$):PROCcent(3,"*** "+A$+" ***"):K$=INKEY$(200):K$="":ENDPROC
2400 DEFPROCclr(l%):PROCpr(0,l%AND3,STRING$(40," ")):IFl%<4 ENDPROC
2410 IF(l%AND&F0) PROCpr(0,(l%AND&F0)DIV16,STRING$(40," "))
2420 IF(l%AND&F00) PROCpr(0,(l%AND&FF0)DIV256,STRING$(40," "))
2430 ENDPROC
2440 DEFPROCcent(l%,A$):PROCpr(0,l%,FNpad(STRING$(20-LENA$/2," ")+A$,40)):ENDPROC
2450 DEFPROCdispT:PROCpr(0,1,"<-A-><-B-><-C-><-D-><-E-><-F-><-G-><-H->"):ENDPROC
2460 DEFFNerr:IFos%=6:=REPORT$
2470 LOCAL A$,A%:A%=1+(!&FD AND&FFFF)
2480 REPEAT:A$=A$+CHR$?A%:A%=A%+1:UNTIL?A%=0:=A$
2490 DEFFNpad(A$,B%)=LEFT$(A$+STRING$(B%," "),B%)
2500 DEFFNnpad(A%,B%)
2510 IF B%<11 :=RIGHT$(STRING$(B%," ")+STR$A%,B%) ELSE :=RIGHT$(STRING$(B%-10,"0")+STR$A%,B%-10)
2520 DEFFNstrip(A$):A$=A$+" ":REPEATA$=LEFT$(A$,LENA$-1):UNTILRIGHT$(A$,1)<>" ":=A$
2530 DEFFNosb(A%,X%,Y%):=(USR&FFF4 AND&FFFF00)DIV256
2540 DEFPROCpr(X%,Y%,A$):IFA$="" ENDPROC
2550 IFvdu%:PRINTTAB(X%,Y%);A$;:ENDPROC
2560 B%=-(Y%>1):X%=X%+64*(Y% MOD 2)
2570 PROCc(128+X%,B%):base%=&FC83-2*B%
2580 A%=147:X%=base%:FOR P%=1 TO LEN(A$)
2590 Y%=ASCMID$(A$,P%,1):CALL&FFF4
2600 NEXT:ENDPROC
2610 DEFPROCc(Y%,B%):LOCAL A%,X%
2620 IFvdu%:IFcls%:CLS:PRINTTAB(38,3);:FORA%=0TO8:PRINT" f";k0%+A%;:NEXT:PRINT": NO/BACK"SPC12"f";k0%+9;": YES/ENTER":ENDPROC
2630 IFvdu%:ENDPROC
2640 X%=&FC82-2*B%:A%=146
2650 REPEATUNTIL(USR&FFF4 AND&800000)=0
2660 A%=147:CALL&FFF4:A%=146:REPEATUNTIL(USR&FFF4 AND&800000)=0
2670 IF Y%<>doff% Y%=don%:A%=147:CALL&FFF4
2680 ENDPROC