Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Franck Pommereau
/
bones
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Franck Pommereau
2015-03-19 07:47:46 +0100
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
013f0ab3fdc21c08f8ab0ae42fb491b5f4668d1c
013f0ab3
1 parent
9d58ad76
quickly changed to single process
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
37 additions
and
27 deletions
.hgignore → .gitignore
bones_edit.py → bones.py
bones/gui/control.py
bones/gui/editor.py
bones/machine.py
bones_machine.py
build.py
.
hg
ignore
→
.
git
ignore
View file @
013f0ab
syntax: glob
*.pyc
*.spec
*~
...
...
bones
_edit
.py
→
bones.py
View file @
013f0ab
File moved
bones/gui/control.py
View file @
013f0ab
...
...
@@ -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
([])
...
...
bones/gui/editor.py
View file @
013f0ab
...
...
@@ -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
...
...
bones/machine.py
View file @
013f0ab
...
...
@@ -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
()
...
...
bones_machine.py
View file @
013f0ab
...
...
@@ -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
)
...
...
build.py
View file @
013f0ab
...
...
@@ -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
()
...
...
Please
register
or
login
to post a comment