ogomf.pas 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. {
  2. Copyright (c) 2015 by Nikolay Nikolov
  3. Contains the binary Relocatable Object Module Format (OMF) reader and writer
  4. This is the object format used on the i8086-msdos platform.
  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 ogomf;
  19. {$i fpcdefs.inc}
  20. interface
  21. uses
  22. { common }
  23. cclasses,globtype,
  24. { target }
  25. systems,
  26. { assembler }
  27. cpuinfo,cpubase,aasmbase,assemble,link,
  28. { OMF definitions }
  29. omfbase,
  30. { output }
  31. ogbase,
  32. owbase;
  33. type
  34. TOmfObjData = class(TObjData)
  35. public
  36. function sectionname(atype:TAsmSectiontype;const aname:string;aorder:TAsmSectionOrder):string;override;
  37. procedure writeReloc(Data:aint;len:aword;p:TObjSymbol;Reloctype:TObjRelocationType);override;
  38. end;
  39. TOmfObjOutput = class(tObjOutput)
  40. protected
  41. function writeData(Data:TObjData):boolean;override;
  42. public
  43. constructor create(AWriter:TObjectWriter);override;
  44. end;
  45. TOmfAssembler = class(tinternalassembler)
  46. constructor create(smart:boolean);override;
  47. end;
  48. implementation
  49. uses
  50. SysUtils,
  51. cutils,verbose,globals,
  52. fmodule,aasmtai,aasmdata,
  53. ogmap,
  54. version
  55. ;
  56. {****************************************************************************
  57. TOmfObjData
  58. ****************************************************************************}
  59. function TOmfObjData.sectionname(atype:TAsmSectiontype;const aname:string;aorder:TAsmSectionOrder):string;
  60. begin
  61. result:=aname;
  62. end;
  63. procedure TOmfObjData.writeReloc(Data:aint;len:aword;p:TObjSymbol;Reloctype:TObjRelocationType);
  64. begin
  65. end;
  66. {****************************************************************************
  67. TOmfObjOutput
  68. ****************************************************************************}
  69. function TOmfObjOutput.writeData(Data:TObjData):boolean;
  70. begin
  71. result:=true;
  72. end;
  73. constructor TOmfObjOutput.create(AWriter:TObjectWriter);
  74. begin
  75. inherited create(AWriter);
  76. cobjdata:=TOmfObjData;
  77. end;
  78. {****************************************************************************
  79. TOmfAssembler
  80. ****************************************************************************}
  81. constructor TOmfAssembler.Create(smart:boolean);
  82. begin
  83. inherited Create(smart);
  84. CObjOutput:=TOmfObjOutput;
  85. end;
  86. {*****************************************************************************
  87. Initialize
  88. *****************************************************************************}
  89. {$ifdef i8086}
  90. const
  91. as_i8086_omf_info : tasminfo =
  92. (
  93. id : as_i8086_omf;
  94. idtxt : 'OMF';
  95. asmbin : '';
  96. asmcmd : '';
  97. supported_targets : [system_i8086_msdos];
  98. flags : [af_outputbinary,af_needar,af_no_debug];
  99. labelprefix : '..@';
  100. comment : '; ';
  101. dollarsign: '$';
  102. );
  103. {$endif i8086}
  104. initialization
  105. {$ifdef i8086}
  106. RegisterAssembler(as_i8086_omf_info,TOmfAssembler);
  107. {$endif i8086}
  108. end.