Mercurial > hg > index.cgi
comparison lwasm/pass1.c @ 329:9f7889139b06
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?
author | William Astle <lost@l-w.ca> |
---|---|
date | Sun, 13 Apr 2014 16:03:59 -0600 |
parents | 1409debcb1a0 |
children | 507f442dc71e |
comparison
equal
deleted
inserted
replaced
328:15125b7c865f | 329:9f7889139b06 |
---|---|
272 for (opnum = 0; instab[opnum].opcode; opnum++) | 272 for (opnum = 0; instab[opnum].opcode; opnum++) |
273 { | 273 { |
274 if (!strcasecmp(instab[opnum].opcode, sym)) | 274 if (!strcasecmp(instab[opnum].opcode, sym)) |
275 break; | 275 break; |
276 } | 276 } |
277 if ((as -> target != TARGET_6309) && (instab[opnum].flags & lwasm_insn_is6309)) | |
278 lwasm_register_error(as, cl, "Illegal use of 6309 instruction in 6809 mode (%s)", sym); | |
279 | 277 |
280 // have to go to linedone here in case there was a symbol | 278 // have to go to linedone here in case there was a symbol |
281 // to register on this line | 279 // to register on this line |
282 if (instab[opnum].opcode == NULL && (*tok == '*' || *tok == ';' || *tok == '#')) | 280 if (instab[opnum].opcode == NULL && (*tok == '*' || *tok == ';' || *tok == '#')) |
283 goto linedone; | 281 goto linedone; |
296 // operate within a condition (not a conditional) | 294 // operate within a condition (not a conditional) |
297 // do nothing | 295 // do nothing |
298 if (as -> skipcond && !(instab[opnum].flags & lwasm_insn_cond)) | 296 if (as -> skipcond && !(instab[opnum].flags & lwasm_insn_cond)) |
299 goto linedone; | 297 goto linedone; |
300 | 298 |
301 if (!nomacro && (as -> pragmas & PRAGMA_SHADOW)) | 299 if (!nomacro && ((as -> pragmas & PRAGMA_SHADOW) || ((as -> target != TARGET_6309) && (instab[opnum].flags & lwasm_insn_is6309)))) |
302 { | 300 { |
303 // check for macros even if they shadow real operations | 301 // check for macros even if they shadow real operations |
304 // NOTE: "ENDM" cannot be shadowed | 302 // NOTE: "ENDM" cannot be shadowed |
305 if (expand_macro(as, cl, &p1, sym) == 0) | 303 if (expand_macro(as, cl, &p1, sym) == 0) |
306 { | 304 { |
330 { | 328 { |
331 cl -> insn = opnum; | 329 cl -> insn = opnum; |
332 // no parse func means operand doesn't matter | 330 // no parse func means operand doesn't matter |
333 if (instab[opnum].parse) | 331 if (instab[opnum].parse) |
334 { | 332 { |
333 if ((as -> target != TARGET_6309) && (instab[opnum].flags & lwasm_insn_is6309)) | |
334 lwasm_register_error(as, cl, "Illegal use of 6309 instruction in 6809 mode (%s)", sym); | |
335 | |
335 if (as -> instruct == 0 || instab[opnum].flags & lwasm_insn_struct) | 336 if (as -> instruct == 0 || instab[opnum].flags & lwasm_insn_struct) |
336 { | 337 { |
337 struct line_expr_s *le; | 338 struct line_expr_s *le; |
338 | 339 |
339 cl -> len = -1; | 340 cl -> len = -1; |
340 // call parse function | 341 // call parse function |
341 debug_message(as, 100, "len = %d, dlen = %d", cl -> len, cl -> dlen); | 342 debug_message(as, 100, "len = %d, dlen = %d", cl -> len, cl -> dlen); |
342 (instab[opnum].parse)(as, cl, &p1); | 343 (instab[opnum].parse)(as, cl, &p1); |
343 if ((cl -> inmod == 0) && cl -> len >= 0 && cl -> dlen >= 0) | 344 if ((cl -> inmod == 0) && cl -> len >= 0 && cl -> dlen >= 0) |
344 { | 345 { |
345 if (cl -> len == 0) | 346 if (cl -> len == 0) |
346 cl -> len = cl -> dlen; | 347 cl -> len = cl -> dlen; |