Mitch is completely correct. Start by understanding the processor. Then play around a bit by writing code to implement particular instructions. Use C++ for this, BTW, not C, or the concepts of the processor will not map to classes in your code.
In the process of implementing instructions, you'll find you need to define things like the flags, and the instruction pointer. That should eventually get you to where you need to implement the memory model, and even the I/O model.
You'll eventually have to figure out how to load code and data into memory, and maybe how to dump it back out to disk.
Only then do you need to get to the point of emulating the execution of code, loaded into memory, at a given instruction pointer.