rappc.pas 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681
  1. {
  2. $Id$
  3. Copyright (c) 1998-2002 by Carl Eric Codere and Peter Vreman
  4. Handles the common i386 assembler reader routines
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  16. ****************************************************************************
  17. }
  18. unit Rasm;
  19. {$i fpcdefs.inc}
  20. interface
  21. uses
  22. aasmbase,aasmtai,aasmcpu,
  23. cpubase,rautils,cclasses;
  24. { Parser helpers }
  25. function is_prefix(t:tasmop):boolean;
  26. function is_override(t:tasmop):boolean;
  27. Function CheckPrefix(prefixop,op:tasmop): Boolean;
  28. Function CheckOverride(overrideop,op:tasmop): Boolean;
  29. Procedure FWaitWarning;
  30. type
  31. T386Operand=class(TOperand)
  32. Procedure SetCorrectSize(opcode:tasmop);override;
  33. end;
  34. T386Instruction=class(TInstruction)
  35. { Operand sizes }
  36. procedure AddReferenceSizes;
  37. procedure SetInstructionOpsize;
  38. procedure CheckOperandSizes;
  39. procedure CheckNonCommutativeOpcodes;
  40. { opcode adding }
  41. procedure ConcatInstruction(p : taasmoutput);override;
  42. end;
  43. tstr2opentry = class(Tnamedindexitem)
  44. op: TAsmOp;
  45. end;
  46. const
  47. AsmPrefixes = 6;
  48. AsmPrefix : array[0..AsmPrefixes-1] of TasmOP =(
  49. A_LOCK,A_REP,A_REPE,A_REPNE,A_REPNZ,A_REPZ
  50. );
  51. AsmOverrides = 6;
  52. AsmOverride : array[0..AsmOverrides-1] of TasmOP =(
  53. A_SEGCS,A_SEGES,A_SEGDS,A_SEGFS,A_SEGGS,A_SEGSS
  54. );
  55. CondAsmOps=3;
  56. CondAsmOp:array[0..CondAsmOps-1] of TasmOp=(
  57. A_CMOVcc, A_Jcc, A_SETcc
  58. );
  59. CondAsmOpStr:array[0..CondAsmOps-1] of string[4]=(
  60. 'CMOV','J','SET'
  61. );
  62. { Convert reg to opsize }
  63. reg_2_opsize:array[firstreg..lastreg] of topsize = (S_NO,
  64. S_L,S_L,S_L,S_L,S_L,S_L,S_L,S_L,
  65. S_W,S_W,S_W,S_W,S_W,S_W,S_W,S_W,
  66. S_B,S_B,S_B,S_B,S_B,S_B,S_B,S_B,
  67. S_W,S_W,S_W,S_W,S_W,S_W,
  68. S_FL,S_FL,S_FL,S_FL,S_FL,S_FL,S_FL,S_FL,S_FL,
  69. S_L,S_L,S_L,S_L,S_L,S_L,
  70. S_L,S_L,S_L,S_L,
  71. S_L,S_L,S_L,S_L,S_L,
  72. S_D,S_D,S_D,S_D,S_D,S_D,S_D,S_D,
  73. S_D,S_D,S_D,S_D,S_D,S_D,S_D,S_D
  74. );
  75. implementation
  76. uses
  77. globtype,globals,systems,verbose,
  78. cpuinfo,ag386att;
  79. {$define ATTOP}
  80. {$define INTELOP}
  81. {$ifdef NORA386INT}
  82. {$ifdef NOAG386NSM}
  83. {$ifdef NOAG386INT}
  84. {$undef INTELOP}
  85. {$endif}
  86. {$endif}
  87. {$endif}
  88. {$ifdef NORA386ATT}
  89. {$ifdef NOAG386ATT}
  90. {$undef ATTOP}
  91. {$endif}
  92. {$endif}
  93. {*****************************************************************************
  94. Parser Helpers
  95. *****************************************************************************}
  96. function is_prefix(t:tasmop):boolean;
  97. var
  98. i : longint;
  99. Begin
  100. is_prefix:=false;
  101. for i:=1 to AsmPrefixes do
  102. if t=AsmPrefix[i-1] then
  103. begin
  104. is_prefix:=true;
  105. exit;
  106. end;
  107. end;
  108. function is_override(t:tasmop):boolean;
  109. var
  110. i : longint;
  111. Begin
  112. is_override:=false;
  113. for i:=1 to AsmOverrides do
  114. if t=AsmOverride[i-1] then
  115. begin
  116. is_override:=true;
  117. exit;
  118. end;
  119. end;
  120. Function CheckPrefix(prefixop,op:tasmop): Boolean;
  121. { Checks if the prefix is valid with the following opcode }
  122. { return false if not, otherwise true }
  123. Begin
  124. CheckPrefix := TRUE;
  125. (* Case prefix of
  126. A_REP,A_REPNE,A_REPE:
  127. Case opcode Of
  128. A_SCASB,A_SCASW,A_SCASD,
  129. A_INS,A_OUTS,A_MOVS,A_CMPS,A_LODS,A_STOS:;
  130. Else
  131. Begin
  132. CheckPrefix := FALSE;
  133. exit;
  134. end;
  135. end; { case }
  136. A_LOCK:
  137. Case opcode Of
  138. A_BT,A_BTS,A_BTR,A_BTC,A_XCHG,A_ADD,A_OR,A_ADC,A_SBB,A_AND,A_SUB,
  139. A_XOR,A_NOT,A_NEG,A_INC,A_DEC:;
  140. Else
  141. Begin
  142. CheckPrefix := FALSE;
  143. Exit;
  144. end;
  145. end; { case }
  146. A_NONE: exit; { no prefix here }
  147. else
  148. CheckPrefix := FALSE;
  149. end; { end case } *)
  150. end;
  151. Function CheckOverride(overrideop,op:tasmop): Boolean;
  152. { Check if the override is valid, and if so then }
  153. { update the instr variable accordingly. }
  154. Begin
  155. CheckOverride := true;
  156. { Case instr.getinstruction of
  157. A_MOVS,A_XLAT,A_CMPS:
  158. Begin
  159. CheckOverride := TRUE;
  160. Message(assem_e_segment_override_not_supported);
  161. end
  162. end }
  163. end;
  164. Procedure FWaitWarning;
  165. begin
  166. if (target_info.target=target_i386_GO32V2) and (cs_fp_emulation in aktmoduleswitches) then
  167. Message(asmr_w_fwait_emu_prob);
  168. end;
  169. {*****************************************************************************
  170. T386Operand
  171. *****************************************************************************}
  172. Procedure T386Operand.SetCorrectSize(opcode:tasmop);
  173. begin
  174. if gas_needsuffix[opcode]=attsufFPU then
  175. begin
  176. case size of
  177. S_L : size:=S_FS;
  178. S_IQ : size:=S_FL;
  179. end;
  180. end
  181. else if gas_needsuffix[opcode]=attsufFPUint then
  182. begin
  183. case size of
  184. S_W : size:=S_IS;
  185. S_L : size:=S_IL;
  186. end;
  187. end;
  188. end;
  189. {*****************************************************************************
  190. T386Instruction
  191. *****************************************************************************}
  192. procedure T386Instruction.AddReferenceSizes;
  193. { this will add the sizes for references like [esi] which do not
  194. have the size set yet, it will take only the size if the other
  195. operand is a register }
  196. var
  197. operand2,i : longint;
  198. s : tasmsymbol;
  199. so : longint;
  200. begin
  201. for i:=1to ops do
  202. begin
  203. operands[i].SetCorrectSize(opcode);
  204. if (operands[i].size=S_NO) then
  205. begin
  206. case operands[i].Opr.Typ of
  207. OPR_REFERENCE :
  208. begin
  209. if i=2 then
  210. operand2:=1
  211. else
  212. operand2:=2;
  213. if operand2<ops then
  214. begin
  215. { Only allow register as operand to take the size from }
  216. if operands[operand2].opr.typ=OPR_REGISTER then
  217. begin
  218. if ((opcode<>A_MOVD) and
  219. (opcode<>A_CVTSI2SS)) then
  220. operands[i].size:=operands[operand2].size;
  221. end
  222. else
  223. begin
  224. { if no register then take the opsize (which is available with ATT),
  225. if not availble then give an error }
  226. if opsize<>S_NO then
  227. operands[i].size:=opsize
  228. else
  229. begin
  230. Message(asmr_e_unable_to_determine_reference_size);
  231. { recovery }
  232. operands[i].size:=S_L;
  233. end;
  234. end;
  235. end
  236. else
  237. begin
  238. if opsize<>S_NO then
  239. operands[i].size:=opsize
  240. end;
  241. end;
  242. OPR_SYMBOL :
  243. begin
  244. { Fix lea which need a reference }
  245. if opcode=A_LEA then
  246. begin
  247. s:=operands[i].opr.symbol;
  248. so:=operands[i].opr.symofs;
  249. operands[i].opr.typ:=OPR_REFERENCE;
  250. Fillchar(operands[i].opr.ref,sizeof(treference),0);
  251. operands[i].opr.ref.symbol:=s;
  252. operands[i].opr.ref.offset:=so;
  253. end;
  254. operands[i].size:=S_L;
  255. end;
  256. end;
  257. end;
  258. end;
  259. end;
  260. procedure T386Instruction.SetInstructionOpsize;
  261. begin
  262. if opsize<>S_NO then
  263. exit;
  264. case ops of
  265. 0 : ;
  266. 1 :
  267. { "push es" must be stored as a long PM }
  268. if ((opcode=A_PUSH) or
  269. (opcode=A_POP)) and
  270. (operands[1].opr.typ=OPR_REGISTER) and
  271. ((operands[1].opr.reg>=firstsreg) and
  272. (operands[1].opr.reg<=lastsreg)) then
  273. opsize:=S_L
  274. else
  275. opsize:=operands[1].size;
  276. 2 :
  277. begin
  278. case opcode of
  279. A_MOVZX,A_MOVSX :
  280. begin
  281. case operands[1].size of
  282. S_W :
  283. case operands[2].size of
  284. S_L :
  285. opsize:=S_WL;
  286. end;
  287. S_B :
  288. case operands[2].size of
  289. S_W :
  290. opsize:=S_BW;
  291. S_L :
  292. opsize:=S_BL;
  293. end;
  294. end;
  295. end;
  296. A_MOVD : { movd is a move from a mmx register to a
  297. 32 bit register or memory, so no opsize is correct here PM }
  298. exit;
  299. A_OUT :
  300. opsize:=operands[1].size;
  301. else
  302. opsize:=operands[2].size;
  303. end;
  304. end;
  305. 3 :
  306. opsize:=operands[3].size;
  307. end;
  308. end;
  309. procedure T386Instruction.CheckOperandSizes;
  310. var
  311. sizeerr : boolean;
  312. i : longint;
  313. begin
  314. { Check only the most common opcodes here, the others are done in
  315. the assembler pass }
  316. case opcode of
  317. A_PUSH,A_POP,A_DEC,A_INC,A_NOT,A_NEG,
  318. A_CMP,A_MOV,
  319. A_ADD,A_SUB,A_ADC,A_SBB,
  320. A_AND,A_OR,A_TEST,A_XOR: ;
  321. else
  322. exit;
  323. end;
  324. { Handle the BW,BL,WL separatly }
  325. sizeerr:=false;
  326. { special push/pop selector case }
  327. if ((opcode=A_PUSH) or
  328. (opcode=A_POP)) and
  329. (operands[1].opr.typ=OPR_REGISTER) and
  330. ((operands[1].opr.reg>=firstsreg) and
  331. (operands[1].opr.reg<=lastsreg)) then
  332. exit;
  333. if opsize in [S_BW,S_BL,S_WL] then
  334. begin
  335. if ops<>2 then
  336. sizeerr:=true
  337. else
  338. begin
  339. case opsize of
  340. S_BW :
  341. sizeerr:=(operands[1].size<>S_B) or (operands[2].size<>S_W);
  342. S_BL :
  343. sizeerr:=(operands[1].size<>S_B) or (operands[2].size<>S_L);
  344. S_WL :
  345. sizeerr:=(operands[1].size<>S_W) or (operands[2].size<>S_L);
  346. end;
  347. end;
  348. end
  349. else
  350. begin
  351. for i:=1 to ops do
  352. begin
  353. if (operands[i].opr.typ<>OPR_CONSTANT) and
  354. (operands[i].size in [S_B,S_W,S_L]) and
  355. (operands[i].size<>opsize) then
  356. sizeerr:=true;
  357. end;
  358. end;
  359. if sizeerr then
  360. begin
  361. { if range checks are on then generate an error }
  362. if (cs_compilesystem in aktmoduleswitches) or
  363. not (cs_check_range in aktlocalswitches) then
  364. Message(asmr_w_size_suffix_and_dest_dont_match)
  365. else
  366. Message(asmr_e_size_suffix_and_dest_dont_match);
  367. end;
  368. end;
  369. { This check must be done with the operand in ATT order
  370. i.e.after swapping in the intel reader
  371. but before swapping in the NASM and TASM writers PM }
  372. procedure T386Instruction.CheckNonCommutativeOpcodes;
  373. begin
  374. if ((ops=2) and
  375. (operands[1].opr.typ=OPR_REGISTER) and
  376. (operands[2].opr.typ=OPR_REGISTER) and
  377. { if the first is ST and the second is also a register
  378. it is necessarily ST1 .. ST7 }
  379. (operands[1].opr.reg=R_ST)) or
  380. (ops=0) then
  381. if opcode=A_FSUBR then
  382. opcode:=A_FSUB
  383. else if opcode=A_FSUB then
  384. opcode:=A_FSUBR
  385. else if opcode=A_FDIVR then
  386. opcode:=A_FDIV
  387. else if opcode=A_FDIV then
  388. opcode:=A_FDIVR
  389. else if opcode=A_FSUBRP then
  390. opcode:=A_FSUBP
  391. else if opcode=A_FSUBP then
  392. opcode:=A_FSUBRP
  393. else if opcode=A_FDIVRP then
  394. opcode:=A_FDIVP
  395. else if opcode=A_FDIVP then
  396. opcode:=A_FDIVRP;
  397. if ((ops=1) and
  398. (operands[1].opr.typ=OPR_REGISTER) and
  399. (operands[1].opr.reg in [R_ST1..R_ST7])) then
  400. if opcode=A_FSUBRP then
  401. opcode:=A_FSUBP
  402. else if opcode=A_FSUBP then
  403. opcode:=A_FSUBRP
  404. else if opcode=A_FDIVRP then
  405. opcode:=A_FDIVP
  406. else if opcode=A_FDIVP then
  407. opcode:=A_FDIVRP;
  408. end;
  409. {*****************************************************************************
  410. opcode Adding
  411. *****************************************************************************}
  412. procedure T386Instruction.ConcatInstruction(p : taasmoutput);
  413. var
  414. siz : topsize;
  415. i,asize : longint;
  416. ai : taicpu;
  417. begin
  418. { Get Opsize }
  419. if (opsize<>S_NO) or (Ops=0) then
  420. siz:=opsize
  421. else
  422. begin
  423. if (Ops=2) and (operands[1].opr.typ=OPR_REGISTER) then
  424. siz:=operands[1].size
  425. else
  426. siz:=operands[Ops].size;
  427. { MOVD should be of size S_LQ or S_QL, but these do not exist PM }
  428. if (ops=2) and (operands[1].size<>S_NO) and
  429. (operands[2].size<>S_NO) and (operands[1].size<>operands[2].size) then
  430. siz:=S_NO;
  431. end;
  432. if ((opcode=A_MOVD)or
  433. (opcode=A_CVTSI2SS)) and
  434. ((operands[1].size=S_NO) or
  435. (operands[2].size=S_NO)) then
  436. siz:=S_NO;
  437. { NASM does not support FADD without args
  438. as alias of FADDP
  439. and GNU AS interprets FADD without operand differently
  440. for version 2.9.1 and 2.9.5 !! }
  441. if (ops=0) and
  442. ((opcode=A_FADD) or
  443. (opcode=A_FMUL) or
  444. (opcode=A_FSUB) or
  445. (opcode=A_FSUBR) or
  446. (opcode=A_FDIV) or
  447. (opcode=A_FDIVR)) then
  448. begin
  449. if opcode=A_FADD then
  450. opcode:=A_FADDP
  451. else if opcode=A_FMUL then
  452. opcode:=A_FMULP
  453. else if opcode=A_FSUB then
  454. opcode:=A_FSUBP
  455. else if opcode=A_FSUBR then
  456. opcode:=A_FSUBRP
  457. else if opcode=A_FDIV then
  458. opcode:=A_FDIVP
  459. else if opcode=A_FDIVR then
  460. opcode:=A_FDIVRP;
  461. {$ifdef ATTOP}
  462. message1(asmr_w_fadd_to_faddp,gas_op2str[opcode]);
  463. {$else}
  464. {$ifdef INTELOP}
  465. message1(asmr_w_fadd_to_faddp,std_op2str[opcode]);
  466. {$else}
  467. message1(asmr_w_fadd_to_faddp,'fXX');
  468. {$endif INTELOP}
  469. {$endif ATTOP}
  470. end;
  471. { GNU AS interprets FDIV without operand differently
  472. for version 2.9.1 and 2.10
  473. we add explicit args to it !! }
  474. if (ops=0) and
  475. ((opcode=A_FSUBP) or
  476. (opcode=A_FSUBRP) or
  477. (opcode=A_FDIVP) or
  478. (opcode=A_FDIVRP) or
  479. (opcode=A_FSUB) or
  480. (opcode=A_FSUBR) or
  481. (opcode=A_FDIV) or
  482. (opcode=A_FDIVR)) then
  483. begin
  484. {$ifdef ATTOP}
  485. message1(asmr_w_adding_explicit_args_fXX,gas_op2str[opcode]);
  486. {$else}
  487. {$ifdef INTELOP}
  488. message1(asmr_w_adding_explicit_args_fXX,std_op2str[opcode]);
  489. {$else}
  490. message1(asmr_w_adding_explicit_args_fXX,'fXX');
  491. {$endif INTELOP}
  492. {$endif ATTOP}
  493. ops:=2;
  494. operands[1].opr.typ:=OPR_REGISTER;
  495. operands[2].opr.typ:=OPR_REGISTER;
  496. operands[1].opr.reg:=R_ST;
  497. operands[2].opr.reg:=R_ST1;
  498. end;
  499. if (ops=1) and
  500. ((operands[1].opr.typ=OPR_REGISTER) and
  501. (operands[1].opr.reg in [R_ST1..R_ST7])) and
  502. ((opcode=A_FSUBP) or
  503. (opcode=A_FSUBRP) or
  504. (opcode=A_FDIVP) or
  505. (opcode=A_FDIVRP) or
  506. (opcode=A_FADDP) or
  507. (opcode=A_FMULP)) then
  508. begin
  509. {$ifdef ATTOP}
  510. message1(asmr_w_adding_explicit_first_arg_fXX,gas_op2str[opcode]);
  511. {$else}
  512. {$ifdef INTELOP}
  513. message1(asmr_w_adding_explicit_first_arg_fXX,std_op2str[opcode]);
  514. {$else}
  515. message1(asmr_w_adding_explicit_first_arg_fXX,'fXX');
  516. {$endif INTELOP}
  517. {$endif ATTOP}
  518. ops:=2;
  519. operands[2].opr.typ:=OPR_REGISTER;
  520. operands[2].opr.reg:=operands[1].opr.reg;
  521. operands[1].opr.reg:=R_ST;
  522. end;
  523. if (ops=1) and
  524. ((operands[1].opr.typ=OPR_REGISTER) and
  525. (operands[1].opr.reg in [R_ST1..R_ST7])) and
  526. ((opcode=A_FSUB) or
  527. (opcode=A_FSUBR) or
  528. (opcode=A_FDIV) or
  529. (opcode=A_FDIVR) or
  530. (opcode=A_FADD) or
  531. (opcode=A_FMUL)) then
  532. begin
  533. {$ifdef ATTOP}
  534. message1(asmr_w_adding_explicit_second_arg_fXX,gas_op2str[opcode]);
  535. {$else}
  536. {$ifdef INTELOP}
  537. message1(asmr_w_adding_explicit_second_arg_fXX,std_op2str[opcode]);
  538. {$else}
  539. message1(asmr_w_adding_explicit_second_arg_fXX,'fXX');
  540. {$endif INTELOP}
  541. {$endif ATTOP}
  542. ops:=2;
  543. operands[2].opr.typ:=OPR_REGISTER;
  544. operands[2].opr.reg:=R_ST;
  545. end;
  546. { I tried to convince Linus Torwald to add
  547. code to support ENTER instruction
  548. (when raising a stack page fault)
  549. but he replied that ENTER is a bad instruction and
  550. Linux does not need to support it
  551. So I think its at least a good idea to add a warning
  552. if someone uses this in assembler code
  553. FPC itself does not use it at all PM }
  554. if (opcode=A_ENTER) and ((target_info.target=target_i386_linux) or
  555. (target_info.target=target_i386_FreeBSD)) then
  556. begin
  557. message(asmr_w_enter_not_supported_by_linux);
  558. end;
  559. ai:=taicpu.op_none(opcode,siz);
  560. ai.Ops:=Ops;
  561. for i:=1to Ops do
  562. begin
  563. case operands[i].opr.typ of
  564. OPR_CONSTANT :
  565. ai.loadconst(i-1,aword(operands[i].opr.val));
  566. OPR_REGISTER:
  567. ai.loadreg(i-1,operands[i].opr.reg);
  568. OPR_SYMBOL:
  569. ai.loadsymbol(i-1,operands[i].opr.symbol,operands[i].opr.symofs);
  570. OPR_REFERENCE:
  571. begin
  572. ai.loadref(i-1,operands[i].opr.ref);
  573. if operands[i].size<>S_NO then
  574. begin
  575. asize:=0;
  576. case operands[i].size of
  577. S_B :
  578. asize:=OT_BITS8;
  579. S_W, S_IS :
  580. asize:=OT_BITS16;
  581. S_L, S_IL, S_FS:
  582. asize:=OT_BITS32;
  583. S_Q, S_D, S_FL, S_FV :
  584. asize:=OT_BITS64;
  585. S_FX :
  586. asize:=OT_BITS80;
  587. end;
  588. if asize<>0 then
  589. ai.oper[i-1].ot:=(ai.oper[i-1].ot and not OT_SIZE_MASK) or asize;
  590. end;
  591. end;
  592. end;
  593. end;
  594. if (opcode=A_CALL) and (opsize=S_FAR) then
  595. opcode:=A_LCALL;
  596. if (opcode=A_JMP) and (opsize=S_FAR) then
  597. opcode:=A_LJMP;
  598. if (opcode=A_LCALL) or (opcode=A_LJMP) then
  599. opsize:=S_FAR;
  600. { Condition ? }
  601. if condition<>C_None then
  602. ai.SetCondition(condition);
  603. { Concat the opcode or give an error }
  604. if assigned(ai) then
  605. begin
  606. { Check the instruction if it's valid }
  607. {$ifndef NOAG386BIN}
  608. ai.CheckIfValid;
  609. {$endif NOAG386BIN}
  610. p.concat(ai);
  611. end
  612. else
  613. Message(asmr_e_invalid_opcode_and_operand);
  614. end;
  615. end.
  616. {
  617. $Log$
  618. Revision 1.2 2002-08-10 14:52:52 carl
  619. + moved target_cpu_string to cpuinfo
  620. * renamed asmmode enum.
  621. * assembler reader has now less ifdef's
  622. * move from nppcmem.pas -> ncgmem.pas vec. node.
  623. Revision 1.1 2002/07/28 20:45:23 florian
  624. + added direct assembler reader for PowerPC
  625. }