shithub: scc

Download patch

ref: ae4c6ad84253a38cb453fd4432a029262954bd69
parent: 0fe5edeb017c23009e9d673361509923a43ac381
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Sat Dec 16 16:27:04 EST 2017

[as] Add end pseudo instruction

This pseudo instruction finishes the processing of the current
file. It allows to add free format comments after it.

--- a/as/as.h
+++ b/as/as.h
@@ -195,3 +195,4 @@
 extern int endian;
 extern Symbol *linesym, *symlist;
 extern char *infile;
+extern int endpass;
--- a/as/ins.c
+++ b/as/ins.c
@@ -235,3 +235,9 @@
 	for (al = pc - curpc; al > 0; --al)
 		emit((char []) {0}, 1);
 }
+
+void
+end(Op *op, Node **args)
+{
+	endpass = 1;
+}
--- a/as/main.c
+++ b/as/main.c
@@ -12,6 +12,7 @@
 
 char *argv0;
 char *outfile, *infile;
+int endpass;
 
 
 static void
@@ -77,8 +78,9 @@
 		die("as: error opening '%s'", fname);
 	cleansecs();
 
+	endpass = 0;
 	setjmp(recover);
-	while (nextline(fp, &line)) {
+	while (!endpass && nextline(fp, &line)) {
 		linesym = NULL;
 
 		if (line.label)
--- a/as/target/x80/x80.dat
+++ b/as/target/x80/x80.dat
@@ -31,6 +31,7 @@
 .STRING	string+	0	none	string	Z80,R800,GB80
 .ASCII	string+	0	none	ascii	Z80,R800,GB80
 .ALIGN	imm16+	0	none	align	Z80,R800,GB80
+.END	none	0	none	end	Z80,R800,GB80
 
 NOP	none	1	0x00	noargs	Z80,R800,GB80
 EI	none	1	0xfb	noargs	Z80,R800,GB80