diff --git a/src/acme.c b/src/acme.c index 745154d..976ec1b 100644 --- a/src/acme.c +++ b/src/acme.c @@ -469,7 +469,7 @@ struct dialect dialects[] = { {VER_NEWFORSYNTAX, "0.94.12", "new \"!for\" syntax"}, // {VER_, "0.95.2", "changed ANC#8 from 0x2b to 0x0b"}, // {VER_CURRENT, "default", "default"}, -// {VER_BACKSLASHESCAPING, "", "backslash escaping and strings"}, +// {VER_BACKSLASHESCAPING, "0.97", "backslash escaping and strings"}, {VER_FUTURE, "future", "enable all experimental features"}, {0, NULL, NULL} // NULLs terminate }; diff --git a/src/alu.c b/src/alu.c index 54a3eea..25e51fb 100644 --- a/src/alu.c +++ b/src/alu.c @@ -361,7 +361,7 @@ static void get_symbol_value(scope_t scope, char optional_prefix_char, size_t na symbol->object.u.number.ntype = NUMTYPE_UNDEFINED; symbol->object.u.number.flags = NUMBER_EVER_UNDEFINED; // reading undefined taints it symbol->object.u.number.addr_refs = 0; - symbol->object.u.number.val.intval = 0; + symbol->object.u.number.val.intval = 0; // FIXME - should not be needed! } else { // FIXME - add sanity check for UNDEFINED where EVER_UNDEFINED is false -> Bug_found()! // (because the only way to have UNDEFINED is the block above, and EVER_UNDEFINED taints everything it touches) @@ -387,7 +387,7 @@ static void get_symbol_value(scope_t scope, char optional_prefix_char, size_t na // Parse program counter ('*') -static void parse_program_counter(void) // Now GotByte = "*" +static void parse_program_counter(unsigned int unpseudo_count) // Now GotByte = "*" { struct number pc; @@ -396,6 +396,8 @@ static void parse_program_counter(void) // Now GotByte = "*" // if needed, output "value not defined" error if (pc.ntype == NUMTYPE_UNDEFINED) is_not_defined(NULL, 0, "*", 1); + if (unpseudo_count) + pseudopc_unpseudo(&pc, pseudopc_get_context(), unpseudo_count); PUSH_INT_ARG(pc.val.intval, pc.flags, pc.addr_refs); // FIXME - when undefined pc is allowed, this must be changed for numtype! } @@ -712,7 +714,9 @@ static int parse_octal_or_unpseudo(void) // now GotByte = '&' } // TODO - support anonymous labels as well? - if (GotByte == '.') { + if (GotByte == '*') { + parse_program_counter(unpseudo_count); + } else if (GotByte == '.') { GetByte(); if (Input_read_keyword() == 0) // now GotByte = illegal char return 1; // error (no string given) @@ -838,7 +842,7 @@ static boolean expect_argument_or_monadic_operator(void) goto now_expect_dyadic_op; case '*': // Program counter - parse_program_counter(); + parse_program_counter(0); // Now GotByte = char after closing quote goto now_expect_dyadic_op; diff --git a/src/global.h b/src/global.h index 0db504f..dee8a78 100644 --- a/src/global.h +++ b/src/global.h @@ -69,7 +69,7 @@ enum version { VER_NEWFORSYNTAX, // v0.94.12 introduced the new "!for" syntax // v0.95.2 changed ANC#8 from 0x2b to 0x0b VER_CURRENT, // "RELEASE" - VER_BACKSLASHESCAPING, // backslash escaping (and therefore strings) + VER_BACKSLASHESCAPING, // v0.97 added backslash escaping (and therefore strings) // possible changes in future versions: // paths should be relative to file, not start dir // ignore leading zeroes? diff --git a/src/output.c b/src/output.c index 03202a0..1413cc2 100644 --- a/src/output.c +++ b/src/output.c @@ -703,14 +703,14 @@ void pseudopc_end_all(void) int pseudopc_unpseudo(struct number *target, struct pseudopc *context, unsigned int levels) { while (levels--) { - if (target->ntype == NUMTYPE_UNDEFINED) - return 0; // ok (no sense in trying to unpseudo this, and it might be an unresolved forward ref anway) + //if (target->ntype == NUMTYPE_UNDEFINED) + // return 0; // ok (no sense in trying to unpseudo this, and it might be an unresolved forward ref anyway) if (context == NULL) { Throw_error("Un-pseudopc operator '&' has no !pseudopc context."); return 1; // error } - // FIXME - in future, check DEFINED flag of context! + // FIXME - in future, check both target and context for NUMTYPE_UNDEFINED! target->val.intval = (target->val.intval - context->offset) & 0xffff; // FIXME - is masking really needed? context = context->outer; } diff --git a/testing/errors/nopseudopccontext1.a b/testing/errors/nopseudopccontext1.a new file mode 100644 index 0000000..170e44b --- /dev/null +++ b/testing/errors/nopseudopccontext1.a @@ -0,0 +1,2 @@ +;ACME 0.96.5 + a = &c diff --git a/testing/errors/nopseudopccontext2.a b/testing/errors/nopseudopccontext2.a new file mode 100644 index 0000000..a3b5dcc --- /dev/null +++ b/testing/errors/nopseudopccontext2.a @@ -0,0 +1,2 @@ +;ACME 0.96.5 + b = &*