Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

  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.  
  22.  
  23.  
  24. #ifndef M68KCONF__HEADER
  25. #define M68KCONF__HEADER
  26.  
  27. #include <limits.h>
  28.  
  29. /* Configuration switches.
  30.  * Use OPT_SPECIFY_HANDLER for configuration options that allow callbacks.
  31.  * OPT_SPECIFY_HANDLER causes the core to link directly to the function
  32.  * or macro you specify, rather than using callback functions whose pointer
  33.  * must be passed in using m68k_set_xxx_callback().
  34.  */
  35. #define OPT_OFF             0
  36. #define OPT_ON              1
  37. #define OPT_SPECIFY_HANDLER 2
  38.  
  39.  
  40. /* ======================================================================== */
  41. /* ============================== MAME STUFF ============================== */
  42. /* ======================================================================== */
  43.  
  44. /* If you're compiling this for MAME, only change M68K_COMPILE_FOR_MAME
  45.  * to OPT_ON and use m68kmame.h to configure the 68k core.
  46.  */
  47. #ifndef M68K_COMPILE_FOR_MAME
  48. #define M68K_COMPILE_FOR_MAME      OPT_OFF
  49. #endif /* M68K_COMPILE_FOR_MAME */
  50.  
  51.  
  52. #if M68K_COMPILE_FOR_MAME == OPT_OFF
  53.  
  54.  
  55. /* ======================================================================== */
  56. /* ============================= CONFIGURATION ============================ */
  57. /* ======================================================================== */
  58.  
  59. /* Turn ON if you want to use the following M68K variants */
  60. #define M68K_EMULATE_008            OPT_OFF
  61. #define M68K_EMULATE_010            OPT_OFF
  62. #define M68K_EMULATE_EC020          OPT_OFF
  63. #define M68K_EMULATE_020            OPT_OFF
  64. #define M68K_EMULATE_040            OPT_OFF
  65.  
  66.  
  67. /* If ON, the CPU will call m68k_read_immediate_xx() for immediate addressing
  68.  * and m68k_read_pcrelative_xx() for PC-relative addressing.
  69.  * If off, all read requests from the CPU will be redirected to m68k_read_xx()
  70.  */
  71. #define M68K_SEPARATE_READS         OPT_OFF
  72.  
  73. /* If ON, the CPU will call m68k_write_32_pd() when it executes move.l with a
  74.  * predecrement destination EA mode instead of m68k_write_32().
  75.  * To simulate real 68k behavior, m68k_write_32_pd() must first write the high
  76.  * word to [address+2], and then write the low word to [address].
  77.  */
  78. #define M68K_SIMULATE_PD_WRITES     OPT_OFF
  79.  
  80. /* If ON, m68k_register_memory() can be used to register an array of memory
  81.  * regions directly accessible from Musashi without having to call
  82.  * intermediate read/write functions.
  83.  */
  84. #define M68K_REGISTER_MEMORY        OPT_ON
  85.  
  86. /* If ON, CPU will call the interrupt acknowledge callback when it services an
  87.  * interrupt.
  88.  * If off, all interrupts will be autovectored and all interrupt requests will
  89.  * auto-clear when the interrupt is serviced.
  90.  */
  91. #define M68K_EMULATE_INT_ACK        OPT_ON
  92. #define M68K_INT_ACK_CALLBACK(A)    your_int_ack_handler_function(A)
  93.  
  94.  
  95. /* If ON, CPU will call the breakpoint acknowledge callback when it encounters
  96.  * a breakpoint instruction and it is running a 68010+.
  97.  */
  98. #define M68K_EMULATE_BKPT_ACK       OPT_OFF
  99. #define M68K_BKPT_ACK_CALLBACK()    your_bkpt_ack_handler_function()
  100.  
  101.  
  102. /* If ON, the CPU will monitor the trace flags and take trace exceptions
  103.  */
  104. #define M68K_EMULATE_TRACE          OPT_OFF
  105.  
  106.  
  107. /* If ON, CPU will call the output reset callback when it encounters a reset
  108.  * instruction.
  109.  */
  110. #define M68K_EMULATE_RESET          OPT_OFF
  111. #define M68K_RESET_CALLBACK()       your_reset_handler_function()
  112.  
  113.  
  114. /* If ON, CPU will call the callback when it encounters a cmpi.l #v, dn
  115.  * instruction.
  116.  */
  117. #define M68K_CMPILD_HAS_CALLBACK     OPT_OFF
  118. #define M68K_CMPILD_CALLBACK(v,r)    your_cmpild_handler_function(v,r)
  119.  
  120.  
  121. /* If ON, CPU will call the callback when it encounters a rte
  122.  * instruction.
  123.  */
  124. #define M68K_RTE_HAS_CALLBACK       OPT_OFF
  125. #define M68K_RTE_CALLBACK()         your_rte_handler_function()
  126.  
  127.  
  128. /* If ON, CPU will call the callback when it encounters a tas
  129.  * instruction.
  130.  */
  131. #define M68K_TAS_HAS_CALLBACK       OPT_OFF
  132. #define M68K_TAS_CALLBACK()         your_tas_handler_function()
  133.  
  134.  
  135. /* If ON, CPU will call the set fc callback on every memory access to
  136.  * differentiate between user/supervisor, program/data access like a real
  137.  * 68000 would.  This should be enabled and the callback should be set if you
  138.  * want to properly emulate the m68010 or higher. (moves uses function codes
  139.  * to read/write data from different address spaces)
  140.  */
  141. #define M68K_EMULATE_FC             OPT_OFF
  142. #define M68K_SET_FC_CALLBACK(A)     your_set_fc_handler_function(A)
  143.  
  144.  
  145. /* If ON, CPU will call the pc changed callback when it changes the PC by a
  146.  * large value.  This allows host programs to be nicer when it comes to
  147.  * fetching immediate data and instructions on a banked memory system.
  148.  */
  149. #define M68K_MONITOR_PC             OPT_OFF
  150. #define M68K_SET_PC_CALLBACK(A)     your_pc_changed_handler_function(A)
  151.  
  152.  
  153. /* If ON, CPU will call the instruction hook callback before every
  154.  * instruction.
  155.  */
  156. #ifdef WITH_DEBUGGER
  157. #define M68K_INSTRUCTION_HOOK       OPT_ON
  158. #else
  159. #define M68K_INSTRUCTION_HOOK       OPT_OFF
  160. #endif
  161. #define M68K_INSTRUCTION_CALLBACK() your_instruction_hook_function()
  162.  
  163.  
  164. /* If ON, the CPU will emulate the 4-byte prefetch queue of a real 68000 */
  165. #define M68K_EMULATE_PREFETCH       OPT_OFF
  166.  
  167.  
  168. /* If ON, the CPU will generate address error exceptions if it tries to
  169.  * access a word or longword at an odd address.
  170.  * NOTE: This is only emulated properly for 68000 mode.
  171.  */
  172. #define M68K_EMULATE_ADDRESS_ERROR  OPT_OFF
  173.  
  174.  
  175. /* Turn ON to enable logging of illegal instruction calls.
  176.  * M68K_LOG_FILEHANDLE must be #defined to a stdio file stream.
  177.  * Turn on M68K_LOG_1010_1111 to log all 1010 and 1111 calls.
  178.  */
  179. #define M68K_LOG_ENABLE             OPT_OFF
  180. #define M68K_LOG_1010_1111          OPT_OFF
  181. #define M68K_LOG_FILEHANDLE         some_file_handle
  182.  
  183.  
  184. /* ----------------------------- COMPATIBILITY ---------------------------- */
  185.  
  186. /* The following options set optimizations that violate the current ANSI
  187.  * standard, but will be compliant under the forthcoming C9X standard.
  188.  */
  189.  
  190.  
  191. /* If ON, the enulation core will use 64-bit integers to speed up some
  192.  * operations.
  193.  * Unsigned long is usually a good indicator for this purpose.
  194.  */
  195. #if ULONG_MAX > 0xffffffff
  196. #define M68K_USE_64_BIT  OPT_ON
  197. #else
  198. #define M68K_USE_64_BIT  OPT_OFF
  199. #endif
  200.  
  201.  
  202. /* Set to your compiler's static inline keyword to enable it, or
  203.  * set it to blank to disable it.
  204.  * If you define INLINE in the makefile, it will override this value.
  205.  * NOTE: not enabling inline functions will SEVERELY slow down emulation.
  206.  */
  207. #ifndef INLINE
  208. #define INLINE static inline
  209. #endif /* INLINE */
  210.  
  211. #endif /* M68K_COMPILE_FOR_MAME */
  212.  
  213.  
  214. /* ======================================================================== */
  215. /* ============================== END OF FILE ============================= */
  216. /* ======================================================================== */
  217.  
  218. #endif /* M68KCONF__HEADER */
  219.