[pypy-svn] r57494 - pypy/dist/pypy/lang/gameboy

cami at codespeak.net cami at codespeak.net
Wed Aug 20 11:32:26 CEST 2008


Author: cami
Date: Wed Aug 20 11:32:25 2008
New Revision: 57494

Modified:
   pypy/dist/pypy/lang/gameboy/cpu.py
Log:
fixed execution bug. fetch should not consume cycles in emulation


Modified: pypy/dist/pypy/lang/gameboy/cpu.py
==============================================================================
--- pypy/dist/pypy/lang/gameboy/cpu.py	(original)
+++ pypy/dist/pypy/lang/gameboy/cpu.py	Wed Aug 20 11:32:25 2008
@@ -347,11 +347,11 @@
         self.cycles += ticks
         self.handle_pending_interrupts()
         while self.cycles > 0:
-            self.execute(self.fetch())
+            self.execute(self.fetch(use_cycles=False))
             
     def emulate_step(self):
         self.handle_pending_interrupts()
-        self.execute(self.fetch())
+        self.execute(self.fetch(use_cycles=False))
         
 
     def handle_pending_interrupts(self):
@@ -407,7 +407,8 @@
 
     def fetch(self, use_cycles=True):
         # Fetching  1 cycle
-        self.cycles += 1
+        if use_cycles:
+            self.cycles += 1
         if self.pc.get(use_cycles) <= 0x3FFF:
             data =  self.rom[self.pc.get(use_cycles)]
         else:



More information about the Pypy-commit mailing list