cpuinfo.pas 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. {
  2. Copyright (c) 2024 by the Free Pascal development team
  3. Basic Processor information for the MOS Technology 6502
  4. See the file COPYING.FPC, included in this distribution,
  5. for details about the copyright.
  6. This program is distributed in the hope that it will be useful,
  7. but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  9. **********************************************************************}
  10. Unit CPUInfo;
  11. {$i fpcdefs.inc}
  12. Interface
  13. uses
  14. globtype;
  15. Type
  16. bestreal = double;
  17. bestrealrec = TDoubleRec;
  18. ts32real = single;
  19. ts64real = double;
  20. ts80real = type extended;
  21. ts128real = type extended;
  22. ts64comp = comp;
  23. pbestreal=^bestreal;
  24. { possible supported processors for this target }
  25. tcputype =
  26. (cpu_none,
  27. cpu_mos_6502_rev_a,
  28. cpu_mos_6502_rev_b
  29. );
  30. tfputype =
  31. (fpu_none,
  32. fpu_soft,
  33. fpu_libgcc
  34. );
  35. tcontrollertype =
  36. (ct_none
  37. );
  38. tcontrollerdatatype = record
  39. controllertypestr, controllerunitstr: string[20];
  40. cputype: tcputype; fputype: tfputype;
  41. flashbase, flashsize, srambase, sramsize, eeprombase, eepromsize, bootbase, bootsize: dword;
  42. end;
  43. Const
  44. {# Size of native extended floating point type }
  45. extended_size = 12;
  46. { target cpu string (used by compiler options) }
  47. target_cpu_string = 'mos6502';
  48. { Is there support for dealing with multiple microcontrollers available }
  49. { for this platform? }
  50. ControllerSupport = false;
  51. { We know that there are fields after sramsize
  52. but we don't care about this warning }
  53. {$PUSH}
  54. {$WARN 3177 OFF}
  55. embedded_controllers : array [tcontrollertype] of tcontrollerdatatype =
  56. (
  57. (controllertypestr:''; controllerunitstr:''; cputype:cpu_none; fputype:fpu_none; flashbase:0; flashsize:0; srambase:0; sramsize:0));
  58. {$POP}
  59. { calling conventions supported by the code generator }
  60. supported_calling_conventions : tproccalloptions = [
  61. pocall_internproc,
  62. pocall_safecall,
  63. pocall_stdcall,
  64. { same as stdcall only different name mangling }
  65. pocall_cdecl,
  66. { same as stdcall only different name mangling }
  67. pocall_cppdecl,
  68. { same as stdcall but floating point numbers are handled like equal sized integers }
  69. pocall_softfloat
  70. ];
  71. cputypestr : array[tcputype] of string[13] = ('',
  72. 'MOS6502 rev.A', { Pre-June 1976, doesn't support the ROR instruction }
  73. 'MOS6502 rev.B' { After June 1976, the ROR instruction is added }
  74. );
  75. fputypestr : array[tfputype] of string[6] = (
  76. 'NONE',
  77. 'SOFT',
  78. 'LIBGCC'
  79. );
  80. { Supported optimizations, only used for information }
  81. supported_optimizerswitches = genericlevel1optimizerswitches+
  82. genericlevel2optimizerswitches+
  83. genericlevel3optimizerswitches-
  84. { no need to write info about those }
  85. [cs_opt_level1,cs_opt_level2,cs_opt_level3]+
  86. [{cs_opt_regvar,}cs_opt_loopunroll,cs_opt_tailrecursion,
  87. cs_opt_stackframe,cs_opt_nodecse,cs_opt_reorder_fields,cs_opt_fastmath];
  88. level1optimizerswitches = genericlevel1optimizerswitches;
  89. level2optimizerswitches = genericlevel2optimizerswitches + level1optimizerswitches +
  90. [{cs_opt_regvar,}cs_opt_stackframe,cs_opt_tailrecursion];
  91. level3optimizerswitches = genericlevel3optimizerswitches + level2optimizerswitches;
  92. level4optimizerswitches = genericlevel4optimizerswitches + level3optimizerswitches + [];
  93. type
  94. tcpuflags =
  95. (CPU6502_HAS_ROR
  96. );
  97. const
  98. cpu_capabilities : array[tcputype] of set of tcpuflags =
  99. ( { cpu_none } [],
  100. { cpu_mos_6502_rev_a } [],
  101. { cpu_mos_6502_rev_b } [CPU6502_HAS_ROR]
  102. );
  103. Implementation
  104. end.