changeset 552:f9ffd1935cee

Add explicit immediate mode to register list instructions (PSHS, etc.) There is actual code in the wild that wants to use things like PSHS #0 which are valid 6809 instructions and actually listed in the literature. So add the capability to do so.
author William Astle <lost@l-w.ca>
date Fri, 30 Jun 2023 09:40:17 -0600
parents 4ec5c94ade71
children 3a173cefc814
files lwasm/insn_rlist.c
diffstat 1 files changed, 17 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lwasm/insn_rlist.c	Sun Apr 23 10:23:43 2023 -0600
+++ b/lwasm/insn_rlist.c	Fri Jun 30 09:40:17 2023 -0600
@@ -27,12 +27,23 @@
 #include "lwasm.h"
 #include "instab.h"
 
+PARSEFUNC(insn_parse_imm8);
+EMITFUNC(insn_emit_imm8);
+
 PARSEFUNC(insn_parse_rlist)
 {
 	int rb = 0;
 	int rn;
 	static const char *regs = "CCA B DPX Y U PCD S ";
 
+	l -> lint = 0;
+	if (**p == '#')
+	{
+		insn_parse_imm8(as, l, p);
+		l -> lint = 1;
+		return;
+	}
+
 	while (**p && !isspace(**p) && **p != ';' && **p != '*')
 	{
 		rn = lwasm_lookupreg2(regs, p);
@@ -84,6 +95,12 @@
 
 EMITFUNC(insn_emit_rlist)
 {
+	if (l -> lint == 1)
+	{
+		insn_emit_imm8(as, l);
+		return;
+	}
+
 	lwasm_emitop(l, instab[l -> insn].ops[0]);
 	lwasm_emit(l, l -> pb);