-
Notifications
You must be signed in to change notification settings - Fork 5
/
InfoUnit.pas
147 lines (125 loc) · 3.96 KB
/
InfoUnit.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
unit InfoUnit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, ComCtrls;
type
TInfoForm = class(TForm)
Bevel1: TBevel;
Bevel2: TBevel;
Bevel3: TBevel;
Bevel4: TBevel;
Bevel5: TBevel;
Bevel6: TBevel;
Label1: TLabel;
HubTopLabel: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
Label10: TLabel;
Label11: TLabel;
Label12: TLabel;
MapImage: TImage;
ProgramLabel: TLabel;
VariableLabel: TLabel;
StackLabel: TLabel;
ClockLabel: TLabel;
FreqLabel: TLabel;
InputFreqLabel: TLabel;
OkButton: TButton;
Label13: TLabel;
InterpreterLabel: TLabel;
Bevel7: TBevel;
Label15: TLabel;
Bevel8: TBevel;
Label2: TLabel;
DebuggerLabel: TLabel;
Label16: TLabel;
Bevel9: TBevel;
procedure FormActivate(Sender: TObject);
procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
private
{ Private declarations }
public
{ Public declarations }
end;
var
InfoForm: TInfoForm;
implementation
uses GlobalUnit;
{$R *.dfm}
procedure TInfoForm.FormActivate(Sender: TObject);
var
stksize, debugsize: integer;
objx, varx, stkx, debx: integer;
osc: string;
begin
Caption := ExtFilename(ExtractFilename(TopFile), 'bin');
HubTopLabel.Caption := '$' + IntToHex(HubLimit - 1,1);
if P2.DebugMode then debugsize := $4000 else debugsize := 0;
stksize := HubLimit - debugsize - P2.SizeVar - P2.SizeObj - P2.SizeInterpreter;
objx := MapImage.Width * (P2.SizeInterpreter) div HubLimit;
varx := MapImage.Width * (P2.SizeInterpreter + P2.SizeObj) div HubLimit;
stkx := MapImage.Width * (P2.SizeInterpreter + P2.SizeObj + P2.SizeVar) div HubLimit;
debx := MapImage.Width * (HubLimit - debugsize) div HubLimit;
MapImage.Canvas.Pen.Style := psClear;
MapImage.Canvas.Brush.Style := bsSolid;
MapImage.Canvas.Brush.Color := clWhite;
MapImage.Canvas.Rectangle(0,0, objx+1, MapImage.Height+1);
MapImage.Canvas.Brush.Color := clRed;
MapImage.Canvas.Rectangle(objx,0, varx+1, MapImage.Height+1);
MapImage.Canvas.Brush.Color := clYellow;
MapImage.Canvas.Rectangle(varx,0, stkx+1, MapImage.Height+1);
MapImage.Canvas.Brush.Color := clAqua;
MapImage.Canvas.Rectangle(stkx,0, debx+1, MapImage.Height+1);
MapImage.Canvas.Brush.Color := clBlack;
MapImage.Canvas.Rectangle(debx,0, MapImage.Width+1, MapImage.Height+1);
InterpreterLabel.Caption := Format('%6.0n', [P2.SizeInterpreter * 1.0]) + ' bytes';
ProgramLabel.Caption := Format('%6.0n', [P2.SizeObj * 1.0]) + ' bytes';
VariableLabel.Caption := Format('%6.0n', [P2.SizeVar * 1.0]) + ' bytes';
StackLabel.Caption := Format('%6.0n', [stksize * 1.0]) + ' bytes';
DebuggerLabel.Caption := Format('%6.0n', [debugsize * 1.0]) + ' bytes';
case P2.ClkMode and $C shr 2 of
0: osc := 'XI <off>';
1: osc := 'XINPUT';
2: osc := '7pF XTAL';
3: osc := '15pF XTAL';
end;
if P2.ClkMode and 3 = 0 then
begin
ClockLabel.Caption := 'RCFAST';
FreqLabel.Caption := '> 20 MHz';
InputFreqLabel.Caption := '<ignored>';
end
else
if P2.ClkMode and 3 = 1 then
begin
ClockLabel.Caption := 'RCSLOW';
FreqLabel.Caption := '~ 20 KHz';
InputFreqLabel.Caption := '<ignored>';
end
else
begin
FreqLabel.Caption := Format('%10.0n', [P2.ClkFreq * 1.0]) + ' Hz';
if P2.ClkMode and 3 = 2 then
begin
ClockLabel.Caption := osc;
InputFreqLabel.Caption := FreqLabel.Caption;
end
else
begin
ClockLabel.Caption := osc + ' + PLL';
InputFreqLabel.Caption := Format('%10.0n', [P2.XinFreq * 1.0]) + ' Hz';
end;
end;
end;
procedure TInfoForm.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
ModalResult := mrOK;
end;
end.