MasterUnit.pas 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761
  1. {
  2. TIGCC IDE
  3. Copyright (C) 2000-2004 Sebastian Reichelt
  4. Copyright (C) 2005 Fréderic Bour
  5. Copyright (C) 2006 Kevin Kofler
  6. This program is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2, or (at your option)
  9. any later version.
  10. This program is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with this program; if not, write to the Free Software Foundation,
  16. Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  17. }
  18. unit MasterUnit;
  19. interface
  20. uses
  21. CalcUnit, ProcessUnit, ParsingUnit,
  22. LinkUnit,
  23. Classes, Graphics, SourceEditUnit;
  24. const
  25. IDELocation = 'Bin\';
  26. LinkLibLocation = 'Bin\';
  27. GCCLocation = 'Bin\';
  28. AsLocation = 'Bin\';
  29. A68kLocation = 'Bin\';
  30. PackLocation = 'Bin\';
  31. ASMIncludeLocation = 'Include\ASM\';
  32. GASIncludeLocation = 'Include\S\';
  33. CIncludeLocation = 'Include\C\';
  34. QuillIncludeLocation = 'Include\Quill\';
  35. DocLocation = 'Doc\';
  36. ProjectsLocation = 'Projects\';
  37. StdLibLocation = 'Lib\';
  38. TIPatchLocation = 'Lib\';
  39. PStarterLocation = 'Lib\';
  40. TemplatesLocation = 'Bin\';
  41. CompletionLocation = 'Include\C\Completion\';
  42. DefaultGCCSwitches = '-B .\ -I- -I ..\Include\C\';
  43. DefaultAsSwitches = '-mc68000 -I ..\Include\S\';
  44. DefaultA68kSwitches = '-i..\Include\ASM';
  45. SpecialQuillGCCSwitches = '-I ..\Include\Quill\';
  46. ProjectFileExt = '.tpr';
  47. MaxNameLength = 8;
  48. type
  49. TSpecialSupportOption = (ssA68k, ssQuill, ssPack, ssFlashOS, ssFargo);
  50. TSpecialSupport = set of TSpecialSupportOption;
  51. TProjectTarget = (ptRegular, ptFlashOS, ptFargo, ptArchive);
  52. TTransferTarget = (ttNone, ttVTI, ttCalc);
  53. TTiEmuCalcType = (cvNone = 0, cvTI92 = 1, cvTI89 = 2, cvTI92Plus = 4, cvV200 = 8, cvTI89Ti = 16);
  54. TKernelFormat = (kfUnknown, kfNone, kfStandard, kfCompressedTables);
  55. TRelocFormat = (rfUnknown, rfNone, rfDirect, rfAMS, rfKernel, rfCompressed, rfMlink, rfFLine);
  56. TPredefinedLibOptions = class(TObject)
  57. CalcDests: TCalcDests;
  58. OptimizeCalcConsts: Boolean;
  59. KernelFormat: TKernelFormat;
  60. UseMinAMS: Boolean;
  61. MinAMS: string;
  62. UnofficialOSSupport: Boolean;
  63. RelocFormat,
  64. ROMCallFormat,
  65. BSSRefFormat,
  66. DataRefFormat: TRelocFormat;
  67. UseFLineJumps,
  68. Use4ByteFLineJumps,
  69. OptimizeROMCalls,
  70. UseInternalFLineEmulator: Boolean;
  71. UseReturnValue,
  72. EnableErrorReturn: Boolean;
  73. SaveScreen: Boolean;
  74. function GetSwitches: string;
  75. end;
  76. var
  77. MainConsole: TProcessConsole;
  78. StopOnErrors,
  79. DeleteAssemblyFiles,
  80. DeleteObjectFiles,
  81. AssumeUndefined,
  82. AutoBlocks,
  83. AutoNews,
  84. UseDataVar,
  85. DataVarCopy,
  86. DataVarCopyIfArchived,
  87. Pack,
  88. DebugInfo,
  89. StdLib,
  90. InitBSS,
  91. OptimizeNOPs,
  92. OptimizeReturns,
  93. OptimizeBranches,
  94. OptimizeMoves,
  95. OptimizeTests,
  96. OptimizeCalculations,
  97. RemoveUnusedSections,
  98. CutUnusedRanges,
  99. ReorderSections,
  100. MergeConstants,
  101. OutputBin: Boolean;
  102. ProjectTarget: TProjectTarget;
  103. GCCSwitches,
  104. AsSwitches,
  105. AsmSwitches,
  106. DataVar,
  107. PackVar,
  108. CommandLine,
  109. PostBuildProcessFile: string;
  110. PredefinedLibOptions: TPredefinedLibOptions;
  111. ProxyName: string;
  112. ProxyPort: Integer;
  113. TIGCCFolder: string;
  114. Temp: string;
  115. OperationCancelled,
  116. OperationSuccessful: Boolean;
  117. ProjectFileName: string;
  118. SyntaxC,
  119. SyntaxAsmGNU,
  120. SyntaxAsm,
  121. SyntaxQuill: TSyntaxColoring;
  122. TabSizeC,
  123. TabSizeAsm: Integer;
  124. EditorColor: TColor;
  125. EditorFont: TFont;
  126. EditorOnFly,
  127. EditorDragDrop,
  128. EditorRemoveTrSp: Boolean;
  129. LastNewsDate: Integer;
  130. TransferTarget: TTransferTarget;
  131. VTIPath: string;
  132. LinkPort: TLinkPort;
  133. LinkCable: TLinkCableType;
  134. SpecialSupport: TSpecialSupport;
  135. Compiling,
  136. CompFinishAndStop,
  137. CompStopNow: Boolean;
  138. CompStartTime,
  139. CompFileStartTime,
  140. CompLastTime: TDateTime;
  141. CompStartFile: procedure of object;
  142. CompStop: procedure of object;
  143. CompSetMessage: procedure(const Msg: string) of object;
  144. CompUpdate: procedure of object;
  145. CompUpdateProgramOutput: procedure of object;
  146. {$IFDEF CanSplit}
  147. var
  148. SplitFiles: Boolean;
  149. {$ENDIF}
  150. function StartsWith(const SubStr: string; var Str: string; CaseSensitive: Boolean = False; Remove: Boolean = False): Boolean;
  151. procedure WaitForMainConsole(const ProcessDesc: string);
  152. function Runnable: Boolean;
  153. implementation
  154. uses
  155. SysUtils, Forms;
  156. procedure WaitForMainConsole(const ProcessDesc: string);
  157. begin
  158. CompUpdate;
  159. while MainConsole.Running do begin
  160. CompUpdate;
  161. Application.ProcessMessages;
  162. if CompFinishAndStop then begin
  163. OperationCancelled := True;
  164. CompSetMessage ('Finishing ' + ProcessDesc + ' Process');
  165. end;
  166. if CompStopNow then begin
  167. OperationCancelled := True;
  168. MainConsole.KillProcess;
  169. Break;
  170. end;
  171. end;
  172. CompUpdate;
  173. end;
  174. function Runnable: Boolean;
  175. begin
  176. Result := (ProjectTarget <> ptArchive) and (ProjectTarget <> ptFlashOS) and (TransferTarget <> ttNone);
  177. end;
  178. function StartsWith(const SubStr: string; var Str: string; CaseSensitive: Boolean; Remove: Boolean): Boolean;
  179. begin
  180. if CaseSensitive then
  181. Result := Copy (Str, 1, Length (SubStr)) = SubStr
  182. else
  183. Result := UpperCase (Copy (Str, 1, Length (SubStr))) = UpperCase (SubStr);
  184. if Remove and Result then
  185. Delete (Str, 1, Length (SubStr));
  186. end;
  187. { TPredefinedLibOptions }
  188. function TPredefinedLibOptions.GetSwitches: string;
  189. procedure AddSwitch(Define: string; const Value: string = '');
  190. begin
  191. if Length (Result) > 0 then
  192. Result := Result + ' ';
  193. Define := '-D' + Define;
  194. if Length (Value) > 0 then
  195. Define := '"' + Define + '=' + Value + '"';
  196. Result := Result + Define;
  197. end;
  198. begin
  199. Result := '';
  200. if cdTI92 in CalcDests then
  201. AddSwitch ('USE_TI92');
  202. if cdTI89 in CalcDests then
  203. AddSwitch ('USE_TI89');
  204. if cdTI92Plus in CalcDests then
  205. AddSwitch ('USE_TI92PLUS');
  206. if cdV200 in CalcDests then
  207. AddSwitch ('USE_V200');
  208. if OptimizeCalcConsts then
  209. AddSwitch ('OPTIMIZE_CALC_CONSTS');
  210. if KernelFormat in [kfStandard, kfCompressedTables] then begin
  211. AddSwitch ('USE_KERNEL');
  212. if KernelFormat = kfCompressedTables then
  213. AddSwitch ('USE_PREOS_COMPRESSED_TABLES');
  214. end;
  215. if UseMinAMS then try
  216. AddSwitch ('MIN_AMS', IntToStr (Round (StrToFloat (MinAMS) * 100)));
  217. except end;
  218. if UnofficialOSSupport then
  219. AddSwitch ('UNOFFICIAL_OS_SUPPORT');
  220. if KernelFormat = kfCompressedTables then begin
  221. if BSSRefFormat = rfNone then
  222. AddSwitch ('MERGE_BSS');
  223. end else begin
  224. case RelocFormat of
  225. rfKernel: AddSwitch ('KERNEL_FORMAT_RELOCS');
  226. rfCompressed: AddSwitch ('COMPRESSED_FORMAT_RELOCS');
  227. rfMLink: AddSwitch ('MLINK_FORMAT_RELOCS');
  228. rfFLine: AddSwitch ('USE_FLINE_JUMPS');
  229. end;
  230. case ROMCallFormat of
  231. rfKernel: AddSwitch ('KERNEL_FORMAT_ROM_CALLS');
  232. rfCompressed: AddSwitch ('COMPRESSED_FORMAT_ROM_CALLS');
  233. rfMlink: AddSwitch ('MLINK_FORMAT_ROM_CALLS');
  234. rfFLine: begin
  235. AddSwitch ('USE_FLINE_ROM_CALLS');
  236. Result := Result + ' -fno-function-cse';
  237. end;
  238. end;
  239. case BSSRefFormat of
  240. rfNone: AddSwitch ('MERGE_BSS');
  241. rfKernel: AddSwitch ('KERNEL_FORMAT_BSS');
  242. rfCompressed: AddSwitch ('COMPRESSED_FORMAT_BSS');
  243. rfMlink: AddSwitch ('MLINK_FORMAT_BSS');
  244. end;
  245. end;
  246. case DataRefFormat of
  247. rfKernel: AddSwitch ('KERNEL_FORMAT_DATA_VAR');
  248. rfCompressed: AddSwitch ('COMPRESSED_FORMAT_DATA_VAR');
  249. rfMlink: AddSwitch ('MLINK_FORMAT_DATA_VAR');
  250. end;
  251. if UseFLineJumps then begin
  252. AddSwitch ('USE_FLINE_JUMPS');
  253. if Use4ByteFLineJumps then
  254. AddSwitch ('USE_4_BYTE_FLINE_JUMPS');
  255. end;
  256. if OptimizeROMCalls then
  257. AddSwitch ('OPTIMIZE_ROM_CALLS');
  258. if UseInternalFLineEmulator then
  259. AddSwitch ('USE_INTERNAL_FLINE_EMULATOR');
  260. if UseReturnValue then
  261. AddSwitch ('RETURN_VALUE');
  262. if EnableErrorReturn then
  263. AddSwitch ('ENABLE_ERROR_RETURN');
  264. if SaveScreen then
  265. AddSwitch ('SAVE_SCREEN');
  266. end;
  267. initialization
  268. PredefinedLibOptions := TPredefinedLibOptions.Create;
  269. PredefinedLibOptions.MinAMS := '1.01';
  270. MainConsole := TProcessConsole.Create;
  271. SyntaxC := TSyntaxColoring.Create (nil);
  272. SyntaxAsm := TSyntaxColoring.Create (nil);
  273. SyntaxAsmGNU := TSyntaxColoring.Create (nil);
  274. SyntaxQuill := TSyntaxColoring.Create (nil);
  275. EditorFont := TFont.Create;
  276. with SyntaxC do begin
  277. Enabled := True;
  278. SymbolColor := clOlive;
  279. SymbolStyle := [fsBold];
  280. SymbolCustomStyle := True;
  281. NumberColor := clMaroon;
  282. NumberStyle := [];
  283. NumberCustomStyle := False;
  284. with WordLists.Add do begin
  285. Caption := 'C Keywords';
  286. Words.CommaText :=
  287. '__alignof__,__asm__,__attribute__,__complex__,__const__,__extension__,__imag__,__inline__,__label__,__real__,__typeof__,' +
  288. 'asm,auto,break,case,char,const,continue,default,do,double,else,enum,extern,float,for,goto,if,inline,int,long,register,return,short,signed,sizeof,static,struct,switch,typedef,typeof,union,unsigned,void,volatile,while';
  289. CaseSensitive := True;
  290. CustomColor := True;
  291. Color := clBlue;
  292. CustomStyle := True;
  293. Style := [fsBold];
  294. end;
  295. with CustomStyles.Add do begin
  296. Caption := 'Comment Area';
  297. CustomColor := True;
  298. Color := clGreen;
  299. CustomStyle := True;
  300. Style := [fsItalic];
  301. BeginText := '/*';
  302. EndText := '*/';
  303. Switchable := False;
  304. end;
  305. with CustomStyles.Add do begin
  306. Caption := 'Comment Line';
  307. CustomColor := True;
  308. Color := clGreen;
  309. CustomStyle := True;
  310. Style := [fsItalic];
  311. BeginText := '//';
  312. EndText := #13;
  313. Switchable := False;
  314. end;
  315. with CustomStyles.Add do begin
  316. Caption := 'String';
  317. CustomColor := True;
  318. Color := clMaroon;
  319. CustomStyle := False;
  320. Style := [];
  321. BeginText := '"';
  322. EndText := '"';
  323. IgnoreChar := '\';
  324. Switchable := False;
  325. end;
  326. with CustomStyles.Add do begin
  327. Caption := 'Character';
  328. CustomColor := True;
  329. Color := clMaroon;
  330. CustomStyle := False;
  331. Style := [];
  332. BeginText := '''';
  333. EndText := '''';
  334. IgnoreChar := '\';
  335. Switchable := False;
  336. end;
  337. with CustomStyles.Add do begin
  338. Caption := 'Preprocessor Directive';
  339. CustomColor := True;
  340. Color := clTeal;
  341. CustomStyle := True;
  342. Style := [fsBold];
  343. BeginText := '#';
  344. EndText := ' ';
  345. Switchable := False;
  346. end;
  347. ParenthesisColors.CommaText := '$800080,$C08000,$8080FF,$008000';
  348. ParenthesisStyle := [fsBold];
  349. ParenthesisCustomStyle := True;
  350. end;
  351. with SyntaxAsmGNU do begin
  352. NumberColor := SyntaxC.NumberColor;
  353. NumberStyle := SyntaxC.NumberStyle;
  354. NumberCustomStyle := SyntaxC.NumberCustomStyle;
  355. SymbolColor := SyntaxC.SymbolColor;
  356. SymbolStyle := SyntaxC.SymbolStyle;
  357. SymbolCustomStyle := SyntaxC.SymbolCustomStyle;
  358. ParenthesisColors.Assign (SyntaxC.ParenthesisColors);
  359. ParenthesisStyle := SyntaxC.ParenthesisStyle;
  360. ParenthesisCustomStyle := SyntaxC.ParenthesisCustomStyle;
  361. with CustomStyles.Add do begin
  362. Caption := 'Comment Area';
  363. CustomColor := True;
  364. Color := clGreen;
  365. CustomStyle := True;
  366. Style := [fsItalic];
  367. BeginText := '/*';
  368. EndText := '*/';
  369. Switchable := False;
  370. end;
  371. with CustomStyles.Add do begin
  372. Caption := 'Comment Line (|)';
  373. CustomColor := True;
  374. Color := clGreen;
  375. CustomStyle := True;
  376. Style := [fsItalic];
  377. BeginText := '|';
  378. EndText := #13;
  379. Switchable := False;
  380. end;
  381. with CustomStyles.Add do begin
  382. Caption := 'Comment Line (#)';
  383. CustomColor := True;
  384. Color := clGreen;
  385. CustomStyle := True;
  386. Style := [fsItalic];
  387. BeginText := '#';
  388. EndText := #13;
  389. Switchable := False;
  390. LineStartOnly := True;
  391. end;
  392. with CustomStyles.Add do begin
  393. Caption := 'String';
  394. CustomColor := True;
  395. Color := clMaroon;
  396. CustomStyle := False;
  397. Style := [];
  398. BeginText := '"';
  399. EndText := '"';
  400. IgnoreChar := '\';
  401. Switchable := False;
  402. end;
  403. with CustomStyles.Add do begin
  404. Caption := 'Character';
  405. CustomColor := True;
  406. Color := clMaroon;
  407. CustomStyle := False;
  408. Style := [];
  409. BeginText := '''';
  410. EndText := '''';
  411. IgnoreChar := '\';
  412. Switchable := False;
  413. end;
  414. with WordLists.Add do begin
  415. Caption := 'Data Movement';
  416. Words.CommaText := 'EXG,LEA,LINK,MOV,MOVE,MOVEA,MOVEM,MOVEP,MOVEQ,MOVM,MOVP,MOVQ,PEA,UNLK';
  417. Color := clBlue;
  418. CustomColor := True;
  419. CaseSensitive := False;
  420. end;
  421. with WordLists.Add do begin
  422. Caption := 'Integer Arithmetic';
  423. Words.CommaText := 'ADD,ADDA,ADDI,ADDQ,ADDX,CLR,CMP,CMPA,CMPI,CMPM,DIVS,DIVU,EXT,MULS,MULU,NEG,NEGX,SUB,SUBA,SUBI,SUBQ,SUBX,TAS';
  424. Color := clBlue;
  425. CustomColor := True;
  426. CaseSensitive := False;
  427. end;
  428. with WordLists.Add do begin
  429. Caption := 'Logical Instructions';
  430. Words.CommaText := 'AND,ANDI,EOR,EORI,NOT,OR,ORI';
  431. Color := clBlue;
  432. CustomColor := True;
  433. CaseSensitive := False;
  434. end;
  435. with WordLists.Add do begin
  436. Caption := 'Shift/Rotation Instructions';
  437. Words.CommaText := 'ASL,ASR,LSL,LSR,ROL,ROR,ROXL,ROXR,SWAP';
  438. Color := clBlue;
  439. CustomColor := True;
  440. CaseSensitive := False;
  441. end;
  442. with WordLists.Add do begin
  443. Caption := 'Bit Manipulation';
  444. Words.CommaText := 'BCHG,BCLR,BSET,BTST';
  445. Color := clBlue;
  446. CustomColor := True;
  447. CaseSensitive := False;
  448. end;
  449. with WordLists.Add do begin
  450. Caption := 'Program Control';
  451. Words.CommaText := 'BCC,BCS,BEQ,BGE,BGT,BHI,BLE,BLS,BLT,BMI,BNE,BPL,BRA,BSR,BVC,BVS,JBCC,JBCS,JBEQ,JBGE,JBGT,JBHI,JBLE,JBLS,JBLT,JBMI,JBNE,JBPL,JBRA,JBSR,JBVC,JBVS,JSR,JRA,JMP,'
  452. + 'NOP,RTR,RTS,SCC,SCS,SEQ,SF,SGE,SGT,SHI,SLE,SLS,SLT,SMI,SNE,SPL,ST,SVC,SVS,TST,'
  453. + 'JHI,JLS,JCC,JCS,JNE,JEQ,JVC,JVS,JPL,JMI,JGE,JLT,JGT,JLE,DBHI,DBLS,DBCC,DBCS,DBNE,DBEQ,DBVC,DBVS,DBPL,DBMI,DBGE,DBLT,DBGT,DBLE,DBF,DBRA,DBT,'
  454. + 'FJNE,FJEQ,FJGE,FJLT,FJGT,FJLE,FJF,FJT,FJGL,FJGLE,FJNGE,FJNGL,FJNGLE,FJNGT,FJNLE,FJNLT,FJOGE,FJOGL,FJOGT,FJOLE,FJOLT,FJOR,FJSEQ,FJSF,FJSNE,FJST,FJUEQ,FJUGE,FJUGT,FJULE,FJULT,FJUN';
  455. Color := clBlue;
  456. CustomColor := True;
  457. CaseSensitive := False;
  458. end;
  459. with WordLists.Add do begin
  460. Caption := 'System Control';
  461. Words.CommaText := 'ILLEGAL,RTE,TRAP';
  462. Color := clBlue;
  463. CustomColor := True;
  464. CaseSensitive := False;
  465. end;
  466. with WordLists.Add do begin
  467. Caption := 'Extensions';
  468. Words.CommaText := 'B,L,S,W';
  469. Color := $408000;
  470. CustomColor := True;
  471. CaseSensitive := False;
  472. end;
  473. with WordLists.Add do begin
  474. Caption := 'Assembler Directives';
  475. Words.CommaText := 'abort,align,altmacro,ascii,asciz,balign,balignw,balignl,byte,comm,data,'
  476. + 'def,dim,double,eject,else,end,elseif,endef,endfunc,endif,endm,endr,equ,equiv,'
  477. + 'err,even,exitm,extern,fail,file,fill,float,func,global,globl,hword,ident,if,include,'
  478. + 'incbin,int,irp,irpc,lcomm,lflags,line,ln,list,long,macro,mri,noaltmacro,nolist,octa,org,'
  479. + 'p2align,p2alignw,p2alignl,print,psize,purgem,quad,rept,sbttl,scl,section,set,'
  480. + 'short,single,size,sleb128,skip,space,stabd,stabn,stabs,string,struct,tag,text,'
  481. + 'title,type,uleb128,val,vtable_entry,word,xdef';
  482. Color := clBlue;
  483. CustomColor := True;
  484. Style := [fsBold];
  485. CustomStyle := True;
  486. CaseSensitive := True;
  487. end;
  488. with WordLists.Add do begin
  489. Caption := 'Registers';
  490. Words.CommaText := 'a0,a1,a2,a3,a4,a5,a6,a7,d0,d1,d2,d3,d4,d5,d6,d7,fp,pc,sp,sr';
  491. Color := clRed;
  492. CustomColor := True;
  493. Style := [fsUnderline];
  494. CustomStyle := True;
  495. CaseSensitive := False;
  496. end;
  497. end;
  498. with SyntaxAsm do begin
  499. NumberColor := SyntaxC.NumberColor;
  500. NumberStyle := SyntaxC.NumberStyle;
  501. NumberCustomStyle := SyntaxC.NumberCustomStyle;
  502. SymbolColor := SyntaxC.SymbolColor;
  503. SymbolStyle := SyntaxC.SymbolStyle;
  504. SymbolCustomStyle := SyntaxC.SymbolCustomStyle;
  505. ParenthesisColors.Assign (SyntaxC.ParenthesisColors);
  506. ParenthesisStyle := SyntaxC.ParenthesisStyle;
  507. ParenthesisCustomStyle := SyntaxC.ParenthesisCustomStyle;
  508. with CustomStyles.Add do begin
  509. Caption := 'Comment';
  510. CustomColor := True;
  511. Color := clGreen;
  512. CustomStyle := True;
  513. Style := [fsItalic];
  514. BeginText := ';';
  515. EndText := #13;
  516. Switchable := False;
  517. end;
  518. with CustomStyles.Add do begin
  519. Caption := 'String (double-quoted)';
  520. CustomColor := True;
  521. Color := clMaroon;
  522. CustomStyle := False;
  523. Style := [];
  524. BeginText := '"';
  525. EndText := '"';
  526. IgnoreChar := '';
  527. Switchable := False;
  528. end;
  529. with CustomStyles.Add do begin
  530. Caption := 'String (single-quoted)';
  531. CustomColor := True;
  532. Color := clMaroon;
  533. CustomStyle := False;
  534. Style := [];
  535. BeginText := '''';
  536. EndText := '''';
  537. IgnoreChar := '';
  538. Switchable := False;
  539. end;
  540. with WordLists.Add do begin
  541. Caption := 'Data Movement';
  542. Words.CommaText := 'EXG,LEA,LINK,MOVE,MOVEA,MOVEM,MOVEP,MOVEQ,PEA,UNLK';
  543. Color := clBlue;
  544. CustomColor := True;
  545. CaseSensitive := False;
  546. end;
  547. with WordLists.Add do begin
  548. Caption := 'Integer Arithmetic';
  549. Words.CommaText := 'ADD,ADDA,ADDI,ADDQ,ADDX,CLR,CMP,CMPA,CMPI,CMPM,DIVS,DIVU,EXT,MULS,MULU,NEG,NEGX,SUB,SUBA,SUBI,SUBQ,SUBX,TAS';
  550. Color := clBlue;
  551. CustomColor := True;
  552. CaseSensitive := False;
  553. end;
  554. with WordLists.Add do begin
  555. Caption := 'Logical Instructions';
  556. Words.CommaText := 'AND,ANDI,EOR,EORI,NOT,OR,ORI';
  557. Color := clBlue;
  558. CustomColor := True;
  559. CaseSensitive := False;
  560. end;
  561. with WordLists.Add do begin
  562. Caption := 'Shift/Rotation Instructions';
  563. Words.CommaText := 'ASL,ASR,LSL,LSR,ROL,ROLX,ROR,RORX,ROXL,ROXR,SWAP';
  564. Color := clBlue;
  565. CustomColor := True;
  566. CaseSensitive := False;
  567. end;
  568. with WordLists.Add do begin
  569. Caption := 'Bit Manipulation';
  570. Words.CommaText := 'BCHG,BCLR,BSET,BTST';
  571. Color := clBlue;
  572. CustomColor := True;
  573. CaseSensitive := False;
  574. end;
  575. with WordLists.Add do begin
  576. Caption := 'Program Control';
  577. Words.CommaText := 'BCC,BCS,BEQ,BGE,BGT,BHI,BHS,BLE,BLO,BLS,BLT,BMI,BNE,BPL,BRA,BSR,BVC,BVS,DBCC,DBCS,DBEQ,DBF,DBGE,DBGT,DBHI,DBHS,DBLE,DBLO,DBLS,DBLT,DBMI,DBNE,DBPL,DBRA,DBT,DBVC,DBVS,JMP,JSR,NOP,RTR,RTS,'
  578. + 'SCC,SCS,SEQ,SF,SGE,SGT,SHI,SHS,SLE,SLO,SLS,SLT,SMI,SNE,SPL,ST,SVC,SVS,TST';
  579. Color := clBlue;
  580. CustomColor := True;
  581. CaseSensitive := False;
  582. end;
  583. with WordLists.Add do begin
  584. Caption := 'System Control';
  585. Words.CommaText := 'ILLEGAL,RTE,TRAP';
  586. Color := clBlue;
  587. CustomColor := True;
  588. CaseSensitive := False;
  589. end;
  590. with WordLists.Add do begin
  591. Caption := 'Extensions';
  592. Words.CommaText := 'B,L,S,W';
  593. Color := $408000;
  594. CustomColor := True;
  595. CaseSensitive := False;
  596. end;
  597. with WordLists.Add do begin
  598. Caption := 'Assembler Directives';
  599. Words.CommaText := 'BSS,CNOP,CSEG,DSEG,DC,DCB,DS,END,ENDC,ENDIF,ENDM,EQU,EQUR,EVEN,FAR,IDNT,IFC,IFD,IFEQ,IFGE,IFGT,IFLE,IFLT,IFNC,IFND,IFNE,INCBIN,INCLUDE,LIST,MACRO,NEAR,NOLIST,ORG,PAGE,PUBLIC,REG,RORG,SECTION,SET,SPC,TITLE,TTL,XDEF,XREF';
  600. Color := clBlue;
  601. CustomColor := True;
  602. Style := [fsBold];
  603. CustomStyle := True;
  604. CaseSensitive := False;
  605. end;
  606. with WordLists.Add do begin
  607. Caption := 'Registers';
  608. Words.CommaText := 'a0,a1,a2,a3,a4,a5,a6,a7,d0,d1,d2,d3,d4,d5,d6,d7,fp,pc,sp,sr';
  609. Color := clRed;
  610. CustomColor := True;
  611. Style := [fsUnderline];
  612. CustomStyle := True;
  613. CaseSensitive := False;
  614. end;
  615. end;
  616. SyntaxQuill.Assign (SyntaxC);
  617. with SyntaxQuill do begin
  618. with WordLists.Add do begin
  619. Caption := 'Sections';
  620. Words.CommaText := '$$ACTIONS,$$CONNECTIONS,$$END,$$END_TEST,$$EVENTS,$$EXTERN,$$LOCATIONS,$$MESSAGES,$$OBJECTS,$$OLDSTYLE_SYSTEM_MESSAGES,$$PICTURES,$$PICTURES_TEST,$$SYSTEM_MESSAGES,$$TITLE,$$VOCABULARY';
  621. CaseSensitive := True;
  622. CustomColor := True;
  623. Color := $0000FF;
  624. CustomStyle := True;
  625. Style := [fsBold];
  626. end;
  627. with WordLists.Add do begin
  628. Caption := 'Section-specific Keywords';
  629. Words.CommaText := 'ACTION,BITMAP,CBLOCK,CONN,DEFINE,DRAWING,END_BITMAP,END_CBLOCK,END_DRAWING,END_PACKED_BITMAP,EVENT,FROM,LOC,MSG,OBJ,PACKED_BITMAP,WORD';
  630. CaseSensitive := True;
  631. CustomColor := True;
  632. Color := $808040;
  633. CustomStyle := True;
  634. Style := [fsBold];
  635. end;
  636. with WordLists.Add do begin
  637. Caption := 'Additional Keywords';
  638. Words.CommaText := 'CONTINUE,ELSE';
  639. CaseSensitive := True;
  640. CustomColor := True;
  641. Color := $808040;
  642. CustomStyle := True;
  643. Style := [fsBold];
  644. end;
  645. with WordLists.Add do begin
  646. Caption := 'Non-functional Keywords';
  647. Words.CommaText := 'BEEP,BLOCK,BORDER,BRIGHT,FLASH,INK,PAPER';
  648. CaseSensitive := True;
  649. CustomColor := True;
  650. Color := $C0C0C0;
  651. CustomStyle := True;
  652. Style := [fsBold];
  653. end;
  654. with WordLists.Add do begin
  655. Caption := 'Predefined Aliases';
  656. Words.CommaText := '$ALSOSEE,$ARG,$CARRIED,$CENTER,$CNT1,$CNT2,$CNT3,$CNT4,$CONT,$CURLOC,$DARK,$DARKCNT,$DESC,$DESC_CNT,$DESC_DARKCNT,$DESC_NOLIGHTCNT,$DONE,$ENDGAME,$EXIT,$FAIL,$FONT,$FULLSCR,$GCONTROL,$LSOURCE,'
  657. + '$MAXCAR,$NOLIGHTCNT,$NOUN,$NOWHERE,$NULL,$NUMCAR,$PROMPT,$RESTART,$SCORE,$SPECIAL,$SUBROUTINE,$TURNHI,$TURNLO,$VERB,$WORN';
  658. CaseSensitive := True;
  659. CustomColor := True;
  660. Color := $800080;
  661. CustomStyle := True;
  662. Style := [fsBold];
  663. end;
  664. with WordLists.Add do begin
  665. Caption := 'Conditions';
  666. Words.CommaText := 'ABSENT,AT,ATGT,ATLT,CARRIED,CHANCE,CREATED,EQ,EQWORD,EXTWORD,GT,HERE,ISAT,ISDESC,ISNOTAT,ISNOTNULL,ISNULL,LT,NEQWORD,NOTAT,NOTCARR,NOTCREATED,NOTEQ,NOTHERE,NOTSAME,NOTWORN,NOTZERO,PRESENT,SAME,TRYMOVE,WORN,ZERO';
  667. CaseSensitive := True;
  668. CustomColor := True;
  669. Color := $FF0000;
  670. CustomStyle := True;
  671. Style := [fsBold];
  672. end;
  673. with WordLists.Add do begin
  674. Caption := 'Actions';
  675. Words.CommaText := 'ADD,ALSOSEE,ANYKEY,AUTOD,AUTOG,AUTOR,AUTOW,BIGFONT,CANCEL,CLEAR,CLS,COPYFF,COPYFO,COPYOF,COPYOO,CREATE,DECCAR,DESC,DESTROY,DONE,DROP,DROPALL,END,ENDDESC,EXIT,EXTERN,GET,GETWORD,GOTO,INCCAR,INVEN,LET,'
  676. + 'LISTAT,LISTOBJ,LOAD,MAXCAR,MES,MESFLAG,MESSAGE,MINUS,NEWLINE,NOTDONE,OK,PAUSE,PICNORM,PICOFF,PICON,PLACE,PLUS,PRINT,PROMPT,PUTO,QUIT,QVERSION,RAMLOAD,RAMSAVE,RANDOM,REDRAW,REMOVE,RESTART,SAVE,SCORE,'
  677. + 'SET,SETNOUN,SETVERB,SHOWLOC,SMLFONT,SUB,SWAP,SYSMESS,TURNS,WEAR,WHATO,WHEREO,ZAPSCR';
  678. CaseSensitive := True;
  679. CustomColor := True;
  680. Color := $A00000;
  681. CustomStyle := True;
  682. Style := [fsBold];
  683. end;
  684. with WordLists.Add do begin
  685. Caption := 'Drawing Primitives';
  686. Words.CommaText := 'AMOVE,CALL,ELLIPSE,FILL,INV_ELLIPSE,INV_LINE,INV_PLOT,INV_RPLOT,LINE,MOVE,PLOT,RPLOT,SHADE,XOR_ELLIPSE,XOR_LINE,XOR_PLOT,XOR_RPLOT';
  687. CaseSensitive := True;
  688. CustomColor := True;
  689. Color := $FF8000;
  690. CustomStyle := True;
  691. Style := [fsBold];
  692. end;
  693. with WordLists.Add do begin
  694. Caption := 'Drawing Directions';
  695. Words.CommaText := 'DOWN,DOWN_LEFT,DOWN_RIGHT,LEFT,LEFT_DOWN,LEFT_UP,RIGHT,RIGHT_DOWN,RIGHT_UP,UP,UP_LEFT,UP_RIGHT';
  696. CaseSensitive := True;
  697. CustomColor := True;
  698. Color := $008000;
  699. CustomStyle := True;
  700. Style := [fsBold];
  701. end;
  702. with WordLists.Add do begin
  703. Caption := 'Shading Patterns';
  704. Words.CommaText := '$BKSLASHFILL,$BRICKFILL,$CHAINFILL,$CIRCLEFILL,$CLOSEDASHFILL,$CLOSEDOTFILL,$CLOSEWAVEFILL,$CROSSFILL,$DASHFILL,$DOTFILL,$HATCHFILL,$INTERLEAVEFILL,$LIGHTDOTFILL,$LIGHTLINEFILL,$LINEFILL,$SLASHFILL,'
  705. + '$SOLIDFILL,$SQDOTFILL,$SQUAREFILL,$THICKBKSLASHFILL,$THICKHATCHFILL,$THICKLINEFILL,$THICKSLASHFILL,$VDASHFILL,$VINTERLEAVEFILL,$VLDOTFILL,$VLIGHTLINEFILL,$VLINEFILL,$VTHICKLINEFILL,$WAVEFILL,$WIDEDOTFILL,$XMARKFILL,$ZIGZAGFILL';
  706. CaseSensitive := True;
  707. CustomColor := True;
  708. Color := $800080;
  709. CustomStyle := True;
  710. Style := [fsBold];
  711. end;
  712. with WordLists.Add do begin
  713. Caption := 'External Symbols';
  714. Words.CommaText := '$ACTIONS$,$ARG$,$BMPUT$,$BPCKPUT$,$BUFFER$,$CONNECTIONS$,$EVENTS$,$EXTERN$,$FLAGS$,$FLAGS_BACKUP$,$GDF$,$GETLINE$,$LOCATIONS$,$LQL$,$MAXCAR$,$MESSAGES$,$NFLAG$,$NLOC$,$NMSG$,$NOBJ$,$NSYSMSG$,$NWORD$,'
  715. + '$OBJECTS$,$PDRAW$,$PICTURE$,$PRINT$,$RAM_SAVED$,$SCALEX$,$SCALEY$,$SSCR$,$SYSTEM_MESSAGES$,$WORDS$';
  716. CaseSensitive := True;
  717. CustomColor := True;
  718. Color := $408000;
  719. CustomStyle := True;
  720. Style := [fsBold];
  721. end;
  722. end;
  723. EditorFont.Name := 'Courier New';
  724. EditorFont.Size := 10;
  725. EditorColor := clWindow;
  726. DecimalSeparator := '.';
  727. finalization
  728. EditorFont.Free;
  729. SyntaxQuill.Free;
  730. SyntaxAsm.Free;
  731. SyntaxAsmGNU.Free;
  732. SyntaxC.Free;
  733. MainConsole.Free;
  734. PredefinedLibOptions.Free;
  735. end.