diff options
author | Bryan Bishop <kanzure@gmail.com> | 2013-09-12 00:56:45 -0500 |
---|---|---|
committer | Bryan Bishop <kanzure@gmail.com> | 2013-09-12 00:56:45 -0500 |
commit | 5a4955e9c7dc1887ae440c3d564bd94d79a4ccdd (patch) | |
tree | ebc74e602d6ab8313095bd118e901d465874c50c | |
parent | 01779ed10d33994a2c14c3639584317a9b4cd129 (diff) |
move is_valid_address into addresses.py
-rw-r--r-- | pokemontools/addresses.py | 14 | ||||
-rw-r--r-- | pokemontools/crystal.py | 14 |
2 files changed, 17 insertions, 11 deletions
diff --git a/pokemontools/addresses.py b/pokemontools/addresses.py new file mode 100644 index 0000000..7b9aba5 --- /dev/null +++ b/pokemontools/addresses.py @@ -0,0 +1,14 @@ +""" +Common methods used against addresses. +""" + +def is_valid_address(address): + """is_valid_rom_address""" + if address == None: + return False + if type(address) == str: + address = int(address, 16) + if 0 <= address <= 2097152: + return True + else: + return False diff --git a/pokemontools/crystal.py b/pokemontools/crystal.py index 918232a..8618185 100644 --- a/pokemontools/crystal.py +++ b/pokemontools/crystal.py @@ -61,6 +61,9 @@ import item_constants import wram import exceptions +import addresses +is_valid_address = addresses.is_valid_address + from map_names import map_names # ---- script_parse_table explanation ---- @@ -142,17 +145,6 @@ def load_asm2(filename="../main.asm"): new_asm = Asm(filename=filename) return new_asm -def is_valid_address(address): - """is_valid_rom_address""" - if address == None: - return False - if type(address) == str: - address = int(address, 16) - if 0 <= address <= 2097152: - return True - else: - return False - def rom_interval(offset, length, strings=True, debug=True): """returns hex values for the rom starting at offset until offset+length""" global rom |