Пример #1
0
Файл: emu.py Проект: fgc/pydcpu
def main():
    try:
        plugins = []
        core = DCPUCore()
        plugins = load_plugins(plugins, core)
        running = True

        while True:
            running = core.run()
            while core.is_alive():
                pass
            for p in plugins:
                p.cpu_ticked()
    except (KeyboardInterrupt, SystemExit):
        print("Shutting down")
    
    shutdown_plugins(plugins)
    
    exit()
Пример #2
0
def main():
    print("DCPUEmu")
    try:
        core = DCPUCore()
        plugins = emuplugins.load_plugins(core)
        print("...Running...\nCtrl+C to shutdown")
        while True:
            dt = core.run()
            status = "Running at %.2fMhz" % (1.0 / dt)
            sys.stdout.write("\r%s\r%s" % (" " * (len(status) + 3), status))
            sys.stdout.flush()
            while core.is_alive():
                pass
            for p in plugins:
                p.cpu_ticked()
    except (KeyboardInterrupt, SystemExit):
        print("\nShutting down")

    emuplugins.shutdown_plugins(plugins)

    exit()