1 | unit UFormDisassembler;
|
---|
2 |
|
---|
3 | {$mode delphi}
|
---|
4 |
|
---|
5 | interface
|
---|
6 |
|
---|
7 | uses
|
---|
8 | Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ComCtrls, StdCtrls,
|
---|
9 | UDisassembler;
|
---|
10 |
|
---|
11 | type
|
---|
12 |
|
---|
13 | { TFormDisassembler }
|
---|
14 |
|
---|
15 | TFormDisassembler = class(TForm)
|
---|
16 | ButtonReload: TButton;
|
---|
17 | ListView1: TListView;
|
---|
18 | procedure ButtonReloadClick(Sender: TObject);
|
---|
19 | procedure FormCreate(Sender: TObject);
|
---|
20 | procedure FormDestroy(Sender: TObject);
|
---|
21 | procedure FormShow(Sender: TObject);
|
---|
22 | procedure ListView1Data(Sender: TObject; Item: TListItem);
|
---|
23 | private
|
---|
24 |
|
---|
25 | public
|
---|
26 | Disassembler: TDisassembler;
|
---|
27 | procedure Reload;
|
---|
28 | end;
|
---|
29 |
|
---|
30 | var
|
---|
31 | FormDisassembler: TFormDisassembler;
|
---|
32 |
|
---|
33 | implementation
|
---|
34 |
|
---|
35 | {$R *.lfm}
|
---|
36 |
|
---|
37 | { TFormDisassembler }
|
---|
38 |
|
---|
39 | procedure TFormDisassembler.FormCreate(Sender: TObject);
|
---|
40 | begin
|
---|
41 | Disassembler := TDisassembler.Create;
|
---|
42 | end;
|
---|
43 |
|
---|
44 | procedure TFormDisassembler.ButtonReloadClick(Sender: TObject);
|
---|
45 | begin
|
---|
46 | Disassembler.Process;
|
---|
47 | Reload;
|
---|
48 | end;
|
---|
49 |
|
---|
50 | procedure TFormDisassembler.FormDestroy(Sender: TObject);
|
---|
51 | begin
|
---|
52 | Disassembler.Free;
|
---|
53 | end;
|
---|
54 |
|
---|
55 | procedure TFormDisassembler.FormShow(Sender: TObject);
|
---|
56 | begin
|
---|
57 | ButtonReload.Click;
|
---|
58 | end;
|
---|
59 |
|
---|
60 | procedure TFormDisassembler.ListView1Data(Sender: TObject; Item: TListItem);
|
---|
61 | begin
|
---|
62 | if Item.Index < Disassembler.Output.Count then
|
---|
63 | with TDisassemblerLine(Disassembler.Output[Item.Index]) do begin
|
---|
64 | Item.Caption := IntToHex(Address, 8);
|
---|
65 | Item.SubItems.Add(Opcode);
|
---|
66 | Item.SubItems.Add(Instruction);
|
---|
67 | end;
|
---|
68 | end;
|
---|
69 |
|
---|
70 | procedure TFormDisassembler.Reload;
|
---|
71 | begin
|
---|
72 | ListView1.Items.Count := Disassembler.Output.Count;
|
---|
73 | ListView1.Refresh;
|
---|
74 | end;
|
---|
75 |
|
---|
76 | end.
|
---|
77 |
|
---|