Cycle accurate emulation: Exodus 2.0 + Open Source Release

Discussion in 'Sega Discussion' started by Nemesis, Apr 27, 2015.

  1. Nemesis

    Nemesis Robust Member

    Joined:
    Mar 22, 2007
    Messages:
    248
    Likes Received:
    79
    You may or may not have heard about Exodus. Exodus is a generic and extensible emulation platform I have been developing for almost 9 years now, which aims to support cycle-level accuracy in emulation, combined with powerful debugging and development tools. Unlike other emulators which are statically compiled to support a particular set of systems, Exodus is open an extensible, with every emulation core supplied through plugins. The platform itself constructs systems from an XML definition of the connections between individual components in the system. This design allows the emulator itself to focus on managing the timing and interaction between the components, and allows the emulation cores to be totally modular and reusable in other systems that share the same components. A lot more information about this is available on the website.

    On the 30th of April 2013 I released Exodus 1.0, with support for the Sega Mega Drive. The plugin SDK wasn't ready for use at that stage though, so I held off on the open source release until I could get it up to scratch. Since then I've had delays and setbacks in getting the next release out the door, but the long process is now complete. I'm pleased to announce that Exodus 2.0 will be released both as binaries, and an open source repository, on the 30th of April 2015. Developer documentation will also be published detailing the API. The code will be licensed under MS-RL, and the repository will be hosted on Bitbucket. Refer to the website for more information on how to build Exodus from the source, and how to contribute ideas or code changes to the project.

    In terms of Mega Drive emulation, the main differences in Exodus 2.0 are as follows:
    -Major speed improvements (average 90% on dual-core systems, 30%-40% on quad-core systems)
    -Around 40% reduction in memory usage
    -Completely redesigned user interface, with a very powerful docking system for window management.
    -Gamepad/joystick support
    -Lots of bugs fixed and new debugging features

    [​IMG]
    The release will be made available on the official website at http://www.exodusemulator.com, so head over there for download links and more information about this project. I hope this emulator of use to some people out there, and I hope other people will be interested in contributing to this project, and helping me to expand it into other platforms.

    Edit:
    Exodus 2.0.0 has now been released! You can download the new version on the release page at http://www.exodusemulator.com/index.php/downloads/current-release
     
    Last edited: Apr 30, 2015
    wombat likes this.
  2. Braintrash

    Braintrash Peppy Member

    Joined:
    Nov 5, 2011
    Messages:
    303
    Likes Received:
    24
    I just wet my pants and I am grateful to you for that.

    Thank you, sir.
     
  3. billcosbymon

    billcosbymon Guru Meditation Error

    Joined:
    Dec 31, 2009
    Messages:
    660
    Likes Received:
    48
    Thank you for your work!
     
  4. -=FamilyGuy=-

    -=FamilyGuy=- Site Supporter 2049

    Joined:
    Mar 3, 2007
    Messages:
    3,032
    Likes Received:
    891
  5. NovaFox

    NovaFox Rapidly Rising Member

    Joined:
    Dec 2, 2014
    Messages:
    84
    Likes Received:
    1
    Hah, I concur with calling it a "simulator!", it does it all!
    Fantastic work, Nemesis, this should prove very handy
     
  6. smf

    smf mamedev

    Joined:
    Apr 14, 2005
    Messages:
    1,255
    Likes Received:
    88
    A simulator provides an experience without working the same way as the original. An emulator provides an experience by working the same way as the original.

    For example the speak and spell simulator http://www.speaknspell.co.uk/ is just a recreation of the original in a modern language, but recently the chip inside the speak and spell has been decapped http://www.seanriddle.com/speakandspell.html so now it can be emulated.

    In emulator circles the term simulator is derogatory, I don't know why anyone would choose it.

    In theory everyone simulate the chips to produce an emulator, because for example nobody is currently running the 68000 microcode through a netlist of gates (*). However due to the negative bias of the word simulator, it tends to not be used.

    Time travel is something that isn't used very often in emulators, it's currently unclear how scalable it is to "everything". A genesis is quite a simple piece of hardware, when you have multi double/triple digit MHz chips that communicate through large shared ram areas then rolling back becomes a much more expensive proposition. Anything older can probably by emulated full speed by brute force synchronising each chip cycle by cycle.

    (*) I haven't seen the source to exodus so can't comment on what cpu core it's using, but it hasn't been announced as a feature so I'm assuming it doesn't. There is a project to convert from the 68000 microcode to C++, but that doesn't appear to have reached a point where it's able to run anything yet. In theory it should sort out all the edge cases of exactly what happens in each cycle. Which is something that cpu cores written by humans have gotten wrong even when they claim to be cycle accurate.
     
    Last edited: Apr 30, 2015
  7. Nemesis

    Nemesis Robust Member

    Joined:
    Mar 22, 2007
    Messages:
    248
    Likes Received:
    79
    Exodus 2.0.0 has now been released! You can download the new version on the release page at http://www.exodusemulator.com/index.php/downloads/current-release
    I'm dedicating this release to my beautiful wife Judi, and my two boisterous little boys Justin and Aiden.

    As promised, Exodus is now also open source. Check out the website at http://www.exodusemulator.com for instructions on how to obtain and compile the source, and information on how you can contribute code changes to the project.

    Note that you won't see a massive improvement in Mega Drive game compatibility with this version, as the focus has been on other areas, like performance, user interface, and the plugin API. There are still a number of games I know of that will greet you with a black screen for example when you try and load. This is due to the fact that although Exodus aims for cycle-level accuracy, it's not actually there yet, and there's a number of games that use a kind of wait loop against flags on the VDP that technically requires at the very least sub-opcode level timing emulation to pass. No other emulators have sub-opcode level timing emulation for their CPU cores, but they use incorrect timing on the VDP as well in order to make the tests pass.

    The biggest thing that needs to be done for Exodus at this stage in order to improve Mega Drive compatibility is write Z80 and M68000 cores that emulate individual bus cycles, rather than emulating at an "opcode" level. For the M68000 at least, nobody seems to have ever done this, and a lot of information needs to be gathered on the hardware in order to determine the correct timing and order for each bus access within instructions. Emulating it properly will also require a major change to the bus system, which I currently have in the works. I was originally planning to have this bus change in Exodus 2.0, but I didn't want to delay the release any further. The bus system redesign, along with cycle-exact M68000 and Z80 cores, will now be my primary focus of development for the next major release. After this is complete, Exodus will have CPU emulation which is truly cycle-exact.

    Despite the lack of perfection with the CPU cores at this stage though, Exodus is already much more accurate than other emulators at Mega Drive support for graphics and sound. Exodus has the most advanced YM2612 core ever written, as it was written entirely from scratch during my detailed reverse engineering of the YM2612 back in 2008.

    In terms of the VDP, Exodus is the only Mega Drive emulator that has a cycle-exact VDP core, which allows it to emulate many quirks and tricks of the real hardware that other emulators can't, like Direct Color DMA. Aside from rendering accuracy, the VDP core is also fundamentally more accurate in handling basic communication from the CPU. Try this test ROM for example, which tests VDP port access:
    [​IMG]
    http://nemesis.exodusemulator.com/MegaDrive/Tests/VDPFIFOTesting/VDPFIFOTesting.zip
    (Detailed discussion: http://gendev.spritesmind.net/forum/viewtopic.php?p=20975#20975)

    This test ROM isn't perfect, a couple of the tests fail intermittently on the real hardware, but it's pretty stable, and it's very thorough and brutal. Even Exodus doesn't get a perfect score here yet, it gets 121 out of 122. Most other Mega Drive emulators will only score around 20 or so. I'm hoping with Exodus now open source, other Mega Drive emulators which are still being maintained can use Exodus as a reference, and improve their accuracy on these kind of tests too.


    Anyway, I hope some other people can make use of this. It's been a very long road to get to this point. Exodus was around 200,000 lines of code at the last count, and most areas of the code have gone through numerous revisions to get to where they are now. I daren't even estimate the number of hours that have gone into this project. I hope you find it interesting and useful.

    EDIT: I forgot to say, if you want to check out the debugging features, you'll be best off using one of the pre-made workspaces. Select "File -> Load Workspace" from the main menu and select "Mega Drive Debugger.xml". That'll give you a pretty good debug environment ready to go.
     
    Last edited: Apr 30, 2015
  8. l_oliveira

    l_oliveira Officer at Arms

    Joined:
    Nov 24, 2007
    Messages:
    3,879
    Likes Received:
    245
    No 32bit version ? D:
     
  9. Nemesis

    Nemesis Robust Member

    Joined:
    Mar 22, 2007
    Messages:
    248
    Likes Received:
    79
    I'm pretty happy with the release of Exodus 2.0 overall, but as expected with only me testing the build prior to release, there were a few bugs in some areas I hadn't tested for awhile. There have been enough issues fixed to justify a patch release, so Exodus 2.0.1 is now available for download! Considering it was 2 years between the first two releases, I think 18 hours between these last two is a bit of an improvement. :)

    Get it now from the current releases page at http://www.exodusemulator.com/index.php/downloads/current-release

    Enhancements:
    EX-291 - Improved default workspace loading to restore the main window size and maximized state before the main window appears, removed the maximized state as the default state, and changed the "Mega Drive Clean" workspace to not be maximized.

    Bug fixes:
    EX-289 - Fixed an error in the Mega Drive ROM loader which prevented games that used SRAM from loading
    EX-290 - Fixed a bug in the way embedded ROM file selection was saved which prevented saved systems with an embedded ROM specified from loading
    EX-292 - Fixed a race condition in the ViewManager which intermittently caused two "Image" windows to appear on startup
    EX-293 - Fixed several issues with device key mapping which prevented new key assignments being made
     
    Last edited: Apr 30, 2015
  10. Nemesis

    Nemesis Robust Member

    Joined:
    Mar 22, 2007
    Messages:
    248
    Likes Received:
    79
    I can spit out an unofficial 32-bit build if there's enough demand, or anyone can pull down the source and do a 32-bit build themselves. The thing is though, if you've got a 32-bit processor, the chances of that processor having enough power to run this emulator at a usable speed.... well lets just say they're not very good. :)
     
  11. Headcrab

    Headcrab (BigEvilCorporation)

    Joined:
    Dec 21, 2011
    Messages:
    246
    Likes Received:
    67
    Fantastic work, I've had your website open in a tab awaiting this release for quite some time, missed it due to a new PC!

    Do you take feature requests? Would support for disassembly with source via ASM68K .COF files be feasible?
     
  12. -=FamilyGuy=-

    -=FamilyGuy=- Site Supporter 2049

    Joined:
    Mar 3, 2007
    Messages:
    3,032
    Likes Received:
    891
    Sorry but this is wrong. First, there's no clear definition of what's a simulation; it's actually a hot debate among physicist (especially quantum physics theoreticians that want to distinguish a quantum simulation from a quantum calculation).

    Second, an emulator doesn't work the same way as the original, it reproduces - mimics - the end user experience. What Exodus is aiming for is to reproduce what's happening in the hardware at any time; thus my calling it a simulation.

    Congrats on your fast update this time Nemesis!
     
  13. l_oliveira

    l_oliveira Officer at Arms

    Joined:
    Nov 24, 2007
    Messages:
    3,879
    Likes Received:
    245
    It's a 4Ghz quadcore AMD. I am using a 32bit OS for work reasons (external hardware which doesn't work with 64bit OSes) with 4Gb RAM. (about 3.5GB are usable)

    I could give a try if you make 32bit builds available. m(_ _)m

    And it's good to be back.
     
  14. doulomb

    doulomb Robust Member

    Joined:
    Apr 25, 2013
    Messages:
    237
    Likes Received:
    57
    Holy carp! This is amazing work :D

    The Genesis has never been a huge interest of mine but I'll certainly still give Exodus a good trial. Thanks!

    -doulomb
     
  15. wombat

    wombat SEGA!

    Joined:
    Mar 14, 2004
    Messages:
    2,671
    Likes Received:
    319
    Great job on developing this stellar emulator, kudos!
     
sonicdude10
Draft saved Draft deleted
Insert every image as a...
  1.  0%

Share This Page