Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

Commit

Permalink
Merge pull request #86 from yenatch/master
Browse files Browse the repository at this point in the history
Refactor the LZ tools and fix BSSReader's eval shenanigans.
  • Loading branch information
kanzure committed Mar 12, 2015
2 parents 2c2ceb7 + 8d86abe commit 46492bd
Show file tree
Hide file tree
Showing 5 changed files with 876 additions and 488 deletions.
20 changes: 16 additions & 4 deletions pokemontools/audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,8 @@ def __init__(self, address, name='', sfx=False):
self.asms = []
self.parse()

def parse(self):

def parse_header(self):
self.num_channels = (rom[self.address] >> 6) + 1
self.channels = []
for ch in xrange(self.num_channels):
Expand All @@ -383,9 +384,9 @@ def parse(self):
self.channels += [(current_channel, channel)]
self.labels += channel.labels

asms = []

asms += [generate_label_asm(self.base_label, self.start_address)]
def make_header(self):
asms = []

for i, (num, channel) in enumerate(self.channels):
channel_id = num - 1
Expand All @@ -397,16 +398,27 @@ def parse(self):

comment_text = '; %x\n' % self.address
asms += [(self.address, comment_text, self.address)]
return asms


def parse(self):
self.parse_header()

asms = []

asms += [generate_label_asm(self.base_label, self.start_address)]
asms += self.make_header()

for num, channel in self.channels:
asms += channel.output

asms = sort_asms(asms)
self.last_address = asms[-1][2]
_, _, self.last_address = asms[-1]
asms += [(self.last_address,'; %x\n' % self.last_address, self.last_address)]

self.asms += asms


def to_asm(self, labels=[]):
"""insert outside labels here"""
asms = self.asms
Expand Down
2 changes: 1 addition & 1 deletion pokemontools/crystal.py
Original file line number Diff line number Diff line change
Expand Up @@ -913,7 +913,7 @@ def to_asm(self):
lo, hi = self.bytes[1:3]
else:
lo, hi = self.bytes[0:2]
pointer_part = "{0}{1:2x}{2:2x}".format(self.prefix, hi, lo)
pointer_part = "{0}{1:02x}{2:02x}".format(self.prefix, hi, lo)

# bank positioning matters!
if bank == True or bank == "reverse": # bank, pointer
Expand Down
Loading

0 comments on commit 46492bd

Please sign in to comment.