diff --git a/src/global.h b/src/global.h index caad3e1..4cbcd39 100644 --- a/src/global.h +++ b/src/global.h @@ -86,10 +86,11 @@ v0.07: *= is now segment change instead of offset assembly added !pseudopc/!realpc */ -//#define VER_ 8500 // v0.85 looks like the oldest version it makes sense to actually support -//#define VER_ 8600 // v0.86 made !pseudopc/!realpc give a warning to use !pseudopc{} instead, and !to wants a file format -//#define VER_ 9300 // v0.93 allowed *= inside offset assembly blocks +#define VER_OLDEST_SUPPORTED 8500 // v0.85 looks like the oldest version it makes sense to actually support +#define VER_DEPRECATE_REALPC 8600 // v0.86 made !pseudopc/!realpc give a warning to use !pseudopc{} instead, and !to wants a file format +#define VER_ALLOW_SETPC_IN_PSEUDOPC 9300 // v0.93 allowed *= inside !pseudopc blocks #define VER_RIGHTASSOCIATIVEPOWEROF 9406 // v0.94.6 made "power of" operator right-associative +// 9407 // v0.94.7 fixed a bug: empty code segments no longer included in output file #define VER_DISABLED_OBSOLETE_STUFF 9408 // v0.94.8 disabled !cbm, !pseudopc/!realpc, !subzone #define VER_NEWFORSYNTAX 9412 // v0.94.12 introduced the new "!for" syntax // 9502 // v0.95.2 changed ANC#8 from 0x2b to 0x0b diff --git a/src/output.c b/src/output.c index e48598f..b890153 100644 --- a/src/output.c +++ b/src/output.c @@ -577,6 +577,12 @@ void vcpu_set_pc(intval_t new_pc, int segment_flags) { intval_t new_offset; + // support stupidly bad, old, ancient, deprecated, obsolete behaviour: + if ((config.wanted_version < VER_ALLOW_SETPC_IN_PSEUDOPC) + && (pseudopc_current_context != NULL)) { + Throw_warning("Offset assembly still active at end of segment. Switched it off."); + pseudopc_end(); + } new_offset = (new_pc - CPU_state.pc.val.intval) & 0xffff; CPU_state.pc.val.intval = new_pc; CPU_state.pc.flags |= NUMBER_IS_DEFINED; // FIXME - remove when allowing undefined! @@ -657,11 +663,17 @@ void pseudopc_start(struct number *new_pc) CPU_state.pc.flags |= NUMBER_IS_DEFINED; // FIXME - remove when allowing undefined! //new: CPU_state.pc.flags = new_pc->flags & (NUMBER_IS_DEFINED | NUMBER_EVER_UNDEFINED); } -// end offset assembly (use FALSE for old, deprecated, obsolete, non-nesting !realpc) -void pseudopc_end(boolean choke_outside) +// end offset assembly +void pseudopc_end(void) { if (pseudopc_current_context == NULL) { - if (choke_outside) + // trying to end offset assembly though it isn't active: + // in current versions this cannot happen and so must be a bug. + // but in versions older than 0.94.8 this was possible using + // !realpc, and before v0.93 offset assembly got automatically + // disabled when encountering "*=". + // so only choke if wanted version is new enough: + if (config.wanted_version >= VER_DISABLED_OBSOLETE_STUFF) Bug_found("ClosingUnopenedPseudopcBlock", 0); } else { CPU_state.pc.val.intval = (CPU_state.pc.val.intval - pseudopc_current_context->offset) & 0xffff; // pc might have wrapped around diff --git a/src/output.h b/src/output.h index 2913cbf..0ed83b0 100644 --- a/src/output.h +++ b/src/output.h @@ -102,8 +102,8 @@ extern void vcpu_end_statement(void); struct pseudopc; // start offset assembly extern void pseudopc_start(struct number *new_pc); -// end offset assembly (use FALSE for old, deprecated, obsolete, non-nesting !realpc) -extern void pseudopc_end(boolean choke_outside); +// end offset assembly +extern void pseudopc_end(void); // un-pseudopc a label value by given number of levels // returns nonzero on error (if level too high) extern int pseudopc_unpseudo(struct number *target, struct pseudopc *context, unsigned int levels); diff --git a/src/pseudoopcodes.c b/src/pseudoopcodes.c index cc6b785..eb3a9c5 100644 --- a/src/pseudoopcodes.c +++ b/src/pseudoopcodes.c @@ -81,7 +81,7 @@ void notreallypo_setpc(void) // GotByte is '*' } } vcpu_set_pc(intresult.val.intval, segment_flags); - // TODO - allow block syntax, so it is possible to put data "somewhere else" and then return to old position + // TODO - allow block syntax, so it is possible to put data "somewhere else" and then return to old position? Input_ensure_EOS(); return; @@ -153,8 +153,9 @@ static enum eos po_to(void) // if no comma found, use default file format if (Input_accept_comma() == FALSE) { if (outputfile_prefer_cbm_format()) { - // output deprecation warning - Throw_warning("Used \"!to\" without file format indicator. Defaulting to \"cbm\"."); + // output deprecation warning (unless user requests really old behaviour) + if (config.wanted_version > VER_DEPRECATE_REALPC) + Throw_warning("Used \"!to\" without file format indicator. Defaulting to \"cbm\"."); } return ENSURE_EOS; } @@ -589,10 +590,18 @@ static enum eos po_align(void) // not using a block is no longer allowed static void old_offset_assembly(void) { - if (config.wanted_version >= VER_DISABLED_OBSOLETE_STUFF) - Throw_error("\"!pseudopc/!realpc\" is obsolete; use \"!pseudopc {}\" instead."); - else + // really old versions allowed it + if (config.wanted_version < VER_DEPRECATE_REALPC) + return; + + // then it was deprecated + if (config.wanted_version < VER_DISABLED_OBSOLETE_STUFF) { Throw_first_pass_warning("\"!pseudopc/!realpc\" is deprecated; use \"!pseudopc {}\" instead."); + return; + } + + // now it's obsolete + Throw_error("\"!pseudopc/!realpc\" is obsolete; use \"!pseudopc {}\" instead."); // FIXME - amend msg, tell user how to use old behaviour! } // start offset assembly @@ -625,7 +634,7 @@ static enum eos po_pseudopc(void) pseudopc_start(&new_pc); // if there's a block, parse that and then restore old value! if (Parse_optional_block()) { - pseudopc_end(TRUE); // restore old state + pseudopc_end(); // restore old state } else { old_offset_assembly(); } @@ -637,7 +646,7 @@ static enum eos po_pseudopc(void) static enum eos po_realpc(void) { old_offset_assembly(); - pseudopc_end(FALSE); // restore old state, if possible + pseudopc_end(); // restore old state return ENSURE_EOS; } diff --git a/src/version.h b/src/version.h index 4250749..c009084 100644 --- a/src/version.h +++ b/src/version.h @@ -9,7 +9,7 @@ #define RELEASE "0.96.5" // update before release FIXME #define CODENAME "Fenchurch" // update before release -#define CHANGE_DATE "30 May" // update before release FIXME +#define CHANGE_DATE "31 May" // update before release FIXME #define CHANGE_YEAR "2020" // update before release //#define HOME_PAGE "http://home.pages.de/~mac_bacon/smorbrod/acme/" #define HOME_PAGE "http://sourceforge.net/p/acme-crossass/" // FIXME