m68kconf.h 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. /* ======================================================================== */
  2. /* ========================= LICENSING & COPYRIGHT ======================== */
  3. /* ======================================================================== */
  4. /*
  5. * MUSASHI
  6. * Version 3.3
  7. *
  8. * A portable Motorola M680x0 processor emulation engine.
  9. * Copyright 1998-2001 Karl Stenerud. All rights reserved.
  10. *
  11. * This code may be freely used for non-commercial purposes as long as this
  12. * copyright notice remains unaltered in the source code and any binary files
  13. * containing this code in compiled form.
  14. *
  15. * All other lisencing terms must be negotiated with the author
  16. * (Karl Stenerud).
  17. *
  18. * The latest version of this code can be obtained at:
  19. * http://kstenerud.cjb.net
  20. */
  21. // notaz: kill some stupid VC warnings
  22. #ifndef __GNUC__
  23. #pragma warning (disable:4100) // unreferenced formal parameter
  24. #pragma warning (disable:4127) // conditional expression is constant
  25. #pragma warning (disable:4245) // type conversion
  26. #pragma warning (disable:4514) // unreferenced inline function has been removed
  27. #endif
  28. #ifndef M68KCONF__HEADER
  29. #define M68KCONF__HEADER
  30. /* Configuration switches.
  31. * Use OPT_SPECIFY_HANDLER for configuration options that allow callbacks.
  32. * OPT_SPECIFY_HANDLER causes the core to link directly to the function
  33. * or macro you specify, rather than using callback functions whose pointer
  34. * must be passed in using m68k_set_xxx_callback().
  35. */
  36. #define OPT_OFF 0
  37. #define OPT_ON 1
  38. #define OPT_SPECIFY_HANDLER 2
  39. /* ======================================================================== */
  40. /* ============================== MAME STUFF ============================== */
  41. /* ======================================================================== */
  42. /* If you're compiling this for MAME, only change M68K_COMPILE_FOR_MAME
  43. * to OPT_ON and use m68kmame.h to configure the 68k core.
  44. */
  45. #ifndef M68K_COMPILE_FOR_MAME
  46. #define M68K_COMPILE_FOR_MAME OPT_OFF
  47. #endif /* M68K_COMPILE_FOR_MAME */
  48. #if M68K_COMPILE_FOR_MAME == OPT_OFF
  49. /* ======================================================================== */
  50. /* ============================= CONFIGURATION ============================ */
  51. /* ======================================================================== */
  52. /* Turn ON if you want to use the following M68K variants */
  53. #define M68K_EMULATE_008 OPT_OFF
  54. #define M68K_EMULATE_010 OPT_OFF
  55. #define M68K_EMULATE_EC020 OPT_OFF
  56. #define M68K_EMULATE_020 OPT_OFF
  57. #define M68K_EMULATE_040 OPT_OFF
  58. /* If ON, the CPU will call m68k_read_immediate_xx() for immediate addressing
  59. * and m68k_read_pcrelative_xx() for PC-relative addressing.
  60. * If off, all read requests from the CPU will be redirected to m68k_read_xx()
  61. */
  62. #define M68K_SEPARATE_READS OPT_OFF
  63. /* If ON, the CPU will call m68k_write_32_pd() when it executes move.l with a
  64. * predecrement destination EA mode instead of m68k_write_32().
  65. * To simulate real 68k behavior, m68k_write_32_pd() must first write the high
  66. * word to [address+2], and then write the low word to [address].
  67. */
  68. #define M68K_SIMULATE_PD_WRITES OPT_OFF
  69. /* If ON, CPU will call the interrupt acknowledge callback when it services an
  70. * interrupt.
  71. * If off, all interrupts will be autovectored and all interrupt requests will
  72. * auto-clear when the interrupt is serviced.
  73. */
  74. #define M68K_EMULATE_INT_ACK OPT_ON
  75. #define M68K_INT_ACK_CALLBACK(A) your_int_ack_handler_function(A)
  76. /* If ON, CPU will call the breakpoint acknowledge callback when it encounters
  77. * a breakpoint instruction and it is running a 68010+.
  78. */
  79. #define M68K_EMULATE_BKPT_ACK OPT_OFF
  80. #define M68K_BKPT_ACK_CALLBACK() your_bkpt_ack_handler_function()
  81. /* If ON, the CPU will monitor the trace flags and take trace exceptions
  82. */
  83. #define M68K_EMULATE_TRACE OPT_ON
  84. /* If ON, CPU will call the output reset callback when it encounters a reset
  85. * instruction.
  86. */
  87. #define M68K_EMULATE_RESET OPT_OFF
  88. #define M68K_RESET_CALLBACK() your_reset_handler_function()
  89. /* If ON, CPU will call the callback when it encounters a cmpi.l #v, dn
  90. * instruction.
  91. */
  92. #define M68K_CMPILD_HAS_CALLBACK OPT_OFF
  93. #define M68K_CMPILD_CALLBACK(v,r) your_cmpild_handler_function(v,r)
  94. /* If ON, CPU will call the callback when it encounters a rte
  95. * instruction.
  96. */
  97. #define M68K_RTE_HAS_CALLBACK OPT_OFF
  98. #define M68K_RTE_CALLBACK() your_rte_handler_function()
  99. /* If ON, CPU will call the callback when it encounters a tas
  100. * instruction.
  101. */
  102. #define M68K_TAS_HAS_CALLBACK OPT_ON
  103. #define M68K_TAS_CALLBACK() your_tas_handler_function()
  104. /* If ON, CPU will call the set fc callback on every memory access to
  105. * differentiate between user/supervisor, program/data access like a real
  106. * 68000 would. This should be enabled and the callback should be set if you
  107. * want to properly emulate the m68010 or higher. (moves uses function codes
  108. * to read/write data from different address spaces)
  109. */
  110. #define M68K_EMULATE_FC OPT_OFF
  111. #define M68K_SET_FC_CALLBACK(A) your_set_fc_handler_function(A)
  112. /* If ON, CPU will call the pc changed callback when it changes the PC by a
  113. * large value. This allows host programs to be nicer when it comes to
  114. * fetching immediate data and instructions on a banked memory system.
  115. */
  116. #define M68K_MONITOR_PC OPT_OFF
  117. #define M68K_SET_PC_CALLBACK(A) your_pc_changed_handler_function(A)
  118. /* If ON, CPU will call the instruction hook callback before every
  119. * instruction.
  120. */
  121. #define M68K_INSTRUCTION_HOOK OPT_OFF
  122. //#define M68K_INSTRUCTION_HOOK OPT_SPECIFY_HANDLER
  123. #define M68K_INSTRUCTION_CALLBACK() instruction_hook()
  124. /* If ON, the CPU will emulate the 4-byte prefetch queue of a real 68000 */
  125. #define M68K_EMULATE_PREFETCH OPT_OFF
  126. /* If ON, the CPU will generate address error exceptions if it tries to
  127. * access a word or longword at an odd address.
  128. * NOTE: This is only emulated properly for 68000 mode.
  129. */
  130. #define M68K_EMULATE_ADDRESS_ERROR OPT_OFF
  131. /* Turn ON to enable logging of illegal instruction calls.
  132. * M68K_LOG_FILEHANDLE must be #defined to a stdio file stream.
  133. * Turn on M68K_LOG_1010_1111 to log all 1010 and 1111 calls.
  134. */
  135. #define M68K_LOG_ENABLE OPT_OFF
  136. #define M68K_LOG_1010_1111 OPT_OFF
  137. #define M68K_LOG_FILEHANDLE some_file_handle
  138. /* ----------------------------- COMPATIBILITY ---------------------------- */
  139. /* The following options set optimizations that violate the current ANSI
  140. * standard, but will be compliant under the forthcoming C9X standard.
  141. */
  142. /* If ON, the enulation core will use 64-bit integers to speed up some
  143. * operations.
  144. */
  145. #define M68K_USE_64_BIT OPT_OFF
  146. /* Set to your compiler's static inline keyword to enable it, or
  147. * set it to blank to disable it.
  148. * If you define INLINE in the makefile, it will override this value.
  149. * NOTE: not enabling inline functions will SEVERELY slow down emulation.
  150. */
  151. #ifndef INLINE
  152. #define INLINE static __inline
  153. #endif /* INLINE */
  154. #endif /* M68K_COMPILE_FOR_MAME */
  155. /* ======================================================================== */
  156. /* ============================== END OF FILE ============================= */
  157. /* ======================================================================== */
  158. #endif /* M68KCONF__HEADER */