Franck Pommereau

quickly changed to single process

syntax: glob
*.pyc
*.spec
*~
......
......@@ -89,12 +89,15 @@ class BonesWindow (gtk.Window) :
def show_all (self) :
gtk.Window.show_all(self)
self.cpu.control.clock.hide()
def run (self) :
def run (self, main) :
self.show_all()
self.cursor = CursorChanger(self)
gtk.mainloop()
self.main = main
#gtk.mainloop()
def _quit (self, *args) :
gtk.main_quit()
#gtk.main_quit()
self.main.quit()
self.hide()
if __name__ == "__main__" :
win = BonesWindow([])
......
......@@ -580,10 +580,15 @@ class CodeEditor (gtk.VBox) :
asm.save(_new_file("Save BIOS as..."))
self._set_status("BIOS saved", 1)
elif resp == gtk.RESPONSE_APPLY :
fd, name = tempfile.mkstemp()
with os.fdopen(fd, "w") as tmp :
tmp.write(asm.dump())
bones.cmd.launch("bones_machine.py", "--tmpfile", name)
import bones_machine
bones = bones_machine.Bones(asm.dump().splitlines())
bones.view.queue.debug = True
print "=" * 29, "starting", "=" * 29
bones.start()
# fd, name = tempfile.mkstemp()
# with os.fdopen(fd, "w") as tmp :
# tmp.write(asm.dump())
# bones.cmd.launch("bones_machine.py", "--tmpfile", name)
self._clear_status()
else :
raise Cancelled
......
......@@ -12,9 +12,10 @@ class Machine (threading.Thread) :
self.bus = bones.bus.Bus(view.bus, self.rom, self.ram, self.screen)
self.cpu = bones.cpu.Cpu(self.bus, view.cpu)
def run (self) :
self.run = True
try :
self.cpu.boot()
while True :
while self.run :
self.cpu.cycle()
except bones.cpu.CpuHalted :
type, value, traceback = sys.exc_info()
......@@ -22,3 +23,6 @@ class Machine (threading.Thread) :
except :
self.view.halt()
raise
def quit (self) :
self.run = False
self.view.halt()
......
......@@ -2,18 +2,18 @@
import sys, os, time
if len(sys.argv) == 1 :
rom = [line.strip() for line in sys.stdin]
elif sys.argv[1] == "--fork" :
if os.fork() != 0 :
os._exit(0)
rom = [line.strip() for line in sys.stdin]
elif sys.argv[1] == "--tmpfile" :
rom = [line.strip() for line in open(sys.argv[2])]
os.remove(sys.argv[2])
else :
sys.stderr.write("bones: invalid command line\n")
sys.exit(1)
# if len(sys.argv) == 1 :
# rom = [line.strip() for line in sys.stdin]
# elif sys.argv[1] == "--fork" :
# if os.fork() != 0 :
# os._exit(0)
# rom = [line.strip() for line in sys.stdin]
# elif sys.argv[1] == "--tmpfile" :
# rom = [line.strip() for line in open(sys.argv[2])]
# os.remove(sys.argv[2])
# else :
# sys.stderr.write("bones: invalid command line\n")
# sys.exit(1)
import warnings
import gtk, gobject
......@@ -107,7 +107,9 @@ class Bones :
self.machine.start()
self.gui.show_all()
self.update()
self.gui.run()
self.gui.run(self)
def quit (self) :
self.machine.quit()
if __name__ == "__main__" :
warnings.filterwarnings("ignore", category=DeprecationWarning)
......
......@@ -13,8 +13,6 @@ icon = {"Windows" : ["--icon", "bones.ico"],
args = ["pyinstaller", "--clean", "-F", "-w"] + icon.get(platform.system(), [])
clean(True)
targets = ["bones_edit.py", "bones_machine.py"]
while targets :
subprocess.call(args + targets)
targets.pop(0)
targets = ["bones.py", "bones_machine.py"]
subprocess.call(args + targets)
clean()
......