mirror of
https://github.com/pret/pokemon-reverse-engineering-tools.git
synced 2026-10-06 07:44:49 -04:00
move code around to avoid dependency loops
original-commit-id: ca07f1d64c0235b49160fc501553a70af8331d81
This commit is contained in:
+15
@@ -0,0 +1,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
|
||||
|
||||
Reference in New Issue
Block a user