> TAPCat 1.15  (C) J.G.Harston  List files in TAP files ( v1.11 Added TZX support 2/ v1.15 Added -dec option, cleaned filename <: F! :Close_All::exit(): PKmax%=&20: ctrl% 31,mem% max%-1,type$(3):X%=ctrl%:Y%=X%256:in%=0:rd%=4 Z%A$=OS_GetEnv:os%>31:Win_TextIO d'ro$="":A$="":"Input TAP file: "A$ n2A%=A$+" "," "):A%:in$=A$,A%-1):A$=A$,A%+1) x2A%=A$+" "," "):A%:ro$=A$,A%-1):A$=A$,A%+1) Ain$="-?":"Syntax: TAPCat (-hex|-dec)":exit(0): ?in%=f_openin(in$):in%=0:"'"in$"' not found":exit(214): Gtype$(0)="Basic":type$(2)="Num ":type$(3)="Char ":type$(3)="Bytes" &gbpb(rd%,in%,mem%,10,0):mem%?7=13 8tap%=(($mem%="ZXTape!"4))(((!mem%&FFFFFF)=&11)1) (tap%4)=0:#in%=0 : ro%=ro$,2)="-r" hx%=ro$,2)<>"-d" Jro%=0: "Filename Type "(2+hx%)"Len"(2+hx%)"Start"(2+hx%)"Extr"; +ro% : "Filename Start Len Extr";  ((tap%4):#in%=&10:A%=#in%+#in% !len%=#in%+256*#in%+(tap%1) @len%>max% :gbpb(rd%,in%,mem%,max%,0):#in%=#in%+len%-max% 0len%<=max%:len%:gbpb(rd%,in%,mem%,len%,0) "?mem%=0 :header ,?mem%=&FF:data 6 #in%::#in%:in%=0 @exit(0): J: T header ^type%=mem%?1 h1m%=mem%?12:mem%?12=13:f$=$(mem%+2):mem%?12=m% rnum% =mem%!12 &FFFF |start%=mem%!14 &FFFF exec% =mem%!16 &FFFF 'fn_clean(f$);" "; Kro%:hi(type%)h0(start%,4)"+"h0(num%,4)" "hi(type%)h0(exec%,4);: 3type%<4:type$(type%); " &"h0(type%,2)" "; < hx% : " "h0(num%,4)" "h0(start%,4)" "h0(exec%,4); 9 hx%=0: " "d(num%,5)" "d(start%,5)" "d(exec%,5);  :  data: : ݤfn_clean(A$): A$="":="" L A%=1 A$: A$,A%,1)<" " A$,A%,1)>"~":A$=A$,A%-1)+"_"+A$,A%+1)  :=A$ : *ݤhi(A%):A%<3:=h0(A%,2) =h0(-1,2) #ݤh0(A%,N%)="0000000"+~A%,N%) &!ݤd(A%,N%)=" "+A%,N%) 0: :Close_All:*EXEC D"in%=in%:in%:A%=in%:in%=0:#A% N X: b!ݤf_openin(A$)=(f_name(A$)) lVݤf_name(A$):os%>31:A%,B%:B%=A%:A%=A$,"\",A%+1):A%=0:A$,".",B%)=0:A$=A$+"." v=A$ : #gbpb(A%,chn%,addr%,num%,ptr%) ??X%=chn%:X%!1=addr%:X%!5=num%:X%!9=ptr%:<&FFFFF: &FFD1: A%=1A%=3:#?X%=X%!9 5:A%=1A%=2:#?X%,?X%!1 A%=3A%=4:?X%!1=#?X% 5X%!1=X%!1+1:X%!5=X%!5-1:(#?X% A%>2) X%!5<1: : BݤOS_GetEnv:A%,X%,Y%,P%,A$:X%=1:os%=((&FFF4)&FF00)256:X% d!=&D7C1C7C5:run$=ARGV$(0):ARGC:A%=1ARGC:A$=A$+ARGV$(A%)+" "::=A$,A$-1)!=&D7C1C7C5:="" _>&FFFFF:X%256:A$=@cmd$:ș"GetModuleFileName",0,X%,255:run$=$$X%:Y%=@lib$,@tmp$)=0:P%= P%=0:>&FFFF:run$=$&8100:ș"OS_GetEnv"A$,,A%:ș"OS_WriteEnv","",A%:A$=A$,1+A$+" "," ",1+A$," "))):P%=:Y%=:A$," ")=0:A$=run$+" " P%=0:P%=X%:[OPT 0:NOP:]:P%=?X%:Y%=:P%=&EAP%=18:A$=$&600 P%=0:A$=$(-&300)P%=&A0:A$=$(^@%-256):Y%=?(-2)64P%=&90:A$=$&100:Y%=!&200 KA$=" "+A$:A$=A$,2):A$<>32:A$=34:A%=A$,"""",2)+1A%=A$+" "," ") (Y%:run$=A$,A%-1):A$=A$,A%+1):Y%=0  A$<>32:=A$ :  &os(A$):A$=42:A$ A$<>"":A$ * 4: >Fexit(A%):"FX1,"+(A%255):quit$=quit$:A$=quit$:quit$="":os(A$) H>&FFFFF:Ș A% R \: fWin_TextIO p0ș "GetStdHandle",-10 @hfile%(1):*INPUT 13 z1ș "GetStdHandle",-11 @hfile%(2):*OUTPUT 14 &ș "SetConsoleMode",@hfile%(1),0: :