add a 'correction' to preprocessor to account for storetext issues

This commit is contained in:
Bryan Bishop 2012-05-16 18:34:03 -05:00
parent ac19eb2826
commit 611016ae40

View File

@ -493,9 +493,12 @@ def macro_translator(macro, token, line):
# --- end of ridiculously long sanity check --- # --- end of ridiculously long sanity check ---
# used for storetext
correction = 0
index = 0 index = 0
while index < len(params): while index < len(params):
param_type = macro.param_types[index] param_type = macro.param_types[index - correction]
description = param_type["name"] description = param_type["name"]
param_klass = param_type["class"] param_klass = param_type["class"]
byte_type = param_klass.byte_type # db or dw 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): if size == 3 and issubclass(param_klass, PointerLabelBeforeBank):
# write the bank first # write the bank first
sys.stdout.write("db " + params[index] + "\n") sys.stdout.write("db " + params[index].strip() + "\n")
# write the pointer second # write the pointer second
sys.stdout.write("dw " + params[index+1] + "\n") sys.stdout.write("dw " + params[index+1].strip() + "\n")
index += 2 index += 2
correction += 1
elif size == 3 and issubclass(param_klass, PointerLabelAfterBank): elif size == 3 and issubclass(param_klass, PointerLabelAfterBank):
# write the pointer first # write the pointer first
sys.stdout.write("dw " + params[index] + "\n") sys.stdout.write("dw " + params[index].strip() + "\n")
# write the bank second # write the bank second
sys.stdout.write("db " + params[index+1] + "\n") sys.stdout.write("db " + params[index+1].strip() + "\n")
index += 2 index += 2
correction += 1
elif size == 3 and issubclass(param_klass, MoneyByteParam): elif size == 3 and issubclass(param_klass, MoneyByteParam):
sys.stdout.write("db " + MoneyByteParam.from_asm(params[index]) + "\n") sys.stdout.write("db " + MoneyByteParam.from_asm(params[index]) + "\n")
index += 1 index += 1