Congratulations for this nice project. I wonder, how to write such an emulator? My initial idea would be to write an interpreter for the processor instruction set with a big array representing the RAM. Then some callback functions are registered via openGL. They are called when there are some inputs (eg. joystick). When this happens, they put something in the simulated memory (some mapped area for I/O or specific registers) and set up some interrupt flags. Does it make sense? then how to simulate accurately the processor (and coprocessors ?) frequency? any other difficulties I haven't seen?