@echo off REM Redcode to System 4 converter - 8/14/00 WTN REM updated 8/15/00 if .%2==. goto help if exist %1 goto start echo Error: file not found :help echo Usage: %0 infile outfile echo infile = existing redcode file echo outfile = sys4 file to create echo Note - ORG/END x not supported! echo QBASIC and PMARS must be on path goto end :start set maxlen=25 REM *** trim comments, replace with ;assert 1 echo ;assert 1> rmconv.tmp type %1 | find/v ";" >> rmconv.tmp REM *** use pmars to generate listing pmars rmconv.tmp > rclist.tmp del rmconv.tmp REM *** generate qbasic convert program echo> conv_.bas :on error goto done echo>>conv_.bas open "rclist.tmp" for input as #1 echo>>conv_.bas open "%2" for output as #2 echo>>conv_.bas line input #1,a$ echo>>conv_.bas line input #1,a$ 'skip 1st 3 lines echo>>conv_.bas line input #1,a$ echo>>conv_.bas ?#2,";System 4 warrior" echo>>conv_.bas ?#2,";name ZzWhatever (1,1)" echo>>conv_.bas ?#2,";assert 1" echo>>conv_.bas ?#2,"":lcnt=0 echo>>conv_.bas fileloop: line input #1,a$ echo>>conv_.bas if a$="" goto finish echo>>conv_.bas i$=mid$(a$,8,6) echo>>conv_.bas a1$=mid$(a$,15,1) echo>>conv_.bas d1=val(mid$(a$,17,5)) echo>>conv_.bas a2$=mid$(a$,24,1) echo>>conv_.bas d2=val(mid$(a$,26,5)) echo>>conv_.bas l$="L"+ltrim$(rtrim$(str$(lcnt))) echo>>conv_.bas df1$=ltrim$(rtrim$(str$(d1))) echo>>conv_.bas df2$=ltrim$(rtrim$(str$(d2))) echo>>conv_.bas if not sgn(lcnt+d1)=-1 then echo>>conv_.bas if sgn(%maxlen%-(lcnt+d1))=1 then echo>>conv_.bas df1$="L"+ltrim$(rtrim$(str$(lcnt+d1))) echo>>conv_.bas end if echo>>conv_.bas end if echo>>conv_.bas if not sgn(lcnt+d2)=-1 then echo>>conv_.bas if sgn(%maxlen%-(lcnt+d2))=1 then echo>>conv_.bas df2$="L"+ltrim$(rtrim$(str$(lcnt+d2))) echo>>conv_.bas end if echo>>conv_.bas end if echo>>conv_.bas t$=chr$(9):l$=l$+t$+i$+t$+a1$+" "+df1$ echo>>conv_.bas l$=l$+","+t$+a2$+" "+df2$:?#2,l$ echo>>conv_.bas lcnt=lcnt+1:goto fileloop echo>>conv_.bas finish: while sgn(%maxlen%-lcnt)=1 echo>>conv_.bas l$="L"+ltrim$(rtrim$(str$(lcnt))) echo>>conv_.bas ?#2,l$;t$;"DAT.F";t$;"# 0,";t$;"# 0";t$;";buffer" echo>>conv_.bas lcnt=lcnt+1:wend echo>>conv_.bas done: close:system REM *** run qbasic program qbasic /run conv_.bas REM *** delete temp files del rclist.tmp del conv_.bas REM *** see if it worked if exist %2 echo System 4 file %2 created. if not exist %2 echo Failed. :end