comparison lwasm/pass1.c @ 367:c6d2a1f54e0c

Change processor target variations to pragmas. Add "pragma 6809" and "pragma 6309" which select the processor target rather than a global flag. The command line switches set or reset the pragma appropriately. Thanks to Erik G <erik@6809.org> for the patch.
author William Astle <lost@l-w.ca>
date Mon, 15 Jun 2015 21:21:58 -0600
parents 98f3e016cfd8
children 8764142b3192
comparison
equal deleted inserted replaced
366:433dbc18fb41 367:c6d2a1f54e0c
297 // operate within a condition (not a conditional) 297 // operate within a condition (not a conditional)
298 // do nothing 298 // do nothing
299 if (as -> skipcond && !(instab[opnum].flags & lwasm_insn_cond)) 299 if (as -> skipcond && !(instab[opnum].flags & lwasm_insn_cond))
300 goto linedone; 300 goto linedone;
301 301
302 if (!nomacro && ((as -> pragmas & PRAGMA_SHADOW) || ((as -> target != TARGET_6309) && (instab[opnum].flags & lwasm_insn_is6309)))) 302 if (!nomacro && ((as->pragmas & PRAGMA_SHADOW) || (!CURPRAGMA(cl, PRAGMA_6809) && (instab[opnum].flags & lwasm_insn_is6309))))
303 { 303 {
304 // check for macros even if they shadow real operations 304 // check for macros even if they shadow real operations
305 // NOTE: "ENDM" cannot be shadowed 305 // NOTE: "ENDM" cannot be shadowed
306 if (expand_macro(as, cl, &p1, sym) == 0) 306 if (expand_macro(as, cl, &p1, sym) == 0)
307 { 307 {
331 { 331 {
332 cl -> insn = opnum; 332 cl -> insn = opnum;
333 // no parse func means operand doesn't matter 333 // no parse func means operand doesn't matter
334 if (instab[opnum].parse) 334 if (instab[opnum].parse)
335 { 335 {
336 if ((as -> target != TARGET_6309) && (instab[opnum].flags & lwasm_insn_is6309)) 336 if (CURPRAGMA(cl, PRAGMA_6809) && (instab[opnum].flags & lwasm_insn_is6309))
337 lwasm_register_error(as, cl, "Illegal use of 6309 instruction in 6809 mode (%s)", sym); 337 lwasm_register_error(as, cl, "Illegal use of 6309 instruction in 6809 mode (%s)", sym);
338 338 if (!CURPRAGMA(cl, PRAGMA_6809) && (instab[opnum].flags & lwasm_insn_is6809))
339 lwasm_register_error(as, cl, "Illegal use of 6809 instruction in 6309 mode (%s)", sym);
340
339 if (as -> instruct == 0 || instab[opnum].flags & lwasm_insn_struct) 341 if (as -> instruct == 0 || instab[opnum].flags & lwasm_insn_struct)
340 { 342 {
341 cl -> len = -1; 343 cl -> len = -1;
342 // call parse function 344 // call parse function
343 debug_message(as, 100, "len = %d, dlen = %d", cl -> len, cl -> dlen); 345 debug_message(as, 100, "len = %d, dlen = %d", cl -> len, cl -> dlen);