Results 1 to 13 of 13

Thread: Emulator?

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2008
    Posts
    1,754

    Emulator?

    How do you write an emulator?

    I have read some tutorials online and articles online about it but I am still confused on how to actually write one. The tutorials/articles talk about how an emulator works but how do you actually go about writing one? For example if someone wrote a Mac emulator then how does your program know how to handle a dmg file? Read byte after byte but what exactly do you do with these bytes?

    I was thinking of writing one for fun in Java but if any other language is required then that is fine (i.e. Assembly).

  2. #2
    Addicted Member
    Join Date
    Mar 2010
    Posts
    231

    Re: Emulator?

    First of all you have to be very familiar with the files you are going to open and under what system they are going to be open.

    I will give you a example:
    The system wii is having ios where you have to find how they open the game,how they read it then integrate this in computer program and make the computer start the exact same ios who is running under wii.
    So you have to create some library for this its not easy step even for a very advanced guy in any language.
    You need a team about 4-5 people , you have to optimize the code to make it light - run it under some poor computer preference.

    I hope I was very clear (smile)

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2008
    Posts
    1,754

    Re: Emulator?

    Quote Originally Posted by mitko29 View Post
    First of all you have to be very familiar with the files you are going to open and under what system they are going to be open.

    I will give you a example:
    The system wii is having ios where you have to find how they open the game,how they read it then integrate this in computer program and make the computer start the exact same ios who is running under wii.
    So you have to create some library for this its not easy step even for a very advanced guy in any language.
    You need a team about 4-5 people , you have to optimize the code to make it light - run it under some poor computer preference.

    I hope I was very clear (smile)
    But what is the actual process to do this?

  4. #4
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: Emulator?

    This might give you some information.
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2008
    Posts
    1,754

    Re: Emulator?

    @Nightwalker from your link it says

    The emulator may translate machine language, calls to the operating system or both.
    This is something that has been repetitive across the articles and tutorials that I have read. However what none of the articles/tutorials have mentioned is how to actually translate the machine language. Also how do you know what to translate it too? The machine language, these are just bits sent to the CPU, right?

  6. #6
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: Emulator?

    This might explain it.
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  7. #7
    Frenzied Member TheBigB's Avatar
    Join Date
    Mar 2006
    Location
    *Stack Trace*
    Posts
    1,511

    Re: Emulator?

    Yes, machine code is what is processed by the processor.

    Emulation has mostly to do with differences in processing instruction sets and overlying operating systems.

    What would you like to emulate?
    Delete it. They just clutter threads anyway.

  8. #8

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2008
    Posts
    1,754

    Re: Emulator?

    Quote Originally Posted by Nightwalker83 View Post
    This might explain it.
    So I can write Machine Language and translate machine language specific to one computer to another. Now that is the basic concept of an emulator. The question now is how do I actually get the machine code to convert in the first place?

    If you think about my example with the mac DMG file on a windows, the DMG file contains a long list of bytes. How do I read these bytes so that I know what exactly they are trying to do? I need to parse the machine language from this DMG file.

    EDIT: @TheBigB Nothing in specific, I am more curious on how it works however emulating an Intel computer so that I can run a virtual operating system would be interesting. I was thinking along the lines of VirtualBox / VMware I know it would be a big project which is why I am more concerned with how it works versus actually completing this project.
    Last edited by noahssite; Feb 20th, 2011 at 06:28 PM.

  9. #9
    Frenzied Member TheBigB's Avatar
    Join Date
    Mar 2006
    Location
    *Stack Trace*
    Posts
    1,511

    Re: Emulator?

    http://www.youtube.com/view_play_lis...8648427BB68706
    This is a 92minute lecture on the basics of hardware and operating systems.
    If you have time to spare watch it.
    I think starting from part 7 might be something you'd want to know.
    Although I'm not sure how much is back-referenced to earlier parts.
    Delete it. They just clutter threads anyway.

  10. #10
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: Emulator?

    There might be something in the Assembly FAQ here on vbforums.
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  11. #11

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2008
    Posts
    1,754

    Re: Emulator?

    Thanks, now I have a lot of information to read/watch. I'll post back after I finish going through all this which might take a while since I am a bit busy at the moment.

  12. #12
    coder. Lord Orwell's Avatar
    Join Date
    Feb 2001
    Location
    Elberfeld, IN
    Posts
    7,628

    Re: Emulator?

    don't think mounting a dmg file is emulating anything. a dmg is a disk image. The OS is programmed to see it as a container and opens it the way windows opens a zip file. OSX doesn't use drive letters for anything.

    as for writing an emulator, you have to be intimately familiar with the machine code of the system you are emulating. The language you write it in is not important.
    Let's say i am writing a c-64 emulator. I am using this example because i know assembly on it.
    i load in the program i want to run into a virtual environment (really, a buffer) and step through each instruction one at a time and have a lookup table of equivalent instructions to run on the real hardware. It's not really that simple since every single chip needs to be emulated in some way, and there are actually two different ways to do all of this. Some emulate on the fly and some will actually break down the entire code and recompile it for the new os. The latter is much faster which is very important for newer hardware being emulated.

    A lot of the emulators available for game systems are operating on the gpl and have readily viewable source code including original code. I suggest you load up the oldest of one of these and try to see what they did.
    My light show youtube page (it's made the news) www.youtube.com/@lightsofelberfeld
    Contact me on the socials www.facebook.com/lordorwell

  13. #13

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2008
    Posts
    1,754

    Re: Emulator?

    Quote Originally Posted by Lord Orwell
    don't think mounting a dmg file is emulating anything
    Yes I am fully aware of that. I didn't say that a DMG file emulates anything. What I was saying was an example, the example being how my emulator could read a DMG file and act accordingly. It didn't need to be a DMG file, it could of been a TXT file or a EXE file. My question was how my program can know what to do as it reads the file bit by bit.

    I think I understand better how it works now. Thanks.

Posting Permissions

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



Click Here to Expand Forum to Full Width