rautils.pas 41 KB

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