# HG changeset patch # User William Astle # Date 1397426639 21600 # Node ID 9f7889139b069b137cc7ae85c31933de8daa8fac # Parent 15125b7c865fcbee2856889f029e97f9b5971228 Fix 6809 mode to count 6309 instructions as non-existent Allow 6309 instructions to be shadowed by macros when assembling in 6809 mode. After all, 6309 instructions are NOT instructions in 6809 mode so why shouldn't they be shadowable by macros? diff -r 15125b7c865f -r 9f7889139b06 lwasm/pass1.c --- a/lwasm/pass1.c Fri Apr 11 21:54:07 2014 -0600 +++ b/lwasm/pass1.c Sun Apr 13 16:03:59 2014 -0600 @@ -274,8 +274,6 @@ if (!strcasecmp(instab[opnum].opcode, sym)) break; } - if ((as -> target != TARGET_6309) && (instab[opnum].flags & lwasm_insn_is6309)) - lwasm_register_error(as, cl, "Illegal use of 6309 instruction in 6809 mode (%s)", sym); // have to go to linedone here in case there was a symbol // to register on this line @@ -298,7 +296,7 @@ if (as -> skipcond && !(instab[opnum].flags & lwasm_insn_cond)) goto linedone; - if (!nomacro && (as -> pragmas & PRAGMA_SHADOW)) + if (!nomacro && ((as -> pragmas & PRAGMA_SHADOW) || ((as -> target != TARGET_6309) && (instab[opnum].flags & lwasm_insn_is6309)))) { // check for macros even if they shadow real operations // NOTE: "ENDM" cannot be shadowed @@ -332,13 +330,16 @@ // no parse func means operand doesn't matter if (instab[opnum].parse) { + if ((as -> target != TARGET_6309) && (instab[opnum].flags & lwasm_insn_is6309)) + lwasm_register_error(as, cl, "Illegal use of 6309 instruction in 6809 mode (%s)", sym); + if (as -> instruct == 0 || instab[opnum].flags & lwasm_insn_struct) { struct line_expr_s *le; cl -> len = -1; // call parse function - debug_message(as, 100, "len = %d, dlen = %d", cl -> len, cl -> dlen); + debug_message(as, 100, "len = %d, dlen = %d", cl -> len, cl -> dlen); (instab[opnum].parse)(as, cl, &p1); if ((cl -> inmod == 0) && cl -> len >= 0 && cl -> dlen >= 0) {