symcpu.pas 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. {
  2. Copyright (c) 2014 by Florian Klaempfl
  3. Symbol table overrides for i8086
  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 symcpu;
  18. {$i fpcdefs.inc}
  19. interface
  20. uses
  21. globtype,
  22. symconst,symtype,symdef,symsym,symx86,symi86;
  23. type
  24. { defs }
  25. tcpufiledef = class(tfiledef)
  26. end;
  27. tcpufiledefclass = class of tcpufiledef;
  28. tcpuvariantdef = class(tvariantdef)
  29. end;
  30. tcpuvariantdefclass = class of tcpuvariantdef;
  31. tcpuformaldef = class(tformaldef)
  32. end;
  33. tcpuformaldefclass = class of tcpuformaldef;
  34. tcpuforwarddef = class(tforwarddef)
  35. end;
  36. tcpuforwarddefclass = class of tcpuforwarddef;
  37. tcpuundefineddef = class(tundefineddef)
  38. end;
  39. tcpuundefineddefclass = class of tcpuundefineddef;
  40. tcpuerrordef = class(terrordef)
  41. end;
  42. tcpuerrordefclass = class of tcpuerrordef;
  43. tcpupointerdef = class(tx86pointerdef)
  44. class function default_x86_data_pointer_type: tx86pointertyp; override;
  45. end;
  46. tcpupointerdefclass = class of tcpupointerdef;
  47. tcpurecorddef = class(trecorddef)
  48. end;
  49. tcpurecorddefclass = class of tcpurecorddef;
  50. tcpuimplementedinterface = class(timplementedinterface)
  51. end;
  52. tcpuimplementedinterfaceclass = class of tcpuimplementedinterface;
  53. tcpuobjectdef = class(tobjectdef)
  54. end;
  55. tcpuobjectdefclass = class of tcpuobjectdef;
  56. tcpuclassrefdef = class(tclassrefdef)
  57. end;
  58. tcpuclassrefdefclass = class of tcpuclassrefdef;
  59. tcpuarraydef = class(tarraydef)
  60. end;
  61. tcpuarraydefclass = class of tcpuarraydef;
  62. tcpuorddef = class(torddef)
  63. end;
  64. tcpuorddefclass = class of tcpuorddef;
  65. tcpufloatdef = class(tfloatdef)
  66. end;
  67. tcpufloatdefclass = class of tcpufloatdef;
  68. tcpuprocvardef = class(tprocvardef)
  69. end;
  70. tcpuprocvardefclass = class of tcpuprocvardef;
  71. tcpuprocdef = class(tprocdef)
  72. end;
  73. tcpuprocdefclass = class of tcpuprocdef;
  74. tcpustringdef = class(tstringdef)
  75. end;
  76. tcpustringdefclass = class of tcpustringdef;
  77. tcpuenumdef = class(tenumdef)
  78. end;
  79. tcpuenumdefclass = class of tcpuenumdef;
  80. tcpusetdef = class(tsetdef)
  81. end;
  82. tcpusetdefclass = class of tcpusetdef;
  83. { syms }
  84. tcpulabelsym = class(tlabelsym)
  85. end;
  86. tcpulabelsymclass = class of tcpulabelsym;
  87. tcpuunitsym = class(tunitsym)
  88. end;
  89. tcpuunitsymclass = class of tcpuunitsym;
  90. tcpunamespacesym = class(tnamespacesym)
  91. end;
  92. tcpunamespacesymclass = class of tcpunamespacesym;
  93. tcpuprocsym = class(tprocsym)
  94. end;
  95. tcpuprocsymclass = class of tcpuprocsym;
  96. tcputypesym = class(ttypesym)
  97. end;
  98. tcpuypesymclass = class of tcputypesym;
  99. tcpufieldvarsym = class(tfieldvarsym)
  100. end;
  101. tcpufieldvarsymclass = class of tcpufieldvarsym;
  102. tcpulocalvarsym = class(tlocalvarsym)
  103. end;
  104. tcpulocalvarsymclass = class of tcpulocalvarsym;
  105. tcpuparavarsym = class(tparavarsym)
  106. end;
  107. tcpuparavarsymclass = class of tcpuparavarsym;
  108. tcpustaticvarsym = class(tstaticvarsym)
  109. end;
  110. tcpustaticvarsymclass = class of tcpustaticvarsym;
  111. tcpuabsolutevarsym = class(ti86absolutevarsym)
  112. protected
  113. procedure ppuload_platform(ppufile: tcompilerppufile); override;
  114. procedure ppuwrite_platform(ppufile: tcompilerppufile); override;
  115. public
  116. addrsegment : aword;
  117. end;
  118. tcpuabsolutevarsymclass = class of tcpuabsolutevarsym;
  119. tcpupropertysym = class(tpropertysym)
  120. end;
  121. tcpupropertysymclass = class of tcpupropertysym;
  122. tcpuconstsym = class(tconstsym)
  123. end;
  124. tcpuconstsymclass = class of tcpuconstsym;
  125. tcpuenumsym = class(tenumsym)
  126. end;
  127. tcpuenumsymclass = class of tcpuenumsym;
  128. tcpusyssym = class(tsyssym)
  129. end;
  130. tcpusyssymclass = class of tcpusyssym;
  131. const
  132. pbestrealtype : ^tdef = @s80floattype;
  133. implementation
  134. uses
  135. globals, cpuinfo;
  136. {****************************************************************************
  137. tcpupointerdef
  138. ****************************************************************************}
  139. class function tcpupointerdef.default_x86_data_pointer_type: tx86pointertyp;
  140. begin
  141. if current_settings.x86memorymodel in x86_far_data_models then
  142. result:=x86pt_far
  143. else
  144. result:=inherited;
  145. end;
  146. {****************************************************************************
  147. tcpuabsolutevarsym
  148. ****************************************************************************}
  149. procedure tcpuabsolutevarsym.ppuload_platform(ppufile: tcompilerppufile);
  150. begin
  151. inherited;
  152. if absseg then
  153. addrsegment:=ppufile.getaword;
  154. end;
  155. procedure tcpuabsolutevarsym.ppuwrite_platform(ppufile: tcompilerppufile);
  156. begin
  157. inherited;
  158. if absseg then
  159. ppufile.putaword(addrsegment);
  160. end;
  161. begin
  162. { used tdef classes }
  163. cfiledef:=tcpufiledef;
  164. cvariantdef:=tcpuvariantdef;
  165. cformaldef:=tcpuformaldef;
  166. cforwarddef:=tcpuforwarddef;
  167. cundefineddef:=tcpuundefineddef;
  168. cerrordef:=tcpuerrordef;
  169. cpointerdef:=tcpupointerdef;
  170. crecorddef:=tcpurecorddef;
  171. cimplementedinterface:=tcpuimplementedinterface;
  172. cobjectdef:=tcpuobjectdef;
  173. cclassrefdef:=tcpuclassrefdef;
  174. carraydef:=tcpuarraydef;
  175. corddef:=tcpuorddef;
  176. cfloatdef:=tcpufloatdef;
  177. cprocvardef:=tcpuprocvardef;
  178. cprocdef:=tcpuprocdef;
  179. cstringdef:=tcpustringdef;
  180. cenumdef:=tcpuenumdef;
  181. csetdef:=tcpusetdef;
  182. { used tsym classes }
  183. clabelsym:=tcpulabelsym;
  184. cunitsym:=tcpuunitsym;
  185. cnamespacesym:=tcpunamespacesym;
  186. cprocsym:=tcpuprocsym;
  187. ctypesym:=tcputypesym;
  188. cfieldvarsym:=tcpufieldvarsym;
  189. clocalvarsym:=tcpulocalvarsym;
  190. cparavarsym:=tcpuparavarsym;
  191. cstaticvarsym:=tcpustaticvarsym;
  192. cabsolutevarsym:=tcpuabsolutevarsym;
  193. cpropertysym:=tcpupropertysym;
  194. cconstsym:=tcpuconstsym;
  195. cenumsym:=tcpuenumsym;
  196. csyssym:=tcpusyssym;
  197. end.