Last change
on this file was 30, checked in by chronos, 2 years ago |
- Modified: Improved sample code execution.
- Added: Memory map form.
|
File size:
1.3 KB
|
Line | |
---|
1 | unit UFormMemory;
|
---|
2 |
|
---|
3 | interface
|
---|
4 |
|
---|
5 | uses
|
---|
6 | Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ComCtrls, UMemory;
|
---|
7 |
|
---|
8 | type
|
---|
9 |
|
---|
10 | { TFormMemory }
|
---|
11 |
|
---|
12 | TFormMemory = class(TForm)
|
---|
13 | ListView1: TListView;
|
---|
14 | procedure FormShow(Sender: TObject);
|
---|
15 | procedure ListView1Data(Sender: TObject; Item: TListItem);
|
---|
16 | private
|
---|
17 |
|
---|
18 | public
|
---|
19 | Memory: TMemory;
|
---|
20 | procedure ReloadList;
|
---|
21 | end;
|
---|
22 |
|
---|
23 | var
|
---|
24 | FormMemory: TFormMemory;
|
---|
25 |
|
---|
26 |
|
---|
27 | implementation
|
---|
28 |
|
---|
29 | {$R *.lfm}
|
---|
30 |
|
---|
31 | { TFormMemory }
|
---|
32 |
|
---|
33 | procedure TFormMemory.ListView1Data(Sender: TObject; Item: TListItem);
|
---|
34 | var
|
---|
35 | Data: string;
|
---|
36 | I: Integer;
|
---|
37 | begin
|
---|
38 | if Item.Index < Memory.Size div 16 then begin
|
---|
39 | Item.Caption := IntToHex(Item.Index * 16, 8);
|
---|
40 | Data := '';
|
---|
41 | for I := 0 to 15 do
|
---|
42 | Data := Data + ' ' + IntToHex(Memory.Data[Item.Index * 16 + I], 2);
|
---|
43 | Item.SubItems.Add(Trim(Data));
|
---|
44 | Data := '';
|
---|
45 | for I := 0 to 15 do
|
---|
46 | if Memory.Data[Item.Index * 16 + I] >= 32 then
|
---|
47 | Data := Data + Chr(Memory.Data[Item.Index * 16 + I])
|
---|
48 | else Data := Data + '.';
|
---|
49 | Item.SubItems.Add(Data);
|
---|
50 | end;
|
---|
51 | end;
|
---|
52 |
|
---|
53 | procedure TFormMemory.FormShow(Sender: TObject);
|
---|
54 | begin
|
---|
55 | ReloadList;
|
---|
56 | end;
|
---|
57 |
|
---|
58 | procedure TFormMemory.ReloadList;
|
---|
59 | begin
|
---|
60 | if Assigned(Memory) then begin
|
---|
61 | ListView1.Items.Count := Memory.Size div 16;
|
---|
62 | ListView1.Refresh;
|
---|
63 | end else ListView1.Items.Count := 0;
|
---|
64 | end;
|
---|
65 |
|
---|
66 | end.
|
---|
67 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.