blob: d7b3cb87727dfd8385f83c086c0aa86a83c45705 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
""" Various functions related to pointer and address math. Mostly to avoid
depedency loops.
"""
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
|