4 ms·
I don't have a specific suggestion for learning to make CPU emulators in particular. As thethirdone said in his comment, the official specification is the most
by charlesdaniels 6y ago
I don't have a specific suggestion for learning to make CPU emulators in particular.
As thethirdone said in his comment, the official specification is the most important resource.
The actual body of the simulator is mostly going to be a lot of lookup tables. You'll probably have a struct or class that stores the state of the CPU at a specific instant in time. Your main loop will be calling a next_state() function on that object. For your sanity, I would highly suggest making your state object immutable.
I have found breaking out the ALU, instruction decoder, and control logic into separate functions is a good way to split things apart.