2023-10-03 08:54:45 +00:00
|
|
|
program undump;
|
|
|
|
{
|
|
|
|
undump is a program to take the output from dump
|
|
|
|
and put it into binary format.
|
|
|
|
}
|
2023-10-03 19:28:45 +00:00
|
|
|
|
|
|
|
{$I 'binary.pas'}
|
|
|
|
{$I 'ihex.pas'}
|
|
|
|
|
2023-10-03 23:19:22 +00:00
|
|
|
type
|
|
|
|
FilePath = String[12];
|
|
|
|
|
|
|
|
Procedure DumpIHex(iname, oname : FilePath);
|
|
|
|
var
|
|
|
|
inf : Text;
|
|
|
|
outf : Text;
|
|
|
|
line : LnStr;
|
|
|
|
rec : IRec;
|
2023-10-03 19:28:45 +00:00
|
|
|
begin
|
2023-10-03 23:19:22 +00:00
|
|
|
if iname <> '' then
|
|
|
|
begin
|
|
|
|
Assign(inf, iname);
|
|
|
|
Reset(inf);
|
|
|
|
end else inf := Input;
|
|
|
|
|
|
|
|
if oname <> '' then
|
|
|
|
begin
|
|
|
|
Assign(outf, oname);
|
|
|
|
Rewrite(outf);
|
|
|
|
end else outf := Output;
|
|
|
|
|
|
|
|
while not EOF(inf) do
|
|
|
|
begin
|
|
|
|
ReadLn(inf, line);
|
|
|
|
if (Line <> '') then
|
|
|
|
begin
|
|
|
|
rec := RdDumpLn(line);
|
|
|
|
WrRec(rec, outf);
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
|
|
|
Close(inf);
|
|
|
|
Writeln(outf, IRecEOF);
|
|
|
|
Flush(outf);
|
|
|
|
Close(outf);
|
|
|
|
end;
|
|
|
|
|
|
|
|
procedure PrnHelp;
|
|
|
|
begin
|
|
|
|
WriteLn('UNDUMP V1.0');
|
|
|
|
WriteLn('Converts DUMP.COM output to Intel Hex format');
|
|
|
|
WriteLn('');
|
|
|
|
WriteLn('Usage:');
|
|
|
|
WriteLn(' UNDUMP.COM INFILE OUTFILE');
|
|
|
|
Halt;
|
|
|
|
end;
|
|
|
|
|
|
|
|
var
|
|
|
|
i, argc : Integer;
|
|
|
|
rec : irec;
|
|
|
|
opts : record
|
|
|
|
ShoVer : Boolean;
|
|
|
|
InFile : FilePath;
|
|
|
|
OutFile : FilePath;
|
|
|
|
end;
|
|
|
|
param : String[255];
|
|
|
|
begin
|
|
|
|
opts.ShoVer := False;
|
|
|
|
opts.InFile := '';
|
|
|
|
opts.OutFile := '';
|
|
|
|
argc := ParamCount;
|
|
|
|
|
|
|
|
for i := 1 to ParamCount do
|
|
|
|
begin
|
|
|
|
if ParamStr(i) = '-h' or ParamStr(i) = 'H' then
|
|
|
|
begin
|
|
|
|
opts.ShoVer := True;
|
|
|
|
argc := argc - 1;
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
|
|
|
if opts.ShoVer then PrnHelp();
|
|
|
|
|
|
|
|
i := ParamCount - argc + 1;
|
|
|
|
|
|
|
|
if i = 1 then opts.OutFile := ParamStr(ParamCount);
|
|
|
|
if i > 1 then
|
|
|
|
begin
|
|
|
|
InFile := ParamStr(i);
|
|
|
|
OutFile := ParamStr(i+1);
|
|
|
|
end;
|
|
|
|
|
|
|
|
DumpIHex(InFile, OutFile);
|
2023-10-03 19:28:45 +00:00
|
|
|
end.
|