source: trunk/Forms/FormMemory.pas

Last change on this file was 2, checked in by chronos, 16 months ago
  • Added: Initial development version.
File size: 1.5 KB
Line 
1unit FormMemory;
2
3interface
4
5uses
6 Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ComCtrls, ExtCtrls,
7 Memory;
8
9type
10 TReadEvent = function (Address: Word): Byte of object;
11
12 { TFormMemory }
13
14 TFormMemory = class(TForm)
15 ListViewMemory: TListView;
16 Timer1: TTimer;
17 procedure FormShow(Sender: TObject);
18 procedure ListViewMemoryData(Sender: TObject; Item: TListItem);
19 procedure Timer1Timer(Sender: TObject);
20 public
21 Memory: TMemory;
22 Size: Integer;
23 procedure Reload;
24 end;
25
26var
27 FormMemory: TFormMemory;
28
29const
30 ItemsPerLine = 16;
31
32
33implementation
34
35{$R *.lfm}
36
37procedure TFormMemory.Reload;
38begin
39 ListViewMemory.Items.Count := Size div ItemsPerLine;
40 ListViewMemory.Refresh;
41end;
42
43procedure TFormMemory.ListViewMemoryData(Sender: TObject; Item: TListItem);
44var
45 Line: string;
46 I: Integer;
47 Text: string;
48 One: Byte;
49begin
50 if Item.Index < Size div ItemsPerLine then begin
51 Line := '';
52 Text := '';
53 for I := 0 to ItemsPerLine - 1 do begin
54 One := Memory.Read(Item.Index * ItemsPerLine + I);
55 Line := Line + IntToHex(One, 2) + ' ';
56 if One >= 32 then Text := Text + Char(One)
57 else Text := Text + ' ';
58 end;
59 Item.Caption := IntToHex(Item.Index * ItemsPerLine, 8);
60 Item.SubItems.Add(Line);
61 Item.SubItems.Add(Text);
62 end;
63end;
64
65procedure TFormMemory.FormShow(Sender: TObject);
66begin
67 Reload;
68end;
69
70procedure TFormMemory.Timer1Timer(Sender: TObject);
71begin
72 if Visible then Reload;
73end;
74
75end.
76
Note: See TracBrowser for help on using the repository browser.