changeset 473:8181ddd707f1

Add "nooutput" pragma Add the "nooutput" pragma which causes assembly to proceed as normal for code with the exception that no output is generated for any instructions under this pragma. The current address is increased as usual and the symbol table is still constructed. However, no actual output is generated for lines operating under this pragma.
author William Astle <lost@l-w.ca>
date Thu, 01 Nov 2018 23:07:03 -0600
parents e97f9a302c6a
children 74d0c394666e
files lwasm/lwasm.c lwasm/lwasm.h lwasm/pragma.c
diffstat 3 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lwasm/lwasm.c	Thu Nov 01 23:00:00 2018 -0600
+++ b/lwasm/lwasm.c	Thu Nov 01 23:07:03 2018 -0600
@@ -436,6 +436,8 @@
 
 void lwasm_emit(line_t *cl, int byte)
 {
+	if (CURPRAGMA(cl, PRAGMA_NOOUTPUT))
+		return;
 	if (cl -> as -> output_format == OUTPUT_OBJ && cl -> csect == NULL)
 	{
 		lwasm_register_error(cl -> as, cl, E_INSTRUCTION_SECTION);
--- a/lwasm/lwasm.h	Thu Nov 01 23:00:00 2018 -0600
+++ b/lwasm/lwasm.h	Thu Nov 01 23:07:03 2018 -0600
@@ -108,6 +108,7 @@
 	PRAGMA_NEWSOURCE			= 1 << 24,	// don't use compatibility source format
 	PRAGMA_OPERANDSIZE			= 1 << 25,	// warn if operand size is bigger than required
 	PRAGMA_EMUEXT				= 1 << 26,  // enable emulator extensions
+	PRAGMA_NOOUTPUT             = 1 << 27,  // disable object code output
 	PRAGMA_CLEARBIT				= 1 << 31	// reserved to indicate negated pragma flag status
 };
 
--- a/lwasm/pragma.c	Thu Nov 01 23:00:00 2018 -0600
+++ b/lwasm/pragma.c	Thu Nov 01 23:07:03 2018 -0600
@@ -76,6 +76,7 @@
 	{ "nooldsource", "oldsource", PRAGMA_NEWSOURCE },
 	{ "operandsizewarning", "nooperandsizewarning", PRAGMA_OPERANDSIZE },
 	{ "emuext", "noemuext", PRAGMA_EMUEXT },
+	{ "nooutput", "output", PRAGMA_NOOUTPUT },
 	{ 0, 0, 0 }
 };