[pypy-svn] r62458 - in pypy/trunk/pypy/lang/gameboy: . debug
tverwaes at codespeak.net
tverwaes at codespeak.net
Tue Mar 3 13:23:38 CET 2009
Author: tverwaes
Date: Tue Mar 3 13:23:37 2009
New Revision: 62458
Modified:
pypy/trunk/pypy/lang/gameboy/cartridge.py
pypy/trunk/pypy/lang/gameboy/cpu.py
pypy/trunk/pypy/lang/gameboy/cpu_register.py
pypy/trunk/pypy/lang/gameboy/debug/debug_comparator.py
pypy/trunk/pypy/lang/gameboy/debug/gameboy_debug_entry_point.py
pypy/trunk/pypy/lang/gameboy/gameboy.py
pypy/trunk/pypy/lang/gameboy/gameboy_implementation.py
Log:
found a bug in the cartridge. we never reset the rom-size to 0!!
Modified: pypy/trunk/pypy/lang/gameboy/cartridge.py
==============================================================================
--- pypy/trunk/pypy/lang/gameboy/cartridge.py (original)
+++ pypy/trunk/pypy/lang/gameboy/cartridge.py Tue Mar 3 13:23:37 2009
@@ -297,7 +297,6 @@
self.rom_bank = self.rom_bank_size
self.ram_bank = 0
self.ram_enable = False
- self.rom_size = 0
self.ram_size = 0
def set_rom(self, buffer):
@@ -408,6 +407,8 @@
# % hex(address))
def write_rom_bank_1(self, address, data):
+ #import pdb
+ #pdb.set_trace()
if (data & 0x1F) == 0:
data = 1
if self.memory_model == 0:
@@ -825,7 +826,7 @@
MEMORY_BANK_TYPE_RANGES = [
- (constants.TYPE_MBC1, constants.TYPE_MBC1_RAM_BATTERY, MBC1),
+ (constants.TYPE_ROM_ONLY, constants.TYPE_MBC1_RAM_BATTERY, MBC1),
(constants.TYPE_MBC2, constants.TYPE_MBC2_BATTERY, MBC2),
(constants.TYPE_MBC3_RTC_BATTERY, constants.TYPE_MBC3_RAM_BATTERY, MBC3),
(constants.TYPE_MBC5, constants.TYPE_MBC5_RUMBLE_RAM_BATTERY, MBC5),
@@ -837,10 +838,10 @@
def initialize_mapping_table():
result = [DefaultMBC] * 256
for entry in MEMORY_BANK_TYPE_RANGES:
- if len(entry) == 2:
- positions = [entry[0]]
- else:
- positions = range(entry[0], entry[1]+1)
+ #if len(entry) == 2:
+ # positions = [entry[0]]
+ #else:
+ positions = range(entry[0], entry[1]+1)
for pos in positions:
result[pos] = entry[-1]
return result
Modified: pypy/trunk/pypy/lang/gameboy/cpu.py
==============================================================================
--- pypy/trunk/pypy/lang/gameboy/cpu.py (original)
+++ pypy/trunk/pypy/lang/gameboy/cpu.py Tue Mar 3 13:23:37 2009
@@ -237,7 +237,8 @@
# Fetching 1 cycle
if use_cycles:
self.cycles += 1
- if self.pc.get(use_cycles) <= 0x3FFF:
+ pc = self.pc.get(use_cycles)
+ if pc <= 0x3FFF:
data = self.rom[self.pc.get(use_cycles)]
else:
data = self.memory.read(self.pc.get(use_cycles))
@@ -288,7 +289,8 @@
def load(self, getCaller, setCaller):
# 1 cycle
- setCaller.set(getCaller.get()) # 1 cycle
+ value = getCaller.get()
+ setCaller.set(value) # 1 cycle
def load_fetch_register(self, register):
self.load(CPUFetchCaller(self), RegisterCallWrapper(register))
Modified: pypy/trunk/pypy/lang/gameboy/cpu_register.py
==============================================================================
--- pypy/trunk/pypy/lang/gameboy/cpu_register.py (original)
+++ pypy/trunk/pypy/lang/gameboy/cpu_register.py Tue Mar 3 13:23:37 2009
@@ -45,6 +45,7 @@
self.reset_value = reset_value
def set(self, value, use_cycles=True):
+ # previous = self.get(False)
value = value & 0xFFFF
self.set_hi(value >> 8, use_cycles)
self.set_lo(value & 0xFF, use_cycles)
@@ -209,4 +210,4 @@
#def is_carry_compare(self, a, b):
# self.is_carry = (a < b)
-
\ No newline at end of file
+
Modified: pypy/trunk/pypy/lang/gameboy/debug/debug_comparator.py
==============================================================================
--- pypy/trunk/pypy/lang/gameboy/debug/debug_comparator.py (original)
+++ pypy/trunk/pypy/lang/gameboy/debug/debug_comparator.py Tue Mar 3 13:23:37 2009
@@ -275,10 +275,10 @@
@printframe("comparing memory")
def compare_video_memory(self, data):
cmp = [
- ("vram", self.video.vram, "vram"),
+ # ("vram", self.video.vram, "vram"),
("oam", self.video.oam, "oam"),
("line", self.video.line, "line"),
- ("objects", self.video.objects, "objects"),
+ # ("objects", self.video.objects, "objects"),
("palette", self.video.palette, "palette"),
]
self.compare_memory_set(cmp, data, label="video");
Modified: pypy/trunk/pypy/lang/gameboy/debug/gameboy_debug_entry_point.py
==============================================================================
--- pypy/trunk/pypy/lang/gameboy/debug/gameboy_debug_entry_point.py (original)
+++ pypy/trunk/pypy/lang/gameboy/debug/gameboy_debug_entry_point.py Tue Mar 3 13:23:37 2009
@@ -12,7 +12,8 @@
# ------------------------------------------------------------------------------
ROM_PATH = str(py.magic.autopath().dirpath().dirpath())+"/rom"
-filename = ROM_PATH + "/rom9/rom9.gb"
+# filename = ROM_PATH + "/rom9/rom9.gb"
+filename = "/home/tverwaes/roms/KirbysDreamLand.gb"
SOCKET_PORT = 55682
skip_count = 22545
Modified: pypy/trunk/pypy/lang/gameboy/gameboy.py
==============================================================================
--- pypy/trunk/pypy/lang/gameboy/gameboy.py (original)
+++ pypy/trunk/pypy/lang/gameboy/gameboy.py Tue Mar 3 13:23:37 2009
@@ -124,7 +124,7 @@
def write(self, address, data):
receiver = self.get_receiver(address)
if receiver is None:
- raise Exception("invalid read address given")
+ raise Exception(("invalid write address given: ",address," ",data))
receiver.write(address, data)
if address == constants.STAT or address == 0xFFFF:
self.cpu.handle_pending_interrupts()
@@ -132,7 +132,7 @@
def read(self, address):
receiver = self.get_receiver(address)
if receiver is None:
- # raise Exception("invalid read address given")
+ # raise Exception("invalid read address given: ", address)
return 0xFF
return receiver.read(address)
Modified: pypy/trunk/pypy/lang/gameboy/gameboy_implementation.py
==============================================================================
--- pypy/trunk/pypy/lang/gameboy/gameboy_implementation.py (original)
+++ pypy/trunk/pypy/lang/gameboy/gameboy_implementation.py Tue Mar 3 13:23:37 2009
@@ -7,7 +7,7 @@
from pypy.lang.gameboy.timer import Clock
from pypy.lang.gameboy import constants
-use_rsdl = True
+use_rsdl = False
if use_rsdl:
from pypy.rlib.rsdl import RSDL, RSDL_helper
from pypy.rpython.lltypesystem import lltype, rffi
More information about the Pypy-commit
mailing list