diff options
author | yenatch <yenatch@gmail.com> | 2013-12-28 19:57:37 -0500 |
---|---|---|
committer | yenatch <yenatch@gmail.com> | 2013-12-28 19:57:37 -0500 |
commit | 70cd4f7c00b33a398ed7af071773c06ca335c105 (patch) | |
tree | 85350b4414bd03cd3155a171563f0fce0b6d35ad | |
parent | 82389c999856e58b443c025228ecddd24dc6e4ab (diff) |
audio: use labels.line_has_label and clean up crystal imports
-rw-r--r-- | pokemontools/audio.py | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/pokemontools/audio.py b/pokemontools/audio.py index 898c646..0cdfcbc 100644 --- a/pokemontools/audio.py +++ b/pokemontools/audio.py @@ -5,14 +5,13 @@ import os from math import ceil from gbz80disasm import get_global_address, get_local_address - -import crystal +from labels import line_has_label from crystal import music_classes as sound_classes - from crystal import ( Command, SingleByteParam, MultiByteParam, + PointerLabelParam, load_rom, ) @@ -23,9 +22,6 @@ import configuration conf = configuration.Config() -def is_label(asm): - return ':' in asm - def is_comment(asm): return asm.startswith(';') @@ -42,7 +38,7 @@ def asm_sort(asm_def): address, last_address, not is_comment(asm), - not is_label(asm), + not line_has_label(asm), asm ) @@ -202,7 +198,7 @@ class Channel: # label any jumps or calls for key, param in class_.param_types.items(): - if param['class'] == crystal.PointerLabelParam: + if param['class'] == PointerLabelParam: label_address = class_.params[key].parsed_address label = '%s_branch_%x' % ( self.base_label, @@ -246,10 +242,10 @@ class Channel: output = sort_asms(self.output + self.labels) text = '' for i, (address, asm, last_address) in enumerate(output): - if is_label(asm): + if line_has_label(asm): # dont print labels for empty chunks for (address_, asm_, last_address_) in output[i:]: - if not is_label(asm_): + if not line_has_label(asm_): text += '\n' + asm + '\n' break else: |