ref: 82f7e983068e723f99a1da85c5c36a560599abc3
parent: d7228d5b9f41eeadd0a723ded52d9dfbf3384c99
author: Bryan Bishop <kanzure@gmail.com>
date: Thu Oct 11 14:52:54 EDT 2012
get an address given a label
--- a/extras/romstr.py
+++ b/extras/romstr.py
@@ -93,6 +93,16 @@
# load the labels from the file
self.labels = json.loads(open(filename, "r").read())
+ def get_address_for(self, label):
+ """ Returns the address of a label. This is slow and could be improved
+ dramatically.
+ """
+ label = str(label)
+ for address in self.labels.keys():
+ if self.labels[address] == label:
+ return address
+ return None
+
def length(self):
""" len(self)
"""
--
⑨