Merge pull request #50 from kanzure/include-wram

Parse WRAM addresses into a dictionary
This commit is contained in:
Bryan Bishop
2013-11-12 22:35:39 -08:00
3 changed files with 2325 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
"""
Access to data files.
"""
# hide the os import
import os as _os
# path to where these files are located
path = _os.path.abspath(_os.path.dirname(__file__))
def join(filename, path=path):
"""
Construct the absolute path to the file.
"""
return _os.path.join(path, filename)

File diff suppressed because it is too large Load Diff

View File

@@ -5,6 +5,10 @@ RGBDS BSS section and constant parsing.
import os
# TODO: parse these constants from constants.asm
NUM_OBJECTS = 0x10
OBJECT_LENGTH = 0x10
def make_wram_labels(wram_sections):
wram_labels = {}
for section in wram_sections:
@@ -108,6 +112,8 @@ class WRAMProcessor(object):
self.setup_hram_constants()
self.setup_gbhw_constants()
self.reformat_wram_labels()
def read_wram_sections(self):
"""
Opens the wram file and calls read_bss_sections.
@@ -162,3 +168,14 @@ class WRAMProcessor(object):
"""
self.gbhw_constants = self.read_gbhw_constants()
return self.gbhw_constants
def reformat_wram_labels(self):
"""
Flips the wram_labels dictionary the other way around to access
addresses by label.
"""
self.wram = {}
for (address, labels) in self.wram_labels.iteritems():
for label in labels:
self.wram[label] = address