summaryrefslogtreecommitdiff
path: root/romstr.py
diff options
context:
space:
mode:
authorBryan Bishop <kanzure@gmail.com>2013-02-03 15:18:06 -0600
committerBryan Bishop <kanzure@gmail.com>2013-02-03 15:18:06 -0600
commitd3a1ef222aeb80e0faf9dc762ec7a249be2da772 (patch)
tree7cf2b749ca701ac489ce8577ac4b3fc098140b57 /romstr.py
parentc789a2962ace456d1e539864f07bc9f946a8df84 (diff)
simplify load_rom in gbz80disasm
original-commit-id: 57200b6cf75040b9696ae54bdac69d5e452a2c48
Diffstat (limited to 'romstr.py')
-rw-r--r--romstr.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/romstr.py b/romstr.py
index d2eea44..5701f19 100644
--- a/romstr.py
+++ b/romstr.py
@@ -46,15 +46,17 @@ class RomStr(str):
return "RomStr(too long)"
@classmethod
- def load(cls, crystal=True, red=False):
+ def load(cls, filename=None, crystal=True, red=False):
""" Loads a ROM into a RomStr.
"""
- if crystal and not red:
+ if crystal and not red and not filename:
file_handler = open("../baserom.gbc", "r")
- elif red and not crystal:
+ elif red and not crystal and not filename:
file_handler = open("../pokered-baserom.gbc", "r")
+ elif filename not in ["", None]:
+ file_handler = open(filename, "rb")
else:
- raise Exception, "not sure which rom to load?"
+ raise Exception("not sure which rom to load?")
bytes = file_handler.read()
file_handler.close()
return RomStr(bytes)