[pypy-svn] r62257 - pypy/trunk/pypy/lang/gameboy

tverwaes at codespeak.net tverwaes at codespeak.net
Fri Feb 27 23:15:28 CET 2009


Author: tverwaes
Date: Fri Feb 27 23:15:26 2009
New Revision: 62257

Modified:
   pypy/trunk/pypy/lang/gameboy/video.py
   pypy/trunk/pypy/lang/gameboy/video_mode.py
Log:
bugfixes. call to get_oam has to take global memory position into account...
maybe should switch to internal versions?


Modified: pypy/trunk/pypy/lang/gameboy/video.py
==============================================================================
--- pypy/trunk/pypy/lang/gameboy/video.py	(original)
+++ pypy/trunk/pypy/lang/gameboy/video.py	Fri Feb 27 23:15:26 2009
@@ -567,15 +567,15 @@
         count = 0
         # search active objects
         for offset in range(0, 4*40, 4):
-            y = self.get_oam(offset + 0)
-            x = self.get_oam(offset + 1)
+            y = self.get_oam(constants.OAM_ADDR + offset + 0)
+            x = self.get_oam(constants.OAM_ADDR + offset + 1)
             if y <= 0 \
                or y >= (SPRITE_SIZE + GAMEBOY_SCREEN_HEIGHT + SPRITE_SIZE) \
                or x <= 0 \
                or x >= GAMEBOY_SCREEN_WIDTH + SPRITE_SIZE:
                 continue
-            tile  = self.get_oam(offset + 2)
-            flags = self.get_oam(offset + 3)
+            tile  = self.get_oam(constants.OAM_ADDR + offset + 2)
+            flags = self.get_oam(constants.OAM_ADDR + offset + 3)
             y     = self.line_y - y + 2 * SPRITE_SIZE
             if self.control.big_sprite_size_selected:
                 # 8x16 tile size
@@ -668,7 +668,7 @@
         for i in range(0, 7):
             color = pattern >> (6-i)
             if (color & 0x0202) != 0:
-                caller.call(x+1, color, mask)
+                caller.call(x + i + 1, color, mask)
         color = pattern << 1
         if (color & 0x0202) != 0:
             caller.call(x+7, color, mask)

Modified: pypy/trunk/pypy/lang/gameboy/video_mode.py
==============================================================================
--- pypy/trunk/pypy/lang/gameboy/video_mode.py	(original)
+++ pypy/trunk/pypy/lang/gameboy/video_mode.py	Fri Feb 27 23:15:26 2009
@@ -84,11 +84,11 @@
     def emulate_hblank_part_2(self):
         if self.video.display:
             self.video.draw_frame()
-        self.video.frames += 1
         if self.video.frames >= self.video.frame_skip:
             self.video.display = True
             self.video.frames = 0
         else:
+            self.video.frames += 1
             self.video.display = False
         self.video.status.set_mode(1)
         self.video.v_blank  = True



More information about the Pypy-commit mailing list