[pypy-svn] r54596 - in pypy/branch/gameboy-emulator/pypy: lang/gameboy translator/goal

tverwaes at codespeak.net tverwaes at codespeak.net
Fri May 9 16:22:43 CEST 2008


Author: tverwaes
Date: Fri May  9 16:22:43 2008
New Revision: 54596

Modified:
   pypy/branch/gameboy-emulator/pypy/lang/gameboy/cartridge.py
   pypy/branch/gameboy-emulator/pypy/lang/gameboy/cpu.py
   pypy/branch/gameboy-emulator/pypy/translator/goal/targetgbrom4.py
Log:
fixing some small bugs + make targetgbrom4 py.testable


Modified: pypy/branch/gameboy-emulator/pypy/lang/gameboy/cartridge.py
==============================================================================
--- pypy/branch/gameboy-emulator/pypy/lang/gameboy/cartridge.py	(original)
+++ pypy/branch/gameboy-emulator/pypy/lang/gameboy/cartridge.py	Fri May  9 16:22:43 2008
@@ -157,7 +157,7 @@
         
     def load(self, cartridgeFilePath):
         self.cartridgeFilePath = str(cartridgeFilePath)
-        self.cartridgeName = os.path.basename(self.cartridgeFilePath)
+        # self.cartridgeName = os.path.basename(self.cartridgeFilePath)
         self.cartridgeFile = open(self.cartridgeFilePath)
         self._load_battery(self.cartridgeFilePath)
         

Modified: pypy/branch/gameboy-emulator/pypy/lang/gameboy/cpu.py
==============================================================================
--- pypy/branch/gameboy-emulator/pypy/lang/gameboy/cpu.py	(original)
+++ pypy/branch/gameboy-emulator/pypy/lang/gameboy/cpu.py	Fri May  9 16:22:43 2008
@@ -35,6 +35,8 @@
     
     def __init__(self, cpu, hi, lo, reset_value=0):
         assert isinstance(cpu, CPU)
+        assert isinstance(lo, Register)
+        assert isinstance(hi, Register)
         self.cpu = cpu
         self.hi = hi
         self.lo = lo
@@ -104,7 +106,7 @@
     
 # ------------------------------------------------------------------------------
   
-class FlagRegister(object):
+class FlagRegister(Register):
     
     def __init__(self, cpu):
         assert isinstance(cpu, CPU)

Modified: pypy/branch/gameboy-emulator/pypy/translator/goal/targetgbrom4.py
==============================================================================
--- pypy/branch/gameboy-emulator/pypy/translator/goal/targetgbrom4.py	(original)
+++ pypy/branch/gameboy-emulator/pypy/translator/goal/targetgbrom4.py	Fri May  9 16:22:43 2008
@@ -6,7 +6,7 @@
 from pypy.lang.gameboy.gameboy import *
 
 
-ROM_PATH = str(py.magic.autopath().dirpath().dirpath().dirpath())+"lang/gameboy/rom"
+ROM_PATH = str(py.magic.autopath().dirpath().dirpath().dirpath())+"/lang/gameboy/rom"
 EMULATION_CYCLES = 64
 
 
@@ -23,12 +23,19 @@
 
 
 def entry_point(argv):
+    #if len(argv) > 1:
+    #    filename = argv[1]
+    #else:
+    #    print "usage:", argv[0], "<image name>"
+    #    return -1
     gameBoy = GameBoy()
-    gameBoy.loadCartridgeFile(ROM_PATH+"/rom4/rom4.gb")
+    gameBoy.load_cartridge_file(ROM_PATH+"/rom4/rom4.gb")#filename)
     gameBoy.emulate(EMULATION_CYCLES)
 
-
 # _____ Define and setup target ___
 
 def target(*args):
     return entry_point, None
+
+def test_target():
+    entry_point(["boe", ROM_PATH+"/rom4/rom4.gb"])



More information about the Pypy-commit mailing list