0

Possible Duplicate:
How do emulators work and how are they written?

I know enough about the gameboy/advance hardware to make an emulator (I think). But I can't find any resources , sample code, tutorials , documentation , anything on the internet? Do I program an emulator like a game? i.e it runs in a game loop

 while (isopen)
 {  
       draw();
       update();
       display();
 }

or like a gui? i.e an event handler?

 switch(msg)
 {
      case DRAW_IMAGE: 
          draw();
          break;
      case KEYDOWN:
          update();
          break;
 }

Do I use a third party graphics library or the windows GDI? There are so many questions but none are answered on any site i got when i googled.

NOTE: I am using C / C++ . (if you know any documentation on making one in C# you can give me that too.)

Community
  • 1
  • 1
ApprenticeHacker
  • 20,229
  • 26
  • 99
  • 152
  • Have a look at MAME. Maybe you can even make your Gameboy emulator part of MAME instead of a separate project. – Flimzy Jul 08 '11 at 03:38
  • To be honest, if you are asking this type of question, I think you are not ready to code an emulator yet. – Vinicius Kamakura Jul 08 '11 at 03:38
  • You lucky dog... You get to read [Cody's answer](http://stackoverflow.com/questions/448673/how-do-emulators-work-and-how-are-they-written/448689#448689) – Shog9 Jul 08 '11 at 03:38
  • @Shog9 That's not an answer, its an entire book. LOL – ApprenticeHacker Jul 08 '11 at 03:41
  • http://stackoverflow.com/questions/6619882/decoding-and-matching-chip-8-opcodes-in-c-c – old_timer Jul 08 '11 at 21:52
  • Somewhat like a game. You want to create a function/module that executes one instruction, and call that function in a loop. You are simulating more than just a processor so that same loop needs to manage graphics and other hardware. Mame is very hard to read even if you have already developed simulators. qemu is painful but much less painful. or look for thumbulator on github, or a long list of other simulators which you can google to find. – old_timer Jul 08 '11 at 21:56
  • there are a few gameboy and gameboy advance emulators out there, visual boy advance, etc. one written in pascal was open sourced. I imagine there are others that are open sourced. the graphics engine in those platforms is by far the biggest part of this project. – old_timer Jul 08 '11 at 21:59

0 Answers0