Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1
    EmuTalk Member
    Join Date
    Jan 2006
    Posts
    10

    Dynarec for first emu project?

    Okay, so a month or so ago I decided that emulation is fascinating, and thought I'd give it a shot. I was inspired by the comp. architecture class I'm currently taking, along with the fact that I've spent so many years taking advantage of the emulators that other people have written... figured it'd be cool to try it out.

    Naturally, since my epiphany I've done a good deal of reading. I looked around to see what would make a good first project for a console emulator, and stumbled across a thread on retrogames from which I gathered that the NES would be a good idea. The nesdev community has been really helpful in giving me a good idea of what needs to be done and how difficult it might be to implement everything. It's a little overwhelming at first, but I'm slowly getting a better grasp on the specifics.



    It seems that most classic console emulators out there are interpreters, which is reasonable. I was digging through the Nestra source earlier though and I think it'd be neat to write a dynamic recompiler-- it might be unecessary for an NES emulator, but I ultimately do want to pursue more ambitious projects, and maybe diving into the basics of dynarec would help me get through more complex emus in the future?

    The issue is that it'd be more difficult to write and debug. I'm definitely up for a challenge, but I don't want to try and tackle something that would just be way over my head. I haven't been able to find much info on dynarec, and I'm barely even aware of what implementing one might entail.

    So, yeah. Any input or opinions would be greatly appreciated.


    • Advertising

      advertising
      EmuTalk.net
      has no influence
      on the ads that
      are displayed
        
       

  2. #2
    PCSX2 Coder refraction's Avatar
    Join Date
    Apr 2004
    Location
    Sheffield, UK
    Posts
    459

  3. #3
    EmuTalk Member
    Join Date
    Jan 2006
    Posts
    10
    Ahh, thanks a lot. That helps quite a bit.

  4. #4
    Gekko Developer ShizZy's Avatar
    Join Date
    Feb 2005
    Location
    RI, USA
    Posts
    760
    Well, it's really hard to say. I guess it mostly depends on how much programming experience you've had overall. And considering that you're starting with NES, which isn't the *easiest* system IMHO. I started with chip8, then gbc - both interpreters. Now I'm doing GCN, still with an interpreter. Dynarecs can be really really messy, and a solid interpreter first helps with debugging.
    ~ShizZy

    6Bit.net Emulation & Gaming | Forums
    Gekko GameCube Emulator

  5. #5
    EmuTalk Member
    Join Date
    Sep 2005
    Posts
    15
    Zenogais's tutorial isn't really enough to make a dynarec. How are you supposed to handle timing, for example?
    Last edited by mono; February 13th, 2006 at 06:15.

  6. #6
    EmuTalk Member
    Join Date
    Jan 2006
    Posts
    10
    I mainly wanted something to give me a general idea of how a dynarec would be implemented. Even something simple with some kind of inter-architecture dictionary would be sufficient (which is more or less what's going on in the tutorial I guess).

    I have found other resources that touch a little on timing issues. This thread here is very informative, and some of the bigger issues in dynarec development are briefly addressed in Victor Moya del Barrio's enormous pdf book thing.

    None of this stuff is necessarily straightforward, but it's somewhere to start, at least.

    [edit:]

    Well, it's really hard to say. I guess it mostly depends on how much programming experience you've had overall. And considering that you're starting with NES, which isn't the *easiest* system IMHO. I started with chip8, then gbc - both interpreters. Now I'm doing GCN, still with an interpreter. Dynarecs can be really really messy, and a solid interpreter first helps with debugging.
    I wouldn't say I'm that experienced, really. My most ambitious personal project to date is a basic raytracer... otherwise, I don't have anything substantial under my belt.

    Would you say it's impossible to pick up, though? I mean, yeah, debugging a dynarec is probably a little more than frustrating, but the concept interests me a lot, and I feel like if I ever want to work on a large scale emulator for a recent console, it's something I'm going to have to learn eventually. Or am I wrong about that? It just seems that most of the more popular programs that emulate anything released after the Playstation go with dynarec.
    Last edited by phytoporg; February 13th, 2006 at 05:29.

  7. #7
    EmuTalk Member
    Join Date
    Sep 2005
    Posts
    15
    Yes, that is true. A dyanrec is necessary for speed on emulators for newer consoles. They still usually have an interpreter, as well, for debugging purposes, though.

    EDIT:

    I took a look at that link you gave. I found the answer to how you handle timing disappointing. It was just what I assumed (that you have to sacrifice some timing accuracy to achieve speed). I suppose that most games aren't too picky about timing, but you still have those that are.
    Last edited by mono; February 13th, 2006 at 07:00.

  8. #8
    EmuTalk Member hap's Avatar
    Join Date
    Jan 2005
    Posts
    188
    on the NES, many games are picky about timing

  9. #9
    EmuTalk Member
    Join Date
    Sep 2005
    Posts
    15
    Well, the only serious emulator I've written was a GB emulator. I didn't experience too many issues with timing. However, the game Altered Space is very sensitive to timing. It certainly wouldn't work on an emulator that only checks cycles after each block because it needs to call an interrupt right after a certain opcode in the middle of the block is executed or it will go into an infinite loop.

  10. #10
    Moderator
    Join Date
    Nov 2001
    Posts
    256
    Depends on how the timer has to be used (which is system based), you could do it as a seperate thread and just check it, you could do a check at a jump, you could check every opcode. The less you check the faster you get but the less accurate. For something that needs it more accurate you could check on certain op types or after X number of ops, etc.

    Dynamic recomp is not that hard, tho it can be challenging. You just have to be able to imagine what the code should look like in your target asm then create a set of rules to translate the input to look like what you want as the output

Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 27
    Last Post: December 28th, 2007, 22:19
  2. Replies: 1
    Last Post: June 16th, 2005, 06:52
  3. Replies: 10
    Last Post: January 14th, 2004, 19:48
  4. Fundamentals of emu programming
    By Kethinov in forum Programming
    Replies: 7
    Last Post: August 28th, 2003, 00:23
  5. project 64 emu
    By saurus75 in forum Project64
    Replies: 2
    Last Post: August 11th, 2002, 19:35

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •