One thing that I've seen that can cause strange behavior is if you have an off-by-one error and are writing to the keyboard address. The CPU simulator sometimes feeds the data you wrote back to you as keyboard input!
If you want to, you can e-mail me your program and I'll take a look at it.
--Mark