From 309c8fb8425af833c260d93909827d1d6c0bdce4 Mon Sep 17 00:00:00 2001 From: Greg King Date: Sat, 30 Nov 2013 08:20:36 -0500 Subject: [PATCH] Fixed ca65's "ubiquitous_idents" feature. Before the fix, that feature couldn't recognize a standard op-code mnemonic, that wasn't replaced by a macro, if it was on a line without a label. This patch was written by Jeremy Turner. --- src/ca65/main.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/ca65/main.c b/src/ca65/main.c index 4b2f9d178..da826f4db 100644 --- a/src/ca65/main.c +++ b/src/ca65/main.c @@ -646,15 +646,18 @@ static void OneLine (void) * an instruction. */ if (CurTok.Tok == TOK_IDENT) { - if (!UbiquitousIdents) { - /* Macros and symbols cannot use instruction names */ + if (UbiquitousIdents) { + /* Macros CAN be instructions, so check for them first */ + Mac = FindMacro (&CurTok.SVal); + if (Mac == 0) { + Instr = FindInstruction (&CurTok.SVal); + } + } else { + /* Macros and symbols may NOT use the names of instructions */ Instr = FindInstruction (&CurTok.SVal); if (Instr < 0) { Mac = FindMacro (&CurTok.SVal); } - } else { - /* Macros and symbols may use the names of instructions */ - Mac = FindMacro (&CurTok.SVal); } } @@ -741,15 +744,18 @@ static void OneLine (void) * be a macro or instruction. */ if (CurTok.Tok == TOK_IDENT) { - if (!UbiquitousIdents) { - /* Macros and symbols cannot use instruction names */ + if (UbiquitousIdents) { + /* Macros CAN be instructions, so check for them first */ + Mac = FindMacro (&CurTok.SVal); + if (Mac == 0) { + Instr = FindInstruction (&CurTok.SVal); + } + } else { + /* Macros and symbols may NOT use the names of instructions */ Instr = FindInstruction (&CurTok.SVal); if (Instr < 0) { Mac = FindMacro (&CurTok.SVal); } - } else { - /* Macros and symbols may use the names of instructions */ - Mac = FindMacro (&CurTok.SVal); } } } -- 2.39.5