summaryrefslogtreecommitdiff
path: root/pokemontools/labels.py
diff options
context:
space:
mode:
authoryenatch <yenatch@gmail.com>2013-11-05 14:11:04 -0500
committeryenatch <yenatch@gmail.com>2013-11-05 14:11:04 -0500
commitda7b863b8e20d5d8da07d9eb44e0fd4f5f0848d0 (patch)
tree09a02add28a0d34589fce85ec2fde3da81c8eb05 /pokemontools/labels.py
parent4a7373d8e79d17f10ebafa3ccef7b822a5b139af (diff)
parentdafb5518df768f93ac94c59d4bf5981e95f7aba0 (diff)
Merge branch 'master' of github.com:kanzure/pokemon-reverse-engineering-tools
Diffstat (limited to 'pokemontools/labels.py')
-rw-r--r--pokemontools/labels.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/pokemontools/labels.py b/pokemontools/labels.py
index 1509ae6..96e34b9 100644
--- a/pokemontools/labels.py
+++ b/pokemontools/labels.py
@@ -8,7 +8,6 @@ import json
import logging
import pointers
-import crystal
class Labels(object):
"""
@@ -32,6 +31,7 @@ class Labels(object):
"Running crystal.scan_for_predefined_labels to create \"{0}\". Trying.."
.format(Labels.filename)
)
+ import crystal
crystal.scan_for_predefined_labels()
self.labels = json.read(open(self.path, "r").read())
@@ -197,3 +197,13 @@ def get_label_from_line(line):
#split up the line
label = line.split(":")[0]
return label
+
+def find_labels_without_addresses(asm):
+ """scans the asm source and finds labels that are unmarked"""
+ without_addresses = []
+ for (line_number, line) in enumerate(asm):
+ if line_has_label(line):
+ label = get_label_from_line(line)
+ if not line_has_comment_address(line):
+ without_addresses.append({"line_number": line_number, "line": line, "label": label})
+ return without_addresses