> MkData 1.11 - Create DATA statements from binary file # v1.00 28-Feb-1993 J.G.Harston (D v1.10 22-Nov-1993 Saves initial dummy file, counts line number 2' v1.11 18-Aug-2006 Added tokeniser <: F"Data file: "in$ P"Output file: "out$ Z1"Spool or Basic file? (S/B) ";:f%=get("SB") d+"Start line number: "ln%:ln%=0:ln%=10 n+ ctrl% 31,name% 255:X%=ctrl%:Y%=X%256 xin%=0:out%=0::close:: HA%=file(in$,5):ld%=X%!2:ex%=X%!6:sz%=X%!10:at%=X%!14:A%:in%=(in$) &in%=0:"File '"in$"' not found": VA$="SAVE "+out$+" 0+"+~(sz%*3)+" FFFF0000 FFFFF":f%=66:A$=A$+"B00" A$=A$+"F00" A$:out%=(out$) 'A$="REM > "+out$:line:A$=":":line A$:line:A$:A$="*" A$="RESTORE "+ln%:line @A$="DATA "+in$+","+~ld%+","+~ex%+","+~sz%+","+~at%:line A$="":sum%=0:n%=16: 4b%=#in%:sum%=sum%+b%:A$=A$+"0"+~b%,2):n%=n%-1 n%=0 #in% BA$="DATA "+A$+","+~sum%:;ln%;" ";A$;" ";ĩA$,8);13;:line #in%:46;11:#in%:in%=0 f%=66:#out%,13:#out%,255 #out%:out%=0: : " line ,@f%=66:A$=Tokenise_(A$):A$=&8B:A$=A$,5): RISC OS Bugfix 6Pf%=66:A$=13+(ln%256)+(ln%)+(4+A$)+A$ A$=" "+ln%,6)+" "+A$+13 @4$name%=A$:gbpb(2,out%,name%,A$,0):ln%=ln%+10: J'ݤget(A$): A%:A%= &DF:A$,A%) T2+2*A$,127);A%:=A% ^"close:in%:A%=in%:in%=0:#A% hout%:A%=out%:out%=0:#A% r |Bݤfile(A$,A%):$name%=A$:?X%=name%:X%?1=name%256:=(&FFDD)&FF Ugbpb(A%,chn%,addr%,num%,ptr%):?X%=chn%:X%!1=addr%:X%!5=num%:X%!9=ptr%: &FFD1: : 6 "READfn$,ld$,ex$,len$,at$:len%=EVAL(""&""+len$)" 6 "IFH.-TOP-2500EVAL(""&""+B$):P.""Checksum error in DATA line "";ln%:END"  "U.ptr%-mem%>=len%" L "OS.""SAVE ""+fn$+"" ""+STR$~mem%+"" ""+STR$~ptr%+"" ""+ex$+"" ""+ld$"  "END",":",* : CݤTokenise_(A$):<&8000:=Tokenise_65(A$) =Tokenise_ARM(A$) ݤTokenise_65(A$): A%,B% 'A%=!4&FFFF:A%=A%-A$-1+4*(A%?-1>0) &B%=("0:"+A$):=$A% 0ݤTokenise_ARM(A$): A%,B% :,ș "XOS_GenerateError",0,255,"*") ,A% D2A%!-36=0:B%=("0:"+A$):=$(A%-14+4*(A%!-36<>0))