shithub: rgbds

Download patch

ref: 2b839fec37404869ebb233674c1c007f4f61c9a7
parent: 513d451710bad2c0fcd7039aea9f5a3b19482b43
author: stag019 <[email protected]>
date: Wed Dec 31 08:29:24 EST 2014

Use the options parameter provided for command line options. Specifically, for haltnop.

--- a/include/asm/main.h
+++ b/include/asm/main.h
@@ -8,6 +8,7 @@
 	char binary[2];
 	SLONG fillchar;
 	bool verbose;
+	bool haltnop;
 	    //-1 == random
 };
 
--- a/src/asm/asmy.y
+++ b/src/asm/asmy.y
@@ -1,7 +1,6 @@
 %{
 #include <ctype.h>
 #include <errno.h>
-#include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -18,8 +17,6 @@
 #include "asm/main.h"
 #include "asm/lexer.h"
 
-extern bool haltnop;
-
 char	*tzNewMacro;
 ULONG	ulNewMacroSize;
 
@@ -1264,7 +1261,7 @@
 z80_halt: T_Z80_HALT
 		{
 			out_AbsByte(0x76);
-			if (haltnop) {
+			if (CurrentOptions.haltnop) {
 				out_AbsByte(0x00);
 			}
 		}
--- a/src/asm/main.c
+++ b/src/asm/main.c
@@ -7,7 +7,6 @@
 
 #include <math.h>
 #include <stdarg.h>
-#include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -30,8 +29,6 @@
  *
  */
 
-bool haltnop;
-
 clock_t nStartClock, nEndClock;
 SLONG nLineNo;
 ULONG nTotalLines, nPass, nPC, nIFDepth, nErrors;
@@ -260,8 +257,8 @@
 
 	char *tzMainfile;
 
-	haltnop = true;
 
+
 	if (argc == 1)
 		PrintUsage();
 
@@ -275,6 +272,7 @@
 	DefaultOptions.binary[1] = '1';
 	DefaultOptions.fillchar = 0;
 	DefaultOptions.verbose = false;
+	DefaultOptions.haltnop = true;
 
 	opt_SetCurrentOptions(&DefaultOptions);
 
@@ -303,7 +301,7 @@
 			}
 			break;
 		case 'h':
-			haltnop = false;
+			newopt.haltnop = false;
 			break;
 		case 'i':
 			fstk_AddIncludePath(optarg);