-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathExportZX.pas
More file actions
188 lines (173 loc) · 4.27 KB
/
ExportZX.pas
File metadata and controls
188 lines (173 loc) · 4.27 KB
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
{
This is part of Vortex Tracker II project
(c)2000-2009 S.V.Bulba
Author: Sergey Bulba, vorobey@mail.khstu.ru
Support page: http://bulba.untergrund.net/
Version 2.0 and later
(c)2017-2021 Ivan Pirog, ivan.pirog@gmail.com
https://github.com/ivanpirog/vortextracker
}
unit ExportZX;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls;
type
TExpDlg = class(TForm)
Button1: TButton;
Button2: TButton;
GroupBox1: TGroupBox;
Edit2: TEdit;
Label3: TLabel;
Edit1: TEdit;
Label2: TLabel;
RadioGroup1: TRadioGroup;
GroupBox2: TGroupBox;
Label1: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
Label10: TLabel;
Label11: TLabel;
Label12: TLabel;
Label13: TLabel;
Label14: TLabel;
Memo1: TMemo;
Label15: TLabel;
LoopChk: TCheckBox;
Label16: TLabel;
Label17: TLabel;
Label18: TLabel;
Label19: TLabel;
Label20: TLabel;
Label21: TLabel;
Label26: TLabel;
Label27: TLabel;
Label28: TLabel;
Label29: TLabel;
Label22: TLabel;
Label23: TLabel;
Label24: TLabel;
Label25: TLabel;
Label30: TLabel;
procedure Edit2Change(Sender: TObject);
procedure Edit1Change(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure ShowZXStat;
procedure RadioGroup1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
ExpDlg: TExpDlg;
ZXCompAddr: integer = $C000;
zxplsz, zxdtsz: word;
ZXModSize1, ZXModSize2, blksz, TmpAddr: integer;
implementation
{$R *.DFM}
procedure TExpDlg.Edit2Change(Sender: TObject);
var
i, j: integer;
begin
if Edit2.Modified then
begin
Val(Trim(Edit2.Text), i, j);
if j <> 0 then exit;
Edit1.Text := IntToHex(i, 4);
TmpAddr := i;
ShowZXStat
end
end;
procedure TExpDlg.Edit1Change(Sender: TObject);
var
s: string;
i, j: integer;
begin
if Edit1.Modified then
begin
s := UpperCase(Trim(Edit1.Text));
i := 0;
j := 0;
while j < Length(s) do
begin
Inc(j);
if not (s[j] in ['0'..'9', 'A'..'F']) then exit;
if s[j] in ['0'..'9'] then
i := i * 16 + Ord(s[j]) - Ord('0')
else
i := i * 16 + Ord(s[j]) - Ord('A') + 10
end;
Edit2.Text := IntToStr(i);
TmpAddr := i;
ShowZXStat
end;
end;
procedure TExpDlg.FormShow(Sender: TObject);
begin
Edit1.Text := IntToHex(ZXCompAddr, 4);
Edit2.Text := IntToStr(ZXCompAddr);
TmpAddr := ZXCompAddr;
ShowZXStat;
end;
procedure TExpDlg.ShowZXStat;
var
i: integer;
begin
blksz := ZXModSize1 + ZXModSize2;
if RadioGroup1.ItemIndex <> 1 then
inc(blksz, zxplsz + zxdtsz)
else
inc(blksz, 16);
Label22.Caption := IntToHex(65536 - blksz, 4) + '):';
i := TmpAddr and 65535;
if i + blksz > 65536 then
i := 65536 - blksz;
ZXCompAddr := i;
if ZXModSize2 = 0 then
begin
Label24.Caption := '----';
Label30.Caption := '----';
end
else
Label30.Caption := IntToHex(ZXModSize2, 4);
Label14.Caption := '(' + '----' + ')';
if RadioGroup1.ItemIndex = 1 then
begin
Label4.Caption := '----';
Label6.Caption := '----';
Label8.Caption := '----';
Label10.Caption := '(' + '----' + ')';
Label17.Caption := '----';
Label19.Caption := '----';
Label21.Caption := '----';
Label27.Caption := IntToHex(ZXCompAddr, 4);
if ZXModSize2 <> 0 then
Label24.Caption := IntToHex(ZXCompAddr + ZXModSize1, 4);
end
else
begin
Label4.Caption := IntToHex(ZXCompAddr, 4);
Label6.Caption := IntToHex(ZXCompAddr + 5, 4);
Label8.Caption := IntToHex(ZXCompAddr + 8, 4);
Label10.Caption := '(' + IntToHex(ZXCompAddr + 10, 4) + ')';
if ZXModSize2 = 0 then
Label14.Caption := '(' + IntToHex(ZXCompAddr + 11, 4) + ')';
Label17.Caption := IntToHex(ZXCompAddr + zxplsz, 4);
Label19.Caption := IntToHex(zxdtsz, 4);
Label21.Caption := IntToHex(zxplsz, 4);
Label27.Caption := IntToHex(ZXCompAddr + zxplsz + zxdtsz, 4);
if ZXModSize2 <> 0 then
Label24.Caption := IntToHex(ZXCompAddr + zxplsz + zxdtsz + ZXModSize1, 4);
end;
Label29.Caption := IntToHex(ZXModSize1, 4);
end;
procedure TExpDlg.RadioGroup1Click(Sender: TObject);
begin
ShowZXStat
end;
end.