Is there a way for a program to know if it's executed under the simulator and not on an actual CPU?
Chad,
Yes, this is a good idea too. Its big advantage is that it's CPU-independent (I think you could use it with the 8051 as well), but the disadvantage is that it depends on a script that you have to create for every program that uses it.
Cheers, Sandy