

Your code parses this instruction and uses this information to alter processor state as specified by your processor. With interpretation, you start at the IP (instruction pointer - also called PC, program counter) and read the instruction from memory. For the 6502, you'd have a number of 8-bit integers representing registers: A, X, Y, P, and S you'd also have a 16-bit PC register. Processor state is a conglomeration of the processor registers, interrupt handlers, etc for a given processor target. With all of these paths, you have the same overall goal: execute a piece of code to modify processor state and interact with 'hardware'. There are three ways of handling processor emulation: You build each individual piece of the system and then connect the pieces much like wires do in hardware. Basic idea:Įmulation works by handling the behavior of the processor and the individual components. If I'm a bit too vague on certain things, please ask questions so I can continue to improve this answer. Many of the things I'm going to describe will require knowledge of the inner workings of processors - assembly knowledge is necessary. I'm going to break it into pieces and then fill in the details via edits. Here are the basic ideas and functional components.
