rautils.pas 41 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459
  1. {
  2. $Id$
  3. Copyright (c) 1998 Carl Eric Codere
  4. This unit implements some support routines for assembler parsing
  5. independent of the processor
  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 of the License, or
  9. (at your option) 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
  16. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17. **********************************************************************}
  18. Unit RAUtils;
  19. Interface
  20. Uses
  21. strings,
  22. cobjects,
  23. globtype,systems,verbose,globals,files,
  24. symconst,symtable,aasm,hcodegen
  25. {$ifdef i386}
  26. ,i386base,i386asm
  27. {$endif}
  28. {$ifdef m68k}
  29. ,m68k
  30. {$endif}
  31. ;
  32. Const
  33. RPNMax = 10; { I think you only need 4, but just to be safe }
  34. OpMax = 25;
  35. maxoperands = 3; { Maximum operands for assembler instructions }
  36. {---------------------------------------------------------------------
  37. Local Label Management
  38. ---------------------------------------------------------------------}
  39. Type
  40. { Each local label has this structure associated with it }
  41. PLocalLabel = ^TLocalLabel;
  42. TLocalLabel = object(TNamedIndexObject)
  43. Emitted : boolean;
  44. constructor Init(const n:string);
  45. function Getpasmlabel:pasmlabel;
  46. private
  47. lab : pasmlabel;
  48. end;
  49. PLocalLabelList = ^TLocalLabelList;
  50. TLocalLabelList = Object(TDictionary)
  51. procedure CheckEmitted;
  52. end;
  53. var
  54. LocalLabelList : PLocalLabelList;
  55. function CreateLocalLabel(const s: string; var hl: pasmlabel; emit:boolean):boolean;
  56. Function SearchLabel(const s: string; var hl: pasmlabel;emit:boolean): boolean;
  57. {---------------------------------------------------------------------
  58. Instruction management
  59. ---------------------------------------------------------------------}
  60. type
  61. TOprType=(OPR_NONE,OPR_CONSTANT,OPR_SYMBOL,OPR_REFERENCE,OPR_REGISTER);
  62. TOprRec = record
  63. case typ:TOprType of
  64. OPR_NONE : ();
  65. OPR_CONSTANT : (val:longint);
  66. OPR_SYMBOL : (symbol:PAsmSymbol;symofs:longint);
  67. OPR_REFERENCE : (ref:treference);
  68. OPR_REGISTER : (reg:tregister);
  69. end;
  70. POperand = ^TOperand;
  71. TOperand = object
  72. size : topsize;
  73. hasvar : boolean; { if the operand is loaded with a variable }
  74. opr : TOprRec;
  75. constructor init;
  76. destructor done;virtual;
  77. Procedure BuildOperand;virtual;
  78. Procedure SetSize(_size:longint);
  79. Function SetupResult:boolean;
  80. Function SetupSelf:boolean;
  81. Function SetupOldEBP:boolean;
  82. Function SetupVar(const hs:string): Boolean;
  83. Function SetupDirectVar(const hs:string): Boolean;
  84. Procedure InitRef;
  85. end;
  86. PInstruction = ^TInstruction;
  87. TInstruction = object
  88. opcode : tasmop;
  89. opsize : topsize;
  90. condition : tasmcond;
  91. ops : byte;
  92. operands : array[1..maxoperands] of POperand;
  93. constructor init;
  94. destructor done;virtual;
  95. Procedure InitOperands;virtual;
  96. Procedure BuildOpcode;virtual;
  97. procedure ConcatInstruction(p:PAasmoutput);virtual;
  98. Procedure SwapOperands;
  99. end;
  100. {---------------------------------------------------------------------}
  101. { Expression parser types }
  102. {---------------------------------------------------------------------}
  103. TExprOperator = record
  104. ch: char; { operator }
  105. is_prefix: boolean; { was it a prefix, possible prefixes are +,- and not }
  106. end;
  107. String15 = String[15];
  108. {**********************************************************************}
  109. { The following operators are supported: }
  110. { '+' : addition }
  111. { '-' : subtraction }
  112. { '*' : multiplication }
  113. { '/' : modulo division }
  114. { '^' : exclusive or }
  115. { '<' : shift left }
  116. { '>' : shift right }
  117. { '&' : bitwise and }
  118. { '|' : bitwise or }
  119. { '~' : bitwise complement }
  120. { '%' : modulo division }
  121. { nnn: longint numbers }
  122. { ( and ) parenthesis }
  123. {**********************************************************************}
  124. TExprParse = Object
  125. public
  126. Constructor Init;
  127. Destructor Done;
  128. Function Evaluate(Expr: String): longint;
  129. Function Priority(_Operator: Char): Integer; virtual;
  130. private
  131. RPNStack : Array[1..RPNMax] of longint; { Stack For RPN calculator }
  132. RPNTop : Integer;
  133. OpStack : Array[1..OpMax] of TExprOperator; { Operator stack For conversion }
  134. OpTop : Integer;
  135. Procedure RPNPush(Num: Longint);
  136. Function RPNPop: Longint;
  137. Procedure RPNCalc(token: String15; prefix: boolean);
  138. Procedure OpPush(_Operator: char; prefix: boolean);
  139. { In reality returns TExprOperaotr }
  140. Procedure OpPop(var _Operator:TExprOperator);
  141. end;
  142. { Evaluate an expression string to a longint }
  143. Function CalculateExpression(const expression: string): longint;
  144. {---------------------------------------------------------------------}
  145. { String routines }
  146. {---------------------------------------------------------------------}
  147. Function ValDecimal(const S:String):longint;
  148. Function ValOctal(const S:String):longint;
  149. Function ValBinary(const S:String):longint;
  150. Function ValHexaDecimal(const S:String):longint;
  151. Function PadZero(Var s: String; n: byte): Boolean;
  152. Function EscapeToPascal(const s:string): string;
  153. {---------------------------------------------------------------------
  154. Symbol helper routines
  155. ---------------------------------------------------------------------}
  156. Function GetRecordOffsetSize(s:string;Var Offset: longint;var Size:longint):boolean;
  157. Function SearchIConstant(const s:string; var l:longint): boolean;
  158. {---------------------------------------------------------------------
  159. Instruction generation routines
  160. ---------------------------------------------------------------------}
  161. Procedure ConcatPasString(p : paasmoutput;s:string);
  162. Procedure ConcatDirect(p : paasmoutput;s:string);
  163. Procedure ConcatLabel(p: paasmoutput;var l : pasmlabel);
  164. Procedure ConcatConstant(p : paasmoutput;value: longint; maxvalue: longint);
  165. Procedure ConcatConstSymbol(p : paasmoutput;const sym:string;l:longint);
  166. Procedure ConcatRealConstant(p : paasmoutput;value: bestreal; real_typ : tfloattype);
  167. Procedure ConcatString(p : paasmoutput;s:string);
  168. procedure ConcatAlign(p:paasmoutput;l:longint);
  169. Procedure ConcatPublic(p:paasmoutput;const s : string);
  170. Procedure ConcatLocal(p:paasmoutput;const s : string);
  171. Procedure ConcatGlobalBss(const s : string;size : longint);
  172. Procedure ConcatLocalBss(const s : string;size : longint);
  173. Implementation
  174. {*************************************************************************
  175. TExprParse
  176. *************************************************************************}
  177. Constructor TExprParse.Init;
  178. Begin
  179. end;
  180. Procedure TExprParse.RPNPush(Num : longint);
  181. { Add an operand to the top of the RPN stack }
  182. begin
  183. if RPNTop < RPNMax then
  184. begin
  185. Inc(RPNTop);
  186. RPNStack[RPNTop]:=Num;
  187. end
  188. else
  189. Message(asmr_e_ev_stack_overflow);
  190. end;
  191. Function TExprParse.RPNPop : longint;
  192. { Get the operand at the top of the RPN stack }
  193. begin
  194. if RPNTop > 0 then
  195. begin
  196. RPNPop:=RPNStack[RPNTop];
  197. Dec(RPNTop);
  198. end
  199. else
  200. Message(asmr_e_ev_stack_underflow);
  201. end;
  202. Procedure TExprParse.RPNCalc(Token : String15; prefix:boolean); { RPN Calculator }
  203. Var
  204. Temp : longint;
  205. LocalError : Integer;
  206. begin
  207. { Handle operators }
  208. if (Length(Token) = 1) and (Token[1] in ['+', '-', '*', '/','&','|','%','^','~','<','>']) then
  209. Case Token[1] of
  210. '+' :
  211. Begin
  212. if not prefix then
  213. RPNPush(RPNPop + RPNPop);
  214. end;
  215. '-' :
  216. Begin
  217. if prefix then
  218. RPNPush(-(RPNPop))
  219. else
  220. RPNPush(RPNPop - RPNPop);
  221. end;
  222. '*' : RPNPush(RPNPop * RPNPop);
  223. '&' : RPNPush(RPNPop AND RPNPop);
  224. '|' : RPNPush(RPNPop OR RPNPop);
  225. '~' : RPNPush(NOT RPNPop);
  226. '<' : RPNPush(RPNPop SHL RPNPop);
  227. '>' : RPNPush(RPNPop SHR RPNPop);
  228. '%' :
  229. begin
  230. Temp:=RPNPop;
  231. if Temp <> 0 then
  232. RPNPush(RPNPop mod Temp)
  233. else
  234. Message(asmr_e_ev_zero_divide);
  235. end;
  236. '^' : RPNPush(RPNPop XOR RPNPop);
  237. '/' :
  238. begin
  239. Temp:=RPNPop;
  240. if Temp <> 0 then
  241. RPNPush(RPNPop div Temp)
  242. else
  243. Message(asmr_e_ev_zero_divide);
  244. end;
  245. end
  246. else
  247. begin
  248. { Convert String to number and add to stack }
  249. if token='-2147483648' then
  250. begin
  251. temp:=$80000000;
  252. localerror:=0;
  253. end
  254. else
  255. Val(Token, Temp, LocalError);
  256. if LocalError = 0 then
  257. RPNPush(Temp)
  258. else
  259. Message(asmr_e_ev_invalid_number);
  260. end;
  261. end;
  262. Procedure TExprParse.OpPush(_Operator : char;prefix: boolean);
  263. { Add an operator onto top of the stack }
  264. begin
  265. if OpTop < OpMax then
  266. begin
  267. Inc(OpTop);
  268. OpStack[OpTop].ch:=_Operator;
  269. OpStack[OpTop].is_prefix:=prefix;
  270. end
  271. else
  272. Message(asmr_e_ev_stack_overflow);
  273. end;
  274. Procedure TExprParse.OpPop(var _Operator:TExprOperator);
  275. { Get operator at the top of the stack }
  276. begin
  277. if OpTop > 0 then
  278. begin
  279. _Operator:=OpStack[OpTop];
  280. Dec(OpTop);
  281. end
  282. else
  283. Message(asmr_e_ev_stack_underflow);
  284. end;
  285. Function TExprParse.Priority(_Operator : Char) : Integer;
  286. { Return priority of operator }
  287. { The greater the priority, the higher the precedence }
  288. begin
  289. Case _Operator OF
  290. '(' :
  291. Priority:=0;
  292. '+', '-' :
  293. Priority:=1;
  294. '*', '/','%','<','>' :
  295. Priority:=2;
  296. '|','&','^','~' :
  297. Priority:=0;
  298. else
  299. Message(asmr_e_ev_invalid_op);
  300. end;
  301. end;
  302. Function TExprParse.Evaluate(Expr : String):longint;
  303. Var
  304. I : Integer;
  305. Token : String15;
  306. opr : TExprOperator;
  307. begin
  308. Evaluate:=0;
  309. { Reset stacks }
  310. OpTop :=0;
  311. RPNTop:=0;
  312. Token :='';
  313. { nothing to do ? }
  314. if Expr='' then
  315. exit;
  316. For I:=1 to Length(Expr) DO
  317. begin
  318. if Expr[I] in ['0'..'9'] then
  319. begin { Build multi-digit numbers }
  320. Token:=Token + Expr[I];
  321. if I = Length(Expr) then { Send last one to calculator }
  322. RPNCalc(Token,false);
  323. end
  324. else
  325. if Expr[I] in ['+', '-', '*', '/', '(', ')','^','&','|','%','~','<','>'] then
  326. begin
  327. if Token <> '' then
  328. begin { Send last built number to calc. }
  329. RPNCalc(Token,false);
  330. Token:='';
  331. end;
  332. Case Expr[I] OF
  333. '(' : OpPush('(',false);
  334. ')' : begin
  335. While OpStack[OpTop].ch <> '(' DO
  336. Begin
  337. OpPop(opr);
  338. RPNCalc(opr.ch,opr.is_prefix);
  339. end;
  340. OpPop(opr); { Pop off and ignore the '(' }
  341. end;
  342. '+','-','~' : Begin
  343. { workaround for -2147483648 }
  344. if (expr[I]='-') and (expr[i+1] in ['0'..'9']) then
  345. begin
  346. token:='-';
  347. expr[i]:='+';
  348. end;
  349. { if start of expression then surely a prefix }
  350. { or if previous char was also an operator }
  351. if (I = 1) or (not (Expr[I-1] in ['0'..'9','(',')'])) then
  352. OpPush(Expr[I],true)
  353. else
  354. Begin
  355. { Evaluate all higher priority operators }
  356. While (OpTop > 0) AND (Priority(Expr[I]) <= Priority(OpStack[OpTop].ch)) DO
  357. Begin
  358. OpPop(opr);
  359. RPNCalc(opr.ch,opr.is_prefix);
  360. end;
  361. OpPush(Expr[I],false);
  362. End;
  363. end;
  364. '*', '/',
  365. '^','|','&',
  366. '%','<','>' : begin
  367. While (OpTop > 0) and (Priority(Expr[I]) <= Priority(OpStack[OpTop].ch)) DO
  368. Begin
  369. OpPop(opr);
  370. RPNCalc(opr.ch,opr.is_prefix);
  371. end;
  372. OpPush(Expr[I],false);
  373. end;
  374. end; { Case }
  375. end
  376. else
  377. Message(asmr_e_ev_invalid_op); { Handle bad input error }
  378. end;
  379. { Pop off the remaining operators }
  380. While OpTop > 0 do
  381. Begin
  382. OpPop(opr);
  383. RPNCalc(opr.ch,opr.is_prefix);
  384. end;
  385. { The result is stored on the top of the stack }
  386. Evaluate:=RPNPop;
  387. end;
  388. Destructor TExprParse.Done;
  389. Begin
  390. end;
  391. Function CalculateExpression(const expression: string): longint;
  392. var
  393. expr: TExprParse;
  394. Begin
  395. expr.Init;
  396. CalculateExpression:=expr.Evaluate(expression);
  397. expr.Done;
  398. end;
  399. {*************************************************************************}
  400. { String conversions/utils }
  401. {*************************************************************************}
  402. Function EscapeToPascal(const s:string): string;
  403. { converts a C styled string - which contains escape }
  404. { characters to a pascal style string. }
  405. var
  406. i,len : longint;
  407. hs : string;
  408. temp : string;
  409. c : char;
  410. Begin
  411. hs:='';
  412. len:=0;
  413. i:=0;
  414. while (i<length(s)) and (len<255) do
  415. begin
  416. Inc(i);
  417. if (s[i]='\') and (i<length(s)) then
  418. Begin
  419. inc(i);
  420. case s[i] of
  421. '\' :
  422. c:='\';
  423. 'b':
  424. c:=#8;
  425. 'f':
  426. c:=#12;
  427. 'n':
  428. c:=#10;
  429. 'r':
  430. c:=#13;
  431. 't':
  432. c:=#9;
  433. '"':
  434. c:='"';
  435. '0'..'7':
  436. Begin
  437. temp:=s[i];
  438. temp:=temp+s[i+1];
  439. temp:=temp+s[i+2];
  440. inc(i,2);
  441. c:=chr(ValOctal(temp));
  442. end;
  443. 'x':
  444. Begin
  445. temp:=s[i+1];
  446. temp:=temp+s[i+2];
  447. inc(i,2);
  448. c:=chr(ValHexaDecimal(temp));
  449. end;
  450. else
  451. Begin
  452. Message1(asmr_e_escape_seq_ignored,s[i]);
  453. c:=s[i];
  454. end;
  455. end;
  456. end
  457. else
  458. c:=s[i];
  459. inc(len);
  460. hs[len]:=c;
  461. end;
  462. hs[0]:=chr(len);
  463. EscapeToPascal:=hs;
  464. end;
  465. Function ValDecimal(const S:String):longint;
  466. { Converts a decimal string to longint }
  467. var
  468. vs,c : longint;
  469. Begin
  470. vs:=0;
  471. for c:=1 to length(s) do
  472. begin
  473. vs:=vs*10;
  474. if s[c] in ['0'..'9'] then
  475. inc(vs,ord(s[c])-ord('0'))
  476. else
  477. begin
  478. Message1(asmr_e_error_converting_decimal,s);
  479. ValDecimal:=0;
  480. exit;
  481. end;
  482. end;
  483. ValDecimal:=vs;
  484. end;
  485. Function ValOctal(const S:String):longint;
  486. { Converts an octal string to longint }
  487. var
  488. vs,c : longint;
  489. Begin
  490. vs:=0;
  491. for c:=1 to length(s) do
  492. begin
  493. vs:=vs shl 3;
  494. if s[c] in ['0'..'7'] then
  495. inc(vs,ord(s[c])-ord('0'))
  496. else
  497. begin
  498. Message1(asmr_e_error_converting_octal,s);
  499. ValOctal:=0;
  500. exit;
  501. end;
  502. end;
  503. ValOctal:=vs;
  504. end;
  505. Function ValBinary(const S:String):longint;
  506. { Converts a binary string to longint }
  507. var
  508. vs,c : longint;
  509. Begin
  510. vs:=0;
  511. for c:=1 to length(s) do
  512. begin
  513. vs:=vs shl 1;
  514. if s[c] in ['0'..'1'] then
  515. inc(vs,ord(s[c])-ord('0'))
  516. else
  517. begin
  518. Message1(asmr_e_error_converting_binary,s);
  519. ValBinary:=0;
  520. exit;
  521. end;
  522. end;
  523. ValBinary:=vs;
  524. end;
  525. Function ValHexadecimal(const S:String):longint;
  526. { Converts a binary string to longint }
  527. var
  528. vs,c : longint;
  529. Begin
  530. vs:=0;
  531. for c:=1 to length(s) do
  532. begin
  533. vs:=vs shl 4;
  534. case s[c] of
  535. '0'..'9' :
  536. inc(vs,ord(s[c])-ord('0'));
  537. 'A'..'F' :
  538. inc(vs,ord(s[c])-ord('A')+10);
  539. 'a'..'f' :
  540. inc(vs,ord(s[c])-ord('a')+10);
  541. else
  542. begin
  543. Message1(asmr_e_error_converting_hexadecimal,s);
  544. ValHexadecimal:=0;
  545. exit;
  546. end;
  547. end;
  548. end;
  549. ValHexadecimal:=vs;
  550. end;
  551. Function PadZero(Var s: String; n: byte): Boolean;
  552. Begin
  553. PadZero:=TRUE;
  554. { Do some error checking first }
  555. if Length(s) = n then
  556. exit
  557. else
  558. if Length(s) > n then
  559. Begin
  560. PadZero:=FALSE;
  561. delete(s,n+1,length(s));
  562. exit;
  563. end
  564. else
  565. PadZero:=TRUE;
  566. { Fill it up with the specified character }
  567. fillchar(s[length(s)+1],n-1,#0);
  568. s[0]:=chr(n);
  569. end;
  570. {****************************************************************************
  571. TOperand
  572. ****************************************************************************}
  573. constructor TOperand.init;
  574. begin
  575. size:=S_NO;
  576. hasvar:=false;
  577. FillChar(Opr,sizeof(Opr),0);
  578. end;
  579. destructor TOperand.done;
  580. begin
  581. end;
  582. Procedure TOperand.SetSize(_size:longint);
  583. begin
  584. if (size = S_NO) then
  585. Begin
  586. case _size of
  587. 1 : size:=S_B;
  588. 2 : size:=S_W{ could be S_IS};
  589. 4 : size:=S_L{ could be S_IL or S_FS};
  590. 8 : size:=S_IQ{ could be S_D or S_FL};
  591. extended_size : size:=S_FX;
  592. end;
  593. end;
  594. end;
  595. Function TOperand.SetupResult:boolean;
  596. Begin
  597. SetupResult:=false;
  598. { replace by correct offset. }
  599. if assigned(procinfo.retdef) and
  600. (procinfo.retdef<>pdef(voiddef)) then
  601. begin
  602. opr.ref.offset:=procinfo.retoffset;
  603. opr.ref.base:= procinfo.framepointer;
  604. { always assume that the result is valid. }
  605. procinfo.funcret_is_valid:=true;
  606. SetupResult:=true;
  607. end
  608. else
  609. Message(asmr_e_void_function);
  610. end;
  611. Function TOperand.SetupSelf:boolean;
  612. Begin
  613. SetupSelf:=false;
  614. if assigned(procinfo._class) then
  615. Begin
  616. opr.ref.offset:=procinfo.ESI_offset;
  617. opr.ref.base:=procinfo.framepointer;
  618. SetupSelf:=true;
  619. end
  620. else
  621. Message(asmr_e_cannot_use_SELF_outside_a_method);
  622. end;
  623. Function TOperand.SetupOldEBP:boolean;
  624. Begin
  625. SetupOldEBP:=false;
  626. if lexlevel>normal_function_level then
  627. Begin
  628. opr.typ:=OPR_REFERENCE;
  629. opr.ref.offset:=procinfo.framepointer_offset;
  630. opr.ref.base:=procinfo.framepointer;
  631. SetupOldEBP:=true;
  632. end
  633. else
  634. Message(asmr_e_cannot_use_OLDEBP_outside_nested_procedure);
  635. end;
  636. Function TOperand.SetupVar(const hs:string): Boolean;
  637. { search and sets up the correct fields in the Instr record }
  638. { for the NON-constant identifier passed to the routine. }
  639. { if not found returns FALSE. }
  640. var
  641. sym : psym;
  642. Begin
  643. SetupVar:=false;
  644. { are we in a routine ? }
  645. getsym(hs,false);
  646. sym:=srsym;
  647. if sym=nil then
  648. exit;
  649. case sym^.typ of
  650. varsym :
  651. begin
  652. { we always assume in asm statements that }
  653. { that the variable is valid. }
  654. pvarsym(sym)^.varstate:=vs_used;
  655. inc(pvarsym(sym)^.refs);
  656. case pvarsym(sym)^.owner^.symtabletype of
  657. unitsymtable,
  658. globalsymtable,
  659. staticsymtable :
  660. opr.ref.symbol:=newasmsymbol(pvarsym(sym)^.mangledname);
  661. parasymtable :
  662. begin
  663. opr.ref.base:=procinfo.framepointer;
  664. opr.ref.offset:=pvarsym(sym)^.address;
  665. opr.ref.offsetfixup:=aktprocsym^.definition^.parast^.address_fixup;
  666. opr.ref.options:=ref_parafixup;
  667. end;
  668. localsymtable :
  669. begin
  670. if (vo_is_external in pvarsym(sym)^.varoptions) then
  671. opr.ref.symbol:=newasmsymbol(pvarsym(sym)^.mangledname)
  672. else
  673. begin
  674. opr.ref.base:=procinfo.framepointer;
  675. opr.ref.offset:=-(pvarsym(sym)^.address);
  676. opr.ref.options:=ref_localfixup;
  677. opr.ref.offsetfixup:=aktprocsym^.definition^.localst^.address_fixup;
  678. end;
  679. end;
  680. end;
  681. case pvarsym(sym)^.definition^.deftype of
  682. orddef,
  683. enumdef,
  684. pointerdef,
  685. floatdef :
  686. SetSize(pvarsym(sym)^.getsize);
  687. arraydef :
  688. SetSize(parraydef(pvarsym(sym)^.definition)^.elesize)
  689. end;
  690. hasvar:=true;
  691. SetupVar:=true;
  692. Exit;
  693. end;
  694. typedconstsym :
  695. begin
  696. opr.ref.symbol:=newasmsymbol(ptypedconstsym(sym)^.mangledname);
  697. case ptypedconstsym(sym)^.definition^.deftype of
  698. orddef,
  699. enumdef,
  700. pointerdef,
  701. floatdef :
  702. SetSize(ptypedconstsym(sym)^.getsize);
  703. arraydef :
  704. SetSize(parraydef(ptypedconstsym(sym)^.definition)^.elesize)
  705. end;
  706. hasvar:=true;
  707. SetupVar:=true;
  708. Exit;
  709. end;
  710. constsym :
  711. begin
  712. if pconstsym(sym)^.consttype in [constint,constchar,constbool] then
  713. begin
  714. opr.typ:=OPR_CONSTANT;
  715. opr.val:=pconstsym(sym)^.value;
  716. hasvar:=true;
  717. SetupVar:=true;
  718. Exit;
  719. end;
  720. end;
  721. typesym :
  722. begin
  723. if ptypesym(sym)^.definition^.deftype in [recorddef,objectdef] then
  724. begin
  725. opr.typ:=OPR_CONSTANT;
  726. opr.val:=0;
  727. hasvar:=true;
  728. SetupVar:=TRUE;
  729. Exit;
  730. end;
  731. end;
  732. procsym :
  733. begin
  734. if assigned(pprocsym(sym)^.definition^.nextoverloaded) then
  735. Message(asmr_w_calling_overload_func);
  736. opr.typ:=OPR_SYMBOL;
  737. opr.symbol:=newasmsymbol(pprocsym(sym)^.definition^.mangledname);
  738. hasvar:=true;
  739. SetupVar:=TRUE;
  740. Exit;
  741. end;
  742. else
  743. begin
  744. Message(asmr_e_unsupported_symbol_type);
  745. exit;
  746. end;
  747. end;
  748. end;
  749. { looks for internal names of variables and routines }
  750. Function TOperand.SetupDirectVar(const hs:string): Boolean;
  751. {$ifndef OLDDIRECTVAR}
  752. var
  753. p : pasmsymbol;
  754. begin
  755. SetupDirectVar:=false;
  756. p:=getasmsymbol(hs);
  757. if assigned(p) then
  758. begin
  759. opr.ref.symbol:=p;
  760. hasvar:=true;
  761. SetupDirectVar:=true;
  762. end;
  763. end;
  764. {$else}
  765. var
  766. p : pai_external;
  767. Begin
  768. SearchDirectVar:=false;
  769. { search in the list of internals }
  770. p:=search_assembler_symbol(internals,hs,EXT_ANY);
  771. if p=nil then
  772. p:=search_assembler_symbol(externals,hs,EXT_ANY);
  773. if p<>nil then
  774. begin
  775. instr.operands[operandnum].opr.ref.symbol:=p^.sym;
  776. case p^.exttyp of
  777. EXT_BYTE : instr.operands[operandnum].size:=S_B;
  778. EXT_WORD : instr.operands[operandnum].size:=S_W;
  779. EXT_NEAR,EXT_FAR,EXT_PROC,EXT_DWORD,EXT_CODEPTR,EXT_DATAPTR:
  780. instr.operands[operandnum].size:=S_L;
  781. EXT_QWORD : instr.operands[operandnum].size:=S_FL;
  782. EXT_TBYTE : instr.operands[operandnum].size:=S_FX;
  783. else
  784. { this is in the case where the instruction is LEA }
  785. { or something like that, in that case size is not }
  786. { important. }
  787. instr.operands[operandnum].size:=S_NO;
  788. end;
  789. instr.operands[operandnum].hasvar:=true;
  790. SearchDirectVar:=TRUE;
  791. Exit;
  792. end;
  793. end;
  794. {$endif}
  795. procedure TOperand.InitRef;
  796. {*********************************************************************}
  797. { Description: This routine first check if the opcode is of }
  798. { type OPR_NONE, or OPR_REFERENCE , if not it gives out an error. }
  799. { If the operandtype = OPR_NONE or <> OPR_REFERENCE then it sets up }
  800. { the operand type to OPR_REFERENCE, as well as setting up the ref }
  801. { to point to the default segment. }
  802. {*********************************************************************}
  803. Begin
  804. case opr.typ of
  805. OPR_REFERENCE:
  806. exit;
  807. OPR_NONE: ;
  808. else
  809. Message(asmr_e_invalid_operand_type);
  810. end;
  811. opr.typ := OPR_REFERENCE;
  812. reset_reference(opr.ref);
  813. end;
  814. procedure TOperand.BuildOperand;
  815. begin
  816. abstract;
  817. end;
  818. {****************************************************************************
  819. TInstruction
  820. ****************************************************************************}
  821. constructor TInstruction.init;
  822. Begin
  823. Opcode:=A_NONE;
  824. Opsize:=S_NO;
  825. Condition:=C_NONE;
  826. Ops:=0;
  827. InitOperands;
  828. end;
  829. destructor TInstruction.done;
  830. var
  831. i : longint;
  832. Begin
  833. for i:=1 to 3 do
  834. Dispose(Operands[i],Done);
  835. end;
  836. procedure TInstruction.InitOperands;
  837. var
  838. i : longint;
  839. begin
  840. for i:=1 to 3 do
  841. New(Operands[i],init);
  842. end;
  843. Procedure TInstruction.SwapOperands;
  844. Var
  845. p : POperand;
  846. Begin
  847. case Ops of
  848. 2 :
  849. begin
  850. p:=Operands[1];
  851. Operands[1]:=Operands[2];
  852. Operands[2]:=p;
  853. end;
  854. 3 :
  855. begin
  856. p:=Operands[1];
  857. Operands[1]:=Operands[3];
  858. Operands[3]:=p;
  859. end;
  860. end;
  861. end;
  862. procedure TInstruction.ConcatInstruction(p:PAasmOutput);
  863. begin
  864. abstract;
  865. end;
  866. procedure TInstruction.BuildOpcode;
  867. begin
  868. abstract;
  869. end;
  870. {***************************************************************************
  871. TLocalLabel
  872. ***************************************************************************}
  873. constructor TLocalLabel.Init(const n:string);
  874. begin
  875. inherited InitName(n);
  876. lab:=nil;
  877. emitted:=false;
  878. end;
  879. function TLocalLabel.Getpasmlabel:pasmlabel;
  880. begin
  881. if not assigned(lab) then
  882. begin
  883. getlabel(lab);
  884. { this label is forced to be used so it's always written }
  885. inc(lab^.refs);
  886. end;
  887. Getpasmlabel:=lab;
  888. end;
  889. {***************************************************************************
  890. TLocalLabelList
  891. ***************************************************************************}
  892. procedure LocalLabelEmitted(p:PNamedIndexObject);{$ifndef FPC}far;{$endif}
  893. begin
  894. if not PLocalLabel(p)^.emitted then
  895. Message1(asmr_e_unknown_label_identifier,p^.name);
  896. end;
  897. procedure TLocalLabelList.CheckEmitted;
  898. begin
  899. ForEach({$ifndef TP}@{$endif}LocalLabelEmitted)
  900. end;
  901. function CreateLocalLabel(const s: string; var hl: pasmlabel; emit:boolean):boolean;
  902. var
  903. lab : PLocalLabel;
  904. Begin
  905. CreateLocalLabel:=true;
  906. { Check if it already is defined }
  907. lab:=PLocalLabel(LocalLabelList^.Search(s));
  908. if not assigned(lab) then
  909. begin
  910. new(lab,init(s));
  911. LocalLabelList^.Insert(lab);
  912. end;
  913. { set emitted flag and check for dup syms }
  914. if emit then
  915. begin
  916. if lab^.Emitted then
  917. begin
  918. Message1(asmr_e_dup_local_sym,lab^.Name);
  919. CreateLocalLabel:=false;
  920. end;
  921. lab^.Emitted:=true;
  922. end;
  923. hl:=lab^.Getpasmlabel;
  924. end;
  925. {****************************************************************************
  926. Symbol table helper routines
  927. ****************************************************************************}
  928. Function SearchIConstant(const s:string; var l:longint): boolean;
  929. {**********************************************************************}
  930. { Description: Searches for a CONSTANT of name s in either the local }
  931. { symbol list, then in the global symbol list, and returns the value }
  932. { of that constant in l. Returns TRUE if successfull, if not found, }
  933. { or if the constant is not of correct type, then returns FALSE }
  934. { Remarks: Also handle TRUE and FALSE returning in those cases 1 and 0 }
  935. { respectively. }
  936. {**********************************************************************}
  937. var
  938. sym: psym;
  939. Begin
  940. SearchIConstant:=false;
  941. { check for TRUE or FALSE reserved words first }
  942. if s = 'TRUE' then
  943. Begin
  944. SearchIConstant:=TRUE;
  945. l:=1;
  946. end
  947. else
  948. if s = 'FALSE' then
  949. Begin
  950. SearchIConstant:=TRUE;
  951. l:=0;
  952. end
  953. else
  954. if assigned(aktprocsym) then
  955. Begin
  956. if assigned(aktprocsym^.definition) then
  957. Begin
  958. { Check the local constants }
  959. if assigned(aktprocsym^.definition^.localst) and
  960. (lexlevel >= normal_function_level) then
  961. sym:=aktprocsym^.definition^.localst^.search(s)
  962. else
  963. sym:=nil;
  964. if assigned(sym) then
  965. Begin
  966. if (sym^.typ = constsym) and
  967. (pconstsym(sym)^.consttype in [constord,constint,constchar,constbool]) then
  968. Begin
  969. l:=pconstsym(sym)^.value;
  970. SearchIConstant:=TRUE;
  971. exit;
  972. end;
  973. end;
  974. end;
  975. end;
  976. { Check the global constants }
  977. getsym(s,false);
  978. if srsym <> nil then
  979. Begin
  980. case srsym^.typ of
  981. constsym :
  982. begin
  983. if (pconstsym(srsym)^.consttype in [constord,constint,constchar,constbool]) then
  984. Begin
  985. l:=pconstsym(srsym)^.value;
  986. SearchIConstant:=TRUE;
  987. exit;
  988. end;
  989. end;
  990. end;
  991. end;
  992. end;
  993. Function GetRecordOffsetSize(s:string;Var Offset: longint;var Size:longint):boolean;
  994. { search and returns the offset and size of records/objects of the base }
  995. { with field name setup in field. }
  996. { returns FALSE if not found. }
  997. { used when base is a variable or a typed constant name. }
  998. var
  999. st : psymtable;
  1000. sym : psym;
  1001. i : longint;
  1002. base : string;
  1003. Begin
  1004. GetRecordOffsetSize:=FALSE;
  1005. Offset:=0;
  1006. Size:=0;
  1007. i:=pos('.',s);
  1008. if i=0 then
  1009. i:=255;
  1010. base:=Copy(s,1,i-1);
  1011. delete(s,1,i);
  1012. getsym(base,false);
  1013. sym:=srsym;
  1014. st:=nil;
  1015. { we can start with a var,type,typedconst }
  1016. case sym^.typ of
  1017. varsym :
  1018. begin
  1019. case pvarsym(sym)^.definition^.deftype of
  1020. recorddef :
  1021. st:=precorddef(pvarsym(sym)^.definition)^.symtable;
  1022. objectdef :
  1023. st:=pobjectdef(pvarsym(sym)^.definition)^.symtable;
  1024. end;
  1025. end;
  1026. typesym :
  1027. begin
  1028. case ptypesym(sym)^.definition^.deftype of
  1029. recorddef :
  1030. st:=precorddef(ptypesym(sym)^.definition)^.symtable;
  1031. objectdef :
  1032. st:=pobjectdef(ptypesym(sym)^.definition)^.symtable;
  1033. end;
  1034. end;
  1035. typedconstsym :
  1036. begin
  1037. case pvarsym(sym)^.definition^.deftype of
  1038. recorddef :
  1039. st:=precorddef(ptypedconstsym(sym)^.definition)^.symtable;
  1040. objectdef :
  1041. st:=pobjectdef(ptypedconstsym(sym)^.definition)^.symtable;
  1042. end;
  1043. end;
  1044. end;
  1045. { now walk all recordsymtables }
  1046. while assigned(st) and (s<>'') do
  1047. begin
  1048. { load next field in base }
  1049. i:=pos('.',s);
  1050. if i=0 then
  1051. i:=255;
  1052. base:=Copy(s,1,i-1);
  1053. delete(s,1,i);
  1054. sym:=st^.search(base);
  1055. st:=nil;
  1056. case sym^.typ of
  1057. varsym :
  1058. begin
  1059. inc(Offset,pvarsym(sym)^.address);
  1060. Size:=PVarsym(sym)^.getsize;
  1061. case pvarsym(sym)^.definition^.deftype of
  1062. recorddef :
  1063. st:=precorddef(pvarsym(sym)^.definition)^.symtable;
  1064. objectdef :
  1065. st:=pobjectdef(pvarsym(sym)^.definition)^.symtable;
  1066. end;
  1067. end;
  1068. end;
  1069. end;
  1070. GetRecordOffsetSize:=(s='');
  1071. end;
  1072. Function SearchLabel(const s: string; var hl: pasmlabel;emit:boolean): boolean;
  1073. var
  1074. sym : psym;
  1075. hs : string;
  1076. Begin
  1077. hl:=nil;
  1078. SearchLabel:=false;
  1079. { Check for pascal labels, which are case insensetive }
  1080. hs:=upper(s);
  1081. getsym(hs,false);
  1082. sym:=srsym;
  1083. if sym=nil then
  1084. exit;
  1085. case sym^.typ of
  1086. labelsym :
  1087. begin
  1088. hl:=plabelsym(sym)^.lab;
  1089. if emit then
  1090. plabelsym(sym)^.defined:=true;
  1091. SearchLabel:=true;
  1092. exit;
  1093. end;
  1094. end;
  1095. end;
  1096. {*************************************************************************}
  1097. { Instruction Generation Utilities }
  1098. {*************************************************************************}
  1099. Procedure ConcatString(p : paasmoutput;s:string);
  1100. {*********************************************************************}
  1101. { PROCEDURE ConcatString(s:string); }
  1102. { Description: This routine adds the character chain pointed to in }
  1103. { s to the instruction linked list. }
  1104. {*********************************************************************}
  1105. Var
  1106. pc: PChar;
  1107. Begin
  1108. getmem(pc,length(s)+1);
  1109. p^.concat(new(pai_string,init_length_pchar(strpcopy(pc,s),length(s))));
  1110. end;
  1111. Procedure ConcatPasString(p : paasmoutput;s:string);
  1112. {*********************************************************************}
  1113. { PROCEDURE ConcatPasString(s:string); }
  1114. { Description: This routine adds the character chain pointed to in }
  1115. { s to the instruction linked list, contrary to ConcatString it }
  1116. { uses a pascal style string, so it conserves null characters. }
  1117. {*********************************************************************}
  1118. Begin
  1119. p^.concat(new(pai_string,init(s)));
  1120. end;
  1121. Procedure ConcatDirect(p : paasmoutput;s:string);
  1122. {*********************************************************************}
  1123. { PROCEDURE ConcatDirect(s:string) }
  1124. { Description: This routine output the string directly to the asm }
  1125. { output, it is only sed when writing special labels in AT&T mode, }
  1126. { and should not be used without due consideration, since it may }
  1127. { cause problems. }
  1128. {*********************************************************************}
  1129. Var
  1130. pc: PChar;
  1131. Begin
  1132. getmem(pc,length(s)+1);
  1133. p^.concat(new(pai_direct,init(strpcopy(pc,s))));
  1134. end;
  1135. Procedure ConcatConstant(p: paasmoutput; value: longint; maxvalue: longint);
  1136. {*********************************************************************}
  1137. { PROCEDURE ConcatConstant(value: longint; maxvalue: longint); }
  1138. { Description: This routine adds the value constant to the current }
  1139. { instruction linked list. }
  1140. { maxvalue -> indicates the size of the data to initialize: }
  1141. { $ff -> create a byte node. }
  1142. { $ffff -> create a word node. }
  1143. { $ffffffff -> create a dword node. }
  1144. {*********************************************************************}
  1145. Begin
  1146. if (maxvalue <> $ffffffff) and (value > maxvalue) then
  1147. Begin
  1148. Message(asmr_e_constant_out_of_bounds);
  1149. { assuming a value of maxvalue }
  1150. value:=maxvalue;
  1151. end;
  1152. if maxvalue = $ff then
  1153. p^.concat(new(pai_const,init_8bit(byte(value))))
  1154. else
  1155. if maxvalue = $ffff then
  1156. p^.concat(new(pai_const,init_16bit(word(value))))
  1157. else
  1158. if maxvalue = $ffffffff then
  1159. p^.concat(new(pai_const,init_32bit(longint(value))));
  1160. end;
  1161. Procedure ConcatConstSymbol(p : paasmoutput;const sym:string;l:longint);
  1162. begin
  1163. p^.concat(new(pai_const_symbol,initname_offset(sym,l)));
  1164. end;
  1165. Procedure ConcatRealConstant(p : paasmoutput;value: bestreal; real_typ : tfloattype);
  1166. {***********************************************************************}
  1167. { PROCEDURE ConcatRealConstant(value: bestreal; real_typ : tfloattype); }
  1168. { Description: This routine adds the value constant to the current }
  1169. { instruction linked list. }
  1170. { real_typ -> indicates the type of the real data to initialize: }
  1171. { s32real -> create a single node. }
  1172. { s64real -> create a double node. }
  1173. { s80real -> create an extended node. }
  1174. { s64bit -> create a comp node. }
  1175. { f32bit -> create a fixed node. (not used normally) }
  1176. {***********************************************************************}
  1177. Begin
  1178. case real_typ of
  1179. s32real : p^.concat(new(pai_real_32bit,init(value)));
  1180. s64real : p^.concat(new(pai_real_64bit,init(value)));
  1181. s80real : p^.concat(new(pai_real_80bit,init(value)));
  1182. s64comp : p^.concat(new(pai_comp_64bit,init(value)));
  1183. f32bit : p^.concat(new(pai_const,init_32bit(trunc(value*$10000))));
  1184. end;
  1185. end;
  1186. Procedure ConcatLabel(p: paasmoutput;var l : pasmlabel);
  1187. {*********************************************************************}
  1188. { PROCEDURE ConcatLabel }
  1189. { Description: This routine either emits a label or a labeled }
  1190. { instruction to the linked list of instructions. }
  1191. {*********************************************************************}
  1192. begin
  1193. p^.concat(new(pai_label,init(l)));
  1194. end;
  1195. procedure ConcatAlign(p:paasmoutput;l:longint);
  1196. {*********************************************************************}
  1197. { PROCEDURE ConcatPublic }
  1198. { Description: This routine emits an global definition to the }
  1199. { linked list of instructions.(used by AT&T styled asm) }
  1200. {*********************************************************************}
  1201. begin
  1202. p^.concat(new(pai_align,init(l)));
  1203. end;
  1204. procedure ConcatPublic(p:paasmoutput;const s : string);
  1205. {*********************************************************************}
  1206. { PROCEDURE ConcatPublic }
  1207. { Description: This routine emits an global definition to the }
  1208. { linked list of instructions.(used by AT&T styled asm) }
  1209. {*********************************************************************}
  1210. begin
  1211. p^.concat(new(pai_symbol,initname_global(s,0)));
  1212. end;
  1213. procedure ConcatLocal(p:paasmoutput;const s : string);
  1214. {*********************************************************************}
  1215. { PROCEDURE ConcatLocal }
  1216. { Description: This routine emits an local definition to the }
  1217. { linked list of instructions. }
  1218. {*********************************************************************}
  1219. begin
  1220. p^.concat(new(pai_symbol,initname(s,0)));
  1221. end;
  1222. Procedure ConcatGlobalBss(const s : string;size : longint);
  1223. {*********************************************************************}
  1224. { PROCEDURE ConcatGlobalBss }
  1225. { Description: This routine emits an global datablock to the }
  1226. { linked list of instructions. }
  1227. {*********************************************************************}
  1228. begin
  1229. bsssegment^.concat(new(pai_datablock,init_global(s,size)));
  1230. end;
  1231. Procedure ConcatLocalBss(const s : string;size : longint);
  1232. {*********************************************************************}
  1233. { PROCEDURE ConcatLocalBss }
  1234. { Description: This routine emits a local datablcok to the }
  1235. { linked list of instructions. }
  1236. {*********************************************************************}
  1237. begin
  1238. bsssegment^.concat(new(pai_datablock,init(s,size)));
  1239. end;
  1240. end.
  1241. {
  1242. $Log$
  1243. Revision 1.21 1999-08-03 22:03:12 peter
  1244. * moved bitmask constants to sets
  1245. * some other type/const renamings
  1246. Revision 1.20 1999/07/29 20:54:06 peter
  1247. * write .size also
  1248. Revision 1.19 1999/06/02 22:44:17 pierre
  1249. * previous wrong log corrected
  1250. Revision 1.18 1999/06/02 22:25:47 pierre
  1251. * changed $ifdef FPC @ into $ifndef TP
  1252. Revision 1.17 1999/05/27 19:45:01 peter
  1253. * removed oldasm
  1254. * plabel -> pasmlabel
  1255. * -a switches to source writing automaticly
  1256. * assembler readers OOPed
  1257. * asmsymbol automaticly external
  1258. * jumptables and other label fixes for asm readers
  1259. Revision 1.16 1999/05/21 13:55:18 peter
  1260. * NEWLAB for label as symbol
  1261. Revision 1.15 1999/05/12 00:17:11 peter
  1262. * fixed error which was shown for all 32bit consts
  1263. Revision 1.14 1999/05/11 16:27:23 peter
  1264. * support for pointerdef
  1265. Revision 1.13 1999/05/06 09:05:27 peter
  1266. * generic write_float and str_float
  1267. * fixed constant float conversions
  1268. Revision 1.12 1999/05/05 22:22:04 peter
  1269. * updated messages
  1270. Revision 1.11 1999/05/02 22:41:57 peter
  1271. * moved section names to systems
  1272. * fixed nasm,intel writer
  1273. Revision 1.10 1999/05/01 13:24:41 peter
  1274. * merged nasm compiler
  1275. * old asm moved to oldasm/
  1276. Revision 1.8 1999/04/26 23:26:19 peter
  1277. * redesigned record offset parsing to support nested records
  1278. * normal compiler uses the redesigned SetupVar()
  1279. Revision 1.7 1999/04/14 09:07:48 peter
  1280. * asm reader improvements
  1281. Revision 1.6 1999/03/31 13:55:34 peter
  1282. * assembler inlining working for ag386bin
  1283. Revision 1.5 1999/03/26 00:01:17 peter
  1284. * first things for optimizer (compiles but cycle crashes)
  1285. Revision 1.4 1999/03/25 16:55:36 peter
  1286. + unitpath,librarypath,includepath,objectpath directives
  1287. Revision 1.3 1999/03/06 17:24:28 peter
  1288. * rewritten intel parser a lot, especially reference reading
  1289. * size checking added for asm parsers
  1290. Revision 1.2 1999/03/02 02:56:33 peter
  1291. + stabs support for binary writers
  1292. * more fixes and missing updates from the previous commit :(
  1293. Revision 1.1 1999/03/01 15:46:26 peter
  1294. * ag386bin finally make cycles correct
  1295. * prefixes are now also normal opcodes
  1296. }