Mercurial > hg > index.cgi
changeset 379:d791d47afc48
Add m80ext pragma for Macro-80C compatibility and ignore END in includes
For compatibility with Macro-80C source, add pragma for it. Also implement
ignoring END in include files rather than treating it as the total end of
assembly.
Thanks to Erik G <erik@6809.org> for the patch.
author | William Astle <lost@l-w.ca> |
---|---|
date | Mon, 13 Jul 2015 20:59:02 -0600 |
parents | b0ec15f95563 |
children | 17fcd0c3ee45 |
files | lwasm/input.c lwasm/input.h lwasm/lwasm.h lwasm/pragma.c lwasm/pseudo.c |
diffstat | 5 files changed, 19 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/lwasm/input.c Mon Jul 13 20:56:48 2015 -0600 +++ b/lwasm/input.c Mon Jul 13 20:59:02 2015 -0600 @@ -82,6 +82,11 @@ struct ifl *ifl_head = NULL; +int input_isinclude(asmstate_t *as) +{ + return IS->type == input_type_include; +} + static int input_isabsolute(const char *s) { #if defined(WIN32) || defined(WIN64)
--- a/lwasm/input.h Mon Jul 13 20:56:48 2015 -0600 +++ b/lwasm/input.h Mon Jul 13 20:59:02 2015 -0600 @@ -38,6 +38,7 @@ char *input_readline(asmstate_t *as); char *input_curspec(asmstate_t *as); FILE *input_open_standalone(asmstate_t *as, char *s, char **rfn); +int input_isinclude(asmstate_t *as); struct ifl {
--- a/lwasm/lwasm.h Mon Jul 13 20:56:48 2015 -0600 +++ b/lwasm/lwasm.h Mon Jul 13 20:59:02 2015 -0600 @@ -98,7 +98,8 @@ PRAGMA_CD = 1 << 17, // enable detailed cycle count PRAGMA_CT = 1 << 18, // enable cycle count running total PRAGMA_CC = 1 << 19, // clear cycle count running total - PRAGMA_QRTS = 1 << 20 // enable BRA ?RTS support + PRAGMA_QRTS = 1 << 20, // enable BRA ?RTS support + PRAGMA_M80EXT = 1 << 21 // enable Macro-80C assembler extensions }; enum
--- a/lwasm/pragma.c Mon Jul 13 20:56:48 2015 -0600 +++ b/lwasm/pragma.c Mon Jul 13 20:59:02 2015 -0600 @@ -69,6 +69,7 @@ { "cd", "nocd", PRAGMA_CD }, { "ct", "noct", PRAGMA_CT }, { "qrts", "noqrts", PRAGMA_QRTS }, + { "m80ext", "nom80ext", PRAGMA_M80EXT }, { 0, 0, 0 } };
--- a/lwasm/pseudo.c Mon Jul 13 20:56:48 2015 -0600 +++ b/lwasm/pseudo.c Mon Jul 13 20:59:02 2015 -0600 @@ -95,9 +95,13 @@ { lw_expr_t addr; - as -> endseen = 1; l -> len = 0; - + + if (CURPRAGMA(l, PRAGMA_M80EXT) && input_isinclude(as)) + return; /* ignore END inside includes */ + + as->endseen = 1; + if (as -> output_format != OUTPUT_DECB) { skip_operand(p); @@ -123,7 +127,10 @@ EMITFUNC(pseudo_emit_end) { lw_expr_t addr; - + + if (CURPRAGMA(l, PRAGMA_M80EXT) && input_isinclude(as)) + return; /* ignore END inside includes */ + addr = lwasm_fetch_expr(l, 0); if (addr)