Here are the kinds of mistakes you make when you emulate a CPU:
Forgot to update a flag
Wrong register used (doh!)
Wrong width (did a byte op but it's a word - often copy paste error)
Borked logic (oops I thought rotate did X but it does Y)
Behaviour of the op is unclear (What is pushed on the stack on a Line1010/1111 exception? Does the program counter point to the current instruction or the next? I had to wing it looking at how the code behaves on the other side)