rautils.pas 41 KB

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