summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryan Bishop <kanzure@gmail.com>2012-06-20 01:42:33 -0500
committerBryan Bishop <kanzure@gmail.com>2012-06-20 01:42:33 -0500
commitb27e54750928818c8f96edbb48b5f4817bd27ef2 (patch)
tree03577e22961fad5d726028c16097a40ed545d378
parent8fe39c647bb50bb53fe28f8e9f38f7dcae8eb183 (diff)
more de-dependency-looping
original-commit-id: 1342ab67db4301563d317722d04fab9473411fda
-rw-r--r--crystal.py10
-rw-r--r--labels.py2
-rw-r--r--pointers.py8
3 files changed, 10 insertions, 10 deletions
diff --git a/crystal.py b/crystal.py
index 22bd6ec..97ca30c 100644
--- a/crystal.py
+++ b/crystal.py
@@ -302,15 +302,7 @@ def load_map_group_offsets():
map_group_offsets.append(offset)
return map_group_offsets
-def calculate_bank(address):
- """you are too lazy to divide on your own?"""
- if type(address) == str:
- address = int(address, 16)
- if 0x4000 <= address <= 0x7FFF:
- raise Exception, "bank 1 does not exist"
- return int(address) / 0x4000
-
-from pointers import calculate_pointer
+from pointers import calculate_bank, calculate_pointer
def calculate_pointer_from_bytes_at(address, bank=False):
"""calculates a pointer from 2 bytes at a location
diff --git a/labels.py b/labels.py
index 193ca24..a25fa3f 100644
--- a/labels.py
+++ b/labels.py
@@ -1,7 +1,7 @@
""" Various label/line-related functions.
"""
-from pointers import calculate_pointer
+from pointers import calculate_pointer, calculate_bank
def remove_quoted_text(line):
"""get rid of content inside quotes
diff --git a/pointers.py b/pointers.py
index d7b3cb8..f392241 100644
--- a/pointers.py
+++ b/pointers.py
@@ -2,6 +2,14 @@
depedency loops.
"""
+def calculate_bank(address):
+ """you are too lazy to divide on your own?"""
+ if type(address) == str:
+ address = int(address, 16)
+ #if 0x4000 <= address <= 0x7FFF:
+ # raise Exception, "bank 1 does not exist"
+ return int(address) / 0x4000
+
def calculate_pointer(short_pointer, bank=None):
"""calculates the full address given a 4-byte pointer and bank byte"""
short_pointer = int(short_pointer)