void MainLoop()
{
Debug.WriteLine("Entering MainLoop");
thread_running = true;
while (!quit_thyself)
{
if (have_a_break)
TheDisplay.WaitUntilActive();
if (GlobalPrefs.ThePrefs.Emul1541Proc)
EmulateCyclesWith1541();
else
EmulateCyclesWithout1541();
state_change = false;
}
thread_running = false;
Debug.WriteLine("Exiting MainLoop");
}