diff lwasm/lwasm.c @ 380:17fcd0c3ee45

Allow multibyte ascii constants in m80ext mode Allow multibyte ascii constants using ' in m80ext mode, with the allowed size depending on the actual size of the register being referenced. Thanks to Erik G <erik@6809.org> for the patch.
author William Astle <lost@l-w.ca>
date Mon, 13 Jul 2015 21:04:39 -0600
parents 35d4213e6657
children 80d615a6642c
line wrap: on
line diff
--- a/lwasm/lwasm.c	Mon Jul 13 20:59:02 2015 -0600
+++ b/lwasm/lwasm.c	Mon Jul 13 21:04:39 2015 -0600
@@ -520,6 +520,28 @@
 		return lw_expr_build(lw_expr_type_int, v);
 	}
 	
+	/* double ASCII constant, like LDD #'MG */
+	if (CURPRAGMA(as->cl, PRAGMA_M80EXT))
+	{
+		if (((**p == '"') || (**p == '\'')) && (as->cl->genmode == 16))
+		{
+			int v;
+			(*p)++;
+			if (!**p)
+				return NULL;
+			if (!*((*p) + 1))
+				return NULL;
+			v = (unsigned char) **p << 8 | (unsigned char) *((*p) + 1);
+			(*p) += 2;
+
+			if ((**p == '"') || (**p == '\''))
+				(*p)++;
+
+			return lw_expr_build(lw_expr_type_int, v);
+		}
+	}
+
+	/* single ASCII constant, like LDA #'E */
 	if (**p == '\'')
 	{
 		int v;