diff options
author | Bryan Bishop <kanzure@gmail.com> | 2012-06-20 01:42:33 -0500 |
---|---|---|
committer | Bryan Bishop <kanzure@gmail.com> | 2012-06-20 01:42:33 -0500 |
commit | 1342ab67db4301563d317722d04fab9473411fda (patch) | |
tree | 453ed42784e79e626955b1da216567dc8e8aa845 /extras/pointers.py | |
parent | ca07f1d64c0235b49160fc501553a70af8331d81 (diff) |
more de-dependency-looping
Diffstat (limited to 'extras/pointers.py')
-rw-r--r-- | extras/pointers.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/extras/pointers.py b/extras/pointers.py index d7b3cb877..f3922417b 100644 --- a/extras/pointers.py +++ b/extras/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) |