summaryrefslogtreecommitdiff
path: root/pokemontools/audio.py
diff options
context:
space:
mode:
authorBryan Bishop <kanzure@gmail.com>2015-03-12 12:03:17 -0500
committerBryan Bishop <kanzure@gmail.com>2015-03-12 12:03:17 -0500
commit46492bd9075313a52622cc585fe7b2ca404cbdcd (patch)
treea85173de577ad9511728a13d25f8d2e39d3b2b18 /pokemontools/audio.py
parent2c2ceb74567664379cebfb121e0db929718a4ba2 (diff)
parent8d86abe8823acc8c44780ae15646ebb7f719c5ec (diff)
Merge pull request #86 from yenatch/master
Refactor the LZ tools and fix BSSReader's eval shenanigans.
Diffstat (limited to 'pokemontools/audio.py')
-rw-r--r--pokemontools/audio.py20
1 files changed, 16 insertions, 4 deletions
diff --git a/pokemontools/audio.py b/pokemontools/audio.py
index 896ceef..9e08113 100644
--- a/pokemontools/audio.py
+++ b/pokemontools/audio.py
@@ -370,7 +370,8 @@ class Sound:
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):
@@ -383,9 +384,9 @@ class Sound:
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
@@ -397,16 +398,27 @@ class Sound:
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