Each components are in their own class.
I have a class Genesis wich contains a class for 68k, a class for Z80, VDP, PSG ...
The class Genesis doesn't car how each component work.
Each component are implemented an class interface called "Component".
The only thing a component call do is executing events.
Each components are communicating with his controller, and can ask to him to add event.
So for the VDP we have the class VDP and the Class VDPController.
The Genesis implements all the controller VDPController, PSGController, 68KController ....
At start of each frame, The VDP ask his controller (Class Genesis) to add an event in 3416 cycles (Vdp Clock) called VDP_EVENT_HBLANK. The class Genesis convert the number of cycle into system cycle (also 3416 because clock not divided) and add to his queue.
When processor have executed 3416 system cycles, the class Genesis take the event and send it to the owner component (VDP in that case).
My main loop is unique
![Smile :-)](./images/smilies/icon_smile.gif)
So the only thing the Genesis do is take event, send to the component at the good moment and executing processors.
With this solution the code is very clear and we can have very good timings (instruction by instruction).
My emulator isn't as fast as other but code is easy to read and with a solid object model.
All the data are typped in a header and all memory access (READ_WORD, READ_BYTE ...) too.
All Genesis emulation is in a kernel wich is system independant.
All you have to do to use the kernel in a system is redefine some macros in the system.h header file and that's all you can use class Genesis in your software.
that's was for presentation of my work.
PS : Sorry for my bad english
![Smile :-)](./images/smilies/icon_smile.gif)