fix 16-bit branch out-by-one error

This commit is contained in:
gardners 2014-02-07 20:23:56 +10:30
parent dec3106744
commit 5c4b23cbee

View File

@ -768,7 +768,7 @@ class Assembler(Pass):
def relativizelong(self, expr, env, arglen): def relativizelong(self, expr, env, arglen):
"Convert an expression into one for use in relative addressing" "Convert an expression into one for use in relative addressing"
arg = expr.value(env) arg = expr.value(env)
arg = arg - (env.getPC() + arglen + 1) arg = arg - (env.getPC() + arglen)
if arg < 0: if arg < 0:
arg += 65536 arg += 65536
return IR.ConstantExpr(arg) return IR.ConstantExpr(arg)