Line | |
---|
1 | unit FormMemory;
|
---|
2 |
|
---|
3 | interface
|
---|
4 |
|
---|
5 | uses
|
---|
6 | Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ComCtrls, ExtCtrls,
|
---|
7 | Memory;
|
---|
8 |
|
---|
9 | type
|
---|
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 |
|
---|
26 | var
|
---|
27 | FormMemory: TFormMemory;
|
---|
28 |
|
---|
29 | const
|
---|
30 | ItemsPerLine = 16;
|
---|
31 |
|
---|
32 |
|
---|
33 | implementation
|
---|
34 |
|
---|
35 | {$R *.lfm}
|
---|
36 |
|
---|
37 | procedure TFormMemory.Reload;
|
---|
38 | begin
|
---|
39 | ListViewMemory.Items.Count := Size div ItemsPerLine;
|
---|
40 | ListViewMemory.Refresh;
|
---|
41 | end;
|
---|
42 |
|
---|
43 | procedure TFormMemory.ListViewMemoryData(Sender: TObject; Item: TListItem);
|
---|
44 | var
|
---|
45 | Line: string;
|
---|
46 | I: Integer;
|
---|
47 | Text: string;
|
---|
48 | One: Byte;
|
---|
49 | begin
|
---|
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;
|
---|
63 | end;
|
---|
64 |
|
---|
65 | procedure TFormMemory.FormShow(Sender: TObject);
|
---|
66 | begin
|
---|
67 | Reload;
|
---|
68 | end;
|
---|
69 |
|
---|
70 | procedure TFormMemory.Timer1Timer(Sender: TObject);
|
---|
71 | begin
|
---|
72 | if Visible then Reload;
|
---|
73 | end;
|
---|
74 |
|
---|
75 | end.
|
---|
76 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.