[pypy-svn] r55004 - pypy/dist/pypy/translator/goal
cami at codespeak.net
cami at codespeak.net
Tue May 20 16:13:09 CEST 2008
Author: cami
Date: Tue May 20 16:13:07 2008
New Revision: 55004
Added:
pypy/dist/pypy/translator/goal/targetgbimplementation.py
Modified:
pypy/dist/pypy/translator/goal/targetgbrom4.py
pypy/dist/pypy/translator/goal/targetsimplevideo.py
Log:
removed start imports
added targetgbimplementation for "real" usage with roms
targetsimplevideo: escaped some non working stuff, fixing now
Added: pypy/dist/pypy/translator/goal/targetgbimplementation.py
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/translator/goal/targetgbimplementation.py Tue May 20 16:13:07 2008
@@ -0,0 +1,41 @@
+import os
+import py
+from pypy.lang.gameboy.gameboyImplementation import GameBoyImplementation
+
+
+ROM_PATH = str(py.magic.autopath().dirpath().dirpath().dirpath())+"/lang/gameboy/rom"
+EMULATION_CYCLES = 64
+
+
+# This loads the whole mini.image in advance. At run-time,
+# it executes the tinyBenchmark. In this way we get an RPython
+# "image" frozen into the executable, mmap'ed by the OS from
+# there and loaded lazily when needed :-)
+
+
+# XXX this only compiles if sys.recursionlimit is high enough!
+# On non-Linux platforms I don't know if there is enough stack to
+# compile...
+#sys.setrecursionlimit(100000)
+
+
+def entry_point(argv=None):
+ if len(argv) > 1:
+ filename = argv[1]
+ else:
+ filename = ROM_PATH+"/rom9/rom9.gb"
+ gameBoy = GameBoyImplementation()
+ #gameBoy.load_cartridge_file(ROM_PATH+"/rom4/rom4.gb")#filename)
+ gameBoy.emulate(EMULATION_CYCLES)
+# #gameBoy.load_cartridge_file(str(filename))
+
+ return 0
+
+
+# _____ Define and setup target ___
+
+def target(*args):
+ return entry_point, None
+
+def test_target():
+ entry_point(["boe", ROM_PATH+"/rom4/rom4.gb"])
Modified: pypy/dist/pypy/translator/goal/targetgbrom4.py
==============================================================================
--- pypy/dist/pypy/translator/goal/targetgbrom4.py (original)
+++ pypy/dist/pypy/translator/goal/targetgbrom4.py Tue May 20 16:13:07 2008
@@ -1,9 +1,7 @@
import os
import py
from pypy.lang.gameboy import constants
-from pypy.lang.gameboy.cpu import *
-from pypy.lang.gameboy.cartridge import *
-from pypy.lang.gameboy.gameboy import *
+from pypy.lang.gameboy.gameboy import GameBoy
ROM_PATH = str(py.magic.autopath().dirpath().dirpath().dirpath())+"/lang/gameboy/rom"
@@ -26,11 +24,13 @@
if len(argv) > 1:
filename = argv[1]
else:
- filename = ROM_PATH+"/rom4/rom4.gb"
+ filename = ROM_PATH+"/rom9/rom9.gb"
gameBoy = GameBoy()
#gameBoy.load_cartridge_file(ROM_PATH+"/rom4/rom4.gb")#filename)
gameBoy.load_cartridge_file(str(filename))
- return gameBoy.emulate(EMULATION_CYCLES)
+ gameBoy.emulate(EMULATION_CYCLES)
+
+ return 0
# _____ Define and setup target ___
Modified: pypy/dist/pypy/translator/goal/targetsimplevideo.py
==============================================================================
--- pypy/dist/pypy/translator/goal/targetsimplevideo.py (original)
+++ pypy/dist/pypy/translator/goal/targetsimplevideo.py Tue May 20 16:13:07 2008
@@ -2,8 +2,8 @@
from pypy.rpython.lltypesystem import rffi, lltype
import py
-WIDTH = 200
-HEIGHT = 200
+WIDTH = 20
+HEIGHT = 20
def entry_point(argv=None):
RSDL.Init(RSDL.INIT_VIDEO) >= 0
@@ -81,6 +81,7 @@
pattern[paintpattern % pl](screen, black, white)
RSDL.UnlockSurface(screen)
RSDL.Flip(screen)
+ RSDL.Delay(1000)
# -----------------------------------------------------------------------------
@@ -88,6 +89,8 @@
def target(*args):
return entry_point, None
+def test_target():
+ entry_point()
if __name__ == '__main__':
entry_point()
More information about the Pypy-commit
mailing list