source: branches/UltimatOS/Forms/UFormMemory.pas

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 
1unit UFormMemory;
2
3interface
4
5uses
6 Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ComCtrls, UMemory;
7
8type
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
23var
24 FormMemory: TFormMemory;
25
26
27implementation
28
29{$R *.lfm}
30
31{ TFormMemory }
32
33procedure TFormMemory.ListView1Data(Sender: TObject; Item: TListItem);
34var
35 Data: string;
36 I: Integer;
37begin
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;
51end;
52
53procedure TFormMemory.FormShow(Sender: TObject);
54begin
55 ReloadList;
56end;
57
58procedure TFormMemory.ReloadList;
59begin
60 if Assigned(Memory) then begin
61 ListView1.Items.Count := Memory.Size div 16;
62 ListView1.Refresh;
63 end else ListView1.Items.Count := 0;
64end;
65
66end.
67
Note: See TracBrowser for help on using the repository browser.