summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryan Bishop <kanzure@gmail.com>2012-05-16 18:34:03 -0500
committerBryan Bishop <kanzure@gmail.com>2012-05-16 18:34:03 -0500
commit611016ae406522a43cd3d75a9f24f5e8f68a02b4 (patch)
treee5d32c7fdea0d8cdc7d5c64ea9e058407bc8a68e
parentac19eb28262800ab26ffd466c4f47b407f893ba5 (diff)
add a 'correction' to preprocessor to account for storetext issues
-rw-r--r--preprocessor.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/preprocessor.py b/preprocessor.py
index 0a0c8a0d6..42f64a01e 100644
--- a/preprocessor.py
+++ b/preprocessor.py
@@ -493,9 +493,12 @@ def macro_translator(macro, token, line):
# --- end of ridiculously long sanity check ---
+ # used for storetext
+ correction = 0
+
index = 0
while index < len(params):
- param_type = macro.param_types[index]
+ param_type = macro.param_types[index - correction]
description = param_type["name"]
param_klass = param_type["class"]
byte_type = param_klass.byte_type # db or dw
@@ -513,16 +516,18 @@ def macro_translator(macro, token, line):
if size == 3 and issubclass(param_klass, PointerLabelBeforeBank):
# write the bank first
- sys.stdout.write("db " + params[index] + "\n")
+ sys.stdout.write("db " + params[index].strip() + "\n")
# write the pointer second
- sys.stdout.write("dw " + params[index+1] + "\n")
+ sys.stdout.write("dw " + params[index+1].strip() + "\n")
index += 2
+ correction += 1
elif size == 3 and issubclass(param_klass, PointerLabelAfterBank):
# write the pointer first
- sys.stdout.write("dw " + params[index] + "\n")
+ sys.stdout.write("dw " + params[index].strip() + "\n")
# write the bank second
- sys.stdout.write("db " + params[index+1] + "\n")
+ sys.stdout.write("db " + params[index+1].strip() + "\n")
index += 2
+ correction += 1
elif size == 3 and issubclass(param_klass, MoneyByteParam):
sys.stdout.write("db " + MoneyByteParam.from_asm(params[index]) + "\n")
index += 1