MasterUnit.pas 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777
  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, ttTIEmu);
  53. TVTICalcType = (cvVTINone, cvVTITI89, cvVTITI92Plus, cvVTITI92);
  54. TTiEmuCalcType = (cvTIEmuNone = 0, cvTIEmuTI92 = 1, cvTIEmuTI89 = 2, cvTIEmuTI92Plus = 4, cvTIEmuV200 = 8, cvTIEmuTI89Ti = 16);
  55. TKernelFormat = (kfUnknown, kfNone, kfStandard, kfCompressedTables);
  56. TRelocFormat = (rfUnknown, rfNone, rfDirect, rfAMS, rfKernel, rfCompressed, rfMlink, rfFLine);
  57. TPredefinedLibOptions = class(TObject)
  58. CalcDests: TCalcDests;
  59. OptimizeCalcConsts: Boolean;
  60. KernelFormat: TKernelFormat;
  61. UseMinAMS: Boolean;
  62. MinAMS: string;
  63. UnofficialOSSupport: Boolean;
  64. RelocFormat,
  65. ROMCallFormat,
  66. BSSRefFormat,
  67. DataRefFormat: TRelocFormat;
  68. UseFLineJumps,
  69. Use4ByteFLineJumps,
  70. OptimizeROMCalls,
  71. UseInternalFLineEmulator: Boolean;
  72. UseReturnValue,
  73. EnableErrorReturn: Boolean;
  74. SaveScreen: Boolean;
  75. function GetSwitches: string;
  76. end;
  77. var
  78. MainConsole: TProcessConsole;
  79. StopOnErrors,
  80. DeleteAssemblyFiles,
  81. DeleteObjectFiles,
  82. AssumeUndefined,
  83. AutoBlocks,
  84. AutoNews,
  85. UseDataVar,
  86. DataVarCopy,
  87. DataVarCopyIfArchived,
  88. Pack,
  89. DebugInfo,
  90. StdLib,
  91. InitBSS,
  92. OptimizeNOPs,
  93. OptimizeReturns,
  94. OptimizeBranches,
  95. OptimizeMoves,
  96. OptimizeTests,
  97. OptimizeCalculations,
  98. RemoveUnusedSections,
  99. CutUnusedRanges,
  100. ReorderSections,
  101. MergeConstants,
  102. OutputBin: Boolean;
  103. ProjectTarget: TProjectTarget;
  104. GCCSwitches,
  105. AsSwitches,
  106. AsmSwitches,
  107. DataVar,
  108. PackVar,
  109. CommandLine,
  110. PostBuildProcessFile: string;
  111. PredefinedLibOptions: TPredefinedLibOptions;
  112. ProxyName: string;
  113. ProxyPort: Integer;
  114. TIGCCFolder: string;
  115. Temp: string;
  116. OperationCancelled,
  117. OperationSuccessful: Boolean;
  118. ProjectFileName: string;
  119. SyntaxC,
  120. SyntaxAsmGNU,
  121. SyntaxAsm,
  122. SyntaxQuill: TSyntaxColoring;
  123. TabSizeC,
  124. TabSizeAsm: Integer;
  125. EditorColor: TColor;
  126. EditorFont: TFont;
  127. EditorOnFly,
  128. EditorDragDrop,
  129. EditorRemoveTrSp: Boolean;
  130. LastNewsDate: Integer;
  131. TransferTarget: TTransferTarget;
  132. VTIPath: string;
  133. TIEmuPath: string;
  134. LinkPort: TLinkPort;
  135. LinkCable: TLinkCableType;
  136. SpecialSupport: TSpecialSupport;
  137. Compiling,
  138. CompFinishAndStop,
  139. CompStopNow: Boolean;
  140. CompStartTime,
  141. CompFileStartTime,
  142. CompLastTime: TDateTime;
  143. CompStartFile: procedure of object;
  144. CompStop: procedure of object;
  145. CompSetMessage: procedure(const Msg: string) of object;
  146. CompUpdate: procedure of object;
  147. CompUpdateProgramOutput: procedure of object;
  148. {$IFDEF CanSplit}
  149. var
  150. SplitFiles: Boolean;
  151. {$ENDIF}
  152. function StartsWith(const SubStr: string; var Str: string; CaseSensitive: Boolean = False; Remove: Boolean = False): Boolean;
  153. procedure WaitForMainConsole(const ProcessDesc: string);
  154. function Runnable: Boolean;
  155. implementation
  156. uses
  157. SysUtils, Forms;
  158. procedure WaitForMainConsole(const ProcessDesc: string);
  159. begin
  160. CompUpdate;
  161. while MainConsole.Running do begin
  162. CompUpdate;
  163. Application.ProcessMessages;
  164. if CompFinishAndStop then begin
  165. OperationCancelled := True;
  166. CompSetMessage ('Finishing ' + ProcessDesc + ' Process');
  167. end;
  168. if CompStopNow then begin
  169. OperationCancelled := True;
  170. MainConsole.KillProcess;
  171. Break;
  172. end;
  173. end;
  174. CompUpdate;
  175. end;
  176. function Runnable: Boolean;
  177. begin
  178. Result := (ProjectTarget <> ptArchive) and (ProjectTarget <> ptFlashOS) and (TransferTarget <> ttNone);
  179. end;
  180. function StartsWith(const SubStr: string; var Str: string; CaseSensitive: Boolean; Remove: Boolean): Boolean;
  181. begin
  182. if CaseSensitive then
  183. Result := Copy (Str, 1, Length (SubStr)) = SubStr
  184. else
  185. Result := UpperCase (Copy (Str, 1, Length (SubStr))) = UpperCase (SubStr);
  186. if Remove and Result then
  187. Delete (Str, 1, Length (SubStr));
  188. end;
  189. { TPredefinedLibOptions }
  190. function TPredefinedLibOptions.GetSwitches: string;
  191. procedure AddSwitch(Define: string; const Value: string = '');
  192. begin
  193. if Length (Result) > 0 then
  194. Result := Result + ' ';
  195. Define := '-D' + Define;
  196. if Length (Value) > 0 then
  197. Define := '"' + Define + '=' + Value + '"';
  198. Result := Result + Define;
  199. end;
  200. begin
  201. Result := '';
  202. if cdTI92 in CalcDests then
  203. AddSwitch ('USE_TI92');
  204. if cdTI89 in CalcDests then
  205. AddSwitch ('USE_TI89');
  206. if cdTI92Plus in CalcDests then
  207. AddSwitch ('USE_TI92PLUS');
  208. if cdV200 in CalcDests then
  209. AddSwitch ('USE_V200');
  210. if OptimizeCalcConsts then
  211. AddSwitch ('OPTIMIZE_CALC_CONSTS');
  212. if KernelFormat in [kfStandard, kfCompressedTables] then begin
  213. AddSwitch ('USE_KERNEL');
  214. if KernelFormat = kfCompressedTables then
  215. AddSwitch ('USE_PREOS_COMPRESSED_TABLES');
  216. end;
  217. if UseMinAMS then try
  218. AddSwitch ('MIN_AMS', IntToStr (Round (StrToFloat (MinAMS) * 100)));
  219. except end;
  220. if UnofficialOSSupport then
  221. AddSwitch ('UNOFFICIAL_OS_SUPPORT');
  222. if KernelFormat = kfCompressedTables then begin
  223. if BSSRefFormat = rfNone then
  224. AddSwitch ('MERGE_BSS');
  225. end else begin
  226. case RelocFormat of
  227. rfKernel: AddSwitch ('KERNEL_FORMAT_RELOCS');
  228. rfCompressed: AddSwitch ('COMPRESSED_FORMAT_RELOCS');
  229. rfMLink: AddSwitch ('MLINK_FORMAT_RELOCS');
  230. rfFLine: AddSwitch ('USE_FLINE_JUMPS');
  231. end;
  232. case ROMCallFormat of
  233. rfKernel: AddSwitch ('KERNEL_FORMAT_ROM_CALLS');
  234. rfCompressed: AddSwitch ('COMPRESSED_FORMAT_ROM_CALLS');
  235. rfMlink: AddSwitch ('MLINK_FORMAT_ROM_CALLS');
  236. rfFLine: begin
  237. AddSwitch ('USE_FLINE_ROM_CALLS');
  238. Result := Result + ' -fno-function-cse';
  239. end;
  240. end;
  241. case BSSRefFormat of
  242. rfNone: AddSwitch ('MERGE_BSS');
  243. rfKernel: AddSwitch ('KERNEL_FORMAT_BSS');
  244. rfCompressed: AddSwitch ('COMPRESSED_FORMAT_BSS');
  245. rfMlink: AddSwitch ('MLINK_FORMAT_BSS');
  246. end;
  247. end;
  248. case DataRefFormat of
  249. rfKernel: AddSwitch ('KERNEL_FORMAT_DATA_VAR');
  250. rfCompressed: AddSwitch ('COMPRESSED_FORMAT_DATA_VAR');
  251. rfMlink: AddSwitch ('MLINK_FORMAT_DATA_VAR');
  252. end;
  253. if UseFLineJumps then begin
  254. AddSwitch ('USE_FLINE_JUMPS');
  255. if Use4ByteFLineJumps then
  256. AddSwitch ('USE_4_BYTE_FLINE_JUMPS');
  257. end;
  258. if OptimizeROMCalls then
  259. AddSwitch ('OPTIMIZE_ROM_CALLS');
  260. if UseInternalFLineEmulator then
  261. AddSwitch ('USE_INTERNAL_FLINE_EMULATOR');
  262. if UseReturnValue then
  263. AddSwitch ('RETURN_VALUE');
  264. if EnableErrorReturn then
  265. AddSwitch ('ENABLE_ERROR_RETURN');
  266. if SaveScreen then
  267. AddSwitch ('SAVE_SCREEN');
  268. end;
  269. initialization
  270. PredefinedLibOptions := TPredefinedLibOptions.Create;
  271. PredefinedLibOptions.MinAMS := '1.01';
  272. MainConsole := TProcessConsole.Create;
  273. SyntaxC := TSyntaxColoring.Create (nil);
  274. SyntaxAsm := TSyntaxColoring.Create (nil);
  275. SyntaxAsmGNU := TSyntaxColoring.Create (nil);
  276. SyntaxQuill := TSyntaxColoring.Create (nil);
  277. EditorFont := TFont.Create;
  278. with SyntaxC do begin
  279. Enabled := True;
  280. SymbolColor := clOlive;
  281. SymbolStyle := [fsBold];
  282. SymbolCustomStyle := True;
  283. NumberColor := clMaroon;
  284. NumberStyle := [];
  285. NumberCustomStyle := False;
  286. with WordLists.Add do begin
  287. Caption := 'C Keywords';
  288. Words.CommaText :=
  289. '__alignof__,__asm__,__attribute__,__complex__,__const__,__extension__,__imag__,__inline__,__label__,__real__,__typeof__,' +
  290. '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';
  291. CaseSensitive := True;
  292. CustomColor := True;
  293. Color := clBlue;
  294. CustomStyle := True;
  295. Style := [fsBold];
  296. end;
  297. with CustomStyles.Add do begin
  298. Caption := 'Comment Area';
  299. CustomColor := True;
  300. Color := clGreen;
  301. CustomStyle := True;
  302. Style := [fsItalic];
  303. BeginText := '/*';
  304. EndText := '*/';
  305. Switchable := False;
  306. end;
  307. with CustomStyles.Add do begin
  308. Caption := 'Comment Line';
  309. CustomColor := True;
  310. Color := clGreen;
  311. CustomStyle := True;
  312. Style := [fsItalic];
  313. BeginText := '//';
  314. EndText := #13;
  315. Switchable := False;
  316. end;
  317. with CustomStyles.Add do begin
  318. Caption := 'String';
  319. CustomColor := True;
  320. Color := clMaroon;
  321. CustomStyle := False;
  322. Style := [];
  323. BeginText := '"';
  324. EndText := '"';
  325. IgnoreChar := '\';
  326. Switchable := False;
  327. end;
  328. with CustomStyles.Add do begin
  329. Caption := 'Character';
  330. CustomColor := True;
  331. Color := clMaroon;
  332. CustomStyle := False;
  333. Style := [];
  334. BeginText := '''';
  335. EndText := '''';
  336. IgnoreChar := '\';
  337. Switchable := False;
  338. end;
  339. with CustomStyles.Add do begin
  340. Caption := 'Preprocessor Directive';
  341. CustomColor := True;
  342. Color := clTeal;
  343. CustomStyle := True;
  344. Style := [fsBold];
  345. BeginText := '#';
  346. EndText := ' ';
  347. Switchable := False;
  348. end;
  349. ParenthesisColors.CommaText := '$800080,$C08000,$8080FF,$008000';
  350. ParenthesisStyle := [fsBold];
  351. ParenthesisCustomStyle := True;
  352. end;
  353. with SyntaxAsmGNU do begin
  354. NumberColor := SyntaxC.NumberColor;
  355. NumberStyle := SyntaxC.NumberStyle;
  356. NumberCustomStyle := SyntaxC.NumberCustomStyle;
  357. SymbolColor := SyntaxC.SymbolColor;
  358. SymbolStyle := SyntaxC.SymbolStyle;
  359. SymbolCustomStyle := SyntaxC.SymbolCustomStyle;
  360. ParenthesisColors.Assign (SyntaxC.ParenthesisColors);
  361. ParenthesisStyle := SyntaxC.ParenthesisStyle;
  362. ParenthesisCustomStyle := SyntaxC.ParenthesisCustomStyle;
  363. with CustomStyles.Add do begin
  364. Caption := 'Comment Area';
  365. CustomColor := True;
  366. Color := clGreen;
  367. CustomStyle := True;
  368. Style := [fsItalic];
  369. BeginText := '/*';
  370. EndText := '*/';
  371. Switchable := False;
  372. end;
  373. with CustomStyles.Add do begin
  374. Caption := 'Comment Line (|)';
  375. CustomColor := True;
  376. Color := clGreen;
  377. CustomStyle := True;
  378. Style := [fsItalic];
  379. BeginText := '|';
  380. EndText := #13;
  381. Switchable := False;
  382. end;
  383. with CustomStyles.Add do begin
  384. Caption := 'Comment Line (#)';
  385. CustomColor := True;
  386. Color := clGreen;
  387. CustomStyle := True;
  388. Style := [fsItalic];
  389. BeginText := '#';
  390. EndText := #13;
  391. Switchable := False;
  392. LineStartOnly := True;
  393. end;
  394. with CustomStyles.Add do begin
  395. Caption := 'String';
  396. CustomColor := True;
  397. Color := clMaroon;
  398. CustomStyle := False;
  399. Style := [];
  400. BeginText := '"';
  401. EndText := '"';
  402. IgnoreChar := '\';
  403. Switchable := False;
  404. end;
  405. with CustomStyles.Add do begin
  406. Caption := 'Character';
  407. CustomColor := True;
  408. Color := clMaroon;
  409. CustomStyle := False;
  410. Style := [];
  411. BeginText := '''';
  412. EndText := '''';
  413. IgnoreChar := '\';
  414. Switchable := False;
  415. end;
  416. with WordLists.Add do begin
  417. Caption := 'Data Movement';
  418. Words.CommaText := 'EXG,LEA,LINK,MOV,MOVE,MOVEA,MOVEM,MOVEP,MOVEQ,MOVM,MOVP,MOVQ,PEA,UNLK';
  419. Color := clBlue;
  420. CustomColor := True;
  421. CaseSensitive := False;
  422. end;
  423. with WordLists.Add do begin
  424. Caption := 'Integer Arithmetic';
  425. 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';
  426. Color := clBlue;
  427. CustomColor := True;
  428. CaseSensitive := False;
  429. end;
  430. with WordLists.Add do begin
  431. Caption := 'Logical Instructions';
  432. Words.CommaText := 'AND,ANDI,EOR,EORI,NOT,OR,ORI';
  433. Color := clBlue;
  434. CustomColor := True;
  435. CaseSensitive := False;
  436. end;
  437. with WordLists.Add do begin
  438. Caption := 'Shift/Rotation Instructions';
  439. Words.CommaText := 'ASL,ASR,LSL,LSR,ROL,ROR,ROXL,ROXR,SWAP';
  440. Color := clBlue;
  441. CustomColor := True;
  442. CaseSensitive := False;
  443. end;
  444. with WordLists.Add do begin
  445. Caption := 'Binary-Coded Decimal Instructions';
  446. Words.CommaText := 'ABCD,NBCD,SBCD';
  447. Color := clBlue;
  448. CustomColor := True;
  449. CaseSensitive := False;
  450. end;
  451. with WordLists.Add do begin
  452. Caption := 'Bit Manipulation';
  453. Words.CommaText := 'BCHG,BCLR,BSET,BTST';
  454. Color := clBlue;
  455. CustomColor := True;
  456. CaseSensitive := False;
  457. end;
  458. with WordLists.Add do begin
  459. Caption := 'Program Control';
  460. 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,'
  461. + 'NOP,RTR,RTS,SCC,SCS,SEQ,SF,SGE,SGT,SHI,SLE,SLS,SLT,SMI,SNE,SPL,ST,SVC,SVS,TST,'
  462. + '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,'
  463. + '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';
  464. Color := clBlue;
  465. CustomColor := True;
  466. CaseSensitive := False;
  467. end;
  468. with WordLists.Add do begin
  469. Caption := 'System Control';
  470. Words.CommaText := 'CHK,ILLEGAL,RESET,RTE,STOP,TRAP,TRAPV';
  471. Color := clBlue;
  472. CustomColor := True;
  473. CaseSensitive := False;
  474. end;
  475. with WordLists.Add do begin
  476. Caption := 'Extensions';
  477. Words.CommaText := 'B,L,S,W';
  478. Color := $408000;
  479. CustomColor := True;
  480. CaseSensitive := False;
  481. end;
  482. with WordLists.Add do begin
  483. Caption := 'Assembler Directives';
  484. Words.CommaText := 'abort,align,altmacro,ascii,asciz,balign,balignw,balignl,byte,comm,data,'
  485. + 'def,dim,double,eject,else,end,elseif,endef,endfunc,endif,endm,endr,equ,equiv,'
  486. + 'err,even,exitm,extern,fail,file,fill,float,func,global,globl,hword,ident,if,include,'
  487. + 'incbin,int,irp,irpc,lcomm,lflags,line,ln,list,long,macro,mri,noaltmacro,nolist,octa,org,'
  488. + 'p2align,p2alignw,p2alignl,print,psize,purgem,quad,rept,sbttl,scl,section,set,'
  489. + 'short,single,size,sleb128,skip,space,stabd,stabn,stabs,string,struct,tag,text,'
  490. + 'title,type,uleb128,val,vtable_entry,word,xdef';
  491. Color := clBlue;
  492. CustomColor := True;
  493. Style := [fsBold];
  494. CustomStyle := True;
  495. CaseSensitive := True;
  496. end;
  497. with WordLists.Add do begin
  498. Caption := 'Registers';
  499. Words.CommaText := 'a0,a1,a2,a3,a4,a5,a6,a7,d0,d1,d2,d3,d4,d5,d6,d7,fp,pc,sp,sr';
  500. Color := clRed;
  501. CustomColor := True;
  502. Style := [fsUnderline];
  503. CustomStyle := True;
  504. CaseSensitive := False;
  505. end;
  506. end;
  507. with SyntaxAsm do begin
  508. NumberColor := SyntaxC.NumberColor;
  509. NumberStyle := SyntaxC.NumberStyle;
  510. NumberCustomStyle := SyntaxC.NumberCustomStyle;
  511. SymbolColor := SyntaxC.SymbolColor;
  512. SymbolStyle := SyntaxC.SymbolStyle;
  513. SymbolCustomStyle := SyntaxC.SymbolCustomStyle;
  514. ParenthesisColors.Assign (SyntaxC.ParenthesisColors);
  515. ParenthesisStyle := SyntaxC.ParenthesisStyle;
  516. ParenthesisCustomStyle := SyntaxC.ParenthesisCustomStyle;
  517. with CustomStyles.Add do begin
  518. Caption := 'Comment';
  519. CustomColor := True;
  520. Color := clGreen;
  521. CustomStyle := True;
  522. Style := [fsItalic];
  523. BeginText := ';';
  524. EndText := #13;
  525. Switchable := False;
  526. end;
  527. with CustomStyles.Add do begin
  528. Caption := 'String (double-quoted)';
  529. CustomColor := True;
  530. Color := clMaroon;
  531. CustomStyle := False;
  532. Style := [];
  533. BeginText := '"';
  534. EndText := '"';
  535. IgnoreChar := '';
  536. Switchable := False;
  537. end;
  538. with CustomStyles.Add do begin
  539. Caption := 'String (single-quoted)';
  540. CustomColor := True;
  541. Color := clMaroon;
  542. CustomStyle := False;
  543. Style := [];
  544. BeginText := '''';
  545. EndText := '''';
  546. IgnoreChar := '';
  547. Switchable := False;
  548. end;
  549. with WordLists.Add do begin
  550. Caption := 'Data Movement';
  551. Words.CommaText := 'EXG,LEA,LINK,MOVE,MOVEA,MOVEM,MOVEP,MOVEQ,PEA,UNLK';
  552. Color := clBlue;
  553. CustomColor := True;
  554. CaseSensitive := False;
  555. end;
  556. with WordLists.Add do begin
  557. Caption := 'Integer Arithmetic';
  558. 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';
  559. Color := clBlue;
  560. CustomColor := True;
  561. CaseSensitive := False;
  562. end;
  563. with WordLists.Add do begin
  564. Caption := 'Logical Instructions';
  565. Words.CommaText := 'AND,ANDI,EOR,EORI,NOT,OR,ORI';
  566. Color := clBlue;
  567. CustomColor := True;
  568. CaseSensitive := False;
  569. end;
  570. with WordLists.Add do begin
  571. Caption := 'Shift/Rotation Instructions';
  572. Words.CommaText := 'ASL,ASR,LSL,LSR,ROL,ROLX,ROR,RORX,ROXL,ROXR,SWAP';
  573. Color := clBlue;
  574. CustomColor := True;
  575. CaseSensitive := False;
  576. end;
  577. with WordLists.Add do begin
  578. Caption := 'Binary-Coded Decimal Instructions';
  579. Words.CommaText := 'ABCD,NBCD,SBCD';
  580. Color := clBlue;
  581. CustomColor := True;
  582. CaseSensitive := False;
  583. end;
  584. with WordLists.Add do begin
  585. Caption := 'Bit Manipulation';
  586. Words.CommaText := 'BCHG,BCLR,BSET,BTST';
  587. Color := clBlue;
  588. CustomColor := True;
  589. CaseSensitive := False;
  590. end;
  591. with WordLists.Add do begin
  592. Caption := 'Program Control';
  593. 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,'
  594. + 'SCC,SCS,SEQ,SF,SGE,SGT,SHI,SHS,SLE,SLO,SLS,SLT,SMI,SNE,SPL,ST,SVC,SVS,TST';
  595. Color := clBlue;
  596. CustomColor := True;
  597. CaseSensitive := False;
  598. end;
  599. with WordLists.Add do begin
  600. Caption := 'System Control';
  601. Words.CommaText := 'CHK,ILLEGAL,RESET,RTE,STOP,TRAP,TRAPV';
  602. Color := clBlue;
  603. CustomColor := True;
  604. CaseSensitive := False;
  605. end;
  606. with WordLists.Add do begin
  607. Caption := 'Extensions';
  608. Words.CommaText := 'B,L,S,W';
  609. Color := $408000;
  610. CustomColor := True;
  611. CaseSensitive := False;
  612. end;
  613. with WordLists.Add do begin
  614. Caption := 'Assembler Directives';
  615. 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';
  616. Color := clBlue;
  617. CustomColor := True;
  618. Style := [fsBold];
  619. CustomStyle := True;
  620. CaseSensitive := False;
  621. end;
  622. with WordLists.Add do begin
  623. Caption := 'Registers';
  624. Words.CommaText := 'a0,a1,a2,a3,a4,a5,a6,a7,d0,d1,d2,d3,d4,d5,d6,d7,fp,pc,sp,sr';
  625. Color := clRed;
  626. CustomColor := True;
  627. Style := [fsUnderline];
  628. CustomStyle := True;
  629. CaseSensitive := False;
  630. end;
  631. end;
  632. SyntaxQuill.Assign (SyntaxC);
  633. with SyntaxQuill do begin
  634. with WordLists.Add do begin
  635. Caption := 'Sections';
  636. Words.CommaText := '$$ACTIONS,$$CONNECTIONS,$$END,$$END_TEST,$$EVENTS,$$EXTERN,$$LOCATIONS,$$MESSAGES,$$OBJECTS,$$OLDSTYLE_SYSTEM_MESSAGES,$$PICTURES,$$PICTURES_TEST,$$SYSTEM_MESSAGES,$$TITLE,$$VOCABULARY';
  637. CaseSensitive := True;
  638. CustomColor := True;
  639. Color := $0000FF;
  640. CustomStyle := True;
  641. Style := [fsBold];
  642. end;
  643. with WordLists.Add do begin
  644. Caption := 'Section-specific Keywords';
  645. 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';
  646. CaseSensitive := True;
  647. CustomColor := True;
  648. Color := $808040;
  649. CustomStyle := True;
  650. Style := [fsBold];
  651. end;
  652. with WordLists.Add do begin
  653. Caption := 'Additional Keywords';
  654. Words.CommaText := 'CONTINUE,ELSE';
  655. CaseSensitive := True;
  656. CustomColor := True;
  657. Color := $808040;
  658. CustomStyle := True;
  659. Style := [fsBold];
  660. end;
  661. with WordLists.Add do begin
  662. Caption := 'Non-functional Keywords';
  663. Words.CommaText := 'BEEP,BLOCK,BORDER,BRIGHT,FLASH,INK,PAPER';
  664. CaseSensitive := True;
  665. CustomColor := True;
  666. Color := $C0C0C0;
  667. CustomStyle := True;
  668. Style := [fsBold];
  669. end;
  670. with WordLists.Add do begin
  671. Caption := 'Predefined Aliases';
  672. 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,'
  673. + '$MAXCAR,$NOLIGHTCNT,$NOUN,$NOWHERE,$NULL,$NUMCAR,$PROMPT,$RESTART,$SCORE,$SPECIAL,$SUBROUTINE,$TURNHI,$TURNLO,$VERB,$WORN';
  674. CaseSensitive := True;
  675. CustomColor := True;
  676. Color := $800080;
  677. CustomStyle := True;
  678. Style := [fsBold];
  679. end;
  680. with WordLists.Add do begin
  681. Caption := 'Conditions';
  682. 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';
  683. CaseSensitive := True;
  684. CustomColor := True;
  685. Color := $FF0000;
  686. CustomStyle := True;
  687. Style := [fsBold];
  688. end;
  689. with WordLists.Add do begin
  690. Caption := 'Actions';
  691. 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,'
  692. + '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,'
  693. + 'SET,SETNOUN,SETVERB,SHOWLOC,SMLFONT,SUB,SWAP,SYSMESS,TURNS,WEAR,WHATO,WHEREO,ZAPSCR';
  694. CaseSensitive := True;
  695. CustomColor := True;
  696. Color := $A00000;
  697. CustomStyle := True;
  698. Style := [fsBold];
  699. end;
  700. with WordLists.Add do begin
  701. Caption := 'Drawing Primitives';
  702. 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';
  703. CaseSensitive := True;
  704. CustomColor := True;
  705. Color := $FF8000;
  706. CustomStyle := True;
  707. Style := [fsBold];
  708. end;
  709. with WordLists.Add do begin
  710. Caption := 'Drawing Directions';
  711. Words.CommaText := 'DOWN,DOWN_LEFT,DOWN_RIGHT,LEFT,LEFT_DOWN,LEFT_UP,RIGHT,RIGHT_DOWN,RIGHT_UP,UP,UP_LEFT,UP_RIGHT';
  712. CaseSensitive := True;
  713. CustomColor := True;
  714. Color := $008000;
  715. CustomStyle := True;
  716. Style := [fsBold];
  717. end;
  718. with WordLists.Add do begin
  719. Caption := 'Shading Patterns';
  720. Words.CommaText := '$BKSLASHFILL,$BRICKFILL,$CHAINFILL,$CIRCLEFILL,$CLOSEDASHFILL,$CLOSEDOTFILL,$CLOSEWAVEFILL,$CROSSFILL,$DASHFILL,$DOTFILL,$HATCHFILL,$INTERLEAVEFILL,$LIGHTDOTFILL,$LIGHTLINEFILL,$LINEFILL,$SLASHFILL,'
  721. + '$SOLIDFILL,$SQDOTFILL,$SQUAREFILL,$THICKBKSLASHFILL,$THICKHATCHFILL,$THICKLINEFILL,$THICKSLASHFILL,$VDASHFILL,$VINTERLEAVEFILL,$VLDOTFILL,$VLIGHTLINEFILL,$VLINEFILL,$VTHICKLINEFILL,$WAVEFILL,$WIDEDOTFILL,$XMARKFILL,$ZIGZAGFILL';
  722. CaseSensitive := True;
  723. CustomColor := True;
  724. Color := $800080;
  725. CustomStyle := True;
  726. Style := [fsBold];
  727. end;
  728. with WordLists.Add do begin
  729. Caption := 'External Symbols';
  730. 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$,'
  731. + '$OBJECTS$,$PDRAW$,$PICTURE$,$PRINT$,$RAM_SAVED$,$SCALEX$,$SCALEY$,$SSCR$,$SYSTEM_MESSAGES$,$WORDS$';
  732. CaseSensitive := True;
  733. CustomColor := True;
  734. Color := $408000;
  735. CustomStyle := True;
  736. Style := [fsBold];
  737. end;
  738. end;
  739. EditorFont.Name := 'Courier New';
  740. EditorFont.Size := 10;
  741. EditorColor := clWindow;
  742. DecimalSeparator := '.';
  743. finalization
  744. EditorFont.Free;
  745. SyntaxQuill.Free;
  746. SyntaxAsm.Free;
  747. SyntaxAsmGNU.Free;
  748. SyntaxC.Free;
  749. MainConsole.Free;
  750. PredefinedLibOptions.Free;
  751. end.