From a8beaf1990e5fbbdaad1c94a6f658f414f5dad43 Mon Sep 17 00:00:00 2001 From: g012 Date: Mon, 4 Sep 2017 00:13:13 +0200 Subject: [PATCH] Added .w opcode suffix to force absolute over zeropage. --- l65.lua | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/l65.lua b/l65.lua index f074429..22184c5 100644 --- a/l65.lua +++ b/l65.lua @@ -1145,21 +1145,29 @@ local function ParseLua(src) end end if opcode_absolute[op] or opcode_absolute_x[op] or opcode_absolute_y[op] then + local suffix = '' + tok:Save() + if tok:ConsumeSymbol('.', tokenList) then + if tok:Get(tokenList).Data == 'w' then suffix = '_nozp' + else tok:Restore() tok:Save() end + end local st, expr = ParseExpr(scope) - if st then + if not st then tok:Restore() + else + tok:Commit() if not tok:ConsumeSymbol(',', tokenList) then if not opcode_absolute[op] then return false, expr end - stat = emit_opcode(op .. "_absolute", expr) break + stat = emit_opcode(op .. "_absolute" .. suffix, expr) break end if tok:Peek().Data == 'x' then if not opcode_absolute_x[op] then return false, expr end tok:Get(tokenList) - stat = emit_opcode(op .. "_absolute_x", expr) break + stat = emit_opcode(op .. "_absolute_x" .. suffix, expr) break end if tok:Peek().Data == 'y' then if not opcode_absolute_y[op] then return false, expr end tok:Get(tokenList) - stat = emit_opcode(op .. "_absolute_x", expr) break + stat = emit_opcode(op .. "_absolute_x" .. suffix, expr) break end return false, expr end