cpu (source and target) performance

Discuss emulation of the Nintendo Entertainment System and Famicom.

Moderator: Moderators

Post Reply
User avatar
Anes
Posts: 702
Joined: Tue Dec 21, 2004 8:35 pm
Location: Mendoza, Argentina

cpu (source and target) performance

Post by Anes »

I just want to know what is better for cpu emulation:

- Has a big "switch" with all opcodes inside it (method i used before); (if the compiler compiles to a jump table of course)
- Has a function per opcode, and call it with a pointer from a table, i mean an array of function pointers. Im implementing some type of "cache" too...
takes the same or regarding the NES the half of memory of cpu ((0x8000) * 4 bytes) size, and when an emulated opcode (function) has been executed is "recorded" in the array related to PC, so when this PC Value is read again jumps directly without the compiler to seek in the table it searched before. (method im actually using)
- Write the cpu core in asm to create global scope labels (wich i dont know if this can be done in VC++ c compiler), and implement that "cache". (i wrote one about one yaer ago but was just "c code translated to asm)". And emu the opcodes with the similar machine opcodes (of course this affects portability).(third method)

anyway, i have heard that a pointer to function table (second method, the one that im using) can compromise CPU target Cache mem, that why im thinking in changing the emu cpu core.
ANes
Post Reply