Simulator main loop and reset.