source: branches/virtualcpu4/Forms/UFormDisassembler.pas

Last change on this file was 184, checked in by chronos, 6 years ago
  • Added: Basic assembler window.
File size: 1.5 KB
Line 
1unit UFormDisassembler;
2
3{$mode delphi}
4
5interface
6
7uses
8 Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ComCtrls, StdCtrls,
9 UDisassembler;
10
11type
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
30var
31 FormDisassembler: TFormDisassembler;
32
33implementation
34
35{$R *.lfm}
36
37{ TFormDisassembler }
38
39procedure TFormDisassembler.FormCreate(Sender: TObject);
40begin
41 Disassembler := TDisassembler.Create;
42end;
43
44procedure TFormDisassembler.ButtonReloadClick(Sender: TObject);
45begin
46 Disassembler.Process;
47 Reload;
48end;
49
50procedure TFormDisassembler.FormDestroy(Sender: TObject);
51begin
52 Disassembler.Free;
53end;
54
55procedure TFormDisassembler.FormShow(Sender: TObject);
56begin
57 ButtonReload.Click;
58end;
59
60procedure TFormDisassembler.ListView1Data(Sender: TObject; Item: TListItem);
61begin
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;
68end;
69
70procedure TFormDisassembler.Reload;
71begin
72 ListView1.Items.Count := Disassembler.Output.Count;
73 ListView1.Refresh;
74end;
75
76end.
77
Note: See TracBrowser for help on using the repository browser.