n8086inl.pas 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. {
  2. Copyright (c) 1998-2002 by Florian Klaempfl
  3. Generate i8086 inline nodes
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  15. ****************************************************************************
  16. }
  17. unit n8086inl;
  18. {$i fpcdefs.inc}
  19. interface
  20. uses
  21. nx86inl,node;
  22. type
  23. { ti8086inlinenode }
  24. ti8086inlinenode = class(tx86inlinenode)
  25. function typecheck_seg: tnode; override;
  26. function first_seg: tnode; override;
  27. procedure second_seg; override;
  28. end;
  29. implementation
  30. uses
  31. ninl,
  32. systems,
  33. globtype,globals,
  34. cutils,verbose,
  35. symconst,
  36. defutil,
  37. aasmbase,aasmtai,aasmdata,aasmcpu,
  38. symtype,symdef,
  39. cgbase,pass_2,
  40. cpuinfo,cpubase,paramgr,
  41. nbas,ncon,ncal,ncnv,nld,ncgutil,
  42. tgobj,
  43. cga,cgutils,cgx86,cgobj,hlcgobj,
  44. htypechk;
  45. function ti8086inlinenode.typecheck_seg: tnode;
  46. begin
  47. result := nil;
  48. resultdef:=u16inttype;
  49. end;
  50. function ti8086inlinenode.first_seg: tnode;
  51. begin
  52. expectloc:=LOC_REGISTER;
  53. result:=nil;
  54. end;
  55. procedure ti8086inlinenode.second_seg;
  56. begin
  57. location_reset(location,LOC_REGISTER,OS_16);
  58. location.register:=cg.getintregister(current_asmdata.CurrAsmList,OS_16);
  59. current_asmdata.CurrAsmList.Concat(Taicpu.op_reg_reg(A_MOV,S_W,NR_DS,location.register));
  60. end;
  61. begin
  62. cinlinenode:=ti8086inlinenode;
  63. end.