{$M 8192, 0, 100000} Uses Crt, Dos, UScreen; Var F : Text; G : File; DataW, I : Word; Data : Byte; FileName, OutFile, Line : String; TotalCar : Word; Procedure ExitProg; Begin TextColor(7); TextBackGround(0); ClrScr; WriteLn('TxtTo89 v1.0 by Philippe Gervaise aKa CandyMan'); Halt; End; Begin Assign(F, 'MakeData.exe'); {$I-} Reset(F); If IoResult <> 0 Then Begin WriteLn('File MakeData.exe not found in the current directory'); Halt; End; {$I+} Close(F); Car := Car2; FileName := OpenFile('*.*'); If FileName = '' Then ExitProg; Assign(F, FileName); Assign(G, 'Txt.Tmp'); Reset(F); ReWrite(G, 1); BlockWrite(G, DataW, 2); {Juste pour ecrire 2 octets, pour plus tard} TotalCar := 0; While Not(Eof(F)) Do Begin ReadLn(F, Line); Data := 32; {Debut de ligne pour la calculatrice} BlockWrite(G, Data, 1); Inc(TotalCar); Data := 13; {Fin de ligne pour la calculatrice} For I := 1 To Length(Line) Do Begin BlockWrite(G, Line[I], 1); Inc(TotalCar); End; If Not(Eof(F)) Then Begin BlockWrite(G, Data, 1); {Prepare pour une autre ligne} Inc(TotalCar); End; End; DataW := 224 * 256; {ID de texte} BlockWrite(G, DataW, 2); Seek(G, 0); DataW := 256; {La position courante} BlockWrite(G, DataW, 2); Close(F); Close(G); OutFile := Copy(FileName, 1, Pos('.', FileName) - 1); SwapVectors; Exec(GetEnv('COMSPEC'), '/C MakeData txt.tmp ' + OutFile + '.89t main'); SwapVectors; Erase(G); ExitProg; End.