summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crystal.py1
-rw-r--r--gbz80disasm.py10
2 files changed, 8 insertions, 3 deletions
diff --git a/crystal.py b/crystal.py
index 4353ad5..6c70f64 100644
--- a/crystal.py
+++ b/crystal.py
@@ -13,6 +13,7 @@ import random
# for capwords
import string
+# for python2.6
if not hasattr(json, "dumps"):
json.dumps = json.write
diff --git a/gbz80disasm.py b/gbz80disasm.py
index aab39db..f2ba483 100644
--- a/gbz80disasm.py
+++ b/gbz80disasm.py
@@ -4,10 +4,12 @@ import os
import sys
from copy import copy, deepcopy
from ctypes import c_int8
-import json
import random
+import json
-spacing = "\t"
+# New versions of json don't have read anymore.
+if not hasattr(json, "read"):
+ json.read = json.loads
from romstr import RomStr
@@ -19,6 +21,8 @@ def load_rom(filename="../baserom.gbc"):
file_handler.close()
return rom
+spacing = "\t"
+
temp_opt_table = [
[ "ADC A", 0x8f, 0 ],
[ "ADC B", 0x88, 0 ],
@@ -557,7 +561,7 @@ all_labels = {}
def load_labels(filename="labels.json"):
global all_labels
if os.path.exists(filename):
- all_labels = json.loads(open(filename, "r").read())
+ all_labels = json.read(open(filename, "r").read())
else:
print "You must run crystal.scan_for_predefined_labels() to create \"labels.json\". Trying..."
import crystal