home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2000 February
/
Chip_2000-02_cd.bin
/
zkuste
/
Delphi
/
navody
/
tt
/
objvm.exe
/
UNITS
/
Decompiler.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1998-06-26
|
989b
|
36 lines
unit Decompiler;
interface
uses
Code,Classes,Decomps,ObjList,OpCodes,SysUtils;
{Decompile code c and add string representation to s }
procedure Decompile(c:TCode;s:TStrings);
implementation
procedure Decompile;
Var d:TObjList;
Pos:Integer;
i:Integer;
decomp:TOpDecomp;
begin
s.Clear;
d:=TObjList.Create;
Decomps.Register(d);
try
Pos:=0;
repeat
for i:=0 to d.Count-1 do
begin
Decomp:=d.Obj[i] as TOpDecomp;
if Decomp.OpCode=c.Int[Pos] then break;
end;
s.Add(IntToStr(Pos)+': '+Decomp.AsString(c,Pos));
Pos:=Pos+Decomp.Length(c,Pos);
until c.Int[Pos]=ocHalt;
d.Free;
except
d.Free;
raise;
end;
end;
end.