From ad6c2dbe7b2215314edbb19b2828b0f1067619b2 Mon Sep 17 00:00:00 2001 From: Greg King Date: Sun, 29 Jul 2018 03:50:02 -0400 Subject: [PATCH] Added code to make the 65816's MVN and MVP instructions handle both immediate (bank) and far-address operands. --- src/ca65/instr.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/ca65/instr.c b/src/ca65/instr.c index 8d1e96705..eb005289c 100644 --- a/src/ca65/instr.c +++ b/src/ca65/instr.c @@ -1295,18 +1295,38 @@ static void PutPCRel4510 (const InsDesc* Ins) } + static void PutBlockMove (const InsDesc* Ins) /* Handle the blockmove instructions (65816) */ { - ExprNode* Arg1 = Expression (); + ExprNode* Arg1; + ExprNode* Arg2; Emit0 (Ins->BaseCode); + + if (CurTok.Tok == TOK_HASH) { + /* The operand is a bank-byte expression. */ + NextTok (); + Arg1 = Expression (); + } else { + /* The operand is a far-address expression. + ** Use only its bank part. + */ + Arg1 = FuncBankByte (); + } ConsumeComma (); + if (CurTok.Tok == TOK_HASH) { + NextTok (); + Arg2 = Expression (); + } else { + Arg2 = FuncBankByte (); + } + /* The operands are written in Assembly code as source, destination; ** but, they're assembled as . */ - EmitByte (Expression ()); + EmitByte (Arg2); EmitByte (Arg1); } -- 2.39.5