2011-07-14 00:49:52 +02:00
|
|
|
/* ======================================================================== */
|
|
|
|
/* ========================= LICENSING & COPYRIGHT ======================== */
|
|
|
|
/* ======================================================================== */
|
|
|
|
/*
|
|
|
|
* MUSASHI
|
|
|
|
* Version 3.32
|
|
|
|
*
|
|
|
|
* A portable Motorola M680x0 processor emulation engine.
|
|
|
|
* Copyright Karl Stenerud. All rights reserved.
|
|
|
|
*
|
|
|
|
* This code may be freely used for non-commercial purposes as long as this
|
|
|
|
* copyright notice remains unaltered in the source code and any binary files
|
|
|
|
* containing this code in compiled form.
|
|
|
|
*
|
|
|
|
* All other licensing terms must be negotiated with the author
|
|
|
|
* (Karl Stenerud).
|
|
|
|
*
|
|
|
|
* The latest version of this code can be obtained at:
|
|
|
|
* http://kstenerud.cjb.net
|
|
|
|
*/
|
|
|
|
|
----------------------
Genesis Plus GX 1.6.0
----------------------
[Core/Sound]
---------------
* added YM2413 emulation in Master System compatibility mode.
* fixed SN76489 noise boost initialization.
* minor YM2612 core optimizations.
[Core/VDP]
---------------
* added accurate emulation of SG-1000, Master System (315-5124, 315-5246) & Game Gear VDP.
* added support for all TMS9918 rendering modes.
* improved Mega Drive VDP timings accuracy in Master System Compatibility mode.
* fixed color palette initialization.
* fixed shifted sprites rendering in Mode 4.
* modified pixel rendering support (pixel depth is now forced at compilation time).
[Core/CPU]
---------------
* optimized 68k core (rewrote 68k interrupt handling, removed multiple CPU types support & unused code) for 5~8% speed improvment
[Core/IO]
---------------
* added accurate emulation of Master System (315-5216, 315-5237, 315-5297) & Game Gear I/O controllers.
* added Terebi Oekaki tablet emulation.
* improved Mouse emulation (fixes mouse support in Cannon Fodder).
* improved Justifier emulation (fixes gun support in Lethal Enforcers 2).
* improved 6-Buttons control pad emulation (fixes Duke Nukem 3D)
* modified lightgun emulation to use common key inputs for all devices.
* 2-buttons controller is now picked by default for Master System games.
[Core/MD]
---------------
* added copy-protection hardware emulation for some new dumped games (Tiny Toon Adventures 3, Mighty Morphin Power Rangers & The Battle of Red Cliffs).
* added Game Toshokan in EEPROM database (verified on real cartridge).
* fixed Micro Machines 2 - Turbo Tournament EEPROM size (verified on real cartridge).
* modified SRAM banswitch hardware emulation to be more compatible with some hacks.
[Core/MS]
---------------
* added Cyborg Z to Korean mapper database.
[Core/GG]
---------------
* added 93C46 EEPROM emulation (Majors Pro Baseball, World Series Baseball & World Series Baseball 95).
[Core/General]
---------------
* added support for .mdx ROM format.
* added Game Gear & SG-1000 ROM support.
* added accurate emulation of SG-1000, Master System (I, II) & Game Gear hardware models for 100% compatibility.
* updated to new Genesis Plus license (see http://cgfm2.emuviews.com/)
* removed DOS port
* various code cleanup.
[Gamecube/Wii]
---------------
* IMPORTANT: cheats, screenshots & save files are now stored in console-specific directories (ex: /snaps/md, /cheats/ms, /saves/gg, ...)
* added 8-bit Action Replay & Game Genie codes support (for Master System & Game Gear games).
* improved audio/video synchronization for PAL games in 50Hz TV modes (now use VSYNC like NTSC games in 60hz modes).
* improved gun cursor positioning accuracy.
* improved horizontal scaling & screenshots rendering in H32 mode.
* fixed a bug with ROM file extension handling that would affect cheats, snapshots, sram & savestate files.
* removed ARAM/injected ROM support (unused).
* removed WPAD_ and PAD_ update from VSYNC callback.
* increased GCC inlining limits for some speed improvment.
* compiled with devkitPPC r24 & libogc 1.8.7.
2011-08-07 19:49:46 +02:00
|
|
|
/* Modified by Eke-Eke for Genesis Plus GX:
|
|
|
|
|
|
|
|
- removed unused stuff to reduce memory usage / optimize execution (multiple CPU types support, NMI support, ...)
|
|
|
|
- moved stuff to compile statically in a single object file
|
|
|
|
- implemented support for global cycle count (shared by 68k & Z80 CPU)
|
|
|
|
- added support for interrupt latency (Sesame's Street Counting Cafe, Fatal Rewind)
|
|
|
|
- added proper cycle use on reset
|
|
|
|
- added cycle accurate timings for MUL/DIV instructions (thanks to Jorge Cwik !)
|
|
|
|
- fixed undocumented flags for DIV instructions (Blood Shot)
|
|
|
|
|
|
|
|
*/
|
2011-07-14 00:49:52 +02:00
|
|
|
|
|
|
|
|
|
|
|
#ifndef M68KCONF__HEADER
|
|
|
|
#define M68KCONF__HEADER
|
|
|
|
|
|
|
|
|
|
|
|
/* Configuration switches.
|
|
|
|
* Use OPT_SPECIFY_HANDLER for configuration options that allow callbacks.
|
|
|
|
* OPT_SPECIFY_HANDLER causes the core to link directly to the function
|
|
|
|
* or macro you specify, rather than using callback functions whose pointer
|
|
|
|
* must be passed in using m68k_set_xxx_callback().
|
|
|
|
*/
|
|
|
|
#define OPT_OFF 0
|
|
|
|
#define OPT_ON 1
|
|
|
|
#define OPT_SPECIFY_HANDLER 2
|
|
|
|
|
|
|
|
/* ======================================================================== */
|
|
|
|
/* ============================= CONFIGURATION ============================ */
|
|
|
|
/* ======================================================================== */
|
|
|
|
|
|
|
|
/* If ON, the CPU will call m68k_write_32_pd() when it executes move.l with a
|
|
|
|
* predecrement destination EA mode instead of m68k_write_32().
|
|
|
|
* To simulate real 68k behavior, m68k_write_32_pd() must first write the high
|
|
|
|
* word to [address+2], and then write the low word to [address].
|
|
|
|
*/
|
|
|
|
#define M68K_SIMULATE_PD_WRITES OPT_OFF
|
|
|
|
|
|
|
|
/* If ON, CPU will call the interrupt acknowledge callback when it services an
|
|
|
|
* interrupt.
|
|
|
|
* If off, all interrupts will be autovectored and all interrupt requests will
|
|
|
|
* auto-clear when the interrupt is serviced.
|
|
|
|
*/
|
|
|
|
#define M68K_EMULATE_INT_ACK OPT_SPECIFY_HANDLER
|
|
|
|
#define M68K_INT_ACK_CALLBACK(A) vdp_68k_irq_ack(A)
|
|
|
|
|
|
|
|
/* If ON, CPU will call the output reset callback when it encounters a reset
|
|
|
|
* instruction.
|
|
|
|
*/
|
|
|
|
#define M68K_EMULATE_RESET OPT_OFF
|
|
|
|
#define M68K_RESET_CALLBACK() your_reset_handler_function()
|
|
|
|
|
|
|
|
/* If ON, CPU will call the callback when it encounters a tas
|
|
|
|
* instruction.
|
|
|
|
*/
|
|
|
|
#define M68K_TAS_HAS_CALLBACK OPT_OFF
|
|
|
|
#define M68K_TAS_CALLBACK() your_tas_handler_function()
|
|
|
|
|
|
|
|
/* If ON, CPU will call the set fc callback on every memory access to
|
|
|
|
* differentiate between user/supervisor, program/data access like a real
|
|
|
|
* 68000 would. This should be enabled and the callback should be set if you
|
|
|
|
* want to properly emulate the m68010 or higher. (moves uses function codes
|
|
|
|
* to read/write data from different address spaces)
|
|
|
|
*/
|
|
|
|
#define M68K_EMULATE_FC OPT_OFF
|
|
|
|
#define M68K_SET_FC_CALLBACK(A) your_set_fc_handler_function(A)
|
|
|
|
|
----------------------
Genesis Plus GX 1.6.0
----------------------
[Core/Sound]
---------------
* added YM2413 emulation in Master System compatibility mode.
* fixed SN76489 noise boost initialization.
* minor YM2612 core optimizations.
[Core/VDP]
---------------
* added accurate emulation of SG-1000, Master System (315-5124, 315-5246) & Game Gear VDP.
* added support for all TMS9918 rendering modes.
* improved Mega Drive VDP timings accuracy in Master System Compatibility mode.
* fixed color palette initialization.
* fixed shifted sprites rendering in Mode 4.
* modified pixel rendering support (pixel depth is now forced at compilation time).
[Core/CPU]
---------------
* optimized 68k core (rewrote 68k interrupt handling, removed multiple CPU types support & unused code) for 5~8% speed improvment
[Core/IO]
---------------
* added accurate emulation of Master System (315-5216, 315-5237, 315-5297) & Game Gear I/O controllers.
* added Terebi Oekaki tablet emulation.
* improved Mouse emulation (fixes mouse support in Cannon Fodder).
* improved Justifier emulation (fixes gun support in Lethal Enforcers 2).
* improved 6-Buttons control pad emulation (fixes Duke Nukem 3D)
* modified lightgun emulation to use common key inputs for all devices.
* 2-buttons controller is now picked by default for Master System games.
[Core/MD]
---------------
* added copy-protection hardware emulation for some new dumped games (Tiny Toon Adventures 3, Mighty Morphin Power Rangers & The Battle of Red Cliffs).
* added Game Toshokan in EEPROM database (verified on real cartridge).
* fixed Micro Machines 2 - Turbo Tournament EEPROM size (verified on real cartridge).
* modified SRAM banswitch hardware emulation to be more compatible with some hacks.
[Core/MS]
---------------
* added Cyborg Z to Korean mapper database.
[Core/GG]
---------------
* added 93C46 EEPROM emulation (Majors Pro Baseball, World Series Baseball & World Series Baseball 95).
[Core/General]
---------------
* added support for .mdx ROM format.
* added Game Gear & SG-1000 ROM support.
* added accurate emulation of SG-1000, Master System (I, II) & Game Gear hardware models for 100% compatibility.
* updated to new Genesis Plus license (see http://cgfm2.emuviews.com/)
* removed DOS port
* various code cleanup.
[Gamecube/Wii]
---------------
* IMPORTANT: cheats, screenshots & save files are now stored in console-specific directories (ex: /snaps/md, /cheats/ms, /saves/gg, ...)
* added 8-bit Action Replay & Game Genie codes support (for Master System & Game Gear games).
* improved audio/video synchronization for PAL games in 50Hz TV modes (now use VSYNC like NTSC games in 60hz modes).
* improved gun cursor positioning accuracy.
* improved horizontal scaling & screenshots rendering in H32 mode.
* fixed a bug with ROM file extension handling that would affect cheats, snapshots, sram & savestate files.
* removed ARAM/injected ROM support (unused).
* removed WPAD_ and PAD_ update from VSYNC callback.
* increased GCC inlining limits for some speed improvment.
* compiled with devkitPPC r24 & libogc 1.8.7.
2011-08-07 19:49:46 +02:00
|
|
|
/* If ON, the CPU will monitor the trace flags and take trace exceptions
|
2011-07-14 00:49:52 +02:00
|
|
|
*/
|
----------------------
Genesis Plus GX 1.6.0
----------------------
[Core/Sound]
---------------
* added YM2413 emulation in Master System compatibility mode.
* fixed SN76489 noise boost initialization.
* minor YM2612 core optimizations.
[Core/VDP]
---------------
* added accurate emulation of SG-1000, Master System (315-5124, 315-5246) & Game Gear VDP.
* added support for all TMS9918 rendering modes.
* improved Mega Drive VDP timings accuracy in Master System Compatibility mode.
* fixed color palette initialization.
* fixed shifted sprites rendering in Mode 4.
* modified pixel rendering support (pixel depth is now forced at compilation time).
[Core/CPU]
---------------
* optimized 68k core (rewrote 68k interrupt handling, removed multiple CPU types support & unused code) for 5~8% speed improvment
[Core/IO]
---------------
* added accurate emulation of Master System (315-5216, 315-5237, 315-5297) & Game Gear I/O controllers.
* added Terebi Oekaki tablet emulation.
* improved Mouse emulation (fixes mouse support in Cannon Fodder).
* improved Justifier emulation (fixes gun support in Lethal Enforcers 2).
* improved 6-Buttons control pad emulation (fixes Duke Nukem 3D)
* modified lightgun emulation to use common key inputs for all devices.
* 2-buttons controller is now picked by default for Master System games.
[Core/MD]
---------------
* added copy-protection hardware emulation for some new dumped games (Tiny Toon Adventures 3, Mighty Morphin Power Rangers & The Battle of Red Cliffs).
* added Game Toshokan in EEPROM database (verified on real cartridge).
* fixed Micro Machines 2 - Turbo Tournament EEPROM size (verified on real cartridge).
* modified SRAM banswitch hardware emulation to be more compatible with some hacks.
[Core/MS]
---------------
* added Cyborg Z to Korean mapper database.
[Core/GG]
---------------
* added 93C46 EEPROM emulation (Majors Pro Baseball, World Series Baseball & World Series Baseball 95).
[Core/General]
---------------
* added support for .mdx ROM format.
* added Game Gear & SG-1000 ROM support.
* added accurate emulation of SG-1000, Master System (I, II) & Game Gear hardware models for 100% compatibility.
* updated to new Genesis Plus license (see http://cgfm2.emuviews.com/)
* removed DOS port
* various code cleanup.
[Gamecube/Wii]
---------------
* IMPORTANT: cheats, screenshots & save files are now stored in console-specific directories (ex: /snaps/md, /cheats/ms, /saves/gg, ...)
* added 8-bit Action Replay & Game Genie codes support (for Master System & Game Gear games).
* improved audio/video synchronization for PAL games in 50Hz TV modes (now use VSYNC like NTSC games in 60hz modes).
* improved gun cursor positioning accuracy.
* improved horizontal scaling & screenshots rendering in H32 mode.
* fixed a bug with ROM file extension handling that would affect cheats, snapshots, sram & savestate files.
* removed ARAM/injected ROM support (unused).
* removed WPAD_ and PAD_ update from VSYNC callback.
* increased GCC inlining limits for some speed improvment.
* compiled with devkitPPC r24 & libogc 1.8.7.
2011-08-07 19:49:46 +02:00
|
|
|
#define M68K_EMULATE_TRACE OPT_OFF
|
2011-07-14 00:49:52 +02:00
|
|
|
|
|
|
|
/* If ON, the CPU will emulate the 4-byte prefetch queue of a real 68000 */
|
|
|
|
#define M68K_EMULATE_PREFETCH OPT_OFF
|
|
|
|
|
|
|
|
/* If ON, the CPU will generate address error exceptions if it tries to
|
|
|
|
* access a word or longword at an odd address.
|
|
|
|
* NOTE: This is only emulated properly for 68000 mode.
|
|
|
|
*/
|
|
|
|
#define M68K_EMULATE_ADDRESS_ERROR OPT_ON
|
|
|
|
|
----------------------
Genesis Plus GX 1.6.0
----------------------
[Core/Sound]
---------------
* added YM2413 emulation in Master System compatibility mode.
* fixed SN76489 noise boost initialization.
* minor YM2612 core optimizations.
[Core/VDP]
---------------
* added accurate emulation of SG-1000, Master System (315-5124, 315-5246) & Game Gear VDP.
* added support for all TMS9918 rendering modes.
* improved Mega Drive VDP timings accuracy in Master System Compatibility mode.
* fixed color palette initialization.
* fixed shifted sprites rendering in Mode 4.
* modified pixel rendering support (pixel depth is now forced at compilation time).
[Core/CPU]
---------------
* optimized 68k core (rewrote 68k interrupt handling, removed multiple CPU types support & unused code) for 5~8% speed improvment
[Core/IO]
---------------
* added accurate emulation of Master System (315-5216, 315-5237, 315-5297) & Game Gear I/O controllers.
* added Terebi Oekaki tablet emulation.
* improved Mouse emulation (fixes mouse support in Cannon Fodder).
* improved Justifier emulation (fixes gun support in Lethal Enforcers 2).
* improved 6-Buttons control pad emulation (fixes Duke Nukem 3D)
* modified lightgun emulation to use common key inputs for all devices.
* 2-buttons controller is now picked by default for Master System games.
[Core/MD]
---------------
* added copy-protection hardware emulation for some new dumped games (Tiny Toon Adventures 3, Mighty Morphin Power Rangers & The Battle of Red Cliffs).
* added Game Toshokan in EEPROM database (verified on real cartridge).
* fixed Micro Machines 2 - Turbo Tournament EEPROM size (verified on real cartridge).
* modified SRAM banswitch hardware emulation to be more compatible with some hacks.
[Core/MS]
---------------
* added Cyborg Z to Korean mapper database.
[Core/GG]
---------------
* added 93C46 EEPROM emulation (Majors Pro Baseball, World Series Baseball & World Series Baseball 95).
[Core/General]
---------------
* added support for .mdx ROM format.
* added Game Gear & SG-1000 ROM support.
* added accurate emulation of SG-1000, Master System (I, II) & Game Gear hardware models for 100% compatibility.
* updated to new Genesis Plus license (see http://cgfm2.emuviews.com/)
* removed DOS port
* various code cleanup.
[Gamecube/Wii]
---------------
* IMPORTANT: cheats, screenshots & save files are now stored in console-specific directories (ex: /snaps/md, /cheats/ms, /saves/gg, ...)
* added 8-bit Action Replay & Game Genie codes support (for Master System & Game Gear games).
* improved audio/video synchronization for PAL games in 50Hz TV modes (now use VSYNC like NTSC games in 60hz modes).
* improved gun cursor positioning accuracy.
* improved horizontal scaling & screenshots rendering in H32 mode.
* fixed a bug with ROM file extension handling that would affect cheats, snapshots, sram & savestate files.
* removed ARAM/injected ROM support (unused).
* removed WPAD_ and PAD_ update from VSYNC callback.
* increased GCC inlining limits for some speed improvment.
* compiled with devkitPPC r24 & libogc 1.8.7.
2011-08-07 19:49:46 +02:00
|
|
|
/* If ON and previous option is also ON, address error exceptions will
|
|
|
|
also be checked when fetching instructions. Disabling this can help
|
|
|
|
speeding up emulation while still emulating address error exceptions
|
|
|
|
on other memory access if needed.
|
|
|
|
* NOTE: This is only emulated properly for 68000 mode.
|
2011-07-14 00:49:52 +02:00
|
|
|
*/
|
----------------------
Genesis Plus GX 1.6.0
----------------------
[Core/Sound]
---------------
* added YM2413 emulation in Master System compatibility mode.
* fixed SN76489 noise boost initialization.
* minor YM2612 core optimizations.
[Core/VDP]
---------------
* added accurate emulation of SG-1000, Master System (315-5124, 315-5246) & Game Gear VDP.
* added support for all TMS9918 rendering modes.
* improved Mega Drive VDP timings accuracy in Master System Compatibility mode.
* fixed color palette initialization.
* fixed shifted sprites rendering in Mode 4.
* modified pixel rendering support (pixel depth is now forced at compilation time).
[Core/CPU]
---------------
* optimized 68k core (rewrote 68k interrupt handling, removed multiple CPU types support & unused code) for 5~8% speed improvment
[Core/IO]
---------------
* added accurate emulation of Master System (315-5216, 315-5237, 315-5297) & Game Gear I/O controllers.
* added Terebi Oekaki tablet emulation.
* improved Mouse emulation (fixes mouse support in Cannon Fodder).
* improved Justifier emulation (fixes gun support in Lethal Enforcers 2).
* improved 6-Buttons control pad emulation (fixes Duke Nukem 3D)
* modified lightgun emulation to use common key inputs for all devices.
* 2-buttons controller is now picked by default for Master System games.
[Core/MD]
---------------
* added copy-protection hardware emulation for some new dumped games (Tiny Toon Adventures 3, Mighty Morphin Power Rangers & The Battle of Red Cliffs).
* added Game Toshokan in EEPROM database (verified on real cartridge).
* fixed Micro Machines 2 - Turbo Tournament EEPROM size (verified on real cartridge).
* modified SRAM banswitch hardware emulation to be more compatible with some hacks.
[Core/MS]
---------------
* added Cyborg Z to Korean mapper database.
[Core/GG]
---------------
* added 93C46 EEPROM emulation (Majors Pro Baseball, World Series Baseball & World Series Baseball 95).
[Core/General]
---------------
* added support for .mdx ROM format.
* added Game Gear & SG-1000 ROM support.
* added accurate emulation of SG-1000, Master System (I, II) & Game Gear hardware models for 100% compatibility.
* updated to new Genesis Plus license (see http://cgfm2.emuviews.com/)
* removed DOS port
* various code cleanup.
[Gamecube/Wii]
---------------
* IMPORTANT: cheats, screenshots & save files are now stored in console-specific directories (ex: /snaps/md, /cheats/ms, /saves/gg, ...)
* added 8-bit Action Replay & Game Genie codes support (for Master System & Game Gear games).
* improved audio/video synchronization for PAL games in 50Hz TV modes (now use VSYNC like NTSC games in 60hz modes).
* improved gun cursor positioning accuracy.
* improved horizontal scaling & screenshots rendering in H32 mode.
* fixed a bug with ROM file extension handling that would affect cheats, snapshots, sram & savestate files.
* removed ARAM/injected ROM support (unused).
* removed WPAD_ and PAD_ update from VSYNC callback.
* increased GCC inlining limits for some speed improvment.
* compiled with devkitPPC r24 & libogc 1.8.7.
2011-08-07 19:49:46 +02:00
|
|
|
#define M68K_CHECK_PC_ADDRESS_ERROR OPT_OFF
|
2011-07-14 00:49:52 +02:00
|
|
|
|
|
|
|
|
|
|
|
/* ----------------------------- COMPATIBILITY ---------------------------- */
|
|
|
|
|
|
|
|
/* The following options set optimizations that violate the current ANSI
|
|
|
|
* standard, but will be compliant under the forthcoming C9X standard.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/* If ON, the enulation core will use 64-bit integers to speed up some
|
|
|
|
* operations.
|
|
|
|
*/
|
|
|
|
#define M68K_USE_64_BIT OPT_OFF
|
|
|
|
|
|
|
|
|
|
|
|
/* ======================================================================== */
|
|
|
|
/* ============================== END OF FILE ============================= */
|
|
|
|
/* ======================================================================== */
|
|
|
|
|
|
|
|
#endif /* M68KCONF__HEADER */
|