diff options
author | Bryan Bishop <kanzure@gmail.com> | 2013-08-03 16:10:52 -0500 |
---|---|---|
committer | Bryan Bishop <kanzure@gmail.com> | 2013-08-03 16:10:52 -0500 |
commit | 28490230cf68f8045fc63a8c7d3de19c7c1d3bcd (patch) | |
tree | c4d1a3acbc7d34b77a890f8e19a8d7253917be8c /pointers.py | |
parent | a14c36eadb75ea3d6fbc4cb3f382d7c9785d9fe9 (diff) |
make a basic python module
Diffstat (limited to 'pointers.py')
-rw-r--r-- | pointers.py | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/pointers.py b/pointers.py deleted file mode 100644 index 161a53e..0000000 --- a/pointers.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- -""" -Various functions related to pointer and address math. Mostly to avoid -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) - if 0x4000 <= short_pointer <= 0x7fff: - short_pointer -= 0x4000 - bank = int(bank) - else: - bank = 0 - pointer = short_pointer + (bank * 0x4000) - return pointer |