Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

ghostboy

how do emulators and roms work?

This topic is 6483 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

How are roms created? like, how the hell would someone get a genesis game like sonic onto the computer? and how are emulators created, i mean like, what kind of programming would it involve..? i''m just lost at how roms are made or put onto the computer, then how emulators use em

Share this post


Link to post
Share on other sites
Advertisement
ROMs are loaded into the computer using a homemade serial port reader that costs about $5 to make.

Emulators are almost like scripting engines, that convert the console''s GFX & CPU instructions into PC ones.



"NPCs will be inherited from the basic Entity class. They will be fully independent, and carry out their own lives oblivious to the world around them ... that is, until you set them on fire ..." -- Merrick

"It is far easier for a camel to pass through the eye of a needle if it first passes through a blender" -- Damocles

Share this post


Link to post
Share on other sites
You haven''t heard about the new genesis functions?
Yeah, try this one out... void RunSonic(int versionNumber)

Share this post


Link to post
Share on other sites
ROMs for emulators are essentially just a copy of every single byte of data that is on a cartridge into a PC file. A ROM contains data pretty much the same way as any EXE file on your PC. It is a compiled program (and data) for whatever machine the cartridge is for.

Every console has it''s own set of operations that it can perform. For example, a Nintendo probably has machine/assembly language commands for adding, subtracting, loading and storing data, etc.

At a low level, a Nintendo operates in much the same way as your desktop, but uses a slightly different ''language''. By language, I don''t mean C or C++ or Java. I mean that the commands are formatted differently in memory. For example, maybe on a Pentium, the opcode to perform an addition is 1234. Well, on a Nintendo, it might just be 3. If you tried running the Nintendo''s opcode directly on your Pentium, you''d get wildly incorrect results.

What an emulator does, is take each opcode in the ROM file and translate it into an equivalent command on your PC. Many things have a straight across translation. For instance, adding and subtracting are common operations and would be easy to emulate (just tell the Pentium to add or subtract).

However, some features get more complicated. Even a lowly 8-bit Nintendo has quite a few special hardware features that are not directly analogous to your PC. This is why many emulators are missing sound or support for certain games. A prime example of this is Mario Kart for the SNES. This cartridge is not easy to emulate, because it has an extra chip in the cartridge itself that was specific to that game. This would be similar to installing a new PCI board in your computer to play one specific game. Each new processor in the console or on the cartridge likely has it''s own native machine language and therefore requires a lot of extra work to emulate.

Most consoles have several processors with different tasks. If the processor does something specialized, like playing sound or displaying a special graphics mode, it might be necessary to do quite a bit of work to emulate that same functionality.

Emulation isn''t really a complicated idea, but it can be quite a bit of work. If you were going to write your own, you''d ideally want detailed specs of how the console works and what all the opcodes and hardware features are.

Hope that helps you out and isn''t too long to read!

Share this post


Link to post
Share on other sites
Haveing tried to wriert some emulators which kinda worked, all I can say is that documentation is fairly sparse about any console. Another big problem not mentioned by jaxon is that a method has to be found to map the memory of the console onto the memory of the PC and then to translate the addresses of the memory.

There tends to be 2 forms of emulation: Interpretive and Recompiling (both static and dynamic). Essentially interpretive emulation means that you read each opcode, then run a short proceedure to inteprete the opcode and perform the required functions. A static recompiler takes the whole ROM at once and re-compiles it to native code for the platform you want to run it on. A dynamic recompiler recompiles the code as it is required, that is whenever the ROM jumps anywhere, the emulator checks to see if that part of the code is translated yet (or if the ROM code has changed) and if it hasn''t it recompiles the ROM code usually up to the next jump instruction and then the PC code is run...and this continues ad infimitum (or until you stop the emulator)

Share this post


Link to post
Share on other sites
How about this question. Are there any open source emulators for a system? Maybe if I saw some code I could understand emulation a little better.

I am Nobody, who are you? Are you Nobody too?

Share this post


Link to post
Share on other sites
off-topic, but for an article suggestion maybe emulation wouldn''t be an awful idea. Any takers?

I am Nobody, who are you? Are you Nobody too?

Share this post


Link to post
Share on other sites
Anybody have information about dynamic recompilation?

I don''t want to make an emulator (at least now), but I''m very curious about that.

Thanks in advance.

Share this post


Link to post
Share on other sites
Hmm, interesting topic, do any of you know how to actually create a serial port reader like morfe said? Where I can buy the things needed for one, how to assemble one, etc? I''m more interested in the hardware part then the software.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!