Commit f0b36e6

Nick committed on
WIP codegen changes, remove unused files
commit f0b36e628c53314836d60821e4520021402aa7c5 parent 8678735
4 changed files +178−675
DeletedUnitMain.lfm +0−402
@@ -1,402 +0,0 @@
1 object frmGameboy: TfrmGameboy
2 Left = 1254
3 Height = 236
4 Top = 1002
5 Width = 212
6 Caption = 'Gameboy'
7 ClientHeight = 216
8 ClientWidth = 212
9 Color = clYellow
10 DefaultMonitor = dmMainForm
11 Font.CharSet = ANSI_CHARSET
12 Font.Color = clWindowText
13 Font.Height = -8
14 Font.Name = 'Arial'
15 Menu = MainMenu
16 OnActivate = FormActivate
17 OnClose = FormClose
18 OnCreate = FormCreate
19 OnKeyDown = FormKeyDown
20 OnKeyUp = FormKeyUp
21 OnMouseDown = FormMouseDown
22 OnResize = FormResize
23 Position = poScreenCenter
24 LCLVersion = '2.0.2.0'
25 object StatusBar: TStatusBar
26 Left = 0
27 Height = 23
28 Top = 193
29 Width = 212
30 Font.CharSet = ANSI_CHARSET
31 Font.Color = clWindowText
32 Font.Height = -8
33 Font.Name = 'Arial'
34 Panels = <
35 item
36 Text = 'Memory'
37 Width = 53
38 end
39 item
40 Text = 'Gameboy'
41 Width = 97
42 end
43 item
44 Text = 'Company'
45 Width = 33
46 end>
47 ParentColor = False
48 ParentFont = False
49 SimplePanel = False
50 end
51 object PaintBox1: TPaintBox
52 Left = 0
53 Height = 193
54 Top = 0
55 Width = 212
56 Align = alClient
57 Font.CharSet = ANSI_CHARSET
58 Font.Color = clWindowText
59 Font.Height = -8
60 Font.Name = 'Arial'
61 ParentFont = False
62 OnPaint = PaintBox1Paint
63 end
64 object MainMenu: TMainMenu
65 left = 37
66 object File1: TMenuItem
67 Caption = '&File'
68 object Load1: TMenuItem
69 Caption = '&Load ...'
70 OnClick = FileOpenClick
71 end
72 object N3: TMenuItem
73 Caption = '-'
74 GroupIndex = 2
75 end
76 object Message1: TMenuItem
77 Caption = '&Message ...'
78 Enabled = False
79 GroupIndex = 2
80 end
81 object N4: TMenuItem
82 Caption = '-'
83 GroupIndex = 2
84 end
85 object Exit1: TMenuItem
86 Caption = 'E&xit'
87 GroupIndex = 2
88 OnClick = Exit1Click
89 end
90 end
91 object CPU1: TMenuItem
92 Caption = '&CPU'
93 object Reset2: TMenuItem
94 Caption = '&Reset '
95 OnClick = ResetClick
96 end
97 object Pause1: TMenuItem
98 Caption = '&Pause'
99 OnClick = Pause
100 end
101 object N2: TMenuItem
102 Caption = '-'
103 end
104 object LoadStat: TMenuItem
105 Caption = '&Load Stat'
106 GroupIndex = 2
107 OnClick = LoadStatClick
108 end
109 object SaveStat: TMenuItem
110 Caption = '&Save Stat'
111 GroupIndex = 2
112 OnClick = SaveStatClick
113 end
114 object N8: TMenuItem
115 Caption = '-'
116 GroupIndex = 2
117 end
118 object Debugger: TMenuItem
119 Caption = '&Debugger'
120 GroupIndex = 2
121 OnClick = DebuggerClick
122 end
123 object Dump1: TMenuItem
124 Caption = '&Dump'
125 Enabled = False
126 GroupIndex = 2
127 object MemoryMap1: TMenuItem
128 Caption = '&MemoryMap'
129 end
130 object RamBank1: TMenuItem
131 Caption = '&RamBank'
132 end
133 object ChrData1: TMenuItem
134 Caption = '&Chr Data'
135 end
136 object N1: TMenuItem
137 Caption = '-'
138 end
139 object CGBVRAM1: TMenuItem
140 Caption = 'CGB &VRAM'
141 end
142 object CGBWRAM1: TMenuItem
143 Caption = 'CGB &WRAM'
144 end
145 object CGBCRAM1: TMenuItem
146 Caption = 'CGB &CRAM'
147 end
148 object N9: TMenuItem
149 Caption = '-'
150 end
151 object SGBVRAM1: TMenuItem
152 Caption = 'SGB &VRAM'
153 end
154 object sgbtiledata1: TMenuItem
155 Caption = 'SGB Chr Data'
156 end
157 end
158 end
159 object Option3: TMenuItem
160 Caption = '&Option'
161 object AutoWait: TMenuItem
162 Caption = 'Auto &Wait'
163 OnClick = AutoWaitClick
164 end
165 object FrameSkip1: TMenuItem
166 Caption = '&Frame Skip'
167 object N01: TMenuItem
168 Caption = '&0'
169 Checked = True
170 GroupIndex = 16
171 OnClick = FrameClick
172 end
173 object N11: TMenuItem
174 Tag = 1
175 Caption = '&1'
176 GroupIndex = 16
177 OnClick = FrameClick
178 end
179 object N21: TMenuItem
180 Tag = 2
181 Caption = '&2'
182 GroupIndex = 16
183 OnClick = FrameClick
184 end
185 object N31: TMenuItem
186 Tag = 3
187 Caption = '&3'
188 GroupIndex = 16
189 OnClick = FrameClick
190 end
191 object N41: TMenuItem
192 Tag = 4
193 Caption = '&4'
194 GroupIndex = 16
195 OnClick = FrameClick
196 end
197 object N51: TMenuItem
198 Tag = 5
199 Caption = '&5'
200 GroupIndex = 16
201 OnClick = FrameClick
202 end
203 end
204 object Priority: TMenuItem
205 Caption = '&Priority'
206 object priority1: TMenuItem
207 Caption = 'Idle'
208 OnClick = setPriority
209 end
210 object priority2: TMenuItem
211 Tag = 1
212 Caption = 'Normal'
213 OnClick = setPriority
214 end
215 object priority3: TMenuItem
216 Tag = 2
217 Caption = 'High'
218 OnClick = setPriority
219 end
220 object N14: TMenuItem
221 Caption = '-'
222 end
223 object priority4: TMenuItem
224 Tag = 3
225 Caption = 'RealTime'
226 OnClick = setPriority
227 end
228 end
229 object N12: TMenuItem
230 Caption = '-'
231 end
232 object Video1: TMenuItem
233 Caption = '&Video'
234 object x11: TMenuItem
235 Caption = 'x&1 window'
236 GroupIndex = 2
237 OnClick = setResolution
238 end
239 object x21: TMenuItem
240 Tag = 1
241 Caption = 'x&2'
242 GroupIndex = 2
243 OnClick = setResolution
244 end
245 object x31: TMenuItem
246 Tag = 2
247 Caption = 'x&3'
248 GroupIndex = 2
249 OnClick = setResolution
250 end
251 object x41: TMenuItem
252 Tag = 3
253 Caption = 'x&4'
254 GroupIndex = 2
255 OnClick = setResolution
256 end
257 object N7: TMenuItem
258 Caption = '-'
259 GroupIndex = 2
260 Visible = False
261 end
262 object full1: TMenuItem
263 Tag = 80
264 Caption = '320x240 full screen'
265 GroupIndex = 2
266 Visible = False
267 OnClick = setResolution
268 end
269 object fullscreen1: TMenuItem
270 Tag = 81
271 Caption = '400x300'
272 GroupIndex = 2
273 Visible = False
274 OnClick = setResolution
275 end
276 object full2: TMenuItem
277 Tag = 82
278 Caption = '512x384'
279 GroupIndex = 2
280 Visible = False
281 OnClick = setResolution
282 end
283 object full3: TMenuItem
284 Tag = 83
285 Caption = '640x400'
286 GroupIndex = 2
287 Visible = False
288 OnClick = setResolution
289 end
290 object full4: TMenuItem
291 Tag = 84
292 Caption = '640x480'
293 GroupIndex = 2
294 Visible = False
295 OnClick = setResolution
296 end
297 end
298 object Sound1: TMenuItem
299 Caption = '&Sound'
300 object Off: TMenuItem
301 Caption = '&Off'
302 OnClick = SetSound
303 end
304 object N6: TMenuItem
305 Caption = '-'
306 end
307 object Ch1: TMenuItem
308 Caption = 'Ch&1'
309 Checked = True
310 OnClick = SetAudioChannel
311 end
312 object Ch2: TMenuItem
313 Tag = 1
314 Caption = 'Ch&2'
315 Checked = True
316 OnClick = SetAudioChannel
317 end
318 object Ch3: TMenuItem
319 Tag = 2
320 Caption = 'Ch&3'
321 Checked = True
322 OnClick = SetAudioChannel
323 end
324 object Ch4: TMenuItem
325 Tag = 3
326 Caption = 'Ch&4'
327 Checked = True
328 OnClick = SetAudioChannel
329 end
330 end
331 object Net1: TMenuItem
332 Caption = '&Net'
333 Enabled = False
334 end
335 object N15: TMenuItem
336 Caption = '-'
337 end
338 object SerialIF1: TMenuItem
339 Caption = 'Serial I/F'
340 Enabled = False
341 object serial1: TMenuItem
342 Caption = 'None'
343 end
344 object serial2: TMenuItem
345 Tag = 1
346 Caption = 'Pocket Printer'
347 end
348 object serial3: TMenuItem
349 Tag = 2
350 Caption = 'Gameboy ...'
351 Visible = False
352 end
353 end
354 object Palette1: TMenuItem
355 Caption = '&Palette'
356 Enabled = False
357 object preset11: TMenuItem
358 Caption = 'preset1'
359 Checked = True
360 GroupIndex = 10
361 end
362 object preset21: TMenuItem
363 Tag = 1
364 Caption = 'preset2'
365 GroupIndex = 10
366 end
367 object preset31: TMenuItem
368 Tag = 2
369 Caption = 'preset3'
370 GroupIndex = 10
371 end
372 object preset41: TMenuItem
373 Tag = 3
374 Caption = 'preset4'
375 GroupIndex = 10
376 end
377 object preset51: TMenuItem
378 Tag = 4
379 Caption = 'preset5'
380 GroupIndex = 10
381 end
382 end
383 object N10: TMenuItem
384 Caption = '-'
385 end
386 object Setting1: TMenuItem
387 Caption = '&Setting ...'
388 Enabled = False
389 end
390 end
391 end
392 object OpenDialog: TOpenDialog
393 end
394 object SaveDialog: TSaveDialog
395 end
396 object Timer: TTimer
397 Enabled = False
398 Interval = 17
399 OnTimer = TimerTimer
400 left = 75
401 end
402 end
DeletedUnitMain.lrs +0−99
@@ -1,99 +0,0 @@
1 { This is an automatically generated lazarus resource file }
2
3 LazarusResources.Add('TfrmGameboy','FORMDATA',[
4 'TPF0'#11'TfrmGameboy'#10'frmGameboy'#4'Left'#3#131#1#6'Height'#3'b'#1#3'Top'
5 +#3#232#0#5'Width'#3'>'#1#7'Caption'#6#7'Gameboy'#12'ClientHeight'#3'@'#1#11
6 +'ClientWidth'#3'>'#1#5'Color'#7#7'clBlack'#14'DefaultMonitor'#7#10'dmMainFor'
7 +'m'#13'DesignTimePPI'#3#168#0#12'Font.CharSet'#7#12'ANSI_CHARSET'#10'Font.Co'
8 +'lor'#7#12'clWindowText'#11'Font.Height'#2#244#9'Font.Name'#6#5'Arial'#4'Men'
9 +'u'#7#8'MainMenu'#10'OnActivate'#7#12'FormActivate'#7'OnClose'#7#9'FormClose'
10 +#8'OnCreate'#7#10'FormCreate'#9'OnKeyDown'#7#11'FormKeyDown'#7'OnKeyUp'#7#9
11 +'FormKeyUp'#11'OnMouseDown'#7#13'FormMouseDown'#8'OnResize'#7#10'FormResize'
12 +#8'Position'#7#14'poScreenCenter'#10'LCLVersion'#6#7'1.8.4.0'#0#10'TStatusBa'
13 +'r'#9'StatusBar'#4'Left'#2#0#6'Height'#2'+'#3'Top'#3#21#1#5'Width'#3'>'#1#6
14 +'Panels'#14#1#4'Text'#6#6'Memory'#5'Width'#2'P'#0#1#4'Text'#6#7'Gameboy'#5'W'
15 +'idth'#3#145#0#0#1#4'Text'#6#7'Company'#5'Width'#2'2'#0#0#11'SimplePanel'#8#0
16 +#0#9'TMainMenu'#8'MainMenu'#4'left'#2'('#3'top'#2#8#0#9'TMenuItem'#5'File1'#7
17 +'Caption'#6#5'&File'#0#9'TMenuItem'#5'Load1'#7'Caption'#6#9'&Load ...'#7'OnC'
18 +'lick'#7#13'FileOpenClick'#0#0#9'TMenuItem'#2'N3'#7'Caption'#6#1'-'#10'Group'
19 +'Index'#2#2#0#0#9'TMenuItem'#8'Message1'#7'Caption'#6#12'&Message ...'#7'Ena'
20 +'bled'#8#10'GroupIndex'#2#2#0#0#9'TMenuItem'#2'N4'#7'Caption'#6#1'-'#10'Grou'
21 +'pIndex'#2#2#0#0#9'TMenuItem'#5'Exit1'#7'Caption'#6#5'E&xit'#10'GroupIndex'#2
22 +#2#7'OnClick'#7#10'Exit1Click'#0#0#0#9'TMenuItem'#4'CPU1'#7'Caption'#6#4'&CP'
23 +'U'#0#9'TMenuItem'#6'Reset2'#7'Caption'#6#7'&Reset '#7'OnClick'#7#10'ResetCl'
24 +'ick'#0#0#9'TMenuItem'#6'Pause1'#7'Caption'#6#6'&Pause'#7'OnClick'#7#5'Pause'
25 +#0#0#9'TMenuItem'#2'N2'#7'Caption'#6#1'-'#0#0#9'TMenuItem'#8'LoadStat'#7'Cap'
26 +'tion'#6#10'&Load Stat'#10'GroupIndex'#2#2#7'OnClick'#7#13'LoadStatClick'#0#0
27 +#9'TMenuItem'#8'SaveStat'#7'Caption'#6#10'&Save Stat'#10'GroupIndex'#2#2#7'O'
28 +'nClick'#7#13'SaveStatClick'#0#0#9'TMenuItem'#2'N8'#7'Caption'#6#1'-'#10'Gro'
29 +'upIndex'#2#2#0#0#9'TMenuItem'#8'Debugger'#7'Caption'#6#9'&Debugger'#10'Grou'
30 +'pIndex'#2#2#7'OnClick'#7#13'DebuggerClick'#0#0#9'TMenuItem'#5'Dump1'#7'Capt'
31 +'ion'#6#5'&Dump'#7'Enabled'#8#10'GroupIndex'#2#2#0#9'TMenuItem'#10'MemoryMap'
32 +'1'#7'Caption'#6#10'&MemoryMap'#0#0#9'TMenuItem'#8'RamBank1'#7'Caption'#6#8
33 +'&RamBank'#0#0#9'TMenuItem'#8'ChrData1'#7'Caption'#6#9'&Chr Data'#0#0#9'TMen'
34 +'uItem'#2'N1'#7'Caption'#6#1'-'#0#0#9'TMenuItem'#8'CGBVRAM1'#7'Caption'#6#9
35 +'CGB &VRAM'#0#0#9'TMenuItem'#8'CGBWRAM1'#7'Caption'#6#9'CGB &WRAM'#0#0#9'TMe'
36 +'nuItem'#8'CGBCRAM1'#7'Caption'#6#9'CGB &CRAM'#0#0#9'TMenuItem'#2'N9'#7'Capt'
37 +'ion'#6#1'-'#0#0#9'TMenuItem'#8'SGBVRAM1'#7'Caption'#6#9'SGB &VRAM'#0#0#9'TM'
38 +'enuItem'#12'sgbtiledata1'#7'Caption'#6#12'SGB Chr Data'#0#0#0#0#9'TMenuItem'
39 +#7'Option3'#7'Caption'#6#7'&Option'#0#9'TMenuItem'#8'AutoWait'#7'Caption'#6
40 +#10'Auto &Wait'#7'OnClick'#7#13'AutoWaitClick'#0#0#9'TMenuItem'#10'FrameSkip'
41 +'1'#7'Caption'#6#11'&Frame Skip'#0#9'TMenuItem'#3'N01'#7'Caption'#6#2'&0'#7
42 +'Checked'#9#10'GroupIndex'#2#16#7'OnClick'#7#10'FrameClick'#0#0#9'TMenuItem'
43 +#3'N11'#3'Tag'#2#1#7'Caption'#6#2'&1'#10'GroupIndex'#2#16#7'OnClick'#7#10'Fr'
44 +'ameClick'#0#0#9'TMenuItem'#3'N21'#3'Tag'#2#2#7'Caption'#6#2'&2'#10'GroupInd'
45 +'ex'#2#16#7'OnClick'#7#10'FrameClick'#0#0#9'TMenuItem'#3'N31'#3'Tag'#2#3#7'C'
46 +'aption'#6#2'&3'#10'GroupIndex'#2#16#7'OnClick'#7#10'FrameClick'#0#0#9'TMenu'
47 +'Item'#3'N41'#3'Tag'#2#4#7'Caption'#6#2'&4'#10'GroupIndex'#2#16#7'OnClick'#7
48 +#10'FrameClick'#0#0#9'TMenuItem'#3'N51'#3'Tag'#2#5#7'Caption'#6#2'&5'#10'Gro'
49 +'upIndex'#2#16#7'OnClick'#7#10'FrameClick'#0#0#0#9'TMenuItem'#8'Priority'#7
50 +'Caption'#6#9'&Priority'#0#9'TMenuItem'#9'priority1'#7'Caption'#6#4'Idle'#7
51 +'OnClick'#7#11'setPriority'#0#0#9'TMenuItem'#9'priority2'#3'Tag'#2#1#7'Capti'
52 +'on'#6#6'Normal'#7'OnClick'#7#11'setPriority'#0#0#9'TMenuItem'#9'priority3'#3
53 +'Tag'#2#2#7'Caption'#6#4'High'#7'OnClick'#7#11'setPriority'#0#0#9'TMenuItem'
54 +#3'N14'#7'Caption'#6#1'-'#0#0#9'TMenuItem'#9'priority4'#3'Tag'#2#3#7'Caption'
55 +#6#8'RealTime'#7'OnClick'#7#11'setPriority'#0#0#0#9'TMenuItem'#3'N12'#7'Capt'
56 +'ion'#6#1'-'#0#0#9'TMenuItem'#6'Video1'#7'Caption'#6#6'&Video'#0#9'TMenuItem'
57 +#11'Outputmode1'#7'Caption'#6#7'&Output'#0#9'TMenuItem'#13'mnuDirectdraw'#7
58 +'Caption'#6#11'&Directdraw'#7'OnClick'#7#14'mnuOutputClick'#0#0#9'TMenuItem'
59 +#6'mnuDib'#7'Caption'#6#4'D&ib'#7'Checked'#9#7'OnClick'#7#14'mnuOutputClick'
60 +#0#0#0#9'TMenuItem'#2'N5'#7'Caption'#6#1'-'#0#0#9'TMenuItem'#3'x11'#7'Captio'
61 +'n'#6#10'x&1 window'#10'GroupIndex'#2#2#7'OnClick'#7#13'setResolution'#0#0#9
62 +'TMenuItem'#3'x21'#3'Tag'#2#1#7'Caption'#6#3'x&2'#10'GroupIndex'#2#2#7'OnCli'
63 +'ck'#7#13'setResolution'#0#0#9'TMenuItem'#3'x31'#3'Tag'#2#2#7'Caption'#6#3'x'
64 +'&3'#10'GroupIndex'#2#2#7'OnClick'#7#13'setResolution'#0#0#9'TMenuItem'#3'x4'
65 +'1'#3'Tag'#2#3#7'Caption'#6#3'x&4'#10'GroupIndex'#2#2#7'OnClick'#7#13'setRes'
66 +'olution'#0#0#9'TMenuItem'#2'N7'#7'Caption'#6#1'-'#10'GroupIndex'#2#2#7'Visi'
67 +'ble'#8#0#0#9'TMenuItem'#5'full1'#3'Tag'#2'P'#7'Caption'#6#19'320x240 full s'
68 ,'creen'#10'GroupIndex'#2#2#7'Visible'#8#7'OnClick'#7#13'setResolution'#0#0#9
69 +'TMenuItem'#11'fullscreen1'#3'Tag'#2'Q'#7'Caption'#6#7'400x300'#10'GroupInde'
70 +'x'#2#2#7'Visible'#8#7'OnClick'#7#13'setResolution'#0#0#9'TMenuItem'#5'full2'
71 +#3'Tag'#2'R'#7'Caption'#6#7'512x384'#10'GroupIndex'#2#2#7'Visible'#8#7'OnCli'
72 +'ck'#7#13'setResolution'#0#0#9'TMenuItem'#5'full3'#3'Tag'#2'S'#7'Caption'#6#7
73 +'640x400'#10'GroupIndex'#2#2#7'Visible'#8#7'OnClick'#7#13'setResolution'#0#0
74 +#9'TMenuItem'#5'full4'#3'Tag'#2'T'#7'Caption'#6#7'640x480'#10'GroupIndex'#2#2
75 +#7'Visible'#8#7'OnClick'#7#13'setResolution'#0#0#0#9'TMenuItem'#6'Sound1'#7
76 +'Caption'#6#6'&Sound'#0#9'TMenuItem'#3'Off'#7'Caption'#6#4'&Off'#7'OnClick'#7
77 +#8'SetSound'#0#0#9'TMenuItem'#2'N6'#7'Caption'#6#1'-'#0#0#9'TMenuItem'#3'Ch1'
78 +#7'Caption'#6#4'Ch&1'#7'Checked'#9#7'OnClick'#7#15'SetAudioChannel'#0#0#9'TM'
79 +'enuItem'#3'Ch2'#3'Tag'#2#1#7'Caption'#6#4'Ch&2'#7'Checked'#9#7'OnClick'#7#15
80 +'SetAudioChannel'#0#0#9'TMenuItem'#3'Ch3'#3'Tag'#2#2#7'Caption'#6#4'Ch&3'#7
81 +'Checked'#9#7'OnClick'#7#15'SetAudioChannel'#0#0#9'TMenuItem'#3'Ch4'#3'Tag'#2
82 +#3#7'Caption'#6#4'Ch&4'#7'Checked'#9#7'OnClick'#7#15'SetAudioChannel'#0#0#0#9
83 +'TMenuItem'#4'Net1'#7'Caption'#6#4'&Net'#7'Enabled'#8#0#0#9'TMenuItem'#3'N15'
84 +#7'Caption'#6#1'-'#0#0#9'TMenuItem'#9'SerialIF1'#7'Caption'#6#10'Serial I/F'
85 +#7'Enabled'#8#0#9'TMenuItem'#7'serial1'#7'Caption'#6#4'None'#0#0#9'TMenuItem'
86 +#7'serial2'#3'Tag'#2#1#7'Caption'#6#14'Pocket Printer'#0#0#9'TMenuItem'#7'se'
87 +'rial3'#3'Tag'#2#2#7'Caption'#6#11'Gameboy ...'#7'Visible'#8#0#0#0#9'TMenuIt'
88 +'em'#8'Palette1'#7'Caption'#6#8'&Palette'#7'Enabled'#8#0#9'TMenuItem'#8'pres'
89 +'et11'#7'Caption'#6#7'preset1'#7'Checked'#9#10'GroupIndex'#2#10#0#0#9'TMenuI'
90 +'tem'#8'preset21'#3'Tag'#2#1#7'Caption'#6#7'preset2'#10'GroupIndex'#2#10#0#0
91 +#9'TMenuItem'#8'preset31'#3'Tag'#2#2#7'Caption'#6#7'preset3'#10'GroupIndex'#2
92 +#10#0#0#9'TMenuItem'#8'preset41'#3'Tag'#2#3#7'Caption'#6#7'preset4'#10'Group'
93 +'Index'#2#10#0#0#9'TMenuItem'#8'preset51'#3'Tag'#2#4#7'Caption'#6#7'preset5'
94 +#10'GroupIndex'#2#10#0#0#0#9'TMenuItem'#3'N10'#7'Caption'#6#1'-'#0#0#9'TMenu'
95 +'Item'#8'Setting1'#7'Caption'#6#12'&Setting ...'#7'Enabled'#8#0#0#0#0#11'TOp'
96 +'enDialog'#10'OpenDialog'#0#0#11'TSaveDialog'#10'SaveDialog'#0#0#6'TTimer'#5
97 +'Timer'#7'Enabled'#8#8'Interval'#2#17#7'OnTimer'#7#10'TimerTimer'#4'left'#2
98 +'('#3'top'#2'('#0#0#0
99 ]);
Modifiedcodegen.pas +177−173
@@ -7,7 +7,7 @@ interface
7 uses 7 uses
8 Classes, SysUtils, Math, Instruments, Song, Utils, 8 Classes, SysUtils, Math, Instruments, Song, Utils,
9 HugeDatatypes, Constants, Dialogs, strutils, FileUtil, LazFileUtils, 9 HugeDatatypes, Constants, Dialogs, strutils, FileUtil, LazFileUtils,
10 lclintf, process, rgb2sdas; 10 lclintf, process;
11 11
12 type 12 type
13 TExportMode = (emNormal, emPreview, emGBS); 13 TExportMode = (emNormal, emPreview, emGBS);
@@ -192,186 +192,220 @@ begin
192 OutSL.Free; 192 OutSL.Free;
193 end; 193 end;
194 194
195 function RenderOrderTable(OrderMatrix: TOrderMatrix): string; 195 procedure RenderSongToHTTs(Song: TSong; DescriptorName: String; Filename: string);
196 function RenderOrderTable(OrderMatrix: TOrderMatrix): string;
197
198 function ArrayHelper(Ints: array of integer): string;
199 var
200 I: integer;
201 SL: TStringList;
202 begin
203 SL := TStringList.Create;
204 SL.StrictDelimiter := True;
205 SL.Delimiter := ',';
206 for I := Low(Ints) to High(Ints)-1 do // HACK: account for the off-by-one error
207 SL.Add('P' + IntToStr(Ints[I]));
208 Result := SL.DelimitedText;
209 SL.Free;
210 end;
196 211
197 function ArrayHelper(Ints: array of integer): string;
198 var 212 var
199 I: integer; 213 Res: TStringList;
200 SL: TStringList; 214 OrderCnt: integer;
201 begin 215 begin
202 SL := TStringList.Create; 216 Res := TStringList.Create;
203 SL.StrictDelimiter := True; 217 OrderCnt := MaxIntValue([High(OrderMatrix[0]), High(OrderMatrix[1]),
204 SL.Delimiter := ','; 218 High(OrderMatrix[2]), High(OrderMatrix[3])]);
205 for I := Low(Ints) to High(Ints)-1 do // HACK: account for the off-by-one error 219
206 SL.Add('P' + IntToStr(Ints[I])); 220 Res.Add('order_cnt: db ' + IntToStr(OrderCnt * 2));
207 Result := SL.DelimitedText; 221 Res.Add('order1: dw ' + ArrayHelper(OrderMatrix[0]));
208 SL.Free; 222 Res.Add('order2: dw ' + ArrayHelper(OrderMatrix[1]));
223 Res.Add('order3: dw ' + ArrayHelper(OrderMatrix[2]));
224 Res.Add('order4: dw ' + ArrayHelper(OrderMatrix[3]));
225
226 Result := Res.Text;
227 Res.Free;
209 end; 228 end;
210 229
211 var 230 function RenderInstruments(Instruments: TInstrumentBank): string;
212 Res: TStringList; 231 var
213 OrderCnt: integer; 232 SL, ResultSL: TStringList;
214 begin 233 AsmInstrument: TAsmInstrument;
215 Res := TStringList.Create; 234 I, J: integer;
216 OrderCnt := MaxIntValue([High(OrderMatrix[0]), High(OrderMatrix[1]), 235 TypePrefix: string;
217 High(OrderMatrix[2]), High(OrderMatrix[3])]); 236 HighMask: byte;
237 begin
238 ResultSL := TStringList.Create;
218 239
219 Res.Add('order_cnt: db ' + IntToStr(OrderCnt * 2)); 240 for I := Low(Instruments) to High(Instruments) do
220 Res.Add('order1: dw ' + ArrayHelper(OrderMatrix[0])); 241 begin
221 Res.Add('order2: dw ' + ArrayHelper(OrderMatrix[1])); 242 AsmInstrument := InstrumentToBytes(Instruments[I]);
222 Res.Add('order3: dw ' + ArrayHelper(OrderMatrix[2])); 243 SL := TStringList.Create;
223 Res.Add('order4: dw ' + ArrayHelper(OrderMatrix[3])); 244 SL.StrictDelimiter := True;
245 SL.Delimiter := ',';
224 246
225 Result := Res.Text; 247 if Instruments[I].Type_ = itNoise then
226 Res.Free; 248 begin
227 end; 249 SL.Add(IntToStr(AsmInstrument[1])); // envelope
250
251 HighMask := AsmInstrument[0];
252 if Instruments[I].LengthEnabled then
253 HighMask := HighMask or %01000000;
254 if Instruments[I].CounterStep = swSeven then
255 HighMask := HighMask or %10000000;
256 SL.Add(IntToStr(HighMask));
257
258 for J := Low(TNoiseMacro) to High(TNoiseMacro) do
259 SL.Add(IntToStr(Instruments[I].NoiseMacro[J]));
260 end
261 else
262 for J := Low(AsmInstrument) to High(AsmInstrument) do
263 SL.Add(IntToStr(AsmInstrument[J]));
264
265 WriteStr(TypePrefix, Instruments[I].Type_);
266 ResultSL.Add(Format('%s%s: db %s', [TypePrefix, 'inst' + IntToStr(I),
267 SL.DelimitedText]));
268 SL.Free;
269 end;
228 270
229 function RenderInstruments(Instruments: TInstrumentBank): string; 271 Result := ResultSL.Text;
230 var 272 ResultSL.Free;
231 SL, ResultSL: TStringList; 273 end;
232 AsmInstrument: TAsmInstrument;
233 I, J: integer;
234 TypePrefix: string;
235 HighMask: byte;
236 begin
237 ResultSL := TStringList.Create;
238 274
239 for I := Low(Instruments) to High(Instruments) do 275 function RenderCell(Cell: TCell): string;
276 var
277 SL: TStringList;
240 begin 278 begin
241 AsmInstrument := InstrumentToBytes(Instruments[I]);
242 SL := TStringList.Create; 279 SL := TStringList.Create;
243 SL.StrictDelimiter := True;
244 SL.Delimiter := ','; 280 SL.Delimiter := ',';
281 SL.StrictDelimiter := True;
245 282
246 if Instruments[I].Type_ = itNoise then 283 if Cell.Note = NO_NOTE then
247 begin 284 SL.Add('___')
248 SL.Add(IntToStr(AsmInstrument[1])); // envelope 285 else
249 286 SL.Add(NoteToDriverMap.KeyData[Cell.Note]);
250 HighMask := AsmInstrument[0];
251 if Instruments[I].LengthEnabled then
252 HighMask := HighMask or %01000000;
253 if Instruments[I].CounterStep = swSeven then
254 HighMask := HighMask or %10000000;
255 SL.Add(IntToStr(HighMask));
256 287
257 for J := Low(TNoiseMacro) to High(TNoiseMacro) do 288 if InRange(Cell.Instrument, 0, 15) then
258 SL.Add(IntToStr(Instruments[I].NoiseMacro[J])); 289 SL.Add(IntToStr(Cell.Instrument))
259 end
260 else 290 else
261 for J := Low(AsmInstrument) to High(AsmInstrument) do 291 SL.Add('0');
262 SL.Add(IntToStr(AsmInstrument[J]));
263 292
264 WriteStr(TypePrefix, Instruments[I].Type_); 293 SL.Add('$' + EffectCodeToStr(Cell.EffectCode, Cell.EffectParams));
265 ResultSL.Add(Format('%s%s: db %s', [TypePrefix, 'inst' + IntToStr(I), 294
266 SL.DelimitedText])); 295 // RGBDS thinks you're defining a new macro if you don't have a space first.
296 Result := ' dn ' + SL.DelimitedText;
267 SL.Free; 297 SL.Free;
268 end; 298 end;
269 299
270 Result := ResultSL.Text; 300 function RenderPattern(Name: string; Pattern: TPattern): string;
271 ResultSL.Free; 301 var
272 end; 302 SL: TStringList;
273 303 I: integer;
274 function RenderCell(Cell: TCell): string; 304 begin
275 var 305 SL := TStringList.Create;
276 SL: TStringList; 306 SL.Add(Name + ':');
277 begin
278 SL := TStringList.Create;
279 SL.Delimiter := ',';
280 SL.StrictDelimiter := True;
281
282 if Cell.Note = NO_NOTE then
283 SL.Add('___')
284 else
285 SL.Add(NoteToDriverMap.KeyData[Cell.Note]);
286
287 if InRange(Cell.Instrument, 0, 15) then
288 SL.Add(IntToStr(Cell.Instrument))
289 else
290 SL.Add('0');
291 307
292 SL.Add('$' + EffectCodeToStr(Cell.EffectCode, Cell.EffectParams)); 308 for I := Low(TPattern) to High(TPattern) do
309 SL.Add(RenderCell(Pattern[I]));
293 310
294 // RGBDS thinks you're defining a new macro if you don't have a space first. 311 Result := SL.Text;
295 Result := ' dn ' + SL.DelimitedText; 312 SL.Free;
296 SL.Free; 313 end;
297 end;
298 314
299 function RenderPattern(Name: string; Pattern: TPattern): string; 315 function RenderWaveforms(Waves: TWaveBank): string;
300 var 316 var
301 SL: TStringList; 317 SL, ResultSL: TStringList;
302 I: integer; 318 I, J: integer;
303 begin 319 begin
304 SL := TStringList.Create; 320 ResultSL := TStringList.Create;
305 SL.Add(Name + ':');
306 321
307 for I := Low(TPattern) to High(TPattern) do 322 for I := Low(Waves) to High(Waves) do
308 SL.Add(RenderCell(Pattern[I])); 323 begin
324 SL := TStringList.Create;
325 SL.StrictDelimiter := True;
326 SL.Delimiter := ',';
309 327
310 Result := SL.Text; 328 J := Low(Waves[I]);
311 SL.Free; 329 while J < High(Waves[I]) do
312 end; 330 begin
331 SL.Add(IntToStr((Waves[I, J] shl 4) or Waves[I, J + 1]));
332 Inc(J, 2);
333 end;
334 ResultSL.Add(Format('wave%d: db %s', [I, SL.DelimitedText]));
335 SL.Free;
336 end;
313 337
314 function RenderWaveforms(Waves: TWaveBank): string; 338 Result := ResultSL.Text;
315 var 339 ResultSL.Free;
316 SL, ResultSL: TStringList; 340 end;
317 I, J: integer;
318 begin
319 ResultSL := TStringList.Create;
320 341
321 for I := Low(Waves) to High(Waves) do 342 function RenderConstants(Song: TSong; Mode: TExportMode): string;
343 var
344 SL: TStringList;
322 begin 345 begin
323 SL := TStringList.Create; 346 SL := TStringList.Create;
324 SL.StrictDelimiter := True; 347 SL.Add('STANDALONE_MODE EQU 1');
325 SL.Delimiter := ',';
326 348
327 J := Low(Waves[I]); 349 if Mode = emPreview then
328 while J < High(Waves[I]) do 350 SL.Add('PREVIEW_MODE EQU 1')
351 else if Mode = emGBS then
329 begin 352 begin
330 SL.Add(IntToStr((Waves[I, J] shl 4) or Waves[I, J + 1])); 353 SL.Add('GBS_MODE EQU 1');
331 Inc(J, 2); 354 SL.Add('GBS_TITLE EQUS "\"' + PadRight(Song.Name, 32) + '\""');
355 SL.Add('GBS_AUTHOR EQUS "\"' + PadRight(Song.Artist, 32) + '\""');
356 SL.Add('GBS_COPYRIGHT EQUS "\"' + PadRight(IntToStr(CurrentYear), 32) + '\""');
332 end; 357 end;
333 ResultSL.Add(Format('wave%d: db %s', [I, SL.DelimitedText])); 358 SL.Add('TICKS EQU ' + IntToStr(Song.TicksPerRow));
359
360 Result := SL.Text;
334 SL.Free; 361 SL.Free;
335 end; 362 end;
336 363
337 Result := ResultSL.Text; 364 procedure WriteRoutinesToFile(Routines: TRoutineBank);
338 ResultSL.Free; 365 var
339 end; 366 I: integer;
340 367 F: Text;
341 function RenderConstants(Song: TSong; Mode: TExportMode): string;
342 var
343 SL: TStringList;
344 begin
345 SL := TStringList.Create;
346 SL.Add('STANDALONE_MODE EQU 1');
347
348 if Mode = emPreview then
349 SL.Add('PREVIEW_MODE EQU 1')
350 else if Mode = emGBS then
351 begin 368 begin
352 SL.Add('GBS_MODE EQU 1'); 369 for I := Low(TRoutineBank) to High(TRoutineBank) do
353 SL.Add('GBS_TITLE EQUS "\"' + PadRight(Song.Name, 32) + '\""'); 370 begin
354 SL.Add('GBS_AUTHOR EQUS "\"' + PadRight(Song.Artist, 32) + '\""'); 371 AssignFile(F, './hUGEDriver/routine' + IntToStr(I) + '.htt');
355 SL.Add('GBS_COPYRIGHT EQUS "\"' + PadRight(IntToStr(CurrentYear), 32) + '\""'); 372 Rewrite(F);
373 Write(F, Routines[I]);
374 CloseFile(F);
375 end;
356 end; 376 end;
357 SL.Add('TICKS EQU ' + IntToStr(Song.TicksPerRow));
358
359 Result := SL.Text;
360 SL.Free;
361 end;
362 377
363 procedure WriteRoutinesToFile(Routines: TRoutineBank); 378 procedure WriteHTT(F: string; S: string);
364 var
365 I: integer;
366 F: Text;
367 begin
368 for I := Low(TRoutineBank) to High(TRoutineBank) do
369 begin 379 begin
370 AssignFile(F, './hUGEDriver/routine' + IntToStr(I) + '.htt'); 380 AssignFile(OutFile, F);
371 Rewrite(F); 381 Rewrite(OutFile);
372 Write(F, Routines[I]); 382 Write(OutFile, S);
373 CloseFile(F); 383 CloseFile(OutFile);
374 end; 384 end;
385 begin
386 FilePath := Filename;
387 Filename := ExtractFileNameWithoutExt(ExtractFileNameOnly(Filename));
388
389 WriteHTT('./hUGEDriver/'+DescriptorName+'_constants.htt', RenderConstants(Song, Mode));
390 WriteHTT('./hUGEDriver/'+DescriptorName+'_wave.htt', RenderWaveforms(Song.Waves));
391 WriteHTT('./hUGEDriver/'+DescriptorName+'_order.htt', RenderOrderTable(Song.OrderMatrix));
392 WriteHTT('./hUGEDriver/'+DescriptorName+'_duty_instrument.htt', RenderInstruments(Song.Instruments.Duty));
393 WriteHTT('./hUGEDriver/'+DescriptorName+'_wave_instrument.htt', RenderInstruments(Song.Instruments.Wave));
394 WriteHTT('./hUGEDriver/'+DescriptorName+'_noise_instrument.htt',
395 RenderInstruments(Song.Instruments.Noise));
396 WriteRoutinesToFile(Song.Routines);
397
398 AssignFile(OutFile, './hUGEDriver/pattern.htt');
399 Rewrite(OutFile);
400
401 // TODO: Are keys and data defined to be aligned? Seems like they are but
402 // should probably find out if that's just an implementation detail...
403 for I := 0 to Song.Patterns.Count - 1 do
404 if PatternIsUsed(Song.Patterns.Keys[I], Song) then
405 Write(OutFile, RenderPattern('P' + IntToStr(Song.Patterns.Keys[I]),
406 Song.Patterns.Data[I]^));
407
408 CloseFile(OutFile);
375 end; 409 end;
376 410
377 procedure RectifyGBSFile(GBSFile: string); 411 procedure RectifyGBSFile(GBSFile: string);
@@ -410,14 +444,6 @@ var
410 FilePath: string; 444 FilePath: string;
411 RenameSucceeded: Boolean; 445 RenameSucceeded: Boolean;
412 446
413 procedure WriteHTT(F: string; S: string);
414 begin
415 AssignFile(OutFile, F);
416 Rewrite(OutFile);
417 Write(OutFile, S);
418 CloseFile(OutFile);
419 end;
420
421 function Assemble(OutFile: string; InFile: string; Defines: array of string): integer; 447 function Assemble(OutFile: string; InFile: string; Defines: array of string): integer;
422 var 448 var
423 Define: string; 449 Define: string;
@@ -469,29 +495,7 @@ label
469 begin 495 begin
470 Song := OptimizeSong(Song); 496 Song := OptimizeSong(Song);
471 497
472 FilePath := Filename; 498 RenderSongToHTTs(Song, DescriptorName, Filename);
473 Filename := ExtractFileNameWithoutExt(ExtractFileNameOnly(Filename));
474
475 WriteHTT('./hUGEDriver/constants.htt', RenderConstants(Song, Mode));
476 WriteHTT('./hUGEDriver/wave.htt', RenderWaveforms(Song.Waves));
477 WriteHTT('./hUGEDriver/order.htt', RenderOrderTable(Song.OrderMatrix));
478 WriteHTT('./hUGEDriver/duty_instrument.htt', RenderInstruments(Song.Instruments.Duty));
479 WriteHTT('./hUGEDriver/wave_instrument.htt', RenderInstruments(Song.Instruments.Wave));
480 WriteHTT('./hUGEDriver/noise_instrument.htt',
481 RenderInstruments(Song.Instruments.Noise));
482 WriteRoutinesToFile(Song.Routines);
483
484 AssignFile(OutFile, './hUGEDriver/pattern.htt');
485 Rewrite(OutFile);
486
487 // TODO: Are keys and data defined to be aligned? Seems like they are but
488 // should probably find out if that's just an implementation detail...
489 for I := 0 to Song.Patterns.Count - 1 do
490 if PatternIsUsed(Song.Patterns.Keys[I], Song) then
491 Write(OutFile, RenderPattern('P' + IntToStr(Song.Patterns.Keys[I]),
492 Song.Patterns.Data[I]^));
493
494 CloseFile(OutFile);
495 499
496 // Build the file 500 // Build the file
497 Chdir('hUGEDriver'); 501 Chdir('hUGEDriver');
ModifiedhUGEDriver +1−1
@@ -1 +1 @@
1 Subproject commit 25a1e40b7bdb3849e5a8c408d531e640b8cb18ff 1 Subproject commit d5c0af75d58777ae0133b3fd86ba5c19264bc5db