ag68kvasm.pas 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. {
  2. Copyright (c) 2016 by the Free Pascal development team
  3. This unit is the VASM assembler writer for 68k
  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 ag68kvasm;
  18. {$i fpcdefs.inc}
  19. interface
  20. uses
  21. aasmbase,systems,
  22. aasmtai,aasmdata,
  23. aggas,ag68kgas,
  24. cpubase,cgutils,
  25. globtype;
  26. type
  27. tm68kvasm = class(Tm68kGNUassembler)
  28. constructor create(info: pasminfo; smart: boolean); override;
  29. function MakeCmdLine: TCmdStr; override;
  30. end;
  31. implementation
  32. uses
  33. cutils,cfileutl,globals,verbose,
  34. cgbase,
  35. assemble,script,
  36. itcpugas,cpuinfo,
  37. aasmcpu;
  38. {****************************************************************************}
  39. { VASM m68k Assembler writer }
  40. {****************************************************************************}
  41. constructor tm68kvasm.create(info: pasminfo; smart: boolean);
  42. begin
  43. inherited;
  44. InstrWriter := Tm68kInstrWriter.create(self);
  45. end;
  46. function tm68kvasm.MakeCmdLine: TCmdStr;
  47. var
  48. objtype: string;
  49. begin
  50. result:=asminfo^.asmcmd;
  51. case target_info.system of
  52. system_m68k_amiga: objtype:='-Fhunk';
  53. system_m68k_atari: objtype:='-Fvobj'; // fix me?
  54. system_m68k_linux: objtype:='-Felf';
  55. else
  56. internalerror(2016052601);
  57. end;
  58. if (target_info.system = system_m68k_amiga) then
  59. begin
  60. Replace(result,'$ASM',maybequoted(ScriptFixFileName(Unix2AmigaPath(AsmFileName))));
  61. Replace(result,'$OBJ',maybequoted(ScriptFixFileName(Unix2AmigaPath(ObjFileName))));
  62. end
  63. else
  64. begin
  65. Replace(result,'$ASM',maybequoted(ScriptFixFileName(AsmFileName)));
  66. Replace(result,'$OBJ',maybequoted(ScriptFixFileName(ObjFileName)));
  67. end;
  68. Replace(result,'$ARCH','-m'+GasCpuTypeStr[current_settings.cputype]);
  69. Replace(result,'$OTYPE',objtype);
  70. Replace(result,'$EXTRAOPT',asmextraopt);
  71. end;
  72. {*****************************************************************************
  73. Initialize
  74. *****************************************************************************}
  75. const
  76. as_m68k_vasm_info : tasminfo =
  77. (
  78. id : as_m68k_vasm;
  79. idtxt : 'VASM';
  80. asmbin : 'vasmm68k_std';
  81. asmcmd: '-quiet -elfregs -gas $OTYPE $ARCH -o $OBJ $EXTRAOPT $ASM';
  82. supported_targets : [system_m68k_amiga,system_m68k_atari,system_m68k_linux];
  83. flags : [af_needar,af_smartlink_sections];
  84. labelprefix : '.L';
  85. comment : '# ';
  86. dollarsign: '$';
  87. );
  88. begin
  89. RegisterAssembler(as_m68k_vasm_info,tm68kvasm);
  90. end.