From 611016ae406522a43cd3d75a9f24f5e8f68a02b4 Mon Sep 17 00:00:00 2001 From: Bryan Bishop Date: Wed, 16 May 2012 18:34:03 -0500 Subject: [PATCH] add a 'correction' to preprocessor to account for storetext issues --- preprocessor.py | 15 ++++++++++----- 1 file 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